@yukino.js/yukino 0.0.18 → 0.0.19
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 +2 -2
- package/dist/{anthropic-SNLPAGHS.js → anthropic-D72CIYEQ.js} +1 -1
- package/dist/browser/dist/static/{highlight-3YCG6EL4.js → highlight-ZDY7K2CR.js} +12 -12
- package/dist/browser/dist/static/index.js +77 -70
- package/dist/browser/dist/static/{webapi-2B2CRWRA.js → webapi-HZESKPJE.js} +1 -1
- package/dist/chunk-456FRBGE.js +4 -0
- package/dist/{chunk-CTYNHZ3Y.js → chunk-676RWZYX.js} +1 -1
- package/dist/{chunk-QZ5RINXE.js → chunk-6SWKDCK3.js} +1 -1
- package/dist/chunk-7WYSSZKU.js +18 -0
- package/dist/{chunk-F7FUNBYM.js → chunk-A4IB5PNW.js} +1 -1
- package/dist/{chunk-ZESFB5XU.js → chunk-BCYFGWSM.js} +16 -16
- package/dist/{chunk-CYKTCSRI.js → chunk-DGDF5PBF.js} +206 -203
- package/dist/chunk-FNQMXCCE.js +4 -0
- package/dist/chunk-HKQWGX5S.js +4 -0
- package/dist/{chunk-HRAX6543.js → chunk-N7G2FDAI.js} +1 -1
- package/dist/chunk-NPIMUWFO.js +4 -0
- package/dist/{chunk-CZGLX3AK.js → chunk-PYFRT6N5.js} +1 -1
- package/dist/{chunk-UQM7BD5K.js → chunk-QDMUFOED.js} +1 -1
- package/dist/chunk-QYUIIFJY.js +4 -0
- package/dist/{chunk-IO3PJG3N.js → chunk-S56AXDDN.js} +1 -1
- package/dist/chunk-U6NE2CTP.js +4 -0
- package/dist/{chunk-ILSOSAOB.js → chunk-UX5DJPHN.js} +29 -29
- package/dist/{chunk-K6F424MN.js → chunk-WKKH2UE5.js} +1 -1
- package/dist/{chunk-7S5SR6KL.js → chunk-XDERLDVW.js} +8 -8
- package/dist/{esm-RASD3BGK.js → esm-46K5BSA6.js} +1 -1
- package/dist/{esm-6WYDAALC.js → esm-63A57VQM.js} +1 -1
- package/dist/esm-6D27H27M.js +225 -0
- package/dist/{esm-7VCKZ3CE.js → esm-73AG4F4H.js} +1 -1
- package/dist/{esm-AFNMXGOY.js → esm-FURF4AWD.js} +1 -1
- package/dist/esm-HB7M3TZY.js +4 -0
- package/dist/{esm-MYMSBMIY.js → esm-QAEO3U72.js} +1 -1
- package/dist/file-type-PSFVPAEH.js +12 -0
- package/dist/{getMachineId-bsd-SR65JA23.js → getMachineId-bsd-2MDOCJCH.js} +1 -1
- package/dist/{getMachineId-bsd-MTZJBHHS.js → getMachineId-bsd-JZNSGCLM.js} +1 -1
- package/dist/getMachineId-bsd-L5XEQF74.js +4 -0
- package/dist/{getMachineId-darwin-J7BNWNFS.js → getMachineId-darwin-32V6AVQO.js} +1 -1
- package/dist/{getMachineId-darwin-UX2LWEFP.js → getMachineId-darwin-SMQEPEZ2.js} +1 -1
- package/dist/getMachineId-darwin-V3OSZDJX.js +5 -0
- package/dist/getMachineId-linux-C4WJW6ZL.js +4 -0
- package/dist/{getMachineId-linux-XGLIABQN.js → getMachineId-linux-OWR5YFVH.js} +1 -1
- package/dist/{getMachineId-linux-RNGA35ZF.js → getMachineId-linux-T543G3ZF.js} +1 -1
- package/dist/{getMachineId-unsupported-JDNTBZDQ.js → getMachineId-unsupported-J7U5FNFT.js} +1 -1
- package/dist/getMachineId-unsupported-M7AEHRA4.js +4 -0
- package/dist/{getMachineId-unsupported-4ACRY4OO.js → getMachineId-unsupported-ZH5H5BSP.js} +1 -1
- package/dist/getMachineId-win-2ZKMVYDE.js +4 -0
- package/dist/getMachineId-win-JHSGKXX7.js +4 -0
- package/dist/getMachineId-win-JOM5JSRW.js +4 -0
- package/dist/image-worker.js +1 -1
- package/dist/lib/{anthropic-UZWRSZSZ.js → anthropic-I7ZSAP7Z.js} +3 -3
- package/dist/lib/{chunk-KKAVW72Q.js → chunk-MJHQUFUL.js} +2 -2
- package/dist/lib/{chunk-T33QIWPB.js → chunk-T4WEXOQ7.js} +20 -1
- package/dist/lib/{chunk-F66UUNE7.js → chunk-TO34ITLQ.js} +2 -2
- package/dist/lib/{chunk-EYSD63EM.js → chunk-UU6ZV6GB.js} +1 -1
- package/dist/lib/{chunk-I7AT5Q45.js → chunk-YZURLYHG.js} +2 -2
- package/dist/lib/index.d.ts +59 -14
- package/dist/lib/index.js +717 -559
- package/dist/lib/{openai-UB67SMOX.js → openai-Y4P7SWUB.js} +3 -3
- package/dist/lib/{providers-YZB3ZC4N.js → providers-MRGAAMBB.js} +2 -2
- package/dist/{main-XRZCWPXW.js → main-MHJXHOY6.js} +203 -199
- package/dist/main.js +2 -2
- package/dist/{openai-SVRRJUPW.js → openai-3IGA2BCD.js} +1 -1
- package/dist/providers-GRYPIKCY.js +4 -0
- package/dist/server-XBVP3S5Q.js +4 -0
- package/dist/{server-SHFUKQA4.js → server-ZYP54JBK.js} +1 -1
- package/dist/{src-EZJEUBJC.js → src-CHQYSTW5.js} +1 -1
- package/dist/{src-32KR7AJY.js → src-HH6MC5CF.js} +1 -1
- package/dist/src-P2WNZ6IY.js +12 -0
- package/dist/{src-7S4T5QVZ.js → src-YWYPK5QA.js} +1 -1
- package/dist/stdio-UHDEALLA.js +5 -0
- package/dist/{websocket-5P5FBVU6.js → websocket-J5DE5FRQ.js} +1 -1
- package/package.json +1 -1
- package/dist/chunk-5ZELCP2G.js +0 -4
- package/dist/chunk-BPGCPI76.js +0 -18
- package/dist/chunk-IQT2IFSO.js +0 -4
- package/dist/chunk-W2VWX7HR.js +0 -4
- package/dist/chunk-XQCCZYMT.js +0 -4
- package/dist/esm-BOD3YQPE.js +0 -225
- package/dist/esm-UKQMXG2A.js +0 -4
- package/dist/file-type-P5MHDLHF.js +0 -12
- package/dist/getMachineId-win-BLVGSBMB.js +0 -4
- package/dist/getMachineId-win-PANZD46Y.js +0 -4
- package/dist/providers-KK4H4FPS.js +0 -4
- package/dist/server-ZYMTEUKF.js +0 -4
- package/dist/src-VLEWSGZD.js +0 -12
- package/dist/stdio-DWJD5XUT.js +0 -5
package/README.md
CHANGED
|
@@ -629,7 +629,7 @@ Source snapshots, JSON arguments, journals, and run state live under `~/.yukino/
|
|
|
629
629
|
|
|
630
630
|
### Worker lifecycle
|
|
631
631
|
|
|
632
|
-
Agent defaults to `kind: "teammate"`, joins the
|
|
632
|
+
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
633
|
|
|
634
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.
|
|
635
635
|
|
|
@@ -693,7 +693,7 @@ Mandatory policy constraints take precedence over rank composition:
|
|
|
693
693
|
|
|
694
694
|
Permission composition selects a mode; tool availability, explicit permission rules, and applicable sandbox policies still govern individual operations. An effective `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.
|
|
695
695
|
|
|
696
|
-
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, teammates with `subagent_type: "plan"` 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)`. The built-in `plan` role plans and then executes as a teammate; one-shot `plan` subagents and all built-in `explore` workers remain permanently read-only and return research without entering execution approval. Rejected plans must be revised and resubmitted. Outside coordinator mode, submitted execution plans remain automatically approved. Approval writes the leader's current mode into the teammate's own mode (`default` when the leader remains in `plan`) and resumes execution under rank composition; it does not authorize subsequent tool calls. This stored mode remains available to later permission checks: a teammate approved under `bypassPermissions` retains that own mode when the leader later switches to `default`, `acceptEdits`, or `plan`. 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. Agent teammate calls reuse the
|
|
696
|
+
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, teammates with `subagent_type: "plan"` 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)`. The built-in `plan` role plans and then executes as a teammate; one-shot `plan` subagents and all built-in `explore` workers remain permanently read-only and return research without entering execution approval. Rejected plans must be revised and resubmitted. Outside coordinator mode, submitted execution plans remain automatically approved. Approval writes the leader's current mode into the teammate's own mode (`default` when the leader remains in `plan`) and resumes execution under rank composition; it does not authorize subsequent tool calls. This stored mode remains available to later permission checks: a teammate approved under `bypassPermissions` retains that own mode when the leader later switches to `default`, `acceptEdits`, or `plan`. 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. Agent teammate calls reuse the selected team; an explicit TeamCreate adds another team without stopping or deleting existing teams. TeamDelete stops and removes only the selected team.
|
|
697
697
|
|
|
698
698
|
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.
|
|
699
699
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __yukinoCreateRequire } from "node:module";
|
|
3
3
|
const require = __yukinoCreateRequire(import.meta.url);
|
|
4
|
-
import{g}from"./chunk-UDDADKJP.js";import{a as ne}from"./chunk-P6DHMU7R.js";import{Oa as oe,a as Y,g as te}from"./chunk-
|
|
4
|
+
import{g}from"./chunk-UDDADKJP.js";import{a as ne}from"./chunk-P6DHMU7R.js";import{Oa as oe,a as Y,g as te}from"./chunk-QDMUFOED.js";import{Z as V,g as $,h as j,ja as W,ka as M,l as K,la as R,m as E,ma as J,na as u,o as G,oa as Q,p as H,pa as X,q as I,qa as Z,s as S,za as ee}from"./chunk-676RWZYX.js";import{Kc as q,Nc as p,Oc as z,Rc as D,Sa as F}from"./chunk-BCYFGWSM.js";import"./chunk-WLJL66O5.js";import"./chunk-WGRGSG2J.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};
|