@theokit/sdk 5.1.0 → 5.2.1

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.
Files changed (56) hide show
  1. package/CHANGELOG.md +122 -0
  2. package/dist/{agent-ARLOD4JX.cjs → agent-GACKKINM.cjs} +7 -7
  3. package/dist/{agent-ARLOD4JX.cjs.map → agent-GACKKINM.cjs.map} +1 -1
  4. package/dist/{agent-N6WJ54ML.js → agent-VUNM33WJ.js} +6 -6
  5. package/dist/{agent-N6WJ54ML.js.map → agent-VUNM33WJ.js.map} +1 -1
  6. package/dist/{chunk-OYD3U3LY.js → chunk-43H4EBS2.js} +7 -7
  7. package/dist/{chunk-OYD3U3LY.js.map → chunk-43H4EBS2.js.map} +1 -1
  8. package/dist/{chunk-AW6F6HZR.js → chunk-AI4MXACC.js} +3 -3
  9. package/dist/{chunk-AW6F6HZR.js.map → chunk-AI4MXACC.js.map} +1 -1
  10. package/dist/{chunk-D3CCY3A2.cjs → chunk-DEJCKB65.cjs} +39 -39
  11. package/dist/{chunk-D3CCY3A2.cjs.map → chunk-DEJCKB65.cjs.map} +1 -1
  12. package/dist/{chunk-OQRGVTQF.js → chunk-DLFWMJE3.js} +3 -3
  13. package/dist/{chunk-OQRGVTQF.js.map → chunk-DLFWMJE3.js.map} +1 -1
  14. package/dist/{chunk-NYQ3IS7K.cjs → chunk-DWB3CN46.cjs} +8 -3
  15. package/dist/chunk-DWB3CN46.cjs.map +1 -0
  16. package/dist/{chunk-QYLZQ43D.cjs → chunk-IQBDR5YZ.cjs} +5 -5
  17. package/dist/{chunk-QYLZQ43D.cjs.map → chunk-IQBDR5YZ.cjs.map} +1 -1
  18. package/dist/{chunk-67SBTGMA.cjs → chunk-PEAOQMWE.cjs} +4 -4
  19. package/dist/{chunk-67SBTGMA.cjs.map → chunk-PEAOQMWE.cjs.map} +1 -1
  20. package/dist/{chunk-WMWEI3NS.js → chunk-RP3VXJMA.js} +8 -3
  21. package/dist/chunk-RP3VXJMA.js.map +1 -0
  22. package/dist/{chunk-KGANQYP7.cjs → chunk-SSIRPWWD.cjs} +5 -5
  23. package/dist/{chunk-KGANQYP7.cjs.map → chunk-SSIRPWWD.cjs.map} +1 -1
  24. package/dist/{chunk-XU6MLSC6.js → chunk-WHTMFN4Q.js} +3 -3
  25. package/dist/{chunk-XU6MLSC6.js.map → chunk-WHTMFN4Q.js.map} +1 -1
  26. package/dist/{context-4QOEWRDF.cjs → context-3YMZDEX5.cjs} +7 -7
  27. package/dist/{context-4QOEWRDF.cjs.map → context-3YMZDEX5.cjs.map} +1 -1
  28. package/dist/context-XNREEC7M.js +6 -0
  29. package/dist/{context-Z3CFTT3H.js.map → context-XNREEC7M.js.map} +1 -1
  30. package/dist/cron.cjs +6 -6
  31. package/dist/cron.js +5 -5
  32. package/dist/eval.cjs +5 -5
  33. package/dist/eval.js +4 -4
  34. package/dist/index.cjs +64 -21
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.cts +66 -1
  37. package/dist/index.d.ts +66 -1
  38. package/dist/index.js +51 -9
  39. package/dist/index.js.map +1 -1
  40. package/dist/internal/persistence/index.cjs +4 -4
  41. package/dist/internal/persistence/index.js +1 -1
  42. package/dist/internal/runtime/compat/foreign-config-sources.d.ts +16 -6
  43. package/dist/subagents-loader-7G76XOZU.cjs +16 -0
  44. package/dist/{subagents-loader-GEHYCMEX.cjs.map → subagents-loader-7G76XOZU.cjs.map} +1 -1
  45. package/dist/subagents-loader-PAZVOZHI.js +7 -0
  46. package/dist/{subagents-loader-DOBTTICM.js.map → subagents-loader-PAZVOZHI.js.map} +1 -1
  47. package/dist/subagents-loader.cjs +3 -3
  48. package/dist/subagents-loader.js +2 -2
  49. package/docs/error-codes.md +2 -1
  50. package/docs/harness-capability-map.md +4 -1
  51. package/package.json +1 -1
  52. package/dist/chunk-NYQ3IS7K.cjs.map +0 -1
  53. package/dist/chunk-WMWEI3NS.js.map +0 -1
  54. package/dist/context-Z3CFTT3H.js +0 -6
  55. package/dist/subagents-loader-DOBTTICM.js +0 -7
  56. package/dist/subagents-loader-GEHYCMEX.cjs +0 -16
