@yukino.js/yukino 0.0.12 → 0.0.13-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.
- package/README.md +5 -62
- package/dist/{a2a-RMMY65QU.js → a2a-DG2JNM3U.js} +1 -1
- package/dist/{acp-WY6JO5LK.js → acp-DCZDS6FQ.js} +1 -1
- package/dist/{anthropic-55TYAIKB.js → anthropic-5BTWVZVT.js} +1 -1
- package/dist/{chunk-HTLXOBAC.js → chunk-5DK2M7VI.js} +1 -1
- package/dist/{chunk-33HUTVDG.js → chunk-AZQD75PX.js} +1 -1
- package/dist/{chunk-IX65B3M7.js → chunk-BDLFNDC4.js} +1 -1
- package/dist/{chunk-V7Q2SA7H.js → chunk-COHBT6M7.js} +181 -175
- package/dist/{chunk-D4MZQCMB.js → chunk-CW5XFH7H.js} +2 -2
- package/dist/{chunk-7TZ52NFW.js → chunk-IWMCIYOG.js} +1 -1
- package/dist/{chunk-SYKQXO6W.js → chunk-SZXXASVH.js} +1 -1
- package/dist/{chunk-PWLFGDME.js → chunk-UGX62ZSO.js} +1 -1
- package/dist/lib/{chunk-WL3ML2TB.js → chunk-EGJKLA2W.js} +1 -1
- package/dist/lib/index.d.ts +12 -14
- package/dist/lib/index.js +199 -113
- package/dist/lib/{providers-DPVHJZAX.js → providers-MOCB6Y5L.js} +1 -1
- package/dist/{main-L3JP6JDZ.js → main-IA22XMQR.js} +162 -163
- package/dist/main.js +2 -2
- package/dist/{providers-VFEHLGQG.js → providers-DXQRJUIY.js} +1 -1
- package/dist/{server-F4PJ3W62.js → server-QS7CX37F.js} +1 -1
- package/dist/{tool-filter-5WW6YGKC.js → tool-filter-KDQMXIDC.js} +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
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{c as be,e as Xe,g as Te}from"./chunk-
|
|
4
|
+
import{c as be,e as Xe,g as Te}from"./chunk-AZQD75PX.js";import{a as R}from"./chunk-MQAQBW7F.js";import{b as P,c as He,d as se,e as Ge,g as ze,k as b,o as Ke,p as we,r as w,s as Ve,u as Ye,v as p,w as Je}from"./chunk-OI2W6R6H.js";import{a as I,b as U,c as qe}from"./chunk-LCWNSYZU.js";import{C as a,c as _,d as ye}from"./chunk-W4GMCNWF.js";import{randomBytes as Es}from"crypto";import{readdirSync as tr,readFileSync as rr,existsSync as sr}from"fs";import{join as or}from"path";var Ze=[{name:"general-purpose",description:"General-purpose agent for researching complex questions, exploring codebase, and executing multi-step tasks."},{name:"plan",description:"Investigate the existing architecture and propose a concrete implementation plan with relevant files, constraints, and verification steps. Read-only: do not create, edit, or delete files. Return unresolved questions to the parent agent.",disallowedTools:["EditFile","WriteFile"],permissionMode:"plan"},{name:"explore",description:"Find code, trace relevant call paths, and report evidence with file paths and line numbers. Use Glob, Grep, ReadFile, and read-only shell commands. Do not modify files; return missing context or blockers to the parent agent.",disallowedTools:["EditFile","WriteFile"],permissionMode:"plan"}];var Qe=b({module:"subagent"});function et(){let n=[...Ze];return nr(P("agents"),n),n}function nr(n,e){if(!sr(n))return;let t=tr(n).filter(r=>r.endsWith(".md"));for(let r of t)try{let s=rr(or(n,r),"utf-8"),o=ar(s);if(o){let i=e.findIndex(l=>l.name===o.name);i>=0?e[i]=o:e.push(o)}}catch(s){Qe.error({err:s},"subagent operation failed");continue}}var ir=a.looseObject({name:a.string().trim().min(1),description:a.string().optional(),tools:a.array(a.string()).optional(),disallowed_tools:a.array(a.string()).optional(),system_prompt:a.string().optional(),max_turns:a.number().int().positive().optional(),model:a.string().optional(),permission_mode:a.literal("plan").optional(),background:a.boolean().optional(),isolation:a.literal("worktree").optional()});function ar(n){n=n.replace(/^\uFEFF/u,"");let e=/^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/u.exec(n);if(!e)return null;let t=e[1].trim(),r=n.slice(e[0].length).trim();try{let s=R.load(t),o=_(ir,s);return{name:o.name,description:o.description??r.slice(0,200),tools:o.tools,disallowedTools:o.disallowed_tools,systemPromptOverride:o.system_prompt,maxTurns:o.max_turns,model:o.model,permissionMode:o.permission_mode,background:o.background,isolation:o.isolation,initialPrompt:r}}catch(s){return Qe.error({err:s},"subagent operation failed"),null}}var tt=b({module:"tasks"}),lr=200,cr=1,D=class extends Error{constructor(t){super("task failed");this.output=t}output},oe=class{tasks=new Map;notifiedTaskIds=new Set;listeners=new Set;pendingTaskIds=new Set;create(e,t,r,s={}){let o=`${s.idPrefix??"agent"}-${String(cr++)}`,i={id:o,name:e,...s.originToolCallId?{originToolCallId:s.originToolCallId}:{},...s.kind?{kind:s.kind}:{},status:"running",output:"",cancel:r,done:Promise.resolve()};return this.tasks.set(o,i),this.pendingTaskIds.add(o),i.done=Promise.resolve().then(()=>i.status==="cancelled"?i.output:t(i)).then(l=>{i.status==="running"&&(i.status="completed",i.output=l,this.emitChange())}).catch(l=>{i.status==="running"?(i.status="failed",i.output=l instanceof D?l.output:`Error: ${w(l)}`,this.emitChange()):i.status==="cancelled"&&l instanceof D&&(i.output=l.output,this.emitChange())}).finally(()=>{i.cancel=()=>{},this.pendingTaskIds.delete(o),this.emitChange()}),this.emitChange(),i}get(e){return this.tasks.get(e)}list(){return[...this.tasks.values()]}subscribe(e){return this.listeners.add(e),e(this.list()),()=>{this.listeners.delete(e)}}emitChange(){let e=this.list();for(let t of this.listeners)try{t(e)}catch(r){tt.error({error:r},"task subscriber failed")}}hasRunning(){return this.list().some(e=>e.status==="running")}stop(e){let t=this.tasks.get(e);if(t?.status!=="running")return!1;t.status="cancelled",t.output="Stopped by user";try{t.cancel()}catch(r){tt.error({error:r,taskId:e},"task cancellation callback failed")}finally{this.emitChange()}return!0}async stopAndWait(e){let t=this.tasks.get(e);if(!t)return!1;let r=this.stop(e);return await t.done,r}async stopAll(){let e=new Set;for(;;){let t=this.list().filter(r=>this.pendingTaskIds.has(r.id)&&!e.has(r.id));if(t.length===0)break;for(let r of t)e.add(r.id),this.stop(r.id);await Promise.allSettled(t.map(r=>r.done))}}async waitAll(e){for(;;){let t=this.list().filter(r=>this.pendingTaskIds.has(r.id)&&(!e||e(r)));if(t.length===0)return;await Promise.allSettled(t.map(r=>r.done))}}async wait(e,t){if(!Number.isInteger(t.timeoutMs)||t.timeoutMs<0||t.timeoutMs>6e4)throw new Error("Task wait timeout must be between 0 and 60000ms");let r=this.get(e);if(!r)return;if(t.abortSignal?.throwIfAborted(),!this.pendingTaskIds.has(e))return{task:r,timedOut:!1};let s,o;try{let i=new Promise((u,d)=>{s=setTimeout(()=>{u(!0)},t.timeoutMs),o=()=>{let c=t.abortSignal?.reason;d(c instanceof Error?c:new Error("Task wait interrupted"))},t.abortSignal?.addEventListener("abort",o,{once:!0})}),l=await Promise.race([r.done.then(()=>!1),i]);return{task:r,timedOut:l}}finally{s&&clearTimeout(s),o&&t.abortSignal?.removeEventListener("abort",o)}}hasNotifications(){return this.list().some(e=>e.status!=="running"&&!this.pendingTaskIds.has(e.id)&&!this.notifiedTaskIds.has(e.id))}drainNotifications(){let e=this.list().filter(t=>t.status!=="running"&&!this.pendingTaskIds.has(t.id)&&!this.notifiedTaskIds.has(t.id));for(let t of e)this.notifiedTaskIds.add(t.id);return this.pruneCompleted(),e}pruneCompleted(){let e=this.list().filter(s=>s.status!=="running"&&!this.pendingTaskIds.has(s.id)&&this.notifiedTaskIds.has(s.id)),t=e.length-lr,r=t>0;for(let s of e){if(t<=0)break;this.tasks.delete(s.id),this.notifiedTaskIds.delete(s.id),t--}r&&this.emitChange()}clear(){if(this.pendingTaskIds.size>0)throw new Error("Stop and await tasks before clearing their manager");this.tasks.clear(),this.notifiedTaskIds.clear(),this.emitChange()}};function Ys(n){return[`<task-notification task_id="${n.id}" status="${n.status}">`,`name=${n.name}`,n.output,"</task-notification>"].join(`
|
|
5
5
|
`)}import{readFileSync as Mr,writeFileSync as Ar,mkdirSync as Rr,renameSync as Cr,rmSync as _r,statSync as kt}from"fs";import{tmpdir as Ir}from"os";import{join as Dr,resolve as jr,dirname as yt}from"path";import{randomBytes as dr}from"crypto";import{mkdirSync as ur,readdirSync as xe,rmdirSync as mr,statSync as pr,unlinkSync as ne,writeFileSync as rt}from"fs";import{join as Ee,resolve as fr}from"path";var st=5e3,gr=1e4,hr=5,kr=80,ve=new Set,ot=a.looseObject({errno:a.number().optional(),code:a.string().optional(),path:a.string().optional(),syscall:a.string().optional()});function nt(n){let e=ye(ot,n);return e.success?e.data.code:void 0}function yr(n){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,n)}function wr(n){let e=/^ticket-(\d+)-/u.exec(n);return e?Number.parseInt(e[1]??"0",10):0}function br(n){let e=/^(?:choosing-|ticket-\d+-)(\d+)-/u.exec(n);if(!e)return null;let t=Number.parseInt(e[1]??"",10);return Number.isSafeInteger(t)&&t>0?t:null}function Tr(n){try{return process.kill(n,0),!0}catch(e){return nt(e)==="EPERM"}}function vr(n){let e=`${String(process.pid)}-${dr(8).toString("hex")}`,t=Ee(n,`choosing-${e}`);for(;;){ur(n,{recursive:!0});try{rt(t,String(process.pid),{flag:"wx"});break}catch(s){let o=ye(ot,s);if(!o.success||o.data.code!=="ENOENT")throw s}}let r;try{let s=xe(n).filter(i=>i.startsWith("ticket-")).reduce((i,l)=>Math.max(i,wr(l)),0)+1,o=`ticket-${String(s).padStart(16,"0")}-${e}`;return r=Ee(n,o),rt(r,String(process.pid),{flag:"wx"}),ne(t),{choosingPath:t,ticketPath:r,ticketName:o}}catch(s){for(let o of[t,r])if(o)try{ne(o)}catch{}throw s}}function Sr(n,e){let t=Date.now();for(let s of xe(n)){let o=Ee(n,s);if(!(o===e.choosingPath||o===e.ticketPath))try{let i=pr(o),l=br(s);t-i.mtimeMs>gr&&(l===null||!Tr(l))&&ne(o)}catch{}}let r=xe(n);return{choosing:r.filter(s=>s.startsWith("choosing-")),tickets:r.filter(s=>s.startsWith("ticket-")).sort()}}function Se(n,e){try{ne(e.ticketPath)}catch(t){if(nt(t)!=="ENOENT")throw t}try{mr(n)}catch{}}function it(n,e){let t=fr(`${n}.lock`);if(ve.has(t)){if(!e)return null;throw new Error(`file lock ${t}: recursive acquisition`)}let r=vr(t),s=Date.now()+st,o=hr;try{for(;;){let{choosing:i,tickets:l}=Sr(t,r);if(i.length===0&&l[0]===r.ticketName){ve.add(t);let u=!1;return()=>{u||(Se(t,r),u=!0,ve.delete(t))}}if(!e||Date.now()>=s){if(Se(t,r),!e)return null;throw new Error(`file lock ${t}: timed out after ${String(st)}ms`)}yr(o+Math.floor(Math.random()*o)),o=Math.min(o*2,kr)}}catch(i){try{Se(t,r)}catch{}throw i}}function to(n){return it(n,!1)}function q(n,e){let t=it(n,!0);if(!t)throw new Error(`file lock ${n}: acquisition failed`);try{return e()}finally{t()}}import{randomBytes as xr}from"crypto";var ie="text",H="shutdown_request",ae="shutdown_response",Er="plan_approval_request",le="plan_approval_response",y="leader",at=new Set(["SendMessage","TaskCreate","TaskGet","TaskList","TaskUpdate"]),Pr=/^[a-zA-Z0-9_-]+$/;function lt(n){return n!==y&&Pr.test(n)}var ct="[shutdown]";function dt(){return`req-${xr(8).toString("hex")}`}function ce(n,e,t,r,s){return{from:n,text:r,timestamp:new Date().toISOString(),type:e,requestId:t,...s===void 0?{}:{approve:s}}}function ut(n,e=""){let t=e||"team is wrapping up";return ce(n,H,dt(),`${ct} ${t}`)}function mt(n,e,t,r=""){return ce(n,ae,e,r,t)}function oo(n,e){return ce(n,Er,dt(),e)}function pt(n,e,t,r=""){return ce(n,le,e,r,t)}function no(n){return n.type===H?!0:(n.text??"").trim().startsWith(ct)}function io(n){return n.approve===!0}async function lo(n,e,t,r,s,o){if(o?.aborted)return"deny";let i=()=>{},l=new Promise(u=>{i=()=>{u("deny")},o?.addEventListener("abort",i,{once:!0})});try{return await Promise.race([n(e,t,r,s,o),l])}finally{o?.removeEventListener("abort",i)}}var $e=b({module:"permissions"}),Fr=[],Lr=["basename","cat","cksum","cmp","column","comm","cut","df","dirname","du","echo","expr","false","fold","fmt","grep","groups","head","id","jq","locate","ls","md5","md5sum","nl","od","paste","pgrep","printenv","printf","ps","pwd","readlink","realpath","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shasum","stat","strings","tac","tail","tr","true","tty","type","uname","uptime","w","wc","whereis","which","who","whoami","ack","ag","alias","arch","base64","bat","bzcat","cal","col","cloc","diff","diff3","dig","dmesg","expand","factor","free","help","hexdump","host","iconv","info","locale","lscpu","lsblk","lsof","lspci","lsusb","man","mdfind","mdls","ncal","netstat","nproc","nslookup","objdump","otool","pbpaste","ping","readelf","rev","sdiff","seq","sum","sw_vers","tldr","traceroute","unexpand","vm_stat","whois","xxd","xzcat","zcat","zgrep","zipinfo",/^command\s+(?:-v|-V)\s+\S+(?:\s+\S+)*$/,/^date(?!.*\s(?:-s|--set)(?:=|\s|$))(?:\s.*)?$/,/^file(?!.*(?:\s--compile(?:=|\s|$)|\s-[^-\s]*C))(?:\s.*)?$/,/^find(?!.*\s(?:-delete|-exec(?:dir)?|-ok(?:dir)?|-fls|-fprint(?:0)?|-fprintf)(?:\s|$))(?:\s.*)?$/,/^fd(?!.*\s(?:-x|-X|--exec|--exec-batch)(?:=|\s|$))(?:\s.*)?$/,/^hostname(?:\s+(?:-[adfFiIsyVh]|--(?:alias|all-fqdns|all-ip-addresses|domain|fqdn|help|ip-address|long|nis|short|version|yp)))*$/,/^rg(?!.*\s(?:--pre|--pre-glob|--hostname-bin)(?:=|\s|$))(?:\s.*)?$/,/^sort(?!.*\s(?:-o|--output|--compress-program)(?:=|\s|$))(?:\s.*)?$/,/^ss(?!.*\s(?:--kill|-[^-\s]*K)(?:\s|$))(?:\s.*)?$/,/^tree(?!.*\s(?:-o|--output)(?:=|\s|$))(?:\s.*)?$/,/^git\s+(?:--version|version)$/,/^git\s+(?:blame|cat-file|count-objects|describe|for-each-ref|ls-files|ls-tree|merge-base|name-rev|rev-parse|shortlog|show-ref|status|verify-pack)(?:\s.*)?$/,/^git\s+(?:diff|log|show)(?!.*\s(?:--ext-diff|--output)(?:=|\s|$))(?:\s.*)?$/,/^git\s+branch$/,/^git\s+branch(?=.*\s(?:-a|--all|-r|--remotes|--list|--show-current|--contains|--no-contains|--merged|--no-merged)(?:=|\s|$))(?!.*\s(?:-[dDmMcCf]|--(?:copy|create-reflog|delete|edit-description|move|set-upstream-to|unset-upstream))(?:=|\s|$))(?:\s.*)?$/,/^git\s+config(?:\s+(?:--blob(?:=|\s)\S+|--file(?:=|\s)\S+|--fixed-value|--global|--local|--null|--show-names|--show-origin|--show-scope|--system|--worktree|-z))*\s+(?:--get|--get-all|--get-regexp|--get-urlmatch|--list|-l)(?:\s.*)?$/,/^git\s+notes\s+(?:list|show)(?:\s.*)?$/,/^git\s+reflog\s+show(?:\s.*)?$/,/^git\s+remote(?:\s+-v)?$/,/^git\s+remote\s+get-url(?:\s+(?:--all|--push))*\s+\S+$/,/^git\s+remote\s+show(?:\s+-n)?(?:\s+\S+)?$/,/^git\s+stash\s+(?:list|show)(?:\s.*)?$/,/^git\s+submodule\s+(?:status|summary)(?:\s.*)?$/,/^git\s+tag(?:\s+(?:-l|--list)(?:\s.*)?)?$/,/^git\s+worktree\s+list(?:\s.*)?$/,/^(?:bun|npm|pnpm|yarn)\s+(?:explain|help|info|list|ls|outdated|prefix|query|root|search|show|view|why)(?:\s.*)?$/,/^(?:npm|pnpm|yarn)\s+config\s+(?:get|list)(?:\s.*)?$/,/^npm\s+pkg\s+get(?:\s.*)?$/,/^bun\s+pm\s+ls(?:\s.*)?$/,/^(?:bun|cargo|clang|cmake|composer|deno|gcc|gem|node|npm|php|pip|pip3|pnpm|python|python3|ruby|rustc|swift|yarn)\s+(?:--version|-V)$/,/^(?:go|helm|kubectl|podman|terraform)\s+version(?:\s.*)?$/,/^(?:java|javac)\s+-version$/,/^dotnet\s+(?:--info|--list-runtimes|--list-sdks|--version)$/,/^(?:docker|podman)\s+(?:diff|events|images|info|inspect|logs|port|ps|stats|top|version)(?:\s.*)?$/,/^(?:docker|podman)\s+(?:container|image|network|volume)\s+(?:inspect|ls)(?:\s.*)?$/,/^docker\s+compose\s+(?:config|images|logs|ps|top|version)(?:\s.*)?$/,/^kubectl\s+(?:api-resources|api-versions|cluster-info|describe|explain|get|logs|top|version)(?:\s.*)?$/,/^kubectl\s+config\s+(?:current-context|get-contexts|view)(?:\s.*)?$/,/^helm\s+(?:env|get|history|list|search|show|status|version)(?:\s.*)?$/,/^terraform\s+(?:output|providers|show|version)(?:\s.*)?$/,/^terraform\s+workspace\s+(?:list|show)(?:\s.*)?$/,/^systemctl\s+(?:is-active|is-enabled|is-failed|list-dependencies|list-jobs|list-sockets|list-timers|list-unit-files|list-units|show|show-environment|status)(?:\s.*)?$/,/^launchctl\s+(?:error|hostinfo|list|managername|managerpid|manageruid|print|print-cache|procinfo|variant|version)(?:\s.*)?$/,/^journalctl(?!.*\s--(?:rotate|vacuum|flush|sync))(?:\s.*)?$/,/^defaults\s+read(?:\s.*)?$/,/^ifconfig$/,/^ipconfig(?:\s+\/(?:all|allcompartments|displaydns))?\s*$/,/^ip\s+(?:addr(?:ess)?|route)$/,/^ip\s+(?:addr(?:ess)?|link|route|neigh(?:bor)?)\s+(?:show|list)\b(?:\s.*)?$/,/^tar\s+(?:--list\b|-[a-zA-Z]*t[a-zA-Z]*)(?:\s.*)?$/,/^unzip\s+-[a-zA-Z]*l(?:\s.*)?$/,/^git\s+(?:grep|fsck|rev-list|whatchanged|help|diff-tree|diff-index|diff-files|ls-remote|verify-tag|verify-commit)(?:\s.*)?$/,/^git\s+archive(?!.*\s(?:-o|--output)(?:=|\s|$))(?:\s.*)?$/,/^svn\s+(?:status|stat|st|diff|di|log|info|list|ls|cat|blame|ann|annotate|proplist|propget|pg)(?:\s.*)?$/,/^hg\s+(?:status|st|log|diff|summary|id|identify|branches|tags|manifest|cat|files|locate|heads|tip|parents|paths|root)(?:\s.*)?$/,/^cargo\s+(?:tree|search|locate-project|verify-project|config\s+get)(?:\s.*)?$/,/^gem\s+(?:list|search|info|env|dependency|contents|specification|sources\s+(?:-l|--list))(?:\s.*)?$/,/^brew\s+(?:--version|-v|list|info|search|outdated|deps|uses|config|leaves|doctor)(?:\s.*)?$/,/^choco\s+(?:--version|list|info|search|outdated)(?:\s.*)?$/,/^apt(?:-get)?\s+list(?:\s.*)?$/,/^apt-cache\s+(?:search|show|showpkg|policy|depends|rdepends|pkgnames)(?:\s.*)?$/,/^dpkg\s+(?:-l|-L|-s|-S|--list|--listfiles|--status|--search)\b(?:\s.*)?$/,/^rpm\s+-q[a-zA-Z]*(?:\s.*)?$/,/^(?:aws|gh|gcloud|az)\s+--version$/,/^aws\s+(?:\S+\s+)?(?:describe|list|get|wait)-\S+(?:\s.*)?$/,/^aws\s+s3\s+ls(?:\s.*)?$/,/^gcloud\s+\S+(?:\s+\S+)*\s+(?:list|describe)(?:\s.*)?$/,/^az\s+\S+(?:\s+\S+)*\s+(?:list|show)(?:\s.*)?$/,/^gh\s+(?:pr|issue|repo|run|release|gist)\s+(?:view|list|status|checks|diff)(?:\s.*)?$/,/^(?:docker|podman)\s+(?:system\s+(?:df|info)|history|context\s+(?:ls|list|show|inspect))(?:\s.*)?$/,/^(?:Get-(?:Acl|Alias|AuthenticodeSignature|ChildItem|CimInstance|Clipboard|Command|ComputerInfo|Content|Counter|Culture|Date|DnsClientCache|EventLog|ExecutionPolicy|FileHash|Help|History|Host|HotFix|Item|ItemProperty|Location|Member|Module|NetAdapter|NetIPAddress|NetNeighbor|NetIPConfiguration|NetRoute|NetTCPConnection|NetUDPEndpoint|Package|PackageProvider|PnpDevice|Printer|Process|PSDrive|PSProvider|PSRepository|PSSnapin|ScheduledTask|Service|TimeZone|UICulture|Variable|Verb|WinEvent|WmiObject)|Compare-Object|Format-(?:Custom|Hex|List|Table|Wide)|Group-Object|Measure-Object|Out-String|Resolve-Path|Select-Object|Select-String|Sort-Object|Test-Path|Where-Object|Write-(?:Debug|Error|Host|Information|Output|Progress|Verbose|Warning))(?:\s.*)?$/i],Or={Bash:"command",PowerShell:"command",ComputerUse:"action",ReadFile:"file_path",LSP:"file_path",WebFetch:"url",WebSearch:"query",TaskOutput:"task_id",WriteFile:"file_path",EditFile:"file_path",Glob:"pattern",Grep:"pattern",InstallSkill:"source"};function Pe(n,e){if(n==="McpCall")return Xe(p(e,"server",""),p(e,"tool",""));let t=Or[n];if(!t)return"";let r=e[t];return typeof r=="string"?r:n==="ComputerUse"&&Array.isArray(e.actions)?e.actions.map(s=>Ke(s)?p(s,"type"):"").filter(Boolean).join(","):""}var Me=class{allowedRoots;projectDir;constructor(e){this.projectDir=jr(e),this.allowedRoots=[this.projectDir,Ir()]}addRoot(e){this.allowedRoots.push(I(this.projectDir,e))}check(e){let t=U(I(this.projectDir,e));for(let r of this.allowedRoots)if(qe(U(r),t))return null;return{effect:"deny",reason:`Path ${e} is outside allowed directories`}}};function Nr(n,e){let t="^"+n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".")+"$";try{return new RegExp(t).test(e)}catch(r){return $e.error({err:r},"permissions operation failed"),!1}}var Br=/^(\w+)\((.+)\)$/;function Wr(n){return Ve(n)&&"code"in n&&typeof n.code=="string"}function ft(n){let e;try{e=Mr(n,"utf-8")}catch(o){return Wr(o)&&o.code!=="ENOENT"&&$e.error({err:o},"permissions operation failed"),[]}let t=a.object({rule:a.string().optional(),effect:a.string().optional()}),r;try{let o=R.load(e);r=_(a.array(t),o)}catch(o){return $e.error({err:o},"permissions operation failed"),[]}let s=[];for(let o of r){if(o.effect!=="allow"&&o.effect!=="deny"&&o.effect!=="ask")continue;let i=Br.exec((o.rule??"").trim());i&&s.push({tool:i[1],pattern:i[2],effect:o.effect})}return s}function gt(n,e,t){let r=null;for(let s of n)if(!(s.tool!==e&&s.tool!=="*")&&Nr(s.pattern,t)){if(s.effect==="deny")return"deny";s.effect==="ask"?r="ask":r??="allow"}return r}var Ae=class{userPath;projectPath;cache=new Map;constructor(e){this.userPath=P("permissions.yaml"),this.projectPath=Ge(e,"permissions.yaml")}rulesFor(e){let t;try{t=kt(e,{bigint:!0})}catch{return this.cache.delete(e),[]}let r=this.cache.get(e);if(r?.mtimeNs===t.mtimeNs&&r.size===t.size)return r.rules;let s=ft(e);return this.cache.set(e,{mtimeNs:t.mtimeNs,size:t.size,rules:s}),s}snapshot(){return[this.userPath,this.projectPath].flatMap(e=>this.rulesFor(e))}appendProjectRule(e){Rr(yt(this.projectPath),{recursive:!0}),q(this.projectPath,()=>{let t=ft(this.projectPath);if(t.some(i=>i.tool===e.tool&&i.pattern===e.pattern&&i.effect===e.effect))return;t.push(e);let s=t.map(i=>({rule:`${i.tool}(${i.pattern})`,effect:i.effect})),o=`${this.projectPath}.${String(process.pid)}.tmp`;try{Ar(o,R.dump(s),"utf-8"),Cr(o,this.projectPath),this.cache.delete(this.projectPath)}finally{_r(o,{force:!0})}})}};function Ur(n){for(let e of Fr)if(e.re.test(n))return e.reason;return""}function ht(n){let e=n.trim();return/[\r\n&|;<>`(){}[\]]/.test(e)?!1:Lr.some(t=>typeof t=="string"?e===t||e.startsWith(t+" ")||e.startsWith(t+" "):(t.lastIndex=0,t.test(e)))}function qr(n,e){switch(n){case"bypassPermissions":return"allow";case"plan":return e==="read"?"allow":"ask";case"acceptEdits":return e==="command"?"ask":"allow";default:return e==="read"?"allow":"ask"}}var de=class n{constructor(e,t="default",r){this.cwd=e;this.modeState={value:t,delegatedValue:t==="plan"?"default":t,source:r,listeners:new Set},this.sandbox=new Me(e),this.ruleEngine=new Ae(e)}cwd;modeState;delegated=!1;planModeLocked=!1;planFilePath="";teammate=!1;sandboxEnabled=!1;sandboxAutoAllow=!1;sandbox;ruleEngine;get mode(){return this.planModeLocked?"plan":this.delegated?this.delegatedMode:this.modeState.source?.()??this.modeState.value}set mode(e){if(!(this.modeState.value===e&&!this.modeState.source)){this.modeState.value=e,e!=="plan"&&(this.modeState.delegatedValue=e),this.modeState.source=void 0;for(let t of this.modeState.listeners)t()}}get delegatedMode(){let e=this.modeState.source?.();return e&&e!=="plan"?e:this.modeState.delegatedValue}subscribeMode(e){return this.modeState.listeners.add(e),()=>{this.modeState.listeners.delete(e)}}forCwd(e){let t=new n(e,this.mode);return t.modeState=this.modeState,t.delegated=this.delegated,t.planModeLocked=this.planModeLocked,t.planFilePath=this.planFilePath,t.ruleEngine=this.ruleEngine,t.teammate=this.teammate,t.sandboxEnabled=this.sandboxEnabled,t.sandboxAutoAllow=this.sandboxAutoAllow,t}forSubagent(e){let t=this.forCwd(e);return t.delegated=!0,this.teammate||(t.planFilePath=""),t}check(e,t,r){let s=Pe(e,r),o=this.teammate&&at.has(e),i=p(r,"file_path",p(r,"path","")),l=this.mode==="plan"&&(e==="WriteFile"||e==="EditFile")&&!!this.planFilePath&&U(I(this.cwd,i))===U(I(this.cwd,this.planFilePath));if(this.planModeLocked&&t!=="read"&&!o&&!l&&!(t==="command"&&ht(s)))return{effect:"deny",reason:"Plan approval is required before executing mutations"};let u=null,d=()=>u??=this.ruleEngine.snapshot(),c=gt(d(),e,s);if(c==="deny"||c==="ask")return{effect:c,reason:`Permission rule: ${c}`};if(o)return{effect:"allow",reason:"Teammate coordination tool"};if(l)return{effect:"allow",reason:"Plan file write allowed in plan mode"};if(t==="command"&&ht(s))return{effect:"allow",reason:"Safe read-only command"};let f=t==="command"?Ur(s):"";if(f)return{effect:"deny",reason:`Dangerous command blocked: ${f}`};if(this.sandboxEnabled&&this.sandboxAutoAllow&&e==="Bash"){let m=p(r,"command").trim();if(!m)return{effect:"ask",reason:"Sandbox auto-allow requires a non-empty Bash command"};let g=m.split(/\s*(?:&&|\|\||&|[;|\n\r])\s*/).map(k=>k.trim()).filter(Boolean),x=!1;for(let k of g){let M=gt(d(),e,k);if(M==="deny")return{effect:"deny",reason:"Permission rule: deny"};M==="ask"&&(x=!0)}return x?{effect:"ask",reason:"Permission rule: ask (sandbox does not override)"}:{effect:"allow",reason:"Sandbox auto-allow: OS sandbox active"}}if(t==="write"&&i&&this.mode!=="bypassPermissions"){let m=this.sandbox.check(i);if(m&&c!=="allow")return{effect:"ask",reason:m.reason}}return c?{effect:c,reason:`Permission rule: ${c}`}:{effect:qr(this.mode,t),reason:`Mode: ${this.mode}`}}allowExtraRoot(e){this.sandbox.addRoot(e)}allowAlways(e,t){let r=Pe(e,t),s=e==="ReadFile"||e==="WriteFile"||e==="EditFile",o;if(s&&r){let i=I(this.cwd,r),l=!1;try{l=kt(i).isDirectory()}catch{}o=Dr(l?i:yt(i),"*")}else o=r.trim().split(/\s+/).slice(0,2).join(" ")+"*";this.ruleEngine.appendProjectRule({tool:e,pattern:o,effect:"allow"})}describeToolAction(e,t){let r=Pe(e,t);if(r)return r;let s=[];for(let[o,i]of Object.entries(t)){let l=String(i);l.length>80&&(l=l.slice(0,80)+"..."),s.push(`${o}: ${l}`)}return s.join(", ")}};function G(n,e){let t=new Set([...e].filter(r=>r.status==="completed").map(r=>r.id));return n.blockedBy.filter(r=>!t.has(r))}function wt(n){let e=new Map;for(let o of n){if(e.has(o.id))throw new Error(`Duplicate task ID: ${o.id}`);e.set(o.id,o)}for(let o of e.values())for(let[i,l]of[[o.blocks,"blockedBy"],[o.blockedBy,"blocks"]]){if(new Set(i).size!==i.length)throw new Error(`Duplicate dependencies for task #${o.id}`);for(let u of i){if(u===o.id)throw new Error(`Task #${u} cannot depend on itself`);let d=e.get(u);if(!d)throw new Error(`Unknown dependency: task #${u} does not exist`);if(!d[l].includes(o.id))throw new Error(`Inconsistent dependency between task #${o.id} and #${u}`)}}let t=new Set,r=new Set,s=o=>{if(t.has(o.id))throw new Error("Task dependencies contain a cycle");if(!r.has(o.id)){t.add(o.id);for(let i of o.blocks){let l=e.get(i);l&&s(l)}t.delete(o.id),r.add(o.id)}};for(let o of e.values())s(o)}import{randomUUID as Gr}from"crypto";import{existsSync as zr,mkdirSync as Kr,readFileSync as Vr,renameSync as Yr,rmSync as Jr,writeFileSync as Xr}from"fs";import{dirname as Zr}from"path";var Qr=b({module:"todo"}),j=a.enum(["pending","in_progress","completed","blocked","cancelled"]),es=a.object({id:a.string().regex(/^[1-9]\d*$/u),subject:a.string().trim().min(1),description:a.string(),status:j,owner:a.string().optional(),activeForm:a.string().optional(),blocks:a.array(a.string()),blockedBy:a.array(a.string()),metadata:a.record(a.string(),a.unknown()),priority:a.enum(["high","medium","low"]).optional()}),ts=a.object({nextId:a.number().int().positive().max(Number.MAX_SAFE_INTEGER),tasks:a.array(es)}),bt=class{filePath;constructor(e){if(!/^[A-Za-z0-9_-]+$/u.test(e))throw new Error("Invalid task list ID");this.filePath=He(e,"tasks.json")}load(){if(!zr(this.filePath))return{nextId:1,tasks:[]};try{let e=Vr(this.filePath,"utf-8"),t=JSON.parse(e),r=_(ts,t);if(r.tasks.some(s=>Number(s.id)>=r.nextId))throw new Error("Invalid task ID counter");return r}catch(e){throw Qr.error({err:e},"todo operation failed"),new Error("Cannot load an unreadable task list",{cause:e})}}save(e,t){Kr(Zr(this.filePath),{recursive:!0});let r=`${this.filePath}.${Gr()}.tmp`;try{Xr(r,JSON.stringify({nextId:t,tasks:e},null,2),"utf-8"),Yr(r,this.filePath)}finally{Jr(r,{force:!0})}}};var z=class n{name="TaskCreate";description="Create a pending item on the current task board. This tracks work; it does not launch an Agent or a background task.";category="read";isConcurrencySafe(){return!1}list;constructor(e){this.list=e}schema(){return{name:this.name,description:this.description,input_schema:{type:"object",properties:{subject:{type:"string",description:"Brief task title"},description:{type:"string",description:"What needs to be done"},activeForm:{type:"string",description:"Present continuous form for spinner"},metadata:{type:"object",description:"Task-specific structured context"}},required:["subject","description"],additionalProperties:!1}}}execute(e,t){let r=a.object({subject:a.string().trim().min(1),description:a.string(),activeForm:a.string().optional(),metadata:a.record(a.string(),a.unknown()).optional()}).strict().safeParse(t);if(!r.success)return Promise.resolve({output:r.error.message,isError:!0});let{subject:s,description:o,activeForm:i,metadata:l}=r.data;try{e.abortSignal?.throwIfAborted();let u=this.list.create(s,o,i,l);return Promise.resolve({output:`Task #${u.id} created successfully: ${u.subject}`,isError:!1})}catch(u){return Promise.resolve({output:`Error: ${w(u)}`,isError:!0})}}forList(e){return new n(e)}},K=class n{name="TaskGet";description="Get a task by its ID.";category="read";list;constructor(e){this.list=e}schema(){return{name:this.name,description:this.description,input_schema:{type:"object",properties:{taskId:{type:"string",description:"Task ID"}},required:["taskId"]}}}execute(e,t){let r=p(t,"taskId"),s;try{e.abortSignal?.throwIfAborted(),s=this.list.get(r)}catch(o){return Promise.resolve({output:`Error: ${w(o)}`,isError:!0})}return s?Promise.resolve({output:JSON.stringify(s,null,2),isError:!1}):Promise.resolve({output:"Task not found",isError:!0})}forList(e){return new n(e)}},V=class n{name="TaskList";description="List all tasks.";category="read";list;constructor(e){this.list=e}schema(){return{name:this.name,description:this.description,input_schema:{type:"object",properties:{}}}}execute(){let e;try{e=this.list.list()}catch(r){return Promise.resolve({output:`Error: ${w(r)}`,isError:!0})}if(e.length===0)return Promise.resolve({output:"No tasks found",isError:!1});let t=e.map(r=>{let s=G(r,e);return`#${r.id}. [${r.status}] ${r.subject}${r.owner?` (${r.owner})`:""}${s.length?` (blocked by: ${s.join(", ")})`:""}`});return Promise.resolve({output:t.join(`
|
|
6
6
|
`),isError:!1})}forList(e){return new n(e)}},Y=class n{name="TaskUpdate";description="Atomically update the current task board's fields and dependencies. Dependency IDs must already exist; self-dependencies, cycles, and starting blocked work are rejected. Teammates claim in_progress tasks under their own name. deleted removes the task and its links.";category="read";isConcurrencySafe(){return!1}list;constructor(e){this.list=e}schema(){return{name:this.name,description:this.description,input_schema:{type:"object",properties:{taskId:{type:"string",description:"Task ID"},status:{type:"string",enum:[...j.options,"deleted"],description:"New task status; deleted removes the item and its dependency links"},subject:{type:"string",description:"New subject"},description:{type:"string",description:"New description"},owner:{type:"string",description:"New owner"},activeForm:{type:"string",description:"Present continuous form for progress display"},priority:{type:"string",enum:["high","medium","low"]},metadata:{type:"object",description:"Merge structured context; null deletes a metadata key"},addBlocks:{type:"array",items:{type:"string"},description:"Existing task IDs this one blocks"},addBlockedBy:{type:"array",items:{type:"string"},description:"Existing task IDs blocking this one"}},required:["taskId"],additionalProperties:!1}}}execute(e,t){let r=ss.safeParse(t);if(!r.success)return Promise.resolve({output:w(r.error),isError:!0});let{taskId:s,status:o,subject:i,description:l,...u}=r.data;try{if(e.abortSignal?.throwIfAborted(),o==="deleted")return Promise.resolve(this.list.delete(s)?{output:`Task #${s} deleted`,isError:!1}:{output:"Task not found",isError:!0});let d=this.list.update(s,{...u,...i===void 0?{}:{subject:i},...l===void 0?{}:{description:l},...o?{status:o}:{}});return Promise.resolve(d?{output:`Updated task #${s}: ${d.status}${d.owner?` (owner: ${d.owner})`:""}.${o==="completed"?" Call TaskList to find the next available task; verify the completed work before reporting success.":""}`,isError:!1}:{output:"Task not found",isError:!0})}catch(d){return Promise.resolve({output:`Error: ${w(d)}`,isError:!0})}}forList(e){return new n(e)}},ss=a.object({taskId:a.string().trim().min(1),subject:a.string().trim().min(1).optional(),description:a.string().optional(),status:a.enum([...j.options,"deleted"]).optional(),owner:a.string().optional(),activeForm:a.string().optional(),priority:a.enum(["high","medium","low"]).optional(),metadata:a.record(a.string(),a.unknown()).optional(),addBlocks:a.array(a.string().trim().min(1)).optional(),addBlockedBy:a.array(a.string().trim().min(1)).optional()}).strict(),Re=class n{constructor(e){this.list=e}list;name="TodoWrite";description="Replace this agent's entire task/TODO list in one atomic update. Include all items to retain; reuse returned IDs to preserve metadata and dependency links. An empty array clears the list. Track complex work, not trivial requests; this tool never launches work.";category="read";isConcurrencySafe(){return!1}schema(){return{name:this.name,description:this.description,input_schema:{type:"object",properties:{todos:{type:"array",maxItems:200,items:{type:"object",properties:{id:{type:"string",description:"Existing task ID; omit for a new item"},subject:{type:"string",description:"Brief task title"},description:{type:"string"},status:{type:"string",enum:j.options},activeForm:{type:"string"},priority:{type:"string",enum:["high","medium","low"]}},required:["subject","status"],additionalProperties:!1}}},required:["todos"],additionalProperties:!1}}}execute(e,t){let r=a.object({todos:a.array(a.object({id:a.string().min(1).optional(),subject:a.string().trim().min(1),description:a.string().optional(),status:j,activeForm:a.string().optional(),priority:a.enum(["high","medium","low"]).optional()}).strict()).max(200)}).strict().safeParse(t);if(!r.success)return Promise.resolve({output:r.error.message,isError:!0});try{return e.abortSignal?.throwIfAborted(),Promise.resolve({output:JSON.stringify(this.list.replace(r.data.todos),null,2),isError:!1})}catch(s){return Promise.resolve({output:`Error: ${w(s)}`,isError:!0})}}forList(e){return new n(e)}};function Tt(n){return n instanceof z||n instanceof K||n instanceof V||n instanceof Y||n instanceof Re}var F=class{constructor(e,t,r,s){this.manager=e;this.teamName=t;this.agentName=r;this.fallback=s}manager;teamName;agentName;fallback;board(){let e=this.teamName?this.manager.get(this.teamName):this.manager.list()[0];if(!e){if(this.fallback)return this.fallback;throw new Error("No active team task board")}let t=this.manager.getTaskStore(e.name),r=this.agentName===y?void 0:this.agentName;return{create:(s,o,i,l)=>t.create(s,o,"",[],[],this.agentName,i,l),get:s=>t.get(s),list:()=>t.listTasks(),update:(s,o)=>{if(o.owner&&o.owner!==y){let l=e.getMember(o.owner);if(!l||!l.active&&l.uiState)throw new Error(`Teammate '${o.owner}' is not available for assignment`)}let i=t.update(s,o,r);return o.owner&&i?.owner&&i.owner!==y&&i.owner!==this.agentName&&e.getMember(i.owner)?.mailbox.sendSync(this.agentName,`Task assignment: #${i.id} ${i.subject}
|
|
7
7
|
${i.description}
|
|
@@ -31,7 +31,7 @@ Worktree retained at: ${k}`:""}`,isError:!0}}};return g?this.startBackground(r,e
|
|
|
31
31
|
${s}`}catch($){return c.removeMember(m),await k.dispose(),{output:`Error creating teammate worktree: ${w($)}`,isError:!0}}let E=l.permissionChecker??new de(this.cwd);this.teamManager.setPermissionChecker(E);let re=E.forSubagent(h);re.planModeLocked||=o||u.permissionMode==="plan",re.teammate=!0;try{let $=this.teamRunAgentFactory?.(k,re,h,{definition:u,modelOverride:d,onPermissionRequest:l.onPermissionRequest});if($){let Ue=c.spawnTeammate(m,M,$,re,this.teamProviderIndex,l.toolCallId,h,{agentType:u.name,model:d||u.model,planApprovalRequired:o,readOnly:u.permissionMode==="plan",cleanup:()=>k.dispose()});return Ue!=="in-process"&&await k.dispose(),{output:`Teammate '${m}' spawned in team '${e}' (mode: ${Ue})${o?", starting in plan mode":""}`,isError:!1}}return c.removeMember(m),await k.dispose(),{output:"Error: teammate runner is unavailable.",isError:!0}}catch($){return c.getMember(m)?.active&&await c.stopMember(m),c.removeMember(m),await k.dispose(),{output:`Error spawning teammate: ${w($)}${h!==this.cwd?`
|
|
32
32
|
Worktree retained at: ${h}`:""}`,isError:!0}}}async runFork(e,t,r,s,o,i,l=!1){if(!this.conversation||!this.forkHandler)return{output:"Error: fork requires parent conversation context",isError:!0};if(this.querySource===Be)return{output:"Error: cannot fork from a forked agent. Use subagent_type to spawn a definition-based agent instead.",isError:!0};for(let c of this.conversation.getMessages())if(typeof c.content=="string"&&c.content.includes(Gt))return{output:"Error: cannot fork from a forked agent. Use subagent_type to spawn a definition-based agent instead.",isError:!0};let u,d;try{if(o){s.abortSignal?.throwIfAborted();let x=await me(Oe(),void 0,s.cwd);u=x.path,e=`${pe(s.cwd,x.path)}
|
|
33
33
|
|
|
34
|
-
${e}`,s={...s,cwd:x.path,permissionChecker:s.permissionChecker?.forCwd(x.path)}}let{cloneRegistryForFork:c}=await import("./tool-filter-
|
|
34
|
+
${e}`,s={...s,cwd:x.path,permissionChecker:s.permissionChecker?.forCwd(x.path)}}let{cloneRegistryForFork:c}=await import("./tool-filter-KDQMXIDC.js"),f=c(this.registry);d=l?Ne(f,void 0,void 0,!0):f;let m=i??this.conversation.fork(),g=await this.forkHandler(`${$s}
|
|
35
35
|
|
|
36
36
|
Your task:
|
|
37
37
|
${e}`,m,d,r,s);return{output:`Forked agent "${t}":
|
|
@@ -1,7 +1,7 @@
|
|
|
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{$ as gn,A as pn,B as Qa,C as Jr,D as Kr,E as Zr,H as ln,J as eo,M as to,N as no,O as so,Q as co,T as va,U as mn,V as hn,Y as If,Z as lo,_ as vn,aa as xn,da as He,ea as bo,fa as Ja,ga as yo,h as fa,ha as wo,k as sn,la as ko,ma as Eo,n as $r,na as So,o as cn,oa as Ao,p as Va,pa as Co,q as Hr,qa as To,ra as Po,s as Wr,sa as _o,t as Gr,ta as jo,u as Vr,ua as qo,v as Xr,va as Oo,wa as Mo,x as Qr,xa as Ro,y as ma,z as Xa}from"./chunk-
|
|
4
|
+
import{$ as gn,A as pn,B as Qa,C as Jr,D as Kr,E as Zr,H as ln,J as eo,M as to,N as no,O as so,Q as co,T as va,U as mn,V as hn,Y as If,Z as lo,_ as vn,aa as xn,da as He,ea as bo,fa as Ja,ga as yo,h as fa,ha as wo,k as sn,la as ko,ma as Eo,n as $r,na as So,o as cn,oa as Ao,p as Va,pa as Co,q as Hr,qa as To,ra as Po,s as Wr,sa as _o,t as Gr,ta as jo,u as Vr,ua as qo,v as Xr,va as Oo,wa as Mo,x as Qr,xa as Ro,y as ma,z as Xa}from"./chunk-COHBT6M7.js";import{d as po}from"./chunk-5DK2M7VI.js";import{h as Nr,i as nn,r as Br,u as Wa,v as rn,y as Ur}from"./chunk-4CLD7LEU.js";import{B as ha,L as oo,R as bn,T as uo,U as fo,W as mo,e as un,f as dn,ka as ho,la as vo,na as go,oa as xo,q as ao,r as io,t as fn,v as ro}from"./chunk-CW5XFH7H.js";import{d as Yr}from"./chunk-AZQD75PX.js";import{a as Rf,b as se}from"./chunk-WGFROGUC.js";import{k as zr,n as Ga,v as on}from"./chunk-OI2W6R6H.js";import{C as T}from"./chunk-W4GMCNWF.js";import{a as tn,b as Dr}from"./chunk-VM4YKTHC.js";import{a as w,c as h,e as Mf}from"./chunk-7MKA3SHV.js";var ga=h((rw,Do)=>{"use strict";var Ff=w("path").relative;Do.exports=zf;var Lf=process.cwd();function Fo(a,e){for(var t=a.split(/[ ,]+/),n=String(e).toLowerCase(),i=0;i<t.length;i++){var r=t[i];if(r&&(r==="*"||r.toLowerCase()===n))return!0}return!1}function Df(a,e,t){var n=Object.getOwnPropertyDescriptor(a,e),i=n.value;return n.get=function(){return i},n.writable&&(n.set=function(o){return i=o}),delete n.value,delete n.writable,Object.defineProperty(a,e,n),n}function Nf(a){for(var e="",t=0;t<a;t++)e+=", arg"+t;return e.substr(2)}function Bf(a){var e=this.name+": "+this.namespace;this.message&&(e+=" deprecated "+this.message);for(var t=0;t<a.length;t++)e+=`
|
|
5
5
|
at `+a[t].toString();return e}function zf(a){if(!a)throw new TypeError("argument namespace is required");var e=Za(),t=We(e[1]),n=t[0];function i(r){Ka.call(i,r)}return i._file=n,i._ignored=$f(a),i._namespace=a,i._traced=Hf(a),i._warned=Object.create(null),i.function=Xf,i.property=Qf,i}function Uf(a,e){var t=typeof a.listenerCount!="function"?a.listeners(e).length:a.listenerCount(e);return t>0}function $f(a){if(process.noDeprecation)return!0;var e=process.env.NO_DEPRECATION||"";return Fo(e,a)}function Hf(a){if(process.traceDeprecation)return!0;var e=process.env.TRACE_DEPRECATION||"";return Fo(e,a)}function Ka(a,e){var t=Uf(process,"deprecation");if(!(!t&&this._ignored)){var n,i,r,o,s=0,p=!1,c=Za(),l=this._file;for(e?(o=e,r=We(c[1]),r.name=o.name,l=r[0]):(s=2,o=We(c[s]),r=o);s<c.length;s++)if(n=We(c[s]),i=n[0],i===l)p=!0;else if(i===this._file)l=this._file;else if(p)break;var d=n?o.join(":")+"__"+n.join(":"):void 0;if(!(d!==void 0&&d in this._warned)){this._warned[d]=!0;var u=a;if(u||(u=r===o||!r.name?Io(o):Io(r)),t){var f=Lo(this._namespace,u,c.slice(s));process.emit("deprecation",f);return}var m=process.stderr.isTTY?Gf:Wf,v=m.call(this,u,n,c.slice(s));process.stderr.write(v+`
|
|
6
6
|
`,"utf8")}}}function We(a){var e=a.getFileName()||"<anonymous>",t=a.getLineNumber(),n=a.getColumnNumber();a.isEval()&&(e=a.getEvalOrigin()+", "+e);var i=[e,t,n];return i.callSite=a,i.name=a.getFunctionName(),i}function Io(a){var e=a.callSite,t=a.name;t||(t="<anonymous@"+yn(a)+">");var n=e.getThis(),i=n&&e.getTypeName();return i==="Object"&&(i=void 0),i==="Function"&&(i=n.name||i),i&&e.getMethodName()?i+"."+t:t}function Wf(a,e,t){var n=new Date().toUTCString(),i=n+" "+this._namespace+" deprecated "+a;if(this._traced){for(var r=0;r<t.length;r++)i+=`
|
|
7
7
|
at `+t[r].toString();return i}return e&&(i+=" at "+yn(e)),i}function Gf(a,e,t){var n="\x1B[36;1m"+this._namespace+"\x1B[22;39m \x1B[33;1mdeprecated\x1B[22;39m \x1B[0m"+a+"\x1B[39m";if(this._traced){for(var i=0;i<t.length;i++)n+=`
|
|
@@ -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{C as e}from"./chunk-W4GMCNWF.js";import{readFileSync as i}from"fs";import o from"path";import{fileURLToPath as c}from"url";var f=e.object({version:e.string()});function _(){return"0.0.
|
|
4
|
+
import{C as e}from"./chunk-W4GMCNWF.js";import{readFileSync as i}from"fs";import o from"path";import{fileURLToPath as c}from"url";var f=e.object({version:e.string()});function _(){return"0.0.13-dev"}var u=_();export{u as a};
|
|
@@ -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{a as u}from"./chunk-
|
|
4
|
+
import{a as u}from"./chunk-SZXXASVH.js";import{C as c}from"./chunk-W4GMCNWF.js";var k="@yukino.js/yukino",p="https://registry.npmjs.org/@yukino.js%2Fyukino/latest",f=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*))?(?:\+[\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*)?$/u;function d(o){let n=f.exec(o),e=n?.[4]?.split(".")??[];if(!n||e.some(r=>/^0\d+$/u.test(r)))throw new Error(`Invalid package version: ${o}`);return{core:[BigInt(n[1]),BigInt(n[2]),BigInt(n[3])],prerelease:e}}function g(o,n){let e=d(o),r=d(n);for(let t=0;t<e.core.length;t++)if(e.core[t]!==r.core[t])return e.core[t]>r.core[t];if(e.prerelease.length===0||r.prerelease.length===0)return e.prerelease.length===0&&r.prerelease.length>0;for(let t=0;t<Math.max(e.prerelease.length,r.prerelease.length);t++){let i=e.prerelease[t],s=r.prerelease[t];if(i===s)continue;if(i===void 0||s===void 0)return s===void 0;let l=/^\d+$/u.test(i),a=/^\d+$/u.test(s);return l&&a?BigInt(i)>BigInt(s):l===a?i>s:a}return!1}async function h(o){let n=AbortSignal.timeout(1e4),e=await fetch(p,{headers:{accept:"application/json","User-Agent":`yukino/${u} (${process.platform}; ${process.arch})`},signal:o?AbortSignal.any([o,n]):n});if(!e.ok)throw new Error(`Could not check for Yukino updates: HTTP ${e.status}`);let r=await e.json(),t=c.object({version:c.string()}).parse(r).version;return d(t),t}async function I(o){if(process.env.YUKINO_SKIP_VERSION_CHECK!=="1")try{let n=await h(o);return g(n,u)?n:void 0}catch{return}}export{k as a,g as b,h as c,I as d};
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -445,6 +445,7 @@ interface ToolContext {
|
|
|
445
445
|
* backgrounded there could never deliver a notification).
|
|
446
446
|
*/
|
|
447
447
|
taskManager?: TaskManager | null;
|
|
448
|
+
shellTimeoutDisabled?: boolean;
|
|
448
449
|
abortSignal?: AbortSignal;
|
|
449
450
|
onOutput?: (output: string) => void;
|
|
450
451
|
fileHistory?: FileHistory | undefined;
|
|
@@ -6139,13 +6140,13 @@ declare const BASH_DESCRIPTION = "Execute command in Bash; return stdout and std
|
|
|
6139
6140
|
* run_in_background parameter and its guidance never advertise a capability
|
|
6140
6141
|
* the current host cannot deliver.
|
|
6141
6142
|
*/
|
|
6142
|
-
declare const BASH_BACKGROUND_DESCRIPTION = "- Set run_in_background to true to run the command in the background. The call returns a task ID immediately and the result arrives later as a task notification; do not poll or sleep waiting for it. Use this for long-running commands you do not need the result of right away. Use TaskStop with the task_id to kill a background command early. A foreground command that exceeds its timeout is moved to the background automatically instead of being killed
|
|
6143
|
+
declare const BASH_BACKGROUND_DESCRIPTION = "- Set run_in_background to true to run the command in the background. The call returns a task ID immediately and the result arrives later as a task notification; do not poll or sleep waiting for it. Use this for long-running commands you do not need the result of right away. Use TaskStop with the task_id to kill a background command early. A foreground command that exceeds its timeout is moved to the background automatically instead of being killed.";
|
|
6143
6144
|
declare const POWERSHELL_DESCRIPTION = "Execute command in PowerShell; return stdout and stderr. Recommended on Windows (powershell.exe); uses pwsh elsewhere.\n- timeout is in seconds: default 120, maximum 600. Each call starts a fresh, independent shell in the Agent's working directory; location, variables, and options do not persist.\n- Quote paths with spaces; use Set-Location -LiteralPath \"path\" in the same call. Separate independent commands. For dependencies, check $LASTEXITCODE for native commands and use -ErrorAction Stop for cmdlets; ; does not stop on failure. Do not assume PowerShell 7 syntax.\n- Prefer dedicated file/search tools over Get-Content, Select-String, or Write-Output. Scope recursion to a directory, not a drive root. Diagnose failures rather than retrying in Start-Sleep loops.\nGit: commit or push only when requested. Destructive operations (push --force, reset --hard, checkout ., clean -f, branch -D), amending, or skipping hooks/signing require explicit authorization; never bypass permission/hook denials. Prefer new commits. When committing, include Co-Authored-By: Yukino <usr161043261@outlook.com>.";
|
|
6144
6145
|
/**
|
|
6145
6146
|
* Appended to the PowerShell schema description only when background execution
|
|
6146
6147
|
* is available; mirrors BASH_BACKGROUND_DESCRIPTION with PS-flavored wording.
|
|
6147
6148
|
*/
|
|
6148
|
-
declare const POWERSHELL_BACKGROUND_DESCRIPTION = "- Set run_in_background to true to run the command in the background. The call returns a task ID immediately and the result arrives later as a task notification; do not poll or Start-Sleep waiting for it. Use this for long-running commands you do not need the result of right away. Use TaskStop with the task_id to kill a background command early. A foreground command that exceeds its timeout is moved to the background automatically instead of being killed
|
|
6149
|
+
declare const POWERSHELL_BACKGROUND_DESCRIPTION = "- Set run_in_background to true to run the command in the background. The call returns a task ID immediately and the result arrives later as a task notification; do not poll or Start-Sleep waiting for it. Use this for long-running commands you do not need the result of right away. Use TaskStop with the task_id to kill a background command early. A foreground command that exceeds its timeout is moved to the background automatically instead of being killed.";
|
|
6149
6150
|
declare const READ_FILE_DESCRIPTION = "Read text with 1-based display line numbers, or images (png, jpg, jpeg, gif, webp) as visual content; not directories.\n- file_path is absolute or relative to the Agent's working directory. offset skips lines (0-based, default 0); limit defaults to 2000 lines, with a 50KB text output cap. Displayed line 101 starts at offset=100. Follow continuation/readback instructions for partial output.\n- Images ignore offset/limit. A successful read refreshes the file-state cache used by EditFile/WriteFile; re-read after an external-change error.";
|
|
6150
6151
|
declare const EDIT_FILE_DESCRIPTION = "Replace exact text in an existing file and return a diff. Prefer this over whole-file rewrites; batch disjoint changes in one edits array to read and write the file once.\n- file_path is absolute or relative to the Agent's working directory. ReadFile is required first; stale file-state errors require a fresh read and revised edit.\n- Each edits entry contains old_string and new_string, with optional replace_all. All matches use the original file; overlapping edits are rejected before writing. Merge overlapping changes into one entry.\n- old_string must be non-empty and unique unless replace_all=true (default false). LF and CRLF line endings match equivalently. Use enough context to disambiguate; preserve all other whitespace and exclude display line numbers. If matching fails, stray carriage returns in both edit strings are removed before retrying.\n- new_string must differ from old_string; an empty string deletes the match. The file's line endings and unchanged text are preserved.";
|
|
6151
6152
|
declare const WRITE_FILE_DESCRIPTION = "Write complete UTF-8 content to file_path, creating parent directories and overwriting existing content. Use for new files or complete rewrites; prefer EditFile for targeted changes.\n- file_path is absolute or relative to the Agent's working directory. Existing files require ReadFile first; re-read if the cached state is stale.\n- content includes any desired trailing newline; an empty string creates or truncates an empty file. Avoid unrelated files or unsolicited documentation.";
|
|
@@ -6218,6 +6219,13 @@ declare namespace editFile {
|
|
|
6218
6219
|
export { editFile_EditFileTool as EditFileTool };
|
|
6219
6220
|
}
|
|
6220
6221
|
|
|
6222
|
+
declare function describeEditMismatch(content: string, oldString: string): string;
|
|
6223
|
+
|
|
6224
|
+
declare const editFileDiagnostics_describeEditMismatch: typeof describeEditMismatch;
|
|
6225
|
+
declare namespace editFileDiagnostics {
|
|
6226
|
+
export { editFileDiagnostics_describeEditMismatch as describeEditMismatch };
|
|
6227
|
+
}
|
|
6228
|
+
|
|
6221
6229
|
declare class EnterWorktreeTool implements Tool {
|
|
6222
6230
|
name: string;
|
|
6223
6231
|
description: string;
|
|
@@ -6541,15 +6549,6 @@ interface CommandHandle {
|
|
|
6541
6549
|
*/
|
|
6542
6550
|
background: (reason: BackgroundReason) => string | null;
|
|
6543
6551
|
}
|
|
6544
|
-
/**
|
|
6545
|
-
* Whether a command may be *automatically* backgrounded on timeout. Bare
|
|
6546
|
-
* sleeps are killed instead: backgrounding one would just hold a task slot
|
|
6547
|
-
* until session end. Explicit run_in_background and manual Ctrl+B are always
|
|
6548
|
-
* honored regardless of this gate. Only the first token is considered:
|
|
6549
|
-
* `sleep 60` should die on timeout, but `npm run build && sleep 1` is a real
|
|
6550
|
-
* workload worth keeping alive.
|
|
6551
|
-
*/
|
|
6552
|
-
declare function isAutobackgroundingAllowed(command: string, disallowed: ReadonlySet<string>): boolean;
|
|
6553
6552
|
declare function backgroundTaskName(command: string): string;
|
|
6554
6553
|
declare function backgroundMessage(reason: BackgroundReason, taskId: string, timeout: number): string;
|
|
6555
6554
|
/** Slice buf to at most maxBytes, ending on a UTF-8 character boundary. */
|
|
@@ -6635,13 +6634,12 @@ declare const shellBackground_createShellOutputFile: typeof createShellOutputFil
|
|
|
6635
6634
|
declare const shellBackground_discardFd: typeof discardFd;
|
|
6636
6635
|
declare const shellBackground_formatFinalResult: typeof formatFinalResult;
|
|
6637
6636
|
declare const shellBackground_hasAnyForegroundTasks: typeof hasAnyForegroundTasks;
|
|
6638
|
-
declare const shellBackground_isAutobackgroundingAllowed: typeof isAutobackgroundingAllowed;
|
|
6639
6637
|
declare const shellBackground_openOutputFd: typeof openOutputFd;
|
|
6640
6638
|
declare const shellBackground_readOutputFile: typeof readOutputFile;
|
|
6641
6639
|
declare const shellBackground_sliceUtf8Safe: typeof sliceUtf8Safe;
|
|
6642
6640
|
declare const shellBackground_unlinkQuiet: typeof unlinkQuiet;
|
|
6643
6641
|
declare namespace shellBackground {
|
|
6644
|
-
export { shellBackground_BACKGROUNDABLE_TOOL_NAMES as BACKGROUNDABLE_TOOL_NAMES, shellBackground_BACKGROUND_MAX_OUTPUT_BYTES as BACKGROUND_MAX_OUTPUT_BYTES, shellBackground_BACKGROUND_NOTIFICATION_BYTES as BACKGROUND_NOTIFICATION_BYTES, type shellBackground_BackgroundReason as BackgroundReason, type shellBackground_BackgroundableTool as BackgroundableTool, type shellBackground_CommandHandle as CommandHandle, shellBackground_SIZE_WATCHDOG_INTERVAL_MS as SIZE_WATCHDOG_INTERVAL_MS, type shellBackground_ShellExit as ShellExit, shellBackground_attachBackgroundTaskManager as attachBackgroundTaskManager, shellBackground_backgroundAllForegroundTasks as backgroundAllForegroundTasks, shellBackground_backgroundMessage as backgroundMessage, shellBackground_backgroundTaskName as backgroundTaskName, shellBackground_buildBackgroundBody as buildBackgroundBody, shellBackground_createShellOutputFile as createShellOutputFile, shellBackground_discardFd as discardFd, shellBackground_formatFinalResult as formatFinalResult, shellBackground_hasAnyForegroundTasks as hasAnyForegroundTasks,
|
|
6642
|
+
export { shellBackground_BACKGROUNDABLE_TOOL_NAMES as BACKGROUNDABLE_TOOL_NAMES, shellBackground_BACKGROUND_MAX_OUTPUT_BYTES as BACKGROUND_MAX_OUTPUT_BYTES, shellBackground_BACKGROUND_NOTIFICATION_BYTES as BACKGROUND_NOTIFICATION_BYTES, type shellBackground_BackgroundReason as BackgroundReason, type shellBackground_BackgroundableTool as BackgroundableTool, type shellBackground_CommandHandle as CommandHandle, shellBackground_SIZE_WATCHDOG_INTERVAL_MS as SIZE_WATCHDOG_INTERVAL_MS, type shellBackground_ShellExit as ShellExit, shellBackground_attachBackgroundTaskManager as attachBackgroundTaskManager, shellBackground_backgroundAllForegroundTasks as backgroundAllForegroundTasks, shellBackground_backgroundMessage as backgroundMessage, shellBackground_backgroundTaskName as backgroundTaskName, shellBackground_buildBackgroundBody as buildBackgroundBody, shellBackground_createShellOutputFile as createShellOutputFile, shellBackground_discardFd as discardFd, shellBackground_formatFinalResult as formatFinalResult, shellBackground_hasAnyForegroundTasks as hasAnyForegroundTasks, shellBackground_openOutputFd as openOutputFd, shellBackground_readOutputFile as readOutputFile, shellBackground_sliceUtf8Safe as sliceUtf8Safe, shellBackground_unlinkQuiet as unlinkQuiet };
|
|
6645
6643
|
}
|
|
6646
6644
|
|
|
6647
6645
|
declare const MAX_SHELL_OUTPUT_BYTES: number;
|
|
@@ -6778,7 +6776,7 @@ declare namespace writeFile {
|
|
|
6778
6776
|
}
|
|
6779
6777
|
|
|
6780
6778
|
declare namespace index$4 {
|
|
6781
|
-
export { askUser as AskUser, bash as Bash, bingSearch as BingSearch, computerUse as ComputerUse, descriptions as Descriptions, diff as Diff, editFile as EditFile, enterWorktree as EnterWorktree, exitCodeHints as ExitCodeHints, exitPlanMode as ExitPlanMode, exitWorktree as ExitWorktree, fileMutationQueue as FileMutationQueue, fileStateCache as FileStateCache, glob as Glob, goal as Goal, grep as Grep, isDiffTool$1 as IsDiffTool, lsp as LSP, mcpCall as McpCall, powershell as PowerShell, readFile as ReadFile, registry$1 as Registry, searchOutput as SearchOutput, shellBackground as ShellBackground, shellOutput as ShellOutput, snippets as Snippets, syntheticOutput as SyntheticOutput, taskOutput as TaskOutput, toolSearch as ToolSearch, types$1 as Types, webFetch as WebFetch, webSearch as WebSearch, writeFile as WriteFile };
|
|
6779
|
+
export { askUser as AskUser, bash as Bash, bingSearch as BingSearch, computerUse as ComputerUse, descriptions as Descriptions, diff as Diff, editFile as EditFile, editFileDiagnostics as EditFileDiagnostics, enterWorktree as EnterWorktree, exitCodeHints as ExitCodeHints, exitPlanMode as ExitPlanMode, exitWorktree as ExitWorktree, fileMutationQueue as FileMutationQueue, fileStateCache as FileStateCache, glob as Glob, goal as Goal, grep as Grep, isDiffTool$1 as IsDiffTool, lsp as LSP, mcpCall as McpCall, powershell as PowerShell, readFile as ReadFile, registry$1 as Registry, searchOutput as SearchOutput, shellBackground as ShellBackground, shellOutput as ShellOutput, snippets as Snippets, syntheticOutput as SyntheticOutput, taskOutput as TaskOutput, toolSearch as ToolSearch, types$1 as Types, webFetch as WebFetch, webSearch as WebSearch, writeFile as WriteFile };
|
|
6782
6780
|
}
|
|
6783
6781
|
|
|
6784
6782
|
type PackageManager = "npm" | "yarn" | "pnpm";
|