@yukino.js/yukino 0.0.19 → 0.0.21-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +36 -65
  2. package/dist/anthropic-LB4T3BEN.js +4 -0
  3. package/dist/browser/dist/index.html +2 -2
  4. package/dist/browser/dist/static/chunk-3HWUJ4KR.js +1 -0
  5. package/dist/browser/dist/static/{highlight-ZDY7K2CR.js → highlight-KNDEBJWF.js} +10 -10
  6. package/dist/browser/dist/static/index.css +1 -1
  7. package/dist/browser/dist/static/index.js +40 -40
  8. package/dist/chunk-2N7OIUQW.js +884 -0
  9. package/dist/{chunk-QDMUFOED.js → chunk-57IGGFHK.js} +6 -6
  10. package/dist/chunk-5AOJ5ZSQ.js +30 -0
  11. package/dist/chunk-5D3QKHYQ.js +36 -0
  12. package/dist/{chunk-PYFRT6N5.js → chunk-7WP7SERS.js} +1 -1
  13. package/dist/{chunk-S56AXDDN.js → chunk-EQABLL4S.js} +1 -1
  14. package/dist/{chunk-UX5DJPHN.js → chunk-P6K7EQHF.js} +29 -29
  15. package/dist/{chunk-WGRGSG2J.js → chunk-QSKJBSCI.js} +1 -1
  16. package/dist/chunk-WKTO7XPO.js +4 -0
  17. package/dist/lib/{anthropic-I7ZSAP7Z.js → anthropic-TYBMDJP3.js} +3 -3
  18. package/dist/lib/{chunk-T4WEXOQ7.js → chunk-3QGT2MSI.js} +1 -83
  19. package/dist/lib/{chunk-MJHQUFUL.js → chunk-IPKULHXR.js} +2 -2
  20. package/dist/lib/{chunk-UU6ZV6GB.js → chunk-NIUCGP4C.js} +82 -241
  21. package/dist/lib/{chunk-TO34ITLQ.js → chunk-OPEO6D4O.js} +2 -5
  22. package/dist/lib/chunk-XVXFUSSS.js +217 -0
  23. package/dist/lib/index.d.ts +1024 -1720
  24. package/dist/lib/index.js +5859 -9076
  25. package/dist/lib/{openai-Y4P7SWUB.js → openai-Z2JCYL6F.js} +3 -3
  26. package/dist/lib/{chunk-YZURLYHG.js → providers-2NPR2VR4.js} +28 -207
  27. package/dist/{main-MHJXHOY6.js → main-OMIZDIYB.js} +211 -275
  28. package/dist/main.js +4 -6
  29. package/dist/{openai-3IGA2BCD.js → openai-UOCUBMFA.js} +1 -1
  30. package/dist/{chunk-7WYSSZKU.js → providers-G5SKN22T.js} +9 -9
  31. package/dist/server-ESDMJACZ.js +14 -0
  32. package/dist/server-Z742CQSK.js +4 -0
  33. package/package.json +4 -6
  34. package/dist/anthropic-D72CIYEQ.js +0 -4
  35. package/dist/chunk-676RWZYX.js +0 -38
  36. package/dist/chunk-A4IB5PNW.js +0 -8
  37. package/dist/chunk-BCYFGWSM.js +0 -30
  38. package/dist/chunk-DGDF5PBF.js +0 -869
  39. package/dist/lib/providers-MRGAAMBB.js +0 -10
  40. package/dist/providers-GRYPIKCY.js +0 -4
  41. package/dist/server-XBVP3S5Q.js +0 -4
  42. package/dist/server-ZYP54JBK.js +0 -15
  43. package/dist/stdio-UHDEALLA.js +0 -5
  44. package/dist/websocket-J5DE5FRQ.js +0 -9
