@yukino.js/yukino 0.0.6 → 0.0.8

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 (40) hide show
  1. package/README.md +147 -37
  2. package/dist/a2a-GBVNBDMY.js +14 -0
  3. package/dist/{acp-U7GA5YRP.js → acp-C6VUCEZ6.js} +7 -7
  4. package/dist/anthropic-ZEQI4K52.js +4 -0
  5. package/dist/chunk-37IAJFPF.js +4 -0
  6. package/dist/{chunk-E7FXB7TA.js → chunk-3P7BR7SO.js} +17 -17
  7. package/dist/{chunk-WVT2D5AR.js → chunk-6XDMANXO.js} +1 -1
  8. package/dist/{chunk-SYLHBECV.js → chunk-L5C5JBLP.js} +1 -1
  9. package/dist/chunk-MU6PSBZT.js +358 -0
  10. package/dist/chunk-WGFROGUC.js +8 -0
  11. package/dist/{chunk-ME5UYXP4.js → chunk-YHE4BT76.js} +148 -148
  12. package/dist/esm-4KOJC56H.js +225 -0
  13. package/dist/fe/dist/index.html +21 -0
  14. package/dist/fe/dist/static/index.css +2 -0
  15. package/dist/fe/dist/static/index.js +203 -0
  16. package/dist/lib/{anthropic-GAD2PGEN.js → anthropic-K7VWTSFH.js} +2 -2
  17. package/dist/lib/{chunk-D3SXNTPZ.js → chunk-2NA2RSV7.js} +1 -9
  18. package/dist/lib/{chunk-RVSLQCZ5.js → chunk-E2DXHLHR.js} +1 -1
  19. package/dist/lib/{chunk-3ONNRNKQ.js → chunk-IIL5NGQF.js} +467 -456
  20. package/dist/lib/{chunk-OYQY3Q45.js → chunk-K532PPI6.js} +0 -2
  21. package/dist/lib/{chunk-CBBSDV2D.js → chunk-RJQT6B2O.js} +1 -1
  22. package/dist/lib/index.d.ts +412 -3620
  23. package/dist/lib/index.js +2762 -1885
  24. package/dist/lib/{openai-BYOGAZU5.js → openai-6MPSWGKN.js} +2 -2
  25. package/dist/lib/{providers-YHVXG3PP.js → providers-N52Y2QTJ.js} +1 -1
  26. package/dist/lib/{tool-filter-HUVHJN3O.js → tool-filter-F4S25GMJ.js} +1 -1
  27. package/dist/main.js +366 -237
  28. package/dist/{openai-PYPO6SKD.js → openai-VV2RYB77.js} +1 -1
  29. package/dist/{providers-6UOA2HYN.js → providers-UD3DPALA.js} +1 -1
  30. package/dist/server-FXK26WN2.js +4 -0
  31. package/package.json +11 -12
  32. package/dist/anthropic-3TRLGKHZ.js +0 -4
  33. package/dist/chunk-4GE22WHI.js +0 -4
  34. package/dist/chunk-TPWRDFEX.js +0 -4
  35. package/dist/chunk-XFVM5ZZL.js +0 -241
  36. package/dist/esm-5V3TYPZK.js +0 -229
  37. package/dist/lib/chunk-EFNPK4SJ.js +0 -137
  38. package/dist/lib/sandbox-runtime-QDN5SXPM.js +0 -9
  39. package/dist/sandbox-runtime-ELKAYRIL.js +0 -4
  40. package/dist/server-NXQ6REG3.js +0 -4
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, and team coordination where one leader agent manages multiple teammates (in-process, or as separate processes in tmux/iTerm panes) 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 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 (in-process, or as separate processes in tmux/iTerm panes) working in parallel.
10
10
 
11
11
  ## Features
12
12
 
