@yukino.js/yukino 0.0.7 → 0.0.9

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 (53) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +131 -26
  3. package/dist/a2a-C65LD3SC.js +14 -0
  4. package/dist/acp-SNG4K2LG.js +14 -0
  5. package/dist/anthropic-E7KF3CEK.js +4 -0
  6. package/dist/chunk-4RUACBRP.js +5 -0
  7. package/dist/chunk-BQGLVWJ2.js +363 -0
  8. package/dist/chunk-COBTQXCB.js +88 -0
  9. package/dist/chunk-GTWPLFAN.js +38 -0
  10. package/dist/chunk-HZFKNHPB.js +4 -0
  11. package/dist/chunk-PP5WWNTV.js +4 -0
  12. package/dist/chunk-QEUO5B7I.js +1033 -0
  13. package/dist/{chunk-HWDSXNX4.js → chunk-SQ26ASOB.js} +3 -3
  14. package/dist/chunk-WGFROGUC.js +8 -0
  15. package/dist/esm-4KOJC56H.js +225 -0
  16. package/dist/fe/dist/index.html +21 -0
  17. package/dist/fe/dist/static/index.css +2 -0
  18. package/dist/fe/dist/static/index.js +203 -0
  19. package/dist/lib/{anthropic-CDPTNR5L.js → anthropic-XFZKSPOX.js} +3 -2
  20. package/dist/lib/{chunk-6NYUYSER.js → chunk-7EWMQYVH.js} +12 -3
  21. package/dist/lib/{chunk-OYQY3Q45.js → chunk-K532PPI6.js} +0 -2
  22. package/dist/lib/{chunk-PEV5NGQ2.js → chunk-KUA7U27R.js} +8 -3
  23. package/dist/lib/{chunk-TKCJSTWI.js → chunk-LHIQSMGD.js} +12 -7
  24. package/dist/lib/{chunk-HE4RUUZP.js → chunk-MFEAVGDX.js} +291 -592
  25. package/dist/lib/chunk-Q3EV2REC.js +260 -0
  26. package/dist/lib/{chunk-EO23VPDZ.js → chunk-RY7EXVHD.js} +18 -15
  27. package/dist/lib/index.d.ts +476 -3675
  28. package/dist/lib/index.js +4800 -3279
  29. package/dist/lib/{openai-TEFKPV7T.js → openai-QSDLFAKO.js} +3 -2
  30. package/dist/lib/{providers-2X5JB2JX.js → providers-TL72PZZD.js} +2 -1
  31. package/dist/lib/{seatbelt-VE3I3EGH.js → seatbelt-MRJ25UBQ.js} +1 -1
  32. package/dist/lib/{tool-filter-HUVHJN3O.js → tool-filter-F4S25GMJ.js} +1 -1
  33. package/dist/main.js +366 -237
  34. package/dist/{openai-RYXW7AKZ.js → openai-XNFC4DJ2.js} +13 -13
  35. package/dist/{providers-YG2HYIG6.js → providers-XEORRTYK.js} +1 -1
  36. package/dist/{seatbelt-3YN3GMQO.js → seatbelt-FU3EQ42H.js} +1 -1
  37. package/dist/server-35JMM5JU.js +4 -0
  38. package/package.json +11 -12
  39. package/dist/acp-76S2XII3.js +0 -14
  40. package/dist/anthropic-WK6EYMUE.js +0 -4
  41. package/dist/chunk-3OULXPVI.js +0 -5
  42. package/dist/chunk-4GE22WHI.js +0 -4
  43. package/dist/chunk-7PPWFSIC.js +0 -4
  44. package/dist/chunk-7ZBAF7M4.js +0 -4
  45. package/dist/chunk-IW5L5276.js +0 -65
  46. package/dist/chunk-NG62ISUV.js +0 -61
  47. package/dist/chunk-QQZCYWYI.js +0 -241
  48. package/dist/chunk-QRO6H32L.js +0 -1031
  49. package/dist/esm-5V3TYPZK.js +0 -229
  50. package/dist/lib/chunk-EFNPK4SJ.js +0 -137
  51. package/dist/lib/sandbox-runtime-QDN5SXPM.js +0 -9
  52. package/dist/sandbox-runtime-ELKAYRIL.js +0 -4
  53. package/dist/server-66HLMSUR.js +0 -4
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 hangtiancheng
3
+ Copyright (c) 2026 hangtiancheng
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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,19 +86,31 @@ 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.
92
95
  permission_mode: bypassPermissions
