@theokit/sdk 4.54.0 → 4.56.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 +159 -0
- package/dist/a2a/index.cjs +13 -4
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.d.cts +1 -1
- package/dist/a2a/index.d.ts +1 -1
- package/dist/a2a/index.js +13 -5
- package/dist/a2a/index.js.map +1 -1
- package/dist/a2a/message-bus.d.cts +33 -4
- package/dist/a2a/message-bus.d.ts +33 -4
- package/dist/{agent-CIUgz7cN.d.cts → agent-D3Xr_-6Z.d.cts} +61 -6
- package/dist/{agent-DSec-E0c.d.ts → agent-DIu6FooJ.d.ts} +61 -6
- package/dist/{agent-VGD5WL4N.js → agent-K3PQBS7D.js} +10 -9
- package/dist/{agent-VGD5WL4N.js.map → agent-K3PQBS7D.js.map} +1 -1
- package/dist/{agent-NOEGF4GI.cjs → agent-PJMBK7HQ.cjs} +11 -10
- package/dist/{agent-NOEGF4GI.cjs.map → agent-PJMBK7HQ.cjs.map} +1 -1
- package/dist/{chunk-SSQZA3DZ.js → chunk-2BDH744Z.js} +3 -3
- package/dist/{chunk-SSQZA3DZ.js.map → chunk-2BDH744Z.js.map} +1 -1
- package/dist/chunk-6HTXPPHK.cjs +18 -0
- package/dist/{chunk-3KGLRRFC.cjs.map → chunk-6HTXPPHK.cjs.map} +1 -1
- package/dist/{chunk-5UOVYM3P.cjs → chunk-6VLKVX7O.cjs} +131 -54
- package/dist/chunk-6VLKVX7O.cjs.map +1 -0
- package/dist/{chunk-5PHVENFV.js → chunk-7FHZ4VQX.js} +3 -55
- package/dist/chunk-7FHZ4VQX.js.map +1 -0
- package/dist/{chunk-Q47R5E2X.cjs → chunk-E3WZ6Y4H.cjs} +7 -59
- package/dist/chunk-E3WZ6Y4H.cjs.map +1 -0
- package/dist/{chunk-TTHBHAJI.cjs → chunk-H5GOSXSC.cjs} +4 -4
- package/dist/{chunk-TTHBHAJI.cjs.map → chunk-H5GOSXSC.cjs.map} +1 -1
- package/dist/{chunk-UNDROG5N.cjs → chunk-HLPSLDGL.cjs} +94 -26
- package/dist/chunk-HLPSLDGL.cjs.map +1 -0
- package/dist/{chunk-TPTZA6NI.js → chunk-KBXWEWKS.js} +70 -29
- package/dist/chunk-KBXWEWKS.js.map +1 -0
- package/dist/chunk-KRD3GQAA.cjs +71 -0
- package/dist/chunk-KRD3GQAA.cjs.map +1 -0
- package/dist/chunk-KVNWIAO4.js +68 -0
- package/dist/chunk-KVNWIAO4.js.map +1 -0
- package/dist/{chunk-UFAO4T7Z.cjs → chunk-LQYQHXIW.cjs} +129 -88
- package/dist/chunk-LQYQHXIW.cjs.map +1 -0
- package/dist/{chunk-AGSBJD2L.js → chunk-M7UHYBEY.js} +3 -3
- package/dist/{chunk-AGSBJD2L.js.map → chunk-M7UHYBEY.js.map} +1 -1
- package/dist/{chunk-VDEWG5TV.js → chunk-MVAPK2BX.js} +77 -9
- package/dist/chunk-MVAPK2BX.js.map +1 -0
- package/dist/{chunk-RM7Y65IG.cjs → chunk-NIRE5CNO.cjs} +10 -3
- package/dist/{chunk-FXEUP75G.js.map → chunk-NIRE5CNO.cjs.map} +1 -1
- package/dist/{chunk-DAPSQZT4.js → chunk-ODTZ7HX3.js} +131 -54
- package/dist/chunk-ODTZ7HX3.js.map +1 -0
- package/dist/{chunk-DUIF54UP.js → chunk-OHBIUXKM.js} +3 -3
- package/dist/{chunk-DUIF54UP.js.map → chunk-OHBIUXKM.js.map} +1 -1
- package/dist/{chunk-FXEUP75G.js → chunk-Q4CMI2LP.js} +9 -2
- package/dist/chunk-Q4CMI2LP.js.map +1 -0
- package/dist/{chunk-5BJV5UPY.cjs → chunk-V2UUGUY4.cjs} +3 -3
- package/dist/{chunk-5BJV5UPY.cjs.map → chunk-V2UUGUY4.cjs.map} +1 -1
- package/dist/{compact-session-K5LXTBPJ.js → compact-session-FUJDVF7B.js} +4 -4
- package/dist/{compact-session-K5LXTBPJ.js.map → compact-session-FUJDVF7B.js.map} +1 -1
- package/dist/{compact-session-YCT6JMBX.cjs → compact-session-LEWF554G.cjs} +12 -12
- package/dist/{compact-session-YCT6JMBX.cjs.map → compact-session-LEWF554G.cjs.map} +1 -1
- package/dist/context/index.cjs +6 -5
- package/dist/context/index.cjs.map +1 -1
- package/dist/context/index.js +3 -2
- package/dist/context/index.js.map +1 -1
- package/dist/{cron-DxxeQ-sK.d.cts → cron-BcWmzWzT.d.cts} +1 -1
- package/dist/{cron-CRwy2JBF.d.ts → cron-De6hzWCF.d.ts} +1 -1
- package/dist/cron.cjs +10 -9
- package/dist/cron.d.cts +2 -2
- package/dist/cron.d.ts +2 -2
- package/dist/cron.js +9 -8
- package/dist/eval.cjs +9 -8
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +8 -7
- package/dist/eval.js.map +1 -1
- package/dist/{index-manager-ZMRJ6ZII.js → index-manager-WBIMDVQT.js} +4 -3
- package/dist/{index-manager-ZMRJ6ZII.js.map → index-manager-WBIMDVQT.js.map} +1 -1
- package/dist/{index-manager-NG5YENWO.cjs → index-manager-WC5ZVJWO.cjs} +5 -4
- package/dist/{index-manager-NG5YENWO.cjs.map → index-manager-WC5ZVJWO.cjs.map} +1 -1
- package/dist/index.cjs +47 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +12 -11
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-DDR6X6PC.js → inject-session-BJMJH5BX.js} +3 -3
- package/dist/{inject-session-DDR6X6PC.js.map → inject-session-BJMJH5BX.js.map} +1 -1
- package/dist/{inject-session-XLO3KTBM.cjs → inject-session-WQGGMCQY.cjs} +4 -4
- package/dist/{inject-session-XLO3KTBM.cjs.map → inject-session-WQGGMCQY.cjs.map} +1 -1
- package/dist/internal/llm/prompt-cache-key.d.ts +1 -0
- package/dist/internal/llm/responses.d.ts +67 -1
- package/dist/internal/llm/types.d.ts +15 -0
- package/dist/internal/local-agent/real-local-run-tools.d.ts +17 -6
- package/dist/internal/memory/storage/markdown-store.d.ts +14 -2
- package/dist/internal/memory/storage/memory-file.d.ts +54 -0
- package/dist/internal/memory/types.d.ts +28 -0
- package/dist/models.cjs +9 -9
- package/dist/models.js +1 -1
- package/dist/providers.cjs +4 -4
- package/dist/providers.js +2 -2
- package/dist/sandbox/index.cjs +1 -1
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.js +1 -1
- package/dist/sandbox/index.js.map +1 -1
- package/dist/subagents-loader.d.cts +1 -1
- package/dist/subagents-loader.d.ts +1 -1
- package/dist/types/agent.d.ts +47 -5
- package/dist/types/provider-profile.d.ts +13 -0
- package/docs/error-codes.md +22 -20
- package/docs/harness-capability-map.md +3 -1
- package/package.json +1 -1
- package/dist/chunk-3KGLRRFC.cjs +0 -18
- package/dist/chunk-5PHVENFV.js.map +0 -1
- package/dist/chunk-5UOVYM3P.cjs.map +0 -1
- package/dist/chunk-DAPSQZT4.js.map +0 -1
- package/dist/chunk-Q47R5E2X.cjs.map +0 -1
- package/dist/chunk-RM7Y65IG.cjs.map +0 -1
- package/dist/chunk-TPTZA6NI.js.map +0 -1
- package/dist/chunk-UFAO4T7Z.cjs.map +0 -1
- package/dist/chunk-UNDROG5N.cjs.map +0 -1
- package/dist/chunk-VDEWG5TV.js.map +0 -1
|
@@ -551,6 +551,19 @@ interface ProviderProfile {
|
|
|
551
551
|
* Default off — only enable for routes/models known to leak (e.g. a qwen3-coder profile variant).
|
|
552
552
|
*/
|
|
553
553
|
extractToolCallsFromContent?: boolean;
|
|
554
|
+
/**
|
|
555
|
+
* Opt-in encrypted-reasoning carry for `apiMode: "responses_api"` (usetheokit/theokit-sdk#383).
|
|
556
|
+
* When `true`, the request adds `include: ["reasoning.encrypted_content"]` and
|
|
557
|
+
* `reasoning.context: "all_turns"`, and the transport replays the ciphertext the provider returned
|
|
558
|
+
* so the model does not re-derive its chain of thought on every round of a turn.
|
|
559
|
+
*
|
|
560
|
+
* Default off, and deliberately per-profile rather than per-`apiMode`: `include` is a documented
|
|
561
|
+
* Responses-API field but `reasoning.context` is not, so a provider that validates strictly
|
|
562
|
+
* answers it with `400`. Enable it only for a backend measured to accept both — the builtin
|
|
563
|
+
* `openai-chatgpt` profile is one, because issue #383 captured OpenAI Codex sending exactly these
|
|
564
|
+
* fields to that endpoint. Ignored by every other `apiMode`.
|
|
565
|
+
*/
|
|
566
|
+
encryptedReasoning?: boolean;
|
|
554
567
|
}
|
|
555
568
|
|
|
556
569
|
/**
|
|
@@ -799,6 +812,19 @@ type Plugin = (BasePlugin & {
|
|
|
799
812
|
* @public
|
|
800
813
|
*/
|
|
801
814
|
type SettingSource = "project" | "user" | "team" | "mdm" | "plugins" | "all";
|
|
815
|
+
/**
|
|
816
|
+
* A tool the SDK declares to the model on its own initiative — not one the consumer passed in
|
|
817
|
+
* {@link AgentOptions.tools}, and not one an MCP server exposed.
|
|
818
|
+
*
|
|
819
|
+
* These three names are also the ones the SDK reserves: a custom tool may not claim them. Listing
|
|
820
|
+
* one in {@link AgentOptions.withheldBuiltinTools} both stops it being declared and releases the
|
|
821
|
+
* name, because nothing of the SDK's is occupying it any more.
|
|
822
|
+
*
|
|
823
|
+
* Named for usetheokit/theokit-sdk#381, which is the report that the catalog had no opt-out.
|
|
824
|
+
*
|
|
825
|
+
* @public
|
|
826
|
+
*/
|
|
827
|
+
type BuiltinToolName = "shell" | "memory_search" | "memory_get";
|
|
802
828
|
/**
|
|
803
829
|
* Local agent configuration.
|
|
804
830
|
*
|
|
@@ -809,14 +835,17 @@ type SettingSource = "project" | "user" | "team" | "mdm" | "plugins" | "all";
|
|
|
809
835
|
* an evaluation invalidated this way: the working directory held the benchmark's answer key, and
|
|
810
836
|
* two transcripts show the model citing it. Deny it explicitly if that matters —
|
|
811
837
|
* `{ tool: "shell", action: "deny" }` on a {@link PermissionEngine} rule is terminal under every
|
|
812
|
-
* permission mode, including `bypass`.
|
|
813
|
-
* the model may attempt it and be refused
|
|
838
|
+
* permission mode, including `bypass`. A deny rule still leaves the tool in the advertised
|
|
839
|
+
* catalog, so the model may attempt it and be refused; to keep it out of the catalog entirely,
|
|
840
|
+
* pass `withheldBuiltinTools: ["shell"]` on {@link AgentOptions} (usetheokit/theokit-sdk#381).
|
|
814
841
|
*
|
|
815
842
|
* 2. **Finished runs write a transcript to disk**, at `.theokit/memory/sessions/<runId>.md` under
|
|
816
843
|
* the workspace `cwd`, with the full prompt and reply. This happens with no `memory` config and
|
|
817
|
-
* with `settingSources: []` — it is what `memory_search({ corpus: "sessions" })` reads.
|
|
818
|
-
*
|
|
819
|
-
*
|
|
844
|
+
* with `settingSources: []` — it is what `memory_search({ corpus: "sessions" })` reads. Opt out
|
|
845
|
+
* with `memory: { enabled: false }`, which suppresses the write entirely
|
|
846
|
+
* (usetheokit/theokit-sdk#382). Leaving `memory`
|
|
847
|
+
* unset still writes, so if the workspace is a git repository, add `.theokit/` to `.gitignore`:
|
|
848
|
+
* one report describes a transcript reaching a public repo before it was noticed.
|
|
820
849
|
*
|
|
821
850
|
* @public
|
|
822
851
|
*/
|
|
@@ -1220,6 +1249,32 @@ interface AgentOptions {
|
|
|
1220
1249
|
* See {@link CustomTool}.
|
|
1221
1250
|
*/
|
|
1222
1251
|
tools?: CustomTool[];
|
|
1252
|
+
/**
|
|
1253
|
+
* Builtin tools this agent must NOT declare to the model. Absent or empty ⇒ every builtin the
|
|
1254
|
+
* rest of the configuration would register is declared, exactly as before this option existed.
|
|
1255
|
+
*
|
|
1256
|
+
* WHY WITHHOLDING IS NOT THE SAME AS DENYING. A consumer that cannot allow `shell` — because it
|
|
1257
|
+
* reaches outside their own sandbox scope — can already refuse the call in a `pre_tool_call` hook
|
|
1258
|
+
* or with a {@link PermissionEngine} deny rule. That stops the execution and pays for the offer
|
|
1259
|
+
* twice over: the schema rides in EVERY request of EVERY round (measured at 267 characters for
|
|
1260
|
+
* `shell`, 1,462 for `memory_search` + `memory_get` together — usetheokit/theokit-sdk#381), and
|
|
1261
|
+
* the model can spend a whole round discovering a refusal it had no way to anticipate. Declaring
|
|
1262
|
+
* a tool that is guaranteed to be refused is the wrong shape; withholding removes it from the
|
|
1263
|
+
* catalog, so the model is never offered what it cannot have.
|
|
1264
|
+
*
|
|
1265
|
+
* WITHHOLDING RELEASES THE NAME. `withheldBuiltinTools: ["shell"]` lets {@link AgentOptions.tools}
|
|
1266
|
+
* declare a tool called `shell` without the `tool_reserved_name` error — the reservation exists to
|
|
1267
|
+
* stop a collision with the SDK's own tool, and there is no longer one to collide with. Every
|
|
1268
|
+
* builtin still declared stays reserved.
|
|
1269
|
+
*
|
|
1270
|
+
* This governs DECLARATION, not authorization. A withheld builtin is simply absent from the
|
|
1271
|
+
* catalog: a model that invents the name anyway gets `Unknown tool <name>` (exit 127) rather than
|
|
1272
|
+
* an execution, but nothing here evaluates a policy. Keep the deny rule if you need one that a
|
|
1273
|
+
* per-send `tools` override cannot reopen.
|
|
1274
|
+
*
|
|
1275
|
+
* @public
|
|
1276
|
+
*/
|
|
1277
|
+
withheldBuiltinTools?: readonly BuiltinToolName[];
|
|
1223
1278
|
/**
|
|
1224
1279
|
* SE37 — opt-in reasoning. When `true`, the agent gets a chain-of-thought
|
|
1225
1280
|
* preamble prepended to its system prompt AND the `think` reasoning tool
|
|
@@ -1583,4 +1638,4 @@ interface ListResult<T> {
|
|
|
1583
1638
|
nextCursor?: string;
|
|
1584
1639
|
}
|
|
1585
1640
|
|
|
1586
|
-
export { type
|
|
1641
|
+
export { type SystemPromptMemoryFact as $, type AgentOptions as A, type BudgetTracker as B, type CloudOptions as C, type PluginContext as D, type PostAssistantReplyContext as E, type PostToolCallContext as F, type GetAgentOptions as G, type HookName as H, type InlineSkill as I, type PreToolCallContext as J, type PreUserSendContext as K, type LocalOptions as L, type MemorySettings as M, type PreUserSendResult as N, type ProviderTransform as O, type Plugin as P, type ProviderTransformContext as Q, type RecordSessionSummaryArgs as R, type SystemPromptResolver as S, type SessionLifecycleContext as T, type SessionRecord as U, type SessionStore as V, type SettingSource as W, Skill as X, type SkillsResolver as Y, type SkillsResolverContext as Z, type SystemPromptContext as _, type AgentDefinition as a, type TelemetrySettings as a0, type ToolCallSummary as a1, type ToolResultTransformContext as a2, type TransformContext as a3, type SkillsSettings as b, type ListAgentsOptions as c, type ListResult as d, type SDKAgentInfo as e, type ListRunsOptions as f, type GetRunOptions as g, type AgentOperationOptions as h, type AgentDescription as i, type ProviderProfile as j, type MemoryProvider as k, type PreToolCallDecision as l, type ActiveMemoryPassArgs as m, type ActiveMemoryPassResult as n, type AgentSubagentDescription as o, type AgentToolDescription as p, type BudgetCheck as q, type BudgetTotal as r, type BudgetUsageEvent as s, type BuiltinToolName as t, type CloudEnv as u, type CloudRepo as v, type CreateSkillSpec as w, type MemoryProviderFactory as x, type MemoryProviderHandle as y, type MemoryProviderInitOptions as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { Agent } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { Agent } from './chunk-KBXWEWKS.js';
|
|
2
|
+
import './chunk-OHBIUXKM.js';
|
|
3
|
+
import './chunk-ODTZ7HX3.js';
|
|
4
4
|
import './chunk-YMA4S2WO.js';
|
|
5
5
|
import './chunk-2SFBB54R.js';
|
|
6
6
|
import './chunk-SUKXXLWD.js';
|
|
@@ -8,13 +8,14 @@ import './chunk-K2BQQ445.js';
|
|
|
8
8
|
import './chunk-XN7NOENA.js';
|
|
9
9
|
import './chunk-H73MEMQB.js';
|
|
10
10
|
import './chunk-GJ6RK75E.js';
|
|
11
|
-
import './chunk-
|
|
11
|
+
import './chunk-MVAPK2BX.js';
|
|
12
12
|
import './chunk-3E77SX4H.js';
|
|
13
13
|
import './chunk-WTMU7J4U.js';
|
|
14
14
|
import './chunk-5JLFFPCH.js';
|
|
15
15
|
import './chunk-BMAZLQQ4.js';
|
|
16
16
|
import './chunk-HKCKOAIO.js';
|
|
17
|
-
import './chunk-
|
|
17
|
+
import './chunk-7FHZ4VQX.js';
|
|
18
|
+
import './chunk-KVNWIAO4.js';
|
|
18
19
|
import './chunk-UPRJR6IP.js';
|
|
19
20
|
import './chunk-FD2UT76F.js';
|
|
20
21
|
import './chunk-4VPXM6UU.js';
|
|
@@ -40,13 +41,13 @@ import './chunk-2QKTVKH3.js';
|
|
|
40
41
|
import './chunk-AG5JPQIY.js';
|
|
41
42
|
import './chunk-F7AQV62G.js';
|
|
42
43
|
import './chunk-R7WIIPUR.js';
|
|
43
|
-
import './chunk-
|
|
44
|
-
import './chunk-
|
|
44
|
+
import './chunk-2BDH744Z.js';
|
|
45
|
+
import './chunk-Q4CMI2LP.js';
|
|
45
46
|
import './chunk-44MBDIHG.js';
|
|
46
47
|
import './chunk-UQGQFBRL.js';
|
|
47
48
|
import './chunk-3OR54XG4.js';
|
|
48
49
|
import './chunk-IDCKSLYH.js';
|
|
49
50
|
import './chunk-T7XEKOVW.js';
|
|
50
51
|
import './chunk-T7O6K6PX.js';
|
|
51
|
-
//# sourceMappingURL=agent-
|
|
52
|
-
//# sourceMappingURL=agent-
|
|
52
|
+
//# sourceMappingURL=agent-K3PQBS7D.js.map
|
|
53
|
+
//# sourceMappingURL=agent-K3PQBS7D.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-K3PQBS7D.js"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var chunkLQYQHXIW_cjs = require('./chunk-LQYQHXIW.cjs');
|
|
4
|
+
require('./chunk-V2UUGUY4.cjs');
|
|
5
|
+
require('./chunk-6VLKVX7O.cjs');
|
|
6
6
|
require('./chunk-53CBTBWO.cjs');
|
|
7
7
|
require('./chunk-BV2MWEMV.cjs');
|
|
8
8
|
require('./chunk-NGESVVJN.cjs');
|
|
@@ -10,13 +10,14 @@ require('./chunk-BUUUWQMB.cjs');
|
|
|
10
10
|
require('./chunk-EI2Q7SJ5.cjs');
|
|
11
11
|
require('./chunk-GHX4P3V2.cjs');
|
|
12
12
|
require('./chunk-YPJ5NH5N.cjs');
|
|
13
|
-
require('./chunk-
|
|
13
|
+
require('./chunk-HLPSLDGL.cjs');
|
|
14
14
|
require('./chunk-F3YZMOAU.cjs');
|
|
15
15
|
require('./chunk-4OTIXDMU.cjs');
|
|
16
16
|
require('./chunk-DQKERTND.cjs');
|
|
17
17
|
require('./chunk-CTCGWIUD.cjs');
|
|
18
18
|
require('./chunk-2ZPEDVLM.cjs');
|
|
19
|
-
require('./chunk-
|
|
19
|
+
require('./chunk-E3WZ6Y4H.cjs');
|
|
20
|
+
require('./chunk-KRD3GQAA.cjs');
|
|
20
21
|
require('./chunk-U2AC6JUP.cjs');
|
|
21
22
|
require('./chunk-MUUQ2WFJ.cjs');
|
|
22
23
|
require('./chunk-WJVHMTKB.cjs');
|
|
@@ -42,8 +43,8 @@ require('./chunk-HJBMA5MB.cjs');
|
|
|
42
43
|
require('./chunk-IWBGCBR6.cjs');
|
|
43
44
|
require('./chunk-XSX2UU6Y.cjs');
|
|
44
45
|
require('./chunk-3EE6LVWT.cjs');
|
|
45
|
-
require('./chunk-
|
|
46
|
-
require('./chunk-
|
|
46
|
+
require('./chunk-6HTXPPHK.cjs');
|
|
47
|
+
require('./chunk-NIRE5CNO.cjs');
|
|
47
48
|
require('./chunk-5USCYPPI.cjs');
|
|
48
49
|
require('./chunk-BVZW2B5V.cjs');
|
|
49
50
|
require('./chunk-52NKC5HT.cjs');
|
|
@@ -55,7 +56,7 @@ require('./chunk-NUKRL3I6.cjs');
|
|
|
55
56
|
|
|
56
57
|
Object.defineProperty(exports, "Agent", {
|
|
57
58
|
enumerable: true,
|
|
58
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunkLQYQHXIW_cjs.Agent; }
|
|
59
60
|
});
|
|
60
|
-
//# sourceMappingURL=agent-
|
|
61
|
-
//# sourceMappingURL=agent-
|
|
61
|
+
//# sourceMappingURL=agent-PJMBK7HQ.cjs.map
|
|
62
|
+
//# sourceMappingURL=agent-PJMBK7HQ.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-PJMBK7HQ.cjs"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { registerBuiltins, listProviders, getProviderProfile } from './chunk-
|
|
1
|
+
import { registerBuiltins, listProviders, getProviderProfile } from './chunk-Q4CMI2LP.js';
|
|
2
2
|
|
|
3
3
|
// src/providers.ts
|
|
4
4
|
function listProviders2() {
|
|
@@ -11,5 +11,5 @@ function getProviderProfile2(name) {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export { getProviderProfile2 as getProviderProfile, listProviders2 as listProviders };
|
|
14
|
-
//# sourceMappingURL=chunk-
|
|
15
|
-
//# sourceMappingURL=chunk-
|
|
14
|
+
//# sourceMappingURL=chunk-2BDH744Z.js.map
|
|
15
|
+
//# sourceMappingURL=chunk-2BDH744Z.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/providers.ts"],"names":["listProviders","getProviderProfile"],"mappings":";;;AA4BO,SAASA,cAAAA,GAA4C;AAC1D,EAAA,gBAAA,EAAiB;AACjB,EAAA,OAAO,aAAA,EAAa;AACtB;AAQO,SAASC,oBAAmB,IAAA,EAA2C;AAC5E,EAAA,gBAAA,EAAiB;AACjB,EAAA,OAAO,mBAAW,IAAI,CAAA;AACxB","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/providers.ts"],"names":["listProviders","getProviderProfile"],"mappings":";;;AA4BO,SAASA,cAAAA,GAA4C;AAC1D,EAAA,gBAAA,EAAiB;AACjB,EAAA,OAAO,aAAA,EAAa;AACtB;AAQO,SAASC,oBAAmB,IAAA,EAA2C;AAC5E,EAAA,gBAAA,EAAiB;AACjB,EAAA,OAAO,mBAAW,IAAI,CAAA;AACxB","file":"chunk-2BDH744Z.js","sourcesContent":["/**\n * The provider registry, as public API.\n *\n * It was `@internal`, which meant the SDK was the only thing that could answer \"which providers\n * exist, and what does each one need?\". `theokit` consequently kept a hand-written list of three —\n * against the 46 registered here — so an agent declaring `ollama/qwen2.5:3b` routed to whatever\n * key happened to be set instead of to Ollama (usetheokit/theokit#326).\n *\n * A second table that nothing forces to agree with the first is not a cache, it is a future bug.\n * These two functions exist so there is one table.\n *\n * Both ensure the builtins are registered before answering: registration is lazy (it happens when\n * an agent is created, a run is routed, or a provider is defined), so a caller asking early would\n * otherwise get an empty registry and reasonably conclude the SDK knows nothing.\n */\n\nimport { registerBuiltins } from \"./internal/providers/builtin/index.js\";\nimport {\n getProviderProfile as getProfile,\n listProviders as listProfiles,\n} from \"./internal/providers/registry.js\";\nimport type { ProviderProfile } from \"./internal/providers/types.js\";\n\n/**\n * Every registered provider — builtins, the JSON catalog, and anything a plugin registered.\n *\n * @public\n */\nexport function listProviders(): readonly ProviderProfile[] {\n registerBuiltins();\n return listProfiles();\n}\n\n/**\n * One provider by name or alias (`lm-studio` resolves to `lmstudio`), or `undefined` when nothing\n * has registered it.\n *\n * @public\n */\nexport function getProviderProfile(name: string): ProviderProfile | undefined {\n registerBuiltins();\n return getProfile(name);\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkNIRE5CNO_cjs = require('./chunk-NIRE5CNO.cjs');
|
|
4
|
+
|
|
5
|
+
// src/providers.ts
|
|
6
|
+
function listProviders2() {
|
|
7
|
+
chunkNIRE5CNO_cjs.registerBuiltins();
|
|
8
|
+
return chunkNIRE5CNO_cjs.listProviders();
|
|
9
|
+
}
|
|
10
|
+
function getProviderProfile2(name) {
|
|
11
|
+
chunkNIRE5CNO_cjs.registerBuiltins();
|
|
12
|
+
return chunkNIRE5CNO_cjs.getProviderProfile(name);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.getProviderProfile = getProviderProfile2;
|
|
16
|
+
exports.listProviders = listProviders2;
|
|
17
|
+
//# sourceMappingURL=chunk-6HTXPPHK.cjs.map
|
|
18
|
+
//# sourceMappingURL=chunk-6HTXPPHK.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/providers.ts"],"names":["listProviders","registerBuiltins","getProviderProfile"],"mappings":";;;;;AA4BO,SAASA,cAAAA,GAA4C;AAC1D,EAAAC,kCAAA,EAAiB;AACjB,EAAA,OAAOD,+BAAA,EAAa;AACtB;AAQO,SAASE,oBAAmB,IAAA,EAA2C;AAC5E,EAAAD,kCAAA,EAAiB;AACjB,EAAA,OAAOC,qCAAW,IAAI,CAAA;AACxB","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/providers.ts"],"names":["listProviders","registerBuiltins","getProviderProfile"],"mappings":";;;;;AA4BO,SAASA,cAAAA,GAA4C;AAC1D,EAAAC,kCAAA,EAAiB;AACjB,EAAA,OAAOD,+BAAA,EAAa;AACtB;AAQO,SAASE,oBAAmB,IAAA,EAA2C;AAC5E,EAAAD,kCAAA,EAAiB;AACjB,EAAA,OAAOC,qCAAW,IAAI,CAAA;AACxB","file":"chunk-6HTXPPHK.cjs","sourcesContent":["/**\n * The provider registry, as public API.\n *\n * It was `@internal`, which meant the SDK was the only thing that could answer \"which providers\n * exist, and what does each one need?\". `theokit` consequently kept a hand-written list of three —\n * against the 46 registered here — so an agent declaring `ollama/qwen2.5:3b` routed to whatever\n * key happened to be set instead of to Ollama (usetheokit/theokit#326).\n *\n * A second table that nothing forces to agree with the first is not a cache, it is a future bug.\n * These two functions exist so there is one table.\n *\n * Both ensure the builtins are registered before answering: registration is lazy (it happens when\n * an agent is created, a run is routed, or a provider is defined), so a caller asking early would\n * otherwise get an empty registry and reasonably conclude the SDK knows nothing.\n */\n\nimport { registerBuiltins } from \"./internal/providers/builtin/index.js\";\nimport {\n getProviderProfile as getProfile,\n listProviders as listProfiles,\n} from \"./internal/providers/registry.js\";\nimport type { ProviderProfile } from \"./internal/providers/types.js\";\n\n/**\n * Every registered provider — builtins, the JSON catalog, and anything a plugin registered.\n *\n * @public\n */\nexport function listProviders(): readonly ProviderProfile[] {\n registerBuiltins();\n return listProfiles();\n}\n\n/**\n * One provider by name or alias (`lm-studio` resolves to `lmstudio`), or `undefined` when nothing\n * has registered it.\n *\n * @public\n */\nexport function getProviderProfile(name: string): ProviderProfile | undefined {\n registerBuiltins();\n return getProfile(name);\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkGHX4P3V2_cjs = require('./chunk-GHX4P3V2.cjs');
|
|
4
|
+
var chunkKRD3GQAA_cjs = require('./chunk-KRD3GQAA.cjs');
|
|
4
5
|
var chunkR3UPQFKK_cjs = require('./chunk-R3UPQFKK.cjs');
|
|
5
6
|
var chunkSKXBJ2NU_cjs = require('./chunk-SKXBJ2NU.cjs');
|
|
6
7
|
var chunkZF2LDKQQ_cjs = require('./chunk-ZF2LDKQQ.cjs');
|
|
@@ -77,7 +78,7 @@ function defaultIndexPath(cwd) {
|
|
|
77
78
|
}
|
|
78
79
|
function requireLance() {
|
|
79
80
|
try {
|
|
80
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
81
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-6VLKVX7O.cjs', document.baseURI).href)));
|
|
81
82
|
return r("@lancedb/lancedb");
|
|
82
83
|
} catch (cause) {
|
|
83
84
|
throw new chunkK3FW2XZD_cjs.ConfigurationError(
|
|
@@ -300,6 +301,7 @@ async function openLanceIndex(opts) {
|
|
|
300
301
|
});
|
|
301
302
|
return new LanceMemoryAdapter(lance);
|
|
302
303
|
}
|
|
304
|
+
var MEMORY_KINDS = ["user", "feedback", "project", "reference"];
|
|
303
305
|
function legacyMemoryJsonPath(cwd, config) {
|
|
304
306
|
if (config.storePath !== void 0) {
|
|
305
307
|
return path.resolve(cwd, config.storePath);
|
|
@@ -310,6 +312,54 @@ function legacyMemoryJsonPath(cwd, config) {
|
|
|
310
312
|
return chunkR3UPQFKK_cjs.safePathJoin(cwd, ".theokit", "memory", namespace, `${scope}-${userId}.json`);
|
|
311
313
|
}
|
|
312
314
|
|
|
315
|
+
// src/internal/memory/storage/memory-file.ts
|
|
316
|
+
var SAFE_SLUG = /^[a-z0-9][a-z0-9_-]*$/;
|
|
317
|
+
var MAX_SLUG_LENGTH = 64;
|
|
318
|
+
function slugForFact(text) {
|
|
319
|
+
const slug = text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, MAX_SLUG_LENGTH).replace(/-+$/, "");
|
|
320
|
+
return SAFE_SLUG.test(slug) ? slug : chunkR3UPQFKK_cjs.safeFilenameForId(text);
|
|
321
|
+
}
|
|
322
|
+
function renderMemoryFile(fields) {
|
|
323
|
+
const metadata = [" node_type: memory"];
|
|
324
|
+
if (fields.kind !== void 0) metadata.push(` type: ${fields.kind}`);
|
|
325
|
+
if (fields.modified !== void 0) metadata.push(` modified: ${fields.modified}`);
|
|
326
|
+
return [
|
|
327
|
+
"---",
|
|
328
|
+
`name: ${fields.name}`,
|
|
329
|
+
`description: ${JSON.stringify(fields.description)}`,
|
|
330
|
+
"metadata:",
|
|
331
|
+
...metadata,
|
|
332
|
+
"---",
|
|
333
|
+
"",
|
|
334
|
+
fields.body,
|
|
335
|
+
""
|
|
336
|
+
].join("\n");
|
|
337
|
+
}
|
|
338
|
+
function parseMemoryFile(raw) {
|
|
339
|
+
const { yaml, body } = chunkKRD3GQAA_cjs.splitFrontmatter(raw);
|
|
340
|
+
if (yaml === void 0) return void 0;
|
|
341
|
+
let fields;
|
|
342
|
+
try {
|
|
343
|
+
fields = chunkKRD3GQAA_cjs.parseSimpleYaml(yaml);
|
|
344
|
+
} catch {
|
|
345
|
+
return void 0;
|
|
346
|
+
}
|
|
347
|
+
const name = fields.name;
|
|
348
|
+
const description = fields.description;
|
|
349
|
+
if (typeof name !== "string" || typeof description !== "string") return void 0;
|
|
350
|
+
const metadata = fields.metadata ?? {};
|
|
351
|
+
const rawKind = metadata.type;
|
|
352
|
+
const kind = typeof rawKind === "string" && MEMORY_KINDS.includes(rawKind) ? rawKind : void 0;
|
|
353
|
+
const modified = typeof metadata.modified === "string" ? metadata.modified : void 0;
|
|
354
|
+
return {
|
|
355
|
+
name,
|
|
356
|
+
description,
|
|
357
|
+
...kind !== void 0 ? { kind } : {},
|
|
358
|
+
...modified !== void 0 ? { modified } : {},
|
|
359
|
+
body: body.trim()
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
|
|
313
363
|
// src/internal/memory/storage/markdown-store.ts
|
|
314
364
|
var MEMORY_MD_HEADER = "# Memory\n\n> Auto-managed by @theokit/sdk. Edit freely \u2014 the SDK reads from here.\n";
|
|
315
365
|
var FACTS_HEADING = "## Facts";
|
|
@@ -323,65 +373,86 @@ function notesDir(cwd) {
|
|
|
323
373
|
return path.join(memoryDir(cwd), "notes");
|
|
324
374
|
}
|
|
325
375
|
async function readFactsFromMarkdown(cwd) {
|
|
326
|
-
let
|
|
376
|
+
let entries;
|
|
327
377
|
try {
|
|
328
|
-
|
|
378
|
+
entries = await promises.readdir(memoryDir(cwd));
|
|
329
379
|
} catch {
|
|
330
380
|
return [];
|
|
331
381
|
}
|
|
332
|
-
|
|
382
|
+
const facts = [];
|
|
383
|
+
for (const entry of entries.sort()) {
|
|
384
|
+
const fact = await readMemoryFileAt(cwd, entry);
|
|
385
|
+
if (fact !== void 0) facts.push(fact);
|
|
386
|
+
}
|
|
387
|
+
try {
|
|
388
|
+
facts.push(...parseFactsSection(await promises.readFile(memoryMdPath(cwd), "utf8")));
|
|
389
|
+
} catch {
|
|
390
|
+
}
|
|
391
|
+
return facts;
|
|
392
|
+
}
|
|
393
|
+
async function readMemoryFileAt(cwd, entry) {
|
|
394
|
+
if (!entry.endsWith(".md") || entry === "MEMORY.md") return void 0;
|
|
395
|
+
let raw;
|
|
396
|
+
try {
|
|
397
|
+
raw = await promises.readFile(path.join(memoryDir(cwd), entry), "utf8");
|
|
398
|
+
} catch {
|
|
399
|
+
return void 0;
|
|
400
|
+
}
|
|
401
|
+
const parsed = parseMemoryFile(raw);
|
|
402
|
+
if (parsed === void 0) return void 0;
|
|
403
|
+
return {
|
|
404
|
+
text: parsed.description,
|
|
405
|
+
...parsed.kind !== void 0 ? { kind: parsed.kind } : {},
|
|
406
|
+
...parsed.modified !== void 0 ? { modified: parsed.modified } : {}
|
|
407
|
+
};
|
|
333
408
|
}
|
|
334
409
|
function appendFactToMarkdown(cwd, fact) {
|
|
335
410
|
return chunkZF2LDKQQ_cjs.withCwdMutex(memoryDir(cwd), async () => {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
raw = "";
|
|
411
|
+
if (fact.kind !== void 0 && !MEMORY_KINDS.includes(fact.kind)) {
|
|
412
|
+
throw new chunkK3FW2XZD_cjs.ConfigurationError(
|
|
413
|
+
`Unknown memory fact kind "${fact.kind}". Expected one of: ${MEMORY_KINDS.join(", ")}.`,
|
|
414
|
+
{ code: "invalid_memory_kind" }
|
|
415
|
+
);
|
|
342
416
|
}
|
|
343
|
-
const
|
|
344
|
-
const
|
|
417
|
+
const text = chunkJTB5Q42C_cjs.redactSecrets(fact.text);
|
|
418
|
+
const name = slugForFact(text);
|
|
345
419
|
await promises.mkdir(memoryDir(cwd), { recursive: true });
|
|
346
|
-
await chunkI6TGFUCO_cjs.replaceFileAtomic(
|
|
420
|
+
await chunkI6TGFUCO_cjs.replaceFileAtomic(
|
|
421
|
+
path.join(memoryDir(cwd), `${name}.md`),
|
|
422
|
+
renderMemoryFile({
|
|
423
|
+
name,
|
|
424
|
+
description: text,
|
|
425
|
+
...fact.kind !== void 0 ? { kind: fact.kind } : {},
|
|
426
|
+
modified: (/* @__PURE__ */ new Date()).toISOString(),
|
|
427
|
+
body: text
|
|
428
|
+
})
|
|
429
|
+
);
|
|
430
|
+
await chunkI6TGFUCO_cjs.replaceFileAtomic(memoryMdPath(cwd), await nextIndex(cwd, text, name));
|
|
347
431
|
});
|
|
348
432
|
}
|
|
433
|
+
async function nextIndex(cwd, text, name) {
|
|
434
|
+
let existing = "";
|
|
435
|
+
try {
|
|
436
|
+
existing = await promises.readFile(memoryMdPath(cwd), "utf8");
|
|
437
|
+
} catch {
|
|
438
|
+
existing = "";
|
|
439
|
+
}
|
|
440
|
+
const entry = `- [${text}](${name}.md)`;
|
|
441
|
+
const kept = existing.split("\n").filter((line) => !line.startsWith(`- [`) || !line.includes(`](${name}.md)`));
|
|
442
|
+
const body = kept.join("\n").trimEnd();
|
|
443
|
+
const head = body.length > 0 ? body : MEMORY_MD_HEADER.trimEnd();
|
|
444
|
+
return `${head}
|
|
445
|
+
${entry}
|
|
446
|
+
`;
|
|
447
|
+
}
|
|
448
|
+
var INDEX_ENTRY = /^\[[^\]]*\]\([^)]+\.md\)$/;
|
|
349
449
|
function parseFactsSection(raw) {
|
|
350
450
|
const idx = raw.indexOf(FACTS_HEADING);
|
|
351
451
|
if (idx === -1) return [];
|
|
352
452
|
const tail = raw.slice(idx + FACTS_HEADING.length);
|
|
353
453
|
const nextHeading = tail.search(/\n#{1,2}\s/);
|
|
354
454
|
const block = nextHeading === -1 ? tail : tail.slice(0, nextHeading);
|
|
355
|
-
return block.split("\n").map((line) => line.trim()).filter((line) => line.startsWith("- ")).map((line) =>
|
|
356
|
-
}
|
|
357
|
-
function insertFactBullet(raw, fact) {
|
|
358
|
-
const bullet = `- ${fact}`;
|
|
359
|
-
if (raw.length === 0) {
|
|
360
|
-
return `${MEMORY_MD_HEADER}
|
|
361
|
-
${FACTS_HEADING}
|
|
362
|
-
|
|
363
|
-
${bullet}
|
|
364
|
-
`;
|
|
365
|
-
}
|
|
366
|
-
const idx = raw.indexOf(FACTS_HEADING);
|
|
367
|
-
if (idx === -1) {
|
|
368
|
-
const sep = raw.endsWith("\n") ? "" : "\n";
|
|
369
|
-
return `${raw}${sep}
|
|
370
|
-
${FACTS_HEADING}
|
|
371
|
-
|
|
372
|
-
${bullet}
|
|
373
|
-
`;
|
|
374
|
-
}
|
|
375
|
-
const after = idx + FACTS_HEADING.length;
|
|
376
|
-
const nextHeading = raw.slice(after).search(/\n#{1,2}\s/);
|
|
377
|
-
if (nextHeading === -1) {
|
|
378
|
-
const trailing = raw.endsWith("\n") ? "" : "\n";
|
|
379
|
-
return `${raw}${trailing}${bullet}
|
|
380
|
-
`;
|
|
381
|
-
}
|
|
382
|
-
const insertAt = after + nextHeading;
|
|
383
|
-
return `${raw.slice(0, insertAt)}
|
|
384
|
-
${bullet}${raw.slice(insertAt)}`;
|
|
455
|
+
return block.split("\n").map((line) => line.trim()).filter((line) => line.startsWith("- ")).map((line) => line.slice(2).trim()).filter((body) => !INDEX_ENTRY.test(body)).map((body) => ({ text: body }));
|
|
385
456
|
}
|
|
386
457
|
async function readFacts(cwd, config) {
|
|
387
458
|
if (!config.enabled) return [];
|
|
@@ -495,6 +566,19 @@ function blendScores(hit, vectorScore, weights) {
|
|
|
495
566
|
...vectorScore > 0 ? { vectorScore } : {}
|
|
496
567
|
};
|
|
497
568
|
}
|
|
569
|
+
async function markdownFilesIn(dir, root, skip = []) {
|
|
570
|
+
let entries;
|
|
571
|
+
try {
|
|
572
|
+
entries = await promises.readdir(dir);
|
|
573
|
+
} catch {
|
|
574
|
+
return [];
|
|
575
|
+
}
|
|
576
|
+
return entries.filter((entry) => entry.endsWith(".md") && !skip.includes(entry)).map((entry) => ({
|
|
577
|
+
absolutePath: path.join(dir, entry),
|
|
578
|
+
relPath: path.relative(root, path.join(dir, entry)),
|
|
579
|
+
source: "memory"
|
|
580
|
+
}));
|
|
581
|
+
}
|
|
498
582
|
async function collectMarkdownFiles(cwd) {
|
|
499
583
|
const root = memoryDir(cwd);
|
|
500
584
|
const results = [];
|
|
@@ -507,15 +591,8 @@ async function collectMarkdownFiles(cwd) {
|
|
|
507
591
|
});
|
|
508
592
|
} catch {
|
|
509
593
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
for (const entry of entries) {
|
|
513
|
-
if (!entry.endsWith(".md")) continue;
|
|
514
|
-
const abs = path.join(notesDir(cwd), entry);
|
|
515
|
-
results.push({ absolutePath: abs, relPath: path.relative(root, abs), source: "memory" });
|
|
516
|
-
}
|
|
517
|
-
} catch {
|
|
518
|
-
}
|
|
594
|
+
results.push(...await markdownFilesIn(memoryDir(cwd), root, ["MEMORY.md"]));
|
|
595
|
+
results.push(...await markdownFilesIn(notesDir(cwd), root));
|
|
519
596
|
const wikiFiles = await discoverWikiFiles(cwd);
|
|
520
597
|
for (const wiki of wikiFiles) {
|
|
521
598
|
results.push({
|
|
@@ -983,5 +1060,5 @@ exports.openMemoryDb = openMemoryDb;
|
|
|
983
1060
|
exports.readFacts = readFacts;
|
|
984
1061
|
exports.readFactsFromMarkdown = readFactsFromMarkdown;
|
|
985
1062
|
exports.writeSessionSummary = writeSessionSummary;
|
|
986
|
-
//# sourceMappingURL=chunk-
|
|
987
|
-
//# sourceMappingURL=chunk-
|
|
1063
|
+
//# sourceMappingURL=chunk-6VLKVX7O.cjs.map
|
|
1064
|
+
//# sourceMappingURL=chunk-6VLKVX7O.cjs.map
|