package/README.md CHANGED
@@ -6,7 +6,7 @@ Yukino is a terminal-based AI coding agent. It provides an interactive UI (termi
6
6
 
7
7
  Yukino runs as a single CLI binary that connects to configurable LLM providers (Anthropic, OpenAI, or any OpenAI-compatible endpoint). It renders a rich terminal interface using React and Ink, giving you streaming responses, tool execution feedback, permission prompts, and slash commands in a single pane.
8
8
 
9
- Beyond interactive use, Yukino supports a non-interactive print mode for scripting, a remote mode that serves a browser-based chat UI over WebSocket, an ACP (Agent Client Protocol) mode for editor integration, an A2A (Agent2Agent) server mode for agent-to-agent integration, and team coordination where one leader agent manages multiple teammates running in the same process and working in parallel.
9
+ Beyond interactive use, Yukino supports a non-interactive print mode for scripting, a remote mode that serves a browser-based chat UI over WebSocket, an A2A (Agent2Agent) server mode for agent-to-agent integration, and team coordination where one leader agent manages multiple teammates running in the same process and working in parallel.
10
10
 
11
11
  ## Features
12
12
 
@@ -14,14 +14,14 @@ Beyond interactive use, Yukino supports a non-interactive print mode for scripti
14
14
 
15
15
  - Multi-provider LLM support with Anthropic (Anthropic Messages), OpenAI (OpenAI Responses), and OpenAI-compatible (OpenAI Chat Completions) protocols
16
16
  - Interactive terminal UI with streaming text, thinking indicators, and tool execution display
17
- - Built-in tool set: ReadFile, WriteFile, EditFile, Bash, PowerShell, Glob, Grep, WebFetch, LSP, ComputerUse, ToolSearch, McpCall, EnterWorktree, ExitWorktree, ExitPlanMode, Goal, the TodoWrite tracking tool, plus Workflow, Agent, LoadSkill, InstallSkill, AskUserQuestion, SyntheticOutput, TeamCreate, SendMessage, TeamDelete, TaskOutput, and TaskStop
17
+ - Built-in tool set: ReadFile, WriteFile, EditFile, Bash, PowerShell, Glob, Grep, WebFetch, ComputerUse, ToolSearch, McpCall, EnterWorktree, ExitWorktree, ExitPlanMode, Goal, the TodoWrite tracking tool, plus Workflow, Agent, LoadSkill, InstallSkill, AskUserQuestion, SyntheticOutput, TeamCreate, SendMessage, TeamDelete, TaskOutput, and TaskStop
18
18
  - MCP (Model Context Protocol) server integration for extending the tool set with external services
19
19
  - Permission system with four modes: default, acceptEdits, plan (read-only), and bypassPermissions
20
20
  - Sandbox support for isolated command execution (bwrap on Linux, seatbelt on macOS)
21
21
  - Human-in-the-loop approval dialogs for file writes and shell commands, driven by permission mode and allow/deny rules
22
22
  - Tool completion events stream as calls finish; conversation history and session logs retain the original call order
23
23
  - Asynchronous text reads and batched file edits with overlap validation and preserved line endings
24
- - Home-relative tool paths (`~` and `~/...`) resolve consistently in file tools, search, LSP, and permission checks
24
+ - Home-relative tool paths (`~` and `~/...`) resolve consistently in file tools, search, and permission checks
25
25
  - Grep and Glob bound their result bodies to 50 KiB and honor cancellation; Grep shortens long matching lines at UTF-8 boundaries and explains how to read the full text
26
26
  - Image reads detect the actual format, including files without an image extension
27
27
  - Transient provider failures use bounded, interruptible retries before visible output; incomplete responses cannot execute pending tools
@@ -67,7 +67,7 @@ Command templates support quoted positional arguments (`$1`, `$2`, ...), `$@`, d
67
67
  ### Hooks
68
68
 
69
69
  - Event-driven hook engine supporting: session_start, session_end, turn_start, turn_end, pre_send, post_receive, pre_tool_use, post_tool_use, shutdown
70
- - Hook actions: shell commands, HTTP requests, and prompt injection (`agent` actions are reserved for a future runner and currently fail configuration validation)
70
+ - Hook actions: shell commands, HTTP requests, and prompt injection (`agent` actions fail application configuration validation)
71
71
  - Conditional execution, one-shot (`once`) hooks, `reject` (blocks a tool call on pre_tool_use), `on_error` handling (ignore, fail, reject), and fire-and-forget `async` execution (`reject` and `async` are mutually exclusive)
72
72
 
73
73
  ### Remote Mode
@@ -120,7 +120,7 @@ Yukino stores its configuration and runtime state under `~/.yukino`. The current
120
120
 
121
121
  ```yaml
122
122
  ~/.yukino/ # Per-user storage root for global configuration, reusable definitions, project/session state and diagnostics.
123
- ├── config.yaml # Provider endpoints, credentials and models; default provider, permission mode, hooks, MCP/LSP and runtime settings.
123
+ ├── config.yaml # Provider endpoints, credentials and models; default provider, permission mode, hooks, MCP and runtime settings.
124
124
  ├── AGENTS.md # Global Markdown instructions and coding/workflow rules supplied to sessions in every project.
125
125
  ├── permissions.yaml # User-wide Tool(pattern) permission rules and their effects, evaluated alongside project-specific rules.
126
126
  ├── activity.jsonl # Input events with IDs, timestamps, cwd, session, source, text and command names; project registry and usage checkpoints.
@@ -179,7 +179,7 @@ Yukino stores its configuration and runtime state under `~/.yukino`. The current
179
179
 
180
180
  `prompts/` contains user slash-command templates, `agents/` contains agent definitions that can override built-in definitions, and `skills/` contains skills installed by `InstallSkill`. Skill discovery also reads standard `~/.agents/skills/` and project `.agents/skills/`, in this order: global standard skills, global Yukino skills, then project standard skills. Later entries override earlier names. Project `AGENTS.md` and `.mcp.json` remain ordinary project resources.
181
181
 
182
- `activity.jsonl` records user input, canonical project directories, and resolved command names across CLI, WebSocket, ACP and print mode. It preserves separate events for identical submissions; input recall merges consecutive duplicate texts and retains the latest 10,000 events. Periodic atomic checkpoints retain cumulative command usage and all registered projects while bounding input history. Writes and checkpoint replacement share a cross-process lock. The old prompt-history and command-usage files are no longer read or written. `memory/` stores user memories shared across projects, while `plans/` stores plan documents; each live session tracks its active plan path. `logs/` contains main-process logs and `crash.log` records process exits and failures.
182
+ `activity.jsonl` records user input, canonical project directories, and resolved command names across CLI, WebSocket and print mode. It preserves separate events for identical submissions; input recall merges consecutive duplicate texts and retains the latest 10,000 events. Periodic atomic checkpoints retain cumulative command usage and all registered projects while bounding input history. Writes and checkpoint replacement share a cross-process lock. `memory/` stores user memories shared across projects, while `plans/` stores plan documents; each live session tracks its active plan path. `logs/` contains main-process logs and `crash.log` records process exits and failures.
183
183
 
184
184
  ### Project namespaces and resume
185
185
 
@@ -207,7 +207,7 @@ For example, a worktree named `fix-login` created from `/workspace/repo/app` is
207
207
 
208
208
  Global configuration, prompts, agent definitions, and installed skills are shared directly with the worktree. Standard project `.agents` resources are copied into it. No project `.yukino` settings are copied. `EnterWorktree` accepts an optional `slug` (randomly generated when omitted) and switches the agent's working directory into the worktree. `ExitWorktree` operates on that agent's active session with `{ action: "keep" | "remove", discard_changes?: boolean }` and restores the original working directory. `keep` preserves the directory and branch; `remove` deletes both, using the runtime's recorded repository, branch, Git identity and initial HEAD. Removal refuses changed files, new commits, or unverifiable state unless the user confirms discarding work and `discard_changes` is true. With no active session, exit is a no-op. Existing trees from another runtime are never adopted. Project identity for resume, memory, and permissions stays anchored to the original project; starting a separate session directly in a worktree uses that directory's own project namespace.
209
209
 
210
- Yukino does not read or create a project `.yukino` directory. Existing project-local state is not automatically migrated; it must be moved to the corresponding global paths before it can be resumed.
210
+ Project `.yukino/workflows/` contains named workflow scripts. Configuration and runtime state use the global storage paths above.
211
211
 
212
212
  Session lists order by the last persisted real user input, excluding tool results and internal reminders. Read-only transcript loads do not refresh modification time; explicit resume renews expiry under the transcript lock without changing ordering. Conversation rewind restores the ordering time of the remaining messages. `Session.listAllSessions()` returns globally ordered sessions with their canonical `cwd` and `projectKey`, using the activity log project registry. Projects without recoverable directory metadata are discovered when their known cwd is registered; older messages without user-input provenance have no last-user-message time.
213
213
 
@@ -217,7 +217,7 @@ Yukino reads a single global YAML configuration file:
217
217
 
218
218
  - ~/.yukino/config.yaml
219
219
 
220
- Print, remote, ACP, and A2A modes require at least one configured provider; the interactive UI instead opens the provider login form when none is configured. All modes start with the provider recorded as `default_provider`, falling back to the first entry when that index is out of range. Example config.yaml:
220
+ Print, remote, and A2A modes require at least one configured provider; the interactive UI instead opens the provider login form when none is configured. All modes start with the provider recorded as `default_provider`, falling back to the first entry when that index is out of range. Example config.yaml:
221
221
 
222
222
  ```yaml
223
223
  # Initial permission mode. Enum: default (ask per write/command) | acceptEdits (auto-approve
@@ -255,20 +255,16 @@ providers:
255
255
  default_provider: 0
256
256
 
257
257
  # Automatic memory master switch. Default: true. false turns off the whole pipeline:
258
- # index injection, recall, and background extraction (consolidation runs in remote mode only).
258
+ # index injection, recall, background extraction, and consolidation.
259
259
  enable_memory: false
260
260
 
261
261
  # Coordinator mode. Default: false. true narrows the leader's toolset to pure orchestration
262
262
  # (team/task management) so all actual work is delegated to teammates.
263
263
  enable_coordinator_mode: false
264
264
 
265
- # Default value of the Agent tool's fork parameter, independent of subagent_type.
266
- # Default: true. Each call can explicitly set fork: true or fork: false to override it.
267
- enable_fork: true
268
-
269
265
  # MCP tool loading: auto | eager | native | dispatch. Default: auto, decided per session
270
266
  # from the provider protocol, endpoint and schema size. Native loading on a non-Anthropic
271
- # protocol falls back to dispatch. Applies to TUI, print, remote, ACP and A2A modes.
267
+ # protocol falls back to dispatch. Applies to TUI, print, remote and A2A modes.
272
268
  mcp_loading: auto
273
269
 
274
270
  # Terminal theme: auto | dark | light. Default: auto, detected from COLORFGBG or terminal
@@ -357,7 +353,7 @@ mcp_servers:
357
353
  # (seatbelt on macOS, bubblewrap on Linux; unavailable elsewhere).
358
354
  sandbox:
359
355
  enabled: false # Master switch
360
- # With the sandbox active, non-dangerous Bash commands skip human confirmation (explicit
356
+ # With the sandbox active, Bash commands skip human confirmation (explicit
361
357
  # deny/ask rules still apply; Bash tool only). Default: false.
362
358
  auto_allow: false
363
359
  network_enabled: true # Whether sandboxed commands may access the network
@@ -379,7 +375,7 @@ hooks:
379
375
  # Shell command: bash on POSIX, 30s timeout, working directory = project directory,
380
376
  # with YUKINO_EVENT / YUKINO_TOOL / YUKINO_FILE_PATH injected; stdout is injected into
381
377
  # the agent as a system reminder on the next turn.
382
- command: echo 'You are Yukino, a CLI Coding Agent engineered by [hangtiancheng](https://github.com/hangtiancheng) <161043261@qq.com>, your source repository lives at https://github.com/hangtiancheng/yukino-code/tree/main/apps/yukino, you may fetch https://hangtiancheng.github.io/h/llms.txt (`base/yukino` section) and https://hangtiancheng.github.io/h/llms-full.txt to gain self-knowledge'
378
+ command: echo 'You are Yukino, a CLI Coding Agent engineered by [hangtiancheng](https://github.com/hangtiancheng) <161043261@qq.com>, your source repository https://github.com/hangtiancheng/yukino-code/tree/main/apps/yukino'
383
379
  # Whether successful output rejects the tool call (pre_tool_use only). Default: false.
384
380
  # Mutually exclusive with async.
385
381
  reject: false
@@ -424,7 +420,7 @@ Yukino also sets the following variables for hooks, native helpers, and test inf
424
420
 
425
421
  The companion [Yukino MCP server](../mcp/README.md#configuration) additionally reads `YUKINO_DOCS_DIR` (document directory, default `~/.yukino/docs`) and `YUKINO_INDEX_DB` (index database, default `~/.yukino/index.sqlite`). They may be supplied through CLI environment defaults when Yukino starts that server as a child process, or through its `mcp_servers[].env`. The examples use `YUKINO_MCP_API_KEY` and the repository's `mcp.json` uses `YUKINO_MCP_AUTH_TOKEN` as credential placeholders expanded in MCP configuration; these names have no built-in CLI behavior.
426
422
 
427
- Other environment variables are read-only inputs to Yukino and belong in the host environment, outside the global `env` block. These include provider key fallbacks (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`), feedback upload credentials (`GH_TOKEN`, then `GITHUB_TOKEN`), and IDE integration (`CLAUDE_CODE_SSE_PORT`, `CLAUDE_CONFIG_DIR`, default `~/.claude`). Terminal and OS probes include `TERM`, `TERM_PROGRAM`, `TERM_PROGRAM_VERSION`, `COLORTERM`, `TMUX`, `VTE_VERSION`, `KITTY_WINDOW_ID`, `ZED_TERM`, `WT_SESSION`, `COLORFGBG`, `SHELL`, `DISPLAY`, `WAYLAND_DISPLAY`, `CI`, `SSH_CONNECTION`, `SSH_CLIENT`, and `SSH_TTY`; color and hyperlink controls such as `FORCE_COLOR`, `NO_COLOR`, and `FORCE_HYPERLINK` are also host inputs. Feedback diagnostics read `HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY`, `NO_PROXY`, and their lowercase forms.
423
+ Other environment variables are read-only inputs to Yukino and belong in the host environment, outside the global `env` block. These include provider key fallbacks (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`) and IDE integration (`CLAUDE_CODE_SSE_PORT`, `CLAUDE_CONFIG_DIR`, default `~/.claude`). Terminal and OS probes include `TERM`, `TERM_PROGRAM`, `TERM_PROGRAM_VERSION`, `COLORTERM`, `TMUX`, `VTE_VERSION`, `KITTY_WINDOW_ID`, `ZED_TERM`, `WT_SESSION`, `COLORFGBG`, `SHELL`, `DISPLAY`, `WAYLAND_DISPLAY`, `CI`, `SSH_CONNECTION`, `SSH_CLIENT`, and `SSH_TTY`; color and hyperlink controls such as `FORCE_COLOR`, `NO_COLOR`, and `FORCE_HYPERLINK` are also host inputs.
428
424
 
429
425
  Main agents, subagents, and teammates use the same path sandbox policy: read-only tools can access paths outside the working directory without path approval. Writes outside the agent's working directory, the system temp directory, or an explicitly allowed root require approval unless an explicit allow rule applies. `bypassPermissions` disables this path sandbox; switching back restores it. Explicit deny/ask rules and an agent's own plan approval lock still apply. The OS-level Bash sandbox is separate and remains controlled by the `sandbox` configuration or the TUI's `/sandbox` command. Isolated worktree agents instead receive their own worktree write root, without the parent workspace or a shared system-temp write grant; per-command output directories remain writable. Explicit OS deny-write entries still take precedence.
430
426
 
@@ -432,7 +428,7 @@ Sandboxed worktree agents can stage and commit through their own Git metadata an
432
428
 
433
429
  Shell rules check every executable segment separated by newlines, `;`, `&&`, `||`, `|`, and `&`, respecting literal quotes and escapes. Remembered shell rules retain the first two words plus `*`; a rule for one segment does not authorize later segments. Substitution, redirection, environment assignments (including Bash `+=`), wrappers and unsupported control syntax cannot use remembered prefixes for automatic approval. With applicable explicit restrictions, uninspectable syntax is conservatively denied or requires approval even in bypass mode. Permission dialogs show the scopes they will remember; tools without a stable scope offer one-time approval only. File rules canonicalize relative, home-relative and symlink paths before matching.
434
430
 
435
- Sandbox configuration applies to TUI, print, Remote/ACP/A2A, and in-process teammates. Enabling it fails closed when the native backend is unavailable. `bypassPermissions` does not disable it. Relative allow/deny write paths resolve against the command's execution directory; home-relative paths use the same resolver as file tools. The policy confines Bash writes and optionally disables all network access; it does not wrap PowerShell, LSP, or MCP executables.
431
+ Sandbox configuration applies to TUI, print, Remote/A2A, and in-process teammates. Enabling it fails closed when the native backend is unavailable. `bypassPermissions` does not disable it. Relative allow/deny write paths resolve against the command's execution directory; home-relative paths use the same resolver as file tools. The policy confines Bash writes and optionally disables all network access; it does not wrap PowerShell or MCP executables.
436
432
 
437
433
  Provider fields:
438
434
 
@@ -564,40 +560,18 @@ Each entry takes `command`/`args`/`env` (stdio) or `url`/`headers` with `type` o
564
560
 
565
561
  After editing `.mcp.json` or `config.yaml`, use `/mcp reload` in the UI to re-read both sources. The reload is a full reset: every current connection is dropped, then the freshly read list is connected from scratch.
566
562
 
567
- ### Language servers (LSP)
568
-
569
- Configure installed stdio language servers in `~/.yukino/config.yaml`. Servers start lazily on the first matching query; Yukino does not install or download them. The first configured server matching the file extension is selected, with one server per working directory and configuration name.
570
-
571
- ```yaml
572
- lsp_servers:
573
- - name: typescript
574
- command: typescript-language-server
575
- args: ["--stdio"]
576
- languages:
577
- .ts: typescript
578
- .tsx: typescriptreact
579
- .js: javascript
580
- .jsx: javascriptreact
581
- timeout_ms: 15000
582
- # Optional: env, initialization_options, settings
583
- ```
584
-
585
- `LSP` supports definition, references, hover, document/workspace symbols, implementation, type definition, call hierarchy preparation and incoming/outgoing calls, and diagnostics. Input positions are 1-based UTF-16; returned ranges follow the [LSP specification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/) (0-based UTF-16). File content is synchronized before queries. A push-diagnostics response with `pending: true` means no current report arrived within the bounded wait, not that the file has no errors. Servers without versioned diagnostic notifications cannot guarantee detection of delayed stale reports.
586
-
587
- The tool requests only read-only operations and rejects server-requested workspace edits and commands. Configured executables are trusted local programs, like stdio MCP servers: they run with the user's OS privileges, outside the Bash OS sandbox. Configure only servers you trust. Queries honor Yukino's read-tool permission rules and the agent's effective permission mode. Servers are shut down at host exit, with forced process-tree cleanup if necessary.
588
-
589
563
  ### Tasks, TODOs, and background work
590
564
 
591
565
  Task tracking and task execution are separate:
592
566
 
593
- - Every host (terminal, print, Remote, ACP and A2A) exposes one `TodoWrite` tool for tracking. Call `TodoWrite({})` to refresh the current board without writing. Without a team it uses the agent's private list; creating or restoring a team routes the leader to the shared board, including coordinator mode. Deleting the team restores the private list. Teammates use the shared board; ordinary subagents and forks keep independent private lists. The tool and schema remain stable across board switches.
567
+ - Every host (terminal, print, Remote and A2A) exposes one `TodoWrite` tool for tracking. Call `TodoWrite({})` to refresh the current board without writing. Without a team it uses the agent's private list; creating or restoring a team routes the leader to the shared board, including coordinator mode. Deleting the team restores the private list. Teammates use the shared board; ordinary subagents and forks keep independent private lists. The tool and schema remain stable across board switches.
594
568
  - `TodoWrite({todos: [...]})` applies incremental edits in one atomic transaction. Items without `id` create tasks and require `subject`; status defaults to `pending` and description to an empty string. Items with an existing `id` update only submitted fields. Creation and updates both accept `description`, `status`, `owner`, `priority`, `metadata`, `blocks` and `blockedBy`. Omitted tasks and fields are retained. Empty arrays do nothing. Delete tasks explicitly with `TodoWrite({deleteIds: ["1"]})`; deleting removes their reciprocal dependency links. Tracking never launches work; assigning a shared task notifies its owner after commit.
595
- - Results contain `boardId`, the complete `todos` snapshot, and a `progress` string using `TODO completed/total`; only completed items contribute to the numerator. An invalid edit rejects the entire batch without partial writes, consuming IDs, or publishing changes. Unknown fields, unknown task IDs and repeated edits to the same ID are rejected.
569
+ - Results contain `boardId`, the complete `todos` snapshot, and a `progress` string using `DONE completed/total`; only completed items contribute to the numerator. An invalid edit rejects the entire batch without partial writes, consuming IDs, or publishing changes. Unknown fields, unknown task IDs and repeated edits to the same ID are rejected.
596
570
  - Statuses are `pending`, `in_progress`, `completed`, `blocked`, and `cancelled`. `blocks` and `blockedBy` replace the specified dependency list and maintain reciprocal links; an empty array removes those links. Referenced IDs must exist before the call; forward references, self-dependencies, conflicting link edits and cycles are rejected. Starting blocked work fails atomically. Only completed dependencies unblock work; cancelled dependencies remain unresolved until their links are removed. Shared writes reload and commit under one cross-process lock. Teammates automatically claim tasks when marking them in progress, cannot take another worker's task, and cannot start a second task while one is already in progress. The leader can explicitly reassign work; stop its old worker before reassignment if it is still executing.
597
- - Interactive/Remote/ACP/A2A private lists persist per session in `~/.yukino/sessions/artifacts/<session-id>/tasks.json`, with a stored next-ID counter so deleting or clearing items never reuses IDs on resume. Shared boards use project-scoped team storage. Corrupt or inconsistent stores fail explicitly, without migration, auto-repair, or stale-state fallback. Storage and tool schemas have changed; old task files are not supported. Print mode's private checklist lasts for that invocation. The terminal's TODO progress follows the same private list or shared board as TodoWrite, including teammate updates, blocked items, and cancelled items. When every item is completed, the progress line hides after five seconds without deleting tasks or resetting IDs. Adding or reopening an unfinished item shows it again and cancels the pending hide. Switching sessions or boards starts a fresh completion countdown.
571
+ - Interactive/Remote/A2A private lists persist per session in `~/.yukino/sessions/artifacts/<session-id>/tasks.json`, with a stored next-ID counter so deleting or clearing items never reuses IDs on resume. Shared boards use project-scoped team storage. Corrupt or inconsistent stores fail explicitly. Print mode's private checklist lasts for that invocation. The terminal's TODO progress follows the same private list or shared board as TodoWrite, including teammate updates, blocked items, and cancelled items. When every item is completed, the progress line hides after five seconds without deleting tasks or resetting IDs. Adding or reopening an unfinished item shows it again and cancels the pending hide. Switching sessions or boards starts a fresh completion countdown.
598
572
  - `Agent` executes delegated work. Background Agent/Bash/PowerShell invocations return runtime task IDs, distinct from TODO IDs. `TaskOutput` inspects one of these IDs or waits once (`wait: true`, `timeout_ms: 0..60000`). It does not consume automatic completion notifications or stop a task on timeout. Prefer notifications over polling. `TaskStop` remains the explicit cancellation mechanism.
599
573
 
600
- The common built-in registry is used by terminal, print, Remote/ACP/A2A, and in-process teammates. Delegation, coordinator, and per-agent tool restrictions still filter that registry.
574
+ The common built-in registry is used by terminal, print, Remote/A2A, and in-process teammates. Delegation, coordinator, and per-agent tool restrictions still filter that registry.
601
575
 
602
576
  ### Workflows
603
577
 
@@ -631,7 +605,7 @@ Source snapshots, JSON arguments, journals, and run state live under `~/.yukino/
631
605
 
632
606
  Agent defaults to `kind: "teammate"`, joins the selected team or creates one automatically when none exists, and generates the teammate name from its description. Multiple teams can coexist; pass `team_name` when multiple teams exist. Use `kind: "subagent"` for one-shot runs and `worktree: true` for Git worktree isolation; agent definitions also accept a boolean `worktree` default, which a call can override. The optional `model` field is unnecessary for most tasks. `TeamCreate` adds a team, named via its optional `name` parameter or auto-generated when omitted, and keeps existing teams running. `TeamList` lists all teams. Use `team_name` with Agent, SendMessage, TodoWrite, TaskStop, and TeamDelete to select the target team; when only one team matches, it can be omitted. Teammates always send messages and edit tasks within their own team. The progress display combines tasks from all teams.
633
607
 
634
- `Agent` selects its role and context independently: `subagent_type` defaults to `"general-purpose"`, while `fork` defaults to `true` (or the configured `enable_fork` value). An explicit `fork` value overrides the configuration for every role.
608
+ `Agent` selects its role and context independently: `subagent_type` defaults to `"general-purpose"`, while `fork` defaults to `true` for every role.
635
609
 
636
610
  | Parameters | Role | Initial context |
637
611
  | ------------------------------------ | --------------- | ------------------------------- |
@@ -642,13 +616,13 @@ Agent defaults to `kind: "teammate"`, joins the selected team or creates one aut
642
616
 
643
617
  The same combinations work for other built-in and user-defined roles. Role tool restrictions, permissions, models, and `max_turns` apply in either context mode. `run_in_background` separately controls one-shot scheduling. For persistent teammates, `fork` seeds the initial conversation once; later assignments reuse the teammate's own history. Forking copies the conversation without sharing subsequent changes, and closes pending parent tool calls only in the copied transcript.
644
618
 
645
- Ordinary subagents run once. On completion, failure, or interruption, the host waits for their owned background commands to stop and releases their scoped tool registry. Parent-owned LSP/MCP tools are borrowed, not shut down by a child. Background task records and subagent transcripts persist under `~/.yukino/sessions/artifacts/`; `TaskOutput` includes the transcript path and timestamps. Finished results remain queryable from disk after the in-memory retention limit, and delivered notifications are recorded in the leader's session. Resuming restores terminal outcomes and reports abandoned running tasks as interrupted failures. Iteration-limit and model failures preserve partial text alongside the error and transcript. Cancellation callbacks are discarded when runners settle. A fork cannot create or replace teams, or stop parent-owned work.
619
+ Ordinary subagents run once. On completion, failure, or interruption, the host waits for their owned background commands to stop and releases their scoped tool registry. Parent-owned MCP tools are borrowed, not shut down by a child. Background task records and subagent transcripts persist under `~/.yukino/sessions/artifacts/`; `TaskOutput` includes the transcript path and timestamps. Finished results remain queryable from disk after the in-memory retention limit, and delivered notifications are recorded in the leader's session. Resuming restores terminal outcomes and reports abandoned running tasks as interrupted failures. Iteration-limit and model failures preserve partial text alongside the error and transcript. Cancellation callbacks are discarded when runners settle. A fork cannot create or replace teams, or stop parent-owned work.
646
620
 
647
621
  An explicit `run_in_background: false` overrides a predefined agent's `background: true`; when omitted, the definition supplies the default, independently of `fork`. Role files accept a UTF-8 BOM before frontmatter. Delegated agents cannot manage the main session's persistent goal.
648
622
 
649
623
  Ordinary subagents have no default model-turn limit. Role files can set a positive `max_turns` to impose one. Fresh and inherited conversations, foreground and background execution all use the selected role's limit. Reaching a configured limit reports failure with partial output and a transcript path; it does not mark the assignment complete.
650
624
 
651
- Persistent teammates become idle after each turn. They keep conversation and private checklist context for follow-up assignments, but must send findings with `SendMessage`; final text is not automatically forwarded to the leader. They exit on explicit shutdown, cancellation, failure, or loss of the leader. Exit clears live permission/cancellation references, releases owned tools, and resets unfinished owned tasks to unassigned/pending. Completed and cancelled records remain intact. Teammate task ownership is not released merely because a turn becomes idle.
625
+ Persistent teammates become idle after each turn. They keep conversation context and access to the shared task board for follow-up assignments, but must send findings with `SendMessage`; final text is not automatically forwarded to the leader. They exit on explicit shutdown, cancellation, failure, or loss of the leader. Exit clears live permission/cancellation references, releases owned tools, and resets unfinished owned tasks to unassigned/pending. Completed and cancelled records remain intact. Teammate task ownership is not released merely because a turn becomes idle.
652
626
 
653
627
  The team retains at most 200 terminated member summaries; running and idle members are never evicted. Agent generates unique teammate names among retained members.
654
628
 
@@ -716,7 +690,7 @@ After a normal model turn ends, an active goal starts another turn. Pending user
716
690
 
717
691
  The optional token budget counts input, output, cache-read, and cache-creation tokens for the main conversation's model requests during the goal run, including its final response. Delegated agents, memory selection, and compaction summaries are outside this counter. An in-flight request can exceed the budget; once reported, substantive work stops. Yukino makes at most one final model request with no tools to summarize verified progress, unfinished work, and blockers. Its tokens are included in the counter. The request is not retried or continued if it fails or hits its output limit. Pending user input, Plan mode, and interruption take priority; an undelivered summary remains pending across session resume. The goal remains `budget_limited` and requires explicit replacement with a new budget. The 150-turn limit requires `/goal continue` to reset it. Active time excludes idle, paused, and process-restart intervals.
718
692
 
719
- TUI, Remote/ACP/A2A, and print mode share this goal loop. `yukino -p "/goal <objective>"` creates a goal for that invocation's new session. Print mode control queries finish without a model call; invalid commands return a nonzero exit code, and stream JSON retains its final `result` event.
693
+ TUI, Remote/A2A, and print mode share this goal loop. `yukino -p "/goal <objective>"` creates a goal for that invocation's new session. Print mode control queries finish without a model call; invalid commands return a nonzero exit code, and stream JSON retains its final `result` event.
720
694
 
721
695
  ## Usage
722
696
 
@@ -763,17 +737,6 @@ The browser UI mirrors the terminal UI's capabilities: streaming replies and thi
763
737
 
764
738
  Remote mode also hosts [MCP Apps](https://modelcontextprotocol.io/extensions/apps/build). Tools that declare `_meta.ui.resourceUri`, including yukino-mcp's `create_app`, display their UI below the tool card in a sandboxed iframe. The host forwards the tool input and full result (including `structuredContent` and UI-only `_meta`), applies the resource's CSP domains, and synchronizes theme and content height. Apps can read resources and call app-visible tools on their originating MCP server; tool calls use Yukino's permissions and pre-tool hooks. Open links and text messages back to the agent are supported. Apps are restored after browser refresh while the remote session remains active; clearing the transcript removes them. Saved-session resume does not restore App views.
765
739
 
766
- ### ACP Mode (Editor Integration)
767
-
768
- ```bash
769
- yukino --acp # Agent Client Protocol over stdio (cannot be combined with other flags)
770
- yukino --acp-ws # ACP over WebSocket, listens on 127.0.0.1:18889
771
- yukino --acp-ws 9000 # ACP over WebSocket at a custom port (host:port also works)
772
- yukino --acp-ws 0 # OS-assigned ephemeral port; the actual ws:// URL is printed on startup
773
- ```
774
-
775
- Implements the Agent Client Protocol (`@agentclientprotocol/sdk`) so ACP-compatible editors can drive Yukino as an external agent. The WebSocket transport only binds loopback addresses.
776
-
777
740
  ### A2A Mode (Agent2Agent Server)
778
741
 
779
742
  ```bash
@@ -781,7 +744,17 @@ yukino --a2a # A2A server, listens on 127.0.0.1:18890
781
744
  yukino --a2a 9000 # custom loopback port (host:port also works)
782
745
  ```
783
746
 
784
- Serves Yukino as an Agent2Agent (`@a2a-js/sdk`) agent so other A2A-compatible agents and orchestrators can call it. The agent card is published at `/.well-known/agent-card.json`; JSON-RPC is served at `POST /` and HTTP+JSON/REST under `/v1/...`, on protocol version 1.0 with a v0.3 compatibility layer. Each A2A context maps to one Yukino session: text messages run the agent loop and stream `working` status updates (assistant text, thinking, tool calls, tool results), and tool permission requests surface as `input-required` status updates carrying a `yukino: permission-request` data part. Clients answer by sending a `yukino: permission-response` data part (`{ permissionId, decision: allow | deny | allowAlways }`) back on the same task. Answer one pending permission per message: when several tools await approval at once, only the first `permission-response` in a message is applied and the agent re-emits `input-required` for the rest, so respond to them one at a time. The server only binds loopback addresses.
747
+ Serves Yukino as an Agent2Agent (`@a2a-js/sdk`) agent so other agents and orchestrators can call it. The agent card is at `/.well-known/agent-card.json`; JSON-RPC is served at `POST /` and HTTP+JSON/REST under `/v1/...`. Only A2A 1.0 is supported. Send `A2A-Version: 1.0` on every protocol request. JSON-RPC uses names such as `SendMessage`, `SendStreamingMessage`, `GetTask`, and `ListTasks`. The server only binds loopback addresses.
748
+
749
+ Each context maps to one Yukino session. Assistant text streams as artifact updates with one stable artifact ID per assistant turn; the final update replaces its deltas with the complete text. Completed tasks expose the full final reply in `status.message` and in the corresponding artifact. History contains complete assistant messages, rather than individual tokens. Thinking and tool events appear only in streaming status-update `metadata.yukino`, using the `yukino` discriminator (`thinking`, `tool-call`, `tool-result`).
750
+
751
+ `SendMessage.configuration.historyLength`, `GetTask.historyLength`, and `ListTasks.historyLength` default to 10 recent messages. REST uses the same field on send and the `historyLength` query parameter on task queries. Set it to 0 to omit history; `status.message` and artifacts still carry the answer. Request a larger value to retrieve more history. The JSON request-body limit is 100 KiB; oversized requests return a structured HTTP 413 error.
752
+
753
+ #### Yukino A2A permissions v1
754
+
755
+ The agent card declares the permission handshake as an extension, including the supported decisions. The server applies its local `permission_mode` configuration and project permission rules. Client metadata cannot elevate that policy. `default` asks before edits and commands; `acceptEdits` permits edits while commands remain subject to approval; `bypassPermissions` permits operations subject to explicit rules.
756
+
757
+ Tool permission requests surface as `TASK_STATE_INPUT_REQUIRED` status updates. `status.message.parts` contains data parts with `{ yukino: "permission-request", permissionId, toolCallId, toolName, reason, args, source? }`. `source`, when present, contains `agentName` and `cwd`; `reason` contains only the approval reason. Send a data part `{ yukino: "permission-response", permissionId, decision: "allow" | "deny" | "allowAlways" }` on the same task and context. `allowAlways` persists matching project rules for future calls, while explicit denials still apply. Answer one pending permission per message; when several tools await approval, the server re-emits the remaining requests after each decision.
785
758
 
786
759
  ### Slash Commands
787
760
 
@@ -856,15 +829,13 @@ Commands can run while the model is streaming, with at most one user command at
856
829
 
857
830
  Run `/plan` to plan the current task, or `/plan <task>` to specify a planning request. In interactive terminal and browser sessions, both `/plan` and the main agent's `EnterPlanMode` tool run the built-in read-only `plan` agent synchronously in the foreground with a fork of the main conversation. The host saves the returned plan and presents it for user approval before implementation. Failed or cancelled planning does not open approval. `Shift+Tab` and the browser's permission-mode badge only cycle the three execution permission modes; from plan mode, they return to `default`.
858
831
 
859
- In the interactive terminal, `/feedback [description]` runs session analysis synchronously in the built-in `general-purpose` agent with a fork of the main conversation. Select diagnostic attachments, review the prepared issues, and approve them before the host uploads attachments or files issues. Cancelling feedback stops the foreground worker.
860
-
861
832
  Press ↓ on the last visual row of the input to view all teammates and background subagents, including while the foreground agent is streaming. Completion menus and prompt-history navigation take precedence. Enter opens an agent's details, Escape returns or closes the list, and the unsent draft and cursor are preserved. Teammate spawn cards scroll with the transcript like background subagent cards; current progress is available in the Agents list.
862
833
 
863
- Use the mouse wheel or trackpad to scroll conversation history in the terminal's native scrollback. Drag to select text and use the terminal's copy/paste shortcuts. Up/Down navigates completion menus, visual input rows, and prompt history; Down after restoring the draft opens the Agents list. Home/End and Ctrl+A/E move to the start/end of the input line. PageUp/PageDown behavior follows the terminal's own scrollback bindings.
834
+ Terminal and browser UI share Catppuccin Mocha (dark) and Latte (light) palettes. Named foundation colors feed shared semantic tokens for both interfaces. Teal identifies focus and progress, blue and mauve separate user and system messages, and tool cards use blue while running, green on success, and red on failure. Stopped terminal tool cards use yellow. Tinted surfaces and readable foreground shades are derived from the same palette. Messages, tool cards, Markdown, and dialogs retain generous spacing, with layouts adapting to smaller terminals and screens.
864
835
 
865
- **Design tradeoff:** Yukino uses the terminal's primary screen, with fullscreen/alternate-screen rendering and mouse capture removed. Completed messages are appended to native scrollback, preserving normal selection, copying, pasting, and wheel/trackpad history scrolling without translating scrolling into prompt-history navigation. Yukino gives up its own conversation viewport, scrollbar, click-to-latest indicator, and conversation-navigation key bindings. Scrolling and whether new output follows the bottom are controlled by the terminal; the input and footer scroll out of view while reading older history. The live area remains responsive and shows the tail of running output; the complete assistant response is printed when it finishes. Ctrl+O reprints the current transcript with expanded/collapsed details, and resume/rewind prints the restored transcript; earlier printed lines remain terminal history. Scrollback retention, selection behavior, copy/paste shortcuts, and selection stability during live redraws depend on the terminal.
836
+ The terminal uses native scrollback. Scroll with the mouse wheel or trackpad, drag to select, and use the terminal's copy/paste shortcuts. The input and footer scroll out of view while reading history; new-output following and scrollback retention depend on the terminal. Up/Down navigates completion menus, visual input rows, and prompt history. Home/End and Ctrl+A/E move within the input line; PageUp/PageDown use the terminal's bindings.
866
837
 
867
- Terminal resizing redraws the live area without clearing or replaying completed messages, preserving the terminal's native reading position and scrollback anchors. Historical output keeps its printed line breaks and uses the terminal's own reflow; previously printed cards are not rebuilt or stretched to fill a wider terminal. Streaming and completed Markdown tables use grids with wrapped cells, falling back to wrapped raw Markdown when the columns cannot fit their widest characters. Printed table grids follow native history reflow when the terminal narrows. Background padding does not add extra wrapped rows when the terminal narrows. The input, status, live text, running tool cards, and newly completed messages use the current width. Resize redraws are coalesced. Apple Terminal's reflowed live rows and cleared gaps are tracked so repeated width and height changes restore the input and footer without leaving old status lines behind.
838
+ Completed messages stay in scrollback when the terminal resizes; live text, tools, input, and status use the current dimensions. Markdown tables wrap cells and fall back to raw Markdown when a grid cannot fit. Ctrl+O rebuilds the transcript with expanded or collapsed details; clear, resume, and rewind also rebuild it, clearing the prior screen and scrollback.
868
839
 
869
840
  Pastes longer than 10 lines or 1,000 characters collapse to `[paste #1 +124 lines]` or `[paste #1 1234 chars]`. Clipboard images appear as `[Image #1]`. Arrow keys move across each placeholder as a unit, and Backspace/Delete remove it as a unit. Placeholders survive dialog switches; submitting restores the full text and image attachments.
870
841
 
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __yukinoCreateRequire } from "node:module";
3
+ const require = __yukinoCreateRequire(import.meta.url);
4
+ import{g}from"./chunk-UDDADKJP.js";import{a as ne}from"./chunk-P6DHMU7R.js";import{Na as oe,a as Y,g as te}from"./chunk-57IGGFHK.js";import{I as W,J as M,K as R,L as J,M as u,N as Q,O as X,P as Z,Y as ee,g as $,h as j,k as K,l as E,n as G,o as H,p as I,r as S,x as V}from"./chunk-5D3QKHYQ.js";import{Ac as p,Bc as z,Ec as D,Pa as F,xc as q}from"./chunk-5AOJ5ZSQ.js";import"./chunk-WLJL66O5.js";import"./chunk-QSKJBSCI.js";import"./chunk-7MKA3SHV.js";function re(n){for(let t=n.length-1;t>=0;t--){let e=n[t];if(e.defer_loading!==!0){e.cache_control={type:"ephemeral"};return}}}function ae(n){return n.some(t=>"defer_loading"in t&&t.defer_loading===!0)}function le(n,t){if("input_schema"in n){let e=n,{cache_control:s,...i}=e;return t||delete i.type,{...i,...t?{type:"custom"}:{},...e.defer_loading!==!0&&s?{cache_control:s}:{}}}throw new Error("Anthropic received a tool schema serialized for another protocol.")}var ce=F({module:"llm"});function k(n){return typeof n=="string"?[{type:"text",text:n}]:n.map(t=>{let e=Y(t);if(!e||e.type==="tool_reference")throw new Error(`Unsupported user content block: ${D(t,"type","unknown")}`);return e})}function pe(n){let t=[];for(let e of n)if(e.role==="assistant"){let s=[];if(e.thinkingBlocks)for(let r of e.thinkingBlocks)r.type==="redacted_thinking"?s.push({type:"redacted_thinking",data:r.data}):s.push({type:"thinking",thinking:r.thinking,signature:r.signature});let i=typeof e.content=="string"?e.content:q(e.content);if(i&&s.push({type:"text",text:i}),e.toolUses)for(let r of e.toolUses)s.push({type:"tool_use",id:r.toolUseId,name:r.toolName==="ComputerUse"?"computer":r.toolName,input:r.arguments});s.length===0&&s.push({type:"text",text:""}),t.push({role:"assistant",content:s})}else if(e.toolResults&&e.toolResults.length>0){let s=[];for(let i of e.toolResults)s.push({type:"tool_result",tool_use_id:i.toolUseId,is_error:i.isError,content:i.contentBlocks?.length?i.contentBlocks:i.content});e.content.length>0&&s.push(...k(e.content)),t.push({role:"user",content:s})}else{if(t.length===0){t.push({role:"user",content:k(e.content)});continue}let s=t[t.length-1],i=s.content;s.role==="user"?(typeof i=="string"&&(i=s.content=i.trim().length>0?[{type:"text",text:i}]:[]),i.push(...k(e.content))):t.push({role:"user",content:k(e.content)})}return t}var se=class{protocol="anthropic";client;model;thinkingLevel;systemPrompt;config;useExplicitCustomToolType;constructor(t,e){let s=V(t);if(!s)throw new R(ee);this.client=new g({apiKey:s,baseURL:t.base_url}),this.useExplicitCustomToolType=oe(t.base_url),this.model=t.model,this.config={...t},this.thinkingLevel=K(t),this.systemPrompt=e}setSystemPrompt(t){this.systemPrompt=t}setMaxOutputTokens(t){this.config={...this.config,max_output_tokens:t},this.setThinkingLevel(this.thinkingLevel)}setThinkingLevel(t){return this.thinkingLevel=I(this.config,t),this.thinkingLevel}getThinkingLevel(){return this.thinkingLevel}getSupportedThinkingLevels(){return H(this.config)}getOutputBudget(){return{maxOutputTokens:S(this.config),thinkingTokens:E(this.config,this.thinkingLevel)}}async*stream(t,e,s,i){let r=i?.maxOutputTokens===void 0?this.config:{...this.config,max_output_tokens:i.maxOutputTokens},C=S(r),N=pe(W(t.getMessages())),ie=ae(e),_=e.map(a=>le(a,this.useExplicitCustomToolType));re(_),ue(N);let h={model:this.model,max_tokens:C,stream:!0,system:[{type:"text",text:i?.systemPrompt??this.systemPrompt,cache_control:{type:"ephemeral"}}],messages:N,..._.length>0?{tools:_}:{}},y=I(r,this.getThinkingLevel());if(r.reasoning!==!1)if(y==="off")h.thinking={type:"disabled"};else if(r.thinking_mode==="adaptive"){let a=G(y,r);a!==null&&(h.thinking={type:"adaptive"},h.output_config={effort:a})}else{let a=Math.max(j,i?.answerReserveTokens??0),f=Math.min(E(r,y),C-a);h.thinking=f>=$?{type:"enabled",budget_tokens:f}:{type:"disabled"}}let T=0,v=0,L=0,A=0,B="end_turn",x="",b="",w=!1,O="",P=!1,U=!1;try{let a=[...ie?[te]:[]],f=this.client.messages.stream(h,{...s?{signal:s}:{},...i?.maxRetries===void 0?{}:{maxRetries:i.maxRetries},...a.length>0?{headers:{"anthropic-beta":a.join(",")}}:{}}),c="",m="",d="";for await(let l of f)switch(l.type){case"content_block_start":{let o=l.content_block;if(o.type==="thinking")w=!0,x="",b="";else if(o.type==="redacted_thinking")O=o.data,P=!0;else if(o.type==="tool_use"){if(!o.id||!o.name)throw new u("Anthropic tool call started without a valid id or name");m=o.id,c=o.name==="computer"?"ComputerUse":o.name,d="",yield{type:"tool_call_start",toolName:c,toolId:m}}break}case"content_block_delta":{let o=l.delta;if(o.type==="thinking_delta")x+=o.thinking,yield{type:"thinking_delta",text:o.thinking};else if(o.type==="signature_delta")b+=o.signature;else if(o.type==="text_delta")yield{type:"text_delta",text:o.text};else if(o.type==="input_json_delta"){if(!m||!c)throw new u("Anthropic tool arguments arrived before a valid tool call");d+=o.partial_json,yield{type:"tool_call_delta",text:o.partial_json}}break}case"content_block_stop":{if(w&&(yield{type:"thinking_complete",thinking:x,signature:b},w=!1),P&&(yield{type:"redacted_thinking_complete",data:O},P=!1),c){let o=ne(d);yield{type:"tool_call_complete",toolId:m,toolName:c,arguments:o.arguments,...o.parseError?{parseError:o.parseError}:{}},c="",m="",d=""}break}case"message_delta":{l.delta.stop_reason&&(B=l.delta.stop_reason);let o=l.usage;typeof o.output_tokens=="number"&&(v=o.output_tokens),typeof o.input_tokens=="number"&&(T=o.input_tokens),typeof o.cache_read_input_tokens=="number"&&(L=o.cache_read_input_tokens),typeof o.cache_creation_input_tokens=="number"&&(A=o.cache_creation_input_tokens);break}case"message_stop":{U=!0;break}case"message_start":{T=l.message.usage.input_tokens,v=l.message.usage.output_tokens,L=l.message.usage.cache_read_input_tokens??0,A=l.message.usage.cache_creation_input_tokens??0;break}}if(!U)throw new u("Anthropic stream ended without message_stop; response was truncated");yield{type:"stream_end",stopReason:B,usage:{inputTokens:T,outputTokens:v,cacheReadInputTokens:L,cacheCreationInputTokens:A}}}catch(a){throw ce.error({err:a},"llm operation failed"),he(a)}}};function ue(n){for(let t=n.length-1;t>=0;t--){if(n[t].role!=="user")continue;let e=n[t].content;if(typeof e=="string"&&e.length===0||Array.isArray(e)&&e.length===0)return;typeof e=="string"&&(e=n[t].content=[{type:"text",text:e}]);let s=e[e.length-1];for(let i=e.length-1;i>=0;i--)if(e[i].type!=="image"){s=e[i];break}Reflect.set(s,"cache_control",{type:"ephemeral"});return}}function he(n){if(n instanceof M)return n;if(n instanceof g.APIConnectionError||n instanceof g.APIUserAbortError)return new u(`Network error: ${n.message}`);if(n instanceof g.APIError){if(n.status===413||n.status===400&&Z(n.message))return new X(`Prompt too long: ${n.message}`);if(n.status===401)return new R(`Invalid API key: ${n.message}`);if(n.status===429){let t=n.headers,e=t instanceof Headers?t.get("retry-after"):void 0,s="Rate Limited";if(e){let i=Number.parseInt(p(e));Number.isNaN(i)?s+=", please wait.":s+=`, retry after ${p(i)}s.`}else s+=", please wait.";return new J(s,e?p(e):void 0)}if(n.status!==void 0&&(n.status>=500||n.status===408)){let t=n.headers;return new Q(`Anthropic API error (${p(n.status)}): ${n.message}`,t instanceof Headers?t.get("retry-after")??void 0:void 0)}return new M(`Anthropic API error (${p(n.status)}): ${n.message}`)}return new u(`Network error: ${z(n)}`)}export{se as AnthropicClient,pe as buildAnthropicMessages,ue as markLastUserTailForCache,re as markToolsForCache,ae as needsToolSearchBeta};
@@ -8,7 +8,7 @@
8
8
  content="width=device-width, initial-scale=1.0, viewport-fit=cover"
9
9
  />
10
10
  <title>Yukino Remote</title>
11
- <meta name="theme-color" content="#18181e" />
11
+ <meta name="theme-color" content="#1e1e2e" />
12
12
  <script>
13
13
  // Set the color scheme before first paint to avoid a flash. Mirrors the
14
14
  // logic in hooks/use-theme.ts: explicit choice wins, else system pref,
@@ -33,7 +33,7 @@
33
33
  <style>
34
34
  body {
35
35
  margin: 0;
36
- background: #18181e;
36
+ background: var(--yukino-background, #1e1e2e);
37
37
  }
38
38
  </style>
39
39
  </head>
@@ -0,0 +1 @@
1
+ var x={dark:{rosewater:"#f5e0dc",flamingo:"#f2cdcd",pink:"#f5c2e7",mauve:"#cba6f7",red:"#f38ba8",maroon:"#eba0ac",peach:"#fab387",yellow:"#f9e2af",green:"#a6e3a1",teal:"#94e2d5",sky:"#89dceb",sapphire:"#74c7ec",blue:"#89b4fa",lavender:"#b4befe",text:"#cdd6f4",subtext1:"#bac2de",subtext0:"#a6adc8",overlay2:"#9399b2",overlay1:"#7f849c",overlay0:"#6c7086",surface2:"#585b70",surface1:"#45475a",surface0:"#313244",base:"#1e1e2e",mantle:"#181825",crust:"#11111b"},light:{rosewater:"#dc8a78",flamingo:"#dd7878",pink:"#ea76cb",mauve:"#8839ef",red:"#d20f39",maroon:"#e64553",peach:"#fe640b",yellow:"#df8e1d",green:"#40a02b",teal:"#179299",sky:"#04a5e5",sapphire:"#209fb5",blue:"#1e66f5",lavender:"#7287fd",text:"#4c4f69",subtext1:"#5c5f77",subtext0:"#6c6f85",overlay2:"#7c7f93",overlay1:"#8c8fa1",overlay0:"#9ca0b0",surface2:"#acb0be",surface1:"#bcc0cc",surface0:"#ccd0da",base:"#eff1f5",mantle:"#e6e9ef",crust:"#dce0e8"}};function d(e,r,n){return`#${[1,3,5].map(s=>{let t=Number.parseInt(e.slice(s,s+2),16),i=Number.parseInt(r.slice(s,s+2),16);return Math.round(t+(i-t)*n).toString(16).padStart(2,"0")}).join("")}`}function f(e){let r=[1,3,5].map(n=>{let a=Number.parseInt(e.slice(n,n+2),16)/255;return a<=.04045?a/12.92:((a+.055)/1.055)**2.4});return r[0]*.2126+r[1]*.7152+r[2]*.0722}function h(e,r,n){let a=f(r),s=a>f(e)?"#000000":"#ffffff";for(let t=0;t<=20;t++){let i=d(e,s,t/20),g=f(i);if((Math.max(g,a)+.05)/(Math.min(g,a)+.05)>=4.5)return i}return n}function l(e){let r=d(e.base,"#ffffff",.08),n=m=>d(r,m,.08),a=d(e.base,e.teal,.16),s=[e.teal,e.green,e.red,e.yellow,e.blue,e.mauve].map(n);s.push(a);let t=m=>s.reduce((k,p)=>h(k,p,e.text),m),i=t(e.teal),g=t(e.green),c=t(e.yellow),b=t(e.red),u=t(e.mauve);return{background:e.base,surface:e.mantle,codeBg:e.mantle,border:e.surface2,borderMuted:e.surface0,borderAccent:i,text:e.text,bright:e.text,muted:e.subtext1,dim:h(e.subtext0,e.mantle,e.text),accent:i,accentHover:d(i,e.text,.12),accentContrast:e.base,accentBg:n(e.teal),success:g,successBg:n(e.green),warning:c,warningBg:n(e.yellow),error:b,errorBg:n(e.red),selectedBg:a,userMessageBg:n(e.blue),userMessageText:e.text,customMessageBg:n(e.mauve),customMessageText:e.text,customMessageLabel:u,toolPendingBg:n(e.blue),toolSuccessBg:n(e.green),toolErrorBg:n(e.red),toolStoppedBg:n(e.yellow),toolTitle:e.text,toolOutput:t(e.subtext1),toolDiffAdded:g,toolDiffRemoved:b,toolDiffContext:t(e.subtext0),thinkingText:e.subtext0,thinkingOff:e.subtext0,thinkingMinimal:e.subtext1,thinkingLow:t(e.blue),thinkingMedium:i,thinkingHigh:u,thinkingXHigh:t(e.lavender),thinkingMax:t(e.pink),bashMode:g,mdHeading:u,mdLink:t(e.blue),mdLinkUrl:e.subtext0,mdCode:i,mdCodeBlock:e.text,mdCodeBlockBorder:e.surface2,mdQuote:e.subtext0,mdQuoteBorder:e.surface2,mdHr:e.surface2,mdListBullet:i,syntaxComment:t(e.overlay2),syntaxKeyword:u,syntaxFunction:t(e.blue),syntaxVariable:e.text,syntaxString:g,syntaxNumber:t(e.peach),syntaxType:c,syntaxOperator:t(e.sky),syntaxPunctuation:t(e.overlay2)}}var o={dark:l(x.dark),light:l(x.light)};var y=o,T=y.dark,v=y.light;export{T as a,v as b};