Metadata-Version: 2.4
Name: turkservis-cli
Version: 1.10.24
Summary: Official command-line client for the public TurkServis API
Author: TurkServis
License-Expression: MIT
Project-URL: Homepage, https://turkservis.online
Project-URL: API, https://ai.turkservis.online/v1
Requires-Python: <3.14,>=3.11
Description-Content-Type: text/markdown
Requires-Dist: cryptography<50,>=49
Requires-Dist: httpx<1,>=0.27
Requires-Dist: keyring<26,>=25
Requires-Dist: mcp==2.1.1
Requires-Dist: openai<2,>=1
Requires-Dist: platformdirs<5,>=4
Requires-Dist: playwright<1.62,>=1.61
Requires-Dist: prompt_toolkit==3.0.52
Requires-Dist: rich<15,>=13
Requires-Dist: tomlkit<1,>=0.13
Requires-Dist: typer<1,>=0.12
Provides-Extra: test
Requires-Dist: pytest<10,>=8; extra == "test"

# AITURK

The canonical command-line client for the public TurkServis API.

- API: `https://ai.turkservis.online/v1`
- Account portal: `https://turkservis.online`
- Python: CPython 3.11, 3.12 or 3.13 with pip
- Credentials: `TURKSERVIS_API_KEY` or the operating-system credential store

The CLI never accepts a member key as a command-line argument and never writes
one to its JSON preferences. Browser login exchanges a short-lived callback
code over HTTPS and saves the resulting key through the operating-system
keyring.

## Install for development

Use an isolated environment so this source checkout does not alter global
Python packages:

```console
python -m venv .venv
.venv/Scripts/python -m pip install -e ".[test]"  # Windows
# .venv/bin/python -m pip install -e ".[test]"   # macOS/Linux
```

## Sign in

```console
aiturk login
aiturk doctor
```

For an ephemeral CI session, set `TURKSERVIS_API_KEY` in the runner's secret
store instead of using browser login. The environment variable takes priority
over the OS keyring.

## Commands

Running `aiturk` without arguments in a real terminal opens the AITURK workspace
before authentication or network access. Press F2 or type `/login` to enter a
masked API key inside the workspace. `/model` opens the live model selector;
`/project PATH` changes the project. Enter starts an OpenCode coding session
with the message you typed. Escape cancels login without losing that message,
and Ctrl+D exits. The coding runtime must be installed to start an agent session.

Scripts and redirected input retain the noninteractive help behavior. Explicit
commands such as `aiturk login`, `aiturk version`, and `aiturk agent` remain
available.

| Command | Purpose |
| --- | --- |
| `aiturk` | Open the workspace, sign in and select a model inside it |
| `aiturk login` | Browser login with a loopback one-time-code callback |
| `aiturk logout` | Delete the saved key from the OS keyring |
| `aiturk chat [PROMPT]` | One-shot or interactive streaming chat |
| `aiturk models --format json` | Discover live models and teams |
| `aiturk fusion QUESTION --model MODEL --effort EFFORT` | One-shot named Fusion consultation |
| `aiturk agent PROJECT --model MODEL --effort EFFORT` | Interactive local coding agent using the OpenCode runtime |
| `aiturk hedef GOAL --project PROJECT ...` | Continue a managed goal with OpenCode |
| `aiturk account` | Show balance and usage from `/v1/me` |
| `aiturk doctor` | Check the public URL, credential, and API connection |
| `aiturk remote --help` | Pair, enable, drain, disable, diagnose, or run AITURK Remote |
| `aiturk version` | Show the installed package version |

Persistent package, keyring and configuration identifiers retain the internal
`turkservis` namespace for safe upgrades; they are not additional CLI commands.

## AITURK Remote

Remote is installed **off** and starts only after explicit device pairing and
`aiturk remote enable`. Its device token and per-run local IPC capability are
stored only in the operating-system credential vault; neither is accepted as a
CLI argument, environment variable, JSON preference, or log field.

```console
aiturk remote doctor --format json
aiturk remote pair --device-name "Masaustu" --format json
aiturk remote status --refresh --format json
aiturk remote enable --format json
aiturk remote install-service --format json          # dry-run preview
aiturk remote install-service --apply --format json  # current-user hidden task
```

The runtime binds only `127.0.0.1` on an OS-selected port, requires a random
capability, and observes only projects/sessions explicitly registered through
that local IPC. It never scans terminal screens, chat history, or the process
list. Project roots are canonicalized locally; equal, parent, and child mapping
overlaps fail closed. Only a device-keyed `hmac-sha256-v1` root fingerprint may
leave the device, never the clear local path.

Every Remote command supports a stable `--format json` envelope:
`schema_version`, `ok`, `command`, and either `data` or a redacted `error`.
Machine-readable JSON is the only stdout content; human diagnostics go to
stderr. `drain` rejects new work, while `disable` is refused until active leases
are gone. This first runtime slice performs no automatic coding or file sync.

## Local assist engine

Codex, Claude, and Hermes use the local `aiturk` CLI. TurkServis/Fusion
is not installed or exposed as an AI-facing MCP integration. The primary model
chooses the exact Fusion model, independent effort, task order, retries, and
termination policy.

One-shot advice and a full local agent are deliberately separate:

```console
aiturk fusion "Check this design" --model Sonnet5-Fusion --effort low --format json
aiturk chat "Run this leaf task" --model ALT --format json
aiturk agent run --project . --goal "Implement and test the requested change" --model Opus5-Fusion --effort high --format json
```

AITURK has one user-facing coding runtime: its bundled, integrity-checked
OpenCode-based TUI. Bare `aiturk`, `aiturk agent`, and local
`aiturk hedef` execution all use that same runtime and visual surface. There is
no automatic runtime switch and no `--runtime` option.

```console
aiturk agent . --model LIVE_MODEL --effort high
aiturk agent run --project . --goal "Implement and test the change" --model LIVE_MODEL --format json
```

The runtime operates in the exact project root and can read, research, edit,
run commands, and test.
`--auto` remains limited to explicitly authorized unattended in-project work;
external-directory access remains denied.

`hedef` adds the project-management contract on top of the same agent runtime.
All management instructions use the canonical `aiturk` command name:

```console
aiturk hedef "Implement and verify the checkout fix" --project . --model LIVE_MODEL --effort high
```

It routes management and worker roles through TurkServis only, asks the project
manager hierarchy to coordinate plans, and keeps a reusable task id for a later
resume. A single invocation runs until the agent exits; after a process or
machine interruption, rerun with the reported `--task-id` to continue from the
project's existing evidence.

Readable chat transcripts are never newly written to a global session folder.
They are appended only when an existing `Proje Genel Müdür/Notlar/Sohbetler`
path can be resolved from `--project` (or the current directory). If that
management root does not exist, chat still works but transcript persistence is
skipped.

The older assist engine remains available for bounded workflows:

```console
turkservis assist diagnose --project . --goal "Find the failing payment test"
turkservis assist verify --project . --goal "Verify the proposed fix" --max-workers 20 --format json
```

Local file search and test execution do not use model tokens. Remote advice
and research use the member's TurkServis allowance. Separate CLI processes carrying the same
parent task id share one 20-slot local lease pool; nested work cannot multiply
that limit.

The remote service cannot read the disk. The CLI selects bounded evidence locally,
redacts credentials, and sends only the relevant excerpts. General users may
choose broader profiles; this PC's `hermes-worker` profile is limited to
`C:\Users\kaan\Desktop\Projelerimiz` and requires a task capability before
workspace writes.

## Test

```console
python -m pytest -q
```
