@yukino.js/yukino 0.0.19 → 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.
- package/README.md +36 -65
- package/dist/anthropic-LB4T3BEN.js +4 -0
- package/dist/browser/dist/index.html +2 -2
- package/dist/browser/dist/static/chunk-3HWUJ4KR.js +1 -0
- package/dist/browser/dist/static/{highlight-ZDY7K2CR.js → highlight-KNDEBJWF.js} +10 -10
- package/dist/browser/dist/static/index.css +1 -1
- package/dist/browser/dist/static/index.js +40 -40
- package/dist/chunk-2N7OIUQW.js +884 -0
- package/dist/{chunk-QDMUFOED.js → chunk-57IGGFHK.js} +6 -6
- package/dist/chunk-5AOJ5ZSQ.js +30 -0
- package/dist/chunk-5D3QKHYQ.js +36 -0
- package/dist/{chunk-PYFRT6N5.js → chunk-7WP7SERS.js} +1 -1
- package/dist/{chunk-S56AXDDN.js → chunk-EQABLL4S.js} +1 -1
- package/dist/{chunk-UX5DJPHN.js → chunk-P6K7EQHF.js} +29 -29
- package/dist/{chunk-WGRGSG2J.js → chunk-QSKJBSCI.js} +1 -1
- package/dist/chunk-WKTO7XPO.js +4 -0
- package/dist/lib/{anthropic-I7ZSAP7Z.js → anthropic-TYBMDJP3.js} +3 -3
- package/dist/lib/{chunk-T4WEXOQ7.js → chunk-3QGT2MSI.js} +1 -83
- package/dist/lib/{chunk-MJHQUFUL.js → chunk-IPKULHXR.js} +2 -2
- package/dist/lib/{chunk-UU6ZV6GB.js → chunk-NIUCGP4C.js} +82 -241
- package/dist/lib/{chunk-TO34ITLQ.js → chunk-OPEO6D4O.js} +2 -5
- package/dist/lib/chunk-XVXFUSSS.js +217 -0
- package/dist/lib/index.d.ts +1024 -1720
- package/dist/lib/index.js +5859 -9076
- package/dist/lib/{openai-Y4P7SWUB.js → openai-Z2JCYL6F.js} +3 -3
- package/dist/lib/{chunk-YZURLYHG.js → providers-2NPR2VR4.js} +28 -207
- package/dist/{main-MHJXHOY6.js → main-OMIZDIYB.js} +211 -275
- package/dist/main.js +4 -6
- package/dist/{openai-3IGA2BCD.js → openai-UOCUBMFA.js} +1 -1
- package/dist/{chunk-7WYSSZKU.js → providers-G5SKN22T.js} +9 -9
- package/dist/server-ESDMJACZ.js +14 -0
- package/dist/server-Z742CQSK.js +4 -0
- package/package.json +4 -6
- package/dist/anthropic-D72CIYEQ.js +0 -4
- package/dist/chunk-676RWZYX.js +0 -38
- package/dist/chunk-A4IB5PNW.js +0 -8
- package/dist/chunk-BCYFGWSM.js +0 -30
- package/dist/chunk-DGDF5PBF.js +0 -869
- package/dist/lib/providers-MRGAAMBB.js +0 -10
- package/dist/providers-GRYPIKCY.js +0 -4
- package/dist/server-XBVP3S5Q.js +0 -4
- package/dist/server-ZYP54JBK.js +0 -15
- package/dist/stdio-UHDEALLA.js +0 -5
- package/dist/websocket-J5DE5FRQ.js +0 -9
|
@@ -1,23 +1,23 @@
|
|
|
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{
|
|
4
|
+
import{Bc as O,Ec as l,Ib as I,Jb as R,Pa as y,jc as S,kc as C,ob as E,zc as p}from"./chunk-5AOJ5ZSQ.js";function u(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function L(e){return E.has(e)}function h(e){return u(e)&&e.type==="text"&&typeof e.text=="string"?{type:"text",text:e.text}:null}function x(e){return!u(e)||e.type!=="image"||!u(e.source)?null:e.source.type==="url"&&typeof e.source.url=="string"?{type:"image",source:{type:"url",url:e.source.url}}:e.source.type==="base64"&&typeof e.source.media_type=="string"&&L(e.source.media_type)&&typeof e.source.data=="string"?{type:"image",source:{type:"base64",media_type:e.source.media_type,data:e.source.data}}:null}function U(e){if(e.type!=="document"||!u(e.source))return null;let t=null;if(e.source.type==="url"&&typeof e.source.url=="string")t={type:"url",url:e.source.url};else if(e.source.type==="base64"&&e.source.media_type==="application/pdf"&&typeof e.source.data=="string")t={type:"base64",media_type:"application/pdf",data:e.source.data};else if(e.source.type==="text"&&e.source.media_type==="text/plain"&&typeof e.source.data=="string")t={type:"text",media_type:"text/plain",data:e.source.data};else if(e.source.type==="content"){if(typeof e.source.content=="string")t={type:"content",content:e.source.content};else if(Array.isArray(e.source.content)){let o=[];for(let r of e.source.content){let s=h(r)??x(r);if(!s)return null;o.push(s)}t={type:"content",content:o}}}return t?{type:"document",source:t,...typeof e.title=="string"||e.title===null?{title:e.title}:{},...typeof e.context=="string"||e.context===null?{context:e.context}:{}}:null}function $(e){let t=h(e);if(t)return t;let o=x(e);if(o)return o;if(!u(e))return null;if(e.type==="tool_reference"&&typeof e.tool_name=="string")return{type:"tool_reference",tool_name:e.tool_name};if(e.type==="search_result"&&typeof e.source=="string"&&typeof e.title=="string"&&Array.isArray(e.content)){let r=[];for(let s of e.content){let n=h(s);if(!n)return null;r.push(n)}return{type:"search_result",source:e.source,title:e.title,content:r}}return U(e)}var J="# MCP Server Instructions",a="mcp__",Q="io.modelcontextprotocol/ui",V="text/html;profile=mcp-app",Z="ui://";var ee="advanced-tool-use-2025-11-20",P=new Set(["api.anthropic.com"]),te=new Set(["image/png","image/jpeg","image/gif","image/webp"]),oe="Not connected";var v=y({module:"mcp"});function d(e){return e.replace(/[^a-zA-Z0-9_]/g,"_")}function F(e){return`${a}${d(e)}${"__"}`}function f(e,t){return F(e)+d(t)}var k=class{name;description;category="command";deferred=!0;mcpServerName;client;originalName;inputSchema;constructor(t,o,r){this.name=f(o,r.name),this.description=r.description,this.originalName=r.name,this.client=t,this.inputSchema=r.inputSchema,this.mcpServerName=o}mcpInputSchema(){return this.inputSchema??{}}setDeferLoading(t){this.deferred=t}schema(){return{name:this.name,description:this.description,input_schema:this.inputSchema}}async execute(t,o){try{return await this.client.callTool(this.originalName,o,t.abortSignal)}catch(r){return v.error({err:r},"mcp operation failed"),{output:`MCP tool error: ${O(r)}`,isError:!0}}}};function ce(e,t,o){switch(e){case"explicit":return`Command running in background (task_id: ${t}). You will be notified when it completes; do not poll. Use TaskStop with task_id to kill it early.`;case"timeout":return`Command exceeded its ${String(o)}s timeout and was moved to the background (task_id: ${t}). It is still running \u2014 you will be notified when it completes.`;case"user":return`Command was manually backgrounded by the user (task_id: ${t}). It is still running \u2014 you will be notified when it completes.`}}var A="Git: 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>.",le=`Execute command in Bash; return stdout and stderr. Prefer PowerShell on Windows.
|
|
5
5
|
- timeout is in seconds: default 120, maximum 600. Each call starts a fresh, independent shell in the Agent's working directory; cd, variables, functions, and options do not persist.
|
|
6
6
|
- Quote paths with spaces. To change directory, use cd "path" && command in the same call. Separate independent commands; chain dependent commands with &&, not ;.
|
|
7
7
|
- Prefer dedicated file/search tools over cat, head, tail, sed, awk, echo, or find. Scope searches to a directory, never the filesystem root. Diagnose failures rather than retrying in sleep loops.
|
|
8
|
-
${
|
|
8
|
+
${A}`,pe="- 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.",ue="Shell command to execute",de=`Execute command in PowerShell; return stdout and stderr. Recommended on Windows (powershell.exe); uses pwsh elsewhere.
|
|
9
9
|
- 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.
|
|
10
10
|
- 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.
|
|
11
11
|
- 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.
|
|
12
|
-
${
|
|
12
|
+
${A}`,me="- 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.",he="PowerShell command to execute",ge="Timeout in seconds (max 600)",fe="Run the command in the background. Returns a task ID immediately; the result arrives later as a task notification.",_e=`Read text with 1-based display line numbers, or images (png, jpg, jpeg, gif, webp) as visual content; not directories.
|
|
13
13
|
- 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.
|
|
14
14
|
- Images ignore offset/limit. A successful read refreshes the file-state cache used by EditFile/WriteFile; re-read after an external-change error.`,Te="File path, absolute or relative to the Agent's working directory. Supports text and image files.",ye="Number of text lines to skip (0-based). Use 0 for the first line, 100 for displayed line 101. Ignored for images.",Ee="Maximum number of text lines to return (default 2000), subject to a 50KB output limit. Ignored for images.",Ie=`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.
|
|
15
15
|
- 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.
|
|
16
16
|
- 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.
|
|
17
17
|
- 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.
|
|
18
|
-
- new_string must differ from old_string; an empty string deletes the match. The file's line endings and unchanged text are preserved.`,Re="Path to the existing file, absolute or relative to the Agent's working directory. Read it first with ReadFile.",Se="Targeted replacements matched against the original file. Batch disjoint changes in one call; overlapping edits are rejected before writing.",Ce="Non-empty text from the original file, without ReadFile line-number prefixes. LF and CRLF line endings match equivalently; all other whitespace must match exactly. If matching fails, stray carriage returns in the edit strings are removed and matching is retried. Must be unique unless replace_all is true.",
|
|
18
|
+
- new_string must differ from old_string; an empty string deletes the match. The file's line endings and unchanged text are preserved.`,Re="Path to the existing file, absolute or relative to the Agent's working directory. Read it first with ReadFile.",Se="Targeted replacements matched against the original file. Batch disjoint changes in one call; overlapping edits are rejected before writing.",Ce="Non-empty text from the original file, without ReadFile line-number prefixes. LF and CRLF line endings match equivalently; all other whitespace must match exactly. If matching fails, stray carriage returns in the edit strings are removed and matching is retried. Must be unique unless replace_all is true.",Oe="Replacement text. An empty string deletes the match. The file's line endings are preserved.",xe="Replace all occurrences (default false)",Pe=`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.
|
|
19
19
|
- 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.
|
|
20
|
-
- content includes any desired trailing newline; an empty string creates or truncates an empty file. Avoid unrelated files or unsolicited documentation.`,ke="File path, absolute or relative to the Agent's working directory. Missing parent directories are created; existing files must be read first.",
|
|
20
|
+
- content includes any desired trailing newline; an empty string creates or truncates an empty file. Avoid unrelated files or unsolicited documentation.`,ke="File path, absolute or relative to the Agent's working directory. Missing parent directories are created; existing files must be read first.",Ae="Complete UTF-8 file contents. Replaces all existing content; an empty string creates or truncates an empty file.",be=`Find files by glob pattern (e.g. "**/*.ts", "*.{ts,tsx}"). Return paths relative to path, sorted newest modification first.
|
|
21
21
|
- path is absolute or relative to the Agent's working directory (default "."); never search the filesystem root.
|
|
22
22
|
- Includes dotfiles; traversal skips fixed directories such as .git, .agents, .yukino, node_modules, dist, and __pycache__, not rules from .gitignore.
|
|
23
23
|
- At most 1000 matches; narrow limited searches rather than treating them as exhaustive. Prefer this over shell find/ls.`,Ne="Filename glob relative to path, e.g. '**/*.ts' for recursive search or '*.{ts,tsx}' for direct children.",we="Search base, absolute or relative to the Agent's working directory (default '.'). Returned filenames are relative to this base.",De=`Search file content with a case-insensitive, line-by-line JavaScript-style regex pattern; return file:line:content with 1-based lines and working-directory-relative paths.
|
|
@@ -32,4 +32,4 @@ ${b}`,me="- Set run_in_background to true to run the command in the background.
|
|
|
32
32
|
Set multiSelect=true when the user may choose multiple options, or false for one mutually exclusive choice. Ask only for missing information that changes the task; do not re-request authorization already given.
|
|
33
33
|
`,He="question",je="The question to ask",Ge="options",qe="label",We="description",Ke="Set to true for multiple-choice, false for single-choice",Xe=`Use this tool proactively before a non-trivial implementation when the right approach is genuinely unclear and user review would prevent significant rework. It runs the built-in plan agent synchronously in the foreground with a fork of your conversation. The read-only agent investigates and returns a concrete plan; the host saves the plan and presents it for user approval. A successful call ends this turn. Do not implement until the user approves.
|
|
34
34
|
|
|
35
|
-
Use it for significant architectural ambiguity, unclear requirements that require exploration, or high-impact restructuring. Skip it when the task is straightforward, the user has already specified the implementation, the fix is obvious after diagnosis, or the request is pure research. Do not use it from delegated agents. This tool takes no parameters.`,Ye="Submit the completed plan from the plan file. The main agent presents it for user approval; a teammate follows the host's team approval policy (leader review in coordinator mode, automatic approval otherwise); a one-shot subagent returns it to the parent. Do not implement until the host approves execution.",$e="Create an isolated git worktree and switch this agent's working directory into it. Use only when the user explicitly requests a worktree. Only one worktree session may be active at a time. The optional slug is generated randomly when omitted. Use ExitWorktree to return to the original directory.",ze="Exit this agent's active EnterWorktree session and restore its original working directory. Use only when the user asks to leave the worktree. With no active session this is a no-op. Use action: keep to preserve the worktree and branch, or remove to delete both. Removal refuses uncommitted files, new commits, or unverifiable state unless discard_changes is true. If removal is refused, confirm with the user before retrying with discard_changes: true. Manually created worktrees and worktrees from other runtimes are never adopted.",Je="Optional worktree identifier and branch suffix, using letters, digits, hyphens, or underscores. A random slug is generated when omitted.",Qe='"keep" preserves the worktree and branch; "remove" deletes both.',Ve="Explicitly allow discarding uncommitted files and new commits, or removing when changes cannot be verified. Confirm with the user before setting true. Only applies to remove.",Ze="Get the user-set persistent goal, or report in_progress, complete, or blocked with a reason. A goal is active automatically when the user sets it; in_progress reports progress and resets the blocker audit while keeping it active. Only the user can set, replace, pause, resume, or clear goals. Complete only when all requirements are achieved and verified. Record the same blocker on three consecutive continuation turns before stopping; multiple calls in one turn count once.",et="Read goal status, or report progress, completion, or blockage.",tt="Required for update. Use in_progress to report progress and reset the blocker audit on an active goal, complete when verified, or blocked for an unavoidable blocker.",ot="Required for update. Describe progress, evidence of completion, or the specific blocker.",rt="Query a configured language server for definitions, references, hover, symbols, implementations, type definitions, call hierarchy, or diagnostics. file_path resolves against the current working directory; line and character are 1-based UTF-16 positions. Returned ranges use the LSP standard (0-based UTF-16) and file URIs. This tool cannot edit files or run arbitrary commands. Servers must be explicitly configured in lsp_servers; no automatic installation.",A="Invoke a tool on a connected MCP server. Call ToolSearch first to load the tool's schema, then pass its arguments here exactly as that schema requires, using the same JSON types.",N="MCP server name, e.g. 'linear'.",w="Full tool name as returned by ToolSearch, e.g. 'mcp__linear__create_issue'.",D="The target tool's arguments. Must match that tool's input_schema exactly, including JSON types: bare numbers for integer fields, bare true/false for boolean fields, quoted strings for string fields, and plain JSON arrays for array fields.",nt="Return structured output in JSON format. Use this tool to return your final response as structured data in non-interactive or coordinator mode sessions.",st="The structured result: an object, an array, or a plain string",it="Inspect a background Agent/Bash/PowerShell task by its task_id, or wait once for at most timeout_ms (maximum 60000). This does not consume completion notifications or cancel timed-out tasks. Prefer automatic task notifications over repeated polling. TodoWrite item IDs belong to the separate TODO board and cannot be used here.",at="Search for and load deferred tools by name or keyword.",ct='Search query. Use "select:name1,name2" to load specific tools by name, or keywords to search.',lt="Max results to return",pt="OpenAI-style action type: click (button, x, y, keys), double_click (x, y, keys), drag (path, keys), keypress (keys), move (x, y, keys), screenshot, scroll (x, y, scrollX, scrollY, keys), type (text), wait.",ut="Anthropic-style single computer action. Send either action or actions, not both.",dt="OpenAI-style ordered batch of computer actions, executed in sequence; a screenshot is returned after the batch.",mt="Button for type=click.",ht="Keys held during the action, or pressed by keypress.",gt="Drag path for type=drag.",ft="Horizontal scroll delta for type=scroll.",_t="Vertical scroll delta for type=scroll.",Tt="Text to type for type=type.",yt="OpenAI-style safety checks raised with the batch; acknowledged in the tool result.",Et="OpenAI-style status of the computer call; echoed in the tool result.",It="Anthropic-style [x, y] coordinate in the latest screenshot space.",Rt="Seconds for hold_key or wait.",St="Zoom region [x1, y1, x2, y2] in the latest screenshot space.",Ct="Anthropic-style number of wheel clicks to scroll.",xt="Anthropic-style drag start coordinate.",Ot="Text to type, or a '+'-separated key combination.",Pt="OpenAI-style x coordinate.",kt="OpenAI-style y coordinate.",bt="Button for action=click.",At="OpenAI-style keys held during an action or pressed by keypress.",Nt="OpenAI-style drag path.",wt="OpenAI-style horizontal scroll delta.",Dt="OpenAI-style vertical scroll delta.";function Mt(e){return`Control the current ${e} computer with screenshots, mouse, keyboard, scrolling, waiting, and zoom. Use screenshot before choosing coordinates and verify consequential actions with another screenshot. Two call styles are supported: Anthropic-style single actions (action + coordinate/scroll_amount/scroll_direction/start_coordinate/region/text), and OpenAI-style batches (actions[] of typed actions with x/y/button/keys/path/scrollX/scrollY/text, plus pendingSafetyChecks and status; a screenshot is returned after the batch). Flat OpenAI aliases (action=click/drag/keypress/move) are also accepted.`}function B(e,t){if(t==="string"&&typeof e=="number"&&Number.isFinite(e))return String(e);if((t==="integer"||t==="number")&&typeof e=="string"){let o=e.trim();if(o===""||!(t==="integer"?I:R).test(o))return e;let s=t==="integer"?Number.parseInt(o,10):Number.parseFloat(o);return Number.isFinite(s)?s:e}if(t==="boolean"&&typeof e=="string"){let o=e.trim().toLowerCase();if(o==="true")return!0;if(o==="false")return!1}return e}function _(e,t){if(typeof t!="object"||t===null)return e;let o=p(t),r=l(o,"type","");if(r==="object"&&typeof e=="object"&&e!==null&&!Array.isArray(e)){let s=p(o.properties??{}),n={};for(let[i,c]of Object.entries(p(e))){let m=Object.hasOwn(s,i)?_(c,s[i]):c;i==="__proto__"?Object.defineProperty(n,i,{value:m,writable:!0,enumerable:!0,configurable:!0}):n[i]=m}return n}if(r==="array"){let s=o.items??{},n=e;if(typeof n=="object"&&n!==null&&!Array.isArray(n)){let i=Object.values(n);i.length===1&&Array.isArray(i[0])&&(n=i[0])}else typeof n=="string"&&(n=n.split(",").map(i=>i.trim()).filter(i=>i!==""));return Array.isArray(n)?n.map(i=>_(i,s)):n}return r!==""?B(e,r):e}function jt(e,t){return t.startsWith(a)?t.slice(a.length):d(e)+"__"+d(t)}function T(e){return"mcpInputSchema"in e&&typeof e.mcpInputSchema=="function"}var M=class{constructor(t){this.registry=t}registry;name="McpCall";description=A;category="command";deferred=!1;schema(){return{name:this.name,description:this.description,input_schema:{type:"object",properties:{server:{type:"string",description:N},tool:{type:"string",description:w},arguments:{type:"object",description:D}},required:["server","tool","arguments"]}}}resolveTarget(t){let o=l(t,"server"),r=l(t,"tool");if(!o||!r)return;let s=r.startsWith(a)?r:f(o,r),n=this.registry.get(s);return n&&T(n)&&n.mcpServerName===o?n:void 0}availableNames(){return this.registry.listTools().filter(t=>t.name.startsWith(a)).map(t=>t.name).sort()}prepareArguments(t){let o=this.resolveTarget(t);return!o||typeof t.arguments!="object"||t.arguments===null||Array.isArray(t.arguments)?t:{...t,arguments:_(t.arguments,o.mcpInputSchema())}}async execute(t,o){let r=l(o,"server",""),s=l(o,"tool","");if(s==="")return{output:S,isError:!0};let n=this.resolveTarget(o);if(!n){let c=this.availableNames(),m=c.length>0?c.join(", "):"(none connected)";return{output:`Unknown MCP tool '${s}' on server '${r}'. Available tools: ${m}`,isError:!0}}if(typeof o.arguments!="object"||o.arguments===null||Array.isArray(o.arguments))return{output:C,isError:!0};let i=p(this.prepareArguments(o).arguments);return t.abortSignal?.throwIfAborted(),n.execute(t,i)}};function G(e){if(!e)return!0;try{return P.has(new URL(e).hostname.toLowerCase())}catch{return!1}}function q(e){return Math.floor(e/2.5)}function W(e,t,o,r,s="auto",n=10){if(s!=="auto")return s==="native"&&t!=="anthropic"?"dispatch":s;if(r<=0)return"eager";let i=o*n/100;return q(r)<i?"eager":t==="anthropic"&&G(e)?"native":"dispatch"}function K(e){let t=0;for(let o of e.listTools())if(o.name.startsWith(a))try{t+=JSON.stringify(o.schema()).length}catch{t+=o.name.length+(o.description?.length??0)}return t}function X(e,t){e.mcpLoadingMode=t;let o=t==="eager";for(let r of e.listTools())T(r)&&typeof r.setDeferLoading=="function"&&r.setDeferLoading(!o);e.exposeToolSearch=!o,e.exposeMcpCall=t==="dispatch"}function Kt(e,t,o,r,s="auto"){let n=W(t,o,r,K(e),s);return X(e,n),n}export{$ as a,J as b,a as c,Q as d,V as e,Z as f,ee as g,te as h,oe as i,f as j,k,ce as l,le as m,pe as n,ue as o,de as p,me as q,he as r,ge as s,fe as t,_e as u,Te as v,ye as w,Ee as x,Ie as y,Re as z,Se as A,Ce as B,xe as C,Oe as D,Pe as E,ke as F,be as G,Ae as H,Ne as I,we as J,De as K,Me as L,Le as M,Ue as N,ve as O,Fe as P,Be as Q,He as R,je as S,Ge as T,qe as U,We as V,Ke as W,Xe as X,Ye as Y,$e as Z,ze as _,Je as $,Qe as aa,Ve as ba,Ze as ca,et as da,tt as ea,ot as fa,rt as ga,nt as ha,st as ia,it as ja,at as ka,ct as la,lt as ma,pt as na,ut as oa,dt as pa,mt as qa,ht as ra,gt as sa,ft as ta,_t as ua,Tt as va,yt as wa,Et as xa,It as ya,Rt as za,St as Aa,Ct as Ba,xt as Ca,Ot as Da,Pt as Ea,kt as Fa,bt as Ga,At as Ha,Nt as Ia,wt as Ja,Dt as Ka,Mt as La,jt as Ma,M as Na,G as Oa,X as Pa,Kt as Qa};
|
|
35
|
+
Use it for significant architectural ambiguity, unclear requirements that require exploration, or high-impact restructuring. Skip it when the task is straightforward, the user has already specified the implementation, the fix is obvious after diagnosis, or the request is pure research. Do not use it from delegated agents. This tool takes no parameters.`,Ye="Submit the completed plan from the plan file. The main agent presents it for user approval; a teammate follows the host's team approval policy (leader review in coordinator mode, automatic approval otherwise); a one-shot subagent returns it to the parent. Do not implement until the host approves execution.",$e="Create an isolated git worktree and switch this agent's working directory into it. Use only when the user explicitly requests a worktree. Only one worktree session may be active at a time. The optional slug is generated randomly when omitted. Use ExitWorktree to return to the original directory.",ze="Exit this agent's active EnterWorktree session and restore its original working directory. Use only when the user asks to leave the worktree. With no active session this is a no-op. Use action: keep to preserve the worktree and branch, or remove to delete both. Removal refuses uncommitted files, new commits, or unverifiable state unless discard_changes is true. If removal is refused, confirm with the user before retrying with discard_changes: true. Manually created worktrees and worktrees from other runtimes are never adopted.",Je="Optional worktree identifier and branch suffix, using letters, digits, hyphens, or underscores. A random slug is generated when omitted.",Qe='"keep" preserves the worktree and branch; "remove" deletes both.',Ve="Explicitly allow discarding uncommitted files and new commits, or removing when changes cannot be verified. Confirm with the user before setting true. Only applies to remove.",Ze="Get the user-set persistent goal, or report in_progress, complete, or blocked with a reason. A goal is active automatically when the user sets it; in_progress reports progress and resets the blocker audit while keeping it active. Only the user can set, replace, pause, resume, or clear goals. Complete only when all requirements are achieved and verified. Record the same blocker on three consecutive continuation turns before stopping; multiple calls in one turn count once.",et="Read goal status, or report progress, completion, or blockage.",tt="Required for update. Use in_progress to report progress and reset the blocker audit on an active goal, complete when verified, or blocked for an unavoidable blocker.",ot="Required for update. Describe progress, evidence of completion, or the specific blocker.",b="Invoke a tool on a connected MCP server. Call ToolSearch first to load the tool's schema, then pass its arguments here exactly as that schema requires, using the same JSON types.",N="MCP server name, e.g. 'linear'.",w="Full tool name as returned by ToolSearch, e.g. 'mcp__linear__create_issue'.",D="The target tool's arguments. Must match that tool's input_schema exactly, including JSON types: bare numbers for integer fields, bare true/false for boolean fields, quoted strings for string fields, and plain JSON arrays for array fields.",rt="Return structured output in JSON format. Use this tool to return your final response as structured data in non-interactive or coordinator mode sessions.",nt="The structured result: an object, an array, or a plain string",st="Inspect a background Agent/Bash/PowerShell task by its task_id, or wait once for at most timeout_ms (maximum 60000). This does not consume completion notifications or cancel timed-out tasks. Prefer automatic task notifications over repeated polling. TodoWrite item IDs belong to the separate TODO board and cannot be used here.",it="Search for and load deferred tools by name or keyword.",at='Search query. Use "select:name1,name2" to load specific tools by name, or keywords to search.',ct="Max results to return",lt="OpenAI-style action type: click (button, x, y, keys), double_click (x, y, keys), drag (path, keys), keypress (keys), move (x, y, keys), screenshot, scroll (x, y, scrollX, scrollY, keys), type (text), wait.",pt="Anthropic-style single computer action. Send either action or actions, not both.",ut="OpenAI-style ordered batch of computer actions, executed in sequence; a screenshot is returned after the batch.",dt="Button for type=click.",mt="Keys held during the action, or pressed by keypress.",ht="Drag path for type=drag.",gt="Horizontal scroll delta for type=scroll.",ft="Vertical scroll delta for type=scroll.",_t="Text to type for type=type.",Tt="OpenAI-style safety checks raised with the batch; acknowledged in the tool result.",yt="OpenAI-style status of the computer call; echoed in the tool result.",Et="Anthropic-style [x, y] coordinate in the latest screenshot space.",It="Seconds for hold_key or wait.",Rt="Zoom region [x1, y1, x2, y2] in the latest screenshot space.",St="Anthropic-style number of wheel clicks to scroll.",Ct="Anthropic-style drag start coordinate.",Ot="Text to type, or a '+'-separated key combination.",xt="OpenAI-style x coordinate.",Pt="OpenAI-style y coordinate.",kt="Button for action=click.",At="OpenAI-style keys held during an action or pressed by keypress.",bt="OpenAI-style drag path.",Nt="OpenAI-style horizontal scroll delta.",wt="OpenAI-style vertical scroll delta.";function Dt(e){return`Control the current ${e} computer with screenshots, mouse, keyboard, scrolling, waiting, and zoom. Use screenshot before choosing coordinates and verify consequential actions with another screenshot. Two call styles are supported: Anthropic-style single actions (action + coordinate/scroll_amount/scroll_direction/start_coordinate/region/text), and OpenAI-style batches (actions[] of typed actions with x/y/button/keys/path/scrollX/scrollY/text, plus pendingSafetyChecks and status; a screenshot is returned after the batch). Flat OpenAI aliases (action=click/drag/keypress/move) are also accepted.`}function B(e,t){if(t==="string"&&typeof e=="number"&&Number.isFinite(e))return String(e);if((t==="integer"||t==="number")&&typeof e=="string"){let o=e.trim();if(o===""||!(t==="integer"?I:R).test(o))return e;let s=t==="integer"?Number.parseInt(o,10):Number.parseFloat(o);return Number.isFinite(s)?s:e}if(t==="boolean"&&typeof e=="string"){let o=e.trim().toLowerCase();if(o==="true")return!0;if(o==="false")return!1}return e}function _(e,t){if(typeof t!="object"||t===null)return e;let o=p(t),r=l(o,"type","");if(r==="object"&&typeof e=="object"&&e!==null&&!Array.isArray(e)){let s=p(o.properties??{}),n={};for(let[i,c]of Object.entries(p(e))){let m=Object.hasOwn(s,i)?_(c,s[i]):c;i==="__proto__"?Object.defineProperty(n,i,{value:m,writable:!0,enumerable:!0,configurable:!0}):n[i]=m}return n}if(r==="array"){let s=o.items??{},n=e;if(typeof n=="object"&&n!==null&&!Array.isArray(n)){let i=Object.values(n);i.length===1&&Array.isArray(i[0])&&(n=i[0])}else typeof n=="string"&&(n=n.split(",").map(i=>i.trim()).filter(i=>i!==""));return Array.isArray(n)?n.map(i=>_(i,s)):n}return r!==""?B(e,r):e}function Ht(e,t){return t.startsWith(a)?t.slice(a.length):d(e)+"__"+d(t)}function T(e){return"mcpInputSchema"in e&&typeof e.mcpInputSchema=="function"}var M=class{constructor(t){this.registry=t}registry;name="McpCall";description=b;category="command";deferred=!1;schema(){return{name:this.name,description:this.description,input_schema:{type:"object",properties:{server:{type:"string",description:N},tool:{type:"string",description:w},arguments:{type:"object",description:D}},required:["server","tool","arguments"]}}}resolveTarget(t){let o=l(t,"server"),r=l(t,"tool");if(!o||!r)return;let s=r.startsWith(a)?r:f(o,r),n=this.registry.get(s);return n&&T(n)&&n.mcpServerName===o?n:void 0}availableNames(){return this.registry.listTools().filter(t=>t.name.startsWith(a)).map(t=>t.name).sort()}prepareArguments(t){let o=this.resolveTarget(t);return!o||typeof t.arguments!="object"||t.arguments===null||Array.isArray(t.arguments)?t:{...t,arguments:_(t.arguments,o.mcpInputSchema())}}async execute(t,o){let r=l(o,"server",""),s=l(o,"tool","");if(s==="")return{output:S,isError:!0};let n=this.resolveTarget(o);if(!n){let c=this.availableNames(),m=c.length>0?c.join(", "):"(none connected)";return{output:`Unknown MCP tool '${s}' on server '${r}'. Available tools: ${m}`,isError:!0}}if(typeof o.arguments!="object"||o.arguments===null||Array.isArray(o.arguments))return{output:C,isError:!0};let i=p(this.prepareArguments(o).arguments);return t.abortSignal?.throwIfAborted(),n.execute(t,i)}};function G(e){if(!e)return!0;try{return P.has(new URL(e).hostname.toLowerCase())}catch{return!1}}function q(e){return Math.floor(e/2.5)}function W(e,t,o,r,s="auto",n=10){if(s!=="auto")return s==="native"&&t!=="anthropic"?"dispatch":s;if(r<=0)return"eager";let i=o*n/100;return q(r)<i?"eager":t==="anthropic"&&G(e)?"native":"dispatch"}function K(e){let t=0;for(let o of e.listTools())if(o.name.startsWith(a))try{t+=JSON.stringify(o.schema()).length}catch{t+=o.name.length+(o.description?.length??0)}return t}function X(e,t){e.mcpLoadingMode=t;let o=t==="eager";for(let r of e.listTools())T(r)&&typeof r.setDeferLoading=="function"&&r.setDeferLoading(!o);e.exposeToolSearch=!o,e.exposeMcpCall=t==="dispatch"}function Wt(e,t,o,r,s="auto"){let n=W(t,o,r,K(e),s);return X(e,n),n}export{$ as a,J as b,a as c,Q as d,V as e,Z as f,ee as g,te as h,oe as i,f as j,k,ce as l,le as m,pe as n,ue as o,de as p,me as q,he as r,ge as s,fe as t,_e as u,Te as v,ye as w,Ee as x,Ie as y,Re as z,Se as A,Ce as B,Oe as C,xe as D,Pe as E,ke as F,Ae as G,be as H,Ne as I,we as J,De as K,Me as L,Le as M,Ue as N,ve as O,Fe as P,Be as Q,He as R,je as S,Ge as T,qe as U,We as V,Ke as W,Xe as X,Ye as Y,$e as Z,ze as _,Je as $,Qe as aa,Ve as ba,Ze as ca,et as da,tt as ea,ot as fa,rt as ga,nt as ha,st as ia,it as ja,at as ka,ct as la,lt as ma,pt as na,ut as oa,dt as pa,mt as qa,ht as ra,gt as sa,ft as ta,_t as ua,Tt as va,yt as wa,Et as xa,It as ya,Rt as za,St as Aa,Ct as Ba,Ot as Ca,xt as Da,Pt as Ea,kt as Fa,At as Ga,bt as Ha,Nt as Ia,wt as Ja,Dt as Ka,Ht as La,M as Ma,G as Na,X as Oa,Wt as Pa};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __yukinoCreateRequire } from "node:module";
|
|
3
|
+
const require = __yukinoCreateRequire(import.meta.url);
|
|
4
|
+
import{a as Kt,b as zt,c as Xt,d as Yt,e as Jt,f as Qt,g as Zt,h as er,i as tr,j as rr,k as nr,l as ir,m as sr,n as or,o as lr,p as cr,q as fr,r as ar,s as he,u as ur,v as qe}from"./chunk-WLJL66O5.js";import{a as I,c as R,e as ls}from"./chunk-7MKA3SHV.js";var ze=R((ru,Ir)=>{"use strict";var fe=e=>e&&typeof e.message=="string",Ke=e=>{if(!e)return;let t=e.cause;if(typeof t=="function"){let r=e.cause();return fe(r)?r:void 0}else return fe(t)?t:void 0},xr=(e,t)=>{if(!fe(e))return"";let r=e.stack||"";if(t.has(e))return r+`
|
|
5
|
+
causes have become circular...`;let n=Ke(e);return n?(t.add(e),r+`
|
|
6
|
+
caused by: `+xr(n,t)):r},gs=e=>xr(e,new Set),Lr=(e,t,r)=>{if(!fe(e))return"";let n=r?"":e.message||"";if(t.has(e))return n+": ...";let i=Ke(e);if(i){t.add(e);let s=typeof e.cause=="function";return n+(s?"":": ")+Lr(i,t,s)}else return n},ys=e=>Lr(e,new Set);Ir.exports={isErrorLike:fe,getErrorCause:Ke,stackWithCauses:gs,messageWithCauses:ys}});var Xe=R((nu,Pr)=>{"use strict";var Es=Symbol("circular-ref-tag"),me=Symbol("pino-raw-err-ref"),Nr=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[me]},set:function(e){this[me]=e}}});Object.defineProperty(Nr,me,{writable:!0,value:{}});Pr.exports={pinoErrProto:Nr,pinoErrorSymbols:{seen:Es,rawSymbol:me}}});var vr=R((iu,Dr)=>{"use strict";Dr.exports=Je;var{messageWithCauses:_s,stackWithCauses:Ss,isErrorLike:Mr}=ze(),{pinoErrProto:bs,pinoErrorSymbols:ws}=Xe(),{seen:Ye}=ws,{toString:Rs}=Object.prototype;function Je(e){if(!Mr(e))return e;e[Ye]=void 0;let t=Object.create(bs);t.type=Rs.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,t.message=_s(e),t.stack=Ss(e),Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(r=>Je(r)));for(let r in e)if(t[r]===void 0){let n=e[r];Mr(n)?r!=="cause"&&!Object.prototype.hasOwnProperty.call(n,Ye)&&(t[r]=Je(n)):t[r]=n}return delete e[Ye],t.raw=e,t}});var Cr=R((su,kr)=>{"use strict";kr.exports=ye;var{isErrorLike:Qe}=ze(),{pinoErrProto:Os,pinoErrorSymbols:Ts}=Xe(),{seen:ge}=Ts,{toString:As}=Object.prototype;function ye(e){if(!Qe(e))return e;e[ge]=void 0;let t=Object.create(Os);t.type=As.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,t.message=e.message,t.stack=e.stack,Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(r=>ye(r))),Qe(e.cause)&&!Object.prototype.hasOwnProperty.call(e.cause,ge)&&(t.cause=ye(e.cause));for(let r in e)if(t[r]===void 0){let n=e[r];Qe(n)?Object.prototype.hasOwnProperty.call(n,ge)||(t[r]=ye(n)):t[r]=n}return delete e[ge],t.raw=e,t}});var Fr=R((ou,$r)=>{"use strict";$r.exports={mapHttpRequest:xs,reqSerializer:Ur};var Ze=Symbol("pino-raw-req-ref"),Br=Object.create({},{id:{enumerable:!0,writable:!0,value:""},method:{enumerable:!0,writable:!0,value:""},url:{enumerable:!0,writable:!0,value:""},query:{enumerable:!0,writable:!0,value:""},params:{enumerable:!0,writable:!0,value:""},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:""},remotePort:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[Ze]},set:function(e){this[Ze]=e}}});Object.defineProperty(Br,Ze,{writable:!0,value:{}});function Ur(e){let t=e.info||e.socket,r=Object.create(Br);if(r.id=typeof e.id=="function"?e.id():e.id||(e.info?e.info.id:void 0),r.method=e.method,e.originalUrl)r.url=e.originalUrl;else{let n=e.path;r.url=typeof n=="string"?n:e.url?e.url.path||e.url:void 0}return e.query&&(r.query=e.query),e.params&&(r.params=e.params),r.headers=e.headers,r.remoteAddress=t&&t.remoteAddress,r.remotePort=t&&t.remotePort,r.raw=e.raw||e,r}function xs(e){return{req:Ur(e)}}});var Vr=R((lu,Wr)=>{"use strict";Wr.exports={mapHttpResponse:Ls,resSerializer:qr};var et=Symbol("pino-raw-res-ref"),jr=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[et]},set:function(e){this[et]=e}}});Object.defineProperty(jr,et,{writable:!0,value:{}});function qr(e){let t=Object.create(jr);return t.statusCode=e.headersSent?e.statusCode:null,t.headers=e.getHeaders?e.getHeaders():e._headers,t.raw=e,t}function Ls(e){return{res:qr(e)}}});var rt=R((cu,Gr)=>{"use strict";var tt=vr(),Is=Cr(),Ee=Fr(),_e=Vr();Gr.exports={err:tt,errWithCause:Is,mapHttpRequest:Ee.mapHttpRequest,mapHttpResponse:_e.mapHttpResponse,req:Ee.reqSerializer,res:_e.resSerializer,wrapErrorSerializer:function(t){return t===tt?t:function(n){return t(tt(n))}},wrapRequestSerializer:function(t){return t===Ee.reqSerializer?t:function(n){return t(Ee.reqSerializer(n))}},wrapResponseSerializer:function(t){return t===_e.resSerializer?t:function(n){return t(_e.resSerializer(n))}}}});var nt=R((fu,zr)=>{"use strict";var Hr=I("util"),Kr=Hr.getCallSites??Hr.getCallSite;function Ns(e,t){return t}zr.exports=function(){if(Kr)return Kr().slice(2).map(s=>s.scriptName);let t=Error.prepareStackTrace;Error.prepareStackTrace=Ns;let r=new Error().stack;if(Error.prepareStackTrace=t,!Array.isArray(r))return;let n=r.slice(2),i=[];for(let s of n)s&&i.push(s.getFileName());return i}});var en=R((au,Zr)=>{"use strict";function it(e){if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array){let t=[];for(let r=0;r<e.length;r++)t[r]=it(e[r]);return t}if(typeof e=="object"){let t=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=it(e[r]));return t}return e}function Xr(e){let t=[],r="",n=!1,i=!1,s="";for(let f=0;f<e.length;f++){let o=e[f];!n&&o==="."?r&&(t.push(r),r=""):o==="["?(r&&(t.push(r),r=""),n=!0):o==="]"&&n?(t.push(r),r="",n=!1,i=!1):(o==='"'||o==="'")&&n?i?o===s?(i=!1,s=""):r+=o:(i=!0,s=o):r+=o}return r&&t.push(r),t}function Yr(e,t,r){let n=e;for(let s=0;s<t.length-1;s++){let f=t[s];if(typeof n!="object"||n===null||!(f in n)||typeof n[f]!="object"||n[f]===null)return!1;n=n[f]}let i=t[t.length-1];if(i==="*"){if(Array.isArray(n))for(let s=0;s<n.length;s++)n[s]=r;else if(typeof n=="object"&&n!==null)for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&(n[s]=r)}else typeof n=="object"&&n!==null&&i in n&&Object.prototype.hasOwnProperty.call(n,i)&&(n[i]=r);return!0}function Jr(e,t){let r=e;for(let i=0;i<t.length-1;i++){let s=t[i];if(typeof r!="object"||r===null||!(s in r)||typeof r[s]!="object"||r[s]===null)return!1;r=r[s]}let n=t[t.length-1];if(n==="*"){if(Array.isArray(r))for(let i=0;i<r.length;i++)r[i]=void 0;else if(typeof r=="object"&&r!==null)for(let i in r)Object.prototype.hasOwnProperty.call(r,i)&&delete r[i]}else typeof r=="object"&&r!==null&&n in r&&Object.prototype.hasOwnProperty.call(r,n)&&delete r[n];return!0}var Se=Symbol("PATH_NOT_FOUND");function Ps(e,t){let r=e;for(let n of t){if(r==null||typeof r!="object"||r===null||!(n in r))return Se;r=r[n]}return r}function Ms(e,t){let r=e;for(let n of t){if(r==null||typeof r!="object"||r===null)return;r=r[n]}return r}function Ds(e,t,r,n=!1){for(let i of t){let s=Xr(i);if(s.includes("*"))Qr(e,s,r,i,n);else if(n)Jr(e,s);else{let f=Ps(e,s);if(f===Se)continue;let o=typeof r=="function"?r(f,s):r;Yr(e,s,o)}}}function Qr(e,t,r,n,i=!1){let s=t.indexOf("*");if(s===t.length-1){let f=t.slice(0,-1),o=e;for(let l of f){if(o==null||typeof o!="object"||o===null)return;o=o[l]}if(Array.isArray(o))if(i)for(let l=0;l<o.length;l++)o[l]=void 0;else for(let l=0;l<o.length;l++){let u=[...f,l.toString()],h=typeof r=="function"?r(o[l],u):r;o[l]=h}else if(typeof o=="object"&&o!==null)if(i){let l=[];for(let u in o)Object.prototype.hasOwnProperty.call(o,u)&&l.push(u);for(let u of l)delete o[u]}else for(let l in o){let u=[...f,l],h=typeof r=="function"?r(o[l],u):r;o[l]=h}}else vs(e,t,r,s,n,i)}function vs(e,t,r,n,i,s=!1){let f=t.slice(0,n),o=t.slice(n+1),l=[];function u(h,d){if(d===f.length){if(Array.isArray(h))for(let g=0;g<h.length;g++)l[d]=g.toString(),u(h[g],d+1);else if(typeof h=="object"&&h!==null)for(let g in h)l[d]=g,u(h[g],d+1)}else if(d<f.length){let g=f[d];h&&typeof h=="object"&&h!==null&&g in h&&(l[d]=g,u(h[g],d+1))}else if(o.includes("*"))Qr(h,o,typeof r=="function"?(p,c)=>{let y=[...l.slice(0,d),...c];return r(p,y)}:r,i,s);else if(s)Jr(h,o);else{let g=typeof r=="function"?r(Ms(h,o),[...l.slice(0,d),...o]):r;Yr(h,o,g)}}if(f.length===0)u(e,0);else{let h=e;for(let d=0;d<f.length;d++){let g=f[d];if(h==null||typeof h!="object"||h===null)return;h=h[g],l[d]=g}h!=null&&u(h,f.length)}}function ks(e){if(e.length===0)return null;let t=new Map;for(let r of e){let n=Xr(r),i=t;for(let s=0;s<n.length;s++){let f=n[s];i.has(f)||i.set(f,new Map),i=i.get(f)}}return t}function Cs(e,t){if(!t)return e;function r(n,i,s=0){if(!i||i.size===0||n===null||typeof n!="object")return n;if(n instanceof Date)return new Date(n.getTime());if(Array.isArray(n)){let o=[];for(let l=0;l<n.length;l++){let u=l.toString();i.has(u)||i.has("*")?o[l]=r(n[l],i.get(u)||i.get("*")):o[l]=n[l]}return o}let f=Object.create(Object.getPrototypeOf(n));for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&(i.has(o)||i.has("*")?f[o]=r(n[o],i.get(o)||i.get("*")):f[o]=n[o]);return f}return r(e,t)}function Bs(e){if(typeof e!="string")throw new Error("Paths must be (non-empty) strings");if(e==="")throw new Error("Invalid redaction path ()");if(e.includes(".."))throw new Error(`Invalid redaction path (${e})`);if(e.includes(","))throw new Error(`Invalid redaction path (${e})`);let t=0,r=!1,n="";for(let i=0;i<e.length;i++){let s=e[i];if((s==='"'||s==="'")&&t>0)r?s===n&&(r=!1,n=""):(r=!0,n=s);else if(s==="["&&!r)t++;else if(s==="]"&&!r&&(t--,t<0))throw new Error(`Invalid redaction path (${e})`)}if(t!==0)throw new Error(`Invalid redaction path (${e})`)}function Us(e){if(!Array.isArray(e))throw new TypeError("paths must be an array");for(let t of e)Bs(t)}function $s(e={}){let{paths:t=[],censor:r="[REDACTED]",serialize:n=JSON.stringify,strict:i=!0,remove:s=!1}=e;Us(t);let f=ks(t);return function(l){if(i&&(l===null||typeof l!="object")&&(l==null||typeof l!="object"))return n?n(l):l;let u=Cs(l,f),h=l,d=r;return typeof r=="function"&&(d=r),Ds(u,t,d,s),n===!1?(u.restore=function(){return it(h)},u):typeof n=="function"?n(u):JSON.stringify(u)}}Zr.exports=$s});var H=R((uu,tn)=>{"use strict";var Fs=Symbol("pino.setLevel"),js=Symbol("pino.getLevel"),qs=Symbol("pino.levelVal"),Ws=Symbol("pino.levelComp"),Vs=Symbol("pino.useLevelLabels"),Gs=Symbol("pino.useOnlyCustomLevels"),Hs=Symbol("pino.mixin"),Ks=Symbol("pino.lsCache"),zs=Symbol("pino.chindings"),Xs=Symbol("pino.asJson"),Ys=Symbol("pino.write"),Js=Symbol("pino.redactFmt"),Qs=Symbol("pino.time"),Zs=Symbol("pino.timeSliceIndex"),eo=Symbol("pino.stream"),to=Symbol("pino.stringify"),ro=Symbol("pino.stringifySafe"),no=Symbol("pino.stringifiers"),io=Symbol("pino.end"),so=Symbol("pino.formatOpts"),oo=Symbol("pino.messageKey"),lo=Symbol("pino.errorKey"),co=Symbol("pino.nestedKey"),fo=Symbol("pino.nestedKeyStr"),ao=Symbol("pino.mixinMergeStrategy"),uo=Symbol("pino.msgPrefix"),ho=Symbol("pino.wildcardFirst"),po=Symbol.for("pino.serializers"),mo=Symbol.for("pino.formatters"),go=Symbol.for("pino.hooks"),yo=Symbol.for("pino.metadata"),Eo=Symbol.for("pino.transport.usesMultistream");tn.exports={setLevelSym:Fs,getLevelSym:js,levelValSym:qs,levelCompSym:Ws,useLevelLabelsSym:Vs,mixinSym:Hs,lsCacheSym:Ks,chindingsSym:zs,asJsonSym:Xs,writeSym:Ys,serializersSym:po,redactFmtSym:Js,timeSym:Qs,timeSliceIndexSym:Zs,streamSym:eo,stringifySym:to,stringifySafeSym:ro,stringifiersSym:no,endSym:io,formatOptsSym:so,messageKeySym:oo,errorKeySym:lo,nestedKeySym:co,wildcardFirstSym:ho,needsMetadataGsym:yo,useOnlyCustomLevelsSym:Gs,formattersSym:mo,hooksSym:go,nestedKeyStrSym:fo,mixinMergeStrategySym:ao,msgPrefixSym:uo,transportUsesMultistreamSym:Eo}});var ot=R((du,on)=>{"use strict";var rn=en(),{redactFmtSym:_o,wildcardFirstSym:be}=H(),st=/[^.[\]]+|\[([^[\]]*?)\]/g,nn="[Redacted]",sn=!1;function So(e,t){let{paths:r,censor:n,remove:i}=bo(e),s=r.reduce((l,u)=>{st.lastIndex=0;let h=st.exec(u),d=st.exec(u),g=h[1]!==void 0?h[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):h[0];if(g==="*"&&(g=be),d===null)return l[g]=null,l;if(l[g]===null)return l;let{index:p}=d,c=`${u.substr(p,u.length-1)}`;return l[g]=l[g]||[],g!==be&&l[g].length===0&&l[g].push(...l[be]||[]),g===be&&Object.keys(l).forEach(function(y){l[y]&&l[y].push(c)}),l[g].push(c),l},Object.create(null)),f=Object.assign(Object.create(null),{[_o]:rn({paths:r,censor:n,serialize:t,strict:sn,remove:i})}),o=(...l)=>t(typeof n=="function"?n(...l):n);return[...Object.keys(s),...Object.getOwnPropertySymbols(s)].reduce((l,u)=>{if(s[u]===null)l[u]=h=>o(h,[u]);else{let h=typeof n=="function"?(d,g)=>n(d,[u,...g]):n;l[u]=rn({paths:s[u],censor:h,serialize:t,strict:sn,remove:i})}return l},f)}function bo(e){if(Array.isArray(e))return e={paths:e,censor:nn},e;let{paths:t,censor:r=nn,remove:n}=e;if(Array.isArray(t)===!1)throw Error("pino \u2013 redact must contain an array of strings");return n===!0&&(r=void 0),{paths:t,censor:r,remove:n}}on.exports=So});var fn=R((hu,cn)=>{"use strict";var wo=()=>"",Ro=()=>`,"time":${Date.now()}`,Oo=()=>`,"time":${Math.round(Date.now()/1e3)}`,To=()=>`,"time":"${new Date(Date.now()).toISOString()}"`,Ao=1000000n,ln=1000000000n,xo=BigInt(Date.now())*Ao,Lo=process.hrtime.bigint(),Io=()=>{let e=process.hrtime.bigint()-Lo,t=xo+e,r=t/ln,n=t%ln,i=Number(r*1000n+n/1000000n),s=new Date(i),f=s.getUTCFullYear(),o=(s.getUTCMonth()+1).toString().padStart(2,"0"),l=s.getUTCDate().toString().padStart(2,"0"),u=s.getUTCHours().toString().padStart(2,"0"),h=s.getUTCMinutes().toString().padStart(2,"0"),d=s.getUTCSeconds().toString().padStart(2,"0");return`,"time":"${f}-${o}-${l}T${u}:${h}:${d}.${n.toString().padStart(9,"0")}Z"`};cn.exports={nullTime:wo,epochTime:Ro,unixTime:Oo,isoTime:To,isoTimeNano:Io}});var un=R((pu,an)=>{"use strict";function No(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}an.exports=Po;function Po(e,t,r){var n=r&&r.stringify||No,i=1;if(typeof e=="object"&&e!==null){var s=t.length+i;if(s===1)return e;var f=new Array(s);f[0]=n(e);for(var o=1;o<s;o++)f[o]=n(t[o]);return f.join(" ")}if(typeof e!="string")return e;var l=t.length;if(l===0)return e;for(var u="",h=1-i,d=-1,g=e&&e.length||0,p=0;p<g;){if(e.charCodeAt(p)===37&&p+1<g){switch(d=d>-1?d:0,e.charCodeAt(p+1)){case 100:case 102:if(h>=l||t[h]==null)break;d<p&&(u+=e.slice(d,p)),u+=Number(t[h]),d=p+2,p++;break;case 105:if(h>=l||t[h]==null)break;d<p&&(u+=e.slice(d,p)),u+=Math.floor(Number(t[h])),d=p+2,p++;break;case 79:case 111:case 106:if(h>=l||t[h]===void 0)break;d<p&&(u+=e.slice(d,p));var c=typeof t[h];if(c==="string"){u+="'"+t[h]+"'",d=p+2,p++;break}if(c==="function"){u+=t[h].name||"<anonymous>",d=p+2,p++;break}u+=n(t[h]),d=p+2,p++;break;case 115:if(h>=l)break;d<p&&(u+=e.slice(d,p)),u+=String(t[h]),d=p+2,p++;break;case 37:d<p&&(u+=e.slice(d,p)),u+="%",d=p+2,p++,h--;break}++h}++p}return d===-1?e:(d<g&&(u+=e.slice(d)),u)}});var ct=R((mu,lt)=>{"use strict";if(typeof SharedArrayBuffer<"u"&&typeof Atomics<"u"){let t=function(r){if((r>0&&r<1/0)===!1)throw typeof r!="number"&&typeof r!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");Atomics.wait(e,0,0,Number(r))},e=new Int32Array(new SharedArrayBuffer(4));lt.exports=t}else{let e=function(t){if((t>0&&t<1/0)===!1)throw typeof t!="number"&&typeof t!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");let n=Date.now()+Number(t);for(;n>Date.now(););};lt.exports=e}});var _n=R((gu,En)=>{"use strict";var A=I("fs"),Mo=I("events"),Do=I("util").inherits,dn=I("path"),at=ct(),vo=I("assert"),we=100,Re=Buffer.allocUnsafe(0),ko=16*1024,hn="buffer",pn="utf8",[Co,Bo]=(process.versions.node||"0.0").split(".").map(Number),Uo=Co>=22&&Bo>=7;function mn(e,t){t._opening=!0,t._writing=!0,t._asyncDrainScheduled=!1;function r(s,f){if(s){t._reopening=!1,t._writing=!1,t._opening=!1,t.sync?process.nextTick(()=>{t.listenerCount("error")>0&&t.emit("error",s)}):t.emit("error",s);return}let o=t._reopening;t.fd=f,t.file=e,t._reopening=!1,t._opening=!1,t._writing=!1,t.sync?process.nextTick(()=>t.emit("ready")):t.emit("ready"),!t.destroyed&&(!t._writing&&t._len>t.minLength||t._flushPending?t._actualWrite():o&&process.nextTick(()=>t.emit("drain")))}let n=t.append?"a":"w",i=t.mode;if(t.sync)try{t.mkdir&&A.mkdirSync(dn.dirname(e),{recursive:!0});let s=A.openSync(e,n,i);r(null,s)}catch(s){throw r(s),s}else t.mkdir?A.mkdir(dn.dirname(e),{recursive:!0},s=>{if(s)return r(s);A.open(e,n,i,r)}):A.open(e,n,i,r)}function U(e){if(!(this instanceof U))return new U(e);let{fd:t,dest:r,minLength:n,maxLength:i,maxWrite:s,periodicFlush:f,sync:o,append:l=!0,mkdir:u,retryEAGAIN:h,fsync:d,contentMode:g,mode:p}=e||{};t=t||r,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._flushPending=!1,this._hwm=Math.max(n||0,16387),this.file=null,this.destroyed=!1,this.minLength=n||0,this.maxLength=i||0,this.maxWrite=s||ko,this._periodicFlush=f||0,this._periodicFlushTimer=void 0,this.sync=o||!1,this.writable=!0,this._fsync=d||!1,this.append=l||!1,this.mode=p,this.retryEAGAIN=h||(()=>!0),this.mkdir=u||!1;let c,y;if(g===hn)this._writingBuf=Re,this.write=jo,this.flush=Wo,this.flushSync=Go,this._actualWrite=Ko,c=()=>A.writeSync(this.fd,this._writingBuf),y=()=>A.write(this.fd,this._writingBuf,this.release);else if(g===void 0||g===pn)this._writingBuf="",this.write=Fo,this.flush=qo,this.flushSync=Vo,this._actualWrite=Ho,c=()=>Buffer.isBuffer(this._writingBuf)?A.writeSync(this.fd,this._writingBuf):A.writeSync(this.fd,this._writingBuf,"utf8"),y=()=>Buffer.isBuffer(this._writingBuf)?A.write(this.fd,this._writingBuf,this.release):A.write(this.fd,this._writingBuf,"utf8",this.release);else throw new Error(`SonicBoom supports "${pn}" and "${hn}", but passed ${g}`);if(typeof t=="number")this.fd=t,process.nextTick(()=>this.emit("ready"));else if(typeof t=="string")mn(t,this);else throw new Error("SonicBoom supports only file descriptors and files");if(this.minLength>=this.maxWrite)throw new Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(m,S)=>{if(m){if((m.code==="EAGAIN"||m.code==="EBUSY")&&this.retryEAGAIN(m,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{at(we),this.release(void 0,0)}catch(b){this.release(b)}else setTimeout(y,we);else this._writing=!1,this.emit("error",m);return}this.emit("write",S);let E=ft(this._writingBuf,this._len,S);if(this._len=E.len,this._writingBuf=E.writingBuf,this._writingBuf.length){if(!this.sync){y();return}try{do{let b=c(),T=ft(this._writingBuf,this._len,b);this._len=T.len,this._writingBuf=T.writingBuf}while(this._writingBuf.length)}catch(b){this.release(b);return}}this._fsync&&A.fsyncSync(this.fd);let _=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):_>this.minLength?this._actualWrite():this._ending?_>0?this._actualWrite():(this._writing=!1,Oe(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick($o,this)):this.emit("drain"))},this.on("newListener",function(m){m==="drain"&&(this._asyncDrainScheduled=!1)}),this._periodicFlush!==0&&(this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.unref())}function ft(e,t,r){return typeof e=="string"&&(e=Buffer.from(e)),t=Math.max(t-r,0),e=e.subarray(r),{writingBuf:e,len:t}}function $o(e){e.listenerCount("drain")>0&&(e._asyncDrainScheduled=!1,e.emit("drain"))}Do(U,Mo);function gn(e,t){return e.length===0?Re:e.length===1?e[0]:Buffer.concat(e,t)}function Fo(e){if(this.destroyed)throw new Error("SonicBoom destroyed");e=""+e;let t=Buffer.byteLength(e),r=this._len+t,n=this._bufs;return this.maxLength&&r>this.maxLength?(this.emit("drop",e),this._len<this._hwm):(n.length===0||Buffer.byteLength(n[n.length-1])+t>this.maxWrite?n.push(e):n[n.length-1]+=e,this._len=r,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function jo(e){if(this.destroyed)throw new Error("SonicBoom destroyed");let t=this._len+e.length,r=this._bufs,n=this._lens;return this.maxLength&&t>this.maxLength?(this.emit("drop",e),this._len<this._hwm):(r.length===0||n[n.length-1]+e.length>this.maxWrite?(r.push([e]),n.push(e.length)):(r[r.length-1].push(e),n[n.length-1]+=e.length),this._len=t,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function yn(e){this._flushPending=!0;let t=()=>{if(this._fsync)this._flushPending=!1,e();else try{A.fsync(this.fd,n=>{this._flushPending=!1,e(n)})}catch(n){e(n)}this.off("error",r)},r=n=>{this._flushPending=!1,e(n),this.off("drain",t)};this.once("drain",t),this.once("error",r)}function qo(e){if(e!=null&&typeof e!="function")throw new Error("flush cb must be a function");if(this.destroyed){let t=new Error("SonicBoom destroyed");if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&yn.call(this,e),!this._writing&&(this._bufs.length===0&&this._bufs.push(""),this._actualWrite())}function Wo(e){if(e!=null&&typeof e!="function")throw new Error("flush cb must be a function");if(this.destroyed){let t=new Error("SonicBoom destroyed");if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&yn.call(this,e),!this._writing&&(this._bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}U.prototype.reopen=function(e){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.reopen(e)});return}if(this._ending)return;if(!this.file)throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");if(e&&(this.file=e),this._reopening=!0,this._writing)return;let t=this.fd;this.once("ready",()=>{t!==this.fd&&A.close(t,r=>{if(r)return this.emit("error",r)})}),mn(this.file,this)};U.prototype.end=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?this._actualWrite():Oe(this)))};function Vo(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf="");let e="";for(;this._bufs.length||e.length;){e.length<=0&&(e=this._bufs[0]);try{let t=Buffer.isBuffer(e)?A.writeSync(this.fd,e):A.writeSync(this.fd,e,"utf8"),r=ft(e,this._len,t);e=r.writingBuf,this._len=r.len,e.length<=0&&this._bufs.shift()}catch(t){if((t.code==="EAGAIN"||t.code==="EBUSY")&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;at(we)}}try{A.fsyncSync(this.fd)}catch{}}function Go(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift([this._writingBuf]),this._writingBuf=Re);let e=Re;for(;this._bufs.length||e.length;){e.length<=0&&(e=gn(this._bufs[0],this._lens[0]));try{let t=A.writeSync(this.fd,e);e=e.subarray(t),this._len=Math.max(this._len-t,0),e.length<=0&&(this._bufs.shift(),this._lens.shift())}catch(t){if((t.code==="EAGAIN"||t.code==="EBUSY")&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;at(we)}}}U.prototype.destroy=function(){this.destroyed||Oe(this)};function Ho(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:this._bufs.shift()||"",this.sync)try{let t=Buffer.isBuffer(this._writingBuf)?A.writeSync(this.fd,this._writingBuf):A.writeSync(this.fd,this._writingBuf,"utf8");e(null,t)}catch(t){e(t)}else A.write(this.fd,this._writingBuf,e)}function Ko(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:gn(this._bufs.shift(),this._lens.shift()),this.sync)try{let t=A.writeSync(this.fd,this._writingBuf);e(null,t)}catch(t){e(t)}else Uo&&(this._writingBuf=Buffer.from(this._writingBuf)),A.write(this.fd,this._writingBuf,e)}function Oe(e){if(e.fd===-1){e.once("ready",Oe.bind(null,e));return}e._periodicFlushTimer!==void 0&&clearInterval(e._periodicFlushTimer),e.destroyed=!0,e._bufs=[],e._lens=[],vo(typeof e.fd=="number",`sonic.fd must be a number, got ${typeof e.fd}`);try{A.fsync(e.fd,t)}catch{}function t(){e.fd!==1&&e.fd!==2?A.close(e.fd,r):r()}function r(n){if(n){e.emit("error",n);return}e._ending&&!e._writing&&e.emit("finish"),e.emit("close")}}U.SonicBoom=U;U.default=U;En.exports=U});var ut=R((yu,On)=>{"use strict";var $={exit:[],beforeExit:[]},Sn={exit:Yo,beforeExit:Jo},Z;function zo(){Z===void 0&&(Z=new FinalizationRegistry(Qo))}function Xo(e){$[e].length>0||process.on(e,Sn[e])}function bn(e){$[e].length>0||(process.removeListener(e,Sn[e]),$.exit.length===0&&$.beforeExit.length===0&&(Z=void 0))}function Yo(){wn("exit")}function Jo(){wn("beforeExit")}function wn(e){for(let t of $[e]){let r=t.deref(),n=t.fn;r!==void 0&&n(r,e)}$[e]=[]}function Qo(e){for(let t of["exit","beforeExit"]){let r=$[t].indexOf(e);$[t].splice(r,r+1),bn(t)}}function Rn(e,t,r){if(t===void 0)throw new Error("the object can't be undefined");Xo(e);let n=new WeakRef(t);n.fn=r,zo(),Z.register(t,n),$[e].push(n)}function Zo(e,t){Rn("exit",e,t)}function el(e,t){Rn("beforeExit",e,t)}function tl(e){if(Z!==void 0){Z.unregister(e);for(let t of["exit","beforeExit"])$[t]=$[t].filter(r=>{let n=r.deref();return n&&n!==e}),bn(t)}}On.exports={register:Zo,registerBeforeExit:el,unregister:tl}});var Tn=R((Eu,rl)=>{rl.exports={name:"thread-stream",version:"4.2.0",description:"A streaming way to send data to a Node.js Worker Thread",main:"index.js",types:"index.d.ts",engines:{node:">=20"},dependencies:{"real-require":"^1.0.0"},devDependencies:{"@types/node":"^25.0.2","@yao-pkg/pkg":"^6.0.0",borp:"^1.0.0",desm:"^1.3.0",eslint:"^9.39.1",fastbench:"^1.0.1",neostandard:"^0.13.0","pino-elasticsearch":"^9.0.0","sonic-boom":"^5.0.0","ts-node":"^10.8.0",typescript:"~5.7.3"},scripts:{build:"tsc --noEmit",lint:"eslint",test:'npm run lint && npm run build && npm run transpile && borp --pattern "test/*.test.{js,mjs}"',"test:ci":'npm run lint && npm run transpile && borp --pattern "test/*.test.{js,mjs}"',"test:yarn":'npm run transpile && borp --pattern "test/*.test.js"',transpile:"sh ./test/ts/transpile.sh"},repository:{type:"git",url:"git+https://github.com/mcollina/thread-stream.git"},keywords:["worker","thread","threads","stream"],author:"Matteo Collina <hello@matteocollina.com>",license:"MIT",bugs:{url:"https://github.com/mcollina/thread-stream/issues"},homepage:"https://github.com/mcollina/thread-stream#readme"}});var xn=R((_u,An)=>{"use strict";function nl(e,t,r,n,i){let s=n===1/0?1/0:Date.now()+n,f=()=>{let o=Atomics.load(e,t);if(o===r){i(null,"ok");return}if(s!==1/0&&Date.now()>s){i(null,"timed-out");return}let l=s===1/0?1e4:Math.min(1e4,Math.max(1,s-Date.now())),u=Atomics.waitAsync(e,t,o,l);u.async?u.value.then(f):setImmediate(f)};f()}function il(e,t,r,n,i){let s=n===1/0?1/0:Date.now()+n,f=()=>{if(Atomics.load(e,t)!==r){i(null,"ok");return}if(s!==1/0&&Date.now()>s){i(null,"timed-out");return}let l=s===1/0?1e4:Math.min(1e4,Math.max(1,s-Date.now())),u=Atomics.waitAsync(e,t,r,l);u.async?u.value.then(h=>{if(h==="ok"){i(null,"ok");return}f()}):setImmediate(f)};f()}An.exports={wait:nl,waitDiff:il}});var In=R((Su,Ln)=>{"use strict";Ln.exports={WRITE_INDEX:4,READ_INDEX:8,SEQ_INDEX:2}});var jn=R((bu,Fn)=>{"use strict";var{version:sl}=Tn(),{EventEmitter:ol}=I("events"),{Worker:ll}=I("worker_threads"),{join:cl}=I("path"),{pathToFileURL:fl}=I("url"),{wait:al}=xn(),{WRITE_INDEX:q,READ_INDEX:K,SEQ_INDEX:dt}=In(),ul=I("buffer"),dl=I("assert"),a=Symbol("kImpl"),hl=ul.constants.MAX_STRING_LENGTH;function Nn(){}function gt(e,t){Atomics.add(e[a].state,dt,1),t(),Atomics.add(e[a].state,dt,1),Atomics.notify(e[a].state,dt)}function Pn(e){gt(e,()=>{Atomics.store(e[a].state,K,0),Atomics.store(e[a].state,q,0)})}var ae=class{constructor(t){this._value=t}deref(){return this._value}},Te=class{register(){}unregister(){}},pl=process.env.NODE_V8_COVERAGE?Te:global.FinalizationRegistry||Te,ml=process.env.NODE_V8_COVERAGE?ae:global.WeakRef||ae,Mn=new pl(e=>{e.exited||e.terminate()});function gl(e,t){let{filename:r,workerData:n}=t,s=("__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||cl(__dirname,"lib","worker.js"),f=new ll(s,{...t.workerOpts,name:t.workerOpts?.name||"thread-stream",trackUnmanagedFds:!1,workerData:{filename:r.indexOf("file://")===0?r:fl(r).href,dataBuf:e[a].dataBuf,stateBuf:e[a].stateBuf,workerData:{$context:{threadStreamVersion:sl},...n}}});return f.stream=new ae(e),f.on("message",yl),f.on("exit",kn),Mn.register(e,f),f}function Dn(e){dl(!e[a].sync),e[a].needDrain&&(e[a].needDrain=!1,e.emit("drain"))}function vn(e){for(;;){let t=Atomics.load(e[a].state,q),r=e[a].data.length-t;if(r>0){if(e[a].bufLen===0){e[a].flushing=!1,e[a].ending?yt(e):e[a].needDrain&&process.nextTick(Dn,e);return}Un(e,r,Nn);continue}if(r===0){if(t===0&&e[a].bufLen===0)return;Ae(e,()=>{e.destroyed||(Pn(e),vn(e))});return}C(e,new Error("overwritten"));return}}function yl(e){let t=this.stream.deref();if(t===void 0){this.exited=!0,this.terminate();return}if(e?.code!=null)switch(e.code){case"READY":this.stream=new ml(t),Ae(t,()=>{t[a].ready=!0,t.emit("ready")});break;case"ERROR":C(t,e.err);break;case"EVENT":Array.isArray(e.args)?t.emit(e.name,...e.args):t.emit(e.name,e.args);break;case"FLUSHED":{if(e.context!=="thread-stream"){C(t,new Error("this should not happen: "+e.code));break}let r=t[a].flushCallbacks.get(e.id);r&&(t[a].flushCallbacks.delete(e.id),process.nextTick(r));break}case"WARNING":process.emitWarning(e.err);break;default:C(t,new Error("this should not happen: "+e.code))}}function kn(e){let t=this.stream.deref();t!==void 0&&(Mn.unregister(t),t.worker.exited=!0,t.worker.off("exit",kn),C(t,e!==0?new Error("the worker thread exited"):null))}var pt=class extends ol{constructor(t={}){if(super(),t.bufferSize<4)throw new Error("bufferSize must at least fit a 4-byte utf-8 char");this[a]={},this[a].stateBuf=new SharedArrayBuffer(128),this[a].state=new Int32Array(this[a].stateBuf),this[a].dataBuf=new SharedArrayBuffer(t.bufferSize||4*1024*1024),this[a].data=Buffer.from(this[a].dataBuf),this[a].sync=t.sync||!1,this[a].ending=!1,this[a].ended=!1,this[a].needDrain=!1,this[a].destroyed=!1,this[a].flushing=!1,this[a].ready=!1,this[a].finished=!1,this[a].errored=null,this[a].closed=!1,this[a].buf=[],this[a].bufHead=0,this[a].bufLen=0,this[a].flushCallbacks=new Map,this[a].nextFlushId=0,this.worker=gl(this,t),this.on("message",(r,n)=>{this.worker.postMessage(r,n)})}write(t){let r=Buffer.isBuffer(t)?t:Buffer.from(t);if(this[a].destroyed)return mt(this,new Error("the worker has exited")),!1;if(this[a].ending)return mt(this,new Error("the worker is ending")),!1;if(this[a].flushing&&this[a].bufLen+r.length>=hl)try{ht(this),this[a].flushing=!0}catch(n){return C(this,n),!1}if(this[a].buf.push(r),this[a].bufLen+=r.length,this[a].sync)try{return ht(this),!0}catch(n){return C(this,n),!1}return this[a].flushing||(this[a].flushing=!0,setImmediate(vn,this)),this[a].needDrain=this[a].data.length-this[a].bufLen-Atomics.load(this[a].state,q)<=0,!this[a].needDrain}end(){this[a].destroyed||(this[a].ending=!0,yt(this))}flush(t){t=typeof t=="function"?t:Nn,Cn(this,r=>{if(r){process.nextTick(t,r);return}Bn(this,t)})}flushSync(){this[a].destroyed||(ht(this),$n(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[a].ready}get destroyed(){return this[a].destroyed}get closed(){return this[a].closed}get writable(){return!this[a].destroyed&&!this[a].ending}get writableEnded(){return this[a].ending}get writableFinished(){return this[a].finished}get writableNeedDrain(){return this[a].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[a].errored}};function Cn(e,t){if(e[a].destroyed){process.nextTick(t,new Error("the worker has exited"));return}if(!e[a].sync&&(e[a].flushing||e[a].bufLen>0)){setImmediate(Cn,e,t);return}Ae(e,t)}function Ae(e,t){let r=Atomics.load(e[a].state,q);al(e[a].state,K,r,1/0,(n,i)=>{if(n){C(e,n),t(n);return}if(i!=="ok"){Ae(e,t);return}t()})}function Bn(e,t){if(e[a].destroyed){process.nextTick(t,new Error("the worker has exited"));return}if(!e[a].ready){let n=()=>{s(),Bn(e,t)},i=()=>{s(),process.nextTick(t,new Error("the worker has exited"))},s=()=>{e.off("ready",n),e.off("close",i)};e.once("ready",n),e.once("close",i);return}let r=++e[a].nextFlushId;e[a].flushCallbacks.set(r,t);try{e.worker.postMessage({code:"FLUSH",context:"thread-stream",id:r})}catch(n){e[a].flushCallbacks.delete(r),C(e,n),process.nextTick(t,n)}}function El(e,t){let r=e[a].flushCallbacks;if(r.size===0)return;let n=t||new Error("the worker has exited");for(let i of r.values())process.nextTick(i,n);r.clear()}function mt(e,t){setImmediate(()=>{e.emit("error",t)})}function C(e,t){e[a].destroyed||(e[a].destroyed=!0,El(e,t),t&&(e[a].errored=t,mt(e,t)),e.worker.exited?setImmediate(()=>{e[a].closed=!0,e.emit("close")}):e.worker.terminate().catch(()=>{}).then(()=>{e[a].closed=!0,e.emit("close")}))}function Un(e,t,r){let i=Atomics.load(e[a].state,q),s=t;for(;s>0&&e[a].bufLen!==0;){let f=e[a].bufHead,o=e[a].buf[f];if(o.length<=s){o.copy(e[a].data,i),i+=o.length,s-=o.length,e[a].bufLen-=o.length,e[a].bufHead=f+1,e[a].bufHead===e[a].buf.length?(e[a].buf.length=0,e[a].bufHead=0):e[a].bufHead>=1024&&e[a].bufHead*2>=e[a].buf.length&&(e[a].buf.splice(0,e[a].bufHead),e[a].bufHead=0);continue}o.copy(e[a].data,i,0,s),e[a].buf[f]=o.subarray(s),e[a].bufLen-=s,i+=s,s=0}return gt(e,()=>{Atomics.store(e[a].state,q,i)}),r(),!0}function yt(e){if(!(e[a].ended||!e[a].ending||e[a].flushing)){e[a].ended=!0;try{e.flushSync();let t=Atomics.load(e[a].state,K);gt(e,()=>{Atomics.store(e[a].state,q,-1)});let r=0;for(;t!==-1;){if(Atomics.wait(e[a].state,K,t,1e3),t=Atomics.load(e[a].state,K),t===-2){C(e,new Error("end() failed"));return}if(++r===10){C(e,new Error("end() took too long (10s)"));return}}process.nextTick(()=>{e[a].finished=!0,e.emit("finish")})}catch(t){C(e,t)}}}function ht(e){let t=()=>{e[a].ending?yt(e):e[a].needDrain&&process.nextTick(Dn,e)};for(e[a].flushing=!1;e[a].bufLen!==0;){let r=Atomics.load(e[a].state,q),n=e[a].data.length-r;if(n===0){$n(e),Pn(e);continue}else if(n<0)throw new Error("overwritten");Un(e,n,t)}}function $n(e){if(e[a].flushing)throw new Error("unable to flush while flushing");let t=Atomics.load(e[a].state,q),r=0;for(;;){let n=Atomics.load(e[a].state,K);if(n===-2)throw Error("_flushSync failed");if(n!==t)Atomics.wait(e[a].state,K,n,1e3);else break;if(++r===10)throw new Error("_flushSync took too long (10s)")}}Fn.exports=pt});var St=R((wu,Vn)=>{"use strict";var{createRequire:_l}=I("module"),{existsSync:Sl}=I("fs"),bl=nt(),{join:Et,isAbsolute:Wn,sep:wl}=I("path"),{fileURLToPath:Rl}=I("url"),Ol=ct(),_t=ut(),Tl=jn(),{transportUsesMultistreamSym:Al}=H();function xl(e){_t.register(e,Ml),_t.registerBeforeExit(e,Dl),e.on("close",function(){_t.unregister(e)})}function Ll(){let e=process.execArgv;for(let t=0;t<e.length;t++){let r=e[t];if(r==="--import"||r==="--require"||r==="-r"||r.startsWith("--import=")||r.startsWith("--require=")||r.startsWith("-r="))return!0}return!1}function Il(e){let t=e.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);if(!t)return e;let r=[],n=!1;for(let i=0;i<t.length;i++){let s=t[i];if(s==="--require"||s==="-r"||s==="--import"){let f=t[i+1];if(f&&qn(f)){n=!0,i++;continue}r.push(s),f&&(r.push(f),i++);continue}if(s.startsWith("--require=")||s.startsWith("-r=")||s.startsWith("--import=")){let f=s.slice(s.indexOf("=")+1);if(qn(f)){n=!0;continue}}r.push(s)}return n?r.join(" "):e}function qn(e){let t=Nl(e);if(!t)return!1;let r=t;if(r.startsWith("file://"))try{r=Rl(r)}catch{return!1}return Wn(r)&&!Sl(r)}function Nl(e){let t=e[0],r=e[e.length-1];return t==='"'&&r==='"'||t==="'"&&r==="'"?e.slice(1,-1):e}function Pl(e,t,r,n,i){if(!r.execArgv&&Ll()&&I.main===void 0&&(r={...r,execArgv:[]}),!r.env&&process.env.NODE_OPTIONS){let l=Il(process.env.NODE_OPTIONS);l!==process.env.NODE_OPTIONS&&(r={...r,env:{...process.env,NODE_OPTIONS:l}})}r={...r,name:i};let s=new Tl({filename:e,workerData:t,workerOpts:r,sync:n});s.on("ready",f),s.on("close",function(){process.removeListener("exit",o)}),process.on("exit",o);function f(){process.removeListener("exit",o),s.unref(),r.autoEnd!==!1&&xl(s)}function o(){s.closed||(s.flushSync(),Ol(100),s.end())}return s}function Ml(e){e.ref(),e.flushSync(),e.end(),e.once("close",function(){e.unref()})}function Dl(e){e.flushSync()}function vl(e){let{pipeline:t,targets:r,levels:n,dedupe:i,worker:s={},caller:f=bl(),sync:o=!1}=e,l={...e.options},u=!1,h=typeof f=="string"?[f]:f,d=typeof globalThis=="object"&&Object.prototype.hasOwnProperty.call(globalThis,"__bundlerPathsOverrides")&&globalThis.__bundlerPathsOverrides&&typeof globalThis.__bundlerPathsOverrides=="object"?globalThis.__bundlerPathsOverrides:Object.create(null),g=e.target;if(g&&r)throw new Error("only one of target or targets can be specified");if(r){g=d["pino-worker"]||Et(__dirname,"worker.js"),l.targets=r.filter(E=>E.target).map(E=>({...E,target:y(E.target)})),l.pipelines=r.filter(E=>E.pipeline).map(E=>E.pipeline.map(_=>({..._,level:E.level,target:y(_.target)})));let m=l.targets.some(E=>E.level!=null),S=l.pipelines.some(E=>E.some(_=>_.level!=null));u=l.targets.length+l.pipelines.length>1||m||S}else t&&(g=d["pino-worker"]||Et(__dirname,"worker.js"),l.pipelines=[t.map(m=>({...m,target:y(m.target)}))]);n&&(l.levels=n),i&&(l.dedupe=i),l.pinoWillSendConfig=!0;let p=r||t?"pino.transport":g,c=Pl(y(g),l,s,o,p);return u&&(c[Al]=!0),c;function y(m){if(m=d[m]||m,Wn(m)||m.indexOf("file://")===0)return m;if(m==="pino/file")return Et(__dirname,"..","file.js");let S;for(let E of h)try{let _=E==="node:repl"?process.cwd()+wl:E;S=_l(_).resolve(m);break}catch{continue}if(!S)throw new Error(`unable to determine transport target for "${m}"`);return S}}Vn.exports=vl});var Ne=R((Ou,ni)=>{"use strict";var kl=I("diagnostics_channel"),Gn=un(),{mapHttpRequest:Cl,mapHttpResponse:Bl}=rt(),bt=_n(),Hn=ut(),{lsCacheSym:Ul,chindingsSym:Jn,writeSym:Kn,serializersSym:Qn,formatOptsSym:zn,endSym:$l,stringifiersSym:Zn,stringifySym:ei,stringifySafeSym:wt,wildcardFirstSym:ti,nestedKeySym:Fl,formattersSym:ri,messageKeySym:jl,errorKeySym:ql,nestedKeyStrSym:Wl,msgPrefixSym:xe}=H(),{isMainThread:Vl}=I("worker_threads"),Gl=St(),[Hl]=process.versions.node.split(".").map(e=>Number(e)),Xn=kl.tracingChannel("pino_asJson"),Le=Hl>=25?e=>JSON.stringify(e):zl;function ee(){}function Kl(e,t){if(!t)return r;return function(...i){t.call(this,i,r,e)};function r(n,...i){if(typeof n=="object"){let s=n;n!==null&&(n.method&&n.headers&&n.socket?n=Cl(n):typeof n.setHeader=="function"&&(n=Bl(n)));let f;s===null&&i.length===0?f=[null]:(s=i.shift(),f=i),typeof this[xe]=="string"&&s!==void 0&&s!==null&&(s=this[xe]+s),this[Kn](n,Gn(s,f,this[zn]),e)}else{let s=n===void 0?i.shift():n;typeof this[xe]=="string"&&s!==void 0&&s!==null&&(s=this[xe]+s),this[Kn](null,Gn(s,i,this[zn]),e)}}}function zl(e){let t="",r=0,n=!1,i=255,s=e.length;if(s>100)return JSON.stringify(e);for(var f=0;f<s&&i>=32;f++)i=e.charCodeAt(f),(i===34||i===92)&&(t+=e.slice(r,f)+"\\",r=f,n=!0);return n?t+=e.slice(r):t=e,i<32?JSON.stringify(e):'"'+t+'"'}function Xl(e,t,r,n){if(Xn.hasSubscribers===!1)return Yn.call(this,e,t,r,n);let i={instance:this,arguments};return Xn.traceSync(Yn,i,this,e,t,r,n)}function Yn(e,t,r,n){let i=this[ei],s=this[wt],f=this[Zn],o=this[$l],l=this[Jn],u=this[Qn],h=this[ri],d=this[jl],g=this[ql],p=this[Ul][r]+n;p=p+l;let c;h.log&&(e=h.log(e));let y=f[ti],m="";for(let E in e)if(c=e[E],Object.prototype.hasOwnProperty.call(e,E)&&c!==void 0){u[E]?c=u[E](c):E===g&&u.err&&(c=u.err(c));let _=f[E]||y;switch(typeof c){case"undefined":case"function":continue;case"number":Number.isFinite(c)===!1&&(c=null);case"boolean":_&&(c=_(c));break;case"string":c=(_||Le)(c);break;default:c=(_||i)(c,s)}if(c===void 0)continue;let b=Le(E);m+=","+b+":"+c}let S="";if(t!==void 0){c=u[d]?u[d](t):t;let E=f[d]||y;switch(typeof c){case"function":break;case"number":Number.isFinite(c)===!1&&(c=null);case"boolean":E&&(c=E(c)),S=',"'+d+'":'+c;break;case"string":c=(E||Le)(c),S=',"'+d+'":'+c;break;default:c=(E||i)(c,s),S=',"'+d+'":'+c}}return this[Fl]&&m?p+this[Wl]+m.slice(1)+"}"+S+o:p+m+S+o}function Yl(e,t){let r,n=e[Jn],i=e[ei],s=e[wt],f=e[Zn],o=f[ti],l=e[Qn],u=e[ri].bindings;t=u(t);for(let h in t)if(r=t[h],((h.length<5||h!=="level"&&h!=="serializers"&&h!=="formatters"&&h!=="customLevels")&&t.hasOwnProperty(h)&&r!==void 0)===!0){if(r=l[h]?l[h](r):r,r=(f[h]||o||i)(r,s),r===void 0)continue;n+=","+Le(h)+":"+r}return n}function Jl(e){return e.write!==e.constructor.prototype.write}function Ie(e){let t=new bt(e);return t.on("error",r),!e.sync&&Vl&&(Hn.register(t,Ql),t.on("close",function(){Hn.unregister(t)})),t;function r(n){if(n.code==="EPIPE"){t.write=ee,t.end=ee,t.flushSync=ee,t.destroy=ee;return}t.removeListener("error",r),t.emit("error",n)}}function Ql(e,t){e.destroyed||(t==="beforeExit"?(e.flush(),e.on("drain",function(){e.end()})):e.flushSync())}function Zl(e){return function(r,n,i={},s){if(typeof i=="string")s=Ie({dest:i}),i={};else if(typeof s=="string"){if(i&&i.transport)throw Error("only one of option.transport or stream can be specified");s=Ie({dest:s})}else if(i instanceof bt||i.writable||i._writableState)s=i,i={};else if(i.transport){if(i.transport instanceof bt||i.transport.writable||i.transport._writableState)throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)");if(i.transport.targets&&i.transport.targets.length&&i.formatters&&typeof i.formatters.level=="function")throw Error("option.transport.targets do not allow custom level formatters");let l;i.customLevels&&(l=i.useOnlyCustomLevels?i.customLevels:Object.assign({},i.levels,i.customLevels)),s=Gl({caller:n,...i.transport,levels:l})}if(i=Object.assign({},e,i),i.serializers=Object.assign(Object.create(null),e.serializers,i.serializers),i.formatters=Object.assign({},e.formatters,i.formatters),i.prettyPrint)throw new Error("prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)");let{enabled:f,onChild:o}=i;return f===!1&&(i.level="silent"),o||(i.onChild=ee),s||(Jl(process.stdout)?s=process.stdout:s=Ie({fd:process.stdout.fd||1})),{opts:i,stream:s}}}function ec(e,t){try{return JSON.stringify(e)}catch{try{return(t||this[wt])(e)}catch{return'"[unable to serialize, circular reference is too complex to analyze]"'}}}function tc(e,t,r){return{level:e,bindings:t,log:r}}function rc(e){let t=Number(e);return typeof e=="string"&&Number.isFinite(t)?t:e===void 0?1:e}ni.exports={noop:ee,buildSafeSonicBoom:Ie,asChindings:Yl,asJson:Xl,genLog:Kl,createArgsNormalizer:Zl,stringify:ec,buildFormatters:tc,normalizeDestFileDescriptor:rc}});var Pe=R((Tu,ii)=>{"use strict";var nc={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},ic={ASC:"ASC",DESC:"DESC"};ii.exports={DEFAULT_LEVELS:nc,SORTING_ORDER:ic}});var Tt=R((Au,ci)=>{"use strict";var{lsCacheSym:sc,levelValSym:Rt,useOnlyCustomLevelsSym:oc,streamSym:lc,formattersSym:cc,hooksSym:fc,levelCompSym:si}=H(),{noop:ac,genLog:z}=Ne(),{DEFAULT_LEVELS:j,SORTING_ORDER:oi}=Pe(),li={fatal:e=>{let t=z(j.fatal,e);return function(...r){let n=this[lc];if(t.call(this,...r),typeof n.flushSync=="function")try{n.flushSync()}catch{}}},error:e=>z(j.error,e),warn:e=>z(j.warn,e),info:e=>z(j.info,e),debug:e=>z(j.debug,e),trace:e=>z(j.trace,e)},Ot=Object.keys(j).reduce((e,t)=>(e[j[t]]=t,e),{}),uc=Object.keys(Ot).reduce((e,t)=>(e[t]='{"level":'+Number(t),e),{});function dc(e){let t=e[cc].level,{labels:r}=e.levels,n={};for(let i in r){let s=t(r[i],Number(i));n[i]=JSON.stringify(s).slice(0,-1)}return e[sc]=n,e}function hc(e,t){if(t)return!1;switch(e){case"fatal":case"error":case"warn":case"info":case"debug":case"trace":return!0;default:return!1}}function pc(e){let{labels:t,values:r}=this.levels;if(typeof e=="number"){if(t[e]===void 0)throw Error("unknown level value"+e);e=t[e]}if(r[e]===void 0)throw Error("unknown level "+e);let n=this[Rt],i=this[Rt]=r[e],s=this[oc],f=this[si],o=this[fc].logMethod;for(let l in r){if(f(r[l],i)===!1){this[l]=ac;continue}this[l]=hc(l,s)?li[l](o):z(r[l],o)}this.emit("level-change",e,i,t[n],n,this)}function mc(e){let{levels:t,levelVal:r}=this;return t&&t.labels?t.labels[r]:""}function gc(e){let{values:t}=this.levels,r=t[e];return r!==void 0&&this[si](r,this[Rt])}function yc(e,t,r){return e===oi.DESC?t<=r:t>=r}function Ec(e){return typeof e=="string"?yc.bind(null,e):e}function _c(e=null,t=!1){let r=e?Object.keys(e).reduce((s,f)=>(s[e[f]]=f,s),{}):null,n=Object.assign(Object.create(Object.prototype,{Infinity:{value:"silent"}}),t?null:Ot,r),i=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),t?null:j,e);return{labels:n,values:i}}function Sc(e,t,r){if(typeof e=="number"){if(![].concat(Object.keys(t||{}).map(s=>t[s]),r?[]:Object.keys(Ot).map(s=>+s),1/0).includes(e))throw Error(`default level:${e} must be included in custom levels`);return}let n=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),r?null:j,t);if(!(e in n))throw Error(`default level:${e} must be included in custom levels`)}function bc(e,t){let{labels:r,values:n}=e;for(let i in t){if(i in n)throw Error("levels cannot be overridden");if(t[i]in r)throw Error("pre-existing level values cannot be used for new levels")}}function wc(e){if(typeof e!="function"&&!(typeof e=="string"&&Object.values(oi).includes(e)))throw new Error('Levels comparison should be one of "ASC", "DESC" or "function" type')}ci.exports={initialLsCache:uc,genLsCache:dc,levelMethods:li,getLevel:mc,setLevel:pc,isLevelEnabled:gc,mappings:_c,assertNoLevelCollisions:bc,assertDefaultLevelFound:Sc,genLevelComparison:Ec,assertLevelComparison:wc}});var At=R((xu,fi)=>{"use strict";fi.exports={version:"10.4.0"}});var yi=R((Iu,gi)=>{"use strict";var{EventEmitter:Rc}=I("events"),{lsCacheSym:Oc,levelValSym:Tc,setLevelSym:Lt,getLevelSym:ai,chindingsSym:De,mixinSym:Ac,asJsonSym:di,writeSym:xc,mixinMergeStrategySym:Lc,timeSym:Ic,timeSliceIndexSym:Nc,streamSym:hi,serializersSym:X,formattersSym:ue,errorKeySym:Pc,messageKeySym:Mc,useOnlyCustomLevelsSym:Dc,needsMetadataGsym:vc,redactFmtSym:kc,stringifySym:Cc,formatOptsSym:Bc,stringifiersSym:Uc,msgPrefixSym:It,hooksSym:$c}=H(),{getLevel:Fc,setLevel:jc,isLevelEnabled:qc,mappings:Wc,initialLsCache:Vc,genLsCache:Gc,assertNoLevelCollisions:Hc}=Tt(),{asChindings:Nt,asJson:Kc,buildFormatters:xt,stringify:ui,noop:pi}=Ne(),{version:zc}=At(),Xc=ot(),Yc=class{},mi={constructor:Yc,child:Jc,bindings:Qc,setBindings:Zc,flush:rf,isLevelEnabled:qc,version:zc,get level(){return this[ai]()},set level(e){this[Lt](e)},get levelVal(){return this[Tc]},set levelVal(e){throw Error("levelVal is read-only")},get msgPrefix(){return this[It]},get[Symbol.toStringTag](){return"Pino"},[Oc]:Vc,[xc]:tf,[di]:Kc,[ai]:Fc,[Lt]:jc};Object.setPrototypeOf(mi,Rc.prototype);gi.exports=function(){return Object.create(mi)};var Me=e=>e;function Jc(e,t){if(!e)throw Error("missing bindings for child Pino");let r=this[X],n=this[ue],i=Object.create(this);if(t==null)return i[ue].bindings!==Me&&(i[ue]=xt(n.level,Me,n.log)),i[De]=Nt(i,e),this.onChild!==pi&&this.onChild(i),i;if(t.hasOwnProperty("serializers")===!0){i[X]=Object.create(null);for(let u in r)i[X][u]=r[u];let o=Object.getOwnPropertySymbols(r);for(var s=0;s<o.length;s++){let u=o[s];i[X][u]=r[u]}for(let u in t.serializers)i[X][u]=t.serializers[u];let l=Object.getOwnPropertySymbols(t.serializers);for(var f=0;f<l.length;f++){let u=l[f];i[X][u]=t.serializers[u]}}else i[X]=r;if(t.hasOwnProperty("formatters")){let{level:o,bindings:l,log:u}=t.formatters;i[ue]=xt(o||n.level,l||Me,u||n.log)}else i[ue]=xt(n.level,Me,n.log);if(t.hasOwnProperty("customLevels")===!0&&(Hc(this.levels,t.customLevels),i.levels=Wc(t.customLevels,i[Dc]),Gc(i)),typeof t.redact=="object"&&t.redact!==null||Array.isArray(t.redact)){i.redact=t.redact;let o=Xc(i.redact,ui),l={stringify:o[kc]};i[Cc]=ui,i[Uc]=o,i[Bc]=l}if(typeof t.msgPrefix=="string"&&(i[It]=(this[It]||"")+t.msgPrefix),i[De]=Nt(i,e),t.level!==void 0&&t.level!==this.level||t.hasOwnProperty("customLevels")){let o=t.level||this.level;i[Lt](o)}return this.onChild(i),i}function Qc(){let t=`{${this[De].substr(1)}}`,r=JSON.parse(t);return delete r.pid,delete r.hostname,r}function Zc(e){let t=Nt(this,e);this[De]=t}function ef(e,t){return Object.assign(t,e)}function tf(e,t,r){let n=this[Ic](),i=this[Ac],s=this[Pc],f=this[Mc],o=this[Lc]||ef,l,u=this[$c].streamWrite;e==null?l={}:e instanceof Error?(l={[s]:e},t===void 0&&(t=e.message)):(l=e,t===void 0&&e[f]===void 0&&e[s]&&(t=e[s].message)),i&&(l=o(l,i(l,r,this)));let h=this[di](l,t,r,n),d=this[hi];d[vc]===!0&&(d.lastLevel=r,d.lastObj=l,d.lastMsg=t,d.lastTime=n.slice(this[Nc]),d.lastLogger=this),d.write(u?u(h):h)}function rf(e){if(e!=null&&typeof e!="function")throw Error("callback must be a function");let t=this[hi];typeof t.flush=="function"?t.flush(e||pi):e&&e()}});var bi=R((vt,Si)=>{"use strict";var{hasOwnProperty:de}=Object.prototype,J=Dt();J.configure=Dt;J.stringify=J;J.default=J;vt.stringify=J;vt.configure=Dt;Si.exports=J;var nf=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function W(e){return e.length<5e3&&!nf.test(e)?`"${e}"`:JSON.stringify(e)}function Pt(e,t){if(e.length>200||t)return e.sort(t);for(let r=1;r<e.length;r++){let n=e[r],i=r;for(;i!==0&&e[i-1]>n;)e[i]=e[i-1],i--;e[i]=n}return e}var sf=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function Mt(e){return sf.call(e)!==void 0&&e.length!==0}function Ei(e,t,r){e.length<r&&(r=e.length);let n=t===","?"":" ",i=`"0":${n}${e[0]}`;for(let s=1;s<r;s++)i+=`${t}"${s}":${n}${e[s]}`;return i}function of(e){if(de.call(e,"circularValue")){let t=e.circularValue;if(typeof t=="string")return`"${t}"`;if(t==null)return t;if(t===Error||t===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function lf(e){let t;if(de.call(e,"deterministic")&&(t=e.deterministic,typeof t!="boolean"&&typeof t!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return t===void 0?!0:t}function cf(e,t){let r;if(de.call(e,t)&&(r=e[t],typeof r!="boolean"))throw new TypeError(`The "${t}" argument must be of type boolean`);return r===void 0?!0:r}function _i(e,t){let r;if(de.call(e,t)){if(r=e[t],typeof r!="number")throw new TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(r))throw new TypeError(`The "${t}" argument must be an integer`);if(r<1)throw new RangeError(`The "${t}" argument must be >= 1`)}return r===void 0?1/0:r}function Y(e){return e===1?"1 item":`${e} items`}function ff(e){let t=new Set;for(let r of e)(typeof r=="string"||typeof r=="number")&&t.add(String(r));return t}function af(e){if(de.call(e,"strict")){let t=e.strict;if(typeof t!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(t)return r=>{let n=`Object can not safely be stringified. Received type ${typeof r}`;throw typeof r!="function"&&(n+=` (${r.toString()})`),new Error(n)}}}function Dt(e){e={...e};let t=af(e);t&&(e.bigint===void 0&&(e.bigint=!1),"circularValue"in e||(e.circularValue=Error));let r=of(e),n=cf(e,"bigint"),i=lf(e),s=typeof i=="function"?i:void 0,f=_i(e,"maximumDepth"),o=_i(e,"maximumBreadth");function l(p,c,y,m,S,E){let _=c[p];switch(typeof _=="object"&&_!==null&&typeof _.toJSON=="function"&&(_=_.toJSON(p)),_=m.call(c,p,_),typeof _){case"string":return W(_);case"object":{if(_===null)return"null";if(y.indexOf(_)!==-1)return r;let b="",T=",",L=E;if(Array.isArray(_)){if(_.length===0)return"[]";if(f<y.length+1)return'"[Array]"';y.push(_),S!==""&&(E+=S,b+=`
|
|
7
|
+
${E}`,T=`,
|
|
8
|
+
${E}`);let M=Math.min(_.length,o),v=0;for(;v<M-1;v++){let G=l(String(v),_,y,m,S,E);b+=G!==void 0?G:"null",b+=T}let k=l(String(v),_,y,m,S,E);if(b+=k!==void 0?k:"null",_.length-1>o){let G=_.length-o-1;b+=`${T}"... ${Y(G)} not stringified"`}return S!==""&&(b+=`
|
|
9
|
+
${L}`),y.pop(),`[${b}]`}let O=Object.keys(_),x=O.length;if(x===0)return"{}";if(f<y.length+1)return'"[Object]"';let w="",P="";S!==""&&(E+=S,T=`,
|
|
10
|
+
${E}`,w=" ");let D=Math.min(x,o);i&&!Mt(_)&&(O=Pt(O,s)),y.push(_);for(let M=0;M<D;M++){let v=O[M],k=l(v,_,y,m,S,E);k!==void 0&&(b+=`${P}${W(v)}:${w}${k}`,P=T)}if(x>o){let M=x-o;b+=`${P}"...":${w}"${Y(M)} not stringified"`,P=T}return S!==""&&P.length>1&&(b=`
|
|
11
|
+
${E}${b}
|
|
12
|
+
${L}`),y.pop(),`{${b}}`}case"number":return isFinite(_)?String(_):t?t(_):"null";case"boolean":return _===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(_);default:return t?t(_):void 0}}function u(p,c,y,m,S,E){switch(typeof c=="object"&&c!==null&&typeof c.toJSON=="function"&&(c=c.toJSON(p)),typeof c){case"string":return W(c);case"object":{if(c===null)return"null";if(y.indexOf(c)!==-1)return r;let _=E,b="",T=",";if(Array.isArray(c)){if(c.length===0)return"[]";if(f<y.length+1)return'"[Array]"';y.push(c),S!==""&&(E+=S,b+=`
|
|
13
|
+
${E}`,T=`,
|
|
14
|
+
${E}`);let x=Math.min(c.length,o),w=0;for(;w<x-1;w++){let D=u(String(w),c[w],y,m,S,E);b+=D!==void 0?D:"null",b+=T}let P=u(String(w),c[w],y,m,S,E);if(b+=P!==void 0?P:"null",c.length-1>o){let D=c.length-o-1;b+=`${T}"... ${Y(D)} not stringified"`}return S!==""&&(b+=`
|
|
15
|
+
${_}`),y.pop(),`[${b}]`}y.push(c);let L="";S!==""&&(E+=S,T=`,
|
|
16
|
+
${E}`,L=" ");let O="";for(let x of m){let w=u(x,c[x],y,m,S,E);w!==void 0&&(b+=`${O}${W(x)}:${L}${w}`,O=T)}return S!==""&&O.length>1&&(b=`
|
|
17
|
+
${E}${b}
|
|
18
|
+
${_}`),y.pop(),`{${b}}`}case"number":return isFinite(c)?String(c):t?t(c):"null";case"boolean":return c===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(c);default:return t?t(c):void 0}}function h(p,c,y,m,S){switch(typeof c){case"string":return W(c);case"object":{if(c===null)return"null";if(typeof c.toJSON=="function"){if(c=c.toJSON(p),typeof c!="object")return h(p,c,y,m,S);if(c===null)return"null"}if(y.indexOf(c)!==-1)return r;let E=S;if(Array.isArray(c)){if(c.length===0)return"[]";if(f<y.length+1)return'"[Array]"';y.push(c),S+=m;let w=`
|
|
19
|
+
${S}`,P=`,
|
|
20
|
+
${S}`,D=Math.min(c.length,o),M=0;for(;M<D-1;M++){let k=h(String(M),c[M],y,m,S);w+=k!==void 0?k:"null",w+=P}let v=h(String(M),c[M],y,m,S);if(w+=v!==void 0?v:"null",c.length-1>o){let k=c.length-o-1;w+=`${P}"... ${Y(k)} not stringified"`}return w+=`
|
|
21
|
+
${E}`,y.pop(),`[${w}]`}let _=Object.keys(c),b=_.length;if(b===0)return"{}";if(f<y.length+1)return'"[Object]"';S+=m;let T=`,
|
|
22
|
+
${S}`,L="",O="",x=Math.min(b,o);Mt(c)&&(L+=Ei(c,T,o),_=_.slice(c.length),x-=c.length,O=T),i&&(_=Pt(_,s)),y.push(c);for(let w=0;w<x;w++){let P=_[w],D=h(P,c[P],y,m,S);D!==void 0&&(L+=`${O}${W(P)}: ${D}`,O=T)}if(b>o){let w=b-o;L+=`${O}"...": "${Y(w)} not stringified"`,O=T}return O!==""&&(L=`
|
|
23
|
+
${S}${L}
|
|
24
|
+
${E}`),y.pop(),`{${L}}`}case"number":return isFinite(c)?String(c):t?t(c):"null";case"boolean":return c===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(c);default:return t?t(c):void 0}}function d(p,c,y){switch(typeof c){case"string":return W(c);case"object":{if(c===null)return"null";if(typeof c.toJSON=="function"){if(c=c.toJSON(p),typeof c!="object")return d(p,c,y);if(c===null)return"null"}if(y.indexOf(c)!==-1)return r;let m="",S=c.length!==void 0;if(S&&Array.isArray(c)){if(c.length===0)return"[]";if(f<y.length+1)return'"[Array]"';y.push(c);let L=Math.min(c.length,o),O=0;for(;O<L-1;O++){let w=d(String(O),c[O],y);m+=w!==void 0?w:"null",m+=","}let x=d(String(O),c[O],y);if(m+=x!==void 0?x:"null",c.length-1>o){let w=c.length-o-1;m+=`,"... ${Y(w)} not stringified"`}return y.pop(),`[${m}]`}let E=Object.keys(c),_=E.length;if(_===0)return"{}";if(f<y.length+1)return'"[Object]"';let b="",T=Math.min(_,o);S&&Mt(c)&&(m+=Ei(c,",",o),E=E.slice(c.length),T-=c.length,b=","),i&&(E=Pt(E,s)),y.push(c);for(let L=0;L<T;L++){let O=E[L],x=d(O,c[O],y);x!==void 0&&(m+=`${b}${W(O)}:${x}`,b=",")}if(_>o){let L=_-o;m+=`${b}"...":"${Y(L)} not stringified"`}return y.pop(),`{${m}}`}case"number":return isFinite(c)?String(c):t?t(c):"null";case"boolean":return c===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(c);default:return t?t(c):void 0}}function g(p,c,y){if(arguments.length>1){let m="";if(typeof y=="number"?m=" ".repeat(Math.min(y,10)):typeof y=="string"&&(m=y.slice(0,10)),c!=null){if(typeof c=="function")return l("",{"":p},[],c,m,"");if(Array.isArray(c))return u("",p,[],ff(c),m,"")}if(m.length!==0)return h("",p,[],m,"")}return d("",p,[])}return g}});var Ti=R((Nu,Oi)=>{"use strict";var kt=Symbol.for("pino.metadata"),{DEFAULT_LEVELS:Ri}=Pe(),uf=Ri.info;function df(e,t){e=e||[],t=t||{dedupe:!1};let r=Object.create(Ri);r.silent=1/0,t.levels&&typeof t.levels=="object"&&Object.keys(t.levels).forEach(d=>{r[d]=t.levels[d]});let n={write:i,add:o,remove:l,emit:s,flushSync:f,end:u,minLevel:0,lastId:0,streams:[],clone:h,[kt]:!0,streamLevels:r};return Array.isArray(e)?e.forEach(o,n):o.call(n,e),e=null,n;function i(d){let g,p=typeof this.lastLevel=="string"?(this.streamLevels||r)[this.lastLevel]:this.lastLevel,{streams:c}=this,y=0,m;for(let S=hf(c.length,t.dedupe);mf(S,c.length,t.dedupe);S=pf(S,t.dedupe))if(g=c[S],g.level<=p){if(y!==0&&y!==g.level)break;if(m=g.stream,m[kt]){let{lastTime:E,lastMsg:_,lastObj:b,lastLogger:T}=this;m.lastLevel=p,m.lastTime=E,m.lastMsg=_,m.lastObj=b,m.lastLogger=T}m.write(d),t.dedupe&&(y=g.level)}else if(!t.dedupe)break}function s(...d){for(let{stream:g}of this.streams)typeof g.emit=="function"&&g.emit(...d)}function f(){for(let{stream:d}of this.streams)typeof d.flushSync=="function"&&d.flushSync()}function o(d){if(!d)return this;let g=typeof d.write=="function"||d.stream,p=d.write?d:d.stream;if(!g)throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");let{streams:c,streamLevels:y}=this,m;typeof d.levelVal=="number"?m=d.levelVal:typeof d.level=="string"?m=y[d.level]:typeof d.level=="number"?m=d.level:m=uf;let S={stream:p,level:m,levelVal:void 0,id:++n.lastId};return c.unshift(S),c.sort(wi),this.minLevel=c[0].level,this}function l(d){let{streams:g}=this,p=g.findIndex(c=>c.id===d);return p>=0&&(g.splice(p,1),g.sort(wi),this.minLevel=g.length>0?g[0].level:-1),this}function u(){for(let{stream:d}of this.streams)typeof d.flushSync=="function"&&d.flushSync(),d.end()}function h(d){let g=new Array(this.streams.length);for(let p=0;p<g.length;p++)g[p]={level:d,stream:this.streams[p].stream};return{write:i,add:o,remove:l,emit:s,flushSync:f,end:u,minLevel:d,streams:g,clone:h,[kt]:!0,streamLevels:r}}}function wi(e,t){return e.level-t.level}function hf(e,t){return t?e-1:0}function pf(e,t){return t?e-1:e+1}function mf(e,t,r){return r?e>=0:e<t}Oi.exports=df});var $i=R((Pu,B)=>{"use strict";var gf=I("os"),Di=rt(),yf=nt(),Ef=ot(),vi=fn(),_f=yi(),ki=H(),{configure:Sf}=bi(),{assertDefaultLevelFound:bf,mappings:Ci,genLsCache:wf,genLevelComparison:Rf,assertLevelComparison:Of}=Tt(),{DEFAULT_LEVELS:Bi,SORTING_ORDER:Tf}=Pe(),{createArgsNormalizer:Af,asChindings:xf,buildSafeSonicBoom:Ai,buildFormatters:Lf,stringify:Ct,normalizeDestFileDescriptor:xi,noop:If}=Ne(),{version:Nf}=At(),{chindingsSym:Li,redactFmtSym:Pf,serializersSym:Ii,timeSym:Mf,timeSliceIndexSym:Df,streamSym:vf,stringifySym:Ni,stringifySafeSym:Bt,stringifiersSym:Pi,setLevelSym:kf,endSym:Cf,formatOptsSym:Bf,messageKeySym:Uf,errorKeySym:$f,nestedKeySym:Ff,mixinSym:jf,levelCompSym:qf,useOnlyCustomLevelsSym:Wf,formattersSym:Mi,hooksSym:Vf,nestedKeyStrSym:Gf,mixinMergeStrategySym:Hf,msgPrefixSym:Kf,transportUsesMultistreamSym:zf}=ki,{epochTime:Ui,nullTime:Xf}=vi,{pid:Yf}=process,Jf=gf.hostname(),Qf=Di.err,Zf={level:"info",levelComparison:Tf.ASC,levels:Bi,messageKey:"msg",errorKey:"err",nestedKey:null,enabled:!0,base:{pid:Yf,hostname:Jf},serializers:Object.assign(Object.create(null),{err:Qf}),formatters:Object.assign(Object.create(null),{bindings(e){return e},level(e,t){return{level:t}}}),hooks:{logMethod:void 0,streamWrite:void 0},timestamp:Ui,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100},ea=Af(Zf),ta=Object.assign(Object.create(null),Di);function Ut(...e){let t={},{opts:r,stream:n}=ea(t,yf(),...e);r.level&&typeof r.level=="string"&&Bi[r.level.toLowerCase()]!==void 0&&(r.level=r.level.toLowerCase());let{redact:i,crlf:s,serializers:f,timestamp:o,messageKey:l,errorKey:u,nestedKey:h,base:d,name:g,level:p,customLevels:c,levelComparison:y,mixin:m,mixinMergeStrategy:S,useOnlyCustomLevels:E,formatters:_,hooks:b,depthLimit:T,edgeLimit:L,onChild:O,msgPrefix:x}=r,w=Sf({maximumDepth:T,maximumBreadth:L}),P=Lf(_.level,_.bindings,_.log),D=Ct.bind({[Bt]:w}),M=i?Object.assign(Object.create(null),Ef(i,D)):Object.create(null),v=i?{stringify:M[Pf]}:{stringify:D},k="}"+(s?`\r
|
|
25
|
+
`:`
|
|
26
|
+
`),G=xf.bind(null,{[Li]:"",[Ii]:f,[Pi]:M,[Ni]:Ct,[Bt]:w,[Mi]:P}),$e="";d!==null&&(g===void 0?$e=G(d):$e=G(Object.assign({},d,{name:g})));let Gt=o instanceof Function?o:o?Ui:Xf,ss=Gt().indexOf(":")+1;if(E&&!c)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(m&&typeof m!="function")throw Error(`Unknown mixin type "${typeof m}" - expected "function"`);if(x&&typeof x!="string")throw Error(`Unknown msgPrefix type "${typeof x}" - expected "string"`);bf(p,c,E);let ne=Ci(c,E);if(n&&n[zf]===!0){let ie=typeof p=="string"?p:void 0;(!ie||ne[ie]===void 0)&&(ie=Object.keys(ne)[0]);let Ht=ne[ie],Fe=!1;try{let je=_.level(ie,Ht);Fe=je&&typeof je=="object"&&je.level===Ht}catch{Fe=!1}Fe||process.emitWarning('custom formatters.level detected with multiple transport targets/pipelines; ensure logs include a numeric "level" field or they may be dropped',{code:"PINO_TRANSPORT_MULTI_TARGETS_LEVEL_FORMATTER"})}typeof n.emit=="function"&&n.emit("message",{code:"PINO_CONFIG",config:{levels:ne,messageKey:l,errorKey:u}}),Of(y);let os=Rf(y);return Object.assign(t,{levels:ne,[qf]:os,[Wf]:E,[vf]:n,[Mf]:Gt,[Df]:ss,[Ni]:Ct,[Bt]:w,[Pi]:M,[Cf]:k,[Bf]:v,[Uf]:l,[$f]:u,[Ff]:h,[Gf]:h?`,${JSON.stringify(h)}:{`:"",[Ii]:f,[jf]:m,[Hf]:S,[Li]:$e,[Mi]:P,[Vf]:b,silent:If,onChild:O,[Kf]:x}),Object.setPrototypeOf(t,_f()),wf(t),t[kf](p),t}B.exports=Ut;B.exports.destination=(e=process.stdout.fd)=>typeof e=="object"?(e.dest=xi(e.dest||process.stdout.fd),Ai(e)):Ai({dest:xi(e),minLength:0});B.exports.transport=St();B.exports.multistream=Ti();B.exports.levels=Ci();B.exports.stdSerializers=ta;B.exports.stdTimeFunctions=Object.assign({},vi);B.exports.symbols=ki;B.exports.version=Nf;B.exports.default=Ut;B.exports.pino=Ut});import{closeSync as le,constants as N,fchmodSync as Sr,fstatSync as fs,ftruncateSync as as,lstatSync as yr,mkdirSync as Er,openSync as br,readFileSync as _r,writeFileSync as us}from"fs";import{open as ds}from"fs/promises";import{homedir as wr}from"os";import{dirname as Rr,join as He,relative as Or,resolve as Tr,sep as Ar}from"path";var se=".yukino",We="sessions",dr="artifacts",hr="projects",pr=/^[A-Za-z0-9_-]+$/u,mr="Invalid session ID";var Ve="Private state must be a regular file",gr=new Set(["worktrees","skills","agents","prompts","AGENTS.md"]);function Ja(e){let t=He(wr(),se),r=Tr(e);if(!qe(t,r))return!1;let n=Or(t,r).split(Ar)[0];return!gr.has(n)}function pe(e,t){let r=Tr(e),n=He(wr(),se);if(!qe(n,r)){Er(r,{recursive:!0,mode:448});return}let i=Or(n,r).split(Ar).filter(Boolean),s=n;for(let f=-1;f<i.length;f++){f>=0&&(s=He(s,i[f]));let o=yr(s,{throwIfNoEntry:!1});if(o?.isSymbolicLink()||o&&!o.isDirectory())throw new Error(`Private state directory must be a real directory: ${s}`);if(!o)try{Er(s,{mode:448})}catch(l){if(!(l instanceof Error)||!("code"in l)||l.code!=="EEXIST")throw l;let u=yr(s);if(u.isSymbolicLink()||!u.isDirectory())throw l}if(process.platform!=="win32"){let l=br(s,N.O_RDONLY|N.O_DIRECTORY|N.O_NOFOLLOW);try{Sr(l,448)}finally{le(l)}}}}function hs(e){if(typeof e=="number")return e;switch(e){case"r":return N.O_RDONLY;case"w":return N.O_WRONLY|N.O_CREAT|N.O_TRUNC;case"wx":return N.O_WRONLY|N.O_CREAT|N.O_TRUNC|N.O_EXCL;case"a":return N.O_WRONLY|N.O_CREAT|N.O_APPEND;default:throw new Error(`Unsupported private file flag: ${e}`)}}function ce(e,t,r=384){pe(Rr(e));let n=hs(t),i=br(e,n&~N.O_TRUNC|N.O_NOFOLLOW|N.O_NONBLOCK,384);try{if(!fs(i).isFile())throw new Error(Ve);return process.platform!=="win32"&&Sr(i,384),n&N.O_TRUNC&&as(i,0),i}catch(s){throw le(i),s}}function Qa(e){le(ce(e,"r"))}function ps(e,t,r){let n=typeof r=="string"?{encoding:r}:r,i=ce(e,n?.flag??"w");try{us(i,t,n)}finally{le(i)}}function Za(e,t,r="utf8"){ps(e,t,{flag:"a",encoding:r})}function eu(e,t){let r=ce(e,"r");try{return t?_r(r,t):_r(r)}finally{le(r)}}async function tu(e,t,r="utf8"){pe(Rr(e));let n=await ds(e,N.O_WRONLY|N.O_CREAT|N.O_NOFOLLOW|N.O_NONBLOCK,384);try{if(!(await n.stat()).isFile())throw new Error(Ve);process.platform!=="win32"&&await n.chmod(384),await n.truncate(0),await n.writeFile(t,r)}finally{await n.close()}}var te=ls($i(),1);import{closeSync as ca}from"fs";import{readdir as Ft,stat as fa,unlink as aa}from"fs/promises";import{join as Be,dirname as ua}from"path";var ve="warn",Fi="silent",ke="logs",$t=".jsonl";var ji=/[^a-zA-Z0-9_-]/g,qi="unnamed";var Wi=new Set(["name","message","stack","cause"]);import{createHash as na}from"crypto";import{homedir as ia}from"os";import{join as Vi}from"path";function sa(){return Vi(ia(),se)}function Q(...e){return Vi(sa(),...e)}function Bu(e,...t){if(!pr.test(e))throw new Error(mr);return Q(We,dr,e,...t)}function Gi(e){return na("sha256").update(ur(e)).digest("hex")}function Uu(e,...t){return Q(hr,Gi(e),...t)}function $u(e){return Q(We,Gi(e))}var ju="text",qu="shutdown_request",Wu="shutdown_response",Vu="plan_approval_request",Gu="plan_approval_response",Hu="leader",Ku=/^[a-zA-Z0-9_-]+$/,zu=/[^a-zA-Z0-9]/g,Xu=new Set(["SendMessage","TodoWrite"]),Yu=new Set(["Workflow","Goal","Agent","SendMessage","TaskStop","SyntheticOutput","TeamCreate","TeamDelete","TeamList","TodoWrite"]),Ju=5e3,Qu=1e4,Zu=5,ed=80,td=500,rd=500,nd=500,id=200,sd=200,od=5,ld="config.json",Hi="teams",cd="inboxes",fd="team:",ad="Working",ud="Stopped",dd="*",hd="(The teammate returned no plan.)",pd="No active team.",md="No active team found for this sender.",gd="Multiple teams match. Specify team_name; use TeamList to see available teams.",yd="Teammates can only access their own team.",Ed="Only the leader can approve or reject teammate plans.",_d="plan_approval_response requires request_id, approve, and review feedback in content.",Sd="Only the leader can request teammate shutdown.",bd="shutdown_response requires 'approve'.",wd="Error: pass exactly one of teammate or task_id",Rd="Only the leader can stop teammates.",Od="Invalid mailbox member name",Td="Cannot load an unreadable teammate mailbox; original contents were preserved",Ad="Invalid shared task ID counter",xd="Cannot load an unreadable shared task board",Ld="Team name must not be empty or whitespace.",Id="No active team task board",Nd="Only an active teammate in plan mode can submit a plan.",Pd="A non-empty plan is required for review.",Md="This teammate already has a plan awaiting review.",Dd="Teammate plans are automatically approved outside coordinator mode.",vd="No matching pending plan approval request for this teammate.",kd="This plan approval request already has a leader response.",Cd="Plan approval responses require the leader's review feedback.";function Bd(e){return`Invalid teammate name '${e}'`}function Ud(e){return`Teammate '${e}' already exists`}function $d(e){return`Teammate '${e}' is already running`}function Fd(e){return`Stop teammate '${e}' before removing it`}function jd(e,t){return`Member '${e}' not found in team '${t}'`}function qd(e,t){return`Teammate '${e}' is ${t} and cannot receive work`}function Wd(e){return`Teammate '${e}' is not available for assignment`}function Vd(e){return`Team '${e}' created. Use Agent with kind="teammate" and team_name="${e}" to add teammates.`}function Gd(e){return`Team '${e}' already exists. Choose a different name, or target the existing team with team_name='${e}'.`}function Hd(e){return`Team '${e}' not found.`}function Kd(e){return`Team '${e}' deleted.`}function zd(e){return`Message sent to '${e}'.`}function Xd(e){return`Message broadcast to ${String(e)} teammate(s).`}function Yd(e,t){return`${e} sent to '${t}'.`}function Jd(e){return`Unsupported message type ${e}.`}function Qd(e){return`Teammate '${e}' not found.`}function Zd(e,t){return`Plan ${e?"approval":"revision feedback"} sent to '${t}'.`}function eh(e){return`Error: background task '${e}' not found`}function th(e,t){return`Background task '${e}' is ${t}, nothing to stop`}function rh(e){return`Background task '${e}' stopped.`}function nh(e,t){return`Teammate '${e}' in team '${t}' is not running, nothing to stop`}function ih(e,t){return`Teammate '${e}' in team '${t}' stopped.`}function sh(e,t){return`Error: teammate '${e}' not found. Known teammates: ${t}`}var V=null,re=null,Ce=null,zi=null;function da(e){let t=e.logDir??Q(ke);return Be(t,`${e.sessionId}${$t}`)}function ph(e){return e.replace(ji,"_")||qi}function ha(e){if(typeof e!="object"||e===null)return;let t=Reflect.get(e,"flushSync");typeof t=="function"&&t.call(e)}function mh(e){V&&pa();let t=da(e);pe(ua(t),{recursive:!0});let r=ce(t,"a");Ce=r,zi=t,re=te.default.destination(r);let n={level:ve,base:{sessionId:e.sessionId,mode:e.mode},serializers:{err:ga}};return e.stdout?V=(0,te.default)(n,te.default.multistream([{stream:re,level:ve},{stream:process.stdout,level:ve}])):V=(0,te.default)(n,re),e.skipCleanup||ma().catch(()=>{}),V}function jt(){return V}function pa(){if(zi=null,V){try{V.flush()}catch{}V=null}if(re&&(ha(re),re=null),Ce!==null){try{ca(Ce)}catch{}Ce=null}}var Xi=(0,te.default)({level:Fi}),gh=new Proxy(Xi,{get(e,t,r){let i=jt()??e,s=Reflect.get(i,t,r);return typeof s=="function"?s.bind(i):s},set(e,t,r){return Reflect.set(jt()??e,t,r)}});function Yi(e){let t=null,r=null,n=()=>{let i=jt();return i?((t===null||r!==i)&&(t=i.child(e),r=i),t):null};return new Proxy(Xi,{get(i,s,f){let o=n()??i,l=Reflect.get(o,s,f);return typeof l=="function"?l.bind(o):l},set(i,s,f){return Reflect.set(n()??i,s,f)}})}async function Ki(e){let t;try{t=(await Ft(e)).filter(s=>s.endsWith($t))}catch{return 0}let r=Date.now(),n=720*60*60*1e3,i=0;for(let s of t){let f=Be(e,s);try{let o=await fa(f);r-o.mtimeMs>n&&(await aa(f),i++)}catch{}}return i}async function ma(){let e=0;e+=await Ki(Q(ke));let t=Q(Hi),r;try{r=await Ft(t)}catch{return e}for(let n of r){let i;try{i=await Ft(Be(t,n))}catch{continue}for(let s of i)e+=await Ki(Be(t,n,s,ke))}return e}function Ji(e,t){let r={type:e.name,message:e.message,stack:e.stack},n=Object.getOwnPropertyDescriptor(e,"cause");if(n&&t<5){let i=n.value;i instanceof Error?r.cause=Ji(i,t+1):i!==void 0&&(r.cause={message:Qi(i)})}for(let i of Object.keys(e)){if(Wi.has(i))continue;let s=Object.getOwnPropertyDescriptor(e,i);if(s){let f=s.value;r[i]=f}}return r}function Qi(e){if(typeof e=="string")return e;try{let t=JSON.stringify(e);if(t!==void 0)return t}catch{}try{return String(e)}catch{return Object.prototype.toString.call(e)}}function ga(e){return e instanceof Error?Ji(e,0):{message:Qi(e),value:e}}import{readdirSync as Ea,lstatSync as _a,statSync as Sa}from"fs";import{join as ba}from"path";var Eh="tool-results",_h=".txt";var wh=120,Rh=600,Oh=3e3,Th=2e3,Ah=50*1024,xh=10*1024*1024,Lh=500,Ih=2e3,Nh=8*1024,Ph=1e4,Mh=25,Dh=25*1024*1024,vh=2e3,kh=1e4,F="\\p{L}\\p{M}\\p{N}_",Ch=new Map([["w",`[${F}]`],["W",`[^${F}]`],["d","\\p{Nd}"],["D","\\P{Nd}"],["b",`(?:(?<![${F}])(?=[${F}])|(?<=[${F}])(?![${F}]))`],["B",`(?:(?<=[${F}])(?=[${F}])|(?<![${F}])(?![${F}]))`]]),Bh=new Map([["w",F],["d","\\p{Nd}"]]),Uh=50*1024,$h=10*1024*1024,Fh=3e4,jh=2e3,qh=5*1024*1024*1024,Wh=500,Vh=["Bash","PowerShell"],Zi=new Set([".agents",".git",".yukino",".next",".venv",".mypy_cache","__pycache__","dist","node_modules"]),Gh=new Set(["image/jpeg","image/png","image/gif","image/webp"]),Hh=["key","hold_key","type","cursor_position","mouse_move","left_mouse_down","left_mouse_up","left_click","left_click_drag","right_click","middle_click","double_click","triple_click","scroll","wait","screenshot","zoom","click","drag","keypress","move"],Kh=["click","double_click","drag","keypress","move","screenshot","scroll","type","wait"],zh=100,Xh=15e3,Yh=32*1024*1024,Jh=1366,Qh=900,Zh="Error: send either action (Anthropic-style, one action per call) or actions (OpenAI-style batch), not both.",ep="Error: action (Anthropic-style) or actions (OpenAI-style batch) is required.",tp="Error: the computer is being controlled by another Yukino call. Retry after it finishes.",rp=3,np=200,ip=10*1024*1024,sp=6e4,op=1e5,lp=900*1e3,cp=50*1024*1024,fp=new Map([["grep",new Map([[1,"no matches found"],[2,"error while searching"]])],["rg",new Map([[1,"no matches found"],[2,"error while searching"]])],["findstr",new Map([[1,"no matches found"],[2,"error while searching"]])],["diff",new Map([[1,"files differ"],[2,"trouble reading files"]])],["cmp",new Map([[1,"files differ"],[2,"trouble reading files"]])],["test",new Map([[1,"condition is false"],[2,"expression error"]])],["[",new Map([[1,"condition is false"],[2,"expression error"]])],["expr",new Map([[1,"expression is null or zero"],[2,"syntax error"]])],["find",new Map([[1,"partial success \u2014 some inputs could not be processed"]])],["robocopy",new Map([[1,"success \u2014 files copied"],[2,"success \u2014 extra files or directories detected"],[4,"success \u2014 mismatched files detected"],[8,"some files failed to copy"],[16,"serious error \u2014 no files copied"]])]]),ap=new Map([[126,"command found but not executable"],[127,"command not found"],[129,"terminated by SIGHUP"],[130,"terminated by SIGINT (Ctrl+C)"],[137,"killed by SIGKILL (often OOM)"],[141,"downstream consumer exited early (SIGPIPE)"],[143,"terminated by SIGTERM"]]),up=/^[+-]?\d+$/,dp=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/,hp="Error: command is required",pp="Error: timeout must be a finite number greater than 0 seconds",mp="Error: command interrupted",gp="Error: sandbox is enabled but unavailable; command was not executed",yp="Error: operation interrupted",Ep="Error: file_path is required",_p="Error: content is required",Sp="Error: offset must be >= 0 and limit must be >= 1",bp="Error: pattern is required",wp="Error: the pattern timed out while matching (likely catastrophic backtracking). Simplify it \u2014 avoid nested quantifiers such as (a+)+ \u2014 or narrow the path/include filter.",Rp="Error: url is required",Op="Error: fetch interrupted",Tp="Error: output is required",Ap="Error: query is required",xp="Error: slug must contain only alphanumeric, hyphen, underscore",Lp="Error: a runtime permission checker is required for worktree sessions",Ip="Error: must have 1-4 questions",Np="Error: file has not been read yet, read it first before editing.",Pp="Error: file was deleted or is no longer accessible; read it again before editing.",Mp="Error: file has been modified since last read, read it again before editing.",Dp="Tool execution was cancelled before it started.",vp="Plan mode is unavailable because no permission context exists.",kp="EnterPlanMode cannot be used from delegated agents.",Cp="You are not in plan mode. Continue within the user's requested scope and current permissions, or call EnterPlanMode first when the task genuinely needs planning. AskUserQuestion is for clarification, not approval.",Bp="You are not in plan mode. This tool is only for exiting plan mode after writing a plan.",Up="No non-empty plan file found. Write your plan to the declared plan file before calling ExitPlanMode.",$p="No leader plan approval handler is available for this teammate.",Fp="McpCall requires a 'tool' name",jp="McpCall requires an 'arguments' object matching the target schema",qp="Goals belong to the main session and are unavailable to delegated agents.",Wp="Updating a goal requires status and reason.",Vp="Goal update accepts only 'in_progress', 'complete', or 'blocked'. A goal is active as soon as the user sets it. Only the user can pause or resume a goal.",Gp="Goal expects action 'get' or 'update'. Updating requires status 'in_progress', 'complete', or 'blocked' and a non-empty reason; no other fields are accepted.";var es=Yi({module:"file-scan"});function Qp(e,t=lr){let r=[],n=0,i=Math.max(cr,t*fr),s=(f,o)=>{if(r.length>=t||n>=i)return;let l;try{l=Ea(f)}catch(u){es.error({err:u},"cwd scan failed");return}for(let u of l){if(r.length>=t||n>=i)return;if(n++,u.startsWith(".")||Zi.has(u))continue;let h=ba(f,u),d=o?`${o}/${u}`:u,g=!1;try{let p=_a(h);if(p.isSymbolicLink()){Sa(h).isFile()&&r.push(d);continue}if(!p.isDirectory()&&!p.isFile())continue;g=p.isDirectory()}catch(p){es.error({err:p},"cwd scan failed");continue}g?s(h,d):r.push(d)}};return s(e,""),r}function Zp(e,t,r=ar){let n=t.toLowerCase();if(!n)return e.slice(0,r);let i=e.filter(f=>f.toLowerCase().startsWith(n)),s=e.filter(f=>!f.toLowerCase().startsWith(n)&&f.toLowerCase().includes(n));return[...i,...s].slice(0,r)}import{stripVTControlCharacters as ja}from"util";import{lookup as Ra}from"dns/promises";import{request as Oa}from"http";import{request as Ta}from"https";import{BlockList as rs,isIP as qt}from"net";import{Readable as Aa}from"stream";var ns=new rs,is=new rs;for(let[e,t]of Zt)ns.addSubnet(e,t,"ipv4");for(let[e,t]of er)is.addSubnet(e,t,"ipv6");function xa(e){let t=qt(e);return t===4?!ns.check(e,"ipv4"):t===6?!is.check(e,"ipv6"):!1}var La=async e=>await Ra(e,{all:!0,order:"verbatim"});function Ia(e){return e.hostname.startsWith("[")&&e.hostname.endsWith("]")?e.hostname.slice(1,-1):e.hostname}async function Na(e,t){let r=e instanceof URL?e:new URL(e);if(r.protocol!=="http:"&&r.protocol!=="https:")throw new Error(tr);if(r.username||r.password)throw new Error(rr);let n=Ia(r),i=qt(n),f=(i?[{address:n,family:i}]:await t(n)).map(o=>({address:o.address,family:qt(o.address)}));if(f.length===0||f.some(o=>o.family!==4&&o.family!==6||!xa(o.address)))throw new Error(nr);return{url:r,addresses:f}}function Pa(e){let t=new Headers;for(let[r,n]of Object.entries(e))if(Array.isArray(n))for(let i of n)t.append(r,i);else n!==void 0&&t.set(r,n);return t}function Ma(e,t,r){let n=(s,f,o)=>{if(f.all){o(null,[r]);return}o(null,r.address,r.family)},i=e.protocol==="https:"?Ta:Oa;return new Promise((s,f)=>{let o=i(e,{headers:Object.fromEntries(new Headers(t.headers).entries()),lookup:n,method:t.method??"GET",signal:t.signal??void 0},l=>{let u=l.statusCode??500,h=Yt.has(u);s(new Response(h?null:Aa.toWeb(l),{headers:Pa(l.headers),status:u,statusText:l.statusMessage}))});o.once("error",f),o.end()})}async function Da(e,t,r){let n;for(let i of r)try{return await Ma(e,t,i)}catch(s){t.signal?.throwIfAborted(),n=s}throw n instanceof Error?n:new Error(ir,{cause:n})}function va(e){let t=(e.method??"GET").toUpperCase();if(t!=="GET"&&t!=="HEAD")throw new Error(`fetchPublicHttpUrl only supports GET or HEAD, received '${t}'`);if(e.body!==void 0&&e.body!==null)throw new Error(or)}async function om(e,t,r={}){va(t);let n=r.fetcher??globalThis.fetch,i=r.lookup??La,s=new URL(e);for(let f=0;;f++){let o=await Na(s,i);t.signal?.throwIfAborted();let l=r.fetcher?await n(o.url,{...t,redirect:"manual"}):await Da(o.url,t,o.addresses);if(!Xt.has(l.status))return l;if(await l.body?.cancel(),f>=5)throw new Error(`Skill download exceeded ${String(5)} redirects`);let u=l.headers.get("location");if(!u)throw new Error(sr);s=new URL(u,s)}}function Ca(){return Object.entries(process.env).flatMap(([e,t])=>Jt.test(e)&&t&&t.length>3?[t,encodeURIComponent(t)]:[])}function cm(e,t=Ca(),r=Kt){let n=e.replace(Qt,`$1${r}`);for(let i of[...t].filter(Boolean).sort((s,f)=>f.length-s.length))n=n.replaceAll(i,r);return n}import{randomBytes as Ua}from"crypto";function am(){let e=Date.now().toString(36),t=Ua(6).toString("hex");return`${e}-${t}`}function um(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function gm(e){return ja(e).replace(/\r\n?/gu,`
|
|
27
|
+
`).replace(new RegExp("\\p{Cc}","gu"),t=>t===`
|
|
28
|
+
`||t===" "?t:"")}function qa(e){if(typeof e=="string")return e;let t=[];for(let r of e)if(r.type==="text"&&typeof r.text=="string")t.push(r.text);else if(r.type==="image"&&Vt(r.source)){let n=r.source.type==="base64"&&typeof r.source.media_type=="string"?r.source.media_type:"image";t.push(`[Image: ${n}]`)}else if(r.type==="tool_reference"&&typeof r.tool_name=="string")t.push(`[Tool reference: ${r.tool_name}]`);else if(r.type==="search_result"){let n=typeof r.title=="string"?r.title:"search result",i=typeof r.source=="string"?` (${r.source})`:"",s=Array.isArray(r.content)?qa(r.content.filter(Vt)):"";t.push(`${n}${i}${s?`
|
|
29
|
+
${s}`:""}`)}else if(r.type==="document"){let n=typeof r.title=="string"?r.title:"document";t.push(`[Document: ${n}]`)}return t.join(`
|
|
30
|
+
`)}function Vt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ym(e){return Vt(e)?e:Array.isArray(e)?Object.fromEntries(e.entries()):{}}function Wa(e){return typeof e=="string"?e:String(e)}function Em(e){return e instanceof Error?e.message:Wa(e)}function _m(e){return typeof e=="object"&&e!==null}function Va(e){let t;if(typeof e=="number")t=e;else if(typeof e=="string"){let r=e.trim();if(!zt.test(r))return;t=Number(r)}else return;if(Number.isFinite(t))return Math.trunc(t)}function Sm(e,t,r){return Va(e[t])??r}function Ue(e,t,r){let n=e[t];return typeof n=="string"?n:r??""}function bm(e,t,r){let n=e[t];if(typeof n=="boolean")return n;if(typeof n=="string"){let i=n.trim().toLowerCase();if(i==="true"||i==="1")return!0;if(i==="false"||i==="0")return!1}if(typeof n=="number"){if(n===1)return!0;if(n===0)return!1}return r??!1}function wm(e){return e.command?Ue(e,"command"):e.file_path?Wt(Ue(e,"file_path"),he):e.pattern?Wt(Ue(e,"pattern"),he):e.description?Wt(Ue(e,"description"),he):""}function Wt(e,t){return e.length>t?`${e.slice(0,t)}\u2026`:e}export{se as a,pr as b,mr as c,Ja as d,pe as e,ce as f,Qa as g,ps as h,Za as i,eu as j,tu as k,sa as l,Q as m,Bu as n,Gi as o,Uu as p,$u as q,ju as r,qu as s,Wu as t,Vu as u,Gu as v,Hu as w,Ku as x,zu as y,Xu as z,Yu as A,Ju as B,Qu as C,Zu as D,ed as E,td as F,rd as G,nd as H,id as I,sd as J,od as K,ld as L,Hi as M,cd as N,fd as O,ad as P,ud as Q,dd as R,hd as S,pd as T,md as U,gd as V,yd as W,Ed as X,_d as Y,Sd as Z,bd as _,wd as $,Rd as aa,Od as ba,Td as ca,Ad as da,xd as ea,Ld as fa,Id as ga,Nd as ha,Pd as ia,Md as ja,Dd as ka,vd as la,kd as ma,Cd as na,Bd as oa,Ud as pa,$d as qa,Fd as ra,jd as sa,qd as ta,Wd as ua,Vd as va,Gd as wa,Hd as xa,Kd as ya,zd as za,Xd as Aa,Yd as Ba,Jd as Ca,Qd as Da,Zd as Ea,eh as Fa,th as Ga,rh as Ha,nh as Ia,ih as Ja,sh as Ka,ph as La,mh as Ma,pa as Na,gh as Oa,Yi as Pa,Eh as Qa,_h as Ra,wh as Sa,Rh as Ta,Oh as Ua,Th as Va,Ah as Wa,xh as Xa,Lh as Ya,Ih as Za,Nh as _a,Ph as $a,Mh as ab,Dh as bb,vh as cb,kh as db,Ch as eb,Bh as fb,Uh as gb,$h as hb,Fh as ib,jh as jb,qh as kb,Wh as lb,Vh as mb,Zi as nb,Gh as ob,Hh as pb,Kh as qb,zh as rb,Xh as sb,Yh as tb,Jh as ub,Qh as vb,Zh as wb,ep as xb,tp as yb,rp as zb,np as Ab,ip as Bb,sp as Cb,op as Db,lp as Eb,cp as Fb,fp as Gb,ap as Hb,up as Ib,dp as Jb,hp as Kb,pp as Lb,mp as Mb,gp as Nb,yp as Ob,Ep as Pb,_p as Qb,Sp as Rb,bp as Sb,wp as Tb,Rp as Ub,Op as Vb,Tp as Wb,Ap as Xb,xp as Yb,Lp as Zb,Ip as _b,Np as $b,Pp as ac,Mp as bc,Dp as cc,vp as dc,kp as ec,Cp as fc,Bp as gc,Up as hc,$p as ic,Fp as jc,jp as kc,qp as lc,Wp as mc,Vp as nc,Gp as oc,Qp as pc,Zp as qc,om as rc,Ca as sc,cm as tc,am as uc,um as vc,gm as wc,qa as xc,Vt as yc,ym as zc,Wa as Ac,Em as Bc,_m as Cc,Sm as Dc,Ue as Ec,bm as Fc,wm as Gc};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __yukinoCreateRequire } from "node:module";
|
|
3
|
+
const require = __yukinoCreateRequire(import.meta.url);
|
|
4
|
+
import{Pa as Pn,a as kn,e as Nn,h as Rn,j as Fe,m as Mn,zc as Ze}from"./chunk-5AOJ5ZSQ.js";import{B as A,b as Qe}from"./chunk-QSKJBSCI.js";var ie=["off","minimal","low","medium","high","xhigh","max"],Fn="high";var Dn={minimal:1024,low:2048,medium:8192,high:16384,xhigh:32768,max:65536},Yn=1024,jn=1024,en={anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY","openai-compat":"OPENAI_API_KEY"},Un=new Set(Object.keys(en)),Hn=["auto","eager","native","dispatch"],qn=["auto","dark","light"],De="config.yaml",Bn=".mcp.json",Kn="At least one provider MUST be configured.",nn="YAML parse error";function se(){return Mn(De)}var ue=A.enum(["none","minimal","low","medium","high","xhigh","max"]),ei=A.enum(["low","medium","high","xhigh","max"]),ni=A.strictObject({off:A.literal("none").nullable().optional(),minimal:ue.nullable().optional(),low:ue.nullable().optional(),medium:ue.nullable().optional(),high:ue.nullable().optional(),xhigh:ue.nullable().optional(),max:ue.nullable().optional()}),Se=A.looseObject({name:A.string(),protocol:A.enum(["anthropic","openai","openai-compat"]),base_url:A.string(),model:A.string(),api_key:A.string().optional(),thinking:A.enum(ie).optional(),reasoning:A.boolean().optional(),thinking_level_map:ni.optional(),thinking_mode:A.enum(["budget","adaptive"]).optional(),context_window:A.coerce.number().optional(),max_output_tokens:A.coerce.number().optional()});function ji(r,i){return r[i]??r[0]}function Ui(r){return ie.some(i=>i===r)}function rn(r){return ti(r,r.thinking??Fn)}function ri(r){return r==="off"?0:Dn[r]}function Hi(r,i){let c=on(i,r);return c===null||c==="none"?0:ri(c)}function on(r,i){if(i?.reasoning===!1)return null;if(r==="off")return"none";let c=i?.thinking_level_map?.[r];if(c!==void 0)return c;if(i?.protocol==="anthropic"&&i.thinking_mode==="adaptive"){if(r==="minimal")return"low";if(r==="xhigh")return"high"}return r}function ii(r,i){let c=ei.safeParse(on(r,i));return c.success?c.data:null}function oi(r){return r.reasoning===!1||r.protocol==="anthropic"&&r.thinking_mode!=="adaptive"&&Vn(r)<Yn+jn?["off"]:ie.filter(i=>{if(i==="off")return!0;if(r.protocol==="anthropic"&&r.thinking_mode==="adaptive")return ii(i,r)!==null;let c=on(i,r);return c!==null&&c!=="none"})}function ti(r,i){let c=oi(r),g="off";for(let l of ie)if(c.includes(l)&&(g=l),l===i)break;return g}function Gn(r){return{...r,thinking:rn(r),context_window:$n(r),max_output_tokens:Vn(r)}}function $n(r){return Number.isSafeInteger(r.context_window)&&(r.context_window??0)>0?r.context_window??1e6:1e6}function Vn(r){let i=r.max_output_tokens,c=Number.isSafeInteger(i)&&(i??0)>0?i??128e3:128e3;return Math.min(c,$n(r))}import{randomUUID as di}from"crypto";import{existsSync as Dr,renameSync as hi,unlinkSync as mi}from"fs";import{dirname as gi,join as yi}from"path";function ci(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Y={},Ue={},ee={},zn;function xe(){if(zn)return ee;zn=1;function r(h){return typeof h>"u"||h===null}function i(h){return typeof h=="object"&&h!==null}function c(h){return Array.isArray(h)?h:r(h)?[]:[h]}function g(h,u){if(u){let x=Object.keys(u);for(let s=0,p=x.length;s<p;s+=1){let b=x[s];h[b]=u[b]}}return h}function l(h,u){let x="";for(let s=0;s<u;s+=1)x+=h;return x}function d(h){return h===0&&Number.NEGATIVE_INFINITY===1/h}return ee.isNothing=r,ee.isObject=i,ee.toArray=c,ee.repeat=l,ee.isNegativeZero=d,ee.extend=g,ee}var tn,Wn;function Te(){if(Wn)return tn;Wn=1;function r(c,g){let l="",d=c.reason||"(unknown reason)";return c.mark?(c.mark.name&&(l+='in "'+c.mark.name+'" '),l+="("+(c.mark.line+1)+":"+(c.mark.column+1)+")",!g&&c.mark.snippet&&(l+=`
|
|
5
|
+
|
|
6
|
+
`+c.mark.snippet),d+" "+l):d}function i(c,g){Error.call(this),this.name="YAMLException",this.reason=c,this.mark=g,this.message=r(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}return i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i.prototype.toString=function(g){return this.name+": "+r(this,g)},tn=i,tn}var ln,Xn;function ui(){if(Xn)return ln;Xn=1;let r=xe();function i(l,d,h,u,x){let s="",p="",b=Math.floor(x/2)-1;return u-d>b&&(s=" ... ",d=u-b+s.length),h-u>b&&(p=" ...",h=u+b-p.length),{str:s+l.slice(d,h).replace(/\t/g,"\u2192")+p,pos:u-d+s.length}}function c(l,d){return r.repeat(" ",d-l.length)+l}function g(l,d){if(d=Object.create(d||null),!l.buffer)return null;d.maxLength||(d.maxLength=79),typeof d.indent!="number"&&(d.indent=1),typeof d.linesBefore!="number"&&(d.linesBefore=3),typeof d.linesAfter!="number"&&(d.linesAfter=2);let h=/\r?\n|\r|\0/g,u=[0],x=[],s,p=-1;for(;s=h.exec(l.buffer);)x.push(s.index),u.push(s.index+s[0].length),l.position<=s.index&&p<0&&(p=u.length-2);p<0&&(p=u.length-1);let b="",O=Math.min(l.line+d.linesAfter,x.length).toString().length,R=d.maxLength-(d.indent+O+3);for(let M=1;M<=d.linesBefore&&!(p-M<0);M++){let K=i(l.buffer,u[p-M],x[p-M],l.position-(u[p]-u[p-M]),R);b=r.repeat(" ",d.indent)+c((l.line-M+1).toString(),O)+" | "+K.str+`
|
|
7
|
+
`+b}let z=i(l.buffer,u[p],x[p],l.position,R);b+=r.repeat(" ",d.indent)+c((l.line+1).toString(),O)+" | "+z.str+`
|
|
8
|
+
`,b+=r.repeat("-",d.indent+O+3+z.pos)+`^
|
|
9
|
+
`;for(let M=1;M<=d.linesAfter&&!(p+M>=x.length);M++){let K=i(l.buffer,u[p+M],x[p+M],l.position-(u[p]-u[p+M]),R);b+=r.repeat(" ",d.indent)+c((l.line+M+1).toString(),O)+" | "+K.str+`
|
|
10
|
+
`}return b.replace(/\n$/,"")}return ln=g,ln}var cn,Jn;function j(){if(Jn)return cn;Jn=1;let r=Te(),i=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],c=["scalar","sequence","mapping"];function g(d){let h={};return d!==null&&Object.keys(d).forEach(function(u){d[u].forEach(function(x){h[String(x)]=u})}),h}function l(d,h){if(h=h||{},Object.keys(h).forEach(function(u){if(i.indexOf(u)===-1)throw new r('Unknown option "'+u+'" is met in definition of "'+d+'" YAML type.')}),this.options=h,this.tag=d,this.kind=h.kind||null,this.resolve=h.resolve||function(){return!0},this.construct=h.construct||function(u){return u},this.instanceOf=h.instanceOf||null,this.predicate=h.predicate||null,this.represent=h.represent||null,this.representName=h.representName||null,this.defaultStyle=h.defaultStyle||null,this.multi=h.multi||!1,this.styleAliases=g(h.styleAliases||null),c.indexOf(this.kind)===-1)throw new r('Unknown kind "'+this.kind+'" is specified for "'+d+'" YAML type.')}return cn=l,cn}var un,Qn;function Ar(){if(Qn)return un;Qn=1;let r=Te(),i=j();function c(d,h){let u=[];return d[h].forEach(function(x){let s=u.length;u.forEach(function(p,b){p.tag===x.tag&&p.kind===x.kind&&p.multi===x.multi&&(s=b)}),u[s]=x}),u}function g(){let d={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function h(u){u.multi?(d.multi[u.kind].push(u),d.multi.fallback.push(u)):d[u.kind][u.tag]=d.fallback[u.tag]=u}for(let u=0,x=arguments.length;u<x;u+=1)arguments[u].forEach(h);return d}function l(d){return this.extend(d)}return l.prototype.extend=function(h){let u=[],x=[];if(h instanceof i)x.push(h);else if(Array.isArray(h))x=x.concat(h);else if(h&&(Array.isArray(h.implicit)||Array.isArray(h.explicit)))h.implicit&&(u=u.concat(h.implicit)),h.explicit&&(x=x.concat(h.explicit));else throw new r("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");u.forEach(function(p){if(!(p instanceof i))throw new r("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(p.loadKind&&p.loadKind!=="scalar")throw new r("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(p.multi)throw new r("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),x.forEach(function(p){if(!(p instanceof i))throw new r("Specified list of YAML types (or a single Type object) contains a non-Type object.")});let s=Object.create(l.prototype);return s.implicit=(this.implicit||[]).concat(u),s.explicit=(this.explicit||[]).concat(x),s.compiledImplicit=c(s,"implicit"),s.compiledExplicit=c(s,"explicit"),s.compiledTypeMap=g(s.compiledImplicit,s.compiledExplicit),s},un=l,un}var sn,Zn;function Er(){if(Zn)return sn;Zn=1;let r=j();return sn=new r("tag:yaml.org,2002:str",{kind:"scalar",construct:function(i){return i!==null?i:""}}),sn}var fn,er;function Sr(){if(er)return fn;er=1;let r=j();return fn=new r("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(i){return i!==null?i:[]}}),fn}var an,nr;function xr(){if(nr)return an;nr=1;let r=j();return an=new r("tag:yaml.org,2002:map",{kind:"mapping",construct:function(i){return i!==null?i:{}}}),an}var pn,rr;function Tr(){if(rr)return pn;rr=1;let r=Ar();return pn=new r({explicit:[Er(),Sr(),xr()]}),pn}var dn,ir;function vr(){if(ir)return dn;ir=1;let r=j();function i(l){if(l===null)return!0;let d=l.length;return d===1&&l==="~"||d===4&&(l==="null"||l==="Null"||l==="NULL")}function c(){return null}function g(l){return l===null}return dn=new r("tag:yaml.org,2002:null",{kind:"scalar",resolve:i,construct:c,predicate:g,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"}),dn}var hn,or;function br(){if(or)return hn;or=1;let r=j();function i(l){if(l===null)return!1;let d=l.length;return d===4&&(l==="true"||l==="True"||l==="TRUE")||d===5&&(l==="false"||l==="False"||l==="FALSE")}function c(l){return l==="true"||l==="True"||l==="TRUE"}function g(l){return Object.prototype.toString.call(l)==="[object Boolean]"}return hn=new r("tag:yaml.org,2002:bool",{kind:"scalar",resolve:i,construct:c,predicate:g,represent:{lowercase:function(l){return l?"true":"false"},uppercase:function(l){return l?"TRUE":"FALSE"},camelcase:function(l){return l?"True":"False"}},defaultStyle:"lowercase"}),hn}var mn,tr;function Cr(){if(tr)return mn;tr=1;let r=xe(),i=j();function c(s){return s>=48&&s<=57||s>=65&&s<=70||s>=97&&s<=102}function g(s){return s>=48&&s<=55}function l(s){return s>=48&&s<=57}function d(s){if(s===null)return!1;let p=s.length,b=0,O=!1;if(!p)return!1;let R=s[b];if((R==="-"||R==="+")&&(R=s[++b]),R==="0"){if(b+1===p)return!0;if(R=s[++b],R==="b"){for(b++;b<p;b++){if(R=s[b],R!=="0"&&R!=="1")return!1;O=!0}return O&&isFinite(h(s))}if(R==="x"){for(b++;b<p;b++){if(!c(s.charCodeAt(b)))return!1;O=!0}return O&&isFinite(h(s))}if(R==="o"){for(b++;b<p;b++){if(!g(s.charCodeAt(b)))return!1;O=!0}return O&&isFinite(h(s))}}for(;b<p;b++){if(!l(s.charCodeAt(b)))return!1;O=!0}return O?isFinite(h(s)):!1}function h(s){let p=s,b=1,O=p[0];if((O==="-"||O==="+")&&(O==="-"&&(b=-1),p=p.slice(1),O=p[0]),p==="0")return 0;if(O==="0"){if(p[1]==="b")return b*parseInt(p.slice(2),2);if(p[1]==="x")return b*parseInt(p.slice(2),16);if(p[1]==="o")return b*parseInt(p.slice(2),8)}return b*parseInt(p,10)}function u(s){return h(s)}function x(s){return Object.prototype.toString.call(s)==="[object Number]"&&s%1===0&&!r.isNegativeZero(s)}return mn=new i("tag:yaml.org,2002:int",{kind:"scalar",resolve:d,construct:u,predicate:x,represent:{binary:function(s){return s>=0?"0b"+s.toString(2):"-0b"+s.toString(2).slice(1)},octal:function(s){return s>=0?"0o"+s.toString(8):"-0o"+s.toString(8).slice(1)},decimal:function(s){return s.toString(10)},hexadecimal:function(s){return s>=0?"0x"+s.toString(16).toUpperCase():"-0x"+s.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),mn}var gn,lr;function wr(){if(lr)return gn;lr=1;let r=xe(),i=j(),c=new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),g=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function l(s){return s===null||!c.test(s)?!1:isFinite(parseFloat(s,10))?!0:g.test(s)}function d(s){let p=s.toLowerCase(),b=p[0]==="-"?-1:1;return"+-".indexOf(p[0])>=0&&(p=p.slice(1)),p===".inf"?b===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:p===".nan"?NaN:b*parseFloat(p,10)}let h=/^[-+]?[0-9]+e/;function u(s,p){if(isNaN(s))switch(p){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===s)switch(p){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===s)switch(p){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(r.isNegativeZero(s))return"-0.0";let b=s.toString(10);return h.test(b)?b.replace("e",".e"):b}function x(s){return Object.prototype.toString.call(s)==="[object Number]"&&(s%1!==0||r.isNegativeZero(s))}return gn=new i("tag:yaml.org,2002:float",{kind:"scalar",resolve:l,construct:d,predicate:x,represent:u,defaultStyle:"lowercase"}),gn}var yn,cr;function Ir(){return cr||(cr=1,yn=Tr().extend({implicit:[vr(),br(),Cr(),wr()]})),yn}var _n,ur;function Lr(){return ur||(ur=1,_n=Ir()),_n}var An,sr;function Or(){if(sr)return An;sr=1;let r=j(),i=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),c=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function g(h){return h===null?!1:i.exec(h)!==null||c.exec(h)!==null}function l(h){let u=0,x=null,s=i.exec(h);if(s===null&&(s=c.exec(h)),s===null)throw new Error("Date resolve error");let p=+s[1],b=+s[2]-1,O=+s[3];if(!s[4])return new Date(Date.UTC(p,b,O));let R=+s[4],z=+s[5],M=+s[6];if(s[7]){for(u=s[7].slice(0,3);u.length<3;)u+="0";u=+u}if(s[9]){let ne=+s[10],U=+(s[11]||0);x=(ne*60+U)*6e4,s[9]==="-"&&(x=-x)}let K=new Date(Date.UTC(p,b,O,R,z,M,u));return x&&K.setTime(K.getTime()-x),K}function d(h){return h.toISOString()}return An=new r("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:g,construct:l,instanceOf:Date,represent:d}),An}var En,fr;function kr(){if(fr)return En;fr=1;let r=j();function i(c){return c==="<<"||c===null}return En=new r("tag:yaml.org,2002:merge",{kind:"scalar",resolve:i}),En}var Sn,ar;function Nr(){if(ar)return Sn;ar=1;let r=j(),i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
11
|
+
\r`;function c(h){if(h===null)return!1;let u=0,x=h.length,s=i;for(let p=0;p<x;p++){let b=s.indexOf(h.charAt(p));if(!(b>64)){if(b<0)return!1;u+=6}}return u%8===0}function g(h){let u=h.replace(/[\r\n=]/g,""),x=u.length,s=i,p=0,b=[];for(let R=0;R<x;R++)R%4===0&&R&&(b.push(p>>16&255),b.push(p>>8&255),b.push(p&255)),p=p<<6|s.indexOf(u.charAt(R));let O=x%4*6;return O===0?(b.push(p>>16&255),b.push(p>>8&255),b.push(p&255)):O===18?(b.push(p>>10&255),b.push(p>>2&255)):O===12&&b.push(p>>4&255),new Uint8Array(b)}function l(h){let u="",x=0,s=h.length,p=i;for(let O=0;O<s;O++)O%3===0&&O&&(u+=p[x>>18&63],u+=p[x>>12&63],u+=p[x>>6&63],u+=p[x&63]),x=(x<<8)+h[O];let b=s%3;return b===0?(u+=p[x>>18&63],u+=p[x>>12&63],u+=p[x>>6&63],u+=p[x&63]):b===2?(u+=p[x>>10&63],u+=p[x>>4&63],u+=p[x<<2&63],u+=p[64]):b===1&&(u+=p[x>>2&63],u+=p[x<<4&63],u+=p[64],u+=p[64]),u}function d(h){return Object.prototype.toString.call(h)==="[object Uint8Array]"}return Sn=new r("tag:yaml.org,2002:binary",{kind:"scalar",resolve:c,construct:g,predicate:d,represent:l}),Sn}var xn,pr;function Rr(){if(pr)return xn;pr=1;let r=j(),i=Object.prototype.hasOwnProperty,c=Object.prototype.toString;function g(d){if(d===null)return!0;let h={},u=d;for(let x=0,s=u.length;x<s;x+=1){let p=u[x],b=!1;if(c.call(p)!=="[object Object]")return!1;let O;for(O in p)if(i.call(p,O))if(!b)b=!0;else return!1;if(!b||i.call(h,O))return!1;Object.defineProperty(h,O,{value:!0})}return!0}function l(d){return d!==null?d:[]}return xn=new r("tag:yaml.org,2002:omap",{kind:"sequence",resolve:g,construct:l}),xn}var Tn,dr;function Mr(){if(dr)return Tn;dr=1;let r=j(),i=Object.prototype.toString;function c(l){if(l===null)return!0;let d=l,h=new Array(d.length);for(let u=0,x=d.length;u<x;u+=1){let s=d[u];if(i.call(s)!=="[object Object]")return!1;let p=Object.keys(s);if(p.length!==1)return!1;h[u]=[p[0],s[p[0]]]}return!0}function g(l){if(l===null)return[];let d=l,h=new Array(d.length);for(let u=0,x=d.length;u<x;u+=1){let s=d[u],p=Object.keys(s);h[u]=[p[0],s[p[0]]]}return h}return Tn=new r("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:c,construct:g}),Tn}var vn,hr;function Pr(){if(hr)return vn;hr=1;let r=j(),i=Object.prototype.hasOwnProperty;function c(l){if(l===null)return!0;let d=l;for(let h in d)if(i.call(d,h)&&d[h]!==null)return!1;return!0}function g(l){return l!==null?l:{}}return vn=new r("tag:yaml.org,2002:set",{kind:"mapping",resolve:c,construct:g}),vn}var bn,mr;function wn(){return mr||(mr=1,bn=Lr().extend({implicit:[Or(),kr()],explicit:[Nr(),Rr(),Mr(),Pr()]})),bn}var gr;function si(){if(gr)return Ue;gr=1;let r=xe(),i=Te(),c=ui(),g=wn(),l=Object.prototype.hasOwnProperty,d=1,h=2,u=3,x=4,s=1,p=2,b=3,O=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,R=/[\x85\u2028\u2029]/,z=/[,\[\]{}]/,M=/^(?:!|!!|![0-9A-Za-z-]+!)$/,K=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function ne(e){return Object.prototype.toString.call(e)}function U(e){return e===10||e===13}function H(e){return e===9||e===32}function D(e){return e===9||e===32||e===10||e===13}function W(e){return e===44||e===91||e===93||e===123||e===125}function Be(e){if(e>=48&&e<=57)return e-48;let o=e|32;return o>=97&&o<=102?o-97+10:-1}function Ke(e){return e===120?2:e===117?4:e===85?8:0}function ve(e){return e>=48&&e<=57?e-48:-1}function ae(e){switch(e){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
|
|
12
|
+
`;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"\x85";case 95:return"\xA0";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function Ge(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function pe(e,o,y){o==="__proto__"?Object.defineProperty(e,o,{configurable:!0,enumerable:!0,writable:!0,value:y}):e[o]=y}let be=new Array(256),de=new Array(256);for(let e=0;e<256;e++)be[e]=ae(e)?1:0,de[e]=ae(e);function F(e,o){this.input=e,this.filename=o.filename||null,this.schema=o.schema||g,this.onWarning=o.onWarning||null,this.legacy=o.legacy||!1,this.json=o.json||!1,this.listener=o.listener||null,this.maxDepth=typeof o.maxDepth=="number"?o.maxDepth:100,this.maxTotalMergeKeys=typeof o.maxTotalMergeKeys=="number"?o.maxTotalMergeKeys:1e4,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.totalMergeKeys=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function Ce(e,o){let y={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return y.snippet=c(y),new i(o,y)}function w(e,o){throw Ce(e,o)}function te(e,o){e.onWarning&&e.onWarning.call(null,Ce(e,o))}function $(e,o,y){let _=e.anchorMapTransactions;if(_.length!==0){let a=_[_.length-1];l.call(a,o)||(a[o]={existed:l.call(e.anchorMap,o),value:e.anchorMap[o]})}e.anchorMap[o]=y}function $e(e){e.anchorMapTransactions.push(Object.create(null))}function re(e){let o=e.anchorMapTransactions.pop(),y=e.anchorMapTransactions;if(y.length===0)return;let _=y[y.length-1],a=Object.keys(o);for(let n=0,t=a.length;n<t;n+=1){let f=a[n];l.call(_,f)||(_[f]=o[f])}}function Ve(e){let o=e.anchorMapTransactions.pop(),y=Object.keys(o);for(let _=y.length-1;_>=0;_-=1){let a=o[y[_]];a.existed?e.anchorMap[y[_]]=a.value:delete e.anchorMap[y[_]]}}function he(e){return{position:e.position,line:e.line,lineStart:e.lineStart,lineIndent:e.lineIndent,firstTabInLine:e.firstTabInLine,tag:e.tag,anchor:e.anchor,kind:e.kind,result:e.result}}function le(e,o){e.position=o.position,e.line=o.line,e.lineStart=o.lineStart,e.lineIndent=o.lineIndent,e.firstTabInLine=o.firstTabInLine,e.tag=o.tag,e.anchor=o.anchor,e.kind=o.kind,e.result=o.result}let we={YAML:function(o,y,_){o.version!==null&&w(o,"duplication of %YAML directive"),_.length!==1&&w(o,"YAML directive accepts exactly one argument");let a=/^([0-9]+)\.([0-9]+)$/.exec(_[0]);a===null&&w(o,"ill-formed argument of the YAML directive");let n=parseInt(a[1],10),t=parseInt(a[2],10);n!==1&&w(o,"unacceptable YAML version of the document"),o.version=_[0],o.checkLineBreaks=t<2,t!==1&&t!==2&&te(o,"unsupported YAML version of the document")},TAG:function(o,y,_){let a;_.length!==2&&w(o,"TAG directive accepts exactly two arguments");let n=_[0];a=_[1],M.test(n)||w(o,"ill-formed tag handle (first argument) of the TAG directive"),l.call(o.tagMap,n)&&w(o,'there is a previously declared suffix for "'+n+'" tag handle'),K.test(a)||w(o,"ill-formed tag prefix (second argument) of the TAG directive");try{a=decodeURIComponent(a)}catch{w(o,"tag prefix is malformed: "+a)}o.tagMap[n]=a}};function q(e,o,y,_){if(o<y){let a=e.input.slice(o,y);if(_)for(let n=0,t=a.length;n<t;n+=1){let f=a.charCodeAt(n);f===9||f>=32&&f<=1114111||w(e,"expected valid JSON character")}else O.test(a)&&w(e,"the stream contains non-printable characters");e.result+=a}}function X(e){e.totalMergeKeys++,e.maxTotalMergeKeys!==-1&&e.totalMergeKeys>e.maxTotalMergeKeys&&w(e,"merge keys exceeded maxTotalMergeKeys ("+e.maxTotalMergeKeys+")")}function me(e,o,y,_){r.isObject(y)||w(e,"cannot merge mappings; the provided source object is unacceptable"),X(e);let a=Object.keys(y);for(let n=0,t=a.length;n<t;n+=1){let f=a[n];X(e),l.call(o,f)||(pe(o,f,y[f]),_[f]=!0)}}function V(e,o,y,_,a,n,t,f,E){if(Array.isArray(a)){a=Array.prototype.slice.call(a);for(let S=0,T=a.length;S<T;S+=1)Array.isArray(a[S])&&w(e,"nested arrays are not supported inside keys"),typeof a=="object"&&ne(a[S])==="[object Object]"&&(a[S]="[object Object]")}if(typeof a=="object"&&ne(a)==="[object Object]"&&(a="[object Object]"),a=String(a),o===null&&(o={}),_==="tag:yaml.org,2002:merge")if(Array.isArray(n)){n.length>100&&w(e,"abnormal merge sequence size");for(let S=0,T=n.length;S<T;S+=1)me(e,o,n[S],y)}else me(e,o,n,y);else!e.json&&!l.call(y,a)&&l.call(o,a)&&(e.line=t||e.line,e.lineStart=f||e.lineStart,e.position=E||e.position,w(e,"duplicated mapping key")),pe(o,a,n),delete y[a];return o}function ge(e){let o=e.input.charCodeAt(e.position);o===10?e.position++:o===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):w(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function P(e,o,y){let _=0,a=e.input.charCodeAt(e.position);for(;a!==0;){for(;H(a);)a===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),a=e.input.charCodeAt(++e.position);if(o&&a===35)do a=e.input.charCodeAt(++e.position);while(a!==10&&a!==13&&a!==0);if(U(a))for(ge(e),a=e.input.charCodeAt(e.position),_++,e.lineIndent=0;a===32;)e.lineIndent++,a=e.input.charCodeAt(++e.position);else break}return y!==-1&&_!==0&&e.lineIndent<y&&te(e,"deficient indentation"),_}function G(e){let o=e.position,y=e.input.charCodeAt(o);return!!((y===45||y===46)&&y===e.input.charCodeAt(o+1)&&y===e.input.charCodeAt(o+2)&&(o+=3,y=e.input.charCodeAt(o),y===0||D(y)))}function ce(e,o){o===1?e.result+=" ":o>1&&(e.result+=r.repeat(`
|
|
13
|
+
`,o-1))}function Ie(e,o,y){let _,a,n,t,f,E,S=e.kind,T=e.result,m=e.input.charCodeAt(e.position);if(D(m)||W(m)||m===35||m===38||m===42||m===33||m===124||m===62||m===39||m===34||m===37||m===64||m===96)return!1;if(m===63||m===45){let v=e.input.charCodeAt(e.position+1);if(D(v)||y&&W(v))return!1}for(e.kind="scalar",e.result="",_=a=e.position,n=!1;m!==0;){if(m===58){let v=e.input.charCodeAt(e.position+1);if(D(v)||y&&W(v))break}else if(m===35){let v=e.input.charCodeAt(e.position-1);if(D(v))break}else{if(e.position===e.lineStart&&G(e)||y&&W(m))break;if(U(m))if(t=e.line,f=e.lineStart,E=e.lineIndent,P(e,!1,-1),e.lineIndent>=o){n=!0,m=e.input.charCodeAt(e.position);continue}else{e.position=a,e.line=t,e.lineStart=f,e.lineIndent=E;break}}n&&(q(e,_,a,!1),ce(e,e.line-t),_=a=e.position,n=!1),H(m)||(a=e.position+1),m=e.input.charCodeAt(++e.position)}return q(e,_,a,!1),e.result?!0:(e.kind=S,e.result=T,!1)}function ye(e,o){let y,_,a=e.input.charCodeAt(e.position);if(a!==39)return!1;for(e.kind="scalar",e.result="",e.position++,y=_=e.position;(a=e.input.charCodeAt(e.position))!==0;)if(a===39)if(q(e,y,e.position,!0),a=e.input.charCodeAt(++e.position),a===39)y=e.position,e.position++,_=e.position;else return!0;else U(a)?(q(e,y,_,!0),ce(e,P(e,!1,o)),y=_=e.position):e.position===e.lineStart&&G(e)?w(e,"unexpected end of the document within a single quoted scalar"):(e.position++,H(a)||(_=e.position));w(e,"unexpected end of the stream within a single quoted scalar")}function Le(e,o){let y,_,a,n=e.input.charCodeAt(e.position);if(n!==34)return!1;for(e.kind="scalar",e.result="",e.position++,y=_=e.position;(n=e.input.charCodeAt(e.position))!==0;){if(n===34)return q(e,y,e.position,!0),e.position++,!0;if(n===92){if(q(e,y,e.position,!0),n=e.input.charCodeAt(++e.position),U(n))P(e,!1,o);else if(n<256&&be[n])e.result+=de[n],e.position++;else if((a=Ke(n))>0){let t=a,f=0;for(;t>0;t--)n=e.input.charCodeAt(++e.position),(a=Be(n))>=0?f=(f<<4)+a:w(e,"expected hexadecimal character");e.result+=Ge(f),e.position++}else w(e,"unknown escape sequence");y=_=e.position}else U(n)?(q(e,y,_,!0),ce(e,P(e,!1,o)),y=_=e.position):e.position===e.lineStart&&G(e)?w(e,"unexpected end of the document within a double quoted scalar"):(e.position++,H(n)||(_=e.position))}w(e,"unexpected end of the stream within a double quoted scalar")}function Oe(e,o){let y=!0,_,a,n,t=e.tag,f,E=e.anchor,S,T,m,v,C=Object.create(null),I,L,k,N=e.input.charCodeAt(e.position);if(N===91)S=93,v=!1,f=[];else if(N===123)S=125,v=!0,f={};else return!1;for(e.anchor!==null&&$(e,e.anchor,f),N=e.input.charCodeAt(++e.position);N!==0;){if(P(e,!0,o),N=e.input.charCodeAt(e.position),N===S)return e.position++,e.tag=t,e.anchor=E,e.kind=v?"mapping":"sequence",e.result=f,!0;if(y?N===44&&w(e,"expected the node content, but found ','"):w(e,"missed comma between flow collection entries"),L=I=k=null,T=m=!1,N===63){let Z=e.input.charCodeAt(e.position+1);D(Z)&&(T=m=!0,e.position++,P(e,!0,o))}_=e.line,a=e.lineStart,n=e.position,Q(e,o,d,!1,!0),L=e.tag,I=e.result,P(e,!0,o),N=e.input.charCodeAt(e.position),(m||e.line===_)&&N===58&&(T=!0,N=e.input.charCodeAt(++e.position),P(e,!0,o),Q(e,o,d,!1,!0),k=e.result),v?V(e,f,C,L,I,k,_,a,n):T?f.push(V(e,null,C,L,I,k,_,a,n)):f.push(I),P(e,!0,o),N=e.input.charCodeAt(e.position),N===44?(y=!0,N=e.input.charCodeAt(++e.position)):y=!1}w(e,"unexpected end of the stream within a flow collection")}function J(e,o){let y,_=s,a=!1,n=!1,t=o,f=0,E=!1,S,T=e.input.charCodeAt(e.position);if(T===124)y=!1;else if(T===62)y=!0;else return!1;for(e.kind="scalar",e.result="";T!==0;)if(T=e.input.charCodeAt(++e.position),T===43||T===45)s===_?_=T===43?b:p:w(e,"repeat of a chomping mode identifier");else if((S=ve(T))>=0)S===0?w(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):n?w(e,"repeat of an indentation width identifier"):(t=o+S-1,n=!0);else break;if(H(T)){do T=e.input.charCodeAt(++e.position);while(H(T));if(T===35)do T=e.input.charCodeAt(++e.position);while(!U(T)&&T!==0)}for(;T!==0;){for(ge(e),e.lineIndent=0,T=e.input.charCodeAt(e.position);(!n||e.lineIndent<t)&&T===32;)e.lineIndent++,T=e.input.charCodeAt(++e.position);if(!n&&e.lineIndent>t&&(t=e.lineIndent),U(T)){f++;continue}if(!n&&t===0&&w(e,"missing indentation for block scalar"),e.lineIndent<t){_===b?e.result+=r.repeat(`
|
|
14
|
+
`,a?1+f:f):_===s&&a&&(e.result+=`
|
|
15
|
+
`);break}y?H(T)?(E=!0,e.result+=r.repeat(`
|
|
16
|
+
`,a?1+f:f)):E?(E=!1,e.result+=r.repeat(`
|
|
17
|
+
`,f+1)):f===0?a&&(e.result+=" "):e.result+=r.repeat(`
|
|
18
|
+
`,f):e.result+=r.repeat(`
|
|
19
|
+
`,a?1+f:f),a=!0,n=!0,f=0;let m=e.position;for(;!U(T)&&T!==0;)T=e.input.charCodeAt(++e.position);q(e,m,e.position,!1)}return!0}function ke(e,o){let y=e.tag,_=e.anchor,a=[],n=!1;if(e.firstTabInLine!==-1)return!1;e.anchor!==null&&$(e,e.anchor,a);let t=e.input.charCodeAt(e.position);for(;t!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,w(e,"tab characters must not be used in indentation")),t===45);){let f=e.input.charCodeAt(e.position+1);if(!D(f))break;if(n=!0,e.position++,P(e,!0,-1)&&e.lineIndent<=o){a.push(null),t=e.input.charCodeAt(e.position);continue}let E=e.line;if(Q(e,o,u,!1,!0),a.push(e.result),P(e,!0,-1),t=e.input.charCodeAt(e.position),(e.line===E||e.lineIndent>o)&&t!==0)w(e,"bad indentation of a sequence entry");else if(e.lineIndent<o)break}return n?(e.tag=y,e.anchor=_,e.kind="sequence",e.result=a,!0):!1}function Ne(e,o,y){let _,a,n,t,f=e.tag,E=e.anchor,S={},T=Object.create(null),m=null,v=null,C=null,I=!1,L=!1;if(e.firstTabInLine!==-1)return!1;e.anchor!==null&&$(e,e.anchor,S);let k=e.input.charCodeAt(e.position);for(;k!==0;){!I&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,w(e,"tab characters must not be used in indentation"));let N=e.input.charCodeAt(e.position+1),Z=e.line;if((k===63||k===58)&&D(N))k===63?(I&&(V(e,S,T,m,v,null,a,n,t),m=v=C=null),L=!0,I=!0,_=!0):I?(I=!1,_=!0):w(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,k=N;else{if(a=e.line,n=e.lineStart,t=e.position,!Q(e,y,h,!1,!0))break;if(e.line===Z){for(k=e.input.charCodeAt(e.position);H(k);)k=e.input.charCodeAt(++e.position);if(k===58)k=e.input.charCodeAt(++e.position),D(k)||w(e,"a whitespace character is expected after the key-value separator within a block mapping"),I&&(V(e,S,T,m,v,null,a,n,t),m=v=C=null),L=!0,I=!1,_=!1,m=e.tag,v=e.result;else if(L)w(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=f,e.anchor=E,!0}else if(L)w(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=f,e.anchor=E,!0}if((e.line===Z||e.lineIndent>o)&&(I&&(a=e.line,n=e.lineStart,t=e.position),Q(e,o,x,!0,_)&&(I?v=e.result:C=e.result),I||(V(e,S,T,m,v,C,a,n,t),m=v=C=null),P(e,!0,-1),k=e.input.charCodeAt(e.position)),(e.line===Z||e.lineIndent>o)&&k!==0)w(e,"bad indentation of a mapping entry");else if(e.lineIndent<o)break}return I&&V(e,S,T,m,v,null,a,n,t),L&&(e.tag=f,e.anchor=E,e.kind="mapping",e.result=S),L}function Re(e){let o=!1,y=!1,_,a,n=e.input.charCodeAt(e.position);if(n!==33)return!1;e.tag!==null&&w(e,"duplication of a tag property"),n=e.input.charCodeAt(++e.position),n===60?(o=!0,n=e.input.charCodeAt(++e.position)):n===33?(y=!0,_="!!",n=e.input.charCodeAt(++e.position)):_="!";let t=e.position;if(o){do n=e.input.charCodeAt(++e.position);while(n!==0&&n!==62);e.position<e.length?(a=e.input.slice(t,e.position),n=e.input.charCodeAt(++e.position)):w(e,"unexpected end of the stream within a verbatim tag")}else{for(;n!==0&&!D(n);)n===33&&(y?w(e,"tag suffix cannot contain exclamation marks"):(_=e.input.slice(t-1,e.position+1),M.test(_)||w(e,"named tag handle cannot contain such characters"),y=!0,t=e.position+1)),n=e.input.charCodeAt(++e.position);a=e.input.slice(t,e.position),z.test(a)&&w(e,"tag suffix cannot contain flow indicator characters")}a&&!K.test(a)&&w(e,"tag name cannot contain such characters: "+a);try{a=decodeURIComponent(a)}catch{w(e,"tag name is malformed: "+a)}return o?e.tag=a:l.call(e.tagMap,_)?e.tag=e.tagMap[_]+a:_==="!"?e.tag="!"+a:_==="!!"?e.tag="tag:yaml.org,2002:"+a:w(e,'undeclared tag handle "'+_+'"'),!0}function Me(e){let o=e.input.charCodeAt(e.position);if(o!==38)return!1;e.anchor!==null&&w(e,"duplication of an anchor property"),o=e.input.charCodeAt(++e.position);let y=e.position;for(;o!==0&&!D(o)&&!W(o);)o=e.input.charCodeAt(++e.position);return e.position===y&&w(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(y,e.position),!0}function ze(e){let o=e.input.charCodeAt(e.position);if(o!==42)return!1;o=e.input.charCodeAt(++e.position);let y=e.position;for(;o!==0&&!D(o)&&!W(o);)o=e.input.charCodeAt(++e.position);e.position===y&&w(e,"name of an alias node must contain at least one character");let _=e.input.slice(y,e.position);return l.call(e.anchorMap,_)||w(e,'unidentified alias "'+_+'"'),e.result=e.anchorMap[_],P(e,!0,-1),!0}function Pe(e,o,y,_){let a=he(e);return $e(e),le(e,o),e.tag=null,e.anchor=null,e.kind=null,e.result=null,Ne(e,y,_)&&e.kind==="mapping"?(re(e),!0):(Ve(e),le(e,a),!1)}function Q(e,o,y,_,a){let n,t,f=1,E=!1,S=!1,T=null,m,v,C;e.depth>=e.maxDepth&&w(e,"nesting exceeded maxDepth ("+e.maxDepth+")"),e.depth+=1,e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null;let I=n=t=x===y||u===y;if(_&&P(e,!0,-1)&&(E=!0,e.lineIndent>o?f=1:e.lineIndent===o?f=0:e.lineIndent<o&&(f=-1)),f===1)for(;;){let L=e.input.charCodeAt(e.position),k=he(e);if(E&&(L===33&&e.tag!==null||L===38&&e.anchor!==null)||!Re(e)&&!Me(e))break;T===null&&(T=k),P(e,!0,-1)?(E=!0,t=I,e.lineIndent>o?f=1:e.lineIndent===o?f=0:e.lineIndent<o&&(f=-1)):t=!1}if(t&&(t=E||a),f===1||x===y)if(d===y||h===y?v=o:v=o+1,C=e.position-e.lineStart,f===1)if(t&&(ke(e,C)||Ne(e,C,v))||Oe(e,v))S=!0;else{let L=e.input.charCodeAt(e.position);T!==null&&I&&!t&&L!==124&&L!==62&&Pe(e,T,T.position-T.lineStart,v)||n&&J(e,v)||ye(e,v)||Le(e,v)?S=!0:ze(e)?(S=!0,(e.tag!==null||e.anchor!==null)&&w(e,"alias node should not have any properties")):Ie(e,v,d===y)&&(S=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&$(e,e.anchor,e.result)}else f===0&&(S=t&&ke(e,C));if(e.tag===null)e.anchor!==null&&$(e,e.anchor,e.result);else if(e.tag==="?"){e.result!==null&&e.kind!=="scalar"&&w(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"');for(let L=0,k=e.implicitTypes.length;L<k;L+=1)if(m=e.implicitTypes[L],m.resolve(e.result)){e.result=m.construct(e.result),e.tag=m.tag,e.anchor!==null&&$(e,e.anchor,e.result);break}}else if(e.tag!=="!"){if(l.call(e.typeMap[e.kind||"fallback"],e.tag))m=e.typeMap[e.kind||"fallback"][e.tag];else{m=null;let L=e.typeMap.multi[e.kind||"fallback"];for(let k=0,N=L.length;k<N;k+=1)if(e.tag.slice(0,L[k].tag.length)===L[k].tag){m=L[k];break}}m||w(e,"unknown tag !<"+e.tag+">"),e.result!==null&&m.kind!==e.kind&&w(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+m.kind+'", not "'+e.kind+'"'),m.resolve(e.result,e.tag)?(e.result=m.construct(e.result,e.tag),e.anchor!==null&&$(e,e.anchor,e.result)):w(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.depth-=1,e.tag!==null||e.anchor!==null||S}function We(e){let o=e.position,y=!1,_;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(_=e.input.charCodeAt(e.position))!==0&&(P(e,!0,-1),_=e.input.charCodeAt(e.position),!(e.lineIndent>0||_!==37));){y=!0,_=e.input.charCodeAt(++e.position);let a=e.position;for(;_!==0&&!D(_);)_=e.input.charCodeAt(++e.position);let n=e.input.slice(a,e.position),t=[];for(n.length<1&&w(e,"directive name must not be less than one character in length");_!==0;){for(;H(_);)_=e.input.charCodeAt(++e.position);if(_===35){do _=e.input.charCodeAt(++e.position);while(_!==0&&!U(_));break}if(U(_))break;for(a=e.position;_!==0&&!D(_);)_=e.input.charCodeAt(++e.position);t.push(e.input.slice(a,e.position))}_!==0&&ge(e),l.call(we,n)?we[n](e,n,t):te(e,'unknown document directive "'+n+'"')}if(P(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,P(e,!0,-1)):y&&w(e,"directives end mark is expected"),Q(e,e.lineIndent-1,x,!1,!0),P(e,!0,-1),e.checkLineBreaks&&R.test(e.input.slice(o,e.position))&&te(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&G(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,P(e,!0,-1));return}e.position<e.length-1&&w(e,"end of the stream or a document separator is expected")}function _e(e,o){e=String(e),o=o||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
20
|
+
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));let y=new F(e,o),_=e.indexOf("\0");for(_!==-1&&(y.position=_,w(y,"null byte is not allowed in input")),y.input+="\0";y.input.charCodeAt(y.position)===32;)y.lineIndent+=1,y.position+=1;for(;y.position<y.length-1;)We(y);return y.documents}function Xe(e,o,y){o!==null&&typeof o=="object"&&typeof y>"u"&&(y=o,o=null);let _=_e(e,y);if(typeof o!="function")return _;for(let a=0,n=_.length;a<n;a+=1)o(_[a])}function Je(e,o){let y=_e(e,o);if(y.length!==0){if(y.length===1)return y[0];throw new i("expected a single document in the stream, but found more")}}return Ue.loadAll=Xe,Ue.load=Je,Ue}var Cn={},yr;function fi(){if(yr)return Cn;yr=1;let r=xe(),i=Te(),c=wn(),g=Object.prototype.toString,l=Object.prototype.hasOwnProperty,d=65279,h=9,u=10,x=13,s=32,p=33,b=34,O=35,R=37,z=38,M=39,K=42,ne=44,U=45,H=58,D=61,W=62,Be=63,Ke=64,ve=91,ae=93,Ge=96,pe=123,be=124,de=125,F={};F[0]="\\0",F[7]="\\a",F[8]="\\b",F[9]="\\t",F[10]="\\n",F[11]="\\v",F[12]="\\f",F[13]="\\r",F[27]="\\e",F[34]='\\"',F[92]="\\\\",F[133]="\\N",F[160]="\\_",F[8232]="\\L",F[8233]="\\P";let Ce=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],w=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function te(n,t){if(t===null)return{};let f={},E=Object.keys(t);for(let S=0,T=E.length;S<T;S+=1){let m=E[S],v=String(t[m]);m.slice(0,2)==="!!"&&(m="tag:yaml.org,2002:"+m.slice(2));let C=n.compiledTypeMap.fallback[m];C&&l.call(C.styleAliases,v)&&(v=C.styleAliases[v]),f[m]=v}return f}function $(n){let t,f,E=n.toString(16).toUpperCase();if(n<=255)t="x",f=2;else if(n<=65535)t="u",f=4;else if(n<=4294967295)t="U",f=8;else throw new i("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+t+r.repeat("0",f-E.length)+E}let $e=1,re=2;function Ve(n){this.schema=n.schema||c,this.indent=Math.max(1,n.indent||2),this.noArrayIndent=n.noArrayIndent||!1,this.skipInvalid=n.skipInvalid||!1,this.flowLevel=r.isNothing(n.flowLevel)?-1:n.flowLevel,this.styleMap=te(this.schema,n.styles||null),this.sortKeys=n.sortKeys||!1,this.lineWidth=n.lineWidth||80,this.noRefs=n.noRefs||!1,this.noCompatMode=n.noCompatMode||!1,this.condenseFlow=n.condenseFlow||!1,this.quotingType=n.quotingType==='"'?re:$e,this.forceQuotes=n.forceQuotes||!1,this.replacer=typeof n.replacer=="function"?n.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function he(n,t){let f=r.repeat(" ",t),E=0,S="",T=n.length;for(;E<T;){let m,v=n.indexOf(`
|
|
21
|
+
`,E);v===-1?(m=n.slice(E),E=T):(m=n.slice(E,v+1),E=v+1),m.length&&m!==`
|
|
22
|
+
`&&(S+=f),S+=m}return S}function le(n,t){return`
|
|
23
|
+
`+r.repeat(" ",n.indent*t)}function we(n,t){for(let f=0,E=n.implicitTypes.length;f<E;f+=1)if(n.implicitTypes[f].resolve(t))return!0;return!1}function q(n){return n===s||n===h}function X(n){return n>=32&&n<=126||n>=161&&n<=55295&&n!==8232&&n!==8233||n>=57344&&n<=65533&&n!==d||n>=65536&&n<=1114111}function me(n){return X(n)&&n!==d&&n!==x&&n!==u}function V(n,t,f){let E=me(n),S=E&&!q(n);return(f?E:E&&n!==ne&&n!==ve&&n!==ae&&n!==pe&&n!==de)&&n!==O&&!(t===H&&!S)||me(t)&&!q(t)&&n===O||t===H&&S}function ge(n){return X(n)&&n!==d&&!q(n)&&n!==U&&n!==Be&&n!==H&&n!==ne&&n!==ve&&n!==ae&&n!==pe&&n!==de&&n!==O&&n!==z&&n!==K&&n!==p&&n!==be&&n!==D&&n!==W&&n!==M&&n!==b&&n!==R&&n!==Ke&&n!==Ge}function P(n){return!q(n)&&n!==H}function G(n,t){let f=n.charCodeAt(t),E;return f>=55296&&f<=56319&&t+1<n.length&&(E=n.charCodeAt(t+1),E>=56320&&E<=57343)?(f-55296)*1024+E-56320+65536:f}function ce(n){return/^\n* /.test(n)}let Ie=1,ye=2,Le=3,Oe=4,J=5;function ke(n,t,f,E,S,T,m,v){let C,I=0,L=null,k=!1,N=!1,Z=E!==-1,Ae=-1,Ee=ge(G(n,0))&&P(G(n,n.length-1));if(t||m)for(C=0;C<n.length;I>=65536?C+=2:C++){if(I=G(n,C),!X(I))return J;Ee=Ee&&V(I,L,v),L=I}else{for(C=0;C<n.length;I>=65536?C+=2:C++){if(I=G(n,C),I===u)k=!0,Z&&(N=N||C-Ae-1>E&&n[Ae+1]!==" ",Ae=C);else if(!X(I))return J;Ee=Ee&&V(I,L,v),L=I}N=N||Z&&C-Ae-1>E&&n[Ae+1]!==" "}return!k&&!N?Ee&&!m&&!S(n)?Ie:T===re?J:ye:f>9&&ce(n)?J:m?T===re?J:ye:N?Oe:Le}function Ne(n,t,f,E,S){n.dump=(function(){if(t.length===0)return n.quotingType===re?'""':"''";if(!n.noCompatMode&&(Ce.indexOf(t)!==-1||w.test(t)))return n.quotingType===re?'"'+t+'"':"'"+t+"'";let T=n.indent*Math.max(1,f),m=n.lineWidth===-1?-1:Math.max(Math.min(n.lineWidth,40),n.lineWidth-T),v=E||n.flowLevel>-1&&f>=n.flowLevel;function C(I){return we(n,I)}switch(ke(t,v,n.indent,m,C,n.quotingType,n.forceQuotes&&!E,S)){case Ie:return t;case ye:return"'"+t.replace(/'/g,"''")+"'";case Le:return"|"+Re(t,n.indent)+Me(he(t,T));case Oe:return">"+Re(t,n.indent)+Me(he(ze(t,m),T));case J:return'"'+Q(t)+'"';default:throw new i("impossible error: invalid scalar style")}})()}function Re(n,t){let f=ce(n)?String(t):"",E=n[n.length-1]===`
|
|
24
|
+
`,T=E&&(n[n.length-2]===`
|
|
25
|
+
`||n===`
|
|
26
|
+
`)?"+":E?"":"-";return f+T+`
|
|
27
|
+
`}function Me(n){return n[n.length-1]===`
|
|
28
|
+
`?n.slice(0,-1):n}function ze(n,t){let f=/(\n+)([^\n]*)/g,E=(function(){let v=n.indexOf(`
|
|
29
|
+
`);return v=v!==-1?v:n.length,f.lastIndex=v,Pe(n.slice(0,v),t)})(),S=n[0]===`
|
|
30
|
+
`||n[0]===" ",T,m;for(;m=f.exec(n);){let v=m[1],C=m[2];T=C[0]===" ",E+=v+(!S&&!T&&C!==""?`
|
|
31
|
+
`:"")+Pe(C,t),S=T}return E}function Pe(n,t){if(n===""||n[0]===" ")return n;let f=/ [^ ]/g,E,S=0,T,m=0,v=0,C="";for(;E=f.exec(n);)v=E.index,v-S>t&&(T=m>S?m:v,C+=`
|
|
32
|
+
`+n.slice(S,T),S=T+1),m=v;return C+=`
|
|
33
|
+
`,n.length-S>t&&m>S?C+=n.slice(S,m)+`
|
|
34
|
+
`+n.slice(m+1):C+=n.slice(S),C.slice(1)}function Q(n){let t="",f=0;for(let E=0;E<n.length;f>=65536?E+=2:E++){f=G(n,E);let S=F[f];!S&&X(f)?(t+=n[E],f>=65536&&(t+=n[E+1])):t+=S||$(f)}return t}function We(n,t,f){let E="",S=n.tag;for(let T=0,m=f.length;T<m;T+=1){let v=f[T];n.replacer&&(v=n.replacer.call(f,String(T),v)),(o(n,t,v,!1,!1)||typeof v>"u"&&o(n,t,null,!1,!1))&&(E!==""&&(E+=","+(n.condenseFlow?"":" ")),E+=n.dump)}n.tag=S,n.dump="["+E+"]"}function _e(n,t,f,E){let S="",T=n.tag;for(let m=0,v=f.length;m<v;m+=1){let C=f[m];n.replacer&&(C=n.replacer.call(f,String(m),C)),(o(n,t+1,C,!0,!0,!1,!0)||typeof C>"u"&&o(n,t+1,null,!0,!0,!1,!0))&&((!E||S!=="")&&(S+=le(n,t)),n.dump&&u===n.dump.charCodeAt(0)?S+="-":S+="- ",S+=n.dump)}n.tag=T,n.dump=S||"[]"}function Xe(n,t,f){let E="",S=n.tag,T=Object.keys(f);for(let m=0,v=T.length;m<v;m+=1){let C="";E!==""&&(C+=", "),n.condenseFlow&&(C+='"');let I=T[m],L=f[I];n.replacer&&(L=n.replacer.call(f,I,L)),o(n,t,I,!1,!1)&&(n.dump.length>1024&&(C+="? "),C+=n.dump+(n.condenseFlow?'"':"")+":"+(n.condenseFlow?"":" "),o(n,t,L,!1,!1)&&(C+=n.dump,E+=C))}n.tag=S,n.dump="{"+E+"}"}function Je(n,t,f,E){let S="",T=n.tag,m=Object.keys(f);if(n.sortKeys===!0)m.sort();else if(typeof n.sortKeys=="function")m.sort(n.sortKeys);else if(n.sortKeys)throw new i("sortKeys must be a boolean or a function");for(let v=0,C=m.length;v<C;v+=1){let I="";(!E||S!=="")&&(I+=le(n,t));let L=m[v],k=f[L];if(n.replacer&&(k=n.replacer.call(f,L,k)),!o(n,t+1,L,!0,!0,!0))continue;let N=n.tag!==null&&n.tag!=="?"||n.dump&&n.dump.length>1024;N&&(n.dump&&u===n.dump.charCodeAt(0)?I+="?":I+="? "),I+=n.dump,N&&(I+=le(n,t)),o(n,t+1,k,!0,N)&&(n.dump&&u===n.dump.charCodeAt(0)?I+=":":I+=": ",I+=n.dump,S+=I)}n.tag=T,n.dump=S||"{}"}function e(n,t,f){let E=f?n.explicitTypes:n.implicitTypes;for(let S=0,T=E.length;S<T;S+=1){let m=E[S];if((m.instanceOf||m.predicate)&&(!m.instanceOf||typeof t=="object"&&t instanceof m.instanceOf)&&(!m.predicate||m.predicate(t))){if(f?m.multi&&m.representName?n.tag=m.representName(t):n.tag=m.tag:n.tag="?",m.represent){let v=n.styleMap[m.tag]||m.defaultStyle,C;if(g.call(m.represent)==="[object Function]")C=m.represent(t,v);else if(l.call(m.represent,v))C=m.represent[v](t,v);else throw new i("!<"+m.tag+'> tag resolver accepts not "'+v+'" style');n.dump=C}return!0}}return!1}function o(n,t,f,E,S,T,m){n.tag=null,n.dump=f,e(n,f,!1)||e(n,f,!0);let v=g.call(n.dump),C=E;E&&(E=n.flowLevel<0||n.flowLevel>t);let I=v==="[object Object]"||v==="[object Array]",L,k;if(I&&(L=n.duplicates.indexOf(f),k=L!==-1),(n.tag!==null&&n.tag!=="?"||k||n.indent!==2&&t>0)&&(S=!1),k&&n.usedDuplicates[L])n.dump="*ref_"+L;else{if(I&&k&&!n.usedDuplicates[L]&&(n.usedDuplicates[L]=!0),v==="[object Object]")E&&Object.keys(n.dump).length!==0?(Je(n,t,n.dump,S),k&&(n.dump="&ref_"+L+n.dump)):(Xe(n,t,n.dump),k&&(n.dump="&ref_"+L+" "+n.dump));else if(v==="[object Array]")E&&n.dump.length!==0?(n.noArrayIndent&&!m&&t>0?_e(n,t-1,n.dump,S):_e(n,t,n.dump,S),k&&(n.dump="&ref_"+L+n.dump)):(We(n,t,n.dump),k&&(n.dump="&ref_"+L+" "+n.dump));else if(v==="[object String]")n.tag!=="?"&&Ne(n,n.dump,t,T,C);else{if(v==="[object Undefined]")return!1;if(n.skipInvalid)return!1;throw new i("unacceptable kind of an object to dump "+v)}if(n.tag!==null&&n.tag!=="?"){let N=encodeURI(n.tag[0]==="!"?n.tag.slice(1):n.tag).replace(/!/g,"%21");n.tag[0]==="!"?N="!"+N:N.slice(0,18)==="tag:yaml.org,2002:"?N="!!"+N.slice(18):N="!<"+N+">",n.dump=N+" "+n.dump}}return!0}function y(n,t){let f=[],E=[];_(n,f,E);let S=E.length;for(let T=0;T<S;T+=1)t.duplicates.push(f[E[T]]);t.usedDuplicates=new Array(S)}function _(n,t,f){if(n!==null&&typeof n=="object"){let E=t.indexOf(n);if(E!==-1)f.indexOf(E)===-1&&f.push(E);else if(t.push(n),Array.isArray(n))for(let S=0,T=n.length;S<T;S+=1)_(n[S],t,f);else{let S=Object.keys(n);for(let T=0,m=S.length;T<m;T+=1)_(n[S[T]],t,f)}}}function a(n,t){t=t||{};let f=new Ve(t);f.noRefs||y(n,f);let E=n;return f.replacer&&(E=f.replacer.call({"":E},"",E)),o(f,0,E,!0,!0)?f.dump+`
|
|
35
|
+
`:""}return Cn.dump=a,Cn}var _r;function ai(){if(_r)return Y;_r=1;let r=si(),i=fi();function c(g,l){return function(){throw new Error("Function yaml."+g+" is removed in js-yaml 4. Use yaml."+l+" instead, which is now safe by default.")}}return Y.Type=j(),Y.Schema=Ar(),Y.FAILSAFE_SCHEMA=Tr(),Y.JSON_SCHEMA=Ir(),Y.CORE_SCHEMA=Lr(),Y.DEFAULT_SCHEMA=wn(),Y.load=r.load,Y.loadAll=r.loadAll,Y.dump=i.dump,Y.YAMLException=Te(),Y.types={binary:Nr(),float:wr(),map:xr(),null:vr(),pairs:Mr(),set:Pr(),timestamp:Or(),bool:br(),int:Cr(),merge:kr(),omap:Rr(),seq:Sr(),str:Er()},Y.safeLoad=c("safeLoad","load"),Y.safeLoadAll=c("safeLoadAll","loadAll"),Y.safeDump=c("safeDump","dump"),Y}var pi=ai(),fe=ci(pi),{Type:qi,Schema:Bi,FAILSAFE_SCHEMA:Ki,JSON_SCHEMA:Gi,CORE_SCHEMA:$i,DEFAULT_SCHEMA:Vi,load:zi,loadAll:Wi,dump:Xi,YAMLException:Ji,types:Qi,safeLoad:Zi,safeLoadAll:eo,safeDump:no}=fe;var Fr=(r,i,c)=>A.preprocess(g=>g===void 0||typeof g=="string"&&!g.trim()?r:g,A.union([A.number(),A.string().trim().regex(/^\d+$/,"Enter a whole number").transform(Number)]).pipe(A.number().int().min(i).max(c))),_i=Se.extend({name:A.string().trim().min(1,"Name is required"),base_url:A.url("Enter a valid HTTP(S) URL").refine(r=>/^https?:\/\//i.test(r),"Use an HTTP(S) URL"),api_key:A.string().trim().min(1,"API key is required"),model:A.string().trim().min(1,"Model is required"),thinking:A.enum(ie).optional(),context_window:Fr(1e6,1e3,1e7),max_output_tokens:Fr(128e3,1,1e6)}).refine(r=>r.max_output_tokens<=r.context_window,{path:["max_output_tokens"],message:"Max output tokens must not exceed the context window"}).transform(r=>({...r,thinking:rn(r)}));function In(r){if(!Dr(r))return{};let i;try{i=fe.load(Fe(r,"utf-8"))}catch{throw new Error(`Unable to read existing ${r}; it has not been changed.`)}return A.record(A.string(),A.unknown()).parse(i??{})}function Ln(r,i){let c=gi(r);Nn(c,{recursive:!0});let g=yi(c,`.config-${di()}.tmp`);try{Rn(g,fe.dump(i,{lineWidth:-1,noRefs:!0}),{encoding:"utf-8",mode:384,flag:"wx"}),hi(g,r)}finally{Dr(g)&&mi(g)}}function ao(r,i){let c=_i.parse(r),g=se(),l=In(g),h=[...A.array(A.record(A.string(),A.unknown())).parse(l.providers??[])];for(let p of i)h.some(b=>b.base_url===p.base_url)||h.push({...p});let u=[],x=!1;for(let p of h){if(p.base_url!==c.base_url){u.push(p);continue}x||(x=!0,u.push(c))}x||u.push(c);let s=u.map(p=>Se.parse(p));return Ln(g,{...l,providers:u}),{provider:c,providers:s,replaced:x,path:g}}function Yr(r,i,c){let g=se(),l=In(g),d=A.array(A.record(A.string(),A.unknown())).parse(l.providers??[]),h=d.filter(x=>x.base_url===r);if(h.length===0)throw new Error(`Provider with base URL "${r}" not found in ${g}.`);let u=h.filter(x=>x[i]!==c);if(u.length!==0){for(let x of u)x[i]=c;Ln(g,{...l,providers:d})}}function po(r,i){Yr(r,"thinking",i)}function ho(r,i){Yr(r,"model",i)}function mo(r){let i=se(),c=In(i);c.default_provider!==r&&Ln(i,{...c,default_provider:r})}import{existsSync as Kr,readFileSync as xi}from"fs";import{join as Ti}from"path";function On(r){return!!r._zod}function He(r,i){return On(r)?Qe(r,i):r.safeParse(i)}function No(r){if(!r)return;let i;if(On(r)?i=r._zod?.def?.shape:i=r.shape,!!i){if(typeof i=="function")try{return i()}catch{return}return i}}function Si(r){return r.length===0?"object root":r.reduce((i,c,g)=>g===0?String(c):typeof c=="number"?`${i}[${c}]`:`${i}.${c}`,"")}function jr(r){if(r&&typeof r=="object"){if("issues"in r&&Array.isArray(r.issues)&&r.issues.length>0)return r.issues.map(i=>i.path?.length?`${i.message} at ${Si(i.path)}`:i.message).join(`
|
|
36
|
+
`);if("message"in r&&typeof r.message=="string")return r.message;try{return JSON.stringify(r)}catch{return String(r)}}return String(r)}function Ro(r){if(On(r)){let d=r._zod?.def;if(d){if(d.value!==void 0)return d.value;if(Array.isArray(d.values)&&d.values.length>0)return d.values[0]}}let c=r._def;if(c){if(c.value!==void 0)return c.value;if(Array.isArray(c.values)&&c.values.length>0)return c.values[0]}let g=r.value;if(g!==void 0)return g}var qe=Pn({module:"config"});function vi(r){return Un.has(r)}var B=class extends Error{constructor(i,c){super(i,c),this.name="ConfigError"}};function Go(r){if(r.api_key)return r.api_key;let i=vi(r.protocol)?en[r.protocol]:"";return i?process.env[i]??"":""}var bi=A.object({name:A.string(),enabled:A.boolean().optional(),command:A.string().optional(),args:A.array(A.string()).optional(),url:A.string().optional(),transport:A.string().optional(),headers:A.record(A.string(),A.string()).optional(),env:A.record(A.string(),A.string()).optional()}),Ci=A.object({id:A.string().optional(),event:A.string(),condition:A.string().optional(),action:A.object({type:A.string(),command:A.string().optional(),url:A.string().optional(),method:A.string().optional(),prompt:A.string().optional()}),reject:A.boolean().optional(),once:A.boolean().optional(),async:A.boolean().optional(),on_error:A.string().optional()}),wi=A.object({enabled:A.boolean().optional(),auto_allow:A.boolean().optional(),network_enabled:A.boolean().optional()}),Ur=A.union([A.string(),A.number(),A.boolean()]).nullish().transform(r=>r==null?"":String(r)),Ii=A.union([A.record(A.string(),Ur),A.array(A.record(A.string(),Ur)),A.null()]).transform(r=>{if(r===null)return{};if(!Array.isArray(r))return r;let i={};for(let c of r)for(let[g,l]of Object.entries(c))i[g]=l;return i}),Gr=A.looseObject({default_provider:A.number().default(0),providers:A.array(Se),permission_mode:A.enum(["default","acceptEdits","plan","bypassPermissions"]).optional(),mcp_loading:A.enum(Hn).default("auto"),theme:A.enum(qn).default("auto"),mcp_servers:A.array(bi).default([]),hooks:A.array(Ci).default([]),sandbox:wi.optional(),enable_coordinator_mode:A.boolean().optional(),enable_memory:A.boolean().optional(),env:Ii.optional()});function $o(r){return r.enable_memory!==!1}function Li(r){if(r)for(let[i,c]of Object.entries(r))process.env[i]===void 0&&(process.env[i]=c)}function Vo(){try{Pi(void 0,{allowEmptyProviders:!0})}catch{}}function Oi(r){if(!r||typeof r!="object")return nn;let i=Ze(r),c=typeof i.reason=="string"&&i.reason.length>0?i.reason:nn,g=Ze(i.mark);if(typeof g.line=="number"){let l=String(g.line+1),d=typeof g.column=="number"?`, column ${String(g.column+1)}`:"";return`${c} (line ${l}${d})`}return c}function Hr(r){let i=Fe(r,"utf-8"),c;try{c=fe.load(i)}catch(d){throw new B(`Invalid YAML in ${r}: ${Oi(d)}`,{cause:d})}let g=He(Gr,c);if(!g.success)throw new B(`Invalid configuration in ${r}: ${jr(g.error)}`);let l=g.data;return Li(l.env),{...l,providers:l.providers.map(Gn)}}function qr(r){if(r.providers.length===0)throw new B(Kn);let i=["name","protocol","base_url","model"],c=new Map;for(let g=0;g<r.providers.length;g++){let l=r.providers[g],d={name:l.name,protocol:l.protocol,base_url:l.base_url,model:l.model},h=i.filter(x=>!d[x].trim());if(h.length>0)throw new B(`Provider #${String(g+1)}: missing fields: ${h.join(", ")}`);let u=c.get(l.base_url);if(u!==void 0)throw new B(`Provider #${String(g+1)}: duplicate base_url '${l.base_url}' (already used by provider #${String(u+1)}).`);c.set(l.base_url,g)}}function Br(r){let i=new Map;for(let c=0;c<r.mcp_servers.length;c++){let g=r.mcp_servers[c],l=`MCP server #${String(c+1)}`;if(!g.name.trim())throw new B(`${l}: name must not be empty.`);let d=i.get(g.name);if(d!==void 0)throw new B(`${l}: duplicate name '${g.name}' (already used by MCP server #${String(d+1)}).`);i.set(g.name,c);let h=!!g.command?.trim(),u=!!g.url?.trim();if(h===u)throw new B(`${l} '${g.name}': configure exactly one of command or url.`);if(h&&g.transport&&g.transport!=="stdio")throw new B(`${l} '${g.name}': command servers must use stdio.`);if(u&&g.transport&&!["http","sse"].includes(g.transport))throw new B(`${l} '${g.name}': URL transport must be http or sse.`)}}var ki=A.looseObject({enabled:A.boolean().default(!0),command:A.string().optional(),args:A.array(A.string()).optional(),env:A.record(A.string(),A.string()).optional(),type:A.enum(["stdio","sse","http"]).optional(),url:A.string().optional(),headers:A.record(A.string(),A.string()).optional()}),Ni=A.looseObject({mcpServers:A.record(A.string(),A.unknown()).default({})});function Ri(r,i){let c=i.type??(i.command!==void 0?"stdio":"http");return c==="stdio"?!i.command||i.url!==void 0?null:{name:r,command:i.command,args:i.args,env:i.env}:!i.url||i.command!==void 0?null:{name:r,url:i.url,transport:c,headers:i.headers}}function Mi(r){let i=Ti(r,Bn);if(!Kr(i))return[];let c;try{c=JSON.parse(xi(i,"utf-8"))}catch(d){return qe.error({err:d,path:i},"invalid .mcp.json"),[]}let g=He(Ni,c);if(!g.success)return qe.error({error:g.error,path:i},"invalid .mcp.json"),[];let l=[];for(let[d,h]of Object.entries(g.data.mcpServers)){let u=He(ki,h);if(!d.trim()||!u.success){qe.warn({name:d,path:i,error:u.success?void 0:u.error},"skipping invalid .mcp.json server entry");continue}if(!u.data.enabled)continue;let x=Ri(d,u.data);x?l.push(x):qe.warn({name:d,path:i},"skipping invalid .mcp.json server entry")}return l}function zo(r,i){let c=Mi(i);if(c.length===0)return r;let g=new Set(r.mcp_servers.map(l=>l.name));return{...r,mcp_servers:[...r.mcp_servers,...c.filter(l=>!g.has(l.name))]}}function Pi(r,i={}){if(r){let l=Hr(r);return Br(l),(!i.allowEmptyProviders||l.providers.length>0)&&qr(l),l}let c=se();if(!Kr(c)){if(i.allowEmptyProviders)return Gr.parse({providers:[]});throw new B(`No config file found, expected ${c}.`)}let g=Hr(c);return Br(g),(!i.allowEmptyProviders||g.providers.length>0)&&qr(g),g}var $r="Tool execution was interrupted. The tool may or may not have completed; verify before relying on its effects.",Xo="The user rejected this tool use. Nothing was changed (for file edits, the new content was NOT written).",Jo="<system-reminder>",Qo="</system-reminder>",Zo=/<(?=\s*\/?\s*system-reminder\b)/giu,et=/^(.+)#L(\d+)(?:-L?(\d+))?$/,nt=/(?:^|[\s((])(?:'@([^']+)'|"@([^"]+)"|@"([^"]+)"|@'([^']+)'|@([^\s#,;,;。!?、()()<>"'`]+(?:#L\d+(?:-L?\d+)?)?))/gu;function ot(r){let i=[];for(let c=0;c<r.length;c++){let g=r[c];if(g.role==="assistant"&&g.toolUses?.length){i.push(g);let l=new Set(g.toolUses.map(u=>u.toolUseId)),d=[],h=[];for(;c+1<r.length;){let u=r[c+1];if(u.role!=="user"||!u.toolResults?.length||u.toolUses?.length)break;c++,h.push(u);for(let x of u.toolResults)l.delete(x.toolUseId)&&d.push(x)}for(let u of l)d.push({toolUseId:u,content:$r,isError:!0});i.push({...h[0]??{role:"user",content:""},toolResults:d});for(let u of h.slice(1))(u.content.length>0||u.thinkingBlocks?.length)&&i.push({...u,toolResults:[]});continue}if((g.toolResults?.length??0)>0){if(g.content.length===0&&!g.toolUses?.length&&!g.thinkingBlocks?.length)continue;i.push({...g,toolResults:[]})}else i.push(g)}return i}var oe=class extends Error{constructor(i){super(i),this.name="LLMError"}},Vr=class extends oe{constructor(i){super(i),this.name="AuthenticationError"}},zr=class extends oe{retryAfter;constructor(i,c){super(i),this.name="RateLimitError",this.retryAfter=c}},Wr=class extends oe{constructor(i){super(i),this.name="NetworkError"}},Xr=class extends oe{constructor(c,g){super(c);this.retryAfter=g;this.name="ServerError"}retryAfter},Jr=class extends oe{constructor(i){super(i),this.name="ContextTooLongError"}};function lt(r){return/context_length_exceeded/i.test(r)||/maximum\s+context\s+length/i.test(r)||/prompts?\s+(?:is\s+)?too\s+long/i.test(r)}var ft=5e3,at=10,pt="2023-06-01",dt="Model discovery failed",ht=3,mt=6e4,gt=1e3,yt=5e3,Qr=`~/${kn}/${De}`,_t=`Anthropic API key not found, set ANTHROPIC_API_KEY in ${Qr}, or via ANTHROPIC_API_KEY env variable.`,At=`OpenAI API key not found, set OPENAI_API_KEY in ${Qr}, or via OPENAI_API_KEY env variable.`;export{He as a,No as b,Ro as c,fe as d,ie as e,Fn as f,Yn as g,jn as h,ji as i,Ui as j,rn as k,Hi as l,on as m,ii as n,oi as o,ti as p,$n as q,Vn as r,_i as s,ao as t,po as u,ho as v,mo as w,Go as x,$o as y,Vo as z,zo as A,Pi as B,Xo as C,Jo as D,Qo as E,Zo as F,et as G,nt as H,ot as I,oe as J,Vr as K,zr as L,Wr as M,Xr as N,Jr as O,lt as P,ft as Q,at as R,pt as S,dt as T,ht as U,mt as V,gt as W,yt as X,_t as Y,At as Z};
|
|
@@ -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 p}from"./chunk-
|
|
4
|
+
import{a as p}from"./chunk-EQABLL4S.js";import{B as c}from"./chunk-QSKJBSCI.js";var _="@yukino.js/yukino",d="https://registry.npmjs.org/@yukino.js%2Fyukino",h="https://registry.npmjs.org/",g="latest";var m="Could not locate the Yukino installation.",I="This Yukino installation is not managed by global npm, yarn, or pnpm. Update the source checkout or reinstall using yukino-code/install.sh or yukino-code/install.ps1.",A=/^(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 l(e){let t=A.exec(e),n=t?.[4]?.split(".")??[];if(!t||n.some(r=>/^0\d+$/u.test(r)))throw new Error(`Invalid package version: ${e}`);return{core:[BigInt(t[1]),BigInt(t[2]),BigInt(t[3])],prerelease:n}}function T(e,t){let n=l(e),r=l(t);for(let o=0;o<n.core.length;o++)if(n.core[o]!==r.core[o])return n.core[o]>r.core[o];if(n.prerelease.length===0||r.prerelease.length===0)return n.prerelease.length===0&&r.prerelease.length>0;for(let o=0;o<Math.max(n.prerelease.length,r.prerelease.length);o++){let s=n.prerelease[o],i=r.prerelease[o];if(s===i)continue;if(s===void 0||i===void 0)return i===void 0;let u=/^\d+$/u.test(s),a=/^\d+$/u.test(i);return u&&a?BigInt(s)>BigInt(i):u===a?s>i:a}return!1}async function E({tag:e=g,signal:t}={}){if(!e||encodeURIComponent(e)!==e||[".",".."].includes(e))throw new Error(`Invalid npm dist-tag: ${e}`);let n=AbortSignal.timeout(1e4),r=await fetch(`${d}/${encodeURIComponent(e)}`,{headers:{accept:"application/json","User-Agent":`yukino/${p} (${process.platform}; ${process.arch})`},signal:t?AbortSignal.any([t,n]):n});if(r.status===404)throw new Error(`No Yukino release found for npm dist-tag "${e}".`);if(!r.ok)throw new Error(`Could not check for Yukino updates (npm dist-tag "${e}"): HTTP ${r.status}`);let o=await r.json(),s=c.object({version:c.string()}).parse(o).version;return l(s),s}async function S(e){try{let t=await E({signal:e});return T(t,p)?t:void 0}catch{return}}export{_ as a,h as b,m as c,I as d,T as e,E as f,S as g};
|
|
@@ -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{
|
|
4
|
+
import{B as e}from"./chunk-QSKJBSCI.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.21-dev"}var u=_();export{u as a};
|