@@ -17,14 +17,14 @@ Beyond interactive use, Yukino supports a non-interactive print mode for scripti
17
17
  - Built-in tool set: ReadFile, WriteFile, EditFile, Bash, PowerShell, Glob, Grep, WebFetch, ComputerUse, ToolSearch, McpCall, EnterWorktree, ExitWorktree, ExitPlanMode, the TaskCreate/TaskGet/TaskList/TaskUpdate todo tools, plus the orchestration and interaction tools: Agent, LoadSkill, InstallSkill, AskUserQuestion, SyntheticOutput, TeamCreate, SpawnTeammate, SendMessage, ListTeams, TeamDelete, 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
- - Sandbox support for isolated command execution: the native backend (bwrap on Linux, seatbelt on macOS) or the sandbox-runtime backend
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
 
23
23
  ### Conversation and Memory
24
24
 
25
25
  - Session persistence with JSONL-based storage for cross-session resume
26
26
  - Automatic context compaction when conversations approach the model's context window
27
- - Long-term memory extraction and recall across sessions (disable with `memory: false` in `~/.yukino/config.yaml`)
27
+ - Long-term memory extraction and recall across sessions (disable with `enable_memory: false` in `~/.yukino/config.yaml`)
28
28
  - Instructions files for persistent guidance: user-global `~/.yukino/AGENTS.md`, plus `AGENTS.md` and `.yukino/AGENTS.md` in every directory from the git root down to the working directory, with `@include` expansion
29
29
 
30
30
  ### Skills and Commands
@@ -50,7 +50,7 @@ Beyond interactive use, Yukino supports a non-interactive print mode for scripti
50
50
 
51
51
  ### Remote Mode
52
52
 
53
- - Koa HTTP server with WebSocket bridge for browser-based access
53
+ - Express HTTP server with WebSocket bridge for browser-based access
54
54
  - React frontend served at a configurable address
55
55
  - Bidirectional message streaming between browser and agent
56
56
 
@@ -86,46 +86,128 @@ Yukino reads a single global YAML configuration file:
86
86
 
87
87
  - ~/.yukino/config.yaml
88
88
 
89
- Print, remote, and ACP modes require at least one configured provider; the interactive UI instead opens the provider login form when none is configured. Example config.yaml:
89
+ 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:
90
90
 
