maka-agent 0.2.0-dev.30.20260912 → 0.2.0-dev.32.20260914
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/THIRD_PARTY_NOTICES.txt +392 -0
- package/dist/acp/maka-acp-agent.js +8 -2
- package/dist/acp/prompt-content.js +225 -0
- package/dist/acp/session-event-mapper.js +103 -0
- package/dist/acp/session-registry.js +654 -17
- package/dist/acp/stdio-server.js +10 -1
- package/dist/cli-core.js +1 -1
- package/dist/pi-transcript-tools.js +3 -2
- package/dist/pi-transcript.js +15 -6
- package/dist/runtime-host-session-channel.js +63 -9
- package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
- package/node_modules/@maka/core/dist/agent-graph-schedule.js +15 -4
- package/node_modules/@maka/core/dist/artifacts.js +6 -0
- package/node_modules/@maka/core/dist/attachments.js +7 -2
- package/node_modules/@maka/core/dist/durable-tool-result-projection.js +3 -1
- package/node_modules/@maka/core/dist/events.js +21 -0
- package/node_modules/@maka/core/dist/executor-id.js +22 -0
- package/node_modules/@maka/core/dist/external-session.js +18 -0
- package/node_modules/@maka/core/dist/goal.js +44 -2
- package/node_modules/@maka/core/dist/model-call-usage-projection.js +0 -13
- package/node_modules/@maka/core/dist/permission.js +0 -1
- package/node_modules/@maka/core/dist/runtime-boundary.js +73 -29
- package/node_modules/@maka/core/dist/runtime-event.js +25 -6
- package/node_modules/@maka/core/dist/runtime-handoff.js +10 -2
- package/node_modules/@maka/core/dist/runtime-logical-execution.js +39 -14
- package/node_modules/@maka/core/dist/session-send-projection.js +6 -3
- package/node_modules/@maka/core/dist/session.js +8 -2
- package/node_modules/@maka/core/dist/shell-run-result.js +1 -0
- package/node_modules/@maka/core/dist/shell-run.js +4 -0
- package/node_modules/@maka/core/dist/tool-result-archive-evidence.js +3 -1
- package/node_modules/@maka/core/dist/tool-result-record-schema.js +2 -1
- package/node_modules/@maka/core/dist/unified-diff.js +33 -26
- package/node_modules/@maka/core/dist/work-board.js +94 -1
- package/node_modules/@maka/core/package.json +1 -0
- package/node_modules/@maka/eval/dist/fleet-simulation.js +270 -0
- package/node_modules/@maka/eval/dist/fleet-store.js +243 -0
- package/node_modules/@maka/eval/dist/fleet-worker.js +125 -0
- package/node_modules/@maka/eval/dist/fleet.js +329 -0
- package/node_modules/@maka/eval/dist/index.js +3 -0
- package/node_modules/@maka/runtime/dist/agent-run.js +2 -17
- package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +55 -180
- package/node_modules/@maka/runtime/dist/ai-sdk-message-projection.js +43 -26
- package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +271 -382
- package/node_modules/@maka/runtime/dist/background-task-health-tool.js +104 -0
- package/node_modules/@maka/runtime/dist/bash-model-output.js +7 -1
- package/node_modules/@maka/runtime/dist/bash-tail-buffer.js +13 -52
- package/node_modules/@maka/runtime/dist/builtin-tools.js +59 -111
- package/node_modules/@maka/runtime/dist/child-fd-input.js +3 -2
- package/node_modules/@maka/runtime/dist/context-budget-policy.js +1 -11
- package/node_modules/@maka/runtime/dist/context-budget.js +12 -1
- package/node_modules/@maka/runtime/dist/conversation-copy.js +104 -9
- package/node_modules/@maka/runtime/dist/filesystem-executor.js +10 -6
- package/node_modules/@maka/runtime/dist/filesystem-worker/client.js +77 -19
- package/node_modules/@maka/runtime/dist/filesystem-worker/launch-spec.js +66 -55
- package/node_modules/@maka/runtime/dist/filesystem-worker/operations.js +34 -97
- package/node_modules/@maka/runtime/dist/filesystem-worker/protocol.js +25 -10
- package/node_modules/@maka/runtime/dist/filesystem-worker/worker-entry.js +2 -0
- package/node_modules/@maka/runtime/dist/glob-search.js +74 -0
- package/node_modules/@maka/runtime/dist/goal-continuation.js +78 -8
- package/node_modules/@maka/runtime/dist/goal-state.js +7 -0
- package/node_modules/@maka/runtime/dist/grep-search.js +155 -0
- package/node_modules/@maka/runtime/dist/history-compaction.js +3 -1
- package/node_modules/@maka/runtime/dist/ledger-tool-result-archive-reader.js +84 -94
- package/node_modules/@maka/runtime/dist/local-web-fetch.js +1 -1
- package/node_modules/@maka/runtime/dist/model-adapter.js +62 -53
- package/node_modules/@maka/runtime/dist/model-history.js +26 -8
- package/node_modules/@maka/runtime/dist/pipe-tail-collector.js +6 -9
- package/node_modules/@maka/runtime/dist/plugin-executor-backend.js +311 -0
- package/node_modules/@maka/runtime/dist/plugin-executor-service.js +344 -0
- package/node_modules/@maka/runtime/dist/provider-error-classification.js +7 -1
- package/node_modules/@maka/runtime/dist/provider-request-telemetry.js +35 -8
- package/node_modules/@maka/runtime/dist/read-page.js +231 -0
- package/node_modules/@maka/runtime/dist/request-projection.js +2 -15
- package/node_modules/@maka/runtime/dist/ripgrep-executable.js +62 -0
- package/node_modules/@maka/runtime/dist/ripgrep-guidance.js +81 -0
- package/node_modules/@maka/runtime/dist/runtime-event-backfill.js +7 -1
- package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +188 -20
- package/node_modules/@maka/runtime/dist/runtime-invocation-route.js +49 -0
- package/node_modules/@maka/runtime/dist/runtime-kernel.js +72 -150
- package/node_modules/@maka/runtime/dist/runtime-read-model.js +2 -3
- package/node_modules/@maka/runtime/dist/sandbox/linux-profile-path.js +7 -1
- package/node_modules/@maka/runtime/dist/sandbox/linux-sandbox.js +20 -5
- package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +3 -0
- package/node_modules/@maka/runtime/dist/session-manager.js +106 -64
- package/node_modules/@maka/runtime/dist/session-recap.js +9 -5
- package/node_modules/@maka/runtime/dist/shell-exec.js +7 -25
- package/node_modules/@maka/runtime/dist/shell-run-manager.js +10 -4
- package/node_modules/@maka/runtime/dist/shell-run-tool-result.js +2 -1
- package/node_modules/@maka/runtime/dist/shell-tools.js +6 -12
- package/node_modules/@maka/runtime/dist/stream-graph-schedule-reconcile.js +1 -0
- package/node_modules/@maka/runtime/dist/stream-graph-supervisor-tools.js +26 -4
- package/node_modules/@maka/runtime/dist/subagent-tools.js +7 -0
- package/node_modules/@maka/runtime/dist/tool-availability.js +0 -1
- package/node_modules/@maka/runtime/dist/tool-output.js +1 -1
- package/node_modules/@maka/runtime/dist/tool-result-archive-capability.js +24 -36
- package/node_modules/@maka/runtime/dist/tool-result-archive-resource.js +32 -527
- package/node_modules/@maka/runtime/dist/tool-result-archive-transition.js +17 -119
- package/node_modules/@maka/runtime/dist/tool-result-archive.js +7 -25
- package/node_modules/@maka/runtime/dist/tool-runtime.js +52 -471
- package/node_modules/@maka/runtime/dist/workers/filesystem-worker.js +6933 -3681
- package/node_modules/@maka/runtime/dist/workspace-executor.js +20 -24
- package/node_modules/@maka/runtime/package.json +5 -0
- package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +7 -2
- package/node_modules/@maka/runtime-host/dist/client/host-handoff-copy.js +185 -191
- package/node_modules/@maka/runtime-host/dist/client/reconnecting-connection.js +3 -0
- package/node_modules/@maka/runtime-host/dist/client/session-catalog-summary.js +1 -0
- package/node_modules/@maka/runtime-host/dist/protocol/external-session.js +24 -3
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +8 -1
- package/node_modules/@maka/runtime-host/dist/protocol/message.js +2 -2
- package/node_modules/@maka/runtime-host/dist/protocol/operations.js +1 -0
- package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +42 -5
- package/node_modules/@maka/runtime-host/dist/protocol/session-catalog.js +31 -3
- package/node_modules/@maka/runtime-host/dist/protocol/session-continuity.js +8 -2
- package/node_modules/@maka/runtime-host/dist/protocol/turn.js +10 -2
- package/node_modules/@maka/runtime-host/dist/protocol/workhub-coordination.js +38 -0
- package/node_modules/@maka/runtime-host/dist/server/child-agent-composition.js +1 -0
- package/node_modules/@maka/runtime-host/dist/server/execution-artifacts.js +3 -30
- package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +56 -8
- package/node_modules/@maka/runtime-host/dist/server/external-session-coordinator.js +14 -1
- package/node_modules/@maka/runtime-host/dist/server/goal-coordinator.js +81 -7
- package/node_modules/@maka/runtime-host/dist/server/host-session-availability.js +10 -2
- package/node_modules/@maka/runtime-host/dist/server/hosted-execution-tool-profile.js +13 -13
- package/node_modules/@maka/runtime-host/dist/server/interaction-coordinator.js +65 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-platform-coordinator.js +6 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-platform.js +6 -0
- package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +1 -0
- package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +56 -16
- package/node_modules/@maka/runtime-host/dist/server/session-continuity-coordinator.js +9 -5
- package/node_modules/@maka/runtime-host/dist/server/session-revision-coordinator.js +4 -0
- package/node_modules/@maka/runtime-host/dist/server/session-transcript-reader.js +88 -72
- package/node_modules/@maka/runtime-host/dist/server/web-fetch-tool.js +37 -1
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-action-gate.js +21 -4
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +145 -1
- package/node_modules/@maka/storage/dist/agent-run-store.js +5 -2
- package/node_modules/@maka/storage/dist/claude-code-session-adapter.js +450 -234
- package/node_modules/@maka/storage/dist/claude-code-transcript-lineage.js +106 -77
- package/node_modules/@maka/storage/dist/execution-stores.js +2 -1
- package/node_modules/@maka/storage/dist/legacy-run-header.js +2 -2
- package/node_modules/@maka/storage/dist/model-call-usage-sql.js +1 -1
- package/node_modules/@maka/storage/dist/runtime-transcript-query.js +27 -14
- package/node_modules/@maka/storage/dist/session-store.js +12 -2
- package/node_modules/@maka/storage/dist/sqlite-long-term-memory-store.js +86 -12
- package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +69 -3
- package/node_modules/@maka/storage/dist/work-board-store.js +40 -1
- package/node_modules/balanced-match/LICENSE.md +23 -0
- package/node_modules/balanced-match/README.md +57 -0
- package/node_modules/balanced-match/dist/commonjs/index.js +59 -0
- package/node_modules/balanced-match/dist/commonjs/package.json +3 -0
- package/node_modules/balanced-match/dist/esm/index.js +54 -0
- package/node_modules/balanced-match/dist/esm/package.json +3 -0
- package/node_modules/balanced-match/package.json +68 -0
- package/node_modules/brace-expansion/LICENSE +23 -0
- package/node_modules/brace-expansion/README.md +105 -0
- package/node_modules/brace-expansion/dist/commonjs/index.js +289 -0
- package/node_modules/brace-expansion/dist/commonjs/package.json +3 -0
- package/node_modules/brace-expansion/dist/esm/index.js +285 -0
- package/node_modules/brace-expansion/dist/esm/package.json +3 -0
- package/node_modules/brace-expansion/package.json +64 -0
- package/node_modules/glob/LICENSE.md +63 -0
- package/node_modules/glob/README.md +1203 -0
- package/node_modules/glob/dist/commonjs/glob.js +248 -0
- package/node_modules/glob/dist/commonjs/has-magic.js +27 -0
- package/node_modules/glob/dist/commonjs/ignore.js +119 -0
- package/node_modules/glob/dist/commonjs/index.js +68 -0
- package/node_modules/glob/dist/commonjs/index.min.js +4 -0
- package/node_modules/glob/dist/commonjs/package.json +3 -0
- package/node_modules/glob/dist/commonjs/pattern.js +223 -0
- package/node_modules/glob/dist/commonjs/processor.js +301 -0
- package/node_modules/glob/dist/commonjs/walker.js +387 -0
- package/node_modules/glob/dist/esm/glob.js +244 -0
- package/node_modules/glob/dist/esm/has-magic.js +23 -0
- package/node_modules/glob/dist/esm/ignore.js +115 -0
- package/node_modules/glob/dist/esm/index.js +55 -0
- package/node_modules/glob/dist/esm/index.min.js +4 -0
- package/node_modules/glob/dist/esm/package.json +3 -0
- package/node_modules/glob/dist/esm/pattern.js +219 -0
- package/node_modules/glob/dist/esm/processor.js +294 -0
- package/node_modules/glob/dist/esm/walker.js +381 -0
- package/node_modules/glob/package.json +98 -0
- package/node_modules/minimatch/LICENSE.md +55 -0
- package/node_modules/minimatch/README.md +528 -0
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
- package/node_modules/minimatch/dist/commonjs/ast.js +845 -0
- package/node_modules/minimatch/dist/commonjs/brace-expressions.js +150 -0
- package/node_modules/minimatch/dist/commonjs/escape.js +30 -0
- package/node_modules/minimatch/dist/commonjs/index.js +1127 -0
- package/node_modules/minimatch/dist/commonjs/package.json +3 -0
- package/node_modules/minimatch/dist/commonjs/unescape.js +38 -0
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
- package/node_modules/minimatch/dist/esm/ast.js +841 -0
- package/node_modules/minimatch/dist/esm/brace-expressions.js +146 -0
- package/node_modules/minimatch/dist/esm/escape.js +26 -0
- package/node_modules/minimatch/dist/esm/index.js +1114 -0
- package/node_modules/minimatch/dist/esm/package.json +3 -0
- package/node_modules/minimatch/dist/esm/unescape.js +34 -0
- package/node_modules/minimatch/package.json +73 -0
- package/node_modules/minipass/LICENSE.md +55 -0
- package/node_modules/minipass/README.md +825 -0
- package/node_modules/minipass/dist/commonjs/index.js +1038 -0
- package/node_modules/minipass/dist/commonjs/package.json +3 -0
- package/node_modules/minipass/dist/esm/index.js +1020 -0
- package/node_modules/minipass/dist/esm/package.json +3 -0
- package/node_modules/minipass/package.json +77 -0
- package/node_modules/path-scurry/LICENSE.md +55 -0
- package/node_modules/path-scurry/README.md +636 -0
- package/node_modules/path-scurry/dist/commonjs/index.js +2018 -0
- package/node_modules/path-scurry/dist/commonjs/package.json +3 -0
- package/node_modules/path-scurry/dist/esm/index.js +1983 -0
- package/node_modules/path-scurry/dist/esm/package.json +3 -0
- package/node_modules/path-scurry/node_modules/lru-cache/LICENSE.md +55 -0
- package/node_modules/path-scurry/node_modules/lru-cache/README.md +469 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel.js +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/index.js +1726 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/index.min.js +2 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/perf.js +10 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/diagnostics-channel-cjs.d.cts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/diagnostics-channel.js +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +1726 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.min.js +2 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel.js +9 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/index.js +1726 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/index.min.js +2 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/perf.js +10 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/package.json +3 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/perf.js +10 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.js +4 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/index.js +1722 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/index.min.js +2 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/perf.js +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.d.mts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/diagnostics-channel.js +19 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js +1722 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.min.js +2 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/diagnostics-channel.js +6 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/index.js +1722 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/index.min.js +2 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/perf.js +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/package.json +3 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/perf.js +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/package.json +154 -0
- package/node_modules/path-scurry/package.json +72 -0
- package/package.json +1 -1
- package/node_modules/@maka/runtime/dist/active-tool-result-prune.js +0 -248
- package/node_modules/@maka/runtime/dist/active-tool-result-working-set.js +0 -218
- package/node_modules/@maka/runtime/dist/archive-read-tool.js +0 -115
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{tracingChannel as G,channel as P}from"node:diagnostics_channel";var S=P("lru-cache:metrics"),W=G("lru-cache");var L=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date;var D=()=>S.hasSubscribers||W.hasSubscribers,U=new Set,M=typeof process=="object"&&process?process:{},k=(u,e,t,i)=>{typeof M.emitWarning=="function"?M.emitWarning(u,e,t,i):console.error(`[${t}] ${e}: ${u}`)},H=u=>!U.has(u);var T=u=>!!u&&u===Math.floor(u)&&u>0&&isFinite(u),j=u=>T(u)?u<=Math.pow(2,8)?Uint8Array:u<=Math.pow(2,16)?Uint16Array:u<=Math.pow(2,32)?Uint32Array:u<=Number.MAX_SAFE_INTEGER?O:null:null,O=class extends Array{constructor(e){super(e),this.fill(0)}},R=class u{heap;length;static#o=!1;static create(e){let t=j(e);if(!t)return[];u.#o=!0;let i=new u(e,t);return u.#o=!1,i}constructor(e,t){if(!u.#o)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},I=class u{#o;#c;#S;#O;#w;#M;#I;#m;get perf(){return this.#m}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#n;#b;#s;#i;#t;#l;#u;#a;#h;#y;#r;#_;#F;#d;#g;#T;#U;#f;#x;static unsafeExposeInternals(e){return{starts:e.#F,ttls:e.#d,autopurgeTimers:e.#g,sizes:e.#_,keyMap:e.#s,keyList:e.#i,valList:e.#t,next:e.#l,prev:e.#u,get head(){return e.#a},get tail(){return e.#h},free:e.#y,isBackgroundFetch:t=>e.#e(t),backgroundFetch:(t,i,s,n)=>e.#P(t,i,s,n),moveToTail:t=>e.#L(t),indexes:t=>e.#A(t),rindexes:t=>e.#z(t),isStale:t=>e.#p(t)}}get max(){return this.#o}get maxSize(){return this.#c}get calculatedSize(){return this.#b}get size(){return this.#n}get fetchMethod(){return this.#M}get memoMethod(){return this.#I}get dispose(){return this.#S}get onInsert(){return this.#O}get disposeAfter(){return this.#w}constructor(e){let{max:t=0,ttl:i,ttlResolution:s=1,ttlAutopurge:n,updateAgeOnGet:r,updateAgeOnHas:h,allowStale:a,dispose:o,onInsert:d,disposeAfter:y,noDisposeOnSet:_,noUpdateTTL:c,maxSize:g=0,maxEntrySize:f=0,sizeCalculation:b,fetchMethod:l,memoMethod:w,noDeleteOnFetchRejection:F,noDeleteOnStaleGet:m,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:A,ignoreFetchAbort:z,backgroundFetchSize:C=1,perf:E}=e;if(this.backgroundFetchSize=C,E!==void 0&&typeof E?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#m=E??L,t!==0&&!T(t))throw new TypeError("max option must be a nonnegative integer");let v=t?j(t):Array;if(!v)throw new Error("invalid max value: "+t);if(this.#o=t,this.#c=g,this.maxEntrySize=f||this.#c,this.sizeCalculation=b,this.sizeCalculation){if(!this.#c&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(w!==void 0&&typeof w!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#I=w,l!==void 0&&typeof l!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#M=l,this.#U=!!l,this.#s=new Map,this.#i=Array.from({length:t}).fill(void 0),this.#t=Array.from({length:t}).fill(void 0),this.#l=new v(t),this.#u=new v(t),this.#a=0,this.#h=0,this.#y=R.create(t),this.#n=0,this.#b=0,typeof o=="function"&&(this.#S=o),typeof d=="function"&&(this.#O=d),typeof y=="function"?(this.#w=y,this.#r=[]):(this.#w=void 0,this.#r=void 0),this.#T=!!this.#S,this.#x=!!this.#O,this.#f=!!this.#w,this.noDisposeOnSet=!!_,this.noUpdateTTL=!!c,this.noDeleteOnFetchRejection=!!F,this.allowStaleOnFetchRejection=!!p,this.allowStaleOnFetchAbort=!!A,this.ignoreFetchAbort=!!z,this.maxEntrySize!==0){if(this.#c!==0&&!T(this.#c))throw new TypeError("maxSize must be a positive integer if specified");if(!T(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#X()}if(this.allowStale=!!a,this.noDeleteOnStaleGet=!!m,this.updateAgeOnGet=!!r,this.updateAgeOnHas=!!h,this.ttlResolution=T(s)||s===0?s:1,this.ttlAutopurge=!!n,this.ttl=i||0,this.ttl){if(!T(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#k()}if(this.#o===0&&this.ttl===0&&this.#c===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#o&&!this.#c){let x="LRU_CACHE_UNBOUNDED";H(x)&&(U.add(x),k("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",x,u))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#k(){let e=new O(this.#o),t=new O(this.#o);this.#d=e,this.#F=t;let i=this.ttlAutopurge?Array.from({length:this.#o}):void 0;this.#g=i,this.#H=(h,a,o=this.#m.now())=>{t[h]=a!==0?o:0,e[h]=a,s(h,a)},this.#D=h=>{t[h]=e[h]!==0?this.#m.now():0,s(h,e[h])};let s=this.ttlAutopurge?(h,a)=>{if(i?.[h]&&(clearTimeout(i[h]),i[h]=void 0),a&&a!==0&&i){let o=setTimeout(()=>{this.#p(h)&&this.#E(this.#i[h],"expire")},a+1);o.unref&&o.unref(),i[h]=o}}:()=>{};this.#v=(h,a)=>{if(e[a]){let o=e[a],d=t[a];if(!o||!d)return;h.ttl=o,h.start=d,h.now=n||r();let y=h.now-d;h.remainingTTL=o-y}};let n=0,r=()=>{let h=this.#m.now();if(this.ttlResolution>0){n=h;let a=setTimeout(()=>n=0,this.ttlResolution);a.unref&&a.unref()}return h};this.getRemainingTTL=h=>{let a=this.#s.get(h);if(a===void 0)return 0;let o=e[a],d=t[a];if(!o||!d)return 1/0;let y=(n||r())-d;return o-y},this.#p=h=>{let a=t[h],o=e[h];return!!o&&!!a&&(n||r())-a>o}}#D=()=>{};#v=()=>{};#H=()=>{};#p=()=>!1;#X(){let e=new O(this.#o);this.#b=0,this.#_=e,this.#R=t=>{this.#b-=e[t],e[t]=0},this.#N=(t,i,s,n)=>{if(!T(s)){if(this.#e(i))return this.backgroundFetchSize;if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(s=n(i,t),!T(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.")}return s},this.#j=(t,i,s)=>{if(e[t]=i,this.#c){let n=this.#c-e[t];for(;this.#b>n;)this.#G(!0)}this.#b+=e[t],s&&(s.entrySize=i,s.totalCalculatedSize=this.#b)}}#R=e=>{};#j=(e,t,i)=>{};#N=(e,t,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#A({allowStale:e=this.allowStale}={}){if(this.#n)for(let t=this.#h;this.#V(t)&&((e||!this.#p(t))&&(yield t),t!==this.#a);)t=this.#u[t]}*#z({allowStale:e=this.allowStale}={}){if(this.#n)for(let t=this.#a;this.#V(t)&&((e||!this.#p(t))&&(yield t),t!==this.#h);)t=this.#l[t]}#V(e){return e!==void 0&&this.#s.get(this.#i[e])===e}*entries(){for(let e of this.#A())this.#t[e]!==void 0&&this.#i[e]!==void 0&&!this.#e(this.#t[e])&&(yield[this.#i[e],this.#t[e]])}*rentries(){for(let e of this.#z())this.#t[e]!==void 0&&this.#i[e]!==void 0&&!this.#e(this.#t[e])&&(yield[this.#i[e],this.#t[e]])}*keys(){for(let e of this.#A()){let t=this.#i[e];t!==void 0&&!this.#e(this.#t[e])&&(yield t)}}*rkeys(){for(let e of this.#z()){let t=this.#i[e];t!==void 0&&!this.#e(this.#t[e])&&(yield t)}}*values(){for(let e of this.#A())this.#t[e]!==void 0&&!this.#e(this.#t[e])&&(yield this.#t[e])}*rvalues(){for(let e of this.#z())this.#t[e]!==void 0&&!this.#e(this.#t[e])&&(yield this.#t[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let i of this.#A()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;if(n!==void 0&&e(n,this.#i[i],this))return this.#C(this.#i[i],t)}}forEach(e,t=this){for(let i of this.#A()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;n!==void 0&&e.call(t,n,this.#i[i],this)}}rforEach(e,t=this){for(let i of this.#z()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;n!==void 0&&e.call(t,n,this.#i[i],this)}}purgeStale(){let e=!1;for(let t of this.#z({allowStale:!0}))this.#p(t)&&(this.#E(this.#i[t],"expire"),e=!0);return e}info(e){let t=this.#s.get(e);if(t===void 0)return;let i=this.#t[t],s=this.#e(i)?i.__staleWhileFetching:i;if(s===void 0)return;let n={value:s};if(this.#d&&this.#F){let r=this.#d[t],h=this.#F[t];if(r&&h){let a=r-(this.#m.now()-h);n.ttl=a,n.start=Date.now()}}return this.#_&&(n.size=this.#_[t]),n}dump(){let e=[];for(let t of this.#A({allowStale:!0})){let i=this.#i[t],s=this.#t[t],n=this.#e(s)?s.__staleWhileFetching:s;if(n===void 0||i===void 0)continue;let r={value:n};if(this.#d&&this.#F){r.ttl=this.#d[t];let h=this.#m.now()-this.#F[t];r.start=Math.floor(Date.now()-h)}this.#_&&(r.size=this.#_[t]),e.unshift([i,r])}return e}load(e){this.clear();for(let[t,i]of e){if(i.start){let s=Date.now()-i.start;i.start=this.#m.now()-s}this.#W(t,i.value,i)}}set(e,t,i={}){let{status:s=S.hasSubscribers?{}:void 0}=i;i.status=s,s&&(s.op="set",s.key=e,t!==void 0&&(s.value=t),s.cache=this);let n=this.#W(e,t,i);return s&&S.hasSubscribers&&S.publish(s),n}#W(e,t,i,s){let{ttl:n=this.ttl,start:r,noDisposeOnSet:h=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:o}=i,d=this.#e(t);if(t===void 0)return o&&(o.set="deleted"),this.delete(e),this;let{noUpdateTTL:y=this.noUpdateTTL}=i;o&&!d&&(o.value=t);let _=this.#N(e,t,i.size||0,a,o);if(this.maxEntrySize&&_>this.maxEntrySize)return this.#E(e,"set"),o&&(o.set="miss",o.maxEntrySizeExceeded=!0),this;let c=this.#n===0?void 0:this.#s.get(e);if(c===void 0)c=this.#n===0?this.#h:this.#y.length!==0?this.#y.pop():this.#n===this.#o?this.#G(!1):this.#n,this.#i[c]=e,this.#t[c]=t,this.#s.set(e,c),this.#l[this.#h]=c,this.#u[c]=this.#h,this.#h=c,this.#n++,this.#j(c,_,o),o&&(o.set="add"),y=!1,this.#x&&!d&&this.#O?.(t,e,"add");else{this.#L(c);let g=this.#t[c];if(t!==g){if(!h)if(this.#e(g)){g!==s&&g.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:f}=g;f!==void 0&&f!==t&&(this.#T&&this.#S?.(f,e,"set"),this.#f&&this.#r?.push([f,e,"set"]))}else this.#T&&this.#S?.(g,e,"set"),this.#f&&this.#r?.push([g,e,"set"]);if(this.#R(c),this.#j(c,_,o),this.#t[c]=t,!d){let f=g&&this.#e(g)?g.__staleWhileFetching:g,b=f===void 0?"add":t!==f?"replace":"update";o&&(o.set=b,f!==void 0&&(o.oldValue=f)),this.#x&&this.onInsert?.(t,e,b)}}else d||(o&&(o.set="update"),this.#x&&this.onInsert?.(t,e,"update"))}if(n!==0&&!this.#d&&this.#k(),this.#d&&(y||this.#H(c,n,r),o&&this.#v(o,c)),!h&&this.#f&&this.#r){let g=this.#r,f;for(;f=g?.shift();)this.#w?.(...f)}return this}pop(){try{for(;this.#n;){let e=this.#t[this.#a];if(this.#G(!0),this.#e(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#f&&this.#r){let e=this.#r,t;for(;t=e?.shift();)this.#w?.(...t)}}}#G(e){let t=this.#a,i=this.#i[t],s=this.#t[t],n=this.#e(s);n&&s.__abortController.abort(new Error("evicted"));let r=n?s.__staleWhileFetching:s;return(this.#T||this.#f)&&r!==void 0&&(this.#T&&this.#S?.(r,i,"evict"),this.#f&&this.#r?.push([r,i,"evict"])),this.#R(t),this.#g?.[t]&&(clearTimeout(this.#g[t]),this.#g[t]=void 0),e&&(this.#i[t]=void 0,this.#t[t]=void 0,this.#y.push(t)),this.#n===1?(this.#a=this.#h=0,this.#y.length=0):this.#a=this.#l[t],this.#s.delete(i),this.#n--,t}has(e,t={}){let{status:i=S.hasSubscribers?{}:void 0}=t;t.status=i,i&&(i.op="has",i.key=e,i.cache=this);let s=this.#Y(e,t);return S.hasSubscribers&&S.publish(i),s}#Y(e,t={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=t,n=this.#s.get(e);if(n!==void 0){let r=this.#t[n];if(this.#e(r)&&r.__staleWhileFetching===void 0)return!1;if(this.#p(n))s&&(s.has="stale",this.#v(s,n));else return i&&this.#D(n),s&&(s.has="hit",this.#v(s,n)),!0}else s&&(s.has="miss");return!1}peek(e,t={}){let{status:i=D()?{}:void 0}=t;i&&(i.op="peek",i.key=e,i.cache=this),t.status=i;let s=this.#J(e,t);return S.hasSubscribers&&S.publish(i),s}#J(e,t){let{status:i,allowStale:s=this.allowStale}=t,n=this.#s.get(e);if(n===void 0||!s&&this.#p(n)){i&&(i.peek=n===void 0?"miss":"stale");return}let r=this.#t[n],h=this.#e(r)?r.__staleWhileFetching:r;return i&&(h!==void 0?(i.peek="hit",i.value=h):i.peek="miss"),h}#P(e,t,i,s){let n=t===void 0?void 0:this.#t[t];if(this.#e(n))return n;let r=new AbortController,{signal:h}=i;h?.addEventListener("abort",()=>r.abort(h.reason),{signal:r.signal});let a={signal:r.signal,options:i,context:s},o=(f,b=!1)=>{let{aborted:l}=r.signal,w=i.ignoreFetchAbort&&f!==void 0,F=i.ignoreFetchAbort||!!(i.allowStaleOnFetchAbort&&f!==void 0);if(i.status&&(l&&!b?(i.status.fetchAborted=!0,i.status.fetchError=r.signal.reason,w&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),l&&!w&&!b)return y(r.signal.reason,F);let m=c,p=this.#t[t];return(p===c||p===void 0&&w&&b)&&(f===void 0?m.__staleWhileFetching!==void 0?this.#t[t]=m.__staleWhileFetching:this.#E(e,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.#W(e,f,a.options,m))),f},d=f=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=f),y(f,!1)),y=(f,b)=>{let{aborted:l}=r.signal,w=l&&i.allowStaleOnFetchAbort,F=w||i.allowStaleOnFetchRejection,m=F||i.noDeleteOnFetchRejection,p=c;if(this.#t[t]===c&&(!m||!b&&p.__staleWhileFetching===void 0?this.#E(e,"fetch"):w||(this.#t[t]=p.__staleWhileFetching)),F)return i.status&&p.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),p.__staleWhileFetching;if(p.__returned===p)throw f},_=(f,b)=>{let l=this.#M?.(e,n,a);r.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(f(void 0),i.allowStaleOnFetchAbort&&(f=w=>o(w,!0)))}),l&&l instanceof Promise?l.then(w=>f(w===void 0?void 0:w),b):l!==void 0&&f(l)};i.status&&(i.status.fetchDispatched=!0);let c=new Promise(_).then(o,d),g=Object.assign(c,{__abortController:r,__staleWhileFetching:n,__returned:void 0});return t===void 0?(this.#W(e,g,{...a.options,status:void 0}),t=this.#s.get(e)):this.#t[t]=g,g}#e(e){if(!this.#U)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController}fetch(e,t={}){let i=W.hasSubscribers,{status:s=D()?{}:void 0}=t;t.status=s,s&&t.context&&(s.context=t.context);let n=this.#B(e,t);return s&&i&&(s.trace=!0,W.tracePromise(()=>n,s).catch(()=>{})),n}async#B(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:r=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:a=0,sizeCalculation:o=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:y=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:_=this.allowStaleOnFetchRejection,ignoreFetchAbort:c=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:f,forceRefresh:b=!1,status:l,signal:w}=t;if(l&&(l.op="fetch",l.key=e,b&&(l.forceRefresh=!0),l.cache=this),!this.#U)return l&&(l.fetch="get"),this.#C(e,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:l});let F={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:r,noDisposeOnSet:h,size:a,sizeCalculation:o,noUpdateTTL:d,noDeleteOnFetchRejection:y,allowStaleOnFetchRejection:_,allowStaleOnFetchAbort:g,ignoreFetchAbort:c,status:l,signal:w},m=this.#s.get(e);if(m===void 0){l&&(l.fetch="miss");let p=this.#P(e,m,F,f);return p.__returned=p}else{let p=this.#t[m];if(this.#e(p)){let v=i&&p.__staleWhileFetching!==void 0;return l&&(l.fetch="inflight",v&&(l.returnedStale=!0)),v?p.__staleWhileFetching:p.__returned=p}let A=this.#p(m);if(!b&&!A)return l&&(l.fetch="hit"),this.#L(m),s&&this.#D(m),l&&this.#v(l,m),p;let z=this.#P(e,m,F,f),E=z.__staleWhileFetching!==void 0&&i;return l&&(l.fetch=A?"stale":"refresh",E&&A&&(l.returnedStale=!0)),E?z.__staleWhileFetching:z.__returned=z}}forceFetch(e,t={}){let i=W.hasSubscribers,{status:s=D()?{}:void 0}=t;t.status=s,s&&t.context&&(s.context=t.context);let n=this.#K(e,t);return s&&i&&(s.trace=!0,W.tracePromise(()=>n,s).catch(()=>{})),n}async#K(e,t={}){let i=await this.#B(e,t);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(e,t={}){let{status:i=S.hasSubscribers?{}:void 0}=t;t.status=i,i&&(i.op="memo",i.key=e,t.context&&(i.context=t.context),i.cache=this);let s=this.#Q(e,t);return i&&(i.value=s),S.hasSubscribers&&S.publish(i),s}#Q(e,t={}){let i=this.#I;if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,status:n,forceRefresh:r,...h}=t;n&&r&&(n.forceRefresh=!0);let a=this.#C(e,h),o=r||a===void 0;if(n&&(n.memo=o?"miss":"hit",o||(n.value=a)),!o)return a;let d=i(e,a,{options:h,context:s});return n&&(n.value=d),this.#W(e,d,h),d}get(e,t={}){let{status:i=S.hasSubscribers?{}:void 0}=t;t.status=i,i&&(i.op="get",i.key=e,i.cache=this);let s=this.#C(e,t);return i&&(s!==void 0&&(i.value=s),S.hasSubscribers&&S.publish(i)),s}#C(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:r}=t,h=this.#s.get(e);if(h===void 0){r&&(r.get="miss");return}let a=this.#t[h],o=this.#e(a);return r&&this.#v(r,h),this.#p(h)?o?(r&&(r.get="stale-fetching"),i&&a.__staleWhileFetching!==void 0?(r&&(r.returnedStale=!0),a.__staleWhileFetching):void 0):(n||this.#E(e,"expire"),r&&(r.get="stale"),i?(r&&(r.returnedStale=!0),a):void 0):(r&&(r.get=o?"fetching":"hit"),this.#L(h),s&&this.#D(h),o?a.__staleWhileFetching:a)}#$(e,t){this.#u[t]=e,this.#l[e]=t}#L(e){e!==this.#h&&(e===this.#a?this.#a=this.#l[e]:this.#$(this.#u[e],this.#l[e]),this.#$(this.#h,e),this.#h=e)}delete(e){return this.#E(e,"delete")}#E(e,t){S.hasSubscribers&&S.publish({op:"delete",delete:t,key:e,cache:this});let i=!1;if(this.#n!==0){let s=this.#s.get(e);if(s!==void 0)if(this.#g?.[s]&&(clearTimeout(this.#g?.[s]),this.#g[s]=void 0),i=!0,this.#n===1)this.#q(t);else{this.#R(s);let n=this.#t[s];if(this.#e(n)?n.__abortController.abort(new Error("deleted")):(this.#T||this.#f)&&(this.#T&&this.#S?.(n,e,t),this.#f&&this.#r?.push([n,e,t])),this.#s.delete(e),this.#i[s]=void 0,this.#t[s]=void 0,s===this.#h)this.#h=this.#u[s];else if(s===this.#a)this.#a=this.#l[s];else{let r=this.#u[s];this.#l[r]=this.#l[s];let h=this.#l[s];this.#u[h]=this.#u[s]}this.#n--,this.#y.push(s)}}if(this.#f&&this.#r?.length){let s=this.#r,n;for(;n=s?.shift();)this.#w?.(...n)}return i}clear(){return this.#q("delete")}#q(e){for(let t of this.#z({allowStale:!0})){let i=this.#t[t];if(this.#e(i))i.__abortController.abort(new Error("deleted"));else{let s=this.#i[t];this.#T&&this.#S?.(i,s,e),this.#f&&this.#r?.push([i,s,e])}}if(this.#s.clear(),this.#t.fill(void 0),this.#i.fill(void 0),this.#d&&this.#F){this.#d.fill(0),this.#F.fill(0);for(let t of this.#g??[])t!==void 0&&clearTimeout(t);this.#g?.fill(void 0)}if(this.#_&&this.#_.fill(0),this.#a=0,this.#h=0,this.#y.length=0,this.#b=0,this.#n=0,this.#f&&this.#r){let t=this.#r,i;for(;i=t?.shift();)this.#w?.(...i)}}};export{I as LRUCache};
|
|
2
|
+
//# sourceMappingURL=index.min.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const defaultPerf = (typeof performance === 'object' &&
|
|
2
|
+
performance &&
|
|
3
|
+
typeof performance.now === 'function') ?
|
|
4
|
+
/* c8 ignore start - this gets covered, but c8 gets confused */
|
|
5
|
+
performance
|
|
6
|
+
: /* c8 ignore stop */ Date;
|
|
7
|
+
//# sourceMappingURL=perf.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const defaultPerf = (typeof performance === 'object' &&
|
|
2
|
+
performance &&
|
|
3
|
+
typeof performance.now === 'function') ?
|
|
4
|
+
/* c8 ignore start - this gets covered, but c8 gets confused */
|
|
5
|
+
performance
|
|
6
|
+
: /* c8 ignore stop */ Date;
|
|
7
|
+
//# sourceMappingURL=perf.js.map
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lru-cache",
|
|
3
|
+
"description": "A cache object that deletes the least-recently-used items.",
|
|
4
|
+
"version": "11.5.1",
|
|
5
|
+
"author": "Isaac Z. Schlueter <i@izs.me>",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"mru",
|
|
8
|
+
"lru",
|
|
9
|
+
"cache"
|
|
10
|
+
],
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "npm run prepare",
|
|
14
|
+
"prepare": "tshy && bash scripts/build.sh",
|
|
15
|
+
"pretest": "npm run prepare",
|
|
16
|
+
"presnap": "npm run prepare",
|
|
17
|
+
"test": "tap",
|
|
18
|
+
"snap": "tap",
|
|
19
|
+
"preversion": "npm test",
|
|
20
|
+
"postversion": "npm publish",
|
|
21
|
+
"prepublishOnly": "git push origin --follow-tags",
|
|
22
|
+
"format": "prettier --write .",
|
|
23
|
+
"typedoc": "typedoc --tsconfig ./.tshy/esm.json ./src/*.ts",
|
|
24
|
+
"benchmark-results-typedoc": "bash scripts/benchmark-results-typedoc.sh",
|
|
25
|
+
"prebenchmark": "npm run prepare",
|
|
26
|
+
"benchmark": "make -C benchmark",
|
|
27
|
+
"preprofile": "npm run prepare",
|
|
28
|
+
"profile": "make -C benchmark profile",
|
|
29
|
+
"lint": "oxlint --fix src test",
|
|
30
|
+
"postsnap": "npm run lint",
|
|
31
|
+
"postlint": "npm run format"
|
|
32
|
+
},
|
|
33
|
+
"main": "./dist/commonjs/index.min.js",
|
|
34
|
+
"types": "./dist/commonjs/index.d.ts",
|
|
35
|
+
"tshy": {
|
|
36
|
+
"esmDialects": [
|
|
37
|
+
"browser",
|
|
38
|
+
"node"
|
|
39
|
+
],
|
|
40
|
+
"commonjsDialects": [
|
|
41
|
+
"browser",
|
|
42
|
+
"node"
|
|
43
|
+
],
|
|
44
|
+
"exports": {
|
|
45
|
+
"./raw": "./src/index.ts",
|
|
46
|
+
".": {
|
|
47
|
+
"import": {
|
|
48
|
+
"browser": {
|
|
49
|
+
"types": "./dist/esm/browser/index.d.ts",
|
|
50
|
+
"default": "./dist/esm/browser/index.min.js"
|
|
51
|
+
},
|
|
52
|
+
"node": {
|
|
53
|
+
"types": "./dist/esm/node/index.d.ts",
|
|
54
|
+
"default": "./dist/esm/node/index.min.js"
|
|
55
|
+
},
|
|
56
|
+
"types": "./dist/esm/index.d.ts",
|
|
57
|
+
"default": "./dist/esm/index.min.js"
|
|
58
|
+
},
|
|
59
|
+
"require": {
|
|
60
|
+
"browser": {
|
|
61
|
+
"types": "./dist/commonjs/browser/index.d.ts",
|
|
62
|
+
"default": "./dist/commonjs/browser/index.min.js"
|
|
63
|
+
},
|
|
64
|
+
"node": {
|
|
65
|
+
"types": "./dist/commonjs/node/index.d.ts",
|
|
66
|
+
"default": "./dist/commonjs/node/index.min.js"
|
|
67
|
+
},
|
|
68
|
+
"types": "./dist/commonjs/index.d.ts",
|
|
69
|
+
"default": "./dist/commonjs/index.min.js"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"selfLink": false
|
|
74
|
+
},
|
|
75
|
+
"repository": {
|
|
76
|
+
"type": "git",
|
|
77
|
+
"url": "git+ssh://git@github.com/isaacs/node-lru-cache.git"
|
|
78
|
+
},
|
|
79
|
+
"devDependencies": {
|
|
80
|
+
"benchmark": "^2.1.4",
|
|
81
|
+
"esbuild": "^0.28.0",
|
|
82
|
+
"marked": "^4.2.12",
|
|
83
|
+
"mkdirp": "^3.0.1",
|
|
84
|
+
"oxlint": "^1.65.0",
|
|
85
|
+
"oxlint-tsgolint": "^0.22.1",
|
|
86
|
+
"prettier": "^3.8.3",
|
|
87
|
+
"tap": "^21.7.4",
|
|
88
|
+
"tshy": "^4.1.2",
|
|
89
|
+
"typedoc": "^0.28.19"
|
|
90
|
+
},
|
|
91
|
+
"license": "BlueOak-1.0.0",
|
|
92
|
+
"files": [
|
|
93
|
+
"dist"
|
|
94
|
+
],
|
|
95
|
+
"engines": {
|
|
96
|
+
"node": "20 || >=22"
|
|
97
|
+
},
|
|
98
|
+
"exports": {
|
|
99
|
+
"./raw": {
|
|
100
|
+
"import": {
|
|
101
|
+
"browser": {
|
|
102
|
+
"types": "./dist/esm/browser/index.d.ts",
|
|
103
|
+
"default": "./dist/esm/browser/index.js"
|
|
104
|
+
},
|
|
105
|
+
"node": {
|
|
106
|
+
"types": "./dist/esm/node/index.d.ts",
|
|
107
|
+
"default": "./dist/esm/node/index.js"
|
|
108
|
+
},
|
|
109
|
+
"types": "./dist/esm/index.d.ts",
|
|
110
|
+
"default": "./dist/esm/index.js"
|
|
111
|
+
},
|
|
112
|
+
"require": {
|
|
113
|
+
"browser": {
|
|
114
|
+
"types": "./dist/commonjs/browser/index.d.ts",
|
|
115
|
+
"default": "./dist/commonjs/browser/index.js"
|
|
116
|
+
},
|
|
117
|
+
"node": {
|
|
118
|
+
"types": "./dist/commonjs/node/index.d.ts",
|
|
119
|
+
"default": "./dist/commonjs/node/index.js"
|
|
120
|
+
},
|
|
121
|
+
"types": "./dist/commonjs/index.d.ts",
|
|
122
|
+
"default": "./dist/commonjs/index.js"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
".": {
|
|
126
|
+
"import": {
|
|
127
|
+
"browser": {
|
|
128
|
+
"types": "./dist/esm/browser/index.d.ts",
|
|
129
|
+
"default": "./dist/esm/browser/index.min.js"
|
|
130
|
+
},
|
|
131
|
+
"node": {
|
|
132
|
+
"types": "./dist/esm/node/index.d.ts",
|
|
133
|
+
"default": "./dist/esm/node/index.min.js"
|
|
134
|
+
},
|
|
135
|
+
"types": "./dist/esm/index.d.ts",
|
|
136
|
+
"default": "./dist/esm/index.min.js"
|
|
137
|
+
},
|
|
138
|
+
"require": {
|
|
139
|
+
"browser": {
|
|
140
|
+
"types": "./dist/commonjs/browser/index.d.ts",
|
|
141
|
+
"default": "./dist/commonjs/browser/index.min.js"
|
|
142
|
+
},
|
|
143
|
+
"node": {
|
|
144
|
+
"types": "./dist/commonjs/node/index.d.ts",
|
|
145
|
+
"default": "./dist/commonjs/node/index.min.js"
|
|
146
|
+
},
|
|
147
|
+
"types": "./dist/commonjs/index.d.ts",
|
|
148
|
+
"default": "./dist/commonjs/index.min.js"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"type": "module",
|
|
153
|
+
"module": "./dist/esm/index.min.js"
|
|
154
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "path-scurry",
|
|
3
|
+
"version": "2.0.2",
|
|
4
|
+
"description": "walk paths fast and efficiently",
|
|
5
|
+
"author": "Isaac Z. Schlueter <i@izs.me> (https://blog.izs.me)",
|
|
6
|
+
"main": "./dist/commonjs/index.js",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
"./package.json": "./package.json",
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/esm/index.d.ts",
|
|
13
|
+
"default": "./dist/esm/index.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/commonjs/index.d.ts",
|
|
17
|
+
"default": "./dist/commonjs/index.js"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"license": "BlueOak-1.0.0",
|
|
25
|
+
"scripts": {
|
|
26
|
+
"preversion": "npm test",
|
|
27
|
+
"postversion": "npm publish",
|
|
28
|
+
"prepublishOnly": "git push origin --follow-tags",
|
|
29
|
+
"prepare": "tshy",
|
|
30
|
+
"pretest": "npm run prepare",
|
|
31
|
+
"presnap": "npm run prepare",
|
|
32
|
+
"test": "tap",
|
|
33
|
+
"snap": "tap",
|
|
34
|
+
"format": "prettier --write . --log-level warn",
|
|
35
|
+
"typedoc": "typedoc --tsconfig tsconfig-esm.json ./src/*.ts",
|
|
36
|
+
"bench": "bash ./scripts/bench.sh"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@nodelib/fs.walk": "^3.0.1",
|
|
40
|
+
"@types/node": "^25.3.0",
|
|
41
|
+
"mkdirp": "^3.0.0",
|
|
42
|
+
"prettier": "^3.3.2",
|
|
43
|
+
"rimraf": "^6.1.3",
|
|
44
|
+
"tap": "^21.6.1",
|
|
45
|
+
"ts-node": "^10.9.2",
|
|
46
|
+
"tshy": "^3.3.2",
|
|
47
|
+
"typedoc": "^0.28.17"
|
|
48
|
+
},
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": "18 || 20 || >=22"
|
|
51
|
+
},
|
|
52
|
+
"funding": {
|
|
53
|
+
"url": "https://github.com/sponsors/isaacs"
|
|
54
|
+
},
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "git+https://github.com/isaacs/path-scurry"
|
|
58
|
+
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"lru-cache": "^11.0.0",
|
|
61
|
+
"minipass": "^7.1.2"
|
|
62
|
+
},
|
|
63
|
+
"tshy": {
|
|
64
|
+
"selfLink": false,
|
|
65
|
+
"exports": {
|
|
66
|
+
"./package.json": "./package.json",
|
|
67
|
+
".": "./src/index.ts"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"types": "./dist/commonjs/index.d.ts",
|
|
71
|
+
"module": "./dist/esm/index.js"
|
|
72
|
+
}
|
package/package.json
CHANGED
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
-
* or more contributor license agreements. See the NOTICE file
|
|
4
|
-
* distributed with this work for additional information
|
|
5
|
-
* regarding copyright ownership. The ASF licenses this file
|
|
6
|
-
* to you under the Apache License, Version 2.0 (the
|
|
7
|
-
* "License"); you may not use this file except in compliance
|
|
8
|
-
* with the License. You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing,
|
|
13
|
-
* software distributed under the License is distributed on an
|
|
14
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
-
* KIND, either express or implied. See the License for the
|
|
16
|
-
* specific language governing permissions and limitations
|
|
17
|
-
* under the License.
|
|
18
|
-
*/
|
|
19
|
-
import { estimateTokens, finitePositive, sha256, utf8ByteLength, } from './context-budget-helpers.js';
|
|
20
|
-
import { planActiveToolResultSupersession, } from './active-tool-result-working-set.js';
|
|
21
|
-
import { archiveToolResultAsTransition, serializedToolResultProjection, } from './tool-result-archive-transition.js';
|
|
22
|
-
import { isArchivedToolResultPlaceholder, serializeToolResultForArchive, } from './tool-result-archive.js';
|
|
23
|
-
const DEFAULT_MAX_CURRENT_RESULT_ESTIMATED_TOKENS = 2048;
|
|
24
|
-
const DEFAULT_MIN_SUPERSEDED_RESULT_ESTIMATED_TOKENS = 256;
|
|
25
|
-
const DEFAULT_CHARS_PER_TOKEN = 4;
|
|
26
|
-
function collectSupersessionDecisions(input) {
|
|
27
|
-
if (!input.completedToolCalls || input.completedToolCalls.length === 0)
|
|
28
|
-
return new Map();
|
|
29
|
-
const calls = new Map(input.completedToolCalls.map((call) => [call.toolCallId, call]));
|
|
30
|
-
const observations = [];
|
|
31
|
-
for (const message of input.messages) {
|
|
32
|
-
if (message.role !== 'tool' || !Array.isArray(message.content))
|
|
33
|
-
continue;
|
|
34
|
-
for (const part of message.content) {
|
|
35
|
-
if (!isToolResultPartish(part) || typeof part.toolCallId !== 'string')
|
|
36
|
-
continue;
|
|
37
|
-
const call = calls.get(part.toolCallId);
|
|
38
|
-
if (!call || call.toolName !== part.toolName)
|
|
39
|
-
continue;
|
|
40
|
-
const payload = extractPayload(part);
|
|
41
|
-
if (!payload || isArchivedPayload(payload.value))
|
|
42
|
-
continue;
|
|
43
|
-
observations.push({
|
|
44
|
-
toolCallId: call.toolCallId,
|
|
45
|
-
toolName: call.toolName,
|
|
46
|
-
input: call.input,
|
|
47
|
-
stepNumber: call.stepNumber,
|
|
48
|
-
bodySha256: sha256(serializeToolResultForArchive(payload.value)),
|
|
49
|
-
isError: payload.field === 'output' &&
|
|
50
|
-
(payload.outputKind === 'error-text' || payload.outputKind === 'error-json'),
|
|
51
|
-
eligible: input.eligibleToolCallIds === undefined || input.eligibleToolCallIds.has(call.toolCallId),
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return planActiveToolResultSupersession(observations);
|
|
56
|
-
}
|
|
57
|
-
export async function rewriteActiveToolResultsInMessages(input) {
|
|
58
|
-
const policy = input.policy;
|
|
59
|
-
const minStepNumber = Math.max(0, Math.floor(policy?.minStepNumber ?? 1));
|
|
60
|
-
if (policy?.enabled !== true || input.stepNumber < minStepNumber) {
|
|
61
|
-
return { messages: [...input.messages], rewritten: 0, archiveFailures: 0, diagnosticPatch: {} };
|
|
62
|
-
}
|
|
63
|
-
const maxResultEstimatedTokens = finitePositive(policy.maxCurrentResultEstimatedTokens) ??
|
|
64
|
-
DEFAULT_MAX_CURRENT_RESULT_ESTIMATED_TOKENS;
|
|
65
|
-
const minSupersededResultEstimatedTokens = finitePositive(policy.minSupersededResultEstimatedTokens) ??
|
|
66
|
-
DEFAULT_MIN_SUPERSEDED_RESULT_ESTIMATED_TOKENS;
|
|
67
|
-
const charsPerToken = input.charsPerToken ?? DEFAULT_CHARS_PER_TOKEN;
|
|
68
|
-
const supersessionDecisions = collectSupersessionDecisions(input);
|
|
69
|
-
let rewritten = 0;
|
|
70
|
-
let activeSupersededToolResults = 0;
|
|
71
|
-
let activeDuplicateToolResults = 0;
|
|
72
|
-
let archiveFailures = 0;
|
|
73
|
-
let activeEstimatedTokensSaved = 0;
|
|
74
|
-
let anyChanged = false;
|
|
75
|
-
const nextMessages = [];
|
|
76
|
-
for (const message of input.messages) {
|
|
77
|
-
if (message.role !== 'tool' || !Array.isArray(message.content)) {
|
|
78
|
-
nextMessages.push(message);
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
let nextContent;
|
|
82
|
-
const originalContent = message.content;
|
|
83
|
-
for (let index = 0; index < originalContent.length; index += 1) {
|
|
84
|
-
const part = originalContent[index];
|
|
85
|
-
if (!isToolResultPartish(part)) {
|
|
86
|
-
if (nextContent)
|
|
87
|
-
nextContent.push(part);
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
const replacement = await rewriteToolResultPart({
|
|
91
|
-
part,
|
|
92
|
-
input,
|
|
93
|
-
charsPerToken,
|
|
94
|
-
maxResultEstimatedTokens,
|
|
95
|
-
minSupersededResultEstimatedTokens,
|
|
96
|
-
supersession: supersessionDecisions.get(part.toolCallId),
|
|
97
|
-
});
|
|
98
|
-
if (replacement.changed) {
|
|
99
|
-
rewritten += 1;
|
|
100
|
-
if (replacement.supersession) {
|
|
101
|
-
activeSupersededToolResults += 1;
|
|
102
|
-
if (replacement.supersession.reason === 'exact_duplicate') {
|
|
103
|
-
activeDuplicateToolResults += 1;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
activeEstimatedTokensSaved += replacement.estimatedTokensSaved;
|
|
107
|
-
anyChanged = true;
|
|
108
|
-
if (!nextContent)
|
|
109
|
-
nextContent = originalContent.slice(0, index);
|
|
110
|
-
nextContent.push(replacement.part);
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
if (replacement.archiveFailure)
|
|
114
|
-
archiveFailures += 1;
|
|
115
|
-
if (nextContent)
|
|
116
|
-
nextContent.push(part);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
if (nextContent) {
|
|
120
|
-
nextMessages.push({ ...message, content: nextContent });
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
nextMessages.push(message);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return {
|
|
127
|
-
messages: anyChanged ? nextMessages : [...input.messages],
|
|
128
|
-
rewritten,
|
|
129
|
-
archiveFailures,
|
|
130
|
-
diagnosticPatch: {
|
|
131
|
-
...(rewritten > 0 ? { activePrunedToolResults: rewritten } : {}),
|
|
132
|
-
...(activeSupersededToolResults > 0 ? { activeSupersededToolResults } : {}),
|
|
133
|
-
...(activeDuplicateToolResults > 0 ? { activeDuplicateToolResults } : {}),
|
|
134
|
-
...(archiveFailures > 0 ? { activeArchiveFailures: archiveFailures } : {}),
|
|
135
|
-
...(activeEstimatedTokensSaved > 0 ? { activeEstimatedTokensSaved } : {}),
|
|
136
|
-
},
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
async function rewriteToolResultPart(input) {
|
|
140
|
-
const { part } = input;
|
|
141
|
-
if (typeof part.toolCallId !== 'string' || typeof part.toolName !== 'string') {
|
|
142
|
-
return { changed: false };
|
|
143
|
-
}
|
|
144
|
-
const eligible = input.input.eligibleToolCallIds;
|
|
145
|
-
if (eligible && !eligible.has(part.toolCallId))
|
|
146
|
-
return { changed: false };
|
|
147
|
-
const payload = extractPayload(part);
|
|
148
|
-
if (!payload)
|
|
149
|
-
return { changed: false };
|
|
150
|
-
if (isArchivedPayload(payload.value))
|
|
151
|
-
return { changed: false };
|
|
152
|
-
// No durable address, no rewrite: the ledger must be able to explain any
|
|
153
|
-
// content the model stops seeing.
|
|
154
|
-
const address = await Promise.resolve(input.input.resolveProjection(part.toolCallId));
|
|
155
|
-
if (!address || address.toolName !== part.toolName)
|
|
156
|
-
return { changed: false };
|
|
157
|
-
const sourceProjection = address.projection;
|
|
158
|
-
const serializedResult = serializedToolResultProjection(sourceProjection);
|
|
159
|
-
const originalEstimatedTokens = estimateTokens(serializedResult.length, input.charsPerToken);
|
|
160
|
-
if (input.supersession
|
|
161
|
-
? originalEstimatedTokens < input.minSupersededResultEstimatedTokens
|
|
162
|
-
: originalEstimatedTokens <= input.maxResultEstimatedTokens) {
|
|
163
|
-
return { changed: false };
|
|
164
|
-
}
|
|
165
|
-
const outcome = await archiveToolResultAsTransition(input.input.transitions, {
|
|
166
|
-
runtimeEventId: address.runtimeEventId,
|
|
167
|
-
turnId: address.turnId,
|
|
168
|
-
toolCallId: part.toolCallId,
|
|
169
|
-
toolName: part.toolName,
|
|
170
|
-
sourceProjection,
|
|
171
|
-
serializedResult,
|
|
172
|
-
originalBytes: utf8ByteLength(serializedResult),
|
|
173
|
-
originalEstimatedTokens,
|
|
174
|
-
reason: 'active_current_turn_tool_result_pruned_before_next_step',
|
|
175
|
-
...(address.previousTransitionId ? { previousTransitionId: address.previousTransitionId } : {}),
|
|
176
|
-
...(input.supersession ? { supersession: input.supersession } : {}),
|
|
177
|
-
result: payload.value,
|
|
178
|
-
});
|
|
179
|
-
if (!outcome)
|
|
180
|
-
return { changed: false, archiveFailure: true };
|
|
181
|
-
const placeholderText = payload.field === 'output' &&
|
|
182
|
-
(payload.outputKind === 'text' || payload.outputKind === 'error-text')
|
|
183
|
-
? JSON.stringify(outcome.placeholder)
|
|
184
|
-
: serializeToolResultForArchive(outcome.placeholder);
|
|
185
|
-
const placeholderEstimatedTokens = estimateTokens(placeholderText.length, input.charsPerToken);
|
|
186
|
-
return {
|
|
187
|
-
changed: true,
|
|
188
|
-
part: replacePayload(part, payload, outcome.placeholder),
|
|
189
|
-
estimatedTokensSaved: Math.max(0, originalEstimatedTokens - placeholderEstimatedTokens),
|
|
190
|
-
...(input.supersession ? { supersession: input.supersession } : {}),
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
function extractPayload(part) {
|
|
194
|
-
if ('output' in part) {
|
|
195
|
-
const output = part.output;
|
|
196
|
-
if (!output || typeof output !== 'object')
|
|
197
|
-
return undefined;
|
|
198
|
-
const candidate = output;
|
|
199
|
-
if ((candidate.type === 'text' ||
|
|
200
|
-
candidate.type === 'json' ||
|
|
201
|
-
candidate.type === 'error-text' ||
|
|
202
|
-
candidate.type === 'error-json') &&
|
|
203
|
-
'value' in candidate) {
|
|
204
|
-
return { field: 'output', value: candidate.value, outputKind: candidate.type };
|
|
205
|
-
}
|
|
206
|
-
return undefined;
|
|
207
|
-
}
|
|
208
|
-
if ('result' in part) {
|
|
209
|
-
return { field: 'result', value: part.result };
|
|
210
|
-
}
|
|
211
|
-
return undefined;
|
|
212
|
-
}
|
|
213
|
-
function replacePayload(part, payload, placeholder) {
|
|
214
|
-
if (payload.field === 'result') {
|
|
215
|
-
return { ...part, result: placeholder };
|
|
216
|
-
}
|
|
217
|
-
const output = part.output;
|
|
218
|
-
const nextValue = payload.outputKind === 'text' || payload.outputKind === 'error-text'
|
|
219
|
-
? JSON.stringify(placeholder)
|
|
220
|
-
: placeholder;
|
|
221
|
-
return {
|
|
222
|
-
...part,
|
|
223
|
-
output: {
|
|
224
|
-
...output,
|
|
225
|
-
value: nextValue,
|
|
226
|
-
},
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* A payload that already IS a placeholder, in either shape the provider format
|
|
231
|
-
* allows: the JSON object, or the serialized text a `text` output carries.
|
|
232
|
-
* Re-archiving one would archive a pointer, not a body.
|
|
233
|
-
*/
|
|
234
|
-
function isArchivedPayload(value) {
|
|
235
|
-
if (isArchivedToolResultPlaceholder(value))
|
|
236
|
-
return true;
|
|
237
|
-
if (typeof value !== 'string')
|
|
238
|
-
return false;
|
|
239
|
-
try {
|
|
240
|
-
return isArchivedToolResultPlaceholder(JSON.parse(value));
|
|
241
|
-
}
|
|
242
|
-
catch {
|
|
243
|
-
return false;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
function isToolResultPartish(value) {
|
|
247
|
-
return Boolean(value && typeof value === 'object' && value.type === 'tool-result');
|
|
248
|
-
}
|