@yukino.js/yukino 0.0.14 → 0.0.16
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.
- package/README.md +13 -11
- package/dist/anthropic-M6YBGTW2.js +4 -0
- package/dist/browser/dist/index.html +2 -2
- package/dist/browser/dist/static/chunk-OR5FHECQ.js +1 -0
- package/dist/browser/dist/static/highlight-AZCRQTGM.js +152 -0
- package/dist/browser/dist/static/index.css +1 -1
- package/dist/browser/dist/static/index.js +86 -84
- package/dist/bwrap-LVIPV72Q.js +0 -0
- package/dist/chunk-3KKA6537.js +0 -0
- package/dist/chunk-3O2CPTOD.js +5 -0
- package/dist/chunk-4JHZPFU6.js +67 -0
- package/dist/chunk-5DGLAJ3U.js +8 -0
- package/dist/chunk-7MKA3SHV.js +0 -0
- package/dist/{chunk-T6WQ3Z5J.js → chunk-BOZOXLKL.js} +1 -1
- package/dist/{chunk-WGFROGUC.js → chunk-CKOUBYG6.js} +0 -0
- package/dist/chunk-CUCQV3CL.js +4 -0
- package/dist/chunk-ETZPOVUC.js +4 -0
- package/dist/chunk-FC2LG24U.js +4 -0
- package/dist/chunk-FNQMXCCE.js +4 -0
- package/dist/chunk-H7DHVEP7.js +30 -0
- package/dist/chunk-I74AL3PF.js +0 -0
- package/dist/chunk-IQT2IFSO.js +4 -0
- package/dist/chunk-JL3K6GYG.js +114 -0
- package/dist/chunk-K45OXLJJ.js +16 -0
- package/dist/chunk-KJJYW5IY.js +0 -0
- package/dist/chunk-LCWNSYZU.js +0 -0
- package/dist/chunk-LR4ZNAAM.js +4 -0
- package/dist/chunk-MHRZYJJO.js +4 -0
- package/dist/chunk-MQAQBW7F.js +0 -0
- package/dist/chunk-P6DHMU7R.js +0 -0
- package/dist/chunk-Q6PJ2RD6.js +988 -0
- package/dist/{chunk-WKSVBXUO.js → chunk-SA7KQIVH.js} +35 -29
- package/dist/{chunk-Z3EFT645.js → chunk-SX477ANO.js} +1 -1
- package/dist/{chunk-MDPSQ6L7.js → chunk-UDDADKJP.js} +1 -1
- package/dist/chunk-VCIRD267.js +0 -0
- package/dist/chunk-VM4YKTHC.js +0 -0
- package/dist/chunk-VU3JWAJR.js +0 -0
- package/dist/chunk-WGRGSG2J.js +65 -0
- package/dist/chunk-XKLTUIST.js +18 -0
- package/dist/chunk-XY7ZFVZL.js +4 -0
- package/dist/devtools-UVGRIXO2.js +0 -0
- package/dist/{esm-HW2JMFYC.js → esm-2JJG3HR7.js} +1 -1
- package/dist/esm-7DWXO52B.js +4 -0
- package/dist/{esm-6L5BJ5GT.js → esm-EOOB75BT.js} +1 -1
- package/dist/{esm-DIYJ5HX6.js → esm-H73EL6IR.js} +1 -1
- package/dist/{esm-YKAO4ES6.js → esm-IBZKE3IU.js} +1 -1
- package/dist/esm-W4NAAZTQ.js +225 -0
- package/dist/{esm-RPR2GBJ2.js → esm-Y237QNPJ.js} +1 -1
- package/dist/getMachineId-bsd-A3UCSHLE.js +4 -0
- package/dist/getMachineId-bsd-E27XJQLX.js +0 -0
- package/dist/getMachineId-darwin-35UPAIXP.js +0 -0
- package/dist/getMachineId-darwin-MWJEU7OI.js +5 -0
- package/dist/getMachineId-linux-FNSLKUDN.js +4 -0
- package/dist/getMachineId-linux-MKXIYT6A.js +0 -0
- package/dist/getMachineId-unsupported-PKQWB2OJ.js +4 -0
- package/dist/getMachineId-unsupported-ZXVGGFX2.js +0 -0
- package/dist/getMachineId-win-3A667JT3.js +4 -0
- package/dist/getMachineId-win-RNVIYJG5.js +0 -0
- package/dist/lib/{anthropic-TDNNKQMT.js → anthropic-2P54PIDT.js} +4 -4
- package/dist/lib/{chunk-WXR5HNB4.js → chunk-3HK5RKES.js} +1 -137
- package/dist/lib/{chunk-WNGF7243.js → chunk-3QG36U3U.js} +216 -8
- package/dist/lib/{chunk-BRLCCEU7.js → chunk-7JP46P5T.js} +5 -11
- package/dist/lib/{chunk-IZXMDC5O.js → chunk-LU6NOWNY.js} +5 -5
- package/dist/lib/{chunk-UKXGO7AW.js → chunk-NCMYMV2M.js} +1196 -258
- package/dist/lib/{chunk-56DL5ZYL.js → chunk-NYPUPN23.js} +2 -2
- package/dist/lib/{chunk-EJNKEFE7.js → chunk-OEX5PMME.js} +2 -2
- package/dist/lib/index.d.ts +564 -400
- package/dist/lib/index.js +3082 -2419
- package/dist/lib/{openai-6VYIA7CT.js → openai-7NAYCBDV.js} +3 -3
- package/dist/lib/{providers-UXL5FVF7.js → providers-YRINFWH2.js} +2 -2
- package/dist/lib/{tool-filter-O6YLSFAS.js → tool-filter-LYVHXM4N.js} +3 -3
- package/dist/{main-FOIMPIOD.js → main-J7UMFVZ5.js} +229 -244
- package/dist/main.js +30 -3
- package/dist/{node-634LOHDX.js → node-4OJDE7P6.js} +1 -1
- package/dist/{openai-7C6BVQ7M.js → openai-HCAV4QMK.js} +1 -1
- package/dist/providers-SPLB2SQZ.js +4 -0
- package/dist/seatbelt-UO7HGD4Z.js +0 -0
- package/dist/server-HBQZYHGG.js +4 -0
- package/dist/server-R4SJR6ZG.js +15 -0
- package/dist/{src-JBRNH4FA.js → src-DEVJGNXS.js} +1 -1
- package/dist/{src-X6JWWHHT.js → src-EMFESWQS.js} +1 -1
- package/dist/{src-R4BSSIJJ.js → src-GG4YROJH.js} +1 -1
- package/dist/{src-43CPCEK2.js → src-JFAO2DGP.js} +1 -1
- package/dist/stdio-INHOYWG6.js +5 -0
- package/dist/tool-filter-GPC6HF2N.js +4 -0
- package/dist/turndown.es-NQ3KDXM7.js +0 -0
- package/dist/websocket-KLVXQWQZ.js +9 -0
- package/package.json +18 -17
- package/dist/a2a-D7KSHNUT.js +0 -15
- package/dist/acp-W4R5P6CZ.js +0 -14
- package/dist/anthropic-DSNN5AE5.js +0 -4
- package/dist/chunk-2LHY3FND.js +0 -67
- package/dist/chunk-3QL446GD.js +0 -4
- package/dist/chunk-A7CJPQC5.js +0 -5
- package/dist/chunk-AGSYLE4E.js +0 -16
- package/dist/chunk-CU3IISCC.js +0 -4
- package/dist/chunk-D2SZ6GQJ.js +0 -1013
- package/dist/chunk-GVRZBATW.js +0 -4
- package/dist/chunk-HMZQYFYG.js +0 -4
- package/dist/chunk-HWCLMDQF.js +0 -28
- package/dist/chunk-I356BFD2.js +0 -6
- package/dist/chunk-JDK4YHNF.js +0 -63
- package/dist/chunk-JFKC4VCA.js +0 -4
- package/dist/chunk-KCMBAHWU.js +0 -4
- package/dist/chunk-OREDGNI6.js +0 -4
- package/dist/chunk-UUWXDH7J.js +0 -4
- package/dist/chunk-W4GMCNWF.js +0 -65
- package/dist/esm-57CJEGGK.js +0 -4
- package/dist/esm-YOQPBF42.js +0 -225
- package/dist/providers-TH6MQC7V.js +0 -4
- package/dist/server-TC5GDF6E.js +0 -4
- package/dist/slim-Q56GHZZP.js +0 -11
- package/dist/tool-filter-SYH5ZFC2.js +0 -4
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ 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,
|
|
17
|
+
- Built-in tool set: ReadFile, WriteFile, EditFile, Bash, PowerShell, Glob, Grep, WebFetch, LSP, ComputerUse, ToolSearch, McpCall, EnterWorktree, ExitWorktree, ExitPlanMode, Goal, the TaskCreate/TaskGet/TaskList/TaskUpdate and TodoWrite tracking tools, plus 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)
|
|
@@ -214,7 +214,7 @@ Print, remote, ACP, and A2A modes require at least one configured provider; the
|
|
|
214
214
|
```yaml
|
|
215
215
|
# Initial permission mode. Enum: default (ask per write/command) | acceptEdits (auto-approve
|
|
216
216
|
# file edits) | bypassPermissions (approve everything).
|
|
217
|
-
# Other values fall back to default. Shift+Tab cycles these modes
|
|
217
|
+
# Other values fall back to default. Shift+Tab cycles these modes and plan mode.
|
|
218
218
|
permission_mode: bypassPermissions
|
|
219
219
|
|
|
220
220
|
# Model providers. At least one is required.
|
|
@@ -462,7 +462,7 @@ In addition to `mcp_servers` in `config.yaml`, Yukino reads a project-level `.mc
|
|
|
462
462
|
|
|
463
463
|
Each entry takes `command`/`args`/`env` (stdio) or `url`/`headers` with `type` of `http` or `sse`. Environment references support `${VAR}`, `${VAR:-default}`, and `$VAR` in commands, arguments, environment values, URLs, and headers; an unset variable without a default prevents that server from connecting. These servers are merged with the user-level `mcp_servers`; on a name collision the user-level entry wins. At startup, a malformed `.mcp.json` is ignored (logged), while an invalid individual server entry is skipped without disabling valid siblings. During `/mcp reload`, invalid config aborts the reload so the current connections remain intact.
|
|
464
464
|
|
|
465
|
-
After editing `.mcp.json` or `config.yaml`, use `/mcp reload` in the UI to re-read both sources.
|
|
465
|
+
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.
|
|
466
466
|
|
|
467
467
|
### Language servers (LSP)
|
|
468
468
|
|
|
@@ -501,20 +501,18 @@ The common built-in registry is used by terminal, print, Remote/ACP/A2A, and in-
|
|
|
501
501
|
|
|
502
502
|
### Worker lifecycle
|
|
503
503
|
|
|
504
|
-
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. Finished
|
|
504
|
+
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.
|
|
505
505
|
|
|
506
506
|
An explicit `run_in_background: false` overrides a predefined agent's `background: true`; when omitted, the definition supplies the default. Forks default to foreground execution. Role files accept a UTF-8 BOM before frontmatter. Delegated agents cannot manage the main session's persistent goal.
|
|
507
507
|
|
|
508
508
|
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.
|
|
509
509
|
|
|
510
|
-
The team retains at most 200 terminated member summaries; running and idle members are never evicted. Fully cleaned-up failed/stopped member names can be reused. Agent definitions support `permission_mode: default | acceptEdits | plan | bypassPermissions`. Omitted modes inherit the parent's live mode. Parent `acceptEdits` and `bypassPermissions` override configured child modes; a child cannot enable bypass unless the parent already uses it. Child mode changes never change the parent. Plan mode blocks mutations, even through allow rules or sandbox auto-allow, except the declared plan file and internal coordination tools. `max_turns` must be a positive integer. Built-in explore uses the selected parent model unless explicitly overridden.
|
|
510
|
+
The team retains at most 200 terminated member summaries; running and idle members are never evicted. Fully cleaned-up failed/stopped member names can be reused. Agent definitions support `permission_mode: default | acceptEdits | plan | bypassPermissions`. Omitted modes inherit the parent's live mode. Parent `acceptEdits` and `bypassPermissions` override configured child modes except permanently read-only roles and coordinator teammates awaiting execution approval; a child cannot enable bypass unless the parent already uses it. Built-in `plan` and `explore` workers stay permanently read-only, including follow-up assignments; parent modes and plan approval cannot grant them execution permissions. Child mode changes never change the parent. Plan mode blocks mutations, even through allow rules or sandbox auto-allow, except the declared plan file and internal coordination tools. `max_turns` must be a positive integer. Built-in explore uses the selected parent model unless explicitly overridden.
|
|
511
511
|
|
|
512
|
-
Teammates run only in-process and route permission requests through the main session. Requests identify the agent and working directory; remembered permission patterns apply to all agents in the project.
|
|
512
|
+
Teammates run only in-process and route permission requests through the main session. Requests identify the agent and working directory; remembered permission patterns apply to all agents in the project. Plan-mode definitions can use `ExitPlanMode` unless explicitly excluded by their tool restrictions; `EnterPlanMode` remains unavailable to delegated agents. One-shot planning subagents return their plans to the parent without changing its mode. In coordinator mode, plan-then-execute teammates requested with `plan_mode_required` or a plan-mode definition stay read-only until the leader reviews the plan and sends `SendMessage(type="plan_approval_response", to=teammate, request_id=requestId, approve=true/false, content=review feedback)`. Permanently read-only built-in `plan` and `explore` workers return research without entering execution approval, even when `plan_mode_required` is set. Rejected plans must be revised and resubmitted. Outside coordinator mode, submitted execution plans remain automatically approved. Approval resumes the teammate in the leader's current mode (`default` when the leader remains in `plan`) and does not authorize subsequent tool calls. Before resuming execution or plan revision, the host includes queued ordinary team messages with the review feedback so scope corrections are applied in that next turn. Stopped teammates release their task ownership; restored sessions mark old runtimes inactive and reclaim unfinished work. Edited worktrees are retained for explicit integration, not deleted as part of runtime cleanup. Starting an Agent under a different team name never implicitly destroys another existing team.
|
|
513
513
|
|
|
514
514
|
Bash and PowerShell commands recognized by `isSafeCommand` can run in parallel. Unrecognized commands and file mutations share a process-wide FIFO queue keyed by canonical working directory, so agents in the same workspace cannot perform these operations simultaneously. Independent worktree directories have independent queues. Queued operations can be cancelled and recheck permissions before starting. Background commands hold their workspace slot until the tracked shell exits; moving a command to the background does not release it.
|
|
515
515
|
|
|
516
|
-
`WebSearch` directly requests Bing's public search pages and extracts organic result titles, source URLs, and snippets. It requires no search API key, subscription, or paid search API. Bing receives the query, requested result count, and market selection, together with ordinary HTTP request information. Requests are cancellable, limited to 25 seconds and 2 MiB, and model output is capped at 100,000 characters. Bing may return fewer results than requested. Network failures, rate limits, CAPTCHA, and unrecognized page layouts are reported as tool errors, distinct from an explicit empty search. `allowed_domains` and `blocked_domains` are mutually exclusive hostname lists, applied locally to decoded result URLs with exact-host/subdomain matching. Filtering can reduce the number of results; it does not ask Bing to search again. No session ID, provider/model, or workspace metadata is transmitted. Never include private source code or secrets in queries; treat results as untrusted content and cite source URLs. Use `WebFetch` to read a source page; search snippets are not full-page content.
|
|
517
|
-
|
|
518
516
|
`WebFetch` cancels discarded response bodies and honors cancellation even for cached pages. Direct HTTP/HTTPS access, including project intranet endpoints, remains supported.
|
|
519
517
|
|
|
520
518
|
### Persistent goals
|
|
@@ -538,6 +536,8 @@ TUI, Remote/ACP/A2A, and print mode share this goal loop. `yukino -p "/goal <obj
|
|
|
538
536
|
|
|
539
537
|
## Usage
|
|
540
538
|
|
|
539
|
+
Run `yukino --help` (or `-h`) for a summary of all command-line options; type `/help` inside a session for the list of slash commands.
|
|
540
|
+
|
|
541
541
|
### Interactive UI Mode
|
|
542
542
|
|
|
543
543
|
```bash
|
|
@@ -575,6 +575,8 @@ yukino --remote 0 # OS-assigned ephemeral port; the actual URL is
|
|
|
575
575
|
|
|
576
576
|
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.
|
|
577
577
|
|
|
578
|
+
The browser UI mirrors the terminal UI's capabilities: streaming replies and thinking, tool cards with live output, permission and ask-user dialogs, plan approval, the code-review form, `/resume` session picker, steering messages while a turn runs (with a follow-up queue for messages that cannot steer), prompt history (`↑`/`↓`), `@file` completion, `!`/`!!` user Bash, image attachments (paste, drop, or the attach button — stored like terminal clipboard images and expanded as `@` references), todo progress, the Agents panel (subagents, background tasks, teammates), context-window usage, and dark/light themes. Model (`/model`), provider (`/login`, `/provider`), thinking level (`/thinking`), permission mode (badge click or `Shift+Tab`), rewind (`/rewind`), sandbox (`/sandbox`), worktree (`/worktree`), MCP reload (`/mcp reload`), fork-mode skills, and `/quit` (shuts the server down) all work from the browser; `Ctrl+B` backgrounds running foreground shells and `Esc` cancels the active turn. Background tasks and teammate notifications wake an idle server the same way they do in the terminal.
|
|
579
|
+
|
|
578
580
|
### ACP Mode (Editor Integration)
|
|
579
581
|
|
|
580
582
|
```bash
|
|
@@ -621,7 +623,7 @@ Inside the UI, these commands are available:
|
|
|
621
623
|
| /sandbox [mode] | Configure sandbox (auto=on+auto, manual=on+manual, off) |
|
|
622
624
|
| /worktree | List git worktrees |
|
|
623
625
|
| /mcp | Show MCP server status |
|
|
624
|
-
| /mcp reload | Re-read MCP config;
|
|
626
|
+
| /mcp reload | Re-read MCP config; disconnect every server and reconnect the freshly read list |
|
|
625
627
|
| /thinking [level] | Without an argument, open a picker of the supported thinking levels; with one, set the level (off, minimal, low, medium, high, xhigh, max). The setting persists to `~/.yukino/config.yaml` |
|
|
626
628
|
| /code-review | Open the code review form for workspace, branch-range, or commit review |
|
|
627
629
|
| /quit | Exit the application |
|
|
@@ -643,7 +645,7 @@ Commands can run while the model is streaming, with at most one user command at
|
|
|
643
645
|
| ↓ | On the last input line, view all teammates and background subagents |
|
|
644
646
|
| Ctrl+B | Move running foreground Bash/PowerShell tasks to the background |
|
|
645
647
|
| Ctrl+V | Paste a clipboard image (Alt+V on Windows) |
|
|
646
|
-
| Shift+Tab | Cycle default → acceptEdits → bypassPermissions
|
|
648
|
+
| Shift+Tab | Cycle default → acceptEdits → bypassPermissions → plan |
|
|
647
649
|
|
|
648
650
|
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.
|
|
649
651
|
|
|
@@ -651,7 +653,7 @@ Use the mouse wheel or trackpad to scroll conversation history in the terminal's
|
|
|
651
653
|
|
|
652
654
|
**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.
|
|
653
655
|
|
|
654
|
-
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.
|
|
656
|
+
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.
|
|
655
657
|
|
|
656
658
|
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.
|
|
657
659
|
|
|
@@ -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 as m}from"./chunk-UDDADKJP.js";import{a as Q}from"./chunk-P6DHMU7R.js";import{a as X,b as Z}from"./chunk-MHRZYJJO.js";import{D as Y,E as w,F as E,G as V,H as u,I as W,J as D,K as J,i as N,k as R,l as B,m as O,n as U,o as $,p as P,r as j,x as H}from"./chunk-3O2CPTOD.js";import"./chunk-CUCQV3CL.js";import"./chunk-MQAQBW7F.js";import{A as G,k as K,l as F,s as q,v as p,w as z}from"./chunk-H7DHVEP7.js";import"./chunk-LCWNSYZU.js";import"./chunk-WGRGSG2J.js";import"./chunk-7MKA3SHV.js";function ne(o){for(let t=o.length-1;t>=0;t--){let e=o[t];if(e.defer_loading!==!0){e.cache_control={type:"ephemeral"};return}}}function se(o){return o.some(t=>"defer_loading"in t&&t.defer_loading===!0)}function re(o,t){if("input_schema"in o){let e=o,{cache_control:n,...r}=e;return t||delete r.type,{...r,...t?{type:"custom"}:{},...e.defer_loading!==!0&&n?{cache_control:n}:{}}}throw new Error("Anthropic received a tool schema serialized for another protocol.")}var ie=K({module:"llm"});function d(o){return typeof o=="string"?[{type:"text",text:o}]:o.map(t=>{let e=F(t);if(!e||e.type==="tool_reference")throw new Error(`Unsupported user content block: ${G(t,"type","unknown")}`);return e})}function ae(o){let t=[];for(let e of o)if(e.role==="assistant"){let n=[];if(e.thinkingBlocks)for(let i of e.thinkingBlocks)n.push({type:"thinking",thinking:i.thinking,signature:i.signature});let r=typeof e.content=="string"?e.content:q(e.content);if(r&&n.push({type:"text",text:r}),e.toolUses)for(let i of e.toolUses)n.push({type:"tool_use",id:i.toolUseId,name:i.toolName==="ComputerUse"?"computer":i.toolName,input:i.arguments});n.length===0&&n.push({type:"text",text:""}),t.push({role:"assistant",content:n})}else if(e.toolResults&&e.toolResults.length>0){let n=[];for(let r of e.toolResults)n.push({type:"tool_result",tool_use_id:r.toolUseId,is_error:r.isError,content:r.contentBlocks?.length?r.contentBlocks:r.content});e.content.length>0&&n.push(...d(e.content)),t.push({role:"user",content:n})}else{if(t.length===0){t.push({role:"user",content:d(e.content)});continue}let n=t[t.length-1],r=n.content;n.role==="user"?(typeof r=="string"&&(r=n.content=r.trim().length>0?[{type:"text",text:r}]:[]),r.push(...d(e.content))):t.push({role:"user",content:d(e.content)})}return t}var ee=class{protocol="anthropic";client;model;thinkingLevel;systemPrompt;config;useExplicitCustomToolType;constructor(t,e){let n=H(t);if(!n)throw new E("Anthropic API key not found, set ANTHROPIC_API_KEY in ~/.yukino/config.yaml, or via ANTHROPIC_API_KEY env variable.");this.client=new m({apiKey:n,baseURL:t.base_url}),this.useExplicitCustomToolType=Z(t.base_url),this.model=t.model,this.config={...t},this.thinkingLevel=R(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=P(this.config,t),this.thinkingLevel}getThinkingLevel(){return this.thinkingLevel}getSupportedThinkingLevels(){return $(this.config)}async*stream(t,e,n,r){let i=r?.maxOutputTokens===void 0?this.config:{...this.config,max_output_tokens:r.maxOutputTokens},I=j(i),S=ae(Y(t.getMessages())),te=se(e),k=e.map(a=>re(a,this.useExplicitCustomToolType));ne(k),le(S);let h={model:this.model,max_tokens:I,stream:!0,system:[{type:"text",text:this.systemPrompt,cache_control:{type:"ephemeral"}}],messages:S,...k.length>0?{tools:k}:{}},_=P(i,this.getThinkingLevel());if(i.reasoning!==!1)if(_==="off")h.thinking={type:"disabled"};else if(i.thinking_mode==="adaptive"){let a=U(_,i);a!==null&&(h.thinking={type:"adaptive"},h.output_config={effort:a})}else{let a=O(_,i);a!==null&&a!=="none"&&(h.thinking={type:"enabled",budget_tokens:Math.min(B(a),I-N)})}let y=0,T=0,v=0,A=0,C="end_turn",L="",b="",x=!1,M=!1;try{let a=[...te?[X]:[]],oe=this.client.messages.stream(h,{...n?{signal:n}:{},...a.length>0?{headers:{"anthropic-beta":a.join(",")}}:{}}),c="",g="",f="";for await(let l of oe)switch(l.type){case"content_block_start":{let s=l.content_block;if(s.type==="thinking")x=!0,L="",b="";else if(s.type==="tool_use"){if(!s.id||!s.name)throw new u("Anthropic tool call started without a valid id or name");g=s.id,c=s.name==="computer"?"ComputerUse":s.name,f="",yield{type:"tool_call_start",toolName:c,toolId:g}}break}case"content_block_delta":{let s=l.delta;if(s.type==="thinking_delta")L+=s.thinking,yield{type:"thinking_delta",text:s.thinking};else if(s.type==="signature_delta")b+=s.signature;else if(s.type==="text_delta")yield{type:"text_delta",text:s.text};else if(s.type==="input_json_delta"){if(!g||!c)throw new u("Anthropic tool arguments arrived before a valid tool call");f+=s.partial_json,yield{type:"tool_call_delta",text:s.partial_json}}break}case"content_block_stop":{if(x&&(yield{type:"thinking_complete",thinking:L,signature:b},x=!1),c){let s=Q(f);yield{type:"tool_call_complete",toolId:g,toolName:c,arguments:s.arguments,...s.parseError?{parseError:s.parseError}:{}},c="",g="",f=""}break}case"message_delta":{l.delta.stop_reason&&(C=l.delta.stop_reason);let s=l.usage;typeof s.output_tokens=="number"&&(T=s.output_tokens),typeof s.input_tokens=="number"&&(y=s.input_tokens),typeof s.cache_read_input_tokens=="number"&&(v=s.cache_read_input_tokens),typeof s.cache_creation_input_tokens=="number"&&(A=s.cache_creation_input_tokens);break}case"message_stop":{M=!0;break}case"message_start":{y=l.message.usage.input_tokens,T=l.message.usage.output_tokens,v=l.message.usage.cache_read_input_tokens??0,A=l.message.usage.cache_creation_input_tokens??0;break}}if(!M)throw new u("Anthropic stream ended without message_stop; response was truncated");yield{type:"stream_end",stopReason:C,usage:{inputTokens:y,outputTokens:T,cacheReadInputTokens:v,cacheCreationInputTokens:A}}}catch(a){throw ie.error({err:a},"llm operation failed"),ce(a)}}};function le(o){for(let t=o.length-1;t>=0;t--){if(o[t].role!=="user")continue;let e=o[t].content;if(typeof e=="string"&&e.length===0||Array.isArray(e)&&e.length===0)return;typeof e=="string"&&(e=o[t].content=[{type:"text",text:e}]);let n=e[e.length-1];for(let r=e.length-1;r>=0;r--)if(e[r].type!=="image"){n=e[r];break}Reflect.set(n,"cache_control",{type:"ephemeral"});return}}function ce(o){if(o instanceof w)return o;if(o instanceof m.APIConnectionError||o instanceof m.APIUserAbortError)return new u(`Network error: ${o.message}`);if(o instanceof m.APIError){if(o.status===413||o.status===400&&J(o.message))return new D(`Prompt too long: ${o.message}`);if(o.status===401)return new E(`Invalid API key: ${o.message}`);if(o.status===429){let t=o.headers,e=t instanceof Headers?t.get("retry-after"):void 0,n="Rate Limited";if(e){let r=Number.parseInt(p(e));Number.isNaN(r)?n+=", please wait.":n+=`, retry after ${p(r)}s.`}else n+=", please wait.";return new V(n,e?p(e):void 0)}if(o.status!==void 0&&(o.status>=500||o.status===408)){let t=o.headers;return new W(`Anthropic API error (${p(o.status)}): ${o.message}`,t instanceof Headers?t.get("retry-after")??void 0:void 0)}return new w(`Anthropic API error (${p(o.status)}): ${o.message}`)}return new u(`Network error: ${z(o)}`)}export{ee as AnthropicClient,ae as buildAnthropicMessages,le as markLastUserTailForCache,ne as markToolsForCache,se 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="#
|
|
11
|
+
<meta name="theme-color" content="#18181e" />
|
|
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: #
|
|
36
|
+
background: #18181e;
|
|
37
37
|
}
|
|
38
38
|
</style>
|
|
39
39
|
</head>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var j=Object.create;var f=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty;var n=Reflect.get;var i=b=>{throw TypeError(b)};var o=(b,a,c)=>a in b?f(b,a,{enumerable:!0,configurable:!0,writable:!0,value:c}):b[a]=c;var q=(b,a)=>()=>(a||b((a={exports:{}}).exports,a),a.exports),r=(b,a)=>{for(var c in a)f(b,c,{get:a[c],enumerable:!0})},p=(b,a,c,d)=>{if(a&&typeof a=="object"||typeof a=="function")for(let e of l(a))!m.call(b,e)&&e!==c&&f(b,e,{get:()=>a[e],enumerable:!(d=k(a,e))||d.enumerable});return b};var s=(b,a,c)=>(c=b!=null?j(h(b)):{},p(a||!b||!b.__esModule?f(c,"default",{value:b,enumerable:!0}):c,b));var t=(b,a,c)=>o(b,typeof a!="symbol"?a+"":a,c),g=(b,a,c)=>a.has(b)||i("Cannot "+c);var u=(b,a,c)=>(g(b,a,"read from private field"),c?c.call(b):a.get(b)),v=(b,a,c)=>a.has(b)?i("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(b):a.set(b,c),w=(b,a,c,d)=>(g(b,a,"write to private field"),d?d.call(b,c):a.set(b,c),c),x=(b,a,c)=>(g(b,a,"access private method"),c);var y=(b,a,c)=>n(h(b),c,a);export{q as a,r as b,s as c,t as d,u as e,v as f,w as g,x as h,y as i};
|