@theokit/sdk 5.13.0 → 5.15.0
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/CHANGELOG.md +57 -0
- package/dist/{agent-DSMuwADp.d.ts → agent-B6C9i_qu.d.ts} +31 -213
- package/dist/{agent-iW5kPpfT.d.cts → agent-B6FQad6P.d.cts} +31 -213
- package/dist/{agent-5DSDDH7K.js → agent-DRDGUU6T.js} +21 -20
- package/dist/{agent-5DSDDH7K.js.map → agent-DRDGUU6T.js.map} +1 -1
- package/dist/{agent-WOMRT3KX.cjs → agent-VI2HITPT.cjs} +22 -21
- package/dist/{agent-WOMRT3KX.cjs.map → agent-VI2HITPT.cjs.map} +1 -1
- package/dist/agent.d.ts +2 -3
- package/dist/auth/index.cjs +17 -16
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.js +5 -4
- package/dist/auth/index.js.map +1 -1
- package/dist/{batch-EP3FCL6D.js → batch-N2XDYZED.js} +4 -4
- package/dist/{batch-EP3FCL6D.js.map → batch-N2XDYZED.js.map} +1 -1
- package/dist/{batch-IZ5EDKJ5.cjs → batch-VFR2MAUE.cjs} +7 -7
- package/dist/{batch-IZ5EDKJ5.cjs.map → batch-VFR2MAUE.cjs.map} +1 -1
- package/dist/{chunk-XOYNB3YN.js → chunk-23SS4ID4.js} +3 -3
- package/dist/{chunk-XOYNB3YN.js.map → chunk-23SS4ID4.js.map} +1 -1
- package/dist/{chunk-NHOEXFZT.js → chunk-2HXTNVLM.js} +5 -2
- package/dist/chunk-2HXTNVLM.js.map +1 -0
- package/dist/{chunk-2C24NSNV.js → chunk-3BBTHFGJ.js} +3 -3
- package/dist/{chunk-2C24NSNV.js.map → chunk-3BBTHFGJ.js.map} +1 -1
- package/dist/{chunk-NP362THY.cjs → chunk-3F53FLQ7.cjs} +5 -7
- package/dist/chunk-3F53FLQ7.cjs.map +1 -0
- package/dist/{chunk-3FSBE4PS.js → chunk-3GTN4HOO.js} +10 -6
- package/dist/chunk-3GTN4HOO.js.map +1 -0
- package/dist/{chunk-7WARNHWW.cjs → chunk-3UMPP553.cjs} +5 -2
- package/dist/chunk-3UMPP553.cjs.map +1 -0
- package/dist/{chunk-SXH37C7X.cjs → chunk-55LLQFHW.cjs} +6 -6
- package/dist/{chunk-SXH37C7X.cjs.map → chunk-55LLQFHW.cjs.map} +1 -1
- package/dist/{chunk-QISSETTG.cjs → chunk-5645PMVU.cjs} +6 -4
- package/dist/chunk-5645PMVU.cjs.map +1 -0
- package/dist/{chunk-JX4LB6XO.js → chunk-5M5GQYBM.js} +617 -250
- package/dist/chunk-5M5GQYBM.js.map +1 -0
- package/dist/{chunk-KL7ZUMK3.cjs → chunk-64ECM3XM.cjs} +704 -337
- package/dist/chunk-64ECM3XM.cjs.map +1 -0
- package/dist/{chunk-ZJAYFSVI.js → chunk-7ACS6P5Z.js} +5 -7
- package/dist/chunk-7ACS6P5Z.js.map +1 -0
- package/dist/{chunk-5A4UFBHW.cjs → chunk-A77UMVMD.cjs} +15 -11
- package/dist/chunk-A77UMVMD.cjs.map +1 -0
- package/dist/{chunk-ZTP6ZACR.js → chunk-ARC2V7NY.js} +3 -3
- package/dist/{chunk-ZTP6ZACR.js.map → chunk-ARC2V7NY.js.map} +1 -1
- package/dist/{chunk-WDVG5R2Q.cjs → chunk-AUH2EVWY.cjs} +4 -3
- package/dist/chunk-AUH2EVWY.cjs.map +1 -0
- package/dist/chunk-BNEUB52I.cjs +55 -0
- package/dist/chunk-BNEUB52I.cjs.map +1 -0
- package/dist/chunk-BPL5CVZ5.js +53 -0
- package/dist/chunk-BPL5CVZ5.js.map +1 -0
- package/dist/{chunk-2SFLLOMN.js → chunk-CBBT42VX.js} +3 -3
- package/dist/{chunk-2SFLLOMN.js.map → chunk-CBBT42VX.js.map} +1 -1
- package/dist/chunk-CHKV2L2Y.cjs +416 -0
- package/dist/chunk-CHKV2L2Y.cjs.map +1 -0
- package/dist/{chunk-4UYHP6NF.cjs → chunk-DJKGDLYZ.cjs} +93 -63
- package/dist/chunk-DJKGDLYZ.cjs.map +1 -0
- package/dist/{chunk-354F3OF5.js → chunk-FGGVSHDW.js} +3 -3
- package/dist/{chunk-354F3OF5.js.map → chunk-FGGVSHDW.js.map} +1 -1
- package/dist/{chunk-6OCJWGVD.cjs → chunk-FTXY4D44.cjs} +4 -4
- package/dist/{chunk-6OCJWGVD.cjs.map → chunk-FTXY4D44.cjs.map} +1 -1
- package/dist/chunk-INVEGVGO.js +405 -0
- package/dist/chunk-INVEGVGO.js.map +1 -0
- package/dist/{chunk-2PRGRYEQ.js → chunk-IOBHFP2E.js} +50 -20
- package/dist/chunk-IOBHFP2E.js.map +1 -0
- package/dist/{chunk-47EACDOC.cjs → chunk-KMFBNKCT.cjs} +4 -4
- package/dist/{chunk-47EACDOC.cjs.map → chunk-KMFBNKCT.cjs.map} +1 -1
- package/dist/{chunk-DF77RBF4.js → chunk-LCCT5ZXJ.js} +6 -6
- package/dist/{chunk-DF77RBF4.js.map → chunk-LCCT5ZXJ.js.map} +1 -1
- package/dist/{chunk-G7XBVM3T.cjs → chunk-MHUOVS5I.cjs} +5 -5
- package/dist/{chunk-G7XBVM3T.cjs.map → chunk-MHUOVS5I.cjs.map} +1 -1
- package/dist/{chunk-CWQPQTUZ.cjs → chunk-NEH3BPFD.cjs} +15 -15
- package/dist/{chunk-CWQPQTUZ.cjs.map → chunk-NEH3BPFD.cjs.map} +1 -1
- package/dist/{chunk-5AR6O7GW.js → chunk-NK5EOTDY.js} +3 -3
- package/dist/{chunk-5AR6O7GW.js.map → chunk-NK5EOTDY.js.map} +1 -1
- package/dist/{chunk-S46WJTDL.cjs → chunk-P7QYG4RZ.cjs} +27 -19
- package/dist/chunk-P7QYG4RZ.cjs.map +1 -0
- package/dist/chunk-PPU2D4FZ.js +19 -0
- package/dist/chunk-PPU2D4FZ.js.map +1 -0
- package/dist/{chunk-MS3TQSXU.js → chunk-QD6B6W6I.js} +6 -4
- package/dist/chunk-QD6B6W6I.js.map +1 -0
- package/dist/{chunk-AB4OPJLD.js → chunk-RGVMJU57.js} +3 -3
- package/dist/{chunk-AB4OPJLD.js.map → chunk-RGVMJU57.js.map} +1 -1
- package/dist/{chunk-NWWTYBD3.cjs → chunk-RTDVSHJR.cjs} +5 -5
- package/dist/{chunk-NWWTYBD3.cjs.map → chunk-RTDVSHJR.cjs.map} +1 -1
- package/dist/{chunk-5HSMH2ZZ.js → chunk-RZL2W4C3.js} +25 -17
- package/dist/chunk-RZL2W4C3.js.map +1 -0
- package/dist/chunk-SPEN7RJU.cjs +18 -0
- package/dist/{chunk-LO6LIUZ6.cjs.map → chunk-SPEN7RJU.cjs.map} +1 -1
- package/dist/{chunk-ZF2LDKQQ.cjs → chunk-U3DW3WDE.cjs} +9 -8
- package/dist/chunk-U3DW3WDE.cjs.map +1 -0
- package/dist/{chunk-DVP3YMDA.cjs → chunk-U7PRI3XM.cjs} +3 -3
- package/dist/{chunk-DVP3YMDA.cjs.map → chunk-U7PRI3XM.cjs.map} +1 -1
- package/dist/{chunk-H7G65PNI.js → chunk-VCQ37TC5.js} +3 -3
- package/dist/{chunk-H7G65PNI.js.map → chunk-VCQ37TC5.js.map} +1 -1
- package/dist/{chunk-SDZ4XDWS.cjs → chunk-VWYFGE27.cjs} +9 -9
- package/dist/{chunk-SDZ4XDWS.cjs.map → chunk-VWYFGE27.cjs.map} +1 -1
- package/dist/{chunk-RN3XDZGS.js → chunk-WM646HEN.js} +4 -3
- package/dist/chunk-WM646HEN.js.map +1 -0
- package/dist/chunk-X7CE7Y5W.js +305 -0
- package/dist/chunk-X7CE7Y5W.js.map +1 -0
- package/dist/{chunk-CGH4BCIY.cjs → chunk-XE3CAY6Z.cjs} +5 -5
- package/dist/{chunk-CGH4BCIY.cjs.map → chunk-XE3CAY6Z.cjs.map} +1 -1
- package/dist/chunk-XOU3CL7S.cjs +312 -0
- package/dist/chunk-XOU3CL7S.cjs.map +1 -0
- package/dist/{chunk-NKQVLWDF.js → chunk-YKNBTHMD.js} +3 -3
- package/dist/{chunk-NKQVLWDF.js.map → chunk-YKNBTHMD.js.map} +1 -1
- package/dist/{compact-session-B7P6EU3Z.cjs → compact-session-NX7HUNTB.cjs} +18 -18
- package/dist/{compact-session-B7P6EU3Z.cjs.map → compact-session-NX7HUNTB.cjs.map} +1 -1
- package/dist/{compact-session-5HMX6KYT.js → compact-session-Q5IGNFPW.js} +9 -9
- package/dist/{compact-session-5HMX6KYT.js.map → compact-session-Q5IGNFPW.js.map} +1 -1
- package/dist/{cron-BvxrLW5J.d.cts → cron-Bh3aWgQ2.d.cts} +2 -2
- package/dist/{cron-DdKzwJqK.d.ts → cron-CCDxeeFZ.d.ts} +2 -2
- package/dist/cron.cjs +21 -20
- package/dist/cron.d.cts +4 -3
- package/dist/cron.d.ts +4 -3
- package/dist/cron.js +20 -19
- package/dist/eval.cjs +20 -19
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +19 -18
- package/dist/eval.js.map +1 -1
- package/dist/fs-session-store-CYNTEPJZ.cjs +20 -0
- package/dist/{fs-session-store-S2AXVJIX.cjs.map → fs-session-store-CYNTEPJZ.cjs.map} +1 -1
- package/dist/fs-session-store-MYQEVUFL.js +11 -0
- package/dist/{fs-session-store-6ZCCJX3K.js.map → fs-session-store-MYQEVUFL.js.map} +1 -1
- package/dist/{index-manager-HO456AVW.cjs → index-manager-2KH75BRW.cjs} +7 -7
- package/dist/{index-manager-HO456AVW.cjs.map → index-manager-2KH75BRW.cjs.map} +1 -1
- package/dist/{index-manager-QDH56FER.js → index-manager-NF2WRLOU.js} +6 -6
- package/dist/{index-manager-QDH56FER.js.map → index-manager-NF2WRLOU.js.map} +1 -1
- package/dist/index.cjs +93 -273
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -46
- package/dist/index.d.ts +13 -46
- package/dist/index.js +52 -236
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-75L3NCNL.js → inject-session-4ROYLZHY.js} +3 -3
- package/dist/{inject-session-75L3NCNL.js.map → inject-session-4ROYLZHY.js.map} +1 -1
- package/dist/{inject-session-WOH7TPDX.cjs → inject-session-AWKDCGHV.cjs} +4 -4
- package/dist/{inject-session-WOH7TPDX.cjs.map → inject-session-AWKDCGHV.cjs.map} +1 -1
- package/dist/internal/agent-loop/doom-loop-tracker.d.ts +3 -0
- package/dist/internal/agent-loop/prune-tool-results.d.ts +37 -0
- package/dist/internal/agent-loop/types.d.ts +6 -0
- package/dist/internal/auth/credential-store.d.ts +1 -1
- package/dist/internal/auth/types.d.ts +4 -0
- package/dist/internal/error-mappers/anthropic.d.ts +3 -0
- package/dist/internal/error-mappers/openai-compatible.d.ts +2 -3
- package/dist/internal/local-agent/local-agent-dispatch.d.ts +3 -1
- package/dist/internal/local-agent/send-queue.d.ts +31 -0
- package/dist/internal/mcp/client.d.ts +2 -0
- package/dist/internal/mcp/oauth-bearer.d.ts +2 -0
- package/dist/internal/memory/adapters/index.cjs +3 -3
- package/dist/internal/memory/adapters/index.js +2 -2
- package/dist/internal/memory/dreaming/phases.d.ts +15 -0
- package/dist/internal/memory/dreaming/run.d.ts +29 -0
- package/dist/internal/memory/sdk-memory-peer-loader.d.ts +2 -0
- package/dist/internal/memory/storage/index.cjs +51 -35
- package/dist/internal/memory/storage/index.d.cts +2 -0
- package/dist/internal/memory/storage/index.d.ts +2 -0
- package/dist/internal/memory/storage/index.js +4 -4
- package/dist/internal/persistence/cwd-mutex.d.cts +4 -2
- package/dist/internal/persistence/cwd-mutex.d.ts +4 -2
- package/dist/internal/persistence/index.cjs +4 -4
- package/dist/internal/persistence/index.js +2 -2
- package/dist/internal/persistence/sqlite-session-store.d.cts +25 -0
- package/dist/internal/persistence/sqlite-session-store.d.ts +25 -0
- package/dist/internal/providers/registry.d.ts +5 -1
- package/dist/internal/runtime/skills/binary-on-path.d.ts +1 -0
- package/dist/internal/runtime/skills/discover-skills.d.ts +2 -0
- package/dist/mcp-auth.cjs +25 -307
- package/dist/mcp-auth.cjs.map +1 -1
- package/dist/mcp-auth.js +5 -305
- package/dist/mcp-auth.js.map +1 -1
- package/dist/models.cjs +11 -11
- package/dist/models.js +4 -4
- package/dist/persistence.cjs +9 -4
- package/dist/persistence.cjs.map +1 -1
- package/dist/persistence.d.cts +744 -40
- package/dist/persistence.d.ts +744 -40
- package/dist/persistence.js +3 -2
- package/dist/persistence.js.map +1 -1
- package/dist/providers.cjs +6 -6
- package/dist/providers.js +4 -4
- package/dist/sandbox/docker-sandbox.d.cts +58 -0
- package/dist/sandbox/docker-sandbox.d.ts +58 -0
- package/dist/sandbox/index.cjs +129 -1
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.d.cts +1 -0
- package/dist/sandbox/index.d.ts +1 -0
- package/dist/sandbox/index.js +132 -5
- package/dist/sandbox/index.js.map +1 -1
- package/dist/{sdk-agent-4-dXI2GS.d.cts → sdk-agent-BA_6_wtc.d.cts} +57 -4
- package/dist/{sdk-agent-CTOJlWA_.d.ts → sdk-agent-CnwPODYH.d.ts} +57 -4
- package/dist/session-store-Dh07jr9N.d.cts +209 -0
- package/dist/session-store-Dh07jr9N.d.ts +209 -0
- package/dist/skills.cjs +4 -4
- package/dist/skills.js +1 -1
- package/dist/sqlite-session-store-BbcpKY1L.d.ts +64 -0
- package/dist/sqlite-session-store-TKXtT4ON.d.cts +64 -0
- package/dist/subagents-loader-KLWF4QPD.cjs +16 -0
- package/dist/{subagents-loader-TXOA5EJJ.cjs.map → subagents-loader-KLWF4QPD.cjs.map} +1 -1
- package/dist/subagents-loader-SXETS2F2.js +7 -0
- package/dist/{subagents-loader-Z744TAKD.js.map → subagents-loader-SXETS2F2.js.map} +1 -1
- package/dist/subagents-loader.cjs +2 -2
- package/dist/subagents-loader.d.cts +3 -2
- package/dist/subagents-loader.d.ts +3 -2
- package/dist/subagents-loader.js +1 -1
- package/dist/types/agent.d.ts +20 -1
- package/dist/types/budget-tracker.d.ts +6 -2
- package/dist/types/mcp.d.ts +14 -0
- package/dist/types/run.d.ts +42 -3
- package/dist/workflow.d.cts +1 -1
- package/dist/workflow.d.ts +1 -1
- package/docs/adr/mutation-testing-scope.md +66 -0
- package/docs/error-codes.md +48 -45
- package/docs/harness-capability-map.md +60 -6
- package/package.json +1 -1
- package/dist/chunk-2PRGRYEQ.js.map +0 -1
- package/dist/chunk-3FSBE4PS.js.map +0 -1
- package/dist/chunk-4UYHP6NF.cjs.map +0 -1
- package/dist/chunk-5A4UFBHW.cjs.map +0 -1
- package/dist/chunk-5HSMH2ZZ.js.map +0 -1
- package/dist/chunk-6CXRYPG7.cjs +0 -211
- package/dist/chunk-6CXRYPG7.cjs.map +0 -1
- package/dist/chunk-7WARNHWW.cjs.map +0 -1
- package/dist/chunk-JX4LB6XO.js.map +0 -1
- package/dist/chunk-KL7ZUMK3.cjs.map +0 -1
- package/dist/chunk-LO6LIUZ6.cjs +0 -18
- package/dist/chunk-MS3TQSXU.js.map +0 -1
- package/dist/chunk-MSEL5E5P.js +0 -204
- package/dist/chunk-MSEL5E5P.js.map +0 -1
- package/dist/chunk-NHOEXFZT.js.map +0 -1
- package/dist/chunk-NP362THY.cjs.map +0 -1
- package/dist/chunk-Q5EWJPRY.js +0 -18
- package/dist/chunk-Q5EWJPRY.js.map +0 -1
- package/dist/chunk-QISSETTG.cjs.map +0 -1
- package/dist/chunk-RN3XDZGS.js.map +0 -1
- package/dist/chunk-S46WJTDL.cjs.map +0 -1
- package/dist/chunk-WDVG5R2Q.cjs.map +0 -1
- package/dist/chunk-ZF2LDKQQ.cjs.map +0 -1
- package/dist/chunk-ZJAYFSVI.js.map +0 -1
- package/dist/fs-session-store-6ZCCJX3K.js +0 -11
- package/dist/fs-session-store-S2AXVJIX.cjs +0 -20
- package/dist/subagents-loader-TXOA5EJJ.cjs +0 -16
- package/dist/subagents-loader-Z744TAKD.js +0 -7
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { a as SessionStore, S as SessionRecord } from './session-store-Dh07jr9N.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Run `fn` after every earlier `withCwdMutex` call for the same `key` has settled, and return
|
|
5
|
+
* what `fn` returns.
|
|
6
|
+
*
|
|
7
|
+
* Calls with the same key run strictly in the order they were made — FIFO, never concurrent.
|
|
8
|
+
* Calls with different keys never wait on each other. The key is an opaque string: two callers
|
|
9
|
+
* serialize against each other exactly when they pass equal keys, so a shared key IS the
|
|
10
|
+
* contract, and a mismatched one silently buys no protection at all.
|
|
11
|
+
*
|
|
12
|
+
* A rejection does not poison the queue. The next waiter runs whether the previous `fn` fulfilled
|
|
13
|
+
* or rejected, and the rejection is delivered only to the caller whose `fn` threw. This function
|
|
14
|
+
* neither retries nor swallows: the returned promise rejects with whatever `fn` rejected with.
|
|
15
|
+
*
|
|
16
|
+
* There is no timeout and no cancellation. An `fn` that never settles blocks that key for the
|
|
17
|
+
* lifetime of the process.
|
|
18
|
+
*
|
|
19
|
+
* **Scope — this is an in-process lock only.** State is a module-scoped Map, so it serializes
|
|
20
|
+
* callers that share one module instance and nothing else. Two processes, two worker threads, or
|
|
21
|
+
* two copies of the SDK resolved into the same tree do not see each other's queue. When the
|
|
22
|
+
* resource is a file that other processes can also write, use `withFileLock` from
|
|
23
|
+
* `./file-lock.ts` instead — it takes an OS-level lock and layers this mutex underneath, so it
|
|
24
|
+
* gives both guarantees. Reach for `withCwdMutex` directly when the shared state is in memory, or
|
|
25
|
+
* when the file is one only this process touches.
|
|
26
|
+
*
|
|
27
|
+
* Extracted packages (`@theokit/sdk-budget`, `@theokit/sdk-memory`) import this from
|
|
28
|
+
* `@theokit/sdk` rather than reimplementing it, precisely so the Map is the same one: a per-package
|
|
29
|
+
* copy would give each package its own queue and let their writes race.
|
|
30
|
+
*
|
|
31
|
+
* The Map is module-scoped, so nothing survives a process restart or a fresh module instance.
|
|
32
|
+
* An entry is dropped as soon as its key has no call pending.
|
|
33
|
+
* Signature and semantics will not change before sdk-core v3.0.
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
declare function withCwdMutex<T>(key: string, fn: () => Promise<T>): Promise<T>;
|
|
38
|
+
|
|
39
|
+
/** Options for {@link SqliteSessionStore}. */
|
|
40
|
+
interface SqliteSessionStoreOptions {
|
|
41
|
+
/** Absolute path of the SQLite file. Parent directories are created. */
|
|
42
|
+
filePath: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A {@link SessionStore} that keeps the native session records in one SQLite file instead of
|
|
46
|
+
* per-agent JSONL transcripts. Pass it as `local.sessionStore`.
|
|
47
|
+
*
|
|
48
|
+
* Uses `better-sqlite3` when installed, else the built-in `node:sqlite` (Node 22.5+).
|
|
49
|
+
* Appends are one transaction, so a batch lands whole or not at all; order is the
|
|
50
|
+
* autoincrement `seq`. Corruption is NOT silently rebuilt: opening a corrupt file throws.
|
|
51
|
+
*
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
declare class SqliteSessionStore implements SessionStore {
|
|
55
|
+
private readonly filePath;
|
|
56
|
+
private dbPromise;
|
|
57
|
+
constructor(options: SqliteSessionStoreOptions);
|
|
58
|
+
private db;
|
|
59
|
+
readRecords(agentId: string): Promise<SessionRecord[]>;
|
|
60
|
+
appendRecords(agentId: string, records: readonly SessionRecord[]): Promise<void>;
|
|
61
|
+
dispose(): Promise<void>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { SqliteSessionStore as S, type SqliteSessionStoreOptions as a, withCwdMutex as w };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkAUH2EVWY_cjs = require('./chunk-AUH2EVWY.cjs');
|
|
4
|
+
require('./chunk-YQ3XC6C2.cjs');
|
|
5
|
+
require('./chunk-6XQLTQB6.cjs');
|
|
6
|
+
require('./chunk-CEGU5AVD.cjs');
|
|
7
|
+
require('./chunk-RNXXYF22.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
Object.defineProperty(exports, "loadSubagents", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkAUH2EVWY_cjs.loadSubagents; }
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=subagents-loader-KLWF4QPD.cjs.map
|
|
16
|
+
//# sourceMappingURL=subagents-loader-KLWF4QPD.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"subagents-loader-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"subagents-loader-KLWF4QPD.cjs"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { loadSubagents } from './chunk-WM646HEN.js';
|
|
2
|
+
import './chunk-YMVTUV5K.js';
|
|
3
|
+
import './chunk-Q7UG242V.js';
|
|
4
|
+
import './chunk-TNFOU6SB.js';
|
|
5
|
+
import './chunk-3OY6H3I7.js';
|
|
6
|
+
//# sourceMappingURL=subagents-loader-SXETS2F2.js.map
|
|
7
|
+
//# sourceMappingURL=subagents-loader-SXETS2F2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"subagents-loader-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"subagents-loader-SXETS2F2.js"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkAUH2EVWY_cjs = require('./chunk-AUH2EVWY.cjs');
|
|
4
4
|
require('./chunk-YQ3XC6C2.cjs');
|
|
5
5
|
require('./chunk-6XQLTQB6.cjs');
|
|
6
6
|
var chunkCEGU5AVD_cjs = require('./chunk-CEGU5AVD.cjs');
|
|
@@ -23,7 +23,7 @@ function resolveSources(options) {
|
|
|
23
23
|
}
|
|
24
24
|
async function discoverSubagents(cwd, options) {
|
|
25
25
|
const sources = resolveSources(options);
|
|
26
|
-
return
|
|
26
|
+
return chunkAUH2EVWY_cjs.loadSubagents(cwd, sources.includes("project"), void 0, options?.compatSources ?? []);
|
|
27
27
|
}
|
|
28
28
|
async function loadSubagentDefinition(name, cwd, options) {
|
|
29
29
|
return (await discoverSubagents(cwd, options))[name];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { a as AgentDefinition } from './agent-
|
|
2
|
-
import './sdk-agent-
|
|
1
|
+
import { a as AgentDefinition } from './agent-B6FQad6P.cjs';
|
|
2
|
+
import './sdk-agent-BA_6_wtc.cjs';
|
|
3
3
|
import './agent-prims-CZyxfCmS.cjs';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import './errors-base-B5g01neU.cjs';
|
|
6
|
+
import './session-store-Dh07jr9N.cjs';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* A declared foreign source: a bare kind, or a kind with the surfaces it may be read for.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { a as AgentDefinition } from './agent-
|
|
2
|
-
import './sdk-agent-
|
|
1
|
+
import { a as AgentDefinition } from './agent-B6C9i_qu.js';
|
|
2
|
+
import './sdk-agent-CnwPODYH.js';
|
|
3
3
|
import './agent-prims-CZyxfCmS.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import './errors-base-B5g01neU.js';
|
|
6
|
+
import './session-store-Dh07jr9N.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* A declared foreign source: a bare kind, or a kind with the surfaces it may be read for.
|
package/dist/subagents-loader.js
CHANGED
package/dist/types/agent.d.ts
CHANGED
|
@@ -327,7 +327,8 @@ export type SystemPromptResolver = (ctx: SystemPromptContext) => string | Promis
|
|
|
327
327
|
*/
|
|
328
328
|
export interface SkillsSettings {
|
|
329
329
|
/**
|
|
330
|
-
* Names of skills the
|
|
330
|
+
* Names of skills the local runtime loads: a skill not named here cannot be listed or read.
|
|
331
|
+
* When omitted, every
|
|
331
332
|
* discovered skill is enabled.
|
|
332
333
|
*/
|
|
333
334
|
enabled?: string[];
|
|
@@ -344,6 +345,12 @@ export interface SkillsSettings {
|
|
|
344
345
|
* default `<cwd>/.theokit/skills`. Absent ⇒ the default root.
|
|
345
346
|
*/
|
|
346
347
|
skillsDir?: string;
|
|
348
|
+
/**
|
|
349
|
+
* B-546 — directories (each containing `<name>/SKILL.md`) an application ships inside its own
|
|
350
|
+
* package. They are read AFTER the project roots and plugin bundles, so a workspace skill of the
|
|
351
|
+
* same name always wins, and they are kept even when `skillsDir` replaces the default roots.
|
|
352
|
+
*/
|
|
353
|
+
bundledDirs?: string[];
|
|
347
354
|
/**
|
|
348
355
|
* M22 — code-defined skills (from `createSkill`) merged with the discovered ones. An inline skill
|
|
349
356
|
* overrides a discovered file skill of the same name.
|
|
@@ -737,6 +744,18 @@ export interface AgentOptions {
|
|
|
737
744
|
conversationId: string;
|
|
738
745
|
userId?: string;
|
|
739
746
|
}) => Promise<void> | void;
|
|
747
|
+
/**
|
|
748
|
+
* Start a fresh conversation when the agent has been idle this many minutes.
|
|
749
|
+
*
|
|
750
|
+
* Checked at the start of a local `send`: when more than this long has passed since the previous
|
|
751
|
+
* `send` on the same agent began, the in-memory conversation is cleared first, so the model
|
|
752
|
+
* receives no prior messages and `onBeforeSend` reports `previousMessageCount: 0`. Absent (the
|
|
753
|
+
* default), or not a positive finite number, never resets. The first send of a process has no
|
|
754
|
+
* previous send, so it never resets. The on-disk transcript is not deleted.
|
|
755
|
+
*
|
|
756
|
+
* @public
|
|
757
|
+
*/
|
|
758
|
+
sessionIdleResetMinutes?: number;
|
|
740
759
|
/**
|
|
741
760
|
* Fires before each `agent.send`. `previousMessageCount` is the count of
|
|
742
761
|
* messages already persisted BEFORE the current send adds the user
|
|
@@ -24,8 +24,12 @@ export interface BudgetUsageEvent {
|
|
|
24
24
|
readonly tokens: number;
|
|
25
25
|
/** Provider/model identifier (e.g., `"openai/gpt-4o-mini"`). */
|
|
26
26
|
readonly model: string;
|
|
27
|
-
/**
|
|
28
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Whether this is an input (uncached prompt), output (completion), `cache_read` (prompt tokens
|
|
29
|
+
* served from the provider's cache) or `cache_write` (prompt tokens written to it) measurement.
|
|
30
|
+
* A tracker that has no separate rate for the cache types should treat them as input.
|
|
31
|
+
*/
|
|
32
|
+
readonly type: "input" | "output" | "cache_read" | "cache_write";
|
|
29
33
|
/** Optional ISO 8601 timestamp; defaults to now() if omitted. */
|
|
30
34
|
readonly at?: string;
|
|
31
35
|
}
|
package/dist/types/mcp.d.ts
CHANGED
|
@@ -30,6 +30,13 @@ export type McpStdioServerConfig = {
|
|
|
30
30
|
* policy and always wins. Pass `"all"` to restore full inheritance.
|
|
31
31
|
*/
|
|
32
32
|
envPolicy?: EnvPolicy;
|
|
33
|
+
/**
|
|
34
|
+
* Run the calls a model makes to this server's tools in ONE step one at a time, in the order the
|
|
35
|
+
* model listed them, instead of at once. Set it for a stateful server whose tools act on shared
|
|
36
|
+
* state, such as a browser MCP server where a snapshot must wait for the navigation before it.
|
|
37
|
+
* Calls to other servers or non-MCP tools in the same step are not held behind it. Default `false`.
|
|
38
|
+
*/
|
|
39
|
+
sequential?: boolean;
|
|
33
40
|
};
|
|
34
41
|
/**
|
|
35
42
|
* OAuth-style auth bundle for HTTP/SSE MCP servers.
|
|
@@ -81,6 +88,13 @@ export type McpHttpServerConfig = {
|
|
|
81
88
|
* `NetworkError` (`code: "mcp_timeout"`). Default 30_000.
|
|
82
89
|
*/
|
|
83
90
|
requestTimeoutMs?: number;
|
|
91
|
+
/**
|
|
92
|
+
* Run the calls a model makes to this server's tools in ONE step one at a time, in the order the
|
|
93
|
+
* model listed them, instead of at once. Set it for a stateful server whose tools act on shared
|
|
94
|
+
* state, such as a browser MCP server where a snapshot must wait for the navigation before it.
|
|
95
|
+
* Calls to other servers or non-MCP tools in the same step are not held behind it. Default `false`.
|
|
96
|
+
*/
|
|
97
|
+
sequential?: boolean;
|
|
84
98
|
};
|
|
85
99
|
/**
|
|
86
100
|
* Union of MCP server configs.
|
package/dist/types/run.d.ts
CHANGED
|
@@ -24,6 +24,17 @@ export interface ToolResultGuardOptions {
|
|
|
24
24
|
/** Redact common PII patterns (email, phone) in tool-result content. */
|
|
25
25
|
redactPii?: boolean;
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* B-564 — how old a tool result may get, in tool rounds, before its content is pruned from the
|
|
29
|
+
* next LLM request (`SendOptions.pruneToolResults`). Contract type owned by `types/`; the
|
|
30
|
+
* implementation lives in `internal/agent-loop/prune-tool-results.ts`, which re-exports this.
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export interface PruneToolResultsOptions {
|
|
35
|
+
/** Keep the newest `olderThanRounds` tool rounds whole; an integer of at least 1. */
|
|
36
|
+
olderThanRounds: number;
|
|
37
|
+
}
|
|
27
38
|
/**
|
|
28
39
|
* Lifecycle status of a {@link Run}.
|
|
29
40
|
*
|
|
@@ -300,6 +311,8 @@ export type SDKImage = {
|
|
|
300
311
|
mimeType: string;
|
|
301
312
|
dimension?: SDKImageDimension;
|
|
302
313
|
};
|
|
314
|
+
/** How a message sent during a running turn is queued. See {@link SendOptions.queueMode}. @public */
|
|
315
|
+
export type QueueMode = "followup" | "steer" | "collect";
|
|
303
316
|
/**
|
|
304
317
|
* Structured form of `agent.send()`'s message argument. Use it to send images
|
|
305
318
|
* alongside text.
|
|
@@ -315,7 +328,7 @@ export interface SDKUserMessage {
|
|
|
315
328
|
*
|
|
316
329
|
* ## Which options do I need?
|
|
317
330
|
*
|
|
318
|
-
* Twenty-
|
|
331
|
+
* Twenty-two optional fields with genuinely different audiences, so most callers read all of them to
|
|
319
332
|
* find their two. This table is the fix that was chosen; the alternative — nesting the groups under
|
|
320
333
|
* `observe?` and `toolPolicy?` and carrying the flat keys as deprecated aliases for one major — would
|
|
321
334
|
* have added surface to remove surface, and the harm here is the READING cost, not a representable
|
|
@@ -325,9 +338,9 @@ export interface SDKUserMessage {
|
|
|
325
338
|
* | If you are… | you want |
|
|
326
339
|
* |---|---|
|
|
327
340
|
* | rendering a live UI | `onDelta`, `onStep`, `onRunEvent` |
|
|
328
|
-
* | applying a policy | `permissionMode`, `activeTools`, `toolChoice`, `toolResultGuard`, `perToolTimeoutMs` |
|
|
341
|
+
* | applying a policy | `permissionMode`, `activeTools`, `toolChoice`, `toolResultGuard`, `pruneToolResults`, `perToolTimeoutMs` |
|
|
329
342
|
* | running an eval or a harness | `maxIterations`, `completionCheck`, `doomLoop`, `signal` |
|
|
330
|
-
* | orchestrating agents | `origin`, `task`, `context` |
|
|
343
|
+
* | orchestrating agents | `origin`, `task`, `context`, `queueMode` |
|
|
331
344
|
* | overriding this one send | `model`, `systemPrompt`, `tools`, `mcpServers`, `contextPaths`, `local` |
|
|
332
345
|
*
|
|
333
346
|
* Every field appears in exactly one row, and
|
|
@@ -338,6 +351,18 @@ export interface SDKUserMessage {
|
|
|
338
351
|
* @public
|
|
339
352
|
*/
|
|
340
353
|
export interface SendOptions {
|
|
354
|
+
/**
|
|
355
|
+
* What to do with this message when the agent is ALREADY running a turn (local runtime only; a
|
|
356
|
+
* cloud agent always queues as `"followup"`). With no turn running, every mode just starts one.
|
|
357
|
+
*
|
|
358
|
+
* - `"followup"` (default) — wait for the running turn, then run as its own turn.
|
|
359
|
+
* - `"steer"` — inject the text into the RUNNING turn as a user message, picked up before the
|
|
360
|
+
* model's next call (after the current tool round). Resolves to the running turn's `Run`. If
|
|
361
|
+
* the turn ends before it can pick the message up, it runs as a followup turn instead.
|
|
362
|
+
* - `"collect"` — batch every `"collect"` message sent while a turn runs into ONE followup turn
|
|
363
|
+
* (texts joined by a blank line). Every collecting caller resolves to that same batched `Run`.
|
|
364
|
+
*/
|
|
365
|
+
queueMode?: QueueMode;
|
|
341
366
|
/**
|
|
342
367
|
* Per-send model override. SE8 — accepts a bare-string id shorthand
|
|
343
368
|
* (`"openai/gpt-4o-mini"`, normalized to `{ id }`) OR a {@link ModelSelection}
|
|
@@ -470,6 +495,20 @@ export interface SendOptions {
|
|
|
470
495
|
* @public
|
|
471
496
|
*/
|
|
472
497
|
toolResultGuard?: ToolResultGuardOptions;
|
|
498
|
+
/**
|
|
499
|
+
* B-564 — opt-in pruning of aged tool results. With `{ olderThanRounds: n }`, the content of
|
|
500
|
+
* every tool result older than `n` tool rounds is replaced by a short stub in each request the
|
|
501
|
+
* run's agent loop sends (its `toolUseId` and `isError` kept; session compaction is not pruned); the transcript the run keeps, persists and resumes
|
|
502
|
+
* from stays whole. `olderThanRounds` must be an integer of at least 1, else the send fails
|
|
503
|
+
* with `ConfigurationError` code `invalid_prune_tool_results` before any provider call.
|
|
504
|
+
* Undefined = no pruning (the request is unchanged). Pruning trades request size against
|
|
505
|
+
* prefix-cache reuse: each new round turns one more previously sent result into a stub, so the
|
|
506
|
+
* request prefix changes from that message onward on providers that cache message prefixes.
|
|
507
|
+
* The cache-hit cost was not measured.
|
|
508
|
+
*
|
|
509
|
+
* @public
|
|
510
|
+
*/
|
|
511
|
+
pruneToolResults?: PruneToolResultsOptions;
|
|
473
512
|
/**
|
|
474
513
|
* Opt-in task wrapping (ADRs D363, D374). When truthy, the entire
|
|
475
514
|
* run is registered as a `Task` in the SDK's observable registry —
|
package/dist/workflow.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ZodType, z } from 'zod';
|
|
2
|
-
import { S as SDKAgent, _ as MessageOrigin } from './sdk-agent-
|
|
2
|
+
import { S as SDKAgent, _ as MessageOrigin } from './sdk-agent-BA_6_wtc.cjs';
|
|
3
3
|
import { T as TheokitAgentError } from './errors-base-B5g01neU.cjs';
|
|
4
4
|
import { C as CustomTool } from './agent-prims-CZyxfCmS.cjs';
|
|
5
5
|
|
package/dist/workflow.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ZodType, z } from 'zod';
|
|
2
|
-
import { S as SDKAgent, _ as MessageOrigin } from './sdk-agent-
|
|
2
|
+
import { S as SDKAgent, _ as MessageOrigin } from './sdk-agent-CnwPODYH.js';
|
|
3
3
|
import { T as TheokitAgentError } from './errors-base-B5g01neU.js';
|
|
4
4
|
import { C as CustomTool } from './agent-prims-CZyxfCmS.js';
|
|
5
5
|
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Mutation testing covers only the B-026 spike over `src/internal/llm`
|
|
2
|
+
|
|
3
|
+
- Status: superseded by B-445 (Stryker scope extended to `packages/sdk/src`, see below)
|
|
4
|
+
- Date: 2026-10-17
|
|
5
|
+
- Decided by: human/paulo
|
|
6
|
+
- Soft cap dismissed: `auditor_unavailable_d4` (code-quality D4, mutation testing), for B-380
|
|
7
|
+
(`sdk-memory-ceiling`) and for any item whose files sit outside the Stryker scope below
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
|
|
11
|
+
`stryker.config.json` at the repository root came in with adeba4b1 as a measurement spike for
|
|
12
|
+
B-026. It was never wired into a gate. Its scope is narrow on purpose:
|
|
13
|
+
|
|
14
|
+
- `mutate` is `src/internal/llm/**/*.ts`, nothing else;
|
|
15
|
+
- it is meant to run from `packages/sdk` (`pnpm --filter exec`), so `jsonReporter.fileName` is
|
|
16
|
+
`../../reports/mutation/slice.json` (now `reports/mutation/mutation.json`);
|
|
17
|
+
- `inPlace: true` is required because `packages/sdk/vitest.setup.ts` imports
|
|
18
|
+
`../../tools/preflight-native-bindings.mjs`, which escapes the package, so a sandbox copy fails
|
|
19
|
+
before it collects a test. The same commit records that `inPlace` restores file content but not
|
|
20
|
+
file mode, which strips the executable bit from `bin/*.mjs` entry points.
|
|
21
|
+
|
|
22
|
+
The kit's code-quality detector D4 looks for a Stryker config in the manifest directory (the
|
|
23
|
+
repository root here), runs `stryker run --reporters json` from there, and reads
|
|
24
|
+
`reports/mutation/mutation.json`. With this config that file is never written, so D4 reports
|
|
25
|
+
`auditor_unavailable_d4` ("stryker ran but wrote no report"). B-380 was the first item in this
|
|
26
|
+
repository to reach the code-quality audit, and none of its files is under `src/internal/llm`.
|
|
27
|
+
Nothing in B-380 touched the config.
|
|
28
|
+
|
|
29
|
+
## Decision
|
|
30
|
+
|
|
31
|
+
Mutation testing in theokit-sdk is the B-026 spike over `src/internal/llm` and nothing more, until
|
|
32
|
+
a separate backlog item extends it. D4 cannot measure code outside that scope today, so an item
|
|
33
|
+
whose files are outside it carries no mutation measurement, and its audit's
|
|
34
|
+
`auditor_unavailable_d4` soft cap is dismissed by this record. Extending Stryker is registered as
|
|
35
|
+
its own backlog item (`repo: theokit-sdk`).
|
|
36
|
+
|
|
37
|
+
This dismisses the cap. It does not claim the uncovered code is well tested: the unit and
|
|
38
|
+
integration suites are still the only evidence for it.
|
|
39
|
+
|
|
40
|
+
## Alternatives rejected
|
|
41
|
+
|
|
42
|
+
- Extend the Stryker config inside B-380, writing the report to `reports/mutation/mutation.json`
|
|
43
|
+
and mutating the memory files. Rejected because it widens an item that is already executing.
|
|
44
|
+
Runs over `packages/sdk` took minutes per file set, surviving mutants could need new tests, and
|
|
45
|
+
the `inPlace` file-mode risk above would come with it, all for work B-380 never scoped.
|
|
46
|
+
- Treat the mismatch as a kit defect (D4 runs from the repository root while the config expects
|
|
47
|
+
`packages/sdk`), report it to the kit and hold B-380 until it is fixed. Rejected because the
|
|
48
|
+
config is a spike that was never adopted as a gate. A kit fix would run Stryker against the same
|
|
49
|
+
`src/internal/llm` glob and still measure nothing B-380 changed.
|
|
50
|
+
|
|
51
|
+
## Consequences
|
|
52
|
+
|
|
53
|
+
- Every item outside `src/internal/llm` reaches review with D4 unmeasured and FAIL_SOFT, admitted
|
|
54
|
+
only through this record.
|
|
55
|
+
- The record stops applying once the backlog item that extends Stryker lands. At that point it
|
|
56
|
+
should be marked superseded.
|
|
57
|
+
|
|
58
|
+
## Superseded (B-445)
|
|
59
|
+
|
|
60
|
+
This record is superseded by the record of the new scope: `stryker.config.json` now mutates
|
|
61
|
+
`packages/sdk/src/**/*.ts`, runs from the repository root and writes
|
|
62
|
+
`reports/mutation/mutation.json`, which is where the D4 detector reads it. So D4 reports a score for
|
|
63
|
+
items under `packages/sdk/src`, and the `auditor_unavailable_d4` dismissal above no longer applies.
|
|
64
|
+
`inPlace` still drops file modes, so `pnpm run mutation` snapshots the mode of every
|
|
65
|
+
`packages/*/bin/*.mjs` first and `tools/check-bin-modes.mjs verify` fails the run if any changed.
|
|
66
|
+
The full-scope run was not executed where this was written (no dependencies installed).
|