@swifty.js/swifty 0.0.26 → 0.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +14 -6
  2. package/dist/agent-3NON2EXE.js +4 -0
  3. package/dist/anthropic-BJ5GN2VT.js +4 -0
  4. package/dist/checker-N5TIJEN5.js +4 -0
  5. package/dist/{chunk-H7VXSMJR.js → chunk-C3WGLVVZ.js} +10 -10
  6. package/dist/chunk-D34FUVGU.js +4 -0
  7. package/dist/chunk-FPQ2LBL4.js +10 -0
  8. package/dist/chunk-JGSIQXEN.js +4 -0
  9. package/dist/{chunk-5KXBVL2A.js → chunk-K5ZK27BX.js} +1 -1
  10. package/dist/chunk-LZBOXJX2.js +301 -0
  11. package/dist/chunk-OTVZGPHD.js +121 -0
  12. package/dist/chunk-QCKJLO6X.js +4 -0
  13. package/dist/chunk-R63ASIIW.js +407 -0
  14. package/dist/chunk-WX3B64R4.js +4 -0
  15. package/dist/chunk-Y6SQB5FG.js +4 -0
  16. package/dist/{devtools-3OAJUZGE.js → devtools-OJ75EP3T.js} +1 -1
  17. package/dist/glob.wasm +0 -0
  18. package/dist/lib/agent-XYO2MXXK.js +11 -0
  19. package/dist/lib/{anthropic-RYPJDHQM.js → anthropic-TGJGAP5R.js} +4 -5
  20. package/dist/lib/{checker-6BW4222R.js → checker-AXHPKVBY.js} +2 -2
  21. package/dist/lib/{chunk-HK2Z6WP4.js → chunk-2IVEVG5N.js} +5 -1
  22. package/dist/lib/{chunk-2AUSNVIB.js → chunk-ALJAVRRX.js} +28 -34
  23. package/dist/lib/{chunk-GNI7YX6F.js → chunk-DJ6AILPN.js} +70 -24
  24. package/dist/lib/chunk-DV6RV5WU.js +2345 -0
  25. package/dist/lib/{chunk-3LU4APFB.js → chunk-FBSPZQGC.js} +126 -73
  26. package/dist/lib/chunk-IB5IQK2S.js +136 -0
  27. package/dist/lib/{chunk-PZ42NAFA.js → chunk-KG4MJGKQ.js} +19 -21
  28. package/dist/lib/{chunk-XFSN4LMA.js → chunk-P4F46PEF.js} +43 -14
  29. package/dist/lib/glob.wasm +0 -0
  30. package/dist/lib/index.d.ts +145 -123
  31. package/dist/lib/index.js +2186 -1726
  32. package/dist/lib/{openai-VX5VBXZ4.js → openai-5UCIIDPO.js} +2 -3
  33. package/dist/lib/{tool-filter-VF7TZRE5.js → tool-filter-R6HDDJHE.js} +1 -1
  34. package/dist/main.js +226 -196
  35. package/dist/{node-OES65R33.js → node-4LTSRXL2.js} +1 -1
  36. package/dist/{openai-6MXNADYN.js → openai-YLS2LUAI.js} +14 -14
  37. package/dist/server-GX72MJQF.js +244 -0
  38. package/dist/{tool-filter-NO7I3HFD.js → tool-filter-VBP6WOGO.js} +1 -1
  39. package/package.json +36 -32
  40. package/dist/agent-GAABBZRW.js +0 -4
  41. package/dist/anthropic-7QRAPLOY.js +0 -4
  42. package/dist/checker-3RWAYF2U.js +0 -4
  43. package/dist/chunk-7MHXMDYC.js +0 -35
  44. package/dist/chunk-A2VR3BC4.js +0 -4
  45. package/dist/chunk-FZPTNGTU.js +0 -4
  46. package/dist/chunk-MWZIARZE.js +0 -130
  47. package/dist/chunk-NR62AA5K.js +0 -4
  48. package/dist/chunk-QN27QEFS.js +0 -4
  49. package/dist/chunk-RMMK4PO5.js +0 -389
  50. package/dist/chunk-SIWLMWHH.js +0 -93
  51. package/dist/chunk-VC6OXOMP.js +0 -238
  52. package/dist/chunk-W37Y53LX.js +0 -4
  53. package/dist/chunk-XBHVVB5A.js +0 -10
  54. package/dist/lib/agent-U7MIUCKT.js +0 -9
  55. package/dist/lib/chunk-2QILP24G.js +0 -1120
  56. package/dist/lib/chunk-OO2CLOEE.js +0 -88
  57. package/dist/lib/chunk-RKJYTYQM.js +0 -1285
  58. package/dist/server-P2VE5HLJ.js +0 -244
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __swiftyCreateRequire } from "node:module";
3
3
  const require = __swiftyCreateRequire(import.meta.url);
4
- import{b as a,c as b,d as c,e as d,f as e,g as f,h as g}from"./chunk-A2VR3BC4.js";import"./chunk-E55KH72M.js";import"./chunk-X3UA5OZL.js";export{d as ASYNC_AGENT_ALLOWED_TOOLS,c as CUSTOM_AGENT_DISALLOWED_TOOLS,f as FORK_QUERY_SOURCE,a as SUBAGENT_DISALLOWED_TOOLS,b as TEAMMATE_DISALLOWED_TOOLS,g as cloneRegistryForFork,e as filterToolsForAgent};
4
+ import{b as a,c as b,d as c,e as d,f as e,g as f,h as g}from"./chunk-Y6SQB5FG.js";import"./chunk-E55KH72M.js";import"./chunk-X3UA5OZL.js";export{d as ASYNC_AGENT_ALLOWED_TOOLS,c as CUSTOM_AGENT_DISALLOWED_TOOLS,f as FORK_QUERY_SOURCE,a as SUBAGENT_DISALLOWED_TOOLS,b as TEAMMATE_DISALLOWED_TOOLS,g as cloneRegistryForFork,e as filterToolsForAgent};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swifty.js/swifty",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
4
4
  "description": "Swifty — CLI coding agent",
5
5
  "keywords": [
6
6
  "agent",
@@ -8,15 +8,15 @@
8
8
  "coding-agent",
9
9
  "swifty"
10
10
  ],
11
- "homepage": "https://github.com/hangtiancheng/swifty-cli",
11
+ "homepage": "https://github.com/hangtiancheng/swifty-code",
12
12
  "bugs": {
13
- "url": "https://github.com/hangtiancheng/swifty-cli/issues"
13
+ "url": "https://github.com/hangtiancheng/swifty-code/issues"
14
14
  },
15
15
  "license": "MIT",
16
16
  "author": "https://github.com/hangtiancheng",
17
17
  "repository": {
18
18
  "type": "git",
19
- "url": "https://github.com/hangtiancheng/swifty-cli.git",
19
+ "url": "https://github.com/hangtiancheng/swifty-code.git",
20
20
  "directory": "apps/swifty"
21
21
  },