91
91
  ```yaml
92
+ # Initial permission mode. Enum: default (ask per write/command) | acceptEdits (auto-approve
93
+ # file edits) | plan (plan mode, no modifications) | bypassPermissions (approve everything).
94
+ # Invalid values fall back to default; Shift+Tab cycles modes at runtime.
95
+ permission_mode: bypassPermissions
96
+
97
+ # Model providers. At least one is required.
92
98
  providers:
93
- - name: anthropic
99
+ - name: ds-anthropic # Display name
100
+ # Wire protocol. Enum: anthropic | openai | openai-compat. Also selects the API key
101
+ # environment fallback: anthropic → ANTHROPIC_API_KEY, openai / openai-compat → OPENAI_API_KEY.
94
102
  protocol: anthropic
103
+ # API endpoint. The provider identity — duplicate base_url across providers is rejected.
104
+ base_url: https://api.deepseek.com/anthropic
105
+ model: deepseek-flash # Model identifier
106
+ api_key: sk-xyz # Optional; omitted falls back to the protocol's environment variable
107
+ # Thinking level. Enum: off | minimal | low | medium | high | xhigh | max. Default: high.
108
+ thinking: high
109
+ context_window: 1000000 # Context window in tokens. Default: 1000000
110
+ # Output token ceiling. Default: 128000; clamped to context_window; the thinking
111
+ # budget shares this ceiling instead of raising it.
112
+ max_output_tokens: 128000
113
+ # Second provider, same fields as above, demonstrating the openai-compat protocol.
114
+ - name: ds-openai
115
+ protocol: openai-compat
95
116
  base_url: https://api.deepseek.com
96
117
  model: deepseek-flash
97
- # api_key defaults to $ANTHROPIC_API_KEY
98
- thinking: high # off | minimal | low | medium | high | xhigh | max
118
+ api_key: sk-xyz
119
+ thinking: high
120
+ context_window: 1000000
121
+ max_output_tokens: 128000
122
+
123
+ # 0-based index of the provider selected at startup. Default: 0.
124
+ default_provider: 0
125
+
126
+ # Automatic memory master switch. Default: true. false turns off the whole pipeline:
127
+ # index injection, recall, and background extraction (consolidation runs in remote mode only).
128
+ enable_memory: false
99
129
 
100
- permission_mode: default
130
+ # Coordinator mode. Default: false. true narrows the leader's toolset to pure orchestration
131
+ # (team/task management) so all actual work is delegated to teammates.
132
+ enable_coordinator_mode: false
133
+
134
+ # Whether an Agent call without subagent_type forks the current conversation (child inherits
135
+ # the full history). Default: true; only an explicit false disables it — disabled calls spawn
136
+ # a fresh general-purpose subagent instead.
137
+ enable_fork: true
101
138
 
139
+ # User-level MCP servers. Merged with the project-level .mcp.json; on a name collision the
140
+ # user-level entry wins.
102
141
  mcp_servers:
103
- - name: yukino-mcp
104
- command: npx
105
- args: ["-y", "@yukino.js/mcp@latest"]
106
- env: # map<string, string>; supports ${VAR}, ${VAR:-default}, and $VAR
142
+ - name: codegraph # Server name; must be unique across all MCP servers
143
+ command: codegraph # stdio server: executable. Exactly one of command | url per server.
144
+ args: # Command-line arguments
145
+ - serve
146
+ - "--mcp"
147
+ - name: yukino-mcp # stdio
148
+ command: pnpm
149
+ args: ["--filter", "@yukino.js/mcp", "dev"]
150
+ # Environment variables for the child process (stdio only; ignored for url servers).
151
+ # Supports ${VAR}, ${VAR:-default}, $VAR; an unset variable without a default fails the
152
+ # connection.
153
+ env:
107
154
  API_BASE_URL: "https://yukino-js.dev"
108
155
  API_KEY: "${YUKINO_MCP_API_KEY}"
156
+ - name: yukino-mcp-http # streamable-http
157
+ url: "http://localhost:3300/mcp" # Remote endpoint (command and url are mutually exclusive)
158
+ # Transport. Enum: http (streamable HTTP; the default when omitted) | sse (legacy) for url
159
+ # servers; command servers may only use stdio (omittable).
160
+ transport: "http"
161
+ # HTTP request headers sent with every request (url only; ignored for stdio). Same ${VAR}
162
+ # expansion as env.
163
+ headers:
164
+ Authorization: "Bearer ${YUKINO_MCP_API_KEY}"
165
+ - name: yukino-mcp-sse # legacy sse
166
+ url: "http://localhost:3300/sse"
167
+ transport: "sse"
168
+ headers:
169
+ Authorization: "Bearer ${YUKINO_MCP_API_KEY}"
170
+
171
+ # OS-level sandbox wrapping Bash commands in isolated execution
172
+ # (seatbelt on macOS, bubblewrap on Linux; unavailable elsewhere).
173
+ sandbox:
174
+ enabled: false # Master switch
175
+ # With the sandbox active, non-dangerous Bash commands skip human confirmation (explicit
176
+ # deny/ask rules still apply; Bash tool only). Default: false.
177
+ auto_allow: false
178
+ network_enabled: true # Whether sandboxed commands may access the network
109
179
 
180
+ # Event-driven hooks.
110
181
  hooks:
111
- - event: pre_tool_use
112
- condition: "Bash"
182
+ - id: pre-tool-use # Optional identifier; the once-slot key (falls back to the array index)
183
+ # Trigger event. Enum: session_start | session_end | turn_start | turn_end | pre_send |
184
+ # post_receive | pre_tool_use | post_tool_use | shutdown.
185
+ event: pre_tool_use
186
+ # Optional JavaScript expression; a truthy result fires the hook. Variables in scope:
187
+ # event, tool, filePath, message, args. Expressions that fail to compile or throw are
188
+ # logged and treated as false, so the hook is skipped.
189
+ condition: 'event.endsWith("tool_use") && (tool.toLowerCase().includes("file") || /bash/i.test(tool))'
113
190
  action:
191
+ # Action type. Enum: command (shell command) | prompt (inject static text) | http
192
+ # (HTTP request) | agent (reserved; rejected by validation today).
114
193
  type: command
115
- command: "echo tool about to run"
116
-
117
- sandbox:
118
- enabled: false
119
- backend: native # native (bwrap/seatbelt) | sandbox-runtime
120
- auto_allow: false
121
- network_enabled: true
122
-
123
- enable_coordinator_mode: false
124
-
125
- # Auto memory: index injection, recall, background extraction, and consolidation
126
- # (consolidation currently runs only in remote mode).
127
- # Set to false to disable the whole automatic memory pipeline (default: true).
128
- memory: true
194
+ # Shell command: bash on POSIX, 30s timeout, working directory = project directory,
195
+ # with YUKINO_EVENT / YUKINO_TOOL / YUKINO_FILE_PATH injected; stdout is injected into
196
+ # the agent as a system reminder on the next turn.
197
+ 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/agent` section) and https://hangtiancheng.github.io/h/llms-full.txt to gain self-knowledge"
198
+ # Whether successful output rejects the tool call (pre_tool_use only). Default: false.
199
+ # Mutually exclusive with async.
200
+ reject: false
201
+ # Fire only once per session (keyed by id, or index). Default: false; a failed execution
202
+ # releases the slot so the next matching event retries.
203
+ once: true
204
+ # Run in the background without blocking the main flow. Default: false; output is drained
205
+ # as a notification on the next turn.
206
+ async: false
207
+ # Behavior when the action execution fails. Enum: ignore (default; log only) | fail
208
+ # (surface the error to the agent) | reject (treat the failure as a rejection; blocks the
209
+ # tool call on pre_tool_use).
210
+ on_error: ignore
129
211
  ```
130
212
 
131
213
  Provider fields:
@@ -148,6 +230,22 @@ The thinking level controls reasoning depth. For `anthropic` in the default `bud
148
230
 
