craby-gateway 0.18.2 → 0.18.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-sea/gateway.cjs +2 -2
- package/package.json +1 -1
package/dist-sea/gateway.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require(`node:crypto`),u=require(`node:fs`);u=c(u);let d=require(`node:fs/promises`);d=c(d);let f=require(`node:os`);f=c(f);let p=require(`node:path`);p=c(p);let m=require(`module`),h=require(`node:child_process`),g=require(`node:module`),_=require(`node:url`),v=require(`node:readline`);v=c(v);let y=require(`node:process`);y=c(y);let b=require(`node:util`),x=require(`fs`);x=c(x);let S=require(`path`);S=c(S);let C=require(`net`),w=require(`child_process`),T=require(`@anthropic-ai/claude-agent-sdk`);var E={name:`@remote-agent/desktop-gateway`,private:!0,version:`0.18.2`,description:`Craby desktop gateway CLI`,type:`module`,bin:{"craby-gateway":`dist-sea/gateway.cjs`},files:[`dist-sea`,`README.md`],publishConfig:{access:`public`,registry:`https://registry.npmjs.org/`},engines:{node:`>=20`},repository:{type:`git`,url:`git+https://github.com/wuyongzhi/anycoding.git`,directory:`apps/desktop-gateway`},scripts:{dev:`GATEWAY_PORT=18787 GATEWAY_HTTPS_PORT=18787 GATEWAY_AUDIT_LOG_PATH=./logs/audit.log GATEWAY_LOG_PATH=./logs/gateway.log GATEWAY_SESSION_HISTORY_DIR=./logs/sessions-v2 GATEWAY_PROJECT_STORE_DIR=./logs/projects GATEWAY_AUTH_STORE_DIR=./logs/auth tsx watch src/index.ts --config ./logs/gateway.dev.yaml`,build:`tsup src/index.ts --format esm --dts`,"build:bundle":`tsdown --config tsdown.config.ts`,"build:npm":`pnpm run build:bundle && node ./scripts/preparePublishPackage.mjs`,"start:bundle":`node dist-sea/gateway.cjs`,"build:blob:darwin":`pnpm run build:bundle && node --experimental-sea-config sea-config.darwin.json`,"build:blob:linux":`pnpm run build:bundle && node --experimental-sea-config sea-config.linux.json`,"build:blob:win32":`pnpm run build:bundle && node --experimental-sea-config sea-config.win32.json`,"build:bin":`pnpm run build:bin:current`,"build:bin:current":`pnpm run build:bundle && node ./scripts/buildSea.mjs`,"build:bin:darwin":`pnpm run build:bundle && node ./scripts/buildSea.mjs darwin`,"build:bin:linux":`pnpm run build:bundle && node ./scripts/buildSea.mjs linux`,"build:bin:win32":`pnpm run build:bundle && node ./scripts/buildSea.mjs win32`,test:`vitest run --passWithNoTests`,typecheck:`tsc -p tsconfig.json --noEmit`,"dump:codex-history":`tsx src/dumpCodexSessionHistory.ts`,"export:codex-project-history":`tsx src/exportCodexProjectHistory.ts`,"pairing:start":`tsx src/pairingStart.ts`,"pack:check":`pnpm run build:npm && npm pack --dry-run ./dist-npm --userconfig ../../.npmrc`,"publish:npm":`pnpm run build:npm && npm publish ./dist-npm --access public --userconfig ../../.npmrc`},dependencies:{"@anthropic-ai/claude-agent-sdk":`^0.2.92`,"@fastify/cors":`^10.0.2`,"@fastify/websocket":`^11.0.2`,diff:`^7.0.0`,fastify:`^5.2.1`,jsonwebtoken:`^9.0.2`,nanoid:`^5.1.5`,pino:`^10.3.1`,"qrcode-terminal":`^0.12.0`,ws:`^8.18.3`,yaml:`^2.8.2`},devDependencies:{"@openai/codex":`^0.111.0`,"@remote-agent/contracts":`workspace:*`,"@remote-agent/provider-adapters":`workspace:*`,"@types/diff":`^7.0.1`,"@types/jsonwebtoken":`^9.0.9`,"@types/qrcode-terminal":`^0.12.2`,"@types/ws":`^8.5.13`,postject:`^1.0.0-alpha.6`,tsdown:`^0.21.0`}};const D=/(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?/;function O(e){let t=e.match(D);return t?t[0]:null}function k(e){return typeof e==`string`?O(e):null}function A(e,t){let n=M(e),r=M(t);if(!n||!r)throw Error(`Invalid version comparison: ${e} vs ${t}`);return n.major===r.major?n.minor===r.minor?n.patch===r.patch?n.prerelease===r.prerelease?0:n.prerelease?r.prerelease?n.prerelease.localeCompare(r.prerelease):-1:1:n.patch-r.patch:n.minor-r.minor:n.major-r.major}function j(e,t){return A(e,t)>=0}function M(e){let t=e.match(D);return t?{major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3]),prerelease:typeof t[4]==`string`?t[4]:null}:null}const N=E,P=N.dependencies??{};function ee(e){return P[e]??``}const F={packageName:`craby-gateway`,cliName:`craby-gateway`,version:N.version??`0.0.0`,providerRequirements:[{id:`codex`,dependencyName:null,dependencyRange:``,minimumVersion:null,systemCommand:`codex`,versionArgs:[`--version`],systemCommandRequired:!0,displayName:`Codex`},{id:`claude`,dependencyName:`@anthropic-ai/claude-agent-sdk`,dependencyRange:ee(`@anthropic-ai/claude-agent-sdk`),minimumVersion:k(ee(`@anthropic-ai/claude-agent-sdk`)),systemCommand:`claude`,versionArgs:[`--version`],systemCommandRequired:!1,displayName:`Claude Code`}]};function te(e){let t=`start`,n,r=!1,i=!1,a=[...e],o=a[0]?.trim();if(o&&!o.startsWith(`-`))if(o===`start`||o===`init`||o===`doctor`||o===`help`||o===`__worker`)t=o,a.shift();else throw Error(`Unknown command: ${o}`);for(let e=0;e<a.length;e+=1){let o=a[e];if(o===`--config`){n=ne(o,a[e+1]),e+=1;continue}if(o===`--force`){r=!0;continue}if(o===`--log`){i=!0;continue}if(o===`--help`||o===`-h`){t=`help`;continue}if(o===`--version`||o===`-v`){t=`version`;continue}throw Error(`Unknown argument: ${o}`)}return{command:t,configPath:n,force:r,logToConsole:i}}function ne(e,t){let n=t?.trim();if(!n)throw Error(`${e} requires a value`);return n}var I=o((e=>{let t=Symbol.for(`yaml.alias`),n=Symbol.for(`yaml.document`),r=Symbol.for(`yaml.map`),i=Symbol.for(`yaml.pair`),a=Symbol.for(`yaml.scalar`),o=Symbol.for(`yaml.seq`),s=Symbol.for(`yaml.node.type`),c=e=>!!e&&typeof e==`object`&&e[s]===t,l=e=>!!e&&typeof e==`object`&&e[s]===n,u=e=>!!e&&typeof e==`object`&&e[s]===r,d=e=>!!e&&typeof e==`object`&&e[s]===i,f=e=>!!e&&typeof e==`object`&&e[s]===a,p=e=>!!e&&typeof e==`object`&&e[s]===o;function m(e){if(e&&typeof e==`object`)switch(e[s]){case r:case o:return!0}return!1}function h(e){if(e&&typeof e==`object`)switch(e[s]){case t:case r:case a:case o:return!0}return!1}e.ALIAS=t,e.DOC=n,e.MAP=r,e.NODE_TYPE=s,e.PAIR=i,e.SCALAR=a,e.SEQ=o,e.hasAnchor=e=>(f(e)||m(e))&&!!e.anchor,e.isAlias=c,e.isCollection=m,e.isDocument=l,e.isMap=u,e.isNode=h,e.isPair=d,e.isScalar=f,e.isSeq=p})),re=o((e=>{var t=I();let n=Symbol(`break visit`),r=Symbol(`skip children`),i=Symbol(`remove node`);function a(e,n){let r=l(n);t.isDocument(e)?o(null,e.contents,r,Object.freeze([e]))===i&&(e.contents=null):o(null,e,r,Object.freeze([]))}a.BREAK=n,a.SKIP=r,a.REMOVE=i;function o(e,r,a,s){let c=u(e,r,a,s);if(t.isNode(c)||t.isPair(c))return d(e,s,c),o(e,c,a,s);if(typeof c!=`symbol`){if(t.isCollection(r)){s=Object.freeze(s.concat(r));for(let e=0;e<r.items.length;++e){let t=o(e,r.items[e],a,s);if(typeof t==`number`)e=t-1;else if(t===n)return n;else t===i&&(r.items.splice(e,1),--e)}}else if(t.isPair(r)){s=Object.freeze(s.concat(r));let e=o(`key`,r.key,a,s);if(e===n)return n;e===i&&(r.key=null);let t=o(`value`,r.value,a,s);if(t===n)return n;t===i&&(r.value=null)}}return c}async function s(e,n){let r=l(n);t.isDocument(e)?await c(null,e.contents,r,Object.freeze([e]))===i&&(e.contents=null):await c(null,e,r,Object.freeze([]))}s.BREAK=n,s.SKIP=r,s.REMOVE=i;async function c(e,r,a,o){let s=await u(e,r,a,o);if(t.isNode(s)||t.isPair(s))return d(e,o,s),c(e,s,a,o);if(typeof s!=`symbol`){if(t.isCollection(r)){o=Object.freeze(o.concat(r));for(let e=0;e<r.items.length;++e){let t=await c(e,r.items[e],a,o);if(typeof t==`number`)e=t-1;else if(t===n)return n;else t===i&&(r.items.splice(e,1),--e)}}else if(t.isPair(r)){o=Object.freeze(o.concat(r));let e=await c(`key`,r.key,a,o);if(e===n)return n;e===i&&(r.key=null);let t=await c(`value`,r.value,a,o);if(t===n)return n;t===i&&(r.value=null)}}return s}function l(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function u(e,n,r,i){if(typeof r==`function`)return r(e,n,i);if(t.isMap(n))return r.Map?.(e,n,i);if(t.isSeq(n))return r.Seq?.(e,n,i);if(t.isPair(n))return r.Pair?.(e,n,i);if(t.isScalar(n))return r.Scalar?.(e,n,i);if(t.isAlias(n))return r.Alias?.(e,n,i)}function d(e,n,r){let i=n[n.length-1];if(t.isCollection(i))i.items[e]=r;else if(t.isPair(i))e===`key`?i.key=r:i.value=r;else if(t.isDocument(i))i.contents=r;else{let e=t.isAlias(i)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}e.visit=a,e.visitAsync=s})),L=o((e=>{var t=I(),n=re();let r={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},i=e=>e.replace(/[!,[\]{}]/g,e=>r[e]);var a=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+i(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],i=Object.entries(this.tags),a;if(e&&i.length>0&&t.isNode(e.contents)){let r={};n.visit(e.contents,(e,n)=>{t.isNode(n)&&n.tag&&(r[n.tag]=!0)}),a=Object.keys(r)}else a=[];for(let[t,n]of i)t===`!!`&&n===`tag:yaml.org,2002:`||(!e||a.some(e=>e.startsWith(n)))&&r.push(`%TAG ${t} ${n}`);return r.join(`
|
|
2
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require(`node:crypto`),u=require(`node:fs`);u=c(u);let d=require(`node:fs/promises`);d=c(d);let f=require(`node:os`);f=c(f);let p=require(`node:path`);p=c(p);let m=require(`module`),h=require(`node:child_process`),g=require(`node:module`),_=require(`node:url`),v=require(`node:readline`);v=c(v);let y=require(`node:process`);y=c(y);let b=require(`node:util`),x=require(`fs`);x=c(x);let S=require(`path`);S=c(S);let C=require(`net`),w=require(`child_process`),T=require(`@anthropic-ai/claude-agent-sdk`);var E={name:`@remote-agent/desktop-gateway`,private:!0,version:`0.18.3`,description:`Craby desktop gateway CLI`,type:`module`,bin:{"craby-gateway":`dist-sea/gateway.cjs`},files:[`dist-sea`,`README.md`],publishConfig:{access:`public`,registry:`https://registry.npmjs.org/`},engines:{node:`>=20`},repository:{type:`git`,url:`git+https://github.com/wuyongzhi/anycoding.git`,directory:`apps/desktop-gateway`},scripts:{dev:`GATEWAY_PORT=18787 GATEWAY_HTTPS_PORT=18787 GATEWAY_AUDIT_LOG_PATH=./logs/audit.log GATEWAY_LOG_PATH=./logs/gateway.log GATEWAY_SESSION_HISTORY_DIR=./logs/sessions-v2 GATEWAY_PROJECT_STORE_DIR=./logs/projects GATEWAY_AUTH_STORE_DIR=./logs/auth tsx watch src/index.ts --config ./logs/gateway.dev.yaml`,build:`tsup src/index.ts --format esm --dts`,"build:bundle":`tsdown --config tsdown.config.ts`,"build:npm":`pnpm run build:bundle && node ./scripts/preparePublishPackage.mjs`,"start:bundle":`node dist-sea/gateway.cjs`,"build:blob:darwin":`pnpm run build:bundle && node --experimental-sea-config sea-config.darwin.json`,"build:blob:linux":`pnpm run build:bundle && node --experimental-sea-config sea-config.linux.json`,"build:blob:win32":`pnpm run build:bundle && node --experimental-sea-config sea-config.win32.json`,"build:bin":`pnpm run build:bin:current`,"build:bin:current":`pnpm run build:bundle && node ./scripts/buildSea.mjs`,"build:bin:darwin":`pnpm run build:bundle && node ./scripts/buildSea.mjs darwin`,"build:bin:linux":`pnpm run build:bundle && node ./scripts/buildSea.mjs linux`,"build:bin:win32":`pnpm run build:bundle && node ./scripts/buildSea.mjs win32`,test:`vitest run --passWithNoTests`,typecheck:`tsc -p tsconfig.json --noEmit`,"dump:codex-history":`tsx src/dumpCodexSessionHistory.ts`,"export:codex-project-history":`tsx src/exportCodexProjectHistory.ts`,"pairing:start":`tsx src/pairingStart.ts`,"pack:check":`pnpm run build:npm && npm pack --dry-run ./dist-npm --userconfig ../../.npmrc`,"publish:npm":`pnpm run build:npm && npm publish ./dist-npm --access public --userconfig ../../.npmrc`},dependencies:{"@anthropic-ai/claude-agent-sdk":`^0.2.92`,"@fastify/cors":`^10.0.2`,"@fastify/websocket":`^11.0.2`,diff:`^7.0.0`,fastify:`^5.2.1`,jsonwebtoken:`^9.0.2`,nanoid:`^5.1.5`,pino:`^10.3.1`,"qrcode-terminal":`^0.12.0`,ws:`^8.18.3`,yaml:`^2.8.2`},devDependencies:{"@openai/codex":`^0.111.0`,"@remote-agent/contracts":`workspace:*`,"@remote-agent/provider-adapters":`workspace:*`,"@types/diff":`^7.0.1`,"@types/jsonwebtoken":`^9.0.9`,"@types/qrcode-terminal":`^0.12.2`,"@types/ws":`^8.5.13`,postject:`^1.0.0-alpha.6`,tsdown:`^0.21.0`}};const D=/(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?/;function O(e){let t=e.match(D);return t?t[0]:null}function k(e){return typeof e==`string`?O(e):null}function A(e,t){let n=M(e),r=M(t);if(!n||!r)throw Error(`Invalid version comparison: ${e} vs ${t}`);return n.major===r.major?n.minor===r.minor?n.patch===r.patch?n.prerelease===r.prerelease?0:n.prerelease?r.prerelease?n.prerelease.localeCompare(r.prerelease):-1:1:n.patch-r.patch:n.minor-r.minor:n.major-r.major}function j(e,t){return A(e,t)>=0}function M(e){let t=e.match(D);return t?{major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3]),prerelease:typeof t[4]==`string`?t[4]:null}:null}const N=E,P=N.dependencies??{};function ee(e){return P[e]??``}const F={packageName:`craby-gateway`,cliName:`craby-gateway`,version:N.version??`0.0.0`,providerRequirements:[{id:`codex`,dependencyName:null,dependencyRange:``,minimumVersion:null,systemCommand:`codex`,versionArgs:[`--version`],systemCommandRequired:!0,displayName:`Codex`},{id:`claude`,dependencyName:`@anthropic-ai/claude-agent-sdk`,dependencyRange:ee(`@anthropic-ai/claude-agent-sdk`),minimumVersion:k(ee(`@anthropic-ai/claude-agent-sdk`)),systemCommand:`claude`,versionArgs:[`--version`],systemCommandRequired:!1,displayName:`Claude Code`}]};function te(e){let t=`start`,n,r=!1,i=!1,a=[...e],o=a[0]?.trim();if(o&&!o.startsWith(`-`))if(o===`start`||o===`init`||o===`doctor`||o===`help`||o===`__worker`)t=o,a.shift();else throw Error(`Unknown command: ${o}`);for(let e=0;e<a.length;e+=1){let o=a[e];if(o===`--config`){n=ne(o,a[e+1]),e+=1;continue}if(o===`--force`){r=!0;continue}if(o===`--log`){i=!0;continue}if(o===`--help`||o===`-h`){t=`help`;continue}if(o===`--version`||o===`-v`){t=`version`;continue}throw Error(`Unknown argument: ${o}`)}return{command:t,configPath:n,force:r,logToConsole:i}}function ne(e,t){let n=t?.trim();if(!n)throw Error(`${e} requires a value`);return n}var I=o((e=>{let t=Symbol.for(`yaml.alias`),n=Symbol.for(`yaml.document`),r=Symbol.for(`yaml.map`),i=Symbol.for(`yaml.pair`),a=Symbol.for(`yaml.scalar`),o=Symbol.for(`yaml.seq`),s=Symbol.for(`yaml.node.type`),c=e=>!!e&&typeof e==`object`&&e[s]===t,l=e=>!!e&&typeof e==`object`&&e[s]===n,u=e=>!!e&&typeof e==`object`&&e[s]===r,d=e=>!!e&&typeof e==`object`&&e[s]===i,f=e=>!!e&&typeof e==`object`&&e[s]===a,p=e=>!!e&&typeof e==`object`&&e[s]===o;function m(e){if(e&&typeof e==`object`)switch(e[s]){case r:case o:return!0}return!1}function h(e){if(e&&typeof e==`object`)switch(e[s]){case t:case r:case a:case o:return!0}return!1}e.ALIAS=t,e.DOC=n,e.MAP=r,e.NODE_TYPE=s,e.PAIR=i,e.SCALAR=a,e.SEQ=o,e.hasAnchor=e=>(f(e)||m(e))&&!!e.anchor,e.isAlias=c,e.isCollection=m,e.isDocument=l,e.isMap=u,e.isNode=h,e.isPair=d,e.isScalar=f,e.isSeq=p})),re=o((e=>{var t=I();let n=Symbol(`break visit`),r=Symbol(`skip children`),i=Symbol(`remove node`);function a(e,n){let r=l(n);t.isDocument(e)?o(null,e.contents,r,Object.freeze([e]))===i&&(e.contents=null):o(null,e,r,Object.freeze([]))}a.BREAK=n,a.SKIP=r,a.REMOVE=i;function o(e,r,a,s){let c=u(e,r,a,s);if(t.isNode(c)||t.isPair(c))return d(e,s,c),o(e,c,a,s);if(typeof c!=`symbol`){if(t.isCollection(r)){s=Object.freeze(s.concat(r));for(let e=0;e<r.items.length;++e){let t=o(e,r.items[e],a,s);if(typeof t==`number`)e=t-1;else if(t===n)return n;else t===i&&(r.items.splice(e,1),--e)}}else if(t.isPair(r)){s=Object.freeze(s.concat(r));let e=o(`key`,r.key,a,s);if(e===n)return n;e===i&&(r.key=null);let t=o(`value`,r.value,a,s);if(t===n)return n;t===i&&(r.value=null)}}return c}async function s(e,n){let r=l(n);t.isDocument(e)?await c(null,e.contents,r,Object.freeze([e]))===i&&(e.contents=null):await c(null,e,r,Object.freeze([]))}s.BREAK=n,s.SKIP=r,s.REMOVE=i;async function c(e,r,a,o){let s=await u(e,r,a,o);if(t.isNode(s)||t.isPair(s))return d(e,o,s),c(e,s,a,o);if(typeof s!=`symbol`){if(t.isCollection(r)){o=Object.freeze(o.concat(r));for(let e=0;e<r.items.length;++e){let t=await c(e,r.items[e],a,o);if(typeof t==`number`)e=t-1;else if(t===n)return n;else t===i&&(r.items.splice(e,1),--e)}}else if(t.isPair(r)){o=Object.freeze(o.concat(r));let e=await c(`key`,r.key,a,o);if(e===n)return n;e===i&&(r.key=null);let t=await c(`value`,r.value,a,o);if(t===n)return n;t===i&&(r.value=null)}}return s}function l(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function u(e,n,r,i){if(typeof r==`function`)return r(e,n,i);if(t.isMap(n))return r.Map?.(e,n,i);if(t.isSeq(n))return r.Seq?.(e,n,i);if(t.isPair(n))return r.Pair?.(e,n,i);if(t.isScalar(n))return r.Scalar?.(e,n,i);if(t.isAlias(n))return r.Alias?.(e,n,i)}function d(e,n,r){let i=n[n.length-1];if(t.isCollection(i))i.items[e]=r;else if(t.isPair(i))e===`key`?i.key=r:i.value=r;else if(t.isDocument(i))i.contents=r;else{let e=t.isAlias(i)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}e.visit=a,e.visitAsync=s})),L=o((e=>{var t=I(),n=re();let r={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},i=e=>e.replace(/[!,[\]{}]/g,e=>r[e]);var a=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+i(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],i=Object.entries(this.tags),a;if(e&&i.length>0&&t.isNode(e.contents)){let r={};n.visit(e.contents,(e,n)=>{t.isNode(n)&&n.tag&&(r[n.tag]=!0)}),a=Object.keys(r)}else a=[];for(let[t,n]of i)t===`!!`&&n===`tag:yaml.org,2002:`||(!e||a.some(e=>e.startsWith(n)))&&r.push(`%TAG ${t} ${n}`);return r.join(`
|
|
3
3
|
`)}};a.defaultYaml={explicit:!1,version:`1.2`},a.defaultTags={"!!":`tag:yaml.org,2002:`},e.Directives=a})),ie=o((e=>{var t=I(),n=re();function r(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function i(e){let t=new Set;return n.visit(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function a(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function o(e,n){let r=[],o=new Map,s=null;return{onAnchor:t=>{r.push(t),s??=i(e);let o=a(n,s);return s.add(o),o},setAnchors:()=>{for(let e of r){let n=o.get(e);if(typeof n==`object`&&n.anchor&&(t.isScalar(n.node)||t.isCollection(n.node)))n.node.anchor=n.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:o}}e.anchorIsValid=r,e.anchorNames=i,e.createNodeAnchors=o,e.findNewAnchor=a})),ae=o((e=>{function t(e,n,r,i){if(i&&typeof i==`object`)if(Array.isArray(i))for(let n=0,r=i.length;n<r;++n){let r=i[n],a=t(e,i,String(n),r);a===void 0?delete i[n]:a!==r&&(i[n]=a)}else if(i instanceof Map)for(let n of Array.from(i.keys())){let r=i.get(n),a=t(e,i,n,r);a===void 0?i.delete(n):a!==r&&i.set(n,a)}else if(i instanceof Set)for(let n of Array.from(i)){let r=t(e,i,n,n);r===void 0?i.delete(n):r!==n&&(i.delete(n),i.add(r))}else for(let[n,r]of Object.entries(i)){let a=t(e,i,n,r);a===void 0?delete i[n]:a!==r&&(i[n]=a)}return e.call(n,r,i)}e.applyReviver=t})),R=o((e=>{var t=I();function n(e,r,i){if(Array.isArray(e))return e.map((e,t)=>n(e,String(t),i));if(e&&typeof e.toJSON==`function`){if(!i||!t.hasAnchor(e))return e.toJSON(r,i);let n={aliasCount:0,count:1,res:void 0};i.anchors.set(e,n),i.onCreate=e=>{n.res=e,delete i.onCreate};let a=e.toJSON(r,i);return i.onCreate&&i.onCreate(a),a}return typeof e==`bigint`&&!i?.keep?Number(e):e}e.toJS=n})),oe=o((e=>{var t=ae(),n=I(),r=R();e.NodeBase=class{constructor(e){Object.defineProperty(this,n.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:i,maxAliasCount:a,onAnchor:o,reviver:s}={}){if(!n.isDocument(e))throw TypeError(`A document argument is required`);let c={anchors:new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof a==`number`?a:100},l=r.toJS(this,``,c);if(typeof o==`function`)for(let{count:e,res:t}of c.anchors.values())o(t,e);return typeof s==`function`?t.applyReviver(s,{"":l},``,l):l}}})),se=o((e=>{var t=ie(),n=re(),r=I(),i=oe(),a=R(),o=class extends i.NodeBase{constructor(e){super(r.ALIAS),this.source=e,Object.defineProperty(this,`tag`,{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){let i;t?.aliasResolveCache?i=t.aliasResolveCache:(i=[],n.visit(e,{Node:(e,t)=>{(r.isAlias(t)||r.hasAnchor(t))&&i.push(t)}}),t&&(t.aliasResolveCache=i));let a;for(let e of i){if(e===this)break;e.anchor===this.source&&(a=e)}return a}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,o=this.resolve(r,t);if(!o){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let c=n.get(o);if(c||=(a.toJS(o,null,t),n.get(o)),c?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(c.count+=1,c.aliasCount===0&&(c.aliasCount=s(r,o,n)),c.count*c.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return c.res}toString(e,n,r){let i=`*${this.source}`;if(e){if(t.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${i} `}return i}};function s(e,t,n){if(r.isAlias(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(r.isCollection(t)){let r=0;for(let i of t.items){let t=s(e,i,n);t>r&&(r=t)}return r}else if(r.isPair(t)){let r=s(e,t.key,n),i=s(e,t.value,n);return Math.max(r,i)}return 1}e.Alias=o})),ce=o((e=>{var t=I(),n=oe(),r=R();let i=e=>!e||typeof e!=`function`&&typeof e!=`object`;var a=class extends n.NodeBase{constructor(e){super(t.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:r.toJS(this.value,e,t)}toString(){return String(this.value)}};a.BLOCK_FOLDED=`BLOCK_FOLDED`,a.BLOCK_LITERAL=`BLOCK_LITERAL`,a.PLAIN=`PLAIN`,a.QUOTE_DOUBLE=`QUOTE_DOUBLE`,a.QUOTE_SINGLE=`QUOTE_SINGLE`,e.Scalar=a,e.isScalarValue=i})),le=o((e=>{var t=se(),n=I(),r=ce();function i(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function a(e,a,o){if(n.isDocument(e)&&(e=e.contents),n.isNode(e))return e;if(n.isPair(e)){let t=o.schema[n.MAP].createNode?.(o.schema,null,o);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:s,onAnchor:c,onTagObj:l,schema:u,sourceObjects:d}=o,f;if(s&&e&&typeof e==`object`){if(f=d.get(e),f)return f.anchor??=c(e),new t.Alias(f.anchor);f={anchor:null,node:null},d.set(e,f)}a?.startsWith(`!!`)&&(a=`tag:yaml.org,2002:`+a.slice(2));let p=i(e,a,u.tags);if(!p){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new r.Scalar(e);return f&&(f.node=t),t}p=e instanceof Map?u[n.MAP]:Symbol.iterator in Object(e)?u[n.SEQ]:u[n.MAP]}l&&(l(p),delete o.onTagObj);let m=p?.createNode?p.createNode(o.schema,e,o):typeof p?.nodeClass?.from==`function`?p.nodeClass.from(o.schema,e,o):new r.Scalar(e);return a?m.tag=a:p.default||(m.tag=p.tag),f&&(f.node=m),m}e.createNode=a})),z=o((e=>{var t=le(),n=I(),r=oe();function i(e,n,r){let i=r;for(let e=n.length-1;e>=0;--e){let t=n[e];if(typeof t==`number`&&Number.isInteger(t)&&t>=0){let e=[];e[t]=i,i=e}else i=new Map([[t,i]])}return t.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}let a=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;e.Collection=class extends r.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,`schema`,{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>n.isNode(t)||n.isPair(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(a(e))this.add(t);else{let[r,...a]=e,o=this.get(r,!0);if(n.isCollection(o))o.addIn(a,t);else if(o===void 0&&this.schema)this.set(r,i(this.schema,a,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${a}`)}}deleteIn(e){let[t,...r]=e;if(r.length===0)return this.delete(t);let i=this.get(t,!0);if(n.isCollection(i))return i.deleteIn(r);throw Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){let[r,...i]=e,a=this.get(r,!0);return i.length===0?!t&&n.isScalar(a)?a.value:a:n.isCollection(a)?a.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!n.isPair(t))return!1;let r=t.value;return r==null||e&&n.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[t,...r]=e;if(r.length===0)return this.has(t);let i=this.get(t,!0);return n.isCollection(i)?i.hasIn(r):!1}setIn(e,t){let[r,...a]=e;if(a.length===0)this.set(r,t);else{let e=this.get(r,!0);if(n.isCollection(e))e.setIn(a,t);else if(e===void 0&&this.schema)this.set(r,i(this.schema,a,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${a}`)}}},e.collectionFromPath=i,e.isEmptyPath=a})),ue=o((e=>{let t=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function n(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}e.indentComment=n,e.lineComment=(e,t,r)=>e.endsWith(`
|
|
4
4
|
`)?n(r,t):r.includes(`
|
|
5
5
|
`)?`
|
|
@@ -118,7 +118,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
118
118
|
function ri(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function ii(e){if(typeof e!=`boolean`)throw Error(`boolean expected, not ${e}`)}function ai(e,t,n=``){let r=ri(e),i=e?.length,a=t!==void 0;if(!r||a&&i!==t){let o=n&&`"${n}" `,s=a?` of length ${t}`:``,c=r?`length=${i}`:`type=${typeof e}`;throw Error(o+`expected Uint8Array`+s+`, got `+c)}return e}function oi(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function si(e,t){ai(e,void 0,`output`);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}function ci(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function li(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function ui(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function di(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}const fi=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;typeof Uint8Array.from([]).toHex==`function`&&Uint8Array.fromHex;function pi(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}const mi=(e,t)=>{function n(n,...r){if(ai(n,void 0,`key`),!fi)throw Error(`Non little-endian hardware is not yet supported`);if(e.nonceLength!==void 0){let t=r[0];ai(t,e.varSizeNonce?void 0:e.nonceLength,`nonce`)}let i=e.tagLength;i&&r[1]!==void 0&&ai(r[1],void 0,`AAD`);let a=t(n,...r),o=(e,t)=>{if(t!==void 0){if(e!==2)throw Error(`cipher output not supported`);ai(t,void 0,`output`)}},s=!1;return{encrypt(e,t){if(s)throw Error(`cannot encrypt() twice with same key + nonce`);return s=!0,ai(e),o(a.encrypt.length,t),a.encrypt(e,t)},decrypt(e,t){if(ai(e),i&&e.length<i)throw Error(`"ciphertext" expected length bigger than tagLength=`+i);return o(a.decrypt.length,t),a.decrypt(e,t)}}}return Object.assign(n,e),n};function hi(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(t.length!==e)throw Error(`"output" expected Uint8Array of length `+e+`, got: `+t.length);if(n&&!_i(t))throw Error(`invalid output, must be aligned`);return t}function gi(e,t,n){ii(n);let r=new Uint8Array(16),i=di(r);return i.setBigUint64(0,BigInt(t),n),i.setBigUint64(8,BigInt(e),n),r}function _i(e){return e.byteOffset%4==0}function vi(e){return Uint8Array.from(e)}const yi=new Uint8Array(16),bi=li(yi),xi=(e,t,n,r)=>{let i=r&1;return{s3:n<<31|r>>>1,s2:t<<31|n>>>1,s1:e<<31|t>>>1,s0:e>>>1^225<<24&-(i&1)}},Si=e=>(e>>>0&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255|0;function Ci(e){e.reverse();let t=e[15]&1,n=0;for(let t=0;t<e.length;t++){let r=e[t];e[t]=r>>>1|n,n=(r&1)<<7}return e[0]^=-t&225,e}const wi=e=>e>64*1024?8:e>1024?4:2;var Ti=class{blockLen=16;outputLen=16;s0=0;s1=0;s2=0;s3=0;finished=!1;t;W;windowSize;constructor(e,t){ai(e,16,`key`),e=vi(e);let n=di(e),r=n.getUint32(0,!1),i=n.getUint32(4,!1),a=n.getUint32(8,!1),o=n.getUint32(12,!1),s=[];for(let e=0;e<128;e++)s.push({s0:Si(r),s1:Si(i),s2:Si(a),s3:Si(o)}),{s0:r,s1:i,s2:a,s3:o}=xi(r,i,a,o);let c=wi(t||1024);if(![1,2,4,8].includes(c))throw Error(`ghash: invalid window size, expected 2, 4 or 8`);this.W=c;let l=128/c,u=this.windowSize=2**c,d=[];for(let e=0;e<l;e++)for(let t=0;t<u;t++){let n=0,r=0,i=0,a=0;for(let o=0;o<c;o++){if(!(t>>>c-o-1&1))continue;let{s0:l,s1:u,s2:d,s3:f}=s[c*e+o];n^=l,r^=u,i^=d,a^=f}d.push({s0:n,s1:r,s2:i,s3:a})}this.t=d}_updateBlock(e,t,n,r){e^=this.s0,t^=this.s1,n^=this.s2,r^=this.s3;let{W:i,t:a,windowSize:o}=this,s=0,c=0,l=0,u=0,d=(1<<i)-1,f=0;for(let p of[e,t,n,r])for(let e=0;e<4;e++){let t=p>>>8*e&255;for(let e=8/i-1;e>=0;e--){let n=t>>>i*e&d,{s0:r,s1:p,s2:m,s3:h}=a[f*o+n];s^=r,c^=p,l^=m,u^=h,f+=1}}this.s0=s,this.s1=c,this.s2=l,this.s3=u}update(e){oi(this),ai(e),e=vi(e);let t=li(e),n=Math.floor(e.length/16),r=e.length%16;for(let e=0;e<n;e++)this._updateBlock(t[e*4+0],t[e*4+1],t[e*4+2],t[e*4+3]);return r&&(yi.set(e.subarray(n*16)),this._updateBlock(bi[0],bi[1],bi[2],bi[3]),ui(bi)),this}destroy(){let{t:e}=this;for(let t of e)t.s0=0,t.s1=0,t.s2=0,t.s3=0}digestInto(e){oi(this),si(e,this),this.finished=!0;let{s0:t,s1:n,s2:r,s3:i}=this,a=li(e);return a[0]=t,a[1]=n,a[2]=r,a[3]=i,e}digest(){let e=new Uint8Array(16);return this.digestInto(e),this.destroy(),e}},Ei=class extends Ti{constructor(e,t){ai(e);let n=Ci(vi(e));super(n,t),ui(n)}update(e){oi(this),ai(e),e=vi(e);let t=li(e),n=e.length%16,r=Math.floor(e.length/16);for(let e=0;e<r;e++)this._updateBlock(Si(t[e*4+3]),Si(t[e*4+2]),Si(t[e*4+1]),Si(t[e*4+0]));return n&&(yi.set(e.subarray(r*16)),this._updateBlock(Si(bi[3]),Si(bi[2]),Si(bi[1]),Si(bi[0])),ui(bi)),this}digestInto(e){oi(this),si(e,this),this.finished=!0;let{s0:t,s1:n,s2:r,s3:i}=this,a=li(e);return a[0]=t,a[1]=n,a[2]=r,a[3]=i,e.reverse()}};function Di(e){let t=(t,n)=>e(n,t.length).update(t).digest(),n=e(new Uint8Array(16),0);return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=(t,n)=>e(t,n),t}const Oi=Di((e,t)=>new Ti(e,t));Di((e,t)=>new Ei(e,t));const ki=new Uint8Array(16);function Ai(e){if(![16,24,32].includes(e.length))throw Error(`"aes key" expected Uint8Array of length 16/24/32, got length=`+e.length)}function ji(e){return e<<1^283&-(e>>7)}function Mi(e,t){let n=0;for(;t>0;t>>=1)n^=e&-(t&1),e=ji(e);return n}const Ni=(()=>{let e=new Uint8Array(256);for(let t=0,n=1;t<256;t++,n^=ji(n))e[t]=n;let t=new Uint8Array(256);t[0]=99;for(let n=0;n<255;n++){let r=e[255-n];r|=r<<8,t[e[n]]=(r^r>>4^r>>5^r>>6^r>>7^99)&255}return ui(e),t})(),Pi=e=>e<<24|e>>>8,Fi=e=>e<<8|e>>>24;function Ii(e,t){if(e.length!==256)throw Error(`Wrong sbox length`);let n=new Uint32Array(256).map((n,r)=>t(e[r])),r=n.map(Fi),i=r.map(Fi),a=i.map(Fi),o=new Uint32Array(256*256),s=new Uint32Array(256*256),c=new Uint16Array(256*256);for(let t=0;t<256;t++)for(let l=0;l<256;l++){let u=t*256+l;o[u]=n[t]^r[l],s[u]=i[t]^a[l],c[u]=e[t]<<8|e[l]}return{sbox:e,sbox2:c,T0:n,T1:r,T2:i,T3:a,T01:o,T23:s}}const Li=Ii(Ni,e=>Mi(e,3)<<24|e<<16|e<<8|Mi(e,2)),Ri=(()=>{let e=new Uint8Array(16);for(let t=0,n=1;t<16;t++,n=ji(n))e[t]=n;return e})();function zi(e){ai(e);let t=e.length;Ai(e);let{sbox2:n}=Li,r=[];_i(e)||r.push(e=vi(e));let i=li(e),a=i.length,o=e=>Vi(n,e,e,e,e),s=new Uint32Array(t+28);s.set(i);for(let e=a;e<s.length;e++){let t=s[e-1];e%a===0?t=o(Pi(t))^Ri[e/a-1]:a>6&&e%a===4&&(t=o(t)),s[e]=s[e-a]^t}return ui(...r),s}function Bi(e,t,n,r,i,a){return e[n<<8&65280|r>>>8&255]^t[i>>>8&65280|a>>>24&255]}function Vi(e,t,n,r,i){return e[t&255|n&65280]|e[r>>>16&255|i>>>16&65280]<<16}function Hi(e,t,n,r,i){let{sbox2:a,T01:o,T23:s}=Li,c=0;t^=e[c++],n^=e[c++],r^=e[c++],i^=e[c++];let l=e.length/4-2;for(let a=0;a<l;a++){let a=e[c++]^Bi(o,s,t,n,r,i),l=e[c++]^Bi(o,s,n,r,i,t),u=e[c++]^Bi(o,s,r,i,t,n),d=e[c++]^Bi(o,s,i,t,n,r);t=a,n=l,r=u,i=d}return{s0:e[c++]^Vi(a,t,n,r,i),s1:e[c++]^Vi(a,n,r,i,t),s2:e[c++]^Vi(a,r,i,t,n),s3:e[c++]^Vi(a,i,t,n,r)}}function Ui(e,t,n,r,i){ai(n,16,`nonce`),ai(r),i=hi(r.length,i);let a=n,o=li(a),s=di(a),c=li(r),l=li(i),u=t?0:12,d=r.length,f=s.getUint32(u,t),{s0:p,s1:m,s2:h,s3:g}=Hi(e,o[0],o[1],o[2],o[3]);for(let n=0;n+4<=c.length;n+=4)l[n+0]=c[n+0]^p,l[n+1]=c[n+1]^m,l[n+2]=c[n+2]^h,l[n+3]=c[n+3]^g,f=f+1>>>0,s.setUint32(u,f,t),{s0:p,s1:m,s2:h,s3:g}=Hi(e,o[0],o[1],o[2],o[3]);let _=16*Math.floor(c.length/4);if(_<d){let e=new Uint32Array([p,m,h,g]),t=ci(e);for(let e=_,n=0;e<d;e++,n++)i[e]=r[e]^t[n];ui(e)}return i}function Wi(e,t,n,r,i){let a=i?i.length:0,o=e.create(n,r.length+a);i&&o.update(i);let s=gi(8*r.length,8*a,t);o.update(r),o.update(s);let c=o.digest();return ui(s),c}const Gi=mi({blockSize:16,nonceLength:12,tagLength:16,varSizeNonce:!0},function(e,t,n){if(t.length<8)throw Error(`aes/gcm: invalid nonce length`);function r(e,t,r){let i=Wi(Oi,!1,e,r,n);for(let e=0;e<t.length;e++)i[e]^=t[e];return i}function i(){let n=zi(e),r=ki.slice(),i=ki.slice();if(Ui(n,!1,i,i,r),t.length===12)i.set(t);else{let e=ki.slice();di(e).setBigUint64(8,BigInt(t.length*8),!1);let n=Oi.create(r).update(t).update(e);n.digestInto(i),n.destroy()}return{xk:n,authKey:r,counter:i,tagMask:Ui(n,!1,i,ki)}}return{encrypt(e){let{xk:t,authKey:n,counter:a,tagMask:o}=i(),s=new Uint8Array(e.length+16),c=[t,n,a,o];_i(e)||c.push(e=vi(e)),Ui(t,!1,a,e,s.subarray(0,e.length));let l=r(n,o,s.subarray(0,s.length-16));return c.push(l),s.set(l,e.length),ui(...c),s},decrypt(e){let{xk:t,authKey:n,counter:a,tagMask:o}=i(),s=[t,n,o,a];_i(e)||s.push(e=vi(e));let c=e.subarray(0,-16),l=e.subarray(-16),u=r(n,o,c);if(s.push(u),!pi(u,l))throw Error(`aes/gcm: invalid ghash tag`);let d=Ui(t,!1,a,c);return ui(...s),d}}});function Ki(e){return e instanceof Uint32Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint32Array`}function qi(e,t){if(ai(t,16,`block`),!Ki(e))throw Error(`_encryptBlock accepts result of expandKeyLE`);let n=li(t),{s0:r,s1:i,s2:a,s3:o}=Hi(e,n[0],n[1],n[2],n[3]);return n[0]=r,n[1]=i,n[2]=a,n[3]=o,t}function Ji(e){let t=0;for(let n=15;n>=0;n--){let r=(e[n]&128)>>>7;e[n]=e[n]<<1|t,t=r}return t&&(e[15]^=135),e}function Yi(e,t){if(e.length!==t.length)throw Error(`xorBlock: blocks must have same length`);for(let n=0;n<e.length;n++)e[n]=e[n]^t[n];return e}var Xi=class{buffer;destroyed;k1;k2;xk;constructor(e){ai(e),Ai(e),this.xk=zi(e),this.buffer=new Uint8Array,this.destroyed=!1;let t=new Uint8Array(16);qi(this.xk,t),this.k1=Ji(t),this.k2=Ji(new Uint8Array(this.k1))}update(e){let{destroyed:t,buffer:n}=this;if(t)throw Error(`CMAC instance was destroyed`);ai(e);let r=new Uint8Array(n.length+e.length);return r.set(n),r.set(e,n.length),this.buffer=r,this}digest(){if(this.destroyed)throw Error(`CMAC instance was destroyed`);let{buffer:e}=this,t=e.length,n=Math.ceil(t/16),r;n===0?(n=1,r=!1):r=t%16==0;let i=(n-1)*16,a=e.subarray(i),o;if(r)o=Yi(new Uint8Array(a),this.k1);else{let e=new Uint8Array(16);e.set(a),e[a.length]=128,o=Yi(e,this.k2)}let s=new Uint8Array(16);for(let t=0;t<n-1;t++)Yi(s,e.subarray(t*16,(t+1)*16)),qi(this.xk,s);return Yi(s,o),qi(this.xk,s),ui(o),s}destroy(){let{buffer:e,destroyed:t,xk:n,k1:r,k2:i}=this;t||(this.destroyed=!0,ui(e,n,r,i))}};const Zi=(e,t)=>new Xi(e).update(t).digest();Zi.create=e=>new Xi(e);function Qi(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function $i(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, got `+e)}function ea(e,...t){if(!Qi(e))throw Error(`Uint8Array expected`);if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length `+t+`, got length=`+e.length)}function ta(e){if(typeof e!=`function`||typeof e.create!=`function`)throw Error(`Hash should be wrapped by utils.createHasher`);$i(e.outputLen),$i(e.blockLen)}function na(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function ra(e,t){ea(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}function ia(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function aa(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function oa(e,t){return e<<32-t|e>>>t}new Uint8Array(new Uint32Array([287454020]).buffer)[0],typeof Uint8Array.from([]).toHex==`function`&&Uint8Array.fromHex;function sa(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function ca(e){return typeof e==`string`&&(e=sa(e)),ea(e),e}var la=class{};function ua(e){let t=t=>e().update(ca(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}var da=class extends la{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,ta(e);let n=ca(t);if(this.iHash=e.create(),typeof this.iHash.update!=`function`)throw Error(`Expected instance of class which extends utils.Hash`);this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?e.create().update(n).digest():n);for(let e=0;e<i.length;e++)i[e]^=54;this.iHash.update(i),this.oHash=e.create();for(let e=0;e<i.length;e++)i[e]^=106;this.oHash.update(i),ia(i)}update(e){return na(this),this.iHash.update(e),this}digestInto(e){na(this),ea(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:a,outputLen:o}=this;return e=e,e.finished=r,e.destroyed=i,e.blockLen=a,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const fa=(e,t,n)=>new da(e,t).update(n).digest();fa.create=(e,t)=>new da(e,t);function pa(e,t,n){return ta(e),n===void 0&&(n=new Uint8Array(e.outputLen)),fa(e,ca(n),ca(t))}const ma=Uint8Array.from([0]),ha=Uint8Array.of();function ga(e,t,n,r=32){ta(e),$i(r);let i=e.outputLen;if(r>255*i)throw Error(`Length should be <= 255*HashLen`);let a=Math.ceil(r/i);n===void 0&&(n=ha);let o=new Uint8Array(a*i),s=fa.create(e,t),c=s._cloneInto(),l=new Uint8Array(s.outputLen);for(let e=0;e<a;e++)ma[0]=e+1,c.update(e===0?ha:l).update(n).update(ma).digestInto(l),o.set(l,i*e),s._cloneInto(c);return s.destroy(),c.destroy(),ia(l,ma),o.slice(0,r)}const _a=(e,t,n,r,i)=>ga(e,pa(e,t,n),r,i);function va(e,t,n,r){if(typeof e.setBigUint64==`function`)return e.setBigUint64(t,n,r);let i=BigInt(32),a=BigInt(4294967295),o=Number(n>>i&a),s=Number(n&a),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,s,r)}function ya(e,t,n){return e&t^~e&n}function ba(e,t,n){return e&t^e&n^t&n}var xa=class extends la{constructor(e,t,n,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=aa(this.buffer)}update(e){na(this),e=ca(e),ea(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let a=0;a<i;){let o=Math.min(r-this.pos,i-a);if(o===r){let t=aa(e);for(;r<=i-a;a+=r)this.process(t,a);continue}n.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){na(this),ra(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,ia(this.buffer.subarray(a)),this.padOffset>r-a&&(this.process(n,0),a=0);for(let e=a;e<r;e++)t[e]=0;va(n,r-8,BigInt(this.length*8),i),this.process(n,0);let o=aa(e),s=this.outputLen;if(s%4)throw Error(`_sha2: outputLen should be aligned to 32bit`);let c=s/4,l=this.get();if(c>l.length)throw Error(`_sha2: outputLen bigger than state`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:a,pos:o}=this;return e.destroyed=a,e.finished=i,e.length=r,e.pos=o,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}};const Sa=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ca=BigInt(2**32-1),wa=BigInt(32);function Ta(e,t=!1){return t?{h:Number(e&Ca),l:Number(e>>wa&Ca)}:{h:Number(e>>wa&Ca)|0,l:Number(e&Ca)|0}}function Ea(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){let{h:n,l:o}=Ta(e[a],t);[r[a],i[a]]=[n,o]}return[r,i]}const Da=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Oa=new Uint32Array(64);var ka=class extends xa{constructor(e=32){super(64,e,8,!1),this.A=Sa[0]|0,this.B=Sa[1]|0,this.C=Sa[2]|0,this.D=Sa[3]|0,this.E=Sa[4]|0,this.F=Sa[5]|0,this.G=Sa[6]|0,this.H=Sa[7]|0}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}process(e,t){for(let n=0;n<16;n++,t+=4)Oa[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=Oa[e-15],n=Oa[e-2],r=oa(t,7)^oa(t,18)^t>>>3;Oa[e]=(oa(n,17)^oa(n,19)^n>>>10)+Oa[e-7]+r+Oa[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=oa(o,6)^oa(o,11)^oa(o,25),u=l+t+ya(o,s,c)+Da[e]+Oa[e]|0,d=(oa(n,2)^oa(n,13)^oa(n,22))+ba(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){ia(Oa)}destroy(){this.set(0,0,0,0,0,0,0,0),ia(this.buffer)}};const Aa=Ea(`0x428a2f98d728ae22.0x7137449123ef65cd.0xb5c0fbcfec4d3b2f.0xe9b5dba58189dbbc.0x3956c25bf348b538.0x59f111f1b605d019.0x923f82a4af194f9b.0xab1c5ed5da6d8118.0xd807aa98a3030242.0x12835b0145706fbe.0x243185be4ee4b28c.0x550c7dc3d5ffb4e2.0x72be5d74f27b896f.0x80deb1fe3b1696b1.0x9bdc06a725c71235.0xc19bf174cf692694.0xe49b69c19ef14ad2.0xefbe4786384f25e3.0x0fc19dc68b8cd5b5.0x240ca1cc77ac9c65.0x2de92c6f592b0275.0x4a7484aa6ea6e483.0x5cb0a9dcbd41fbd4.0x76f988da831153b5.0x983e5152ee66dfab.0xa831c66d2db43210.0xb00327c898fb213f.0xbf597fc7beef0ee4.0xc6e00bf33da88fc2.0xd5a79147930aa725.0x06ca6351e003826f.0x142929670a0e6e70.0x27b70a8546d22ffc.0x2e1b21385c26c926.0x4d2c6dfc5ac42aed.0x53380d139d95b3df.0x650a73548baf63de.0x766a0abb3c77b2a8.0x81c2c92e47edaee6.0x92722c851482353b.0xa2bfe8a14cf10364.0xa81a664bbc423001.0xc24b8b70d0f89791.0xc76c51a30654be30.0xd192e819d6ef5218.0xd69906245565a910.0xf40e35855771202a.0x106aa07032bbd1b8.0x19a4c116b8d2d0c8.0x1e376c085141ab53.0x2748774cdf8eeb99.0x34b0bcb5e19b48a8.0x391c0cb3c5c95a63.0x4ed8aa4ae3418acb.0x5b9cca4f7763e373.0x682e6ff3d6b2b8a3.0x748f82ee5defb2fc.0x78a5636f43172f60.0x84c87814a1f0ab72.0x8cc702081a6439ec.0x90befffa23631e28.0xa4506cebde82bde9.0xbef9a3f7b2c67915.0xc67178f2e372532b.0xca273eceea26619c.0xd186b8c721c0c207.0xeada7dd6cde0eb1e.0xf57d4f7fee6ed178.0x06f067aa72176fba.0x0a637dc5a2c898a6.0x113f9804bef90dae.0x1b710b35131c471b.0x28db77f523047d84.0x32caab7b40c72493.0x3c9ebe0a15c9bebc.0x431d67c49c100d4c.0x4cc5d4becb3e42b6.0x597f299cfc657e2a.0x5fcb6fab3ad6faec.0x6c44198c4a475817`.split(`.`).map(e=>BigInt(e)));Aa[0],Aa[1];const ja=ua(()=>new ka);var Ma=J([`codex`,`claude`]),Na=J([`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`]),Pa=J([`untrusted`,`on-failure`,`on-request`,`never`]),Fa=J([`read-only`,`workspace-write`,`danger-full-access`]),Ia=J([`default`,`acceptEdits`,`bypassPermissions`,`plan`,`dontAsk`]),La=K({reasoningEffort:Na.optional(),approvalPolicy:Pa.optional(),sandboxMode:Fa.optional(),permissionMode:Ia.optional()}),Ra=J([`native`,`fallback`]),za=K({provider:Ma,models:Zn(K({id:W().min(1),label:W().min(1),description:W().min(1).optional(),isDefault:Yn().optional(),supportedReasoningEfforts:Zn(Na).optional()})),support:K({reasoningEffort:Yn(),approvalPolicy:Yn(),sandboxMode:Yn(),permissionMode:Yn().optional()}),options:K({reasoningEfforts:Zn(Na),approvalPolicies:Zn(Pa),sandboxModes:Zn(Fa),permissionModes:Zn(Ia).optional()}),defaults:K({model:W().min(1).optional(),reasoningEffort:Na.optional(),approvalPolicy:Pa.optional(),sandboxMode:Fa.optional(),permissionMode:Ia.optional()}),source:Ra}),Ba=K({label:W().min(1),description:W().min(1),markdown:W().min(1).optional()}),Va=K({id:W().min(1),header:W().min(1),question:W().min(1),multiSelect:Yn(),isOther:Yn(),isSecret:Yn(),options:Zn(Ba).nullable()}),Ha=K({label:W().min(1),body:W()}),Ua=K({title:W().min(1),statusLabel:W().min(1),compactText:W().min(1).optional(),sections:Zn(Ha),details:Zn(W())}),Wa=J([`user`,`assistant`,`tool`,`reasoning`,`system`,`error`]),Ga=J([`streaming`,`waiting_approval`,`waiting_input`,`completed`,`failed`]),Ka=J([`event`,`optimistic`]);K({id:W().min(1),sessionId:W().min(1),provider:Ma,kind:Wa,status:Ga,ts:W().datetime(),updatedAt:W().datetime(),source:Ka,title:W().min(1),text:W().optional(),details:Zn(W()),itemType:W().optional(),itemId:W().optional(),turnId:W().optional(),requestId:W().optional(),userInputQuestions:Zn(Va).optional(),userInputAnswers:er(W(),Zn(W())).optional(),toolCardData:Ua.optional(),collapsible:Yn().optional(),collapsedByDefault:Yn().optional(),debug:K({eventTypes:Zn(W()),rawItemType:W().optional(),rawItemPhase:W().optional()})});var qa=new Set([`claude.history.getSessionMessages`,`claude.history.jsonl`]),Ja=/^(Recalled \d+ memory|Searched for \d+ patterns|Read [^:\n]+|已浏览 \d+ 个文件|已编辑 .+ \+\d+ -\d+)/i,Ya=/^<(command-name|command-message|command-args|local-command-stdout|local-command-caveat|bash-input|bash-stdout|bash-stderr)>([\s\S]*?)<\/\1>\s*/i,Xa=/\u001B\[[0-?]*[ -/]*[@-~]/g,Za=J([`streaming`,`waiting_approval`,`waiting_input`,`failed`]),Qa=J([`neutral`,`accent`,`success`,`warning`,`error`]),$a=K({id:W().min(1),ts:W().datetime(),status:Za.optional(),itemId:W().min(1).optional(),turnId:W().min(1).optional(),requestId:W().min(1).optional()}),eo=Zn(W()),to=K({label:W().min(1),body:W()}),no=K({id:W().min(1),header:W().min(1),question:W().min(1),answers:eo}),ro=K({requestId:W().min(1),sessionId:W().min(1),toolName:W().min(1).optional(),reason:W().min(1).optional(),command:W().min(1).optional(),cwd:W().min(1).optional(),grantRoot:W().min(1).optional(),networkHost:W().min(1).optional(),networkProtocol:W().min(1).optional(),itemId:W().min(1).optional(),turnId:W().min(1).optional()}),io=K({label:W().min(1),description:W().min(1),markdown:W().min(1).optional()}),ao=K({id:W().min(1),header:W().min(1),question:W().min(1),multiSelect:Yn(),isOther:Yn(),isSecret:Yn(),options:Zn(io).nullable()}),oo=K({requestId:W().min(1),sessionId:W().min(1),questions:Zn(ao),itemId:W().min(1).optional(),turnId:W().min(1).optional()}),so=$a.extend({kind:q(`user_prompt`),text:W().min(1)}),co=$a.extend({kind:q(`agent_commentary`),text:W().min(1),details:eo}),lo=$a.extend({kind:q(`activity_summary`),text:W().min(1),tone:Qa,details:eo}),uo=$a.extend({kind:q(`tool_card`),title:W().min(1),statusLabel:W().min(1),compactText:W().min(1).optional(),sections:Zn(to),details:eo}),fo=$a.extend({kind:q(`command_strip`),command:W().min(1),label:W().min(1).optional(),args:W().min(1).optional(),output:W().min(1).optional()}),po=$a.extend({kind:q(`file_change_card`),title:W().min(1),filePath:W().min(1),addedLines:G().int().nonnegative(),removedLines:G().int().nonnegative(),summary:W().min(1).optional(),details:eo,patchPreview:W().min(1).optional()}),mo=$a.extend({kind:q(`terminal_card`),title:W().min(1),statusLabel:W().min(1),toolName:W().min(1),command:W().min(1).optional(),compactText:W().min(1).optional(),output:W(),details:eo}),ho=$a.extend({kind:q(`approval_card`),title:W().min(1),text:W().min(1).optional(),details:eo}),go=$a.extend({kind:q(`question_card`),title:W().min(1),text:W().min(1).optional(),details:eo}),_o=$a.extend({kind:q(`question_answer_card`),title:W().min(1),summaryText:W().min(1),entries:Zn(no)}),vo=$n(`kind`,[uo,po,mo]),yo=$n(`kind`,[so,co,lo,uo,fo,po,mo,ho,go,_o,$a.extend({kind:q(`tool_card_group`),children:Zn(vo)})]);function bo(e){let t=Vo(e.rawEvents),n=[];for(let r of e.messages){if(xo(n,r))continue;let e=So(r,r.itemId?t.get(r.itemId):void 0);e&&n.push(e)}n.push(...Ao(e.rawEvents)),n.push(...jo(e.rawEvents,n));let r=[...new Set(n.flatMap(e=>e.sourceMessageIds))];return{timelineItems:No(Mo([...n].sort(Fo))).map(({item:e})=>e),consumedMessageIds:r}}function xo(e,t){if(t.provider!==`claude`||t.kind!==`user`)return!1;let n=us(t.text);if(!n||!n.startsWith(`<`)||!n.endsWith(`>`))return!1;let r=fs(n);return r?r.kind===`ignored_meta`?!0:r.kind===`command_output`?(e.push({item:{...Lo(t),kind:`activity_summary`,text:r.output,tone:`neutral`,details:[]},sourceMessageIds:[t.id]}),!0):(e.push({item:{...Lo(t),kind:`user_prompt`,text:r.command},sourceMessageIds:[t.id]}),r.output&&e.push({item:{...Ro(`${t.id}:output`,t.ts,t.status),kind:`activity_summary`,text:r.output,tone:`neutral`,details:[]},sourceMessageIds:[t.id]}),!0):!1}function So(e,t){if(Co(e))return null;if(e.itemType===`tool_status`&&e.status===`waiting_approval`)return{item:{...Lo(e),kind:`approval_card`,title:e.title||`需要审批`,...us(e.text)?{text:us(e.text)}:{},details:[...e.details]},sourceMessageIds:[e.id]};if(e.itemType===`request_user_input`)return e.status===`completed`||e.status===`failed`?Do(e):{item:{...Lo(e),kind:`question_card`,title:e.title||`请回答问题`,...us(e.text)?{text:us(e.text)}:{},details:[...e.details]},sourceMessageIds:[e.id]};if(e.kind===`user`){let t=us(e.text);return t?{item:{...Lo(e),kind:`user_prompt`,text:t},sourceMessageIds:[e.id]}:null}if(e.kind===`assistant`)return wo(e);if(e.kind===`reasoning`)return e.status===`streaming`?{item:{...Lo(e),kind:`activity_summary`,text:`正在思考`,tone:`neutral`,details:[]},sourceMessageIds:[e.id]}:null;if(e.kind===`tool`)return To(e,t);if(e.kind===`error`){let t=us(e.text)??`执行失败`;return{item:{...Lo(e),kind:`agent_commentary`,text:t,details:[...e.details]},sourceMessageIds:[e.id]}}let n=us(e.text);return!n&&e.details.length===0?null:{item:{...Lo(e),kind:`agent_commentary`,text:n??e.details.join(`
|
|
119
119
|
`),details:[...e.details]},sourceMessageIds:[e.id]}}function Co(e){return e.kind===`system`&&e.title===`Turn Usage`}function wo(e){let t=us(e.text);return!t&&e.details.length===0?null:t&&_s(t)?{item:{...Lo(e),kind:`activity_summary`,text:t,tone:vs(e.status),details:[...e.details]},sourceMessageIds:[e.id]}:{item:{...Lo(e),kind:`agent_commentary`,text:t??e.details.join(`
|
|
120
120
|
`),details:[...e.details]},sourceMessageIds:[e.id]}}function To(e,t){let n=Eo(e,t);if(n)return n;if(e.itemType===`file_change`)return ko(e,t);if(e.itemType===`command_execution`)return Oo(e,t);let r=ns(e);return r?{item:{...Lo(e),kind:`activity_summary`,text:r,tone:vs(e.status),details:[...e.details]},sourceMessageIds:[e.id]}:null}function Eo(e,t){let n=e.toolCardData??as(t?.item,e);return n?{item:{...Lo(e),kind:`tool_card`,title:n.title,statusLabel:n.statusLabel,...n.compactText?{compactText:n.compactText}:{},sections:n.sections,details:n.details},sourceMessageIds:[e.id]}:null}function Do(e){let t=e.userInputQuestions??[],n=e.userInputAnswers??{},r=t.map(e=>({id:e.id,header:e.header,question:e.question,answers:n[e.id]??[]})),i=r.length>0?r.map(e=>`${e.id} -> ${e.answers.length>0?e.answers.join(`、`):`未回答`}`).join(` · `):us(e.text)??`已提交回答`;return{item:{...Lo(e),kind:`question_answer_card`,title:`已回答 Claude 的问题`,summaryText:i,entries:r},sourceMessageIds:[e.id]}}function Oo(e,t){let n=Os(t?.item,[`command`])??ls(e.details,`command`),r=us(e.text)??Os(t?.item,[`output_delta`,`aggregated_output`])??ls(e.details,`output`),i=Ho(t?.item,e),a=Uo(t?.item,e.status),o=Wo(t?.item),s=Go(t?.item,n,r);if(i&&!n&&!r)return{item:{...Lo(e),kind:`activity_summary`,text:i.text,tone:vs(e.status),details:[...e.details]},sourceMessageIds:[e.id],aggregateMeta:{groupKey:`${e.turnId??`no-turn`}:command-actions`,readCount:i.readCount,listCount:i.listCount,searchCount:i.searchCount}};if(!n&&!r){let t=ns(e);return t?{item:{...Lo(e),kind:`activity_summary`,text:t,tone:vs(e.status),details:[...e.details]},sourceMessageIds:[e.id]}:null}return{item:{...Lo(e),kind:`terminal_card`,title:`Shell`,statusLabel:a,toolName:o,...n?{command:n}:{},...s?{compactText:s}:{},output:r??``,details:Jo(e.details)},sourceMessageIds:[e.id]}}function ko(e,t){let n=rs(t?.item)??cs(e.details)??us(e.text)??`unknown`,r=Zo(t?.item),i=Xo(t?.item),a=ns(e),o=ts(e.provider,n,i.addedLines,i.removedLines),s=Yo(e.details);return{item:{...Lo(e),kind:`file_change_card`,title:o,filePath:n,addedLines:i.addedLines,removedLines:i.removedLines,...a&&a!==o?{summary:a}:{},details:s,...r?{patchPreview:r}:{}},sourceMessageIds:[e.id]}}function Ao(e){let t=[],n=[...e].sort(Io),r=null;for(let e of n){let n=Es(e.payload.raw),i=Ds(n.source),a=Es(n.message),o=Ds(a.type),s=Ds(a.subtype);if(!i||!qa.has(i))continue;let c=Ds(a.content);if(o===`system`&&s===`local_command`&&c){let n=fs(c);if(n?.kind===`command_strip`){let i={...Ro(`claude-command:${e.eventId}`,e.ts,`completed`),kind:`command_strip`,command:n.command,...n.label?{label:n.label}:{},...n.args?{args:n.args}:{},...n.output?{output:n.output}:{}};t.push({item:i,sourceMessageIds:[]}),r=i;continue}if(n?.kind===`command_output`){r?r.output=r.output?`${r.output}
|
|
121
|
-
${n.output}`:n.output:t.push({item:{...Ro(`claude-command-output:${e.eventId}`,e.ts,`completed`),kind:`activity_summary`,text:n.output,tone:`neutral`,details:[]},sourceMessageIds:[]});continue}continue}if(o!==`assistant`)continue;let l=Es(a.message),u=Array.isArray(l.content)?l.content:[];for(let n of u){let r=Es(n);if(Ds(r.type)!==`tool_use`||Ds(r.name)!==`Edit`)continue;let i=Es(r.input),a=Os(i,[`file_path`])??`unknown`,o=Os(i,[`old_string`])??``,s=Os(i,[`new_string`])??``,c=$o(o,s);t.push({item:{...Ro(`claude-edit:${e.eventId}:${Ds(r.id)??a}`,e.ts,`completed`),kind:`file_change_card`,title:ts(`claude`,a,c.addedLines,c.removedLines),filePath:a,addedLines:c.addedLines,removedLines:c.removedLines,summary:`文件已更新`,details:[],patchPreview:Qo(o,s)},sourceMessageIds:[]})}}return t}function jo(e,t){let n=new Map;for(let t of[...e].sort(Io)){let e=ys(t);if(!e)continue;if(xs(t)){let r=bs(t);if(r&&Cs(r)){n.delete(e);continue}n.set(e,{ts:t.ts,latestActivity:ws(t)});continue}let r=n.get(e);if(!r)continue;r.ts=t.ts;let i=ws(t);i&&(r.latestActivity=i),Ss(t)&&n.delete(e)}return n.size===0||t.some(e=>e.item.status===`streaming`||e.item.status===`waiting_approval`||e.item.status===`waiting_input`)?[]:[...n.entries()].map(([e,t])=>({item:{...Ro(`zzz:thinking:${e}`,t.ts,`streaming`),turnId:e,kind:`activity_summary`,text:Ts(t.latestActivity),tone:`neutral`,details:[]},sourceMessageIds:[]}))}function Mo(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.item.kind===`activity_summary`&&n.item.kind===`activity_summary`&&e.aggregateMeta&&n.aggregateMeta&&e.aggregateMeta.groupKey===n.aggregateMeta.groupKey){e.aggregateMeta.readCount+=n.aggregateMeta.readCount,e.aggregateMeta.listCount+=n.aggregateMeta.listCount,e.aggregateMeta.searchCount+=n.aggregateMeta.searchCount,e.item.text=Ko(e.aggregateMeta.readCount,e.aggregateMeta.listCount,e.aggregateMeta.searchCount,n.item.status??`completed`),e.item.tone=vs(n.item.status??`completed`),e.item.details=As([...e.item.details,...n.item.details]),e.item.status=n.item.status,e.sourceMessageIds=As([...e.sourceMessageIds,...n.sourceMessageIds]);continue}t.push({...n,sourceMessageIds:[...n.sourceMessageIds],item:Bo(n.item)})}return t}function No(e){let t=[],n=[],r=()=>{if(n.length===0)return;
|
|
121
|
+
${n.output}`:n.output:t.push({item:{...Ro(`claude-command-output:${e.eventId}`,e.ts,`completed`),kind:`activity_summary`,text:n.output,tone:`neutral`,details:[]},sourceMessageIds:[]});continue}continue}if(o!==`assistant`)continue;let l=Es(a.message),u=Array.isArray(l.content)?l.content:[];for(let n of u){let r=Es(n);if(Ds(r.type)!==`tool_use`||Ds(r.name)!==`Edit`)continue;let i=Es(r.input),a=Os(i,[`file_path`])??`unknown`,o=Os(i,[`old_string`])??``,s=Os(i,[`new_string`])??``,c=$o(o,s);t.push({item:{...Ro(`claude-edit:${e.eventId}:${Ds(r.id)??a}`,e.ts,`completed`),kind:`file_change_card`,title:ts(`claude`,a,c.addedLines,c.removedLines),filePath:a,addedLines:c.addedLines,removedLines:c.removedLines,summary:`文件已更新`,details:[],patchPreview:Qo(o,s)},sourceMessageIds:[]})}}return t}function jo(e,t){let n=new Map;for(let t of[...e].sort(Io)){let e=ys(t);if(!e)continue;if(xs(t)){let r=bs(t);if(r&&Cs(r)){n.delete(e);continue}n.set(e,{ts:t.ts,latestActivity:ws(t)});continue}let r=n.get(e);if(!r)continue;r.ts=t.ts;let i=ws(t);i&&(r.latestActivity=i),Ss(t)&&n.delete(e)}return n.size===0||t.some(e=>e.item.status===`streaming`||e.item.status===`waiting_approval`||e.item.status===`waiting_input`)?[]:[...n.entries()].map(([e,t])=>({item:{...Ro(`zzz:thinking:${e}`,t.ts,`streaming`),turnId:e,kind:`activity_summary`,text:Ts(t.latestActivity),tone:`neutral`,details:[]},sourceMessageIds:[]}))}function Mo(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.item.kind===`activity_summary`&&n.item.kind===`activity_summary`&&e.aggregateMeta&&n.aggregateMeta&&e.aggregateMeta.groupKey===n.aggregateMeta.groupKey){e.aggregateMeta.readCount+=n.aggregateMeta.readCount,e.aggregateMeta.listCount+=n.aggregateMeta.listCount,e.aggregateMeta.searchCount+=n.aggregateMeta.searchCount,e.item.text=Ko(e.aggregateMeta.readCount,e.aggregateMeta.listCount,e.aggregateMeta.searchCount,n.item.status??`completed`),e.item.tone=vs(n.item.status??`completed`),e.item.details=As([...e.item.details,...n.item.details]),e.item.status=n.item.status,e.sourceMessageIds=As([...e.sourceMessageIds,...n.sourceMessageIds]);continue}t.push({...n,sourceMessageIds:[...n.sourceMessageIds],item:Bo(n.item)})}return t}function No(e){let t=[],n=[],r=()=>{if(n.length===0)return;let e=n[0],r=n[n.length-1],i=n.some(e=>e.item.status===`streaming`)?`streaming`:r.item.status;t.push({item:{...Ro(`group:${e.item.id}`,e.item.ts,i??`completed`),kind:`tool_card_group`,children:n.map(e=>zo(e.item))},sourceMessageIds:As(n.flatMap(e=>e.sourceMessageIds))}),n=[]};for(let i of e)Po(i.item)?n.push(i):(r(),t.push(i));return r(),t}function Po(e){return e.kind===`tool_card`||e.kind===`file_change_card`||e.kind===`terminal_card`}function Fo(e,t){let n=e.item.ts.localeCompare(t.item.ts);return n===0?e.item.id.localeCompare(t.item.id):n}function Io(e,t){let n=e.ts.localeCompare(t.ts);return n===0?e.eventId.localeCompare(t.eventId):n}function Lo(e){return Ro(e.id,e.ts,e.status,{itemId:e.itemId,turnId:e.turnId,requestId:e.requestId})}function Ro(e,t,n,r){return{id:e,ts:t,...n===`completed`?{}:{status:Za.parse(n)},...r?.itemId?{itemId:r.itemId}:{},...r?.turnId?{turnId:r.turnId}:{},...r?.requestId?{requestId:r.requestId}:{}}}function zo(e){return Bo(e)}function Bo(e){switch(e.kind){case`user_prompt`:case`approval_card`:case`question_card`:case`command_strip`:return{...e};case`agent_commentary`:case`activity_summary`:case`tool_card`:case`file_change_card`:case`terminal_card`:case`question_answer_card`:return JSON.parse(JSON.stringify(e));case`tool_card_group`:return{...e,children:e.children.map(e=>zo(e))};default:return e}}function Vo(e){let t=new Map;for(let n of e){let e=Es(Es(n.payload.raw).item),r=Os(e,[`id`]);r&&t.set(r,{envelope:n,item:e})}return t}function Ho(e,t){let{readCount:n,listCount:r,searchCount:i}=qo(e);if(n===0&&r===0&&i===0){let e=us(t.text);return e&&_s(e)?{text:e,readCount:0,listCount:0,searchCount:0}:null}return{text:Ko(n,r,i,t.status),readCount:n,listCount:r,searchCount:i}}function Uo(e,t){let{readCount:n,listCount:r,searchCount:i}=qo(e),a=t===`streaming`?`正在`:`已`;return n>0&&r===0&&i===0?`${a}\u8BFB\u53D6 ${n} \u4E2A\u6587\u4EF6`:i>0&&n===0&&r===0?`${a}\u641C\u7D22`:n>0||r>0?`${a}\u6D4F\u89C8`:`${a}\u8FD0\u884C\u547D\u4EE4`}function Wo(e){let{readCount:t,listCount:n,searchCount:r}=qo(e);return t>0&&n===0&&r===0?`Read`:r>0&&t===0&&n===0?`Search`:`Shell`}function Go(e,t,n){let r=Array.isArray(e?.command_actions)?e.command_actions:Array.isArray(e?.commandActions)?e.commandActions:[];if(r.length===1){let e=Es(r[0]);if(Os(e,[`type`])===`read`)return Os(e,[`path`,`file_path`,`filePath`,`name`])??t??ds(n)}return t??ds(n)}function Ko(e,t,n,r){return r===`streaming`?n>0?`正在搜索`:e>0||t>0?`正在浏览`:`正在运行命令`:t>0&&e===0&&n===0&&r===`completed`?t===1?`Listed files`:`Listed ${t} file lists`:t>0&&e===0&&n===0?`\u5DF2\u6D4F\u89C8 ${t} \u4E2A\u5217\u8868`:e>0&&t===0&&n===0?`\u5DF2\u6D4F\u89C8 ${e} \u4E2A\u6587\u4EF6`:e+t>0&&n>0?`\u5DF2\u6D4F\u89C8 ${e+t} \u4E2A\u9879\u76EE\uFF0C${n} \u4E2A\u641C\u7D22`:e+t>0?`\u5DF2\u6D4F\u89C8 ${e+t} \u4E2A\u9879\u76EE`:`\u5DF2\u6267\u884C ${n} \u4E2A\u641C\u7D22`}function qo(e){let t=Array.isArray(e?.command_actions)?e.command_actions:Array.isArray(e?.commandActions)?e.commandActions:[],n=0,r=0,i=0;for(let e of t){let t=Ds(Es(e).type);t===`read`?n+=1:t===`listFiles`||t===`list_files`?r+=1:t===`search`&&(i+=1)}return{readCount:n,listCount:r,searchCount:i}}function Jo(e){return e.filter(e=>{let t=e.trim().toLowerCase();return!(t.startsWith(`command:`)||t.startsWith(`output:`)||t.startsWith(`status:`)||t.startsWith(`exit_code:`)||t.startsWith(`command_actions:`))})}function Yo(e){return e.filter(e=>{let t=e.trim().toLowerCase();return!(t.startsWith(`status:`)||t.startsWith(`output:`)||t.startsWith(`update:`))})}function Xo(e){let t=ks(e,[`added_lines`,`addedLines`]),n=ks(e,[`removed_lines`,`removedLines`]);if(t!==void 0||n!==void 0)return{addedLines:t??0,removedLines:n??0};let r=Os(e,[`old_string`,`oldString`])??``,i=Os(e,[`new_string`,`newString`])??``;if(r||i)return $o(r,i);let a=Os(e,[`patch`,`structuredPatch`,`structured_patch`,`diff`]);if(a)return es(a);let o=Array.isArray(e?.changes)?e.changes:[],s=0,c=0,l=!1;for(let e of o){let t=Es(e),n=ks(t,[`added_lines`,`addedLines`]),r=ks(t,[`removed_lines`,`removedLines`]);if(n!==void 0||r!==void 0){s+=n??0,c+=r??0,l=!0;continue}let i=Os(t,[`diff`,`patch`,`structuredPatch`,`structured_patch`,`unified_diff`]);if(i){let e=es(i);s+=e.addedLines,c+=e.removedLines,l=!0}}return l?{addedLines:s,removedLines:c}:{addedLines:0,removedLines:0}}function Zo(e){let t=Os(e,[`patch`,`structuredPatch`,`structured_patch`,`diff`]);if(t)return t;let n=Os(e,[`old_string`,`oldString`]),r=Os(e,[`new_string`,`newString`]);if(!n&&!r){let t=(Array.isArray(e?.changes)?e.changes:[]).map(e=>Os(Es(e),[`diff`,`patch`,`structuredPatch`,`structured_patch`,`unified_diff`])).filter(e=>typeof e==`string`&&e.length>0);return t.length>0?t.join(`
|
|
122
122
|
|
|
123
123
|
`):void 0}return Qo(n??``,r??``)}function Qo(e,t){let n=Ms(e),r=Ms(t),i=n.map(e=>`- ${e}`),a=r.map(e=>`+ ${e}`);return[...i,...a].join(`
|
|
124
124
|
`)}function $o(e,t){let n=Ms(e),r=Ms(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i+=1;let a=n.length-1,o=r.length-1;for(;a>=i&&o>=i&&n[a]===r[o];)--a,--o;return{removedLines:Math.max(a-i+1,0),addedLines:Math.max(o-i+1,0)}}function es(e){let t=Ms(e),n=0,r=0;for(let e of t)e.startsWith(`+++`)||e.startsWith(`---`)||e.startsWith(`@@`)||(e.startsWith(`+`)?n+=1:e.startsWith(`-`)&&(r+=1));return{addedLines:n,removedLines:r}}function ts(e,t,n,r){return e===`claude`?`Update(${t})`:`\u5DF2\u7F16\u8F91 ${js(t)} +${n} -${r}`}function ns(e){let t=us(e.text);if(t)return t;let n=e.details[0];return n?us(n):void 0}function rs(e){let t=Os(e,[`path`,`file_path`,`filePath`]);if(t)return t;let n=Array.isArray(e?.changes)?e.changes:[];for(let e of n){let t=Os(Es(e),[`path`,`file_path`,`filePath`]);if(t)return t}}function is(e){let t=[],n=Os(e??{},[`file_path`]),r=ks(e??{},[`total_tokens`]),i=ks(e??{},[`total_tool_uses`]),a=ks(e??{},[`duration_ms`]);return n&&t.push(n),typeof i==`number`&&t.push(`${i} tool uses`),typeof r==`number`&&t.push(`${os(r)} tokens`),typeof a==`number`&&t.push(ss(a)),As(t)}function as(e,t){if(Os(e??{},[`display_as`])!==`tool_card`)return;let n=Os(e??{},[`title`])??ns(t),r=Os(e??{},[`status_label`])??us(t.text);if(!n||!r)return;let i=[],a=Os(e??{},[`prompt`]),o=Os(e??{},[`response`]),s=Os(e??{},[`response_label`])??`Response`;return a&&i.push({label:`Prompt`,body:a}),o&&i.push({label:s,body:o}),{title:n,statusLabel:r,compactText:us(t.text),sections:i,details:is(e)}}function os(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function ss(e){let t=Math.max(1,Math.round(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;return r===0?`${n}m`:`${n}m ${r}s`}function cs(e){for(let t of e){let e=t.replace(/^[a-z_]+:\s*/i,``).trim();if(e.includes(`/`)||e.includes(`.tsx`)||e.includes(`.ts`))return e}}function ls(e,t){let n=`${t}:`;for(let t of e)if(t.startsWith(n))return us(t.slice(n.length))}function us(e){if(typeof e!=`string`)return;let t=e.replace(/\r\n/g,`
|