96
+
97
+ # Model providers. At least one is required.
93
98
  providers:
94
- - name: ds-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.
95
102
  protocol: anthropic
103
+ # API endpoint. The provider identity — duplicate base_url across providers is rejected.
96
104
  base_url: https://api.deepseek.com/anthropic
97
- model: deepseek-flash
98
- api_key: sk-xyz
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.
99
108
  thinking: high
100
- context_window: 1000000
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.
101
112
  max_output_tokens: 128000
113
+ # Second provider, same fields as above, demonstrating the openai-compat protocol.
102
114
  - name: ds-openai
103
115
  protocol: openai-compat
104
116
  base_url: https://api.deepseek.com
@@ -107,29 +119,94 @@ providers:
107
119
  thinking: high
108
120
  context_window: 1000000
109
121
  max_output_tokens: 128000
122
+
123
+ # 0-based index of the provider selected at startup. Default: 0.
110
124
  default_provider: 0
111
- memory: false
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
129
+
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.
112
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
138
+
139
+ # User-level MCP servers. Merged with the project-level .mcp.json; on a name collision the
140
+ # user-level entry wins.
113
141
  mcp_servers:
114
- - name: codegraph
115
- command: codegraph
116
- args:
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
117
145
  - serve
118
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:
154
+ API_BASE_URL: "https://yukino-js.dev"
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).
119
173
  sandbox:
120
- enabled: false
121
- backend: sandbox-runtime
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.
122
177
  auto_allow: false
123
- network_enabled: true
178
+ network_enabled: true # Whether sandboxed commands may access the network
179
+
180
+ # Event-driven hooks.
124
181
  hooks:
125
- - id: pre-edit
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.
126
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))'
127
190
  action:
191
+ # Action type. Enum: command (shell command) | prompt (inject static text) | http
192
+ # (HTTP request) | agent (reserved; rejected by validation today).
128
193
  type: command
129
- 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"
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/yukino` 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.
130
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.
131
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.
132
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).
133
210
  on_error: ignore
134
211
  ```
135
212
 
@@ -153,6 +230,22 @@ The thinking level controls reasoning depth. For `anthropic` in the default `bud
153
230
 
154
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).
155
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
+
156
249
  ### Telemetry
157
250
 
158
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.
@@ -271,22 +364,33 @@ The -p flag sends a single prompt, runs the agent loop, and prints the result to
271
364
 
272
365
  ```bash
273
366
  yukino --remote # listens on 127.0.0.1:18888
274
- yukino --remote :9000 # custom loopback port
367
+ yukino --remote 9000 # custom loopback port (":9000" also works)
275
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
276
370
  ```
277
371
 
278
- 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.
279
373
 
280
374
  ### ACP Mode (Editor Integration)
281
375
 
282
376
  ```bash
283
377
  yukino --acp # Agent Client Protocol over stdio (cannot be combined with other flags)
284
378
  yukino --acp-ws # ACP over WebSocket, listens on 127.0.0.1:18889
285
- 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
286
381
  ```
287
382
 
288
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.
289
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
+
290
394
  ### Slash Commands
291
395
 
292
396
  Inside the UI, these commands are available:
@@ -295,8 +399,9 @@ Inside the UI, these commands are available:
295
399
  | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
296
400
  | /login | Configure, save, and activate an LLM provider |
297
401
  | /provider | Switch the active provider |
402
+ | /model [model] | Switch the model of the current provider; without an argument, open the model picker |
298
403
  | /help [command] | Show available commands, or details for a single command |
299
- | /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) |
300
405
  | /session | Confirm the session is active; use /resume to list past sessions |
301
406
  | /memory | List stored memories |
302
407
  | /memory clear | Clear all memories |
@@ -335,10 +440,10 @@ Pasting an image saves it as a PNG under `.yukino/file-history/<session-id>/`. I
335
440
 
336
441
  Besides the `yukino` CLI, the package ships a library entry for embedding Yukino in another host process.
337
442
 
338
- | Entry | Output | Contents |
339
- | -------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
340
- | 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. |
341
- | 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`. |
342
447
 
343
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:
344
449