149
231
  API keys are resolved in this order: explicit api_key field, then environment variables (ANTHROPIC_API_KEY for anthropic, OPENAI_API_KEY for openai and openai-compat).
150
232
 
233
+ Hook conditions (`condition`; omitted means the hook always fires):
234
+
235
+ A condition is a JavaScript expression evaluated against the hook context; a truthy result fires the hook. These variables are in scope:
236
+
237
+ | Variable | Type | Value |
238
+ | ---------- | ------ | --------------------------------------------------------- |
239
+ | `event` | string | Event name, e.g. `pre_tool_use` |
240
+ | `tool` | string | Tool name (`""` for non-tool events) |
241
+ | `filePath` | string | The tool's `file_path`/`path` argument (`""` when absent) |
242
+ | `message` | string | Event message (`""` when absent) |
243
+ | `args` | object | The tool's arguments, e.g. `args.command` |
244
+
245
+ Examples: `tool === "EditFile"`, `["EditFile", "WriteFile", "Bash"].includes(tool)`, `/\.ts$/.test(filePath)`, `event.endsWith("tool_use") && !tool.startsWith("Read")`.
246
+
247
+ Expressions that fail to compile or throw at runtime (syntax errors, misspelled method names, undefined variables) are logged and treated as false, so the hook is skipped.
248
+
151
249
  ### Telemetry
152
250
 
153
251
  Telemetry is disabled by default and is configured only through environment variables. Yukino does not send prompts, model output, thinking content, tool arguments, tool results, file paths, API keys, or raw session IDs. Session identifiers included in traces are hashed.
@@ -266,22 +364,33 @@ The -p flag sends a single prompt, runs the agent loop, and prints the result to
266
364
 
