AI Chat and Code
This is the bundled free-model frontend, separate from My AI Example. It uses the packaged tools/ai/chat_ai.py and tools/ai/code_ai.py backends. Provider credentials are supplied separately by the user.
AI Chat and Code
The AI window matches the editor’s charcoal theme, blue accents, compact controls, and UI font family, with Chat/Code navigation and a bottom composer, styled user/assistant cards, lightweight Markdown and code blocks, removable attachment chips, and a welcome screen with draft starters. Enter sends; Shift+Enter inserts a newline. The composer clears only after a request starts; a failed start preserves the draft. AI fonts/styles are isolated from editor settings. The sidebar collapses in narrow windows; More keeps Copy, Reset, Refresh models and Help accessible. Reset context clears model history while keeping displayed messages available to copy. Copy preserves original Markdown and code text even when formatting markers are hidden in the chat display.
Conversation preview · Welcome preview · Narrow-window preview. These previews use offline example messages; no provider request was sent.
Open Extensions → AI Chat… or AI Code…. The window has Chat/Code and Ask/Team selectors. Ask requires one model and a question. Team shows a lead selector and worker list; Ctrl-click workers from different developers, then enter the task. Workers run in displayed order. Refresh models reloads available models. Requests run in a separate process; Cancel stops that process.
Attach current document sends a snapshot including unsaved edits. Attach files adds UTF-8 files. Attachments remain until cleared; no document is sent implicitly. Replies appear in the output pane and never overwrite a document. Copy conversation copies the retained visible prompts, replies and team output, excluding hidden attachment text. Solo histories are separate per mode/model; the latest six turns are stored during the session, and Reset conversations clears them. Requests send only the recent complete turns that fit the active fast profile. Omitted history is noted in the transcript; earlier visible conversation remains copyable. Team runs are independent.
The plugin uses these conservative fast presets, rather than claiming a universal optimum for every model:
| Limit | Chat | Code |
|---|---|---|
| Task + attachments, UTF-8 | 4 KiB | 12 KiB Ask / 6 KiB Team |
| Requested reply cap | 512 tokens | 1,536 tokens |
| Outgoing history | Up to 2 turns / 4 KiB | Up to 3 turns / 8 KiB |
| Attachments | 2 | 4 |
| Team workers, excluding lead | 2 | 2 |
| Ask timeout | 60 seconds | 120 seconds |
| Team timeout | 120 seconds | 180 seconds |
The active limits and input usage are shown in the AI window. Input byte counts include prompt, file headers and separators. Oversized tasks/files are rejected with an explanation, preserving the prompt and previous attachments. Large files are read only up to a bounded size. A team request whose source plus Python syntax check metadata exceeds the backend source budget is rejected before model calls. Existing provider-size retry behavior may shorten team context with a visible backend notice. Reply caps can leave large answers incomplete; Code asks for focused patches rather than full-file rewrites. Timeouts stop the local request process and keep displayed partial output. Model discovery has a 45-second limit. The shared command-line scripts are not changed; the GUI bridge supplies reply caps at runtime to solo, planning, worker and final-answer calls.
Ask makes fewer model calls than Team. These presets target smaller requests and shorter replies; actual latency depends on the model/provider. No live-provider speed benchmark was performed. General rationale: OpenAI latency optimization.
The plugin uses tools/ai/chat_ai.py and tools/ai/code_ai.py and their shared credentials. Configure keys and Free plan confirmations via /keys in either script before use. Launch the editor again, or select Load New Plugins. No API request is made until opening the assistant (model discovery) or Send. Run offline coverage with python3 -B -m unittest -v test_ai_assistant on a desktop.
AI capabilities and provider failures
The AI backend now receives explicit instructions that Pocket Editor supplies only prompt/history/attached text. It has no tools to browse a project, read files on its own, write files, inspect the machine, run commands/tests, or commit changes. It may explain attachments and propose patches for the user to apply. Any model claim of direct local access is incorrect; model-generated claims do not grant capabilities. Earlier misleading replies are not proof of tool access.
The normal fast reply caps remain 512 Chat / 1,536 Code tokens. If a model returns an empty visible reply, the plugin retries that same call once, with up to 2,048 Chat / 3,072 Code output/reasoning tokens. A notice appears before the retry. This can help reasoning models that exhaust a small output budget, but does not guarantee success and may use an extra request/quota. No hidden reasoning is shown as the final answer. A second empty result produces a readable error.
HTTP 429 is not automatically retried. The UI displays a provider rate-limit message, preserves the draft when sending is blocked, and pauses new requests using that provider for its Retry-After interval when available (at most one day) or 30 seconds otherwise. The pause is local and cannot reset a provider's quota; actual free-tier/shared-provider limits can last longer. Select a different provider or wait. Provider messages do not expose raw Python tracebacks. Failed team planning/finalization is marked as failed even when the command-line backend catches the exception; worker-only failures allow a partial result with an explicit status. A successful size-limit retry does not leave a stale failure.
Replies and team logs use structured text events, so answer lines that resemble protocol markers cannot be mistaken for model lists or history records. Normal fast limits, Copy, the chat theme and Stop remain in place. Shared backend scripts were not modified.
Sources: OpenRouter reasoning/output budgets, OpenRouter error handling. Verification used offline transports, not live provider requests; provider quota recovery and the reported models' current availability remain unverified.
Full reply display
The current assistant/team reply is preserved while older transcript content is trimmed toward 200,000 characters. Reply tokens → Auto retains the conservative defaults. Choose an explicit cap up to 8,192 when a longer reply is needed; this can increase usage. A larger cap does not override provider quotas or timeouts. No automatic continuation request is made.