package/CHANGELOG.md CHANGED
@@ -1,5 +1,127 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#594](https://github.com/usetheokit/theokit-sdk/pull/594) [`9dc8cf5`](https://github.com/usetheokit/theokit-sdk/commit/9dc8cf52bee690bfb9cf55bee63bcda71d3132b3) Thanks [@usetheodev](https://github.com/usetheodev)! - `effectiveToolNames` refuses a created tool instead of answering confidently about it ([#583](https://github.com/usetheokit/theokit-sdk/issues/583) follow-up)
8
+
9
+ Every field on `AgentOptions` is optional, so the `CustomTool` that `SubAgent.create()` returns —
10
+ `{ name, description, inputSchema, handler }` — satisfies the type **by vacuity, with no cast**.
11
+ Measured: a `@ts-expect-error` on that call is reported unused (`TS2578`), so the compiler genuinely
12
+ does not refuse it.
13
+
14
+ What came back was worse than a wrong number:
15
+
16
+ ```ts
17
+ effectiveToolNames(SubAgent.create({ name: "analyst", … }))
18
+ // { names: ["shell"], unresolved: [] }
19
+ ```
20
+
21
+ The empty `unresolved` claims **completeness** about an object the function never understood. A
22
+ caller reads that as *"this subagent still announces a shell"* and either disbelieves a fix that
23
+ worked, or "fixes" something on the strength of it. That is the defect [#583](https://github.com/usetheokit/theokit-sdk/issues/583) exists to eliminate, one
24
+ function further on — and the same argument that made this return `{ names, unresolved }` rather than
25
+ a bare array forbids it.
26
+
27
+ It now throws a `ConfigurationError` naming what to pass instead. The detection is exact rather than
28
+ heuristic: `AgentOptions` declares neither `handler` nor `inputSchema`, so an object carrying **both**
29
+ is a tool and not options.
30
+
31
+ **The workaround is still needed, and the 5.2.0 notes should not have implied otherwise.**
32
+ `SubAgent.create()` closes its spec inside the handler, so the spec cannot be recovered from the
33
+ returned tool — keep it in a variable, or extract it into a function a test can call, and pass that.
34
+
35
+ Reported by the `theocode` session, against advice of mine that was wrong.
36
+
37
+ ## 5.2.0
38
+
39
+ ### Minor Changes
40
+
41
+ - [#585](https://github.com/usetheokit/theokit-sdk/pull/585) [`86bf6c1`](https://github.com/usetheokit/theokit-sdk/commit/86bf6c1ab90438835df5bb0d4a791596c58004ba) Thanks [@usetheodev](https://github.com/usetheodev)! - `effectiveToolNames` — ask what tools an agent will actually have ([#583](https://github.com/usetheokit/theokit-sdk/issues/583))
42
+
43
+ `Agent.describe()` was the only reflection surface, and it builds its catalog as
44
+ `(options.tools ?? [])` — literally the array the caller passed. The SDK's own builtins were never in
45
+ it, so the two states that matter most were indistinguishable:
46
+
47
+ ```
48
+ Agent.create({ tools: [] }) describe().tools = [] ← holds a shell
49
+ the same + withheldBuiltinTools: ["shell"] describe().tools = [] ← holds nothing
50
+ ```
51
+
52
+ A consumer confirming that a role declared read-only really is one had no instrument. What they did
53
+ instead, measured in a real session: ask the agent to enumerate its own catalog — needs a credential,
54
+ needs the network, and returns the list the *model* decided to write. That same session recorded a
55
+ subagent answering *"I can't run shell commands in this environment"* while its catalog listed
56
+ `shell`. An attempt measures the model's disposition; the catalog measures its authority.
57
+
58
+ ```ts
59
+ import { effectiveToolNames } from "@theokit/sdk";
60
+
61
+ const { names, unresolved } = effectiveToolNames({ tools: [], withheldBuiltinTools: ["shell"] });
62
+ // names: [] — the shell is genuinely gone
63
+ // unresolved: [] — nothing else could contribute, so [] is the whole catalog
64
+ ```
65
+
66
+ **Options in, not an agent id** — synchronous, credential-free, answerable *before* the agent runs,
67
+ so a test can compare what it declared against what the runtime will declare. `describe()` needs a
68
+ registered agent and answers too late for that.
69
+
70
+ **Not a bare array**, deliberately. MCP tools need a live connection; plugin tools and the reasoning
71
+ `think` tool are assembled per run. Returning `string[]` would rebuild the original defect one
72
+ function over. `unresolved` names the sources that are configured and could not be enumerated, and is
73
+ empty when none are — which is the only condition under which `names` may be read as complete.
74
+
75
+ Requested, with this exact shape and rationale, by the `theocode` session after it had to work around
76
+ the gap by extracting a subagent spec into a separate function just to assert on it.
77
+
78
+ ### Patch Changes
79
+
80
+ - Correct a version number in the 5.1.0 release notes
81
+
82
+ The 5.1.0 entry *"Snapshot versions now sort ABOVE the release they are cut from"* illustrates the
83
+ result as `5.0.2-compat-580-…`. **That digit was invented rather than derived.** The pending
84
+ changesets included a `minor`, so the calculated base was `5.1.0`, and the first cut after the change
85
+ printed:
86
+
87
+ ```
88
+ 5.1.0-compat-581-20260905211819
89
+ ```
90
+
91
+ A correction was written before the release and did not reach it: it lived in a pull request that had
92
+ not merged when `changeset version` consumed the changeset, so the uncorrected text shipped.
93
+
94
+ Recorded as a new entry rather than by editing the published one, per this project's changelog
95
+ discipline — a released entry is a record of what was said at the time, and rewriting it hides that
96
+ the correction happened.
97
+
98
+ **Why a wrong digit was worth two entries:** the property that mattered — sorting above `5.0.0` —
99
+ held with either number. An invented value that does not change the conclusion is the kind that stays
100
+ uncorrected forever, and a reader comparing the changelog against what they installed would have
101
+ found an unexplained discrepancy and rightly concluded one of the two was lying.
102
+
103
+ - [#585](https://github.com/usetheokit/theokit-sdk/pull/585) [`86bf6c1`](https://github.com/usetheokit/theokit-sdk/commit/86bf6c1ab90438835df5bb0d4a791596c58004ba) Thanks [@usetheodev](https://github.com/usetheodev)! - `CompatSurface` is declared once ([#586](https://github.com/usetheokit/theokit-sdk/issues/586))
104
+
105
+ It was declared twice, independently — `types/agent.ts` (public, typing
106
+ `AgentOptions.local.compatSources`) and `internal/runtime/compat/foreign-config-sources.ts` (typing
107
+ the admission logic and `persistence/paths.ts`). Neither imported the other.
108
+
109
+ Measured: adding a member to one alone produced **zero** type errors. Structurally identical unions
110
+ compare equal, so the two halves of one public contract could stop agreeing about which surfaces
111
+ exist, silently. Widen the public type and a caller declares a surface the admission logic ignores;
112
+ widen the internal one and the loader admits a surface no public caller can name. Both produce a
113
+ declaration that reads as honoured and is not.
114
+
115
+ `types/` is a leaf by design, so the public declaration stays and the internal module imports it.
116
+
117
+ The runtime list `COMPAT_SURFACES` cannot be derived from a type, so it remains a second copy of the
118
+ members — and a compile-time exhaustiveness check now pairs the two, in both directions.
119
+
120
+ **The first version of that check was decorative and this is worth recording:** annotating the list
121
+ `readonly CompatSurface[]` widens each entry back to `CompatSurface`, so the check compared a type
122
+ against itself and passed on any drift. It was caught by testing the guard rather than trusting it —
123
+ a member added to the public type produced zero errors. `as const satisfies` keeps the literals.
124
+
3
125
  ## 5.1.0
4
126
 
5
127
  ### Minor Changes
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunkD3CCY3A2_cjs = require('./chunk-D3CCY3A2.cjs');
3
+ var chunkDEJCKB65_cjs = require('./chunk-DEJCKB65.cjs');
4
4
  require('./chunk-KVSAY6NZ.cjs');
5
5
  require('./chunk-Y2KYR2ED.cjs');
6
6
  require('./chunk-BUUUWQMB.cjs');
7
7
  require('./chunk-Z2JFX372.cjs');
8
- require('./chunk-KGANQYP7.cjs');
8
+ require('./chunk-SSIRPWWD.cjs');
9
9
  require('./chunk-BV2MWEMV.cjs');
10
10
  require('./chunk-D6POWE7E.cjs');
11
11
  require('./chunk-GHX4P3V2.cjs');
@@ -43,8 +43,8 @@ require('./chunk-BJUJT5ED.cjs');
43
43
  require('./chunk-ZF2LDKQQ.cjs');
44
44
  require('./chunk-HCT4HPCL.cjs');
45
45
  require('./chunk-JLRLCBJ4.cjs');
46
- require('./chunk-QYLZQ43D.cjs');
47
- require('./chunk-NYQ3IS7K.cjs');
46
+ require('./chunk-IQBDR5YZ.cjs');
47
+ require('./chunk-DWB3CN46.cjs');
48
48
  require('./chunk-HW7SEELD.cjs');
49
49
  require('./chunk-ATT276RD.cjs');
50
50
  require('./chunk-3EE6LVWT.cjs');
@@ -61,7 +61,7 @@ require('./chunk-6LHQPOMI.cjs');
61
61
 
62
62
  Object.defineProperty(exports, "Agent", {
63
63
  enumerable: true,
64
- get: function () { return chunkD3CCY3A2_cjs.Agent; }
64
+ get: function () { return chunkDEJCKB65_cjs.Agent; }
65
65
  });
66
- //# sourceMappingURL=agent-ARLOD4JX.cjs.map
67
- //# sourceMappingURL=agent-ARLOD4JX.cjs.map
66
+ //# sourceMappingURL=agent-GACKKINM.cjs.map
67
+ //# sourceMappingURL=agent-GACKKINM.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"agent-ARLOD4JX.cjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"agent-GACKKINM.cjs"}
@@ -1,9 +1,9 @@
1
- export { Agent } from './chunk-OYD3U3LY.js';
1
+ export { Agent } from './chunk-43H4EBS2.js';
2
2
  import './chunk-K2VMFZQ5.js';
3
3
  import './chunk-AWINL3ZC.js';
4
4
  import './chunk-K2BQQ445.js';
5
5
  import './chunk-7SZAV6QG.js';
6
- import './chunk-AW6F6HZR.js';
6
+ import './chunk-AI4MXACC.js';
7
7
  import './chunk-2SFBB54R.js';
8
8
  import './chunk-55GB6JYQ.js';
9
9
  import './chunk-H73MEMQB.js';
@@ -41,8 +41,8 @@ import './chunk-TA3K7SBK.js';
41
41
  import './chunk-Q5EWJPRY.js';
42
42
  import './chunk-EIQFAOFD.js';
43
43
  import './chunk-3JHIFQ4I.js';
44
- import './chunk-OQRGVTQF.js';
45
- import './chunk-WMWEI3NS.js';
44
+ import './chunk-DLFWMJE3.js';
45
+ import './chunk-RP3VXJMA.js';
46
46
  import './chunk-JNAA4G4H.js';
47
47
  import './chunk-6M2OIS4Y.js';
48
48
  import './chunk-R7WIIPUR.js';
@@ -54,5 +54,5 @@ import './chunk-V22DZIXO.js';
54
54
  import './chunk-NJWYQWDL.js';
55
55
  import './chunk-ALUN2B4W.js';
56
56
  import './chunk-CZJ6Q7CW.js';
57
- //# sourceMappingURL=agent-N6WJ54ML.js.map
58
- //# sourceMappingURL=agent-N6WJ54ML.js.map
57
+ //# sourceMappingURL=agent-VUNM33WJ.js.map
58
+ //# sourceMappingURL=agent-VUNM33WJ.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"agent-N6WJ54ML.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"agent-VUNM33WJ.js"}
@@ -1,7 +1,7 @@
1
1
  import { submit, emitRunEvent } from './chunk-K2VMFZQ5.js';
2
2
  import { enqueueSessionWrite, hydrateSession, persistTurnToTranscript, flushSessionWrites, appendSessionMessage, getSessionMessages, discardSession, clearSession } from './chunk-AWINL3ZC.js';
3
3
  import { IndexManager } from './chunk-7SZAV6QG.js';
4
- import { loadHookConfig, warnOnce, currentPersonalityContext, warnPersonalitySwitchInsideFork } from './chunk-AW6F6HZR.js';
4
+ import { loadHookConfig, warnOnce, currentPersonalityContext, warnPersonalitySwitchInsideFork } from './chunk-AI4MXACC.js';
5
5
  import { extractCodePlugins } from './chunk-2SFBB54R.js';
6
6
  import { createOpenAiCompatibleRuntime } from './chunk-55GB6JYQ.js';
7
7
  import { persistActiveMemoryTranscript } from './chunk-OR6XIWLB.js';
@@ -24,8 +24,8 @@ import { expandTilde, defaultBaseDir } from './chunk-JOFVLOFY.js';
24
24
  import { withFileLock } from './chunk-TA3K7SBK.js';
25
25
  import { withCwdMutex } from './chunk-Q5EWJPRY.js';
26
26
  import { sweepStaleAtomicTemps, atomicWriteJson } from './chunk-3JHIFQ4I.js';
27
- import { loadSubagents, pluginBundleDirs } from './chunk-OQRGVTQF.js';
28
- import { reportUndeclaredSources, theokitConfigRoot, undefinedVariablesIn, getTheokitHome, adapterForConfigPath, projectConfigRoots, pluginBundleRoots } from './chunk-WMWEI3NS.js';
27
+ import { loadSubagents, pluginBundleDirs } from './chunk-DLFWMJE3.js';
28
+ import { reportUndeclaredSources, theokitConfigRoot, undefinedVariablesIn, getTheokitHome, adapterForConfigPath, projectConfigRoots, pluginBundleRoots } from './chunk-RP3VXJMA.js';
29
29
  import { readWorkspaceDir, parseSimpleYaml } from './chunk-JNAA4G4H.js';
30
30
  import { resolveEffectiveContextWindow, CONTEXT_WINDOW_FLOOR, CONTEXT_WINDOW_MARGIN } from './chunk-6M2OIS4Y.js';
31
31
  import { parseModelId } from './chunk-R7WIIPUR.js';
@@ -9116,7 +9116,7 @@ async function* localAgentStreamToCompletion(agent, message, options) {
9116
9116
  async function localAgentFork(parent, options) {
9117
9117
  const { forkAgentImpl } = await import('./fork-agent-S2EPIML7.js');
9118
9118
  const { getAgentFacade } = await import('./agent-factory-registry-ZVTABLEY.js');
9119
- const { withPersonalityContext } = await import('./context-Z3CFTT3H.js');
9119
+ const { withPersonalityContext } = await import('./context-XNREEC7M.js');
9120
9120
  const create = getAgentFacade().create;
9121
9121
  return withPersonalityContext(
9122
9122
  { slug: parent.personalitySlugSnapshot, isFork: true },
@@ -10889,7 +10889,7 @@ var Agent = class _Agent {
10889
10889
  */
10890
10890
  static async describe(agentId) {
10891
10891
  const agent = await getRegisteredAgentOrThrow(agentId);
10892
- const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-DOBTTICM.js');
10892
+ const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-PAZVOZHI.js');
10893
10893
  const settingSources = agent.options.local?.settingSources;
10894
10894
  const subagents = await loadSubagents2(
10895
10895
  agent.cwd ?? process.cwd(),
@@ -10977,5 +10977,5 @@ async function openLocalStore(reg) {
10977
10977
  }
10978
10978
 
10979
10979
  export { Agent, AgentBuilder, DEFAULT_AGENTIC_MODEL_ID, MEMORY_EMBEDDING_ADAPTERS, Tool, ToolError, UsageAccumulator, computeCost, generateCronId, getPricingEntry, openRouterMemoryEmbeddingProviderAdapter, resolveSessionDir };
10980
- //# sourceMappingURL=chunk-OYD3U3LY.js.map
10981
- //# sourceMappingURL=chunk-OYD3U3LY.js.map
10980
+ //# sourceMappingURL=chunk-43H4EBS2.js.map
10981
+ //# sourceMappingURL=chunk-43H4EBS2.js.map