267
365
  ```bash
268
366
  yukino --remote # listens on 127.0.0.1:18888
269
- yukino --remote :9000 # custom loopback port
367
+ yukino --remote 9000 # custom loopback port (":9000" also works)
270
368
  yukino --remote 0.0.0.0:9000 # explicitly expose on all interfaces (no built-in authentication)
369
+ yukino --remote 0 # OS-assigned ephemeral port; the actual URL is printed on startup
271
370
  ```
272
371
 
273
- Starts a Koa HTTP server and WebSocket bridge. The bundled React frontend is served at the configured address for browser-based interaction.
372
+ Starts an Express HTTP server and WebSocket bridge. The bundled React frontend is served at the configured address for browser-based interaction. With port 0 the OS picks a free port and the server prints the reachable address (e.g. `Remote server listening at http://127.0.0.1:61041`) so you know where to connect.
274
373
 
275
374
  ### ACP Mode (Editor Integration)
276
375
 
277
376
  ```bash
278
377
  yukino --acp # Agent Client Protocol over stdio (cannot be combined with other flags)
279
378
  yukino --acp-ws # ACP over WebSocket, listens on 127.0.0.1:18889
280
- yukino --acp-ws host:port # ACP over WebSocket at a custom loopback address
379
+ yukino --acp-ws 9000 # ACP over WebSocket at a custom port (host:port also works)
380
+ yukino --acp-ws 0 # OS-assigned ephemeral port; the actual ws:// URL is printed on startup
281
381
  ```
282
382
 
283
383
  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.
284
384
 
385
+ ### A2A Mode (Agent2Agent Server)
386
+
387
+ ```bash
388
+ yukino --a2a # A2A server, listens on 127.0.0.1:18890
389
+ yukino --a2a 9000 # custom loopback port (host:port also works)
390
+ ```
391
+
392
+ 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.
393
+
285
394
  ### Slash Commands
286
395
 
287
396
  Inside the UI, these commands are available:
@@ -290,8 +399,9 @@ Inside the UI, these commands are available:
290
399
  | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
291
400
  | /login | Configure, save, and activate an LLM provider |
292
401
  | /provider | Switch the active provider |
402
+ | /model [model] | Switch the model of the current provider; without an argument, open the model picker |
293
403
  | /help [command] | Show available commands, or details for a single command |
294
- | /status | Show current session status (model, tokens, tools, sandbox, memories, skills, MCP) |
404
+ | /status | Show current session status (mode, model, provider, tokens, tools, sandbox, memories, skills, MCP, session, directory) |
295
405
  | /session | Confirm the session is active; use /resume to list past sessions |
296
406
  | /memory | List stored memories |
297
407
  | /memory clear | Clear all memories |
@@ -330,10 +440,10 @@ Pasting an image saves it as a PNG under `.yukino/file-history/<session-id>/`. I
330
440
 
331
441
  Besides the `yukino` CLI, the package ships a library entry for embedding Yukino in another host process.
332
442
 
333
- | Entry | Output | Contents |
334
- | -------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
335
- | CLI (`yukino`) | `dist/main.js` | Fully bundled, minified single file with a shebang; Node built-ins plus modules with native binaries or runtime assets (`sharp`, `@anthropic-ai/sandbox-runtime`, ink's `react-devtools-core` peer) stay external. |
336
- | Library | `dist/lib/index.js`, `dist/lib/index.d.ts` | The `src/index.ts` barrel; runtime dependencies stay external and resolve from the consumer's `node_modules`. |
443
+ | Entry | Output | Contents |
444
+ | -------------- | ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
445
+ | CLI (`yukino`) | `dist/main.js` | Fully bundled, minified single file with a shebang; Node built-ins plus modules with native binaries or runtime assets (`sharp`, ink's `react-devtools-core` peer) stay external. |
446
+ | Library | `dist/lib/index.js`, `dist/lib/index.d.ts` | The `src/index.ts` barrel; runtime dependencies stay external and resolve from the consumer's `node_modules`. |
337
447
 
338
448
  The library entry is terminal-independent by contract: it must never reach `src/ui/**` or a ui-only dependency, so a host without a TTY (a server, an editor extension, a test harness) can import it. `pnpm build` enforces that contract:
339
449