@buoy-gg/agent-core 7.0.34 → 7.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -7
- package/lib/commonjs/blocks/receipts.js +83 -24
- package/lib/commonjs/blocks/receipts.js.map +1 -1
- package/lib/commonjs/blocks/runId.js +31 -0
- package/lib/commonjs/blocks/runId.js.map +1 -0
- package/lib/commonjs/blocks/types.js +23 -2
- package/lib/commonjs/blocks/types.js.map +1 -1
- package/lib/commonjs/blocks/uiTool.js +426 -12
- package/lib/commonjs/blocks/uiTool.js.map +1 -1
- package/lib/commonjs/catalog/catalog.g.js +121 -43
- package/lib/commonjs/catalog/catalog.g.js.map +1 -1
- package/lib/commonjs/catalog/catalog.source.json +121 -45
- package/lib/commonjs/catalog/catalog.types.g.js +44 -0
- package/lib/commonjs/catalog/catalog.types.g.js.map +1 -0
- package/lib/commonjs/catalog/normalizeParams.js +333 -0
- package/lib/commonjs/catalog/normalizeParams.js.map +1 -0
- package/lib/commonjs/catalog/signature.js +68 -0
- package/lib/commonjs/catalog/signature.js.map +1 -0
- package/lib/commonjs/catalog/snapshotReads.js +13 -6
- package/lib/commonjs/catalog/snapshotReads.js.map +1 -1
- package/lib/commonjs/catalog/toProviderTools.js +41 -5
- package/lib/commonjs/catalog/toProviderTools.js.map +1 -1
- package/lib/commonjs/context/buildContextPack.js +367 -19
- package/lib/commonjs/context/buildContextPack.js.map +1 -1
- package/lib/commonjs/effects/digest.js +34 -0
- package/lib/commonjs/effects/digest.js.map +1 -0
- package/lib/commonjs/effects/ledger.js +85 -1
- package/lib/commonjs/effects/ledger.js.map +1 -1
- package/lib/commonjs/engine/askGate.js +287 -0
- package/lib/commonjs/engine/askGate.js.map +1 -0
- package/lib/commonjs/engine/effectFor.js +82 -1
- package/lib/commonjs/engine/effectFor.js.map +1 -1
- package/lib/commonjs/engine/historyBudget.js +260 -0
- package/lib/commonjs/engine/historyBudget.js.map +1 -0
- package/lib/commonjs/engine/runAgentTurn.js +958 -88
- package/lib/commonjs/engine/runAgentTurn.js.map +1 -1
- package/lib/commonjs/engine/systemPrompt.js +72 -8
- package/lib/commonjs/engine/systemPrompt.js.map +1 -1
- package/lib/commonjs/engine/textToolCalls.js +276 -0
- package/lib/commonjs/engine/textToolCalls.js.map +1 -0
- package/lib/commonjs/index.js +81 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/policy/labels.js +19 -3
- package/lib/commonjs/policy/labels.js.map +1 -1
- package/lib/commonjs/policy/policy.js +6 -1
- package/lib/commonjs/policy/policy.js.map +1 -1
- package/lib/commonjs/policy/redact.js +42 -5
- package/lib/commonjs/policy/redact.js.map +1 -1
- package/lib/commonjs/providers/anthropic.js +340 -174
- package/lib/commonjs/providers/anthropic.js.map +1 -1
- package/lib/commonjs/providers/openai.js +229 -103
- package/lib/commonjs/providers/openai.js.map +1 -1
- package/lib/commonjs/providers/sse.js +164 -29
- package/lib/commonjs/providers/sse.js.map +1 -1
- package/lib/commonjs/providers/streamTimer.js +123 -0
- package/lib/commonjs/providers/streamTimer.js.map +1 -0
- package/lib/commonjs/providers/transport.js +107 -0
- package/lib/commonjs/providers/transport.js.map +1 -0
- package/lib/commonjs/providers/xhrStream.js +209 -0
- package/lib/commonjs/providers/xhrStream.js.map +1 -0
- package/lib/commonjs/session.js +245 -52
- package/lib/commonjs/session.js.map +1 -1
- package/lib/module/blocks/receipts.js +83 -24
- package/lib/module/blocks/receipts.js.map +1 -1
- package/lib/module/blocks/runId.js +26 -0
- package/lib/module/blocks/runId.js.map +1 -0
- package/lib/module/blocks/types.js +23 -2
- package/lib/module/blocks/types.js.map +1 -1
- package/lib/module/blocks/uiTool.js +424 -12
- package/lib/module/blocks/uiTool.js.map +1 -1
- package/lib/module/catalog/catalog.g.js +121 -43
- package/lib/module/catalog/catalog.g.js.map +1 -1
- package/lib/module/catalog/catalog.source.json +121 -45
- package/lib/module/catalog/catalog.types.g.js +40 -0
- package/lib/module/catalog/catalog.types.g.js.map +1 -0
- package/lib/module/catalog/normalizeParams.js +327 -0
- package/lib/module/catalog/normalizeParams.js.map +1 -0
- package/lib/module/catalog/signature.js +63 -0
- package/lib/module/catalog/signature.js.map +1 -0
- package/lib/module/catalog/snapshotReads.js +13 -6
- package/lib/module/catalog/snapshotReads.js.map +1 -1
- package/lib/module/catalog/toProviderTools.js +41 -5
- package/lib/module/catalog/toProviderTools.js.map +1 -1
- package/lib/module/context/buildContextPack.js +366 -19
- package/lib/module/context/buildContextPack.js.map +1 -1
- package/lib/module/effects/digest.js +29 -0
- package/lib/module/effects/digest.js.map +1 -0
- package/lib/module/effects/ledger.js +85 -1
- package/lib/module/effects/ledger.js.map +1 -1
- package/lib/module/engine/askGate.js +280 -0
- package/lib/module/engine/askGate.js.map +1 -0
- package/lib/module/engine/effectFor.js +83 -1
- package/lib/module/engine/effectFor.js.map +1 -1
- package/lib/module/engine/historyBudget.js +251 -0
- package/lib/module/engine/historyBudget.js.map +1 -0
- package/lib/module/engine/runAgentTurn.js +954 -88
- package/lib/module/engine/runAgentTurn.js.map +1 -1
- package/lib/module/engine/systemPrompt.js +71 -8
- package/lib/module/engine/systemPrompt.js.map +1 -1
- package/lib/module/engine/textToolCalls.js +270 -0
- package/lib/module/engine/textToolCalls.js.map +1 -0
- package/lib/module/index.js +7 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/policy/labels.js +19 -3
- package/lib/module/policy/labels.js.map +1 -1
- package/lib/module/policy/policy.js +6 -1
- package/lib/module/policy/policy.js.map +1 -1
- package/lib/module/policy/redact.js +42 -5
- package/lib/module/policy/redact.js.map +1 -1
- package/lib/module/providers/anthropic.js +341 -175
- package/lib/module/providers/anthropic.js.map +1 -1
- package/lib/module/providers/openai.js +230 -104
- package/lib/module/providers/openai.js.map +1 -1
- package/lib/module/providers/sse.js +160 -29
- package/lib/module/providers/sse.js.map +1 -1
- package/lib/module/providers/streamTimer.js +118 -0
- package/lib/module/providers/streamTimer.js.map +1 -0
- package/lib/module/providers/transport.js +103 -0
- package/lib/module/providers/transport.js.map +1 -0
- package/lib/module/providers/xhrStream.js +204 -0
- package/lib/module/providers/xhrStream.js.map +1 -0
- package/lib/module/session.js +228 -54
- package/lib/module/session.js.map +1 -1
- package/lib/typescript/blocks/receipts.d.ts +5 -10
- package/lib/typescript/blocks/receipts.d.ts.map +1 -1
- package/lib/typescript/blocks/runId.d.ts +20 -0
- package/lib/typescript/blocks/runId.d.ts.map +1 -0
- package/lib/typescript/blocks/types.d.ts +23 -2
- package/lib/typescript/blocks/types.d.ts.map +1 -1
- package/lib/typescript/blocks/uiTool.d.ts +11 -2
- package/lib/typescript/blocks/uiTool.d.ts.map +1 -1
- package/lib/typescript/catalog/catalog.g.d.ts.map +1 -1
- package/lib/typescript/catalog/catalog.types.g.d.ts +40 -0
- package/lib/typescript/catalog/catalog.types.g.d.ts.map +1 -0
- package/lib/typescript/catalog/normalizeParams.d.ts +43 -0
- package/lib/typescript/catalog/normalizeParams.d.ts.map +1 -0
- package/lib/typescript/catalog/signature.d.ts +29 -0
- package/lib/typescript/catalog/signature.d.ts.map +1 -0
- package/lib/typescript/catalog/snapshotReads.d.ts.map +1 -1
- package/lib/typescript/catalog/toProviderTools.d.ts +28 -15
- package/lib/typescript/catalog/toProviderTools.d.ts.map +1 -1
- package/lib/typescript/context/buildContextPack.d.ts +24 -2
- package/lib/typescript/context/buildContextPack.d.ts.map +1 -1
- package/lib/typescript/effects/digest.d.ts +10 -0
- package/lib/typescript/effects/digest.d.ts.map +1 -0
- package/lib/typescript/effects/ledger.d.ts +55 -0
- package/lib/typescript/effects/ledger.d.ts.map +1 -1
- package/lib/typescript/engine/askGate.d.ts +29 -0
- package/lib/typescript/engine/askGate.d.ts.map +1 -0
- package/lib/typescript/engine/effectFor.d.ts +6 -1
- package/lib/typescript/engine/effectFor.d.ts.map +1 -1
- package/lib/typescript/engine/historyBudget.d.ts +92 -0
- package/lib/typescript/engine/historyBudget.d.ts.map +1 -0
- package/lib/typescript/engine/runAgentTurn.d.ts +115 -1
- package/lib/typescript/engine/runAgentTurn.d.ts.map +1 -1
- package/lib/typescript/engine/systemPrompt.d.ts +41 -0
- package/lib/typescript/engine/systemPrompt.d.ts.map +1 -1
- package/lib/typescript/engine/textToolCalls.d.ts +58 -0
- package/lib/typescript/engine/textToolCalls.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +8 -5
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/policy/labels.d.ts.map +1 -1
- package/lib/typescript/policy/policy.d.ts.map +1 -1
- package/lib/typescript/policy/redact.d.ts.map +1 -1
- package/lib/typescript/providers/anthropic.d.ts +5 -0
- package/lib/typescript/providers/anthropic.d.ts.map +1 -1
- package/lib/typescript/providers/openai.d.ts +0 -16
- package/lib/typescript/providers/openai.d.ts.map +1 -1
- package/lib/typescript/providers/sse.d.ts +82 -1
- package/lib/typescript/providers/sse.d.ts.map +1 -1
- package/lib/typescript/providers/streamTimer.d.ts +59 -0
- package/lib/typescript/providers/streamTimer.d.ts.map +1 -0
- package/lib/typescript/providers/transport.d.ts +40 -0
- package/lib/typescript/providers/transport.d.ts.map +1 -0
- package/lib/typescript/providers/types.d.ts +116 -3
- package/lib/typescript/providers/types.d.ts.map +1 -1
- package/lib/typescript/providers/xhrStream.d.ts +43 -0
- package/lib/typescript/providers/xhrStream.d.ts.map +1 -0
- package/lib/typescript/session.d.ts +63 -2
- package/lib/typescript/session.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED by scripts/gen-agent-catalog.mjs — do not edit.
|
|
3
|
+
* Source: packages/agent-core/src/catalog/catalog.source.json
|
|
4
|
+
*
|
|
5
|
+
* The catalog's tool ids and action names as types, so a wrong name fails
|
|
6
|
+
* at compile time. `catalog.g.ts` carries the data.
|
|
7
|
+
*
|
|
8
|
+
* 24 Buoy tools, 192 actions.
|
|
9
|
+
*/
|
|
10
|
+
export type CatalogToolId = "env" | "console" | "sentry" | "jotai" | "route-events" | "debug-borders" | "zustand" | "redux" | "impersonate" | "query" | "events" | "network" | "js-top" | "app" | "time-machine" | "storage" | "highlight-updates" | "scenarios" | "perf-monitor" | "assets" | "tv-remote" | "focus-inspector" | "images" | "ask-buoy";
|
|
11
|
+
export interface CatalogActionMap {
|
|
12
|
+
"env": "getSnapshot";
|
|
13
|
+
"console": "getSnapshot" | "clearEntries";
|
|
14
|
+
"sentry": "getSnapshot" | "clearEnvelopes";
|
|
15
|
+
"jotai": "listAtoms" | "getAtomValue" | "getChangeDetail" | "setAtom" | "clearEvents";
|
|
16
|
+
"route-events": "getSnapshot" | "getCurrentRoute" | "navigate" | "stackGoBack" | "stackNavigateToIndex" | "stackPopToIndex" | "stackPopToTop" | "clearEvents";
|
|
17
|
+
"debug-borders": "cycleMode" | "setMode";
|
|
18
|
+
"zustand": "listStores" | "getStoreState" | "getChangeDetail" | "setState" | "rehydrate" | "clearEvents";
|
|
19
|
+
"redux": "getState" | "getActionDetail" | "dispatch" | "clearEvents";
|
|
20
|
+
"impersonate": "searchUsers" | "startImpersonation" | "stopImpersonation" | "pauseImpersonation" | "resumeImpersonation" | "updateSettings" | "removeFromHistory" | "clearHistory";
|
|
21
|
+
"query": "listQueries" | "getQueryData" | "refetch" | "invalidate" | "reset" | "remove" | "setQueryData" | "triggerError" | "restoreError" | "triggerLoading" | "restoreLoading" | "clearQueryCache" | "clearMutationCache" | "setOnline";
|
|
22
|
+
"events": "exportEvents" | "setEnabledSources" | "clearEvents";
|
|
23
|
+
"network": "getSnapshot" | "getCaptureStatus" | "getEventBody" | "setPinned" | "setSaved" | "removeSavedRecord" | "clearSavedRequests" | "clearPinnedRequests" | "clearEvents" | "listOverrideRules" | "getOverrideRuleBody" | "debugOverrides" | "upsertOverrideRule" | "setOverrideRuleEnabled" | "setOverridesEnabled" | "deleteOverrideRule" | "clearOverrideRules";
|
|
24
|
+
"js-top": "sample" | "getOriginDetail" | "setEnabled" | "pause" | "resume" | "clear";
|
|
25
|
+
"app": "ping" | "reloadApp";
|
|
26
|
+
"time-machine": "list" | "capture" | "captureBaseline" | "wipeAll" | "restore" | "preview" | "inspect" | "delete" | "rename" | "duplicate" | "setExclusions" | "setScope" | "setRestoreRoute";
|
|
27
|
+
"storage": "async.getAllKeys" | "async.multiGet" | "async.getItem" | "async.setItem" | "async.removeItem" | "async.multiRemove" | "async.multiSet" | "async.clear" | "clearAppStorage" | "getEventDetail" | "clearEvents" | "timeTravel.undo" | "timeTravel.jump" | "mmkv.snapshot" | "mmkv.get" | "mmkv.set" | "mmkv.remove" | "secure.keys" | "secure.snapshot" | "secure.get" | "secure.set" | "secure.delete";
|
|
28
|
+
"highlight-updates": "describeScreen" | "tapElement" | "waitFor" | "beginMeasurement" | "endMeasurement" | "locateComponent" | "getRenderDetail" | "setEnabled" | "toggle" | "setSilentTracking" | "toggleFreeze" | "setSpotlight" | "clearRenderCounts";
|
|
29
|
+
"scenarios": "listScenarios" | "getScenario" | "save" | "acceptDraft" | "discardDraft" | "preview" | "run" | "deactivate" | "delete" | "setFolder" | "listFolders" | "getActive" | "export";
|
|
30
|
+
"perf-monitor": "setEnabled" | "startRecording" | "stopRecording" | "savePending" | "discardPending" | "mark" | "startAutomation" | "cancelAutomation" | "acknowledgeAutomation" | "refreshIndex" | "getAutomationConfig" | "setAutomationConfig" | "loadReport" | "deleteReport" | "deleteBatch" | "clearAll";
|
|
31
|
+
"assets": "list" | "getDetail" | "rescan" | "measureSizes" | "saveBaseline" | "clearBaseline" | "getDiff" | "clearRecords" | "getScanStatus";
|
|
32
|
+
"tv-remote": "arm" | "getEventsSince" | "setMenuCapture" | "disarm" | "clear";
|
|
33
|
+
"focus-inspector": "rescan" | "focusElement" | "setTracking" | "clearHistory";
|
|
34
|
+
"images": "list" | "getDetail" | "getCaptureStatus" | "retry" | "flash" | "proveSavings" | "setOverride" | "clearOverride" | "setNetworkMode" | "setBlankImages" | "hardReload" | "evictDisk" | "massAction" | "clearRecords" | "clearExpoCaches";
|
|
35
|
+
"ask-buoy": "listChanges" | "undoAll";
|
|
36
|
+
}
|
|
37
|
+
export type CatalogAction<T extends CatalogToolId> = CatalogActionMap[T];
|
|
38
|
+
/** Action names per tool — the runtime mirror of {@link CatalogActionMap}. */
|
|
39
|
+
export declare const CATALOG_ACTIONS: Readonly<Record<CatalogToolId, readonly string[]>>;
|
|
40
|
+
//# sourceMappingURL=catalog.types.g.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.types.g.d.ts","sourceRoot":"","sources":["../../../src/catalog/catalog.types.g.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,aAAa,GACrB,KAAK,GACL,SAAS,GACT,QAAQ,GACR,OAAO,GACP,cAAc,GACd,eAAe,GACf,SAAS,GACT,OAAO,GACP,aAAa,GACb,OAAO,GACP,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,KAAK,GACL,cAAc,GACd,SAAS,GACT,mBAAmB,GACnB,WAAW,GACX,cAAc,GACd,QAAQ,GACR,WAAW,GACX,iBAAiB,GACjB,QAAQ,GACR,UAAU,CAAC;AAEf,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EACL,aAAa,GACb,cAAc,CAAC;IACnB,QAAQ,EACJ,aAAa,GACb,gBAAgB,CAAC;IACrB,OAAO,EACH,WAAW,GACX,cAAc,GACd,iBAAiB,GACjB,SAAS,GACT,aAAa,CAAC;IAClB,cAAc,EACV,aAAa,GACb,iBAAiB,GACjB,UAAU,GACV,aAAa,GACb,sBAAsB,GACtB,iBAAiB,GACjB,eAAe,GACf,aAAa,CAAC;IAClB,eAAe,EACX,WAAW,GACX,SAAS,CAAC;IACd,SAAS,EACL,YAAY,GACZ,eAAe,GACf,iBAAiB,GACjB,UAAU,GACV,WAAW,GACX,aAAa,CAAC;IAClB,OAAO,EACH,UAAU,GACV,iBAAiB,GACjB,UAAU,GACV,aAAa,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,MAAM,EAAE,CAAC,CAiP9E,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parameter aliases — accept what models actually send.
|
|
3
|
+
*
|
|
4
|
+
* The provider sees ONE tool per Buoy tool with `params` as an open object
|
|
5
|
+
* (see toProviderTools.ts), so the per-action parameter names live in prose
|
|
6
|
+
* and every model has to reproduce them from memory. A sweep of 18 models
|
|
7
|
+
* against the live app showed the same handful of misses over and over, on
|
|
8
|
+
* cheap models AND on gpt-5 and Gemini 2.5 Pro:
|
|
9
|
+
*
|
|
10
|
+
* queryKey: [...] where the action wants queryHash (by far the #1 miss —
|
|
11
|
+
* the RIGHT NOW block shows keys as arrays, and
|
|
12
|
+
* setQueryData takes queryKey, so the model reuses it)
|
|
13
|
+
* requestId where network.getEventBody wants id
|
|
14
|
+
* newState/patch where zustand.setState wants state
|
|
15
|
+
* name where zustand wants storeName
|
|
16
|
+
* bodyPatch/body/… at the top level of upsertOverrideRule instead of inside `rule`
|
|
17
|
+
*
|
|
18
|
+
* A validation error names the right field, but a cheap model repeats the same
|
|
19
|
+
* wrong call or gives up, and the user sees "nothing happened". Every one of
|
|
20
|
+
* these is mechanically unambiguous, so it is fixed HERE, before validation,
|
|
21
|
+
* and the result carries a one-line note so the model learns the real name
|
|
22
|
+
* without failing the call. Nothing here guesses: an alias only fires when the
|
|
23
|
+
* canonical field is absent and the alias is present.
|
|
24
|
+
*/
|
|
25
|
+
export interface NormalizedParams {
|
|
26
|
+
params: Record<string, unknown>;
|
|
27
|
+
/** Human-readable notes about what was accepted, for the tool result. */
|
|
28
|
+
notes: string[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* TanStack's default `hashKey`: JSON.stringify with plain-object keys sorted,
|
|
32
|
+
* so `["todos", {page:1, sort:"a"}]` hashes the same whatever order the model
|
|
33
|
+
* wrote the object in.
|
|
34
|
+
*/
|
|
35
|
+
export declare function hashQueryKey(key: unknown[]): string;
|
|
36
|
+
/**
|
|
37
|
+
* Fix the unambiguous parameter-name misses before validation. Returns the
|
|
38
|
+
* same object shape validation expects plus the notes to append to the result.
|
|
39
|
+
*/
|
|
40
|
+
export declare function normalizeParams(toolId: string, action: string, raw: Record<string, unknown>): NormalizedParams;
|
|
41
|
+
/** The one-line trailer appended to a tool result when aliases fired. */
|
|
42
|
+
export declare function aliasNote(notes: string[]): string;
|
|
43
|
+
//# sourceMappingURL=normalizeParams.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeParams.d.ts","sourceRoot":"","sources":["../../../src/catalog/normalizeParams.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,yEAAyE;IACzE,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAKD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,MAAM,CAWnD;AA4TD;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC3B,gBAAgB,CAoBlB;AAED,yEAAyE;AACzE,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAEjD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rendering a JSON Schema as the one-line signature a model reads.
|
|
3
|
+
*
|
|
4
|
+
* Lifted out of `blocks/uiTool.ts`, where it was written for `buoy_ui` and
|
|
5
|
+
* where its own comment records the result that justifies using it everywhere:
|
|
6
|
+
*
|
|
7
|
+
* > `uiProviderTool` used to send `params: { type: "object" }` and 26 lines
|
|
8
|
+
* > of prose about what each kind is FOR — and not one field name. The model
|
|
9
|
+
* > was being asked to guess `images` vs `items` and `chips` vs `options`,
|
|
10
|
+
* > and it guessed wrong three rounds running.
|
|
11
|
+
*
|
|
12
|
+
* The other 24 tools still send exactly that: an open `params` object and a
|
|
13
|
+
* sentence promising the error will explain the shape. `normalizeParams.ts`
|
|
14
|
+
* exists to catch the five misses that produced most often. This renders the
|
|
15
|
+
* field names instead, from the SAME schema `validateParams` enforces, so what
|
|
16
|
+
* the model reads can never drift from what the validator accepts.
|
|
17
|
+
*/
|
|
18
|
+
import type { JsonSchema } from "../types";
|
|
19
|
+
/** `{ url*, alt?, caption? }` — `*` marks required. */
|
|
20
|
+
export declare function signature(schema: JsonSchema | undefined, depth?: number): string;
|
|
21
|
+
/**
|
|
22
|
+
* The `params:` line under an action, or "" when the action takes none.
|
|
23
|
+
*
|
|
24
|
+
* Actions with no declared properties (71 of 192) get nothing rather than an
|
|
25
|
+
* empty `{}` — a line that says the action takes no arguments is already said
|
|
26
|
+
* by its absence, and 71 of them would be pure noise.
|
|
27
|
+
*/
|
|
28
|
+
export declare function paramsLine(schema: JsonSchema | undefined): string;
|
|
29
|
+
//# sourceMappingURL=signature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../../src/catalog/signature.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,uDAAuD;AACvD,wBAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,EAAE,KAAK,SAAI,GAAG,MAAM,CA+B3E;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,MAAM,CAIjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshotReads.d.ts","sourceRoot":"","sources":["../../../src/catalog/snapshotReads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,gEAAgE;AAChE,eAAO,MAAM,eAAe,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"snapshotReads.d.ts","sourceRoot":"","sources":["../../../src/catalog/snapshotReads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,gEAAgE;AAChE,eAAO,MAAM,eAAe,gBAAgB,CAAC;AAgN7C;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACnC,OAAO,CAeT"}
|
|
@@ -1,24 +1,37 @@
|
|
|
1
|
+
import type { ToolDescriptor } from "../types";
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* WHY ONE TOOL PER BUOY TOOL, NOT ONE PER ACTION: tool-selection accuracy
|
|
5
|
-
* degrades past roughly 30-50 tools. Buoy has ~179 actions across 22 tools, so
|
|
6
|
-
* a 1:1 mapping is far past the point where the model starts picking wrong.
|
|
7
|
-
* Each Buoy tool therefore becomes ONE provider tool whose `action` property is
|
|
8
|
-
* an enum, with the per-action summaries folded into that enum's description.
|
|
3
|
+
* Provider-agnostic tool definition; the adapters reshape it per protocol.
|
|
9
4
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
5
|
+
* The description comes in three forms because the two protocols cap it
|
|
6
|
+
* differently. Anthropic takes `description` whole. OpenAI (and Azure, and
|
|
7
|
+
* every OpenAI-compatible gateway) caps a function description at 1024
|
|
8
|
+
* chars, and the catalog renders the summary first and the `Actions:` list
|
|
9
|
+
* LAST — so trimming `description` to fit dropped every action line for 23
|
|
10
|
+
* of 24 tools (the 24th kept one line of sixteen), and a model on that
|
|
11
|
+
* protocol saw a summary cut mid-sentence plus a bare `action` enum. Hence
|
|
12
|
+
* the split: `summaryDescription` is the part that fits the cap,
|
|
13
|
+
* `actionsBlock` goes into the `action` property's description, which
|
|
14
|
+
* nothing caps. `description` stays their concatenation
|
|
15
|
+
* so the Anthropic request is byte-identical to what it was.
|
|
16
16
|
*/
|
|
17
|
-
import type { ToolDescriptor } from "../types";
|
|
18
|
-
/** Provider-agnostic tool definition; the adapters reshape it per protocol. */
|
|
19
17
|
export interface ProviderTool {
|
|
20
18
|
name: string;
|
|
19
|
+
/** `summaryDescription` + `actionsBlock` — the whole thing. */
|
|
21
20
|
description: string;
|
|
21
|
+
/** The tool's summary alone — the part that fits OpenAI's 1024-char cap. */
|
|
22
|
+
summaryDescription: string;
|
|
23
|
+
/** `Unavailable when: …` (if any) then `Actions:` and one `- <action> — <summary> [tags]` line each. */
|
|
24
|
+
actionsBlock: string;
|
|
25
|
+
/**
|
|
26
|
+
* Worked example inputs, sent as Anthropic's `input_examples`.
|
|
27
|
+
*
|
|
28
|
+
* Anthropic report 72% -> 90% on complex parameter handling. Their own
|
|
29
|
+
* framing is that JSON Schema "can't express usage patterns: when to include
|
|
30
|
+
* optional parameters, which combinations make sense, or what conventions
|
|
31
|
+
* your API expects" — which is the gap between knowing a field's NAME and
|
|
32
|
+
* knowing its SHAPE, and the gap the params signatures did not close.
|
|
33
|
+
*/
|
|
34
|
+
inputExamples?: Record<string, unknown>[];
|
|
22
35
|
inputSchema: {
|
|
23
36
|
type: "object";
|
|
24
37
|
properties: Record<string, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toProviderTools.d.ts","sourceRoot":"","sources":["../../../src/catalog/toProviderTools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"toProviderTools.d.ts","sourceRoot":"","sources":["../../../src/catalog/toProviderTools.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAoB,cAAc,EAAE,MAAM,UAAU,CAAC;AAEjE;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,WAAW,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,kBAAkB,EAAE,MAAM,CAAC;IAC3B,wGAAwG;IACxG,YAAY,EAAE,MAAM,CAAC;IACrB;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAC1C,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACpC,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,oBAAoB,EAAE,OAAO,CAAC;KAC/B,CAAC;CACH;AASD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,gFAAgF;AAChF,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,cAAc,EAAE,GACxB,MAAM,GAAG,SAAS,CAEpB;AA0BD,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,sEAAsE;IACtE,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC5C,yEAAyE;IACzE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,cAAc,EAAE,EACzB,IAAI,GAAE,sBAA2B,GAChC,YAAY,EAAE,CA4EhB"}
|
|
@@ -8,6 +8,21 @@
|
|
|
8
8
|
* ~5.7KB (~1.5K tokens) covering routes, env, query keys, redux slices,
|
|
9
9
|
* zustand stores, jotai atoms, storage keys and API hosts.
|
|
10
10
|
*
|
|
11
|
+
* TWO HALVES, READ ON TWO SCHEDULES.
|
|
12
|
+
*
|
|
13
|
+
* The STABLE half (routes, slices, stores, atoms, storage keys, env names) is
|
|
14
|
+
* read once when the chat opens and rendered inside the cached system block.
|
|
15
|
+
* It changes rarely, and when it does the cache re-warms once.
|
|
16
|
+
*
|
|
17
|
+
* The LIVE half — the current route, which queries are MOUNTED right now, the
|
|
18
|
+
* last few requests — is read again before EVERY turn and rendered as a
|
|
19
|
+
* separate, uncached block. This exists because of one failure: asked to
|
|
20
|
+
* "rename the Pokémon I'm looking at", the model went to an empty zustand cart
|
|
21
|
+
* because the once-at-open digest had been built before any query was cached,
|
|
22
|
+
* so React Query never appeared in its prompt at all. A query with
|
|
23
|
+
* `observers > 0` IS what the screen is rendering; that fact has to be in
|
|
24
|
+
* front of the model at the moment it decides which tool to reach for.
|
|
25
|
+
*
|
|
11
26
|
* What this does NOT do, and why:
|
|
12
27
|
* - No `getSnapshot('query')`. It returns the full dehydrated cache — 8.3KB for
|
|
13
28
|
* ten queries in that same measurement, growing with every cached payload.
|
|
@@ -22,11 +37,18 @@
|
|
|
22
37
|
import type { DispatchFn, SnapshotFn } from "../types";
|
|
23
38
|
export interface BuildContextInput {
|
|
24
39
|
dispatch: DispatchFn;
|
|
25
|
-
/** Needed by the snapshot-only probes (routes, env). */
|
|
40
|
+
/** Needed by the snapshot-only probes (routes, env, network). */
|
|
26
41
|
readSnapshot?: SnapshotFn;
|
|
27
42
|
/** Tool ids actually present, so we do not probe what cannot answer. */
|
|
28
43
|
availableToolIds: string[];
|
|
29
44
|
availableActions?: Record<string, string[]>;
|
|
30
45
|
}
|
|
31
|
-
|
|
46
|
+
/** The stable half: read once at open, rendered inside the cached prompt. */
|
|
47
|
+
export declare function buildContextDigest(input: BuildContextInput): Promise<Record<string, unknown>>;
|
|
48
|
+
/**
|
|
49
|
+
* The live half: read before every turn. Current route, mounted queries,
|
|
50
|
+
* recent requests, armed overrides. Rendered as the uncached "RIGHT NOW"
|
|
51
|
+
* block — see `buildLiveBlock` in systemPrompt.ts.
|
|
52
|
+
*/
|
|
53
|
+
export declare function buildLiveContext(input: BuildContextInput): Promise<Record<string, unknown>>;
|
|
32
54
|
//# sourceMappingURL=buildContextPack.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildContextPack.d.ts","sourceRoot":"","sources":["../../../src/context/buildContextPack.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"buildContextPack.d.ts","sourceRoot":"","sources":["../../../src/context/buildContextPack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAsVvD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,UAAU,CAAC;IACrB,iEAAiE;IACjE,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,wEAAwE;IACxE,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAC7C;AA6CD,6EAA6E;AAC7E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAE7F;AAsFD;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAIjG"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A short, stable fingerprint of any JSON-able value. Not cryptographic —
|
|
3
|
+
* it only has to answer "is this the same as what I saw?" — and deliberately
|
|
4
|
+
* lossy so the thing persisted beside an unanswered approval or a ledger
|
|
5
|
+
* entry is a hash of a store's state, never the state itself.
|
|
6
|
+
*/
|
|
7
|
+
export declare function digestOf(value: unknown): string | undefined;
|
|
8
|
+
/** Byte-ish size of a value once serialised; Infinity when it cannot be. */
|
|
9
|
+
export declare function jsonLength(value: unknown): number;
|
|
10
|
+
//# sourceMappingURL=digest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digest.d.ts","sourceRoot":"","sources":["../../../src/effects/digest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAU3D;AAED,4EAA4E;AAC5E,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAMjD"}
|
|
@@ -49,6 +49,26 @@ export type AppliedEffect = {
|
|
|
49
49
|
/** The action that removes the key, for the did-not-exist case. */
|
|
50
50
|
removeAction?: string;
|
|
51
51
|
label: string;
|
|
52
|
+
} | {
|
|
53
|
+
/**
|
|
54
|
+
* A React Query cache edit, reversible because the engine reads the
|
|
55
|
+
* query's data before `setQueryData` runs (see captureStoreState). This
|
|
56
|
+
* was the most common write in a real QA session — nine of eleven —
|
|
57
|
+
* and it was filed as a permanent `state-write`, so the changes bar
|
|
58
|
+
* promised undo and then said "can't be undone automatically" for the
|
|
59
|
+
* one thing the tester had actually changed.
|
|
60
|
+
*/
|
|
61
|
+
kind: "query-write";
|
|
62
|
+
queryHash: string;
|
|
63
|
+
/** The cached data before this write; undefined when the query held none. */
|
|
64
|
+
before?: unknown;
|
|
65
|
+
/**
|
|
66
|
+
* Fingerprint of the data as this write left it. A refetch replaces the
|
|
67
|
+
* cache underneath us; restoring `before` over fresh server data would
|
|
68
|
+
* be a second unwanted edit, so undo compares first.
|
|
69
|
+
*/
|
|
70
|
+
wroteDigest?: string;
|
|
71
|
+
label: string;
|
|
52
72
|
} | {
|
|
53
73
|
kind: "state-write";
|
|
54
74
|
toolId: string;
|
|
@@ -89,8 +109,43 @@ export interface RevertOutcome {
|
|
|
89
109
|
export declare class EffectLedger {
|
|
90
110
|
private entries;
|
|
91
111
|
private listeners;
|
|
112
|
+
private gen;
|
|
113
|
+
/**
|
|
114
|
+
* Which conversation this ledger is holding, bumped by `clear`.
|
|
115
|
+
*
|
|
116
|
+
* A turn captures it when it starts and hands it back on every `record`.
|
|
117
|
+
* Nothing about a dispatch can be pulled back once it is in flight, so a
|
|
118
|
+
* write that settles after the user has already tapped "New conversation"
|
|
119
|
+
* still lands in the app — but it must not land in the NEW conversation's
|
|
120
|
+
* undo bar, which is what happened: reset cleared the ledger, the old
|
|
121
|
+
* write finished a moment later, and an empty chat came up owning a change
|
|
122
|
+
* nobody in it had made. Recording it here would be worse than dropping it,
|
|
123
|
+
* because Undo would then offer to reverse something the user cannot see.
|
|
124
|
+
*/
|
|
125
|
+
get generation(): number;
|
|
126
|
+
/**
|
|
127
|
+
* @param generation The value of `generation` when the turn began. Omit for
|
|
128
|
+
* a human-initiated action, which is by definition happening now — and which
|
|
129
|
+
* therefore always returns an entry.
|
|
130
|
+
*/
|
|
92
131
|
record(toolId: string, action: string, effect: AppliedEffect): LedgerEntry;
|
|
132
|
+
record(toolId: string, action: string, effect: AppliedEffect, generation: number): LedgerEntry | undefined;
|
|
93
133
|
list(): LedgerEntry[];
|
|
134
|
+
/**
|
|
135
|
+
* Put back the entries of a conversation that outlived the app.
|
|
136
|
+
*
|
|
137
|
+
* The ledger is the ONLY undo surface, and it used to die with the JS
|
|
138
|
+
* context: after a reload the transcript came back — receipt cards, "saved"
|
|
139
|
+
* lines and all — while the changes bar quietly vanished and the changes
|
|
140
|
+
* themselves stayed applied. "New conversation" warns before losing that
|
|
141
|
+
* ("Clearing the conversation loses the only automatic undo for it"); a
|
|
142
|
+
* reload took the same thing without asking.
|
|
143
|
+
*
|
|
144
|
+
* Refuses once anything has been recorded, for the same reason `hydrate`
|
|
145
|
+
* refuses a live transcript: a late disk read must not shuffle old entries
|
|
146
|
+
* in among changes made since.
|
|
147
|
+
*/
|
|
148
|
+
restore(entries: LedgerEntry[]): boolean;
|
|
94
149
|
/** New array identity for the snapshot after entries were mutated in place. */
|
|
95
150
|
private touch;
|
|
96
151
|
/** Not-yet-undone entries that Undo can actually deliver on. Agrees with
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ledger.d.ts","sourceRoot":"","sources":["../../../src/effects/ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"ledger.d.ts","sourceRoot":"","sources":["../../../src/effects/ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG3C,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC3D;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACxC;IACE,IAAI,EAAE,eAAe,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;CACf,GACD;IACE;;;;;;;OAOG;IACH,IAAI,EAAE,aAAa,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf,GACD;IAAE,IAAI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,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,OAAO;IAOxC,+EAA+E;IAC/E,OAAO,CAAC,KAAK;IAKb;;4EAEwE;IACxE,UAAU,IAAI,WAAW,EAAE;IAI3B,4EAA4E;IAC5E,UAAU,IAAI,WAAW,EAAE;IAI3B,OAAO,IAAI,OAAO;IAIlB,SAAS,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAKrC,KAAK,IAAI,IAAI;IAQb;;;;;;OAMG;IACH,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAyBzF,OAAO,CAAC,IAAI;IAUZ,wEAAwE;IAClE,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAsGtF,uDAAuD;IACjD,SAAS,CAAC,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC;CAgB9D"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ActionsBlock, ChoiceBlock } from "../blocks/types";
|
|
2
|
+
/**
|
|
3
|
+
* The block a turn should have ended with, or null to leave the prose alone.
|
|
4
|
+
*
|
|
5
|
+
* `text` is everything the model said this turn, rounds joined in order.
|
|
6
|
+
*/
|
|
7
|
+
export declare function synthesizeAskBlock(text: string): ChoiceBlock | null;
|
|
8
|
+
/**
|
|
9
|
+
* `attempted` — did this turn call anything that GOES AND GETS data?
|
|
10
|
+
* Keyed on the actions the prompt's ladder names, so the two move together.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ACQUISITION_CALLS: Set<string>;
|
|
13
|
+
export interface ShortfallInput {
|
|
14
|
+
/** Everything the model said this turn, rounds joined in order. */
|
|
15
|
+
text: string;
|
|
16
|
+
/** Whether any ACQUISITION_CALLS ran this turn. */
|
|
17
|
+
attempted: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The block a turn should have ended with when it conceded a gap and never
|
|
21
|
+
* tried to close it, or null to leave the prose alone.
|
|
22
|
+
*
|
|
23
|
+
* An `actions` block, not a `choice`: nothing is being ASKED here. The turn is
|
|
24
|
+
* over and the answer stands; this is one button that says the gap is closable
|
|
25
|
+
* and closes it. So it must not end the turn or set `awaiting-user` — a
|
|
26
|
+
* synthesized card must never look like it is blocking on a reply.
|
|
27
|
+
*/
|
|
28
|
+
export declare function synthesizeShortfallBlock({ text, attempted }: ShortfallInput): ActionsBlock | null;
|
|
29
|
+
//# sourceMappingURL=askGate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"askGate.d.ts","sourceRoot":"","sources":["../../../src/engine/askGate.ts"],"names":[],"mappings":"AAkDA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAgB,MAAM,iBAAiB,CAAC;AAuD/E;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAwBnE;AA0FD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,aAS5B,CAAC;AAEH,MAAM,WAAW,cAAc;IAC7B,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,cAAc,GAAG,YAAY,GAAG,IAAI,CAuBjG"}
|
|
@@ -17,5 +17,10 @@ import type { AppliedEffect } from "../effects/ledger";
|
|
|
17
17
|
export declare function effectFor(toolId: string, descriptor: ActionDescriptor, params: Record<string, unknown>, result: unknown, before: {
|
|
18
18
|
had: boolean;
|
|
19
19
|
value?: string;
|
|
20
|
-
} | undefined
|
|
20
|
+
} | undefined,
|
|
21
|
+
/** The query cache read before and after a `setQueryData` — see runAgentTurn. */
|
|
22
|
+
cache?: {
|
|
23
|
+
before?: unknown;
|
|
24
|
+
after?: unknown;
|
|
25
|
+
}): AppliedEffect | undefined;
|
|
21
26
|
//# sourceMappingURL=effectFor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effectFor.d.ts","sourceRoot":"","sources":["../../../src/engine/effectFor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"effectFor.d.ts","sourceRoot":"","sources":["../../../src/engine/effectFor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAmCvD,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,gBAAgB,EAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,MAAM,EAAE,OAAO,EACf,MAAM,EAAE;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS;AACpD,iFAAiF;AACjF,KAAK,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAC5C,aAAa,GAAG,SAAS,CA6G3B"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How much conversation the model is allowed to be sent, and what gets cut.
|
|
3
|
+
*
|
|
4
|
+
* Lives here, not in `session.ts`, because it is needed in TWO places and used
|
|
5
|
+
* to run in only one. The session trims once per turn, before the loop starts
|
|
6
|
+
* — and a turn is not one request. A twelve-step investigation appends an
|
|
7
|
+
* assistant message and a tool-results message per step, each result capped at
|
|
8
|
+
* 24,000 characters, so a long read chain could add well over a hundred
|
|
9
|
+
* thousand characters AFTER the only check had already happened and walk
|
|
10
|
+
* straight into the provider's context limit. The engine now applies the same
|
|
11
|
+
* budget before every request; the session still applies it when a turn opens.
|
|
12
|
+
*/
|
|
13
|
+
import type { AgentMessage } from "../providers/types";
|
|
14
|
+
/**
|
|
15
|
+
* A long QA session must not die on the provider's context limit with an
|
|
16
|
+
* opaque error, so the history is kept under a budget.
|
|
17
|
+
*
|
|
18
|
+
* TWO STAGES, AND THE ORDER IS THE POINT. Dropping the oldest rounds was the
|
|
19
|
+
* only stage, and in a QA session the oldest round is usually the SETUP — the
|
|
20
|
+
* override that was armed, the store that was written, the user someone is
|
|
21
|
+
* impersonating. Drop it and the model can no longer explain the screen it is
|
|
22
|
+
* looking at, or that a "wrong" response is its own mock. The reply gets worse
|
|
23
|
+
* in exactly the sessions long enough to need trimming.
|
|
24
|
+
*
|
|
25
|
+
* So: COMPRESS first, DROP only if that was not enough.
|
|
26
|
+
*
|
|
27
|
+
* A tool result is "consumed" once the model has produced an assistant message
|
|
28
|
+
* after seeing it — it has already been reasoned over, and what remains is
|
|
29
|
+
* bulk. Replacing it with a marker keeps the round, its decision and its
|
|
30
|
+
* ordering while giving back nearly all the bytes. Three exemptions carry
|
|
31
|
+
* their weight:
|
|
32
|
+
*
|
|
33
|
+
* - Errors are never compressed. A failure is the diagnostic value.
|
|
34
|
+
* - The newest tool-results message is never compressed. The model is about
|
|
35
|
+
* to answer from it.
|
|
36
|
+
* - The last read before a WRITE is never compressed: that is the shape the
|
|
37
|
+
* model matched its edit to, and it is the thing it re-reads when the write
|
|
38
|
+
* is refused and it has to correct itself.
|
|
39
|
+
*
|
|
40
|
+
* Only if the history is still over budget do whole rounds get dropped, as
|
|
41
|
+
* before — a round starts at a user message, so the assistant/tool-result
|
|
42
|
+
* pairing every provider requires stays intact.
|
|
43
|
+
*/
|
|
44
|
+
export declare const MAX_HISTORY_CHARS = 150000;
|
|
45
|
+
/**
|
|
46
|
+
* The ceiling on a WHOLE request: tools, system prompt, messages and the room
|
|
47
|
+
* reserved for the reply. ~100k tokens, which fits the smallest context Ask
|
|
48
|
+
* Buoy is pointed at in practice (a 128k-token gateway) with headroom, and
|
|
49
|
+
* leaves Anthropic's 200k far from the limit.
|
|
50
|
+
*/
|
|
51
|
+
export declare const MAX_REQUEST_CHARS = 400000;
|
|
52
|
+
export declare function messageSize(m: AgentMessage): number;
|
|
53
|
+
/**
|
|
54
|
+
* Replace consumed tool results with a marker. See the note above
|
|
55
|
+
* MAX_HISTORY_CHARS for what "consumed" means and why the exemptions exist.
|
|
56
|
+
*/
|
|
57
|
+
export declare function compressConsumed(messages: AgentMessage[]): AgentMessage[];
|
|
58
|
+
/**
|
|
59
|
+
* Trim, and say how many whole rounds were dropped — the number the UI turns
|
|
60
|
+
* into "older messages were trimmed from the agent's memory".
|
|
61
|
+
*
|
|
62
|
+
* A round is a user message and everything up to the next one. Once a drop
|
|
63
|
+
* starts it ALWAYS runs to the next user boundary: the inner loop used to stop
|
|
64
|
+
* at `MIN_KEEP_MESSAGES` as well, so a history could come out starting with an
|
|
65
|
+
* assistant or tool-results message — which every provider rejects. The
|
|
66
|
+
* minimum-keep guard belongs on STARTING a drop, not on finishing one.
|
|
67
|
+
*/
|
|
68
|
+
export declare function trimHistoryReport(messages: AgentMessage[]): {
|
|
69
|
+
messages: AgentMessage[];
|
|
70
|
+
droppedRounds: number;
|
|
71
|
+
};
|
|
72
|
+
/** Exported for the history tests; not part of the package surface. */
|
|
73
|
+
export declare function trimHistory(messages: AgentMessage[]): AgentMessage[];
|
|
74
|
+
/**
|
|
75
|
+
* Trim the working history of a turn that is still running.
|
|
76
|
+
*
|
|
77
|
+
* Differs from `trimHistoryReport` in one way that matters: the CURRENT round
|
|
78
|
+
* is never touched. A turn's own user message and the reads it has taken since
|
|
79
|
+
* are the thing being answered, so compressing or dropping them would make the
|
|
80
|
+
* request cheaper and the answer wrong. Everything before the last user
|
|
81
|
+
* message is fair game, in the same order as always — compress, then drop.
|
|
82
|
+
*
|
|
83
|
+
* `reserve` is what the request costs BEFORE any messages: the tool
|
|
84
|
+
* definitions (~8k tokens for a typical install, ~23k with everything
|
|
85
|
+
* installed), the system prompt, and the reply the model is allowed to write.
|
|
86
|
+
* Budgeting messages alone would leave the biggest fixed cost out of the sum.
|
|
87
|
+
*/
|
|
88
|
+
export declare function budgetForRequest(messages: AgentMessage[], reserve: number): {
|
|
89
|
+
messages: AgentMessage[];
|
|
90
|
+
droppedRounds: number;
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=historyBudget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"historyBudget.d.ts","sourceRoot":"","sources":["../../../src/engine/historyBudget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,iBAAiB,SAAU,CAAC;AACzC;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,SAAU,CAAC;AAKzC,wBAAgB,WAAW,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM,CAMnD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CA6CzE;AASD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG;IAC3D,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;CACvB,CAwBA;AAED,uEAAuE;AACvE,wBAAgB,WAAW,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CAEpE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,YAAY,EAAE,EACxB,OAAO,EAAE,MAAM,GACd;IAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAqDrD"}
|