22
22
  "bin": {
@@ -44,22 +44,31 @@
44
44
  "dependencies": {
45
45
  "@anthropic-ai/sdk": "^0.104.2",
46
46
  "@modelcontextprotocol/sdk": "^1.30.0",
47
+ "ansi-escapes": "^7.3.0",
48
+ "ansi-regex": "^6.3.0",
47
49
  "chalk": "^5.6.2",
48
- "dompurify": "^3.4.12",
50
+ "cli-highlight": "^2.1.11",
51
+ "cli-table3": "^0.6.5",
52
+ "dompurify": "^3.4.15",
49
53
  "fuse.js": "^7.5.0",
50
54
  "ink": "^7.1.1",
51
55
  "ink-spinner": "^5.0.0",
52
56
  "ink-text-input": "^6.0.0",
53
- "js-yaml": "^4.3.0",
57
+ "js-yaml": "^4.3.2",
54
58
  "koa": "^3.2.1",
55
- "marked": "^18.0.7",
59
+ "marked": "^18.0.12",
60
+ "node-emoji": "^2.2.0",
56
61
  "openai": "^6.49.0",
57
62
  "pino": "^10.3.1",
58
63
  "react": "19.2.7",
59
64
  "react-dom": "19.2.7",
60
- "sharp": "^0.35.3",
61
- "ws": "^8.21.1",
62
- "zod": "^4.4.3"
65
+ "sharp": "^0.35.4",
66
+ "slice-ansi": "^9.0.0",
67
+ "string-width": "^8.2.2",
68
+ "supports-hyperlinks": "^4.5.0",
69
+ "wrap-ansi": "^10.0.1",
70
+ "ws": "^8.21.3",
71
+ "zod": "^4.6.2"
63
72
  },
64
73
  "devDependencies": {
65
74
  "@biomejs/biome": "2.4.15",
@@ -67,51 +76,46 @@
67
76
  "@tailwindcss/postcss": "^4.3.3",
68
77
  "@types/js-yaml": "^4.0.9",
69
78
  "@types/koa": "^3.0.3",
70
- "@types/node": "^24.13.3",
71
- "@types/react": "^19.2.18",
72
- "@types/react-dom": "^19.2.4",
79
+ "@types/node": "^24.13.4",
80
+ "@types/react": "^19.3.0",
81
+ "@types/react-dom": "^19.3.0",
73
82
  "@types/ws": "^8.18.1",
74
- "@vitest/coverage-v8": "^4.1.10",
83
+ "@vitest/coverage-v8": "^4.1.11",
75
84
  "eslint": "^9.39.5",
76
85
  "eslint-plugin-import": "^2.32.0",
77
86
  "eslint-plugin-react-hooks": "^5.2.0",
78
- "eslint-plugin-react-refresh": "^0.5.3",
87
+ "eslint-plugin-react-refresh": "^0.5.6",
79
88
  "eslint-plugin-unicorn": "^65.0.1",
80
- "globals": "^17.8.0",
89
+ "globals": "^17.12.0",
81
90
  "oxfmt": "^0.53.0",
82
91
  "pino-pretty": "^13.1.3",
83
- "postcss": "^8.5.25",
92
+ "postcss": "^8.5.28",
84
93
  "tailwindcss": "^4.3.3",
85
94
  "tsup": "^8.5.1",
86
- "tsx": "^4.23.1",
95
+ "tsx": "^4.23.13",
87
96
  "typescript": "^5.9.3",
88
- "typescript-eslint": "^8.65.0",
89
- "vitest": "^4.1.10",
90
- "@swifty.js/marked-terminal": "^0.0.1",
97
+ "typescript-eslint": "^8.70.0",
98
+ "vitest": "^4.1.11",
91
99
  "@swifty.js/glob-wasm": "0.0.1"
92
100
  },
93
101
  "engines": {
94
102
  "node": ">=20"
95
103
  },
96
104
  "scripts": {
97
- "fe:dev": "cd src/remote/fe && tsup --watch",
98
- "fe:build": "cd src/remote/fe && rm -rf ./dist && tsup",
99
- "fe:preview": "pnpm dlx serve src/remote/fe/dist",
105
+ "dev:fe": "cd src/remote/fe && tsup --watch",
106
+ "build:fe": "cd src/remote/fe && rm -rf ./dist && tsup",
107
+ "preview:fe": "pnpm dlx serve src/remote/fe/dist",
100
108
  "dev": "tsx ./src/main.tsx",
101
109
  "build": "rm -rf ./dist && tsup",
102
- "lint": "eslint ./src ./tests",
103
- "lint:fix": "eslint --fix ./src ./tests",
110
+ "lint": "eslint --cache ./src ./tests",
111
+ "lint:fix": "eslint --cache --fix ./src ./tests",
104
112
  "test": "vitest run",
105
113
  "test:watch": "vitest",
106
114
  "typecheck": "tsc --noEmit -p tsconfig.json",
107
115
  "format": "oxfmt --write .",
116
+ "all": "pnpm typecheck && pnpm test && pnpm lint && pnpm build",
108
117
  "add:user": "pnpm adduser --registry=https://registry.npmjs.org/",
109
118
  "publish:latest": "pnpm publish --access public --registry=https://registry.npmjs.org/",
110
- "publish:alpha": "pnpm publish --access public --registry=https://registry.npmjs.org/ --tag alpha",
111
- "publish:beta": "pnpm publish --access public --registry=https://registry.npmjs.org/ --tag beta",
112
- "publish:rc": "pnpm publish --access public --registry=https://registry.npmjs.org/ --tag rc",
113
- "publish:canary": "pnpm publish --access public --registry=https://registry.npmjs.org/ --tag canary",
114
- "publish:nightly": "pnpm publish --access public --registry=https://registry.npmjs.org/ --tag nightly",
115
- "publish:dev": "pnpm publish --access public --registry=https://registry.npmjs.org/ --tag dev"
119
+ "publish:nightly": "pnpm publish --access public --registry=https://registry.npmjs.org/ --tag nightly"
116
120
  }
117
121
  }
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __swiftyCreateRequire } from "node:module";
3
- const require = __swiftyCreateRequire(import.meta.url);
4
- import{i as a}from"./chunk-VC6OXOMP.js";import"./chunk-MWZIARZE.js";import"./chunk-FZPTNGTU.js";import"./chunk-SIWLMWHH.js";import"./chunk-X3UA5OZL.js";export{a as Agent};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __swiftyCreateRequire } from "node:module";
3
- const require = __swiftyCreateRequire(import.meta.url);
4
- import{a as U}from"./chunk-5KXBVL2A.js";import{g as P}from"./chunk-H7VXSMJR.js";import{l as M}from"./chunk-MWZIARZE.js";import{e as H,g as q,h as C}from"./chunk-W37Y53LX.js";import{b as O,c as $,d as I,e as K,f as W,g as F}from"./chunk-FZPTNGTU.js";import"./chunk-QN27QEFS.js";import"./chunk-7MHXMDYC.js";import{C as w,I as L,J as N,K as B,L as v,M as _,N as j,g as S}from"./chunk-SIWLMWHH.js";import"./chunk-E55KH72M.js";import"./chunk-X3UA5OZL.js";function Y(o){for(let t=o.length-1;t>=0;t--){let e=o[t];if(e.defer_loading!==!0){e.cache_control={type:"ephemeral"};return}}}function z(o){return o.some(t=>t.defer_loading)}var x=L({module:"llm"});var D=3e3,J=w.object({max_input_tokens:w.coerce.number()});async function ct(o){if(o.protocol!=="anthropic")return 0;let t=C(o),n=`${o.base_url.replace(/\/+$/,"")}/v1/models/${encodeURIComponent(o.model)}`,s=new AbortController,r=setTimeout(()=>{s.abort()},D);try{let c=await fetch(n,{method:"GET",headers:{"anthropic-version":"2023-06-01",...t?{"x-api-key":t}:{}},signal:s.signal});if(!c.ok)return 0;let m=await c.json(),{success:h,error:g,data:f}=await S(J,m);if(!h)return x.warn({message:g.message},"model context window schema validation failed"),0;let d=f.max_input_tokens;return Math.max(d,0)}catch(c){return x.error({err:c},"failed to fetch model context window"),0}finally{clearTimeout(r)}}function V(){return!0}function E(o){return typeof o=="string"?[{type:"text",text:o}]:o}function Q(o){let t=[];for(let e of o)if(e.role==="assistant"){let n=[];if(e.thinkingBlocks)for(let r of e.thinkingBlocks)n.push({type:"thinking",thinking:r.thinking,signature:r.signature});let s=typeof e.content=="string"?e.content:N(e.content);if(s&&n.push({type:"text",text:s}),e.toolUses)for(let r of e.toolUses)n.push({type:"tool_use",id:r.toolUseId,name:r.toolName,input:r.arguments});n.length===0&&n.push({type:"text",text:""}),t.push({role:"assistant",content:n})}else if(e.toolResults&&e.toolResults.length>0){let n=[];for(let s of e.toolResults)n.push({type:"tool_result",tool_use_id:s.toolUseId,is_error:s.isError,content:s.contentBlocks?.length?s.contentBlocks:s.content});t.push({role:"user",content:n})}else{if(t.length===0){t.push({role:"user",content:E(e.content)});continue}let n=!1,s=t[t.length-1],r=s.content;s.role==="user"&&(typeof r=="string"||Array.isArray(r)&&r.length>0&&(r[0].type==="text"||r[0].type==="image"))&&(n=!0),n?(typeof r=="string"&&(r=s.content=r.trim().length>0?[{type:"text",text:r}]:[]),r.push(...E(e.content))):t.push({role:"user",content:E(e.content)})}return t}var G=class{client;model;thinking;systemPrompt;maxOutputTokens;contextWindow;constructor(t,e){let n=C(t);if(!n)throw new I("Anthropic API key not found, set ANTHROPIC_API_KEY in .swifty/config.y(a)ml, or via ANTHROPIC_API_KEY env variable.");this.client=new P({apiKey:n,baseURL:t.base_url}),this.model=t.model,this.thinking=t.thinking??!0,this.systemPrompt=e,this.maxOutputTokens=q(t),this.contextWindow=H(t)}setSystemPrompt(t){this.systemPrompt=t}setMaxOutputTokens(t){this.maxOutputTokens=t}async*stream(t,e,n){let s=Q(O(t.getMessages())),r=z(e),c=e.map(l=>{let p=l.input_schema,u={name:l.name,description:l.description,input_schema:{type:"object",properties:p.properties,required:p.required??[]}};return l.defer_loading===!0&&(u.defer_loading=!0),u});Y(c),X(s);let m={model:this.model,max_tokens:this.maxOutputTokens,stream:!0,system:[{type:"text",text:this.systemPrompt,cache_control:{type:"ephemeral"}}],messages:s,...c.length>0?{tools:c}:{}};this.thinking?V()&&(m.thinking={type:"enabled",budget_tokens:M(this.contextWindow,this.maxOutputTokens)}):m.thinking={type:"enabled",budget_tokens:M(this.contextWindow,this.maxOutputTokens)};let h=0,g=0,f=0,d=0,R="end_turn",T="",b="",A=!1;try{let l=this.client.messages.stream(m,{...n?{signal:n}:{},...r?{headers:{"anthropic-beta":U}}:{}}),p="",u="",k="";for await(let i of l)switch(i.type){case"content_block_start":{let a=i.content_block;a.type==="thinking"?(A=!0,T="",b=""):a.type==="tool_use"&&(u=a.id,p=a.name,k="",yield{type:"tool_call_start",toolName:p,toolId:u});break}case"content_block_delta":{let a=i.delta;a.type==="thinking_delta"?(T+=a.thinking,yield{type:"thinking_delta",text:a.thinking}):a.type==="signature_delta"?b=a.signature:a.type==="text_delta"?yield{type:"text_delta",text:a.text}:a.type==="input_json_delta"&&(k+=a.partial_json,yield{type:"tool_call_delta",text:a.partial_json});break}case"content_block_stop":{if(A&&(yield{type:"thinking_complete",thinking:T,signature:b},A=!1),p){let a={};if(k)try{let y=JSON.parse(k);a=B(y)?v(y):{}}catch(y){x.error({err:y},"llm operation failed"),a={}}yield{type:"tool_call_complete",toolId:u,toolName:p,arguments:a},p="",u="",k=""}break}case"message_delta":{i.delta.stop_reason&&(R=i.delta.stop_reason),i.usage.output_tokens&&(g=i.usage.output_tokens,i.usage.input_tokens&&(h=i.usage.input_tokens),i.usage.cache_read_input_tokens&&(f=i.usage.cache_read_input_tokens),i.usage.cache_creation_input_tokens&&(d=i.usage.cache_creation_input_tokens));break}case"message_start":{h=i.message.usage.input_tokens,g=i.message.usage.output_tokens,f=i.message.usage.cache_read_input_tokens??0,d=i.message.usage.cache_creation_input_tokens??0;break}}yield{type:"stream_end",stopReason:R,usage:{inputTokens:h,outputTokens:g,cacheReadInputTokens:f,cacheCreationInputTokens:d}}}catch(l){throw x.error({err:l},"llm operation failed"),Z(l)}}};function X(o){for(let t=o.length-1;t>=0;t--){if(o[t].role!=="user")continue;let e=o[t].content;if(typeof e=="string"&&e.length===0||Array.isArray(e)&&e.length===0)return;typeof e=="string"&&(e=o[t].content=[{type:"text",text:e}]);let n=e[e.length-1];for(let s=e.length-1;s>=0;s--)if(e[s].type!=="image"){n=e[s];break}Reflect.set(n,"cache_control",{type:"ephemeral"})}}function Z(o){if(o instanceof P.APIError){if(o.status===413||/prompts?\s+too\s+long/i.test(o.message))return new F(`Prompt too long: ${o.message}`);if(o.status===401)return new I(`Invalid API key: ${o.message}`);if(o.status===429){let t=v(o.headers)["retry-after"],e="Rate Limited";if(t){let n=Number.parseInt(_(t));Number.isNaN(n)&&(e+=", please wait."),e+=`, retry after ${_(n)}s.`}else e+=", please wait.";return new K(e,t?_(t):void 0)}return new $(`Anthropic API error (${_(o.status)}): ${o.message}`)}return new W(`Network error: ${j(o)}`)}export{G as AnthropicClient,Q as buildAnthropicMessages,ct as fetchModelContextWindow,X as markLastUserTailForCache,Y as markToolsForCache,z as needsToolSearchBeta};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __swiftyCreateRequire } from "node:module";
3
- const require = __swiftyCreateRequire(import.meta.url);
4
- import{a,b,c,d,e,f}from"./chunk-NR62AA5K.js";import"./chunk-QN27QEFS.js";import"./chunk-7MHXMDYC.js";import"./chunk-SIWLMWHH.js";import"./chunk-E55KH72M.js";import"./chunk-X3UA5OZL.js";export{b as PathSandbox,f as PermissionChecker,d as RuleEngine,c as evaluateRules,a as extractContent,e as isSafeCommand};
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __swiftyCreateRequire } from "node:module";
3
- const require = __swiftyCreateRequire(import.meta.url);
4
- function $n(T){return T&&T.__esModule&&Object.prototype.hasOwnProperty.call(T,"default")?T.default:T}var P={},Ie={},Z={},un;function ae(){if(un)return Z;un=1;function T(a){return typeof a>"u"||a===null}function _(a){return typeof a=="object"&&a!==null}function I(a){return Array.isArray(a)?a:T(a)?[]:[a]}function L(a,s){if(s){let S=Object.keys(s);for(let l=0,c=S.length;l<c;l+=1){let C=S[l];a[C]=s[C]}}return a}function d(a,s){let S="";for(let l=0;l<s;l+=1)S+=a;return S}function y(a){return a===0&&Number.NEGATIVE_INFINITY===1/a}return Z.isNothing=T,Z.isObject=_,Z.toArray=I,Z.repeat=d,Z.isNegativeZero=y,Z.extend=L,Z}var Ye,fn;function he(){if(fn)return Ye;fn=1;function T(I,L){let d="",y=I.reason||"(unknown reason)";return I.mark?(I.mark.name&&(d+='in "'+I.mark.name+'" '),d+="("+(I.mark.line+1)+":"+(I.mark.column+1)+")",!L&&I.mark.snippet&&(d+=`
5
-
6
- `+I.mark.snippet),y+" "+d):y}function _(I,L){Error.call(this),this.name="YAMLException",this.reason=I,this.mark=L,this.message=T(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}return _.prototype=Object.create(Error.prototype),_.prototype.constructor=_,_.prototype.toString=function(L){return this.name+": "+T(this,L)},Ye=_,Ye}var Pe,pn;function Jn(){if(pn)return Pe;pn=1;let T=ae();function _(d,y,a,s,S){let l="",c="",C=Math.floor(S/2)-1;return s-y>C&&(l=" ... ",y=s-C+l.length),a-s>C&&(c=" ...",a=s+C-c.length),{str:l+d.slice(y,a).replace(/\t/g,"\u2192")+c,pos:s-y+l.length}}function I(d,y){return T.repeat(" ",y-d.length)+d}function L(d,y){if(y=Object.create(y||null),!d.buffer)return null;y.maxLength||(y.maxLength=79),typeof y.indent!="number"&&(y.indent=1),typeof y.linesBefore!="number"&&(y.linesBefore=3),typeof y.linesAfter!="number"&&(y.linesAfter=2);let a=/\r?\n|\r|\0/g,s=[0],S=[],l,c=-1;for(;l=a.exec(d.buffer);)S.push(l.index),s.push(l.index+l[0].length),d.position<=l.index&&c<0&&(c=s.length-2);c<0&&(c=s.length-1);let C="",k=Math.min(d.line+y.linesAfter,S.length).toString().length,R=y.maxLength-(y.indent+k+3);for(let M=1;M<=y.linesBefore&&!(c-M<0);M++){let U=_(d.buffer,s[c-M],S[c-M],d.position-(s[c]-s[c-M]),R);C=T.repeat(" ",y.indent)+I((d.line-M+1).toString(),k)+" | "+U.str+`
7
- `+C}let X=_(d.buffer,s[c],S[c],d.position,R);C+=T.repeat(" ",y.indent)+I((d.line+1).toString(),k)+" | "+X.str+`
8
- `,C+=T.repeat("-",y.indent+k+3+X.pos)+`^
9
- `;for(let M=1;M<=y.linesAfter&&!(c+M>=S.length);M++){let U=_(d.buffer,s[c+M],S[c+M],d.position-(s[c]-s[c+M]),R);C+=T.repeat(" ",y.indent)+I((d.line+M+1).toString(),k)+" | "+U.str+`
10
- `}return C.replace(/\n$/,"")}return Pe=L,Pe}var De,sn;function D(){if(sn)return De;sn=1;let T=he(),_=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],I=["scalar","sequence","mapping"];function L(y){let a={};return y!==null&&Object.keys(y).forEach(function(s){y[s].forEach(function(S){a[String(S)]=s})}),a}function d(y,a){if(a=a||{},Object.keys(a).forEach(function(s){if(_.indexOf(s)===-1)throw new T('Unknown option "'+s+'" is met in definition of "'+y+'" YAML type.')}),this.options=a,this.tag=y,this.kind=a.kind||null,this.resolve=a.resolve||function(){return!0},this.construct=a.construct||function(s){return s},this.instanceOf=a.instanceOf||null,this.predicate=a.predicate||null,this.represent=a.represent||null,this.representName=a.representName||null,this.defaultStyle=a.defaultStyle||null,this.multi=a.multi||!1,this.styleAliases=L(a.styleAliases||null),I.indexOf(this.kind)===-1)throw new T('Unknown kind "'+this.kind+'" is specified for "'+y+'" YAML type.')}return De=d,De}var He,an;function vn(){if(an)return He;an=1;let T=he(),_=D();function I(y,a){let s=[];return y[a].forEach(function(S){let l=s.length;s.forEach(function(c,C){c.tag===S.tag&&c.kind===S.kind&&c.multi===S.multi&&(l=C)}),s[l]=S}),s}function L(){let y={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function a(s){s.multi?(y.multi[s.kind].push(s),y.multi.fallback.push(s)):y[s.kind][s.tag]=y.fallback[s.tag]=s}for(let s=0,S=arguments.length;s<S;s+=1)arguments[s].forEach(a);return y}function d(y){return this.extend(y)}return d.prototype.extend=function(a){let s=[],S=[];if(a instanceof _)S.push(a);else if(Array.isArray(a))S=S.concat(a);else if(a&&(Array.isArray(a.implicit)||Array.isArray(a.explicit)))a.implicit&&(s=s.concat(a.implicit)),a.explicit&&(S=S.concat(a.explicit));else throw new T("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");s.forEach(function(c){if(!(c instanceof _))throw new T("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(c.loadKind&&c.loadKind!=="scalar")throw new T("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(c.multi)throw new T("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),S.forEach(function(c){if(!(c instanceof _))throw new T("Specified list of YAML types (or a single Type object) contains a non-Type object.")});let l=Object.create(d.prototype);return l.implicit=(this.implicit||[]).concat(s),l.explicit=(this.explicit||[]).concat(S),l.compiledImplicit=I(l,"implicit"),l.compiledExplicit=I(l,"explicit"),l.compiledTypeMap=L(l.compiledImplicit,l.compiledExplicit),l},He=d,He}var je,hn;function Mn(){if(hn)return je;hn=1;let T=D();return je=new T("tag:yaml.org,2002:str",{kind:"scalar",construct:function(_){return _!==null?_:""}}),je}var Be,dn;function Fn(){if(dn)return Be;dn=1;let T=D();return Be=new T("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(_){return _!==null?_:[]}}),Be}var Ue,mn;function qn(){if(mn)return Ue;mn=1;let T=D();return Ue=new T("tag:yaml.org,2002:map",{kind:"mapping",construct:function(_){return _!==null?_:{}}}),Ue}var Ke,gn;function Yn(){if(gn)return Ke;gn=1;let T=vn();return Ke=new T({explicit:[Mn(),Fn(),qn()]}),Ke}var Ge,An;function Pn(){if(An)return Ge;An=1;let T=D();function _(d){if(d===null)return!0;let y=d.length;return y===1&&d==="~"||y===4&&(d==="null"||d==="Null"||d==="NULL")}function I(){return null}function L(d){return d===null}return Ge=new T("tag:yaml.org,2002:null",{kind:"scalar",resolve:_,construct:I,predicate:L,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"}),Ge}var We,yn;function Dn(){if(yn)return We;yn=1;let T=D();function _(d){if(d===null)return!1;let y=d.length;return y===4&&(d==="true"||d==="True"||d==="TRUE")||y===5&&(d==="false"||d==="False"||d==="FALSE")}function I(d){return d==="true"||d==="True"||d==="TRUE"}function L(d){return Object.prototype.toString.call(d)==="[object Boolean]"}return We=new T("tag:yaml.org,2002:bool",{kind:"scalar",resolve:_,construct:I,predicate:L,represent:{lowercase:function(d){return d?"true":"false"},uppercase:function(d){return d?"TRUE":"FALSE"},camelcase:function(d){return d?"True":"False"}},defaultStyle:"lowercase"}),We}var Qe,Cn;function Hn(){if(Cn)return Qe;Cn=1;let T=ae(),_=D();function I(l){return l>=48&&l<=57||l>=65&&l<=70||l>=97&&l<=102}function L(l){return l>=48&&l<=55}function d(l){return l>=48&&l<=57}function y(l){if(l===null)return!1;let c=l.length,C=0,k=!1;if(!c)return!1;let R=l[C];if((R==="-"||R==="+")&&(R=l[++C]),R==="0"){if(C+1===c)return!0;if(R=l[++C],R==="b"){for(C++;C<c;C++){if(R=l[C],R!=="0"&&R!=="1")return!1;k=!0}return k&&isFinite(a(l))}if(R==="x"){for(C++;C<c;C++){if(!I(l.charCodeAt(C)))return!1;k=!0}return k&&isFinite(a(l))}if(R==="o"){for(C++;C<c;C++){if(!L(l.charCodeAt(C)))return!1;k=!0}return k&&isFinite(a(l))}}for(;C<c;C++){if(!d(l.charCodeAt(C)))return!1;k=!0}return k?isFinite(a(l)):!1}function a(l){let c=l,C=1,k=c[0];if((k==="-"||k==="+")&&(k==="-"&&(C=-1),c=c.slice(1),k=c[0]),c==="0")return 0;if(k==="0"){if(c[1]==="b")return C*parseInt(c.slice(2),2);if(c[1]==="x")return C*parseInt(c.slice(2),16);if(c[1]==="o")return C*parseInt(c.slice(2),8)}return C*parseInt(c,10)}function s(l){return a(l)}function S(l){return Object.prototype.toString.call(l)==="[object Number]"&&l%1===0&&!T.isNegativeZero(l)}return Qe=new _("tag:yaml.org,2002:int",{kind:"scalar",resolve:y,construct:s,predicate:S,represent:{binary:function(l){return l>=0?"0b"+l.toString(2):"-0b"+l.toString(2).slice(1)},octal:function(l){return l>=0?"0o"+l.toString(8):"-0o"+l.toString(8).slice(1)},decimal:function(l){return l.toString(10)},hexadecimal:function(l){return l>=0?"0x"+l.toString(16).toUpperCase():"-0x"+l.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Qe}var Ve,Sn;function jn(){if(Sn)return Ve;Sn=1;let T=ae(),_=D(),I=new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),L=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function d(l){return l===null||!I.test(l)?!1:isFinite(parseFloat(l,10))?!0:L.test(l)}function y(l){let c=l.toLowerCase(),C=c[0]==="-"?-1:1;return"+-".indexOf(c[0])>=0&&(c=c.slice(1)),c===".inf"?C===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:c===".nan"?NaN:C*parseFloat(c,10)}let a=/^[-+]?[0-9]+e/;function s(l,c){if(isNaN(l))switch(c){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===l)switch(c){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===l)switch(c){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(T.isNegativeZero(l))return"-0.0";let C=l.toString(10);return a.test(C)?C.replace("e",".e"):C}function S(l){return Object.prototype.toString.call(l)==="[object Number]"&&(l%1!==0||T.isNegativeZero(l))}return Ve=new _("tag:yaml.org,2002:float",{kind:"scalar",resolve:d,construct:y,predicate:S,represent:s,defaultStyle:"lowercase"}),Ve}var Xe,Tn;function Bn(){return Tn||(Tn=1,Xe=Yn().extend({implicit:[Pn(),Dn(),Hn(),jn()]})),Xe}var $e,wn;function Un(){return wn||(wn=1,$e=Bn()),$e}var Je,xn;function Kn(){if(xn)return Je;xn=1;let T=D(),_=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),I=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 L(a){return a===null?!1:_.exec(a)!==null||I.exec(a)!==null}function d(a){let s=0,S=null,l=_.exec(a);if(l===null&&(l=I.exec(a)),l===null)throw new Error("Date resolve error");let c=+l[1],C=+l[2]-1,k=+l[3];if(!l[4])return new Date(Date.UTC(c,C,k));let R=+l[4],X=+l[5],M=+l[6];if(l[7]){for(s=l[7].slice(0,3);s.length<3;)s+="0";s=+s}if(l[9]){let z=+l[10],H=+(l[11]||0);S=(z*60+H)*6e4,l[9]==="-"&&(S=-S)}let U=new Date(Date.UTC(c,C,k,R,X,M,s));return S&&U.setTime(U.getTime()-S),U}function y(a){return a.toISOString()}return Je=new T("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:L,construct:d,instanceOf:Date,represent:y}),Je}var Ze,bn;function Gn(){if(bn)return Ze;bn=1;let T=D();function _(I){return I==="<<"||I===null}return Ze=new T("tag:yaml.org,2002:merge",{kind:"scalar",resolve:_}),Ze}var ze,_n;function Wn(){if(_n)return ze;_n=1;let T=D(),_=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
11
- \r`;function I(a){if(a===null)return!1;let s=0,S=a.length,l=_;for(let c=0;c<S;c++){let C=l.indexOf(a.charAt(c));if(!(C>64)){if(C<0)return!1;s+=6}}return s%8===0}function L(a){let s=a.replace(/[\r\n=]/g,""),S=s.length,l=_,c=0,C=[];for(let R=0;R<S;R++)R%4===0&&R&&(C.push(c>>16&255),C.push(c>>8&255),C.push(c&255)),c=c<<6|l.indexOf(s.charAt(R));let k=S%4*6;return k===0?(C.push(c>>16&255),C.push(c>>8&255),C.push(c&255)):k===18?(C.push(c>>10&255),C.push(c>>2&255)):k===12&&C.push(c>>4&255),new Uint8Array(C)}function d(a){let s="",S=0,l=a.length,c=_;for(let k=0;k<l;k++)k%3===0&&k&&(s+=c[S>>18&63],s+=c[S>>12&63],s+=c[S>>6&63],s+=c[S&63]),S=(S<<8)+a[k];let C=l%3;return C===0?(s+=c[S>>18&63],s+=c[S>>12&63],s+=c[S>>6&63],s+=c[S&63]):C===2?(s+=c[S>>10&63],s+=c[S>>4&63],s+=c[S<<2&63],s+=c[64]):C===1&&(s+=c[S>>2&63],s+=c[S<<4&63],s+=c[64],s+=c[64]),s}function y(a){return Object.prototype.toString.call(a)==="[object Uint8Array]"}return ze=new T("tag:yaml.org,2002:binary",{kind:"scalar",resolve:I,construct:L,predicate:y,represent:d}),ze}var en,En;function Qn(){if(En)return en;En=1;let T=D(),_=Object.prototype.hasOwnProperty,I=Object.prototype.toString;function L(y){if(y===null)return!0;let a=[],s=y;for(let S=0,l=s.length;S<l;S+=1){let c=s[S],C=!1;if(I.call(c)!=="[object Object]")return!1;let k;for(k in c)if(_.call(c,k))if(!C)C=!0;else return!1;if(!C)return!1;if(a.indexOf(k)===-1)a.push(k);else return!1}return!0}function d(y){return y!==null?y:[]}return en=new T("tag:yaml.org,2002:omap",{kind:"sequence",resolve:L,construct:d}),en}var nn,In;function Vn(){if(In)return nn;In=1;let T=D(),_=Object.prototype.toString;function I(d){if(d===null)return!0;let y=d,a=new Array(y.length);for(let s=0,S=y.length;s<S;s+=1){let l=y[s];if(_.call(l)!=="[object Object]")return!1;let c=Object.keys(l);if(c.length!==1)return!1;a[s]=[c[0],l[c[0]]]}return!0}function L(d){if(d===null)return[];let y=d,a=new Array(y.length);for(let s=0,S=y.length;s<S;s+=1){let l=y[s],c=Object.keys(l);a[s]=[c[0],l[c[0]]]}return a}return nn=new T("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:I,construct:L}),nn}var rn,On;function Xn(){if(On)return rn;On=1;let T=D(),_=Object.prototype.hasOwnProperty;function I(d){if(d===null)return!0;let y=d;for(let a in y)if(_.call(y,a)&&y[a]!==null)return!1;return!0}function L(d){return d!==null?d:{}}return rn=new T("tag:yaml.org,2002:set",{kind:"mapping",resolve:I,construct:L}),rn}var ln,kn;function tn(){return kn||(kn=1,ln=Un().extend({implicit:[Kn(),Gn()],explicit:[Wn(),Qn(),Vn(),Xn()]})),ln}var Ln;function Zn(){if(Ln)return Ie;Ln=1;let T=ae(),_=he(),I=Jn(),L=tn(),d=Object.prototype.hasOwnProperty,y=1,a=2,s=3,S=4,l=1,c=2,C=3,k=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,R=/[\x85\u2028\u2029]/,X=/[,\[\]{}]/,M=/^(?:!|!!|![0-9A-Za-z-]+!)$/,U=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function z(e){return Object.prototype.toString.call(e)}function H(e){return e===10||e===13}function j(e){return e===9||e===32}function Y(e){return e===9||e===32||e===10||e===13}function $(e){return e===44||e===91||e===93||e===123||e===125}function Oe(e){if(e>=48&&e<=57)return e-48;let i=e|32;return i>=97&&i<=102?i-97+10:-1}function ke(e){return e===120?2:e===117?4:e===85?8:0}function de(e){return e>=48&&e<=57?e-48:-1}function oe(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 Le(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function te(e,i,t){i==="__proto__"?Object.defineProperty(e,i,{configurable:!0,enumerable:!0,writable:!0,value:t}):e[i]=t}let me=new Array(256),ce=new Array(256);for(let e=0;e<256;e++)me[e]=oe(e)?1:0,ce[e]=oe(e);function q(e,i){this.input=e,this.filename=i.filename||null,this.schema=i.schema||L,this.onWarning=i.onWarning||null,this.legacy=i.legacy||!1,this.json=i.json||!1,this.listener=i.listener||null,this.maxDepth=typeof i.maxDepth=="number"?i.maxDepth:100,this.maxTotalMergeKeys=typeof i.maxTotalMergeKeys=="number"?i.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 ge(e,i){let t={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return t.snippet=I(t),new _(i,t)}function b(e,i){throw ge(e,i)}function ne(e,i){e.onWarning&&e.onWarning.call(null,ge(e,i))}function K(e,i,t){let p=e.anchorMapTransactions;if(p.length!==0){let o=p[p.length-1];d.call(o,i)||(o[i]={existed:d.call(e.anchorMap,i),value:e.anchorMap[i]})}e.anchorMap[i]=t}function Ne(e){e.anchorMapTransactions.push(Object.create(null))}function ee(e){let i=e.anchorMapTransactions.pop(),t=e.anchorMapTransactions;if(t.length===0)return;let p=t[t.length-1],o=Object.keys(i);for(let A=0,n=o.length;A<n;A+=1){let r=o[A];d.call(p,r)||(p[r]=i[r])}}function Re(e){let i=e.anchorMapTransactions.pop(),t=Object.keys(i);for(let p=t.length-1;p>=0;p-=1){let o=i[t[p]];o.existed?e.anchorMap[t[p]]=o.value:delete e.anchorMap[t[p]]}}function ue(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 ie(e,i){e.position=i.position,e.line=i.line,e.lineStart=i.lineStart,e.lineIndent=i.lineIndent,e.firstTabInLine=i.firstTabInLine,e.tag=i.tag,e.anchor=i.anchor,e.kind=i.kind,e.result=i.result}let Ae={YAML:function(i,t,p){i.version!==null&&b(i,"duplication of %YAML directive"),p.length!==1&&b(i,"YAML directive accepts exactly one argument");let o=/^([0-9]+)\.([0-9]+)$/.exec(p[0]);o===null&&b(i,"ill-formed argument of the YAML directive");let A=parseInt(o[1],10),n=parseInt(o[2],10);A!==1&&b(i,"unacceptable YAML version of the document"),i.version=p[0],i.checkLineBreaks=n<2,n!==1&&n!==2&&ne(i,"unsupported YAML version of the document")},TAG:function(i,t,p){let o;p.length!==2&&b(i,"TAG directive accepts exactly two arguments");let A=p[0];o=p[1],M.test(A)||b(i,"ill-formed tag handle (first argument) of the TAG directive"),d.call(i.tagMap,A)&&b(i,'there is a previously declared suffix for "'+A+'" tag handle'),U.test(o)||b(i,"ill-formed tag prefix (second argument) of the TAG directive");try{o=decodeURIComponent(o)}catch{b(i,"tag prefix is malformed: "+o)}i.tagMap[A]=o}};function B(e,i,t,p){if(i<t){let o=e.input.slice(i,t);if(p)for(let A=0,n=o.length;A<n;A+=1){let r=o.charCodeAt(A);r===9||r>=32&&r<=1114111||b(e,"expected valid JSON character")}else k.test(o)&&b(e,"the stream contains non-printable characters");e.result+=o}}function J(e,i,t,p){T.isObject(t)||b(e,"cannot merge mappings; the provided source object is unacceptable");let o=Object.keys(t);for(let A=0,n=o.length;A<n;A+=1){let r=o[A];e.maxTotalMergeKeys!==-1&&++e.totalMergeKeys>e.maxTotalMergeKeys&&b(e,"merge keys exceeded maxTotalMergeKeys ("+e.maxTotalMergeKeys+")"),d.call(i,r)||(te(i,r,t[r]),p[r]=!0)}}function G(e,i,t,p,o,A,n,r,m){if(Array.isArray(o)){o=Array.prototype.slice.call(o);for(let u=0,f=o.length;u<f;u+=1)Array.isArray(o[u])&&b(e,"nested arrays are not supported inside keys"),typeof o=="object"&&z(o[u])==="[object Object]"&&(o[u]="[object Object]")}if(typeof o=="object"&&z(o)==="[object Object]"&&(o="[object Object]"),o=String(o),i===null&&(i={}),p==="tag:yaml.org,2002:merge")if(Array.isArray(A))for(let u=0,f=A.length;u<f;u+=1)J(e,i,A[u],t);else J(e,i,A,t);else!e.json&&!d.call(t,o)&&d.call(i,o)&&(e.line=n||e.line,e.lineStart=r||e.lineStart,e.position=m||e.position,b(e,"duplicated mapping key")),te(i,o,A),delete t[o];return i}function re(e){let i=e.input.charCodeAt(e.position);i===10?e.position++:i===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):b(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function F(e,i,t){let p=0,o=e.input.charCodeAt(e.position);for(;o!==0;){for(;j(o);)o===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),o=e.input.charCodeAt(++e.position);if(i&&o===35)do o=e.input.charCodeAt(++e.position);while(o!==10&&o!==13&&o!==0);if(H(o))for(re(e),o=e.input.charCodeAt(e.position),p++,e.lineIndent=0;o===32;)e.lineIndent++,o=e.input.charCodeAt(++e.position);else break}return t!==-1&&p!==0&&e.lineIndent<t&&ne(e,"deficient indentation"),p}function le(e){let i=e.position,t=e.input.charCodeAt(i);return!!((t===45||t===46)&&t===e.input.charCodeAt(i+1)&&t===e.input.charCodeAt(i+2)&&(i+=3,t=e.input.charCodeAt(i),t===0||Y(t)))}function W(e,i){i===1?e.result+=" ":i>1&&(e.result+=T.repeat(`
13
- `,i-1))}function ye(e,i,t){let p,o,A,n,r,m,u=e.kind,f=e.result,g=e.input.charCodeAt(e.position);if(Y(g)||$(g)||g===35||g===38||g===42||g===33||g===124||g===62||g===39||g===34||g===37||g===64||g===96)return!1;if(g===63||g===45){let h=e.input.charCodeAt(e.position+1);if(Y(h)||t&&$(h))return!1}for(e.kind="scalar",e.result="",p=o=e.position,A=!1;g!==0;){if(g===58){let h=e.input.charCodeAt(e.position+1);if(Y(h)||t&&$(h))break}else if(g===35){let h=e.input.charCodeAt(e.position-1);if(Y(h))break}else{if(e.position===e.lineStart&&le(e)||t&&$(g))break;if(H(g))if(n=e.line,r=e.lineStart,m=e.lineIndent,F(e,!1,-1),e.lineIndent>=i){A=!0,g=e.input.charCodeAt(e.position);continue}else{e.position=o,e.line=n,e.lineStart=r,e.lineIndent=m;break}}A&&(B(e,p,o,!1),W(e,e.line-n),p=o=e.position,A=!1),j(g)||(o=e.position+1),g=e.input.charCodeAt(++e.position)}return B(e,p,o,!1),e.result?!0:(e.kind=u,e.result=f,!1)}function Ce(e,i){let t,p,o=e.input.charCodeAt(e.position);if(o!==39)return!1;for(e.kind="scalar",e.result="",e.position++,t=p=e.position;(o=e.input.charCodeAt(e.position))!==0;)if(o===39)if(B(e,t,e.position,!0),o=e.input.charCodeAt(++e.position),o===39)t=e.position,e.position++,p=e.position;else return!0;else H(o)?(B(e,t,p,!0),W(e,F(e,!1,i)),t=p=e.position):e.position===e.lineStart&&le(e)?b(e,"unexpected end of the document within a single quoted scalar"):(e.position++,j(o)||(p=e.position));b(e,"unexpected end of the stream within a single quoted scalar")}function fe(e,i){let t,p,o,A=e.input.charCodeAt(e.position);if(A!==34)return!1;for(e.kind="scalar",e.result="",e.position++,t=p=e.position;(A=e.input.charCodeAt(e.position))!==0;){if(A===34)return B(e,t,e.position,!0),e.position++,!0;if(A===92){if(B(e,t,e.position,!0),A=e.input.charCodeAt(++e.position),H(A))F(e,!1,i);else if(A<256&&me[A])e.result+=ce[A],e.position++;else if((o=ke(A))>0){let n=o,r=0;for(;n>0;n--)A=e.input.charCodeAt(++e.position),(o=Oe(A))>=0?r=(r<<4)+o:b(e,"expected hexadecimal character");e.result+=Le(r),e.position++}else b(e,"unknown escape sequence");t=p=e.position}else H(A)?(B(e,t,p,!0),W(e,F(e,!1,i)),t=p=e.position):e.position===e.lineStart&&le(e)?b(e,"unexpected end of the document within a double quoted scalar"):(e.position++,j(A)||(p=e.position))}b(e,"unexpected end of the stream within a double quoted scalar")}function Se(e,i){let t=!0,p,o,A,n=e.tag,r,m=e.anchor,u,f,g,h,x=Object.create(null),w,E,O,N=e.input.charCodeAt(e.position);if(N===91)u=93,h=!1,r=[];else if(N===123)u=125,h=!0,r={};else return!1;for(e.anchor!==null&&K(e,e.anchor,r),N=e.input.charCodeAt(++e.position);N!==0;){if(F(e,!0,i),N=e.input.charCodeAt(e.position),N===u)return e.position++,e.tag=n,e.anchor=m,e.kind=h?"mapping":"sequence",e.result=r,!0;if(t?N===44&&b(e,"expected the node content, but found ','"):b(e,"missed comma between flow collection entries"),E=w=O=null,f=g=!1,N===63){let v=e.input.charCodeAt(e.position+1);Y(v)&&(f=g=!0,e.position++,F(e,!0,i))}p=e.line,o=e.lineStart,A=e.position,V(e,i,y,!1,!0),E=e.tag,w=e.result,F(e,!0,i),N=e.input.charCodeAt(e.position),(g||e.line===p)&&N===58&&(f=!0,N=e.input.charCodeAt(++e.position),F(e,!0,i),V(e,i,y,!1,!0),O=e.result),h?G(e,r,x,E,w,O,p,o,A):f?r.push(G(e,null,x,E,w,O,p,o,A)):r.push(w),F(e,!0,i),N=e.input.charCodeAt(e.position),N===44?(t=!0,N=e.input.charCodeAt(++e.position)):t=!1}b(e,"unexpected end of the stream within a flow collection")}function Te(e,i){let t,p=l,o=!1,A=!1,n=i,r=0,m=!1,u,f=e.input.charCodeAt(e.position);if(f===124)t=!1;else if(f===62)t=!0;else return!1;for(e.kind="scalar",e.result="";f!==0;)if(f=e.input.charCodeAt(++e.position),f===43||f===45)l===p?p=f===43?C:c:b(e,"repeat of a chomping mode identifier");else if((u=de(f))>=0)u===0?b(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):A?b(e,"repeat of an indentation width identifier"):(n=i+u-1,A=!0);else break;if(j(f)){do f=e.input.charCodeAt(++e.position);while(j(f));if(f===35)do f=e.input.charCodeAt(++e.position);while(!H(f)&&f!==0)}for(;f!==0;){for(re(e),e.lineIndent=0,f=e.input.charCodeAt(e.position);(!A||e.lineIndent<n)&&f===32;)e.lineIndent++,f=e.input.charCodeAt(++e.position);if(!A&&e.lineIndent>n&&(n=e.lineIndent),H(f)){r++;continue}if(!A&&n===0&&b(e,"missing indentation for block scalar"),e.lineIndent<n){p===C?e.result+=T.repeat(`
14
- `,o?1+r:r):p===l&&o&&(e.result+=`
15
- `);break}t?j(f)?(m=!0,e.result+=T.repeat(`
16
- `,o?1+r:r)):m?(m=!1,e.result+=T.repeat(`
17
- `,r+1)):r===0?o&&(e.result+=" "):e.result+=T.repeat(`
18
- `,r):e.result+=T.repeat(`
19
- `,o?1+r:r),o=!0,A=!0,r=0;let g=e.position;for(;!H(f)&&f!==0;)f=e.input.charCodeAt(++e.position);B(e,g,e.position,!1)}return!0}function Q(e,i){let t=e.tag,p=e.anchor,o=[],A=!1;if(e.firstTabInLine!==-1)return!1;e.anchor!==null&&K(e,e.anchor,o);let n=e.input.charCodeAt(e.position);for(;n!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,b(e,"tab characters must not be used in indentation")),n===45);){let r=e.input.charCodeAt(e.position+1);if(!Y(r))break;if(A=!0,e.position++,F(e,!0,-1)&&e.lineIndent<=i){o.push(null),n=e.input.charCodeAt(e.position);continue}let m=e.line;if(V(e,i,s,!1,!0),o.push(e.result),F(e,!0,-1),n=e.input.charCodeAt(e.position),(e.line===m||e.lineIndent>i)&&n!==0)b(e,"bad indentation of a sequence entry");else if(e.lineIndent<i)break}return A?(e.tag=t,e.anchor=p,e.kind="sequence",e.result=o,!0):!1}function we(e,i,t){let p,o,A,n,r=e.tag,m=e.anchor,u={},f=Object.create(null),g=null,h=null,x=null,w=!1,E=!1;if(e.firstTabInLine!==-1)return!1;e.anchor!==null&&K(e,e.anchor,u);let O=e.input.charCodeAt(e.position);for(;O!==0;){!w&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,b(e,"tab characters must not be used in indentation"));let N=e.input.charCodeAt(e.position+1),v=e.line;if((O===63||O===58)&&Y(N))O===63?(w&&(G(e,u,f,g,h,null,o,A,n),g=h=x=null),E=!0,w=!0,p=!0):w?(w=!1,p=!0):b(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,O=N;else{if(o=e.line,A=e.lineStart,n=e.position,!V(e,t,a,!1,!0))break;if(e.line===v){for(O=e.input.charCodeAt(e.position);j(O);)O=e.input.charCodeAt(++e.position);if(O===58)O=e.input.charCodeAt(++e.position),Y(O)||b(e,"a whitespace character is expected after the key-value separator within a block mapping"),w&&(G(e,u,f,g,h,null,o,A,n),g=h=x=null),E=!0,w=!1,p=!1,g=e.tag,h=e.result;else if(E)b(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=r,e.anchor=m,!0}else if(E)b(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=r,e.anchor=m,!0}if((e.line===v||e.lineIndent>i)&&(w&&(o=e.line,A=e.lineStart,n=e.position),V(e,i,S,!0,p)&&(w?h=e.result:x=e.result),w||(G(e,u,f,g,h,x,o,A,n),g=h=x=null),F(e,!0,-1),O=e.input.charCodeAt(e.position)),(e.line===v||e.lineIndent>i)&&O!==0)b(e,"bad indentation of a mapping entry");else if(e.lineIndent<i)break}return w&&G(e,u,f,g,h,null,o,A,n),E&&(e.tag=r,e.anchor=m,e.kind="mapping",e.result=u),E}function ve(e){let i=!1,t=!1,p,o,A=e.input.charCodeAt(e.position);if(A!==33)return!1;e.tag!==null&&b(e,"duplication of a tag property"),A=e.input.charCodeAt(++e.position),A===60?(i=!0,A=e.input.charCodeAt(++e.position)):A===33?(t=!0,p="!!",A=e.input.charCodeAt(++e.position)):p="!";let n=e.position;if(i){do A=e.input.charCodeAt(++e.position);while(A!==0&&A!==62);e.position<e.length?(o=e.input.slice(n,e.position),A=e.input.charCodeAt(++e.position)):b(e,"unexpected end of the stream within a verbatim tag")}else{for(;A!==0&&!Y(A);)A===33&&(t?b(e,"tag suffix cannot contain exclamation marks"):(p=e.input.slice(n-1,e.position+1),M.test(p)||b(e,"named tag handle cannot contain such characters"),t=!0,n=e.position+1)),A=e.input.charCodeAt(++e.position);o=e.input.slice(n,e.position),X.test(o)&&b(e,"tag suffix cannot contain flow indicator characters")}o&&!U.test(o)&&b(e,"tag name cannot contain such characters: "+o);try{o=decodeURIComponent(o)}catch{b(e,"tag name is malformed: "+o)}return i?e.tag=o:d.call(e.tagMap,p)?e.tag=e.tagMap[p]+o:p==="!"?e.tag="!"+o:p==="!!"?e.tag="tag:yaml.org,2002:"+o:b(e,'undeclared tag handle "'+p+'"'),!0}function xe(e){let i=e.input.charCodeAt(e.position);if(i!==38)return!1;e.anchor!==null&&b(e,"duplication of an anchor property"),i=e.input.charCodeAt(++e.position);let t=e.position;for(;i!==0&&!Y(i)&&!$(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&b(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function be(e){let i=e.input.charCodeAt(e.position);if(i!==42)return!1;i=e.input.charCodeAt(++e.position);let t=e.position;for(;i!==0&&!Y(i)&&!$(i);)i=e.input.charCodeAt(++e.position);e.position===t&&b(e,"name of an alias node must contain at least one character");let p=e.input.slice(t,e.position);return d.call(e.anchorMap,p)||b(e,'unidentified alias "'+p+'"'),e.result=e.anchorMap[p],F(e,!0,-1),!0}function Me(e,i,t,p){let o=ue(e);return Ne(e),ie(e,i),e.tag=null,e.anchor=null,e.kind=null,e.result=null,we(e,t,p)&&e.kind==="mapping"?(ee(e),!0):(Re(e),ie(e,o),!1)}function V(e,i,t,p,o){let A,n,r=1,m=!1,u=!1,f=null,g,h,x;e.depth>=e.maxDepth&&b(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 w=A=n=S===t||s===t;if(p&&F(e,!0,-1)&&(m=!0,e.lineIndent>i?r=1:e.lineIndent===i?r=0:e.lineIndent<i&&(r=-1)),r===1)for(;;){let E=e.input.charCodeAt(e.position),O=ue(e);if(m&&(E===33&&e.tag!==null||E===38&&e.anchor!==null)||!ve(e)&&!xe(e))break;f===null&&(f=O),F(e,!0,-1)?(m=!0,n=w,e.lineIndent>i?r=1:e.lineIndent===i?r=0:e.lineIndent<i&&(r=-1)):n=!1}if(n&&(n=m||o),r===1||S===t)if(y===t||a===t?h=i:h=i+1,x=e.position-e.lineStart,r===1)if(n&&(Q(e,x)||we(e,x,h))||Se(e,h))u=!0;else{let E=e.input.charCodeAt(e.position);f!==null&&w&&!n&&E!==124&&E!==62&&Me(e,f,f.position-f.lineStart,h)||A&&Te(e,h)||Ce(e,h)||fe(e,h)?u=!0:be(e)?(u=!0,(e.tag!==null||e.anchor!==null)&&b(e,"alias node should not have any properties")):ye(e,h,y===t)&&(u=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&K(e,e.anchor,e.result)}else r===0&&(u=n&&Q(e,x));if(e.tag===null)e.anchor!==null&&K(e,e.anchor,e.result);else if(e.tag==="?"){e.result!==null&&e.kind!=="scalar"&&b(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"');for(let E=0,O=e.implicitTypes.length;E<O;E+=1)if(g=e.implicitTypes[E],g.resolve(e.result)){e.result=g.construct(e.result),e.tag=g.tag,e.anchor!==null&&K(e,e.anchor,e.result);break}}else if(e.tag!=="!"){if(d.call(e.typeMap[e.kind||"fallback"],e.tag))g=e.typeMap[e.kind||"fallback"][e.tag];else{g=null;let E=e.typeMap.multi[e.kind||"fallback"];for(let O=0,N=E.length;O<N;O+=1)if(e.tag.slice(0,E[O].tag.length)===E[O].tag){g=E[O];break}}g||b(e,"unknown tag !<"+e.tag+">"),e.result!==null&&g.kind!==e.kind&&b(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+g.kind+'", not "'+e.kind+'"'),g.resolve(e.result,e.tag)?(e.result=g.construct(e.result,e.tag),e.anchor!==null&&K(e,e.anchor,e.result)):b(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||u}function Fe(e){let i=e.position,t=!1,p;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(p=e.input.charCodeAt(e.position))!==0&&(F(e,!0,-1),p=e.input.charCodeAt(e.position),!(e.lineIndent>0||p!==37));){t=!0,p=e.input.charCodeAt(++e.position);let o=e.position;for(;p!==0&&!Y(p);)p=e.input.charCodeAt(++e.position);let A=e.input.slice(o,e.position),n=[];for(A.length<1&&b(e,"directive name must not be less than one character in length");p!==0;){for(;j(p);)p=e.input.charCodeAt(++e.position);if(p===35){do p=e.input.charCodeAt(++e.position);while(p!==0&&!H(p));break}if(H(p))break;for(o=e.position;p!==0&&!Y(p);)p=e.input.charCodeAt(++e.position);n.push(e.input.slice(o,e.position))}p!==0&&re(e),d.call(Ae,A)?Ae[A](e,A,n):ne(e,'unknown document directive "'+A+'"')}if(F(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,F(e,!0,-1)):t&&b(e,"directives end mark is expected"),V(e,e.lineIndent-1,S,!1,!0),F(e,!0,-1),e.checkLineBreaks&&R.test(e.input.slice(i,e.position))&&ne(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&le(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,F(e,!0,-1));return}e.position<e.length-1&&b(e,"end of the stream or a document separator is expected")}function _e(e,i){e=String(e),i=i||{},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 t=new q(e,i),p=e.indexOf("\0");for(p!==-1&&(t.position=p,b(t,"null byte is not allowed in input")),t.input+="\0";t.input.charCodeAt(t.position)===32;)t.lineIndent+=1,t.position+=1;for(;t.position<t.length-1;)Fe(t);return t.documents}function Ee(e,i,t){i!==null&&typeof i=="object"&&typeof t>"u"&&(t=i,i=null);let p=_e(e,t);if(typeof i!="function")return p;for(let o=0,A=p.length;o<A;o+=1)i(p[o])}function qe(e,i){let t=_e(e,i);if(t.length!==0){if(t.length===1)return t[0];throw new _("expected a single document in the stream, but found more")}}return Ie.loadAll=Ee,Ie.load=qe,Ie}var on={},Nn;function zn(){if(Nn)return on;Nn=1;let T=ae(),_=he(),I=tn(),L=Object.prototype.toString,d=Object.prototype.hasOwnProperty,y=65279,a=9,s=10,S=13,l=32,c=33,C=34,k=35,R=37,X=38,M=39,U=42,z=44,H=45,j=58,Y=61,$=62,Oe=63,ke=64,de=91,oe=93,Le=96,te=123,me=124,ce=125,q={};q[0]="\\0",q[7]="\\a",q[8]="\\b",q[9]="\\t",q[10]="\\n",q[11]="\\v",q[12]="\\f",q[13]="\\r",q[27]="\\e",q[34]='\\"',q[92]="\\\\",q[133]="\\N",q[160]="\\_",q[8232]="\\L",q[8233]="\\P";let ge=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],b=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function ne(n,r){if(r===null)return{};let m={},u=Object.keys(r);for(let f=0,g=u.length;f<g;f+=1){let h=u[f],x=String(r[h]);h.slice(0,2)==="!!"&&(h="tag:yaml.org,2002:"+h.slice(2));let w=n.compiledTypeMap.fallback[h];w&&d.call(w.styleAliases,x)&&(x=w.styleAliases[x]),m[h]=x}return m}function K(n){let r,m,u=n.toString(16).toUpperCase();if(n<=255)r="x",m=2;else if(n<=65535)r="u",m=4;else if(n<=4294967295)r="U",m=8;else throw new _("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+T.repeat("0",m-u.length)+u}let Ne=1,ee=2;function Re(n){this.schema=n.schema||I,this.indent=Math.max(1,n.indent||2),this.noArrayIndent=n.noArrayIndent||!1,this.skipInvalid=n.skipInvalid||!1,this.flowLevel=T.isNothing(n.flowLevel)?-1:n.flowLevel,this.styleMap=ne(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==='"'?ee:Ne,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 ue(n,r){let m=T.repeat(" ",r),u=0,f="",g=n.length;for(;u<g;){let h,x=n.indexOf(`
21
- `,u);x===-1?(h=n.slice(u),u=g):(h=n.slice(u,x+1),u=x+1),h.length&&h!==`
22
- `&&(f+=m),f+=h}return f}function ie(n,r){return`
23
- `+T.repeat(" ",n.indent*r)}function Ae(n,r){for(let m=0,u=n.implicitTypes.length;m<u;m+=1)if(n.implicitTypes[m].resolve(r))return!0;return!1}function B(n){return n===l||n===a}function J(n){return n>=32&&n<=126||n>=161&&n<=55295&&n!==8232&&n!==8233||n>=57344&&n<=65533&&n!==y||n>=65536&&n<=1114111}function G(n){return J(n)&&n!==y&&n!==S&&n!==s}function re(n,r,m){let u=G(n),f=u&&!B(n);return(m?u:u&&n!==z&&n!==de&&n!==oe&&n!==te&&n!==ce)&&n!==k&&!(r===j&&!f)||G(r)&&!B(r)&&n===k||r===j&&f}function F(n){return J(n)&&n!==y&&!B(n)&&n!==H&&n!==Oe&&n!==j&&n!==z&&n!==de&&n!==oe&&n!==te&&n!==ce&&n!==k&&n!==X&&n!==U&&n!==c&&n!==me&&n!==Y&&n!==$&&n!==M&&n!==C&&n!==R&&n!==ke&&n!==Le}function le(n){return!B(n)&&n!==j}function W(n,r){let m=n.charCodeAt(r),u;return m>=55296&&m<=56319&&r+1<n.length&&(u=n.charCodeAt(r+1),u>=56320&&u<=57343)?(m-55296)*1024+u-56320+65536:m}function ye(n){return/^\n* /.test(n)}let Ce=1,fe=2,Se=3,Te=4,Q=5;function we(n,r,m,u,f,g,h,x){let w,E=0,O=null,N=!1,v=!1,cn=u!==-1,pe=-1,se=F(W(n,0))&&le(W(n,n.length-1));if(r||h)for(w=0;w<n.length;E>=65536?w+=2:w++){if(E=W(n,w),!J(E))return Q;se=se&&re(E,O,x),O=E}else{for(w=0;w<n.length;E>=65536?w+=2:w++){if(E=W(n,w),E===s)N=!0,cn&&(v=v||w-pe-1>u&&n[pe+1]!==" ",pe=w);else if(!J(E))return Q;se=se&&re(E,O,x),O=E}v=v||cn&&w-pe-1>u&&n[pe+1]!==" "}return!N&&!v?se&&!h&&!f(n)?Ce:g===ee?Q:fe:m>9&&ye(n)?Q:h?g===ee?Q:fe:v?Te:Se}function ve(n,r,m,u,f){n.dump=(function(){if(r.length===0)return n.quotingType===ee?'""':"''";if(!n.noCompatMode&&(ge.indexOf(r)!==-1||b.test(r)))return n.quotingType===ee?'"'+r+'"':"'"+r+"'";let g=n.indent*Math.max(1,m),h=n.lineWidth===-1?-1:Math.max(Math.min(n.lineWidth,40),n.lineWidth-g),x=u||n.flowLevel>-1&&m>=n.flowLevel;function w(E){return Ae(n,E)}switch(we(r,x,n.indent,h,w,n.quotingType,n.forceQuotes&&!u,f)){case Ce:return r;case fe:return"'"+r.replace(/'/g,"''")+"'";case Se:return"|"+xe(r,n.indent)+be(ue(r,g));case Te:return">"+xe(r,n.indent)+be(ue(Me(r,h),g));case Q:return'"'+Fe(r)+'"';default:throw new _("impossible error: invalid scalar style")}})()}function xe(n,r){let m=ye(n)?String(r):"",u=n[n.length-1]===`
24
- `,g=u&&(n[n.length-2]===`
25
- `||n===`
26
- `)?"+":u?"":"-";return m+g+`
27
- `}function be(n){return n[n.length-1]===`
28
- `?n.slice(0,-1):n}function Me(n,r){let m=/(\n+)([^\n]*)/g,u=(function(){let x=n.indexOf(`
29
- `);return x=x!==-1?x:n.length,m.lastIndex=x,V(n.slice(0,x),r)})(),f=n[0]===`
30
- `||n[0]===" ",g,h;for(;h=m.exec(n);){let x=h[1],w=h[2];g=w[0]===" ",u+=x+(!f&&!g&&w!==""?`
31
- `:"")+V(w,r),f=g}return u}function V(n,r){if(n===""||n[0]===" ")return n;let m=/ [^ ]/g,u,f=0,g,h=0,x=0,w="";for(;u=m.exec(n);)x=u.index,x-f>r&&(g=h>f?h:x,w+=`
32
- `+n.slice(f,g),f=g+1),h=x;return w+=`
33
- `,n.length-f>r&&h>f?w+=n.slice(f,h)+`
34
- `+n.slice(h+1):w+=n.slice(f),w.slice(1)}function Fe(n){let r="",m=0;for(let u=0;u<n.length;m>=65536?u+=2:u++){m=W(n,u);let f=q[m];!f&&J(m)?(r+=n[u],m>=65536&&(r+=n[u+1])):r+=f||K(m)}return r}function _e(n,r,m){let u="",f=n.tag;for(let g=0,h=m.length;g<h;g+=1){let x=m[g];n.replacer&&(x=n.replacer.call(m,String(g),x)),(t(n,r,x,!1,!1)||typeof x>"u"&&t(n,r,null,!1,!1))&&(u!==""&&(u+=","+(n.condenseFlow?"":" ")),u+=n.dump)}n.tag=f,n.dump="["+u+"]"}function Ee(n,r,m,u){let f="",g=n.tag;for(let h=0,x=m.length;h<x;h+=1){let w=m[h];n.replacer&&(w=n.replacer.call(m,String(h),w)),(t(n,r+1,w,!0,!0,!1,!0)||typeof w>"u"&&t(n,r+1,null,!0,!0,!1,!0))&&((!u||f!=="")&&(f+=ie(n,r)),n.dump&&s===n.dump.charCodeAt(0)?f+="-":f+="- ",f+=n.dump)}n.tag=g,n.dump=f||"[]"}function qe(n,r,m){let u="",f=n.tag,g=Object.keys(m);for(let h=0,x=g.length;h<x;h+=1){let w="";u!==""&&(w+=", "),n.condenseFlow&&(w+='"');let E=g[h],O=m[E];n.replacer&&(O=n.replacer.call(m,E,O)),t(n,r,E,!1,!1)&&(n.dump.length>1024&&(w+="? "),w+=n.dump+(n.condenseFlow?'"':"")+":"+(n.condenseFlow?"":" "),t(n,r,O,!1,!1)&&(w+=n.dump,u+=w))}n.tag=f,n.dump="{"+u+"}"}function e(n,r,m,u){let f="",g=n.tag,h=Object.keys(m);if(n.sortKeys===!0)h.sort();else if(typeof n.sortKeys=="function")h.sort(n.sortKeys);else if(n.sortKeys)throw new _("sortKeys must be a boolean or a function");for(let x=0,w=h.length;x<w;x+=1){let E="";(!u||f!=="")&&(E+=ie(n,r));let O=h[x],N=m[O];if(n.replacer&&(N=n.replacer.call(m,O,N)),!t(n,r+1,O,!0,!0,!0))continue;let v=n.tag!==null&&n.tag!=="?"||n.dump&&n.dump.length>1024;v&&(n.dump&&s===n.dump.charCodeAt(0)?E+="?":E+="? "),E+=n.dump,v&&(E+=ie(n,r)),t(n,r+1,N,!0,v)&&(n.dump&&s===n.dump.charCodeAt(0)?E+=":":E+=": ",E+=n.dump,f+=E)}n.tag=g,n.dump=f||"{}"}function i(n,r,m){let u=m?n.explicitTypes:n.implicitTypes;for(let f=0,g=u.length;f<g;f+=1){let h=u[f];if((h.instanceOf||h.predicate)&&(!h.instanceOf||typeof r=="object"&&r instanceof h.instanceOf)&&(!h.predicate||h.predicate(r))){if(m?h.multi&&h.representName?n.tag=h.representName(r):n.tag=h.tag:n.tag="?",h.represent){let x=n.styleMap[h.tag]||h.defaultStyle,w;if(L.call(h.represent)==="[object Function]")w=h.represent(r,x);else if(d.call(h.represent,x))w=h.represent[x](r,x);else throw new _("!<"+h.tag+'> tag resolver accepts not "'+x+'" style');n.dump=w}return!0}}return!1}function t(n,r,m,u,f,g,h){n.tag=null,n.dump=m,i(n,m,!1)||i(n,m,!0);let x=L.call(n.dump),w=u;u&&(u=n.flowLevel<0||n.flowLevel>r);let E=x==="[object Object]"||x==="[object Array]",O,N;if(E&&(O=n.duplicates.indexOf(m),N=O!==-1),(n.tag!==null&&n.tag!=="?"||N||n.indent!==2&&r>0)&&(f=!1),N&&n.usedDuplicates[O])n.dump="*ref_"+O;else{if(E&&N&&!n.usedDuplicates[O]&&(n.usedDuplicates[O]=!0),x==="[object Object]")u&&Object.keys(n.dump).length!==0?(e(n,r,n.dump,f),N&&(n.dump="&ref_"+O+n.dump)):(qe(n,r,n.dump),N&&(n.dump="&ref_"+O+" "+n.dump));else if(x==="[object Array]")u&&n.dump.length!==0?(n.noArrayIndent&&!h&&r>0?Ee(n,r-1,n.dump,f):Ee(n,r,n.dump,f),N&&(n.dump="&ref_"+O+n.dump)):(_e(n,r,n.dump),N&&(n.dump="&ref_"+O+" "+n.dump));else if(x==="[object String]")n.tag!=="?"&&ve(n,n.dump,r,g,w);else{if(x==="[object Undefined]")return!1;if(n.skipInvalid)return!1;throw new _("unacceptable kind of an object to dump "+x)}if(n.tag!==null&&n.tag!=="?"){let v=encodeURI(n.tag[0]==="!"?n.tag.slice(1):n.tag).replace(/!/g,"%21");n.tag[0]==="!"?v="!"+v:v.slice(0,18)==="tag:yaml.org,2002:"?v="!!"+v.slice(18):v="!<"+v+">",n.dump=v+" "+n.dump}}return!0}function p(n,r){let m=[],u=[];o(n,m,u);let f=u.length;for(let g=0;g<f;g+=1)r.duplicates.push(m[u[g]]);r.usedDuplicates=new Array(f)}function o(n,r,m){if(n!==null&&typeof n=="object"){let u=r.indexOf(n);if(u!==-1)m.indexOf(u)===-1&&m.push(u);else if(r.push(n),Array.isArray(n))for(let f=0,g=n.length;f<g;f+=1)o(n[f],r,m);else{let f=Object.keys(n);for(let g=0,h=f.length;g<h;g+=1)o(n[f[g]],r,m)}}}function A(n,r){r=r||{};let m=new Re(r);m.noRefs||p(n,m);let u=n;return m.replacer&&(u=m.replacer.call({"":u},"",u)),t(m,0,u,!0,!0)?m.dump+`
35
- `:""}return on.dump=A,on}var Rn;function ei(){if(Rn)return P;Rn=1;let T=Zn(),_=zn();function I(L,d){return function(){throw new Error("Function yaml."+L+" is removed in js-yaml 4. Use yaml."+d+" instead, which is now safe by default.")}}return P.Type=D(),P.Schema=vn(),P.FAILSAFE_SCHEMA=Yn(),P.JSON_SCHEMA=Bn(),P.CORE_SCHEMA=Un(),P.DEFAULT_SCHEMA=tn(),P.load=T.load,P.loadAll=T.loadAll,P.dump=_.dump,P.YAMLException=he(),P.types={binary:Wn(),float:jn(),map:qn(),null:Pn(),pairs:Vn(),set:Xn(),timestamp:Kn(),bool:Dn(),int:Hn(),merge:Gn(),omap:Qn(),seq:Fn(),str:Mn()},P.safeLoad=I("safeLoad","load"),P.safeLoadAll=I("safeLoadAll","loadAll"),P.safeDump=I("safeDump","dump"),P}var ni=ei(),ii=$n(ni),{Type:ri,Schema:li,FAILSAFE_SCHEMA:oi,JSON_SCHEMA:ti,CORE_SCHEMA:ci,DEFAULT_SCHEMA:ui,load:fi,loadAll:pi,dump:si,YAMLException:ai,types:hi,safeLoad:di,safeLoadAll:mi,safeDump:gi}=ii;export{ii as a};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __swiftyCreateRequire } from "node:module";
3
- const require = __swiftyCreateRequire(import.meta.url);
4
- import{a as T,b as f}from"./chunk-E55KH72M.js";var c=class{tools=new Map;discovered=new Set;mcpLoadingMode="eager";exposeToolSearch=!1;exposeMcpCall=!1;register(e){this.tools.set(e.name,e)}get(e){return this.tools.get(e)}listTools(){return[...this.tools.values()]}getAllSchemas(e="anthropic"){let o=e==="openai"||e==="openai-compat",t=this.mcpLoadingMode==="native"&&!o,r=[];for(let s of this.tools.values()){if(s.name===T&&!this.exposeToolSearch||s.name===f&&!this.exposeMcpCall)continue;let i=!!s.deferred&&!this.discovered.has(s.name);if(i&&!t)continue;let n=s.schema();o?r.push({strict:!1,type:"function",name:n.name,description:n.description,parameters:n.input_schema,function:{name:n.name,description:n.description,parameters:n.input_schema}}):r.push(i?{...n,type:"custom",defer_loading:!0}:{...n,type:"custom"})}return r}getDeferredToolNames(){let e=[];for(let o of this.tools.values())o.deferred&&!this.discovered.has(o.name)&&e.push(o.name);return e.sort()}getDeferredTools(){return[...this.tools.values()].filter(e=>e.deferred&&!this.discovered.has(e.name))}searchDeferred(e,o=5){let t=e.toLowerCase(),r=[];for(let s of this.tools.values())if(!(!s.deferred||this.discovered.has(s.name))&&(s.name.toLowerCase().includes(t)||s.description.toLowerCase().includes(t))&&(r.push(s),r.length>=o))break;return r}findDeferredByNames(e){let o=new Map;for(let[t,r]of this.tools)o.set(t.toLowerCase(),r);return e.map(t=>o.get(t.toLowerCase())).filter(t=>t?.deferred??!1)}markDiscovered(e){this.discovered.add(e)}isDiscovered(e){return this.discovered.has(e)}};var h=new Set(["ExitPlanMode","Agent","AskUserQuestion","TaskStop"]),w=new Set(["TeamCreate","TeamDelete"]),m=new Set(["ExitPlanMode","Agent","AskUserQuestion","TaskStop"]),u=new Set(["ReadFile","Grep","Glob","Bash","PowerShell","EditFile","WriteFile","LoadSkill","SyntheticOutput","ToolSearch","EnterWorktree","ExitWorktree","McpCall"]);function g(a){return a.startsWith("mcp__")}function M(a,e,o,t,r=!1){let s=new Set(o??[]),i=new Set(e??[]),n=i.size>0&&!(i.size===1&&i.has("*")),p=new c;for(let d of a.listTools()){let l=d.name;if(g(l)){p.register(d);continue}h.has(l)||r&&m.has(l)||t&&!u.has(l)||s.has(l)||n&&!i.has(l)||p.register(d)}return p}var A="agent:builtin:fork";function k(a){let e=new c;for(let o of a.listTools())if(o.name==="Agent"&&"querySource"in o){let t=Object.create(Object.getPrototypeOf(o),Object.getOwnPropertyDescriptors(o));t.querySource=A,e.register(t)}else e.register(o);return e}export{c as a,h as b,w as c,m as d,u as e,M as f,A as g,k as h};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __swiftyCreateRequire } from "node:module";
3
- const require = __swiftyCreateRequire(import.meta.url);
4
- var g="Tool execution was interrupted. The tool may or may not have completed; verify before relying on its effects.",p="The user rejected this tool use. Nothing was changed (for file edits, the new content was NOT written).";function x(o){let t=new Set,l=new Set;for(let e of o){for(let s of e.toolResults??[])t.add(s.toolUseId);for(let s of e.toolUses??[])l.add(s.toolUseId)}let c=[];for(let e of o){let s=e;if((e.toolResults?.length??0)>0){let n=(e.toolResults??[]).filter(h=>l.has(h.toolUseId));if(n.length===0&&!e.content&&!(e.toolUses?.length??0))continue;s={...e,toolResults:n}}c.push(s);let i=[];for(let n of e.toolUses??[])t.has(n.toolUseId)||(i.push({toolUseId:n.toolUseId,content:g,isError:!0}),t.add(n.toolUseId));i.length>0&&c.push({role:"user",content:"",toolResults:i})}return c}var r=class extends Error{constructor(t){super(t),this.name="LLMError"}},u=class extends r{constructor(t){super(t),this.name="AuthenticationError"}},a=class extends r{retryAfter;constructor(t,l){super(t),this.name="RateLimitError",this.retryAfter=l}},d=class extends r{constructor(t){super(t),this.name="NetworkError"}},f=class extends r{constructor(t){super(t),this.name="ContextTooLongError"}};export{p as a,x as b,r as c,u as d,a as e,d as f,f as g};
@@ -1,130 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __swiftyCreateRequire } from "node:module";
3
- const require = __swiftyCreateRequire(import.meta.url);
4
- import{g as E}from"./chunk-FZPTNGTU.js";import{D as a,I,J as h,N as P,R as U,e as C,f as A}from"./chunk-SIWLMWHH.js";var y=class{history=[];longTermMemoryInjected=!1;baselineTokens=0;_anchorCount=0;addUserMessage(t){this.history.push({role:"user",content:t})}addAssistantMessage(t){this.history.push({role:"assistant",content:t})}addToolUseMessage(t,n,o,s){this.history.push({role:"assistant",content:t,toolUses:[{toolUseId:n,toolName:o,arguments:s}]})}addAssistantMessageWithTools(t,n){this.history.push({role:"assistant",content:t,toolUses:n})}addAssistantFull(t,n,o){this.history.push({role:"assistant",content:t,thinkingBlocks:n.length>0?n:void 0,toolUses:o.length>0?o:void 0})}addToolResultMessage(t,n,o,s){this.history.push({role:"user",content:"",toolResults:[{toolUseId:t,content:n,...s?.length?{contentBlocks:s}:{},isError:o}]})}addToolResultsMessage(t){this.history.push({role:"user",content:"",toolResults:t})}addSystemReminder(t){this.history.push({role:"user",content:`<system-reminder>
5
- ${t}
6
- </system-reminder>`})}hasReminderContaining(t){return this.history.some(n=>n.role==="user"&&h(n.content).includes(t))}injectLongTermMemory(t,n,o=""){if(this.longTermMemoryInjected)return;let s=[];if(t&&s.push(`# SWIFTY.md
7
- Codebase and user instructions are shown below. Be sure to adhere to these instructions. IMPORTANT: These instructions OVERRIDE any default behavior and you MUST follow them exactly as written.
8
-
9
- ${t}}`),n&&s.push(`# Auto Memory
10
- `+n),o&&s.push(`# Available Skills
11
- `+o),s.length===0)return;let r=new Date().toISOString().split("T")[0];s.push(`# Current Date
12
-
13
- Today's date is ${r}.`);let i=`
14
- <system-reminder>
15
- As you answer the user's questions, you can use the following context:
16
-
17
- ${s.join(`
18
-
19
- `)}
20
-
21
- IMPORTANT: this context may or may not be relevant to your tasks. You should not respond to this context unless it is highly relevant to your task.
22
- </system-reminder>`;this.history.unshift({role:"user",content:i}),this.longTermMemoryInjected=!0}appendMessages(t){this.history.push(...t)}len(){return this.history.length}truncateTo(t){t<0&&(t=0),!(t>this.history.length)&&(this.history=this.history.slice(0,t))}reset(){this.history=[],this.longTermMemoryInjected=!1,this.clearUsageAnchor()}getMessages(){return[...this.history]}replaceWithCompacted(t,n){this.history=[{role:"user",content:t},...n],this.longTermMemoryInjected=!1,this.clearUsageAnchor()}recordUsageAnchor(t,n,o,s){let r=t+o+s+n;r<=0||(this.baselineTokens=r,this._anchorCount=this.history.length)}clearUsageAnchor(){this.baselineTokens=0,this._anchorCount=0}usageAnchorState(){return this.baselineTokens<=0?null:{baselineTokens:this.baselineTokens,anchorCount:this._anchorCount}}};import{randomBytes as oe}from"crypto";import{readFileSync as O,writeFileSync as ne,readdirSync as se,mkdirSync as re,statSync as ie,existsSync as D,unlinkSync as De,rmSync as Fe}from"fs";import{join as k}from"path";function T(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Z=new Set(["image/jpeg","image/png","image/gif","image/webp"]);function ee(e){return Z.has(e)}function M(e){return T(e)&&e.type==="text"&&typeof e.text=="string"?{type:"text",text:e.text}:null}function v(e){return!T(e)||e.type!=="image"||!T(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"&&ee(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 te(e){if(e.type!=="document"||!T(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 n=[];for(let o of e.source.content){let s=M(o)??v(o);if(!s)return null;n.push(s)}t={type:"content",content:n}}}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 j(e){let t=M(e);if(t)return t;let n=v(e);if(n)return n;if(!T(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 o=[];for(let s of e.content){let r=M(s);if(!r)return null;o.push(r)}return{type:"search_result",source:e.source,title:e.title,content:o}}return te(e)}var je=new Set([".claude",".git",".swifty",".next",".venv",".mypy_cache",".tox","__pycache__","build","dist","node_modules","vendor","venv"]);var S="compact_boundary";var F=a.object({tool_use_id:a.string(),tool_name:a.string(),arguments:a.record(a.string(),a.unknown()).optional()}),_=a.union([a.string(),a.array(a.record(a.string(),a.unknown()))]),$=a.object({tool_use_id:a.string(),content:_,content_blocks:a.array(a.unknown()).optional(),is_error:a.boolean().optional()}),z=a.object({role:a.string(),content:_.default(""),timestamp:a.number(),type:a.string().optional(),tool_uses:a.array(F).optional(),tool_results:a.array($).optional()}),ae=a.object({role:a.string(),content:_,tool_uses:a.array(F).optional(),tool_results:a.array($).optional()});function q(e){return(e??[]).map(t=>({tool_use_id:t.toolUseId,tool_name:t.toolName,...t.arguments&&Object.keys(t.arguments).length?{arguments:t.arguments}:{}}))}function Y(e){return(e??[]).map(t=>({tool_use_id:t.toolUseId,content:t.content,...t.contentBlocks?.length?{content_blocks:t.contentBlocks}:{},...t.isError?{is_error:!0}:{}}))}var le=a.object({summary:a.string(),keep:a.array(ae)}),R=I({module:"session"});function b(e){return k(e,".swifty","sessions")}function He(e,t){return k(b(e),t+".jsonl")}function We(){let e=Date.now().toString(36),t=oe(4).toString("hex");return`${e}-${t}`}function ce(e,t,n){let o=b(e);re(o,{recursive:!0});let s=k(o,`${t}.jsonl`),r=JSON.stringify(n)+`
23
- `;ne(s,r,{flag:"a",encoding:"utf-8"})}function Je(e,t,n){ce(e,t,{role:"system",content:JSON.stringify(n),timestamp:Math.floor(Date.now()/1e3),type:S})}function Ge(e,t){let n=k(b(e),`${t}.jsonl`);if(!D(n))return[];let o=[];for(let s of O(n,"utf-8").split(`
24
- `))if(s.trim())try{let r=JSON.parse(s),{success:l,data:i,error:c}=A(z,r);l?!i.content&&!(i.tool_uses?.length??0)&&!(i.tool_results?.length??0)||o.push(i):R.error({err:c},"session operation failed")}catch(r){R.error({err:r},"session operation failed")}return o}function K(e){return e?.map(t=>({toolUseId:t.tool_use_id,toolName:t.tool_name,arguments:t.arguments}))}function N(e){if(!e)return;let t=[];for(let n of e){let o=j(n);o&&t.push(o)}return t.length>0?t:void 0}function H(e){return e?.map(t=>{let n=Array.isArray(t.content)?N(t.content):void 0,o=N(t.content_blocks)??n;return{toolUseId:t.tool_use_id,content:typeof t.content=="string"?t.content:h(t.content),...o?{contentBlocks:o}:{},isError:t.is_error??!1}})}function Xe(e){let t=-1;for(let o=e.length-1;o>=0;o--)if(e[o].type===S){t=o;break}let n=[];if(t>=0){let o=null;try{let s=e[t].content,r=typeof s=="string"?JSON.parse(s):null;o=C(le,r)}catch{o=null}if(o){let s=`This session continues from a previous conversation, which has been compressed due to context limitations. Here is a summary of the earlier messages:
25
-
26
- `+o.summary;o.keep.length>0&&(s+=`
27
-
28
- Recent messages have been preserved verbatim.`),n.push({role:"user",content:s});for(let r of o.keep)r.role!=="user"&&r.role!=="assistant"||!r.content&&!(r.tool_uses?.length??0)&&!(r.tool_results?.length??0)||n.push({role:r.role,content:r.content,toolUses:K(r.tool_uses),toolResults:H(r.tool_results)})}for(let s=t+1;s<e.length;s++){let r=e[s];if(r.type===S)continue;let l=L(r);l&&n.push(l)}return n}for(let o of e){let s=L(o);s&&n.push(s)}return n}function L(e){return e.role!=="user"&&e.role!=="assistant"||!e.content&&!(e.tool_uses?.length??0)&&!(e.tool_results?.length??0)?null:{role:e.role,content:e.content,toolUses:K(e.tool_uses),toolResults:H(e.tool_results)}}function Ve(e){let t=b(e);if(!D(t))return[];let n=se(t).filter(s=>s.endsWith(".jsonl")),o=[];for(let s of n){let r=k(t,s),l=ie(r),i=s.replace(".jsonl",""),c="",u=0;try{for(let p of O(r,"utf-8").split(`
29
- `)){if(!p.trim())continue;let d;try{let f=JSON.parse(p);d=C(z,f)}catch(f){R.error({err:f},"session operation failed");continue}u++,!c&&d.role==="user"&&d.content&&(c=h(d.content).slice(0,100))}}catch(p){R.error({err:p},"session operation failed");continue}o.push({id:i,firstMessage:c,messageCount:u,size:l.size,modTime:l.mtime})}return o.sort((s,r)=>r.modTime.getTime()-s.modTime.getTime()),o}var W=3,ue=3,me="[earlier conversation truncated for compaction retry]",pe=3.5,de=1e4,fe=5,ge=4e4,he=2,ye=2e4,Te=13e3,ke=3e3;function J(e,t,n=!1){return e-Math.min(t,ye)-(n?ke:Te)}var G=class{consecutiveFailures=0},x=7e3;function Re(e){if(typeof e=="string")return e.length;let t=0;for(let n of e)n.type==="text"?t+=U(n,"text").length:n.type==="image"&&(t+=x);return t}function be(e){let t=0,n=0;for(let o of e)switch(o.type){case"text":{t+=o.text.length;break}case"image":{n+=x;break}case"tool_reference":{n+=o.tool_name.length;break}case"search_result":{n+=o.source.length+o.title.length,n+=o.content.reduce((s,r)=>s+r.text.length,0);break}case"document":{switch(o.source.type){case"base64":{n+=x;break}case"url":{n+=o.source.url.length;break}case"text":{n+=o.source.data.length;break}case"content":{if(typeof o.source.content=="string"){n+=o.source.content.length;break}for(let s of o.source.content)n+=s.type==="text"?s.text.length:x;break}}break}}return{textChars:t,richChars:n}}function w(e){let t=0;for(let n of e){if(t+=Re(n.content),n.toolUses&&(t+=JSON.stringify(n.toolUses).length),n.toolResults)for(let o of n.toolResults)if(o.contentBlocks?.length){let s=be(o.contentBlocks);t+=Math.max(o.content.length,s.textChars)+s.richChars}else t+=o.content.length;if(n.thinkingBlocks)for(let o of n.thinkingBlocks)t+=o.thinking.length}return Math.ceil(t/pe)}function xe(e){return w(e.getMessages())}function B(e){return w([e])}function Ce(e){return e.role==="user"&&!!e.toolResults&&e.toolResults.length>0}function Me(e){let t=0,n=0,o=e.length;for(let s=e.length-1;s>=0;s--){let r=B(e[s]);if(n>0&&t+r>ge||(o=s,t+=r,n++,t>=de||n>=fe))break}return o=Se(e,o),o}function Se(e,t){if(t<=0||t>=e.length||!Ce(e[t]))return t;let n=new Set((e[t].toolResults??[]).map(o=>o.toolUseId));for(let o=t-1;o>=0;o--){let s=e[o];if(s.role==="assistant"&&s.toolUses?.some(r=>n.has(r.toolUseId)))return o}return t}function _e(e,t){let n=t??e.usageAnchorState();if(!n)return xe(e);let o=e.getMessages(),s=Math.min(n.anchorCount,o.length);return n.baselineTokens+w(o.slice(s))}async function nt(e,t,n,o,s,r,l,i,c=""){let u=_e(e),p=J(n,o),d=J(n,o,!0);if(u<p)return{compacted:!1,message:""};if(!(u>=d)&&s.consecutiveFailures>=W)return{compacted:!1,message:`Auto-compact circuit breaker: ${String(W)} consecutive failures`};try{let g=await Q(e,t,r,l,i,c);return s.consecutiveFailures=0,g}catch(g){return s.consecutiveFailures++,{compacted:!1,message:`Auto-compact failed: ${P(g)}`}}}async function st(e,t,n,o,s,r=""){return Q(e,t,n,o,s,r)}var X=`Your task is to create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions.
30
- This summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing development work without losing context.
31
-
32
- Before providing your final summary, wrap your analysis in <analysis> tags to organize your thoughts and ensure you've covered all necessary points. In your analysis process:
33
-
34
- 1. Chronologically analyze each message and section of the conversation. For each section thoroughly identify:
35
- - The user's explicit requests and intents
36
- - Your approach to addressing the user's requests
37
- - Key decisions, technical concepts and code patterns
38
- - Specific details like:
39
- - file names
40
- - full code snippets
41
- - function signatures
42
- - file edits
43
- - Errors that you ran into and how you fixed them
44
- - Pay special attention to specific user feedback that you received, especially if the user told you to do something differently.
45
- 2. Double-check for technical accuracy and completeness, addressing each required element thoroughly.
46
-
47
- After your analysis, output your final summary wrapped in <summary> tags. Your summary should include the following sections:
48
-
49
- 1. Primary Request and Intent: Capture all of the user's explicit requests and intents in detail
50
- 2. Key Technical Concepts: List all important technical concepts, technologies, and frameworks discussed.
51
- 3. Files and Code Sections: Enumerate specific files and code sections examined, modified, or created. Pay special attention to the most recent messages and include full code snippets where applicable and include a summary of why this file read or edit is important.
52
- 4. Errors and fixes: List all errors that you ran into, and how you fixed them. Pay special attention to specific user feedback that you received, especially if the user told you to do something differently.
53
- 5. Problem Solving: Document problems solved and any ongoing troubleshooting efforts.
54
- 6. All user messages: List ALL user messages that are not tool results. These are critical for understanding the users' feedback and changing intent.
55
- 7. Pending Tasks: Outline any pending tasks that you have explicitly been asked to work on.
56
- 8. Current Work: Describe in detail precisely what was being worked on immediately before this summary request, paying special attention to the most recent messages from both user and assistant. Include file names and code snippets where applicable.
57
- 9. Optional Next Step: List the next step that you will take that is related to the most recent work you were doing. IMPORTANT: ensure that this step is DIRECTLY in line with the user's most recent explicit requests, and the task you were working on immediately before this summary request. If your last task was concluded, then only list next steps if they are explicitly in line with the users request. Do not start on tangential requests or really old requests that were already completed without confirming with the user first.
58
- If there is a next step, include direct quotes from the most recent conversation showing exactly what task you were working on and where you left off. This should be verbatim to ensure there's no drift in task interpretation.
59
-
60
- Here's an example of how your output should be structured:
61
-
62
- <example>
63
- <analysis>
64
- [Your thought process, ensuring all points are covered thoroughly and accurately]
65
- </analysis>
66
-
67
- <summary>
68
- 1. Primary Request and Intent:
69
- [Detailed description]
70
-
71
- 2. Key Technical Concepts:
72
- - [Concept 1]
73
- - [Concept 2]
74
- - [...]
75
-
76
- 3. Files and Code Sections:
77
- - [File Name 1]
78
- - [Summary of why this file is important]
79
- - [Summary of the changes made to this file, if any]
80
- - [Important Code Snippet]
81
- - [File Name 2]
82
- - [Important Code Snippet]
83
- - [...]
84
-
85
- 4. Errors and fixes:
86
- - [Detailed description of error 1]:
87
- - [How you fixed the error]
88
- - [User feedback on the error if any]
89
- - [...]
90
-
91
- 5. Problem Solving:
92
- [Description of solved problems and ongoing troubleshooting]
93
-
94
- 6. All user messages:
95
- - [Detailed non tool use user message]
96
- - [...]
97
-
98
- 7. Pending Tasks:
99
- - [Task 1]
100
- - [Task 2]
101
- - [...]
102
-
103
- 8. Current Work:
104
- [Precise description of current work]
105
-
106
- 9. Optional Next Step:
107
- [Optional Next step to take]
108
-
109
- </summary>
110
- </example>
111
-
112
- Please provide your summary based on the conversation so far, following this structure and ensuring precision and thoroughness in your response.`;function we(e){return X+`
113
-
114
- `+e}function Be(e){let t=[],n=[],o=!1;for(let s of e)s.role==="assistant"&&o&&n.length>0&&(t.push(n),n=[]),n.push(s),o=!!(s.toolResults&&s.toolResults.length>0);return n.length>0&&t.push(n),t}function Ae(e,t){let n=Be(e);if(n.length<2)return null;let o;if(t>0){let r=0;o=0;for(let l of n)if(r+=l.reduce((i,c)=>i+B(c),0),o++,r>=t)break}else o=Math.max(1,Math.floor(n.length/5));if(o=Math.min(o,n.length-1),o<1)return null;let s=n.slice(o).flat();return s.length>0&&s[0].role!=="user"&&s.unshift({role:"user",content:me}),s}function Ie(e){return e.map(t=>{let n=`[${t.role}]: ${h(t.content)}`;return t.toolUses&&(n+=`
115
- [tools: ${t.toolUses.map(o=>o.toolName).join(", ")}]`),t.toolResults&&(n+=`
116
- [tool results]
117
- ${t.toolResults.map(o=>o.content).join(`
118
- `)}`),n}).join(`
119
-
120
- `)}function V(e){let t=/<summary>([\s\S]*?)<\/summary>/.exec(e);if(t)return t[1].trim();let n=/<analysis>[\s\S]*?<\/analysis>/.exec(e);return n?e.replace(n[0],"").trim():e.trim()}async function Pe(e,t,n){let o=-1;for(let i=t.length-1;i>=0;i--)if(t[i].role==="assistant"){o=i;break}if(o<0)throw new Error("no assistant message found for cache-sharing compact");let s=new y;s.appendMessages(t.slice(0,o+1)),s.addUserMessage(X);let r="",l=e.stream(s,n);for await(let i of l)i.type==="text_delta"&&(r+=i.text);return V(r)}async function Ue(e,t,n){let o=t;for(let s=0;;s++){let r=Ie(o),l=new y;l.addUserMessage(we(r));try{let i="",c=e.stream(l,n);for await(let u of c)u.type==="text_delta"&&(i+=u.text);return V(i)}catch(i){let c=i instanceof Error?i.message.toLowerCase():"";if(!(c.includes("prompt")&&c.includes("long")||c.includes("too many")||c.includes("context_length"))||s>=ue)throw i;let p=o.reduce((f,g)=>f+B(g),0)/5,d=Ae(o,p);if(!d)throw i;o=d}}}async function Q(e,t,n,o,s,r=""){let l=e.getMessages(),i=Me(l);if(i<=0||i<he)return{compacted:!1,message:`Compaction skipped: only ${String(i)} message(s) to summarize, kept verbatim`};let c=l.slice(0,i),u=l.slice(i),p;try{p=await Pe(t,l,s)}catch(m){if(!(m instanceof E))throw m;p=await Ue(t,c,s)}let d=n?n.buildRecoveryAttachment(o):"",f=`This session continues from a previous conversation, which has been compressed due to context limitations. Here is a summary of the earlier messages:
121
-
122
- `+p;u.length>0&&(f+=`
123
-
124
- Recent messages have been preserved verbatim.`),r&&(f+=`
125
-
126
- If you need specific details from before compaction (code snippets, error messages, etc.), use ReadFile to read the full session transcript: ${r}`),d&&(f+=`
127
-
128
- ---
129
-
130
- ${d}`),e.replaceWithCompacted(f,u);let g=u.filter(m=>(m.role==="user"||m.role==="assistant")&&(m.content||(m.toolUses?.length??0)||(m.toolResults?.length??0))).map(m=>({role:m.role,content:m.content,...m.toolUses?.length?{tool_uses:q(m.toolUses)}:{},...m.toolResults?.length?{tool_results:Y(m.toolResults)}:{}}));return{compacted:!0,message:`Compacted ${String(c.length)} messages into summary (${String(p.length)} chars), kept ${String(u.length)} recent messages verbatim`,boundary:{summary:p,keep:g}}}export{y as a,je as b,q as c,Y as d,He as e,We as f,ce as g,Je as h,Ge as i,Xe as j,Ve as k,J as l,G as m,nt as n,st as o};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __swiftyCreateRequire } from "node:module";
3
- const require = __swiftyCreateRequire(import.meta.url);
4
- import{c as F}from"./chunk-QN27QEFS.js";import{a as y}from"./chunk-7MHXMDYC.js";import{D as d,I as D,R as c,e as v}from"./chunk-SIWLMWHH.js";import{b as k}from"./chunk-E55KH72M.js";import{readFileSync as _,writeFileSync as j,mkdirSync as M,statSync as $}from"fs";import{homedir as C,tmpdir as L}from"os";import{join as p,resolve as f,dirname as A}from"path";var E=D({module:"permissions"}),T=[],z=["ls","pwd","echo","cat","head","tail","wc","date","whoami","uname","hostname","which","type","file","git status","git log","git diff","git branch","git show","git rev-parse","git remote","bun test","bun run","npm test","npm run","go test","go build","go vet","python -c","node -e"],O={Bash:"command",PowerShell:"command",ReadFile:"file_path",WriteFile:"file_path",EditFile:"file_path",Glob:"pattern",Grep:"pattern"},Y=[".swifty/config.yaml",".swifty/permissions.local.yaml",".swifty/skills/"];function w(i,e){if(i===k)return F(c(e,"server",""),c(e,"tool",""));let t=O[i];if(!t)return"";let s=e[t];return typeof s=="string"?s:""}var R=class{allowedRoots;denyWritePaths;projectDir;constructor(e){this.projectDir=f(e),this.allowedRoots=[this.projectDir,L()],this.denyWritePaths=Y.map(t=>p(this.projectDir,t))}addRoot(e){this.allowedRoots.push(f(e))}addDenyWrite(e){this.denyWritePaths.push(f(e))}checkDenyWrite(e){let t=f(e);for(let s of this.denyWritePaths)if(t.startsWith(s))return{effect:"deny",reason:`Path ${e} is in deny-write list`};return null}check(e){let t=f(e);for(let s of this.allowedRoots)if(t.startsWith(s))return null;return{effect:"deny",reason:`Path ${e} is outside allowed directories`}}};function B(i,e){let t="^"+i.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".")+"$";try{return new RegExp(t).test(e)}catch(s){return E.error({err:s},"permissions operation failed"),!1}}var G=/^(\w+)\((.+)\)$/;function S(i){let e;try{e=_(i,"utf-8")}catch(n){return n.code!=="ENOENT"&&E.error({err:n},"permissions operation failed"),[]}let t=d.object({rule:d.string().optional(),effect:d.string().optional()}),s;try{let n=y.load(e);s=v(d.array(t),n)}catch(n){return E.error({err:n},"permissions operation failed"),[]}let r=[];for(let n of s){if(n.effect!=="allow"&&n.effect!=="deny"&&n.effect!=="ask")continue;let o=G.exec((n.rule??"").trim());o&&r.push({tool:o[1],pattern:o[2],effect:n.effect})}return r}function b(i,e,t){let s=null;for(let r of i)if(!(r.tool!==e&&r.tool!=="*")&&B(r.pattern,t)){if(r.effect==="deny")return"deny";r.effect==="ask"?s="ask":s??="allow"}return s}var P=class{userPath;projectPath;localPath;cache=new Map;constructor(e){this.userPath=p(C(),".swifty","permissions.yaml"),this.projectPath=p(e,".swifty","permissions.yaml"),this.localPath=p(e,".swifty","permissions.local.yaml")}rulesFor(e){let t;try{t=$(e,{bigint:!0})}catch{return this.cache.delete(e),[]}let s=this.cache.get(e);if(s?.mtimeNs===t.mtimeNs&&s.size===t.size)return s.rules;let r=S(e);return this.cache.set(e,{mtimeNs:t.mtimeNs,size:t.size,rules:r}),r}snapshot(){return[this.userPath,this.projectPath,this.localPath].flatMap(e=>this.rulesFor(e))}evaluate(e,t){return b(this.snapshot(),e,t)}appendLocalRule(e){M(A(this.localPath),{recursive:!0});let t=S(this.localPath);if(t.some(n=>n.tool===e.tool&&n.pattern===e.pattern&&n.effect===e.effect))return;t.push(e);let r=t.map(n=>({rule:`${n.tool}(${n.pattern})`,effect:n.effect}));j(this.localPath,y.dump(r),"utf-8")}};function I(i){for(let e of T)if(e.re.test(i))return e.reason;return""}function N(i){let e=i.trim();return e.includes(">")||e.includes("|")||e.includes(";")||e.includes("&&")||e.includes("$(")||e.includes("`")?!1:z.some(t=>e===t||e.startsWith(t+" ")||e.startsWith(t+" "))}function U(i,e){switch(i){case"bypassPermissions":return"allow";case"plan":return e==="read"?"allow":"ask";case"acceptEdits":return e==="command"?"ask":"allow";default:return e==="read"?"allow":"ask"}}var W=class{mode;planFilePath="";sandboxEnabled=!1;sandboxAutoAllow=!1;sandbox;ruleEngine;constructor(e,t="default"){this.mode=t,this.sandbox=new R(e),this.ruleEngine=new P(e)}check(e,t,s){let r=w(e,s),n=null,o=()=>n??=this.ruleEngine.snapshot();if(this.mode==="plan"&&(e==="WriteFile"||e==="EditFile")&&c(s,"file_path","").includes(".swifty/plans/"))return{effect:"allow",reason:"Plan file write allowed in plan mode"};if(t==="command"&&N(r))return{effect:"allow",reason:"Safe read-only command"};let a=t==="command"?I(r):"";if(a)return{effect:"deny",reason:`Dangerous command blocked: ${a}`};if(this.sandboxEnabled&&this.sandboxAutoAllow&&e==="Bash"){let u=c(s,"command").split(/\s*(?:&&|\|\||[;|])\s*/).map(g=>g.trim()).filter(Boolean),l=!1;for(let g of u){let x=b(o(),e,g);if(x==="deny")return{effect:"deny",reason:"Permission rule: deny"};x==="ask"&&(l=!0)}return l?{effect:"ask",reason:"Permission rule: ask (sandbox does not override)"}:{effect:"allow",reason:"Sandbox auto-allow: OS sandbox active"}}let h=c(s,"file_path",c(s,"path",""));if((t==="read"||t==="write")&&h){if(t==="write"){let l=this.sandbox.checkDenyWrite(h);if(l)return l}let u=this.sandbox.check(h);if(u&&this.mode!=="bypassPermissions"){let l=this.ruleEngine.evaluate(e,r);return l?{effect:l,reason:`Permission rule: ${l}`}:{effect:"ask",reason:u.reason}}}let m=b(o(),e,r);return m?{effect:m,reason:`Permission rule: ${m}`}:{effect:U(this.mode,t),reason:`Mode: ${this.mode}`}}allowExtraRoot(e){this.sandbox.addRoot(e)}allowAlways(e,t){let s=w(e,t),r=e==="ReadFile"||e==="WriteFile"||e==="EditFile",n;if(r&&s){let o=f(s),a=!1;try{a=$(o).isDirectory()}catch{}n=p(a?o:A(o),"*")}else n=s.trim().split(/\s+/).slice(0,2).join(" ")+"*";this.ruleEngine.appendLocalRule({tool:e,pattern:n,effect:"allow"})}describeToolAction(e,t){let s=w(e,t);if(s)return s;let r=[];for(let[n,o]of Object.entries(t)){let a=String(o);a.length>80&&(a=a.slice(0,80)+"..."),r.push(`${n}: ${a}`)}return r.join(", ")}};export{w as a,R as b,b as c,P as d,N as e,W as f};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __swiftyCreateRequire } from "node:module";
3
- const require = __swiftyCreateRequire(import.meta.url);
4
- import{I as y,L as u,N as T,R as f}from"./chunk-SIWLMWHH.js";import{b as g}from"./chunk-E55KH72M.js";var S=y({module:"mcp"}),p="mcp__",m="__";function a(e){return e.replace(/[^a-zA-Z0-9_]/g,"_")}function _(e){return p+a(e)+m}function h(e,r){return _(e)+a(r)}var C=class{name;description;category="command";deferred=!0;mcpServerName;client;originalName;inputSchema;constructor(r,t,n){this.name=h(t,n.name),this.description=n.description,this.originalName=n.name,this.client=r,this.inputSchema=n.inputSchema,this.mcpServerName=t}mcpInputSchema(){return this.inputSchema??{}}setDeferLoading(r){this.deferred=r}schema(){return{name:this.name,description:this.description,input_schema:this.inputSchema}}async execute(r,t){try{return await this.client.callTool(this.originalName,t)}catch(n){return S.error({err:n},"mcp operation failed"),{output:`MCP tool error: ${T(n)}`,isError:!0}}}};function x(e,r){if(r==="string"&&typeof e=="number"&&Number.isFinite(e))return String(e);if((r==="integer"||r==="number")&&typeof e=="string"){let t=e.trim();if(t===""||!(r==="integer"?/^[+-]?\d+$/:/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/).test(t))return e;let s=r==="integer"?Number.parseInt(t,10):Number.parseFloat(t);return Number.isNaN(s)?e:s}if(r==="boolean"&&typeof e=="string"){let t=e.trim().toLowerCase();if(t==="true")return!0;if(t==="false")return!1}return e}function d(e,r){if(typeof r!="object"||r===null)return e;let t=u(r),n=f(t,"type","");if(n==="object"&&typeof e=="object"&&e!==null&&!Array.isArray(e)){let s=u(t.properties??{}),o={};for(let[i,c]of Object.entries(e))o[i]=i in s?d(c,s[i]):c;return o}if(n==="array"){let s=t.items??{},o=e;if(typeof o=="object"&&o!==null&&!Array.isArray(o)){let i=Object.values(o);i.length===1&&Array.isArray(i[0])&&(o=i[0])}else typeof o=="string"&&(o=o.split(",").map(i=>i.trim()).filter(i=>i!==""));return Array.isArray(o)?o.map(i=>d(i,s)):o}return n!==""?x(e,n):e}function O(e,r){if(r.startsWith(p)){let t=r.slice(p.length),n=t.indexOf(m);if(n>=0)return a(t.slice(0,n))+m+a(t.slice(n+m.length))}return a(e)+m+a(r)}function M(e){return"mcpInputSchema"in e&&typeof e.mcpInputSchema=="function"}var b=class{constructor(r){this.registry=r}registry;name=g;description="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.";category="command";deferred=!1;schema(){return{name:this.name,description:this.description,input_schema:{type:"object",properties:{server:{type:"string",description:"MCP server name, e.g. 'linear'."},tool:{type:"string",description:"Full tool name as returned by ToolSearch, e.g. 'mcp__linear__create_issue'."},arguments:{type:"object",description:"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."}},required:["server","tool","arguments"]}}}resolve(r,t){let n=this.registry.get(t)??this.registry.get(h(r,t));if(n)return n;let s=m+a(t),o=this.registry.listTools().filter(i=>i.name.startsWith(p)&&i.name.endsWith(s));return o.length===1?o[0]:void 0}availableNames(){return this.registry.listTools().filter(r=>r.name.startsWith(p)).map(r=>r.name).sort()}async execute(r,t){let n=f(t,"server",""),s=f(t,"tool","");if(s==="")return{output:"McpCall requires a 'tool' name",isError:!0};let o=this.resolve(n,s);if(!o){let c=this.availableNames(),l=c.length>0?c.join(", "):"(none connected)";return{output:`Unknown MCP tool '${s}' on server '${n}'. Available tools: ${l}`,isError:!0}}let i={};if(typeof t.arguments=="object"&&t.arguments!==null&&!Array.isArray(t.arguments)&&(i=u(t.arguments)),M(o)){let c=o.mcpInputSchema();if(Object.keys(c).length>0){let l=d(i,c);typeof l=="object"&&l!==null&&!Array.isArray(l)&&(i=u(l))}}return o.execute(r,i)}};export{p as a,C as b,O as c,M as d,b as e};