@yukino.js/yukino 0.0.20 → 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 (35) hide show
  1. package/README.md +12 -38
  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-3V2Q65BE.js → chunk-2N7OIUQW.js} +197 -198
  9. package/dist/{chunk-LUBMW3QT.js → chunk-57IGGFHK.js} +5 -5
  10. package/dist/{chunk-Q6322VDG.js → chunk-5AOJ5ZSQ.js} +20 -20
  11. package/dist/chunk-5D3QKHYQ.js +36 -0
  12. package/dist/{chunk-FK5B4XFN.js → chunk-7WP7SERS.js} +1 -1
  13. package/dist/{chunk-SLZKGKP5.js → chunk-EQABLL4S.js} +1 -1
  14. package/dist/{chunk-T3MBBXTU.js → chunk-P6K7EQHF.js} +29 -29
  15. package/dist/{chunk-D64ZLLSN.js → chunk-WKTO7XPO.js} +1 -1
  16. package/dist/lib/{anthropic-UZXEGJN5.js → anthropic-TYBMDJP3.js} +3 -3
  17. package/dist/lib/{chunk-6RBU5LDC.js → chunk-3QGT2MSI.js} +0 -42
  18. package/dist/lib/{chunk-V3WAJBLN.js → chunk-IPKULHXR.js} +2 -2
  19. package/dist/lib/{chunk-FHJHT233.js → chunk-NIUCGP4C.js} +80 -238
  20. package/dist/lib/{chunk-2QPNVR5H.js → chunk-OPEO6D4O.js} +2 -5
  21. package/dist/lib/{chunk-Y3EO3KLE.js → chunk-XVXFUSSS.js} +2 -2
  22. package/dist/lib/index.d.ts +616 -819
  23. package/dist/lib/index.js +666 -1441
  24. package/dist/lib/{openai-DNNUHOKV.js → openai-Z2JCYL6F.js} +3 -3
  25. package/dist/lib/{providers-NBWCB4EA.js → providers-2NPR2VR4.js} +2 -2
  26. package/dist/{main-IEQSD5OX.js → main-OMIZDIYB.js} +221 -221
  27. package/dist/main.js +2 -2
  28. package/dist/{openai-SRAHPUVF.js → openai-UOCUBMFA.js} +1 -1
  29. package/dist/{providers-ETXXDQGM.js → providers-G5SKN22T.js} +1 -1
  30. package/dist/server-ESDMJACZ.js +14 -0
  31. package/dist/{server-N2WSM46R.js → server-Z742CQSK.js} +1 -1
  32. package/package.json +4 -4
  33. package/dist/anthropic-XJSWCDJD.js +0 -4
  34. package/dist/chunk-ZZF3DILS.js +0 -38
  35. package/dist/server-HXOWUX6N.js +0 -14
package/README.md CHANGED
@@ -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.
@@ -255,17 +255,13 @@ 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
267
  # protocol falls back to dispatch. Applies to TUI, print, remote and A2A modes.
@@ -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
@@ -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/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,28 +560,6 @@ 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:
@@ -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,7 +616,7 @@ 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
 
@@ -857,11 +831,11 @@ Run `/plan` to plan the current task, or `/plan <task>` to specify a planning re
857
831
 
858
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.
859
833
 
860
- 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.
861
835
 
862
- **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.
863
837
 
864
- 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.
865
839
 
866
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.
867
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};