@theokit/sdk 5.3.1 → 5.3.3
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 +44 -0
- package/dist/{agent-CvmTR9uf.d.ts → agent-CTbU0O1R.d.ts} +20 -1
- package/dist/{agent-UXU5AIOJ.cjs → agent-KJLAWKZB.cjs} +5 -5
- package/dist/{agent-UXU5AIOJ.cjs.map → agent-KJLAWKZB.cjs.map} +1 -1
- package/dist/{agent-G4OFQYLE.js → agent-PNYJ5S2Y.js} +4 -4
- package/dist/{agent-G4OFQYLE.js.map → agent-PNYJ5S2Y.js.map} +1 -1
- package/dist/{agent-C3KO5LKm.d.cts → agent-QLwxhXY3.d.cts} +20 -1
- package/dist/{chunk-ZFEOAC52.js → chunk-363RBGIR.js} +4 -4
- package/dist/{chunk-ZFEOAC52.js.map → chunk-363RBGIR.js.map} +1 -1
- package/dist/{chunk-SSIRPWWD.cjs → chunk-65UMH5V3.cjs} +9 -7
- package/dist/chunk-65UMH5V3.cjs.map +1 -0
- package/dist/{chunk-AI4MXACC.js → chunk-7L3MIW2F.js} +9 -7
- package/dist/chunk-7L3MIW2F.js.map +1 -0
- package/dist/{chunk-OZT6T2RI.cjs → chunk-L4XENLQO.cjs} +4 -4
- package/dist/{chunk-OZT6T2RI.cjs.map → chunk-L4XENLQO.cjs.map} +1 -1
- package/dist/{chunk-5XNRWMMD.cjs → chunk-Y46VI73J.cjs} +21 -21
- package/dist/{chunk-5XNRWMMD.cjs.map → chunk-Y46VI73J.cjs.map} +1 -1
- package/dist/{chunk-ZU3HQCKR.js → chunk-ZITYGJOD.js} +3 -3
- package/dist/{chunk-ZU3HQCKR.js.map → chunk-ZITYGJOD.js.map} +1 -1
- package/dist/{context-XNREEC7M.js → context-BUIE52VH.js} +3 -3
- package/dist/{context-XNREEC7M.js.map → context-BUIE52VH.js.map} +1 -1
- package/dist/{context-3YMZDEX5.cjs → context-FCCJQ3FN.cjs} +6 -6
- package/dist/{context-3YMZDEX5.cjs.map → context-FCCJQ3FN.cjs.map} +1 -1
- package/dist/{cron-crfMMdAw.d.ts → cron-Cl8FrK3D.d.ts} +1 -1
- package/dist/{cron-C3PhZED0.d.cts → cron-Dz8AOpy3.d.cts} +1 -1
- package/dist/cron.cjs +4 -4
- package/dist/cron.d.cts +2 -2
- package/dist/cron.d.ts +2 -2
- package/dist/cron.js +3 -3
- package/dist/eval.cjs +3 -3
- package/dist/eval.js +2 -2
- package/dist/index.cjs +19 -19
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -5
- package/dist/subagents-loader.d.cts +1 -1
- package/dist/subagents-loader.d.ts +1 -1
- package/dist/types/plugin.d.ts +20 -1
- package/docs/error-codes.md +2 -2
- package/docs/harness-capability-map.md +1 -1
- package/package.json +1 -1
- package/dist/chunk-AI4MXACC.js.map +0 -1
- package/dist/chunk-SSIRPWWD.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.3.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#624](https://github.com/usetheokit/theokit-sdk/pull/624) [`1ef64b0`](https://github.com/usetheokit/theokit-sdk/commit/1ef64b06f418d1194a699c2924286d87d5271b90) Thanks [@usetheodev](https://github.com/usetheodev)! - README: say that `.theokit/settings.json` is read, because it is
|
|
8
|
+
|
|
9
|
+
Docs only. The `## Hooks` section named `.theokit/hooks.json` and nothing else, and the only mention of `settings.json` / `settings.local.json` sat in the Claude Code compatibility table — which reads as being about `.claude/`.
|
|
10
|
+
|
|
11
|
+
So a reader asking *"what does this package read in `.theokit/`?"* got `hooks.json`, full stop. That answer is wrong: `hookConfigCandidates` reads `hooks.json`, `settings.json` and `settings.local.json` from **every** config root, and `theokitConfigRoot` is always one of them.
|
|
12
|
+
|
|
13
|
+
This is not an omission that merely leaves someone uninformed — it returns the wrong answer to the person doing the right thing. Measured in 2026-09: a consumer put its own configuration in `.theokit/settings.json` with a `hooks` array of its own shape, and hit a hard refusal on **every turn**. The file parsed perfectly for the product that wrote it; the collision was one of shape, not of location, and nothing in this README would have warned them.
|
|
14
|
+
|
|
15
|
+
The section now names all three files and states the consequence: `.theokit/` is this package's filebase, so a `hooks` key there is read and validated here, whatever else wrote the file.
|
|
16
|
+
|
|
17
|
+
## 5.3.2
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#619](https://github.com/usetheokit/theokit-sdk/pull/619) [`3f80bba`](https://github.com/usetheokit/theokit-sdk/commit/3f80bbaf0e7b1a6e7cd81a08f63aba243e1a0f18) Thanks [@usetheodev](https://github.com/usetheodev)! - A wrongly-shaped `hooks` block is refused with the shape that would work
|
|
22
|
+
|
|
23
|
+
`hooks: expected an object at "hooks" in <path>` named the validator's expectation and nothing an operator could act on. It now carries the accepted shape:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
hooks: expected an object at "hooks" in <path> — hooks are keyed by event,
|
|
27
|
+
e.g. { "hooks": { "PreToolUse": [ { "hooks": [ { "type": "command", "command": "…" } ] } ] } }
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Measured on a consumer in 2026-09. A flat `hooks` array in a `.theokit/settings.json` made this loader throw on **every turn** — and the file parsed perfectly for the product that had written it. `.theokit/` is this package's filebase, so what failed was an independent read of a path another product had started using, and the collision was one of **shape**, not of location. With only the diagnosis to go on, the operator looked in the wrong file.
|
|
31
|
+
|
|
32
|
+
Two tests ship with it: the refusal names the shape, and a control proves the shape it names is accepted. Without the control, "the error mentions `keyed by event`" would say nothing about whether that advice is correct.
|
|
33
|
+
|
|
34
|
+
- [#619](https://github.com/usetheokit/theokit-sdk/pull/619) [`a75059c`](https://github.com/usetheokit/theokit-sdk/commit/a75059cb496e4655e571a703c937e4e71ff670d8) Thanks [@usetheodev](https://github.com/usetheodev)! - Document that `on_session_start` / `on_session_end` fire once per **run** ([#613](https://github.com/usetheokit/theokit-sdk/issues/613) follow-up)
|
|
35
|
+
|
|
36
|
+
Docs and a test only; no behaviour change.
|
|
37
|
+
|
|
38
|
+
`SessionLifecycleContext` is named for a session and carries a `runId` that changes on every firing. The hooks fire once per pass through the agent loop — which is per-message for any application that builds its agent per turn. Nothing a consumer could read said so: the only accurate sentence was an internal comment at the firing site (`loop.ts`, *"fires once per run"*).
|
|
39
|
+
|
|
40
|
+
That gap was measured. In 2026-09 it cost two sessions several hours and produced a defect filed against this package for behaviour that is correct; the real answer turned out to be an architectural mismatch in a consumer that constructs an agent per turn, where "once per run" is not what a `SessionStart` handler assumes.
|
|
41
|
+
|
|
42
|
+
Two changes:
|
|
43
|
+
|
|
44
|
+
- The cadence is now stated on `SessionLifecycleContext` and in the `HookName` docblock, where a consumer meets the hook.
|
|
45
|
+
- `test_on_session_start_fires_once_per_run_and_again_on_the_next_run` pins it across two runs. The existing integration case could not: it collects into a `Set`, so a hook firing twice and a hook firing once are indistinguishable there by construction.
|
|
46
|
+
|
|
3
47
|
## 5.3.1
|
|
4
48
|
|
|
5
49
|
### Patch Changes
|
|
@@ -689,6 +689,8 @@ interface ProviderProfile {
|
|
|
689
689
|
* `on_session_end`, `post_assistant_reply`) is fire-and-forget: the return value is DISCARDED. A
|
|
690
690
|
* policy that needs to change a tool result belongs on `transform_tool_result` — put it on
|
|
691
691
|
* `post_tool_call` and it quietly degrades to observation.
|
|
692
|
+
* - `on_session_start` / `on_session_end` fire once per **run**, not once per agent lifetime — see
|
|
693
|
+
* {@link SessionLifecycleContext}. Build an agent per turn and they fire on every message.
|
|
692
694
|
*
|
|
693
695
|
* Failure is asymmetric too. A fire-and-forget or transform handler that throws is caught, logged to
|
|
694
696
|
* stderr, and the run continues. A `pre_tool_call` handler that throws is NOT caught by the hook
|
|
@@ -750,7 +752,24 @@ interface PostToolCallContext {
|
|
|
750
752
|
agentId: string;
|
|
751
753
|
runId: string;
|
|
752
754
|
}
|
|
753
|
-
/**
|
|
755
|
+
/**
|
|
756
|
+
* #65 — context for the `on_session_start` / `on_session_end` hooks.
|
|
757
|
+
*
|
|
758
|
+
* **These fire once per RUN, not once per agent lifetime**, and the `runId` on this very context is
|
|
759
|
+
* the tell: it changes every time they fire. "Session" here means one pass through the agent loop.
|
|
760
|
+
*
|
|
761
|
+
* The distinction is invisible to an application that creates an agent once and sends many messages
|
|
762
|
+
* — there, per-run and per-session coincide. It is decisive for one that builds an agent **per
|
|
763
|
+
* turn**: `on_session_start` then fires on every message, which is the opposite of what a handler
|
|
764
|
+
* named for a session start usually assumes.
|
|
765
|
+
*
|
|
766
|
+
* Stated here because it was not stated anywhere a consumer could read it. The only accurate
|
|
767
|
+
* sentence lived in an internal comment at the firing site, and in 2026-09 that cost two people
|
|
768
|
+
* hours and produced a defect report filed against this package for behaviour that is correct.
|
|
769
|
+
* `test_on_session_start_fires_once_per_run_and_again_on_the_next_run` now pins it.
|
|
770
|
+
*
|
|
771
|
+
* @public
|
|
772
|
+
*/
|
|
754
773
|
interface SessionLifecycleContext {
|
|
755
774
|
agentId: string;
|
|
756
775
|
runId: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkY46VI73J_cjs = require('./chunk-Y46VI73J.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-
|
|
8
|
+
require('./chunk-65UMH5V3.cjs');
|
|
9
9
|
require('./chunk-BV2MWEMV.cjs');
|
|
10
10
|
require('./chunk-D6POWE7E.cjs');
|
|
11
11
|
require('./chunk-GHX4P3V2.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
|
|
64
|
+
get: function () { return chunkY46VI73J_cjs.Agent; }
|
|
65
65
|
});
|
|
66
|
-
//# sourceMappingURL=agent-
|
|
67
|
-
//# sourceMappingURL=agent-
|
|
66
|
+
//# sourceMappingURL=agent-KJLAWKZB.cjs.map
|
|
67
|
+
//# sourceMappingURL=agent-KJLAWKZB.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-KJLAWKZB.cjs"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { Agent } from './chunk-
|
|
1
|
+
export { Agent } from './chunk-363RBGIR.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-
|
|
6
|
+
import './chunk-7L3MIW2F.js';
|
|
7
7
|
import './chunk-2SFBB54R.js';
|
|
8
8
|
import './chunk-55GB6JYQ.js';
|
|
9
9
|
import './chunk-H73MEMQB.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-
|
|
58
|
-
//# sourceMappingURL=agent-
|
|
57
|
+
//# sourceMappingURL=agent-PNYJ5S2Y.js.map
|
|
58
|
+
//# sourceMappingURL=agent-PNYJ5S2Y.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-PNYJ5S2Y.js"}
|
|
@@ -689,6 +689,8 @@ interface ProviderProfile {
|
|
|
689
689
|
* `on_session_end`, `post_assistant_reply`) is fire-and-forget: the return value is DISCARDED. A
|
|
690
690
|
* policy that needs to change a tool result belongs on `transform_tool_result` — put it on
|
|
691
691
|
* `post_tool_call` and it quietly degrades to observation.
|
|
692
|
+
* - `on_session_start` / `on_session_end` fire once per **run**, not once per agent lifetime — see
|
|
693
|
+
* {@link SessionLifecycleContext}. Build an agent per turn and they fire on every message.
|
|
692
694
|
*
|
|
693
695
|
* Failure is asymmetric too. A fire-and-forget or transform handler that throws is caught, logged to
|
|
694
696
|
* stderr, and the run continues. A `pre_tool_call` handler that throws is NOT caught by the hook
|
|
@@ -750,7 +752,24 @@ interface PostToolCallContext {
|
|
|
750
752
|
agentId: string;
|
|
751
753
|
runId: string;
|
|
752
754
|
}
|
|
753
|
-
/**
|
|
755
|
+
/**
|
|
756
|
+
* #65 — context for the `on_session_start` / `on_session_end` hooks.
|
|
757
|
+
*
|
|
758
|
+
* **These fire once per RUN, not once per agent lifetime**, and the `runId` on this very context is
|
|
759
|
+
* the tell: it changes every time they fire. "Session" here means one pass through the agent loop.
|
|
760
|
+
*
|
|
761
|
+
* The distinction is invisible to an application that creates an agent once and sends many messages
|
|
762
|
+
* — there, per-run and per-session coincide. It is decisive for one that builds an agent **per
|
|
763
|
+
* turn**: `on_session_start` then fires on every message, which is the opposite of what a handler
|
|
764
|
+
* named for a session start usually assumes.
|
|
765
|
+
*
|
|
766
|
+
* Stated here because it was not stated anywhere a consumer could read it. The only accurate
|
|
767
|
+
* sentence lived in an internal comment at the firing site, and in 2026-09 that cost two people
|
|
768
|
+
* hours and produced a defect report filed against this package for behaviour that is correct.
|
|
769
|
+
* `test_on_session_start_fires_once_per_run_and_again_on_the_next_run` now pins it.
|
|
770
|
+
*
|
|
771
|
+
* @public
|
|
772
|
+
*/
|
|
754
773
|
interface SessionLifecycleContext {
|
|
755
774
|
agentId: string;
|
|
756
775
|
runId: string;
|
|
@@ -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-
|
|
4
|
+
import { loadHookConfig, warnOnce, currentPersonalityContext, warnPersonalitySwitchInsideFork } from './chunk-7L3MIW2F.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';
|
|
@@ -9122,7 +9122,7 @@ async function* localAgentStreamToCompletion(agent, message, options) {
|
|
|
9122
9122
|
async function localAgentFork(parent, options) {
|
|
9123
9123
|
const { forkAgentImpl } = await import('./fork-agent-S2EPIML7.js');
|
|
9124
9124
|
const { getAgentFacade } = await import('./agent-factory-registry-ZVTABLEY.js');
|
|
9125
|
-
const { withPersonalityContext } = await import('./context-
|
|
9125
|
+
const { withPersonalityContext } = await import('./context-BUIE52VH.js');
|
|
9126
9126
|
const create = getAgentFacade().create;
|
|
9127
9127
|
return withPersonalityContext(
|
|
9128
9128
|
{ slug: parent.personalitySlugSnapshot, isFork: true },
|
|
@@ -11005,5 +11005,5 @@ async function openLocalStore(reg) {
|
|
|
11005
11005
|
}
|
|
11006
11006
|
|
|
11007
11007
|
export { Agent, AgentBuilder, DEFAULT_AGENTIC_MODEL_ID, MEMORY_EMBEDDING_ADAPTERS, Tool, ToolError, UsageAccumulator, computeCost, generateCronId, getPricingEntry, openRouterMemoryEmbeddingProviderAdapter, resolveSessionDir };
|
|
11008
|
-
//# sourceMappingURL=chunk-
|
|
11009
|
-
//# sourceMappingURL=chunk-
|
|
11008
|
+
//# sourceMappingURL=chunk-363RBGIR.js.map
|
|
11009
|
+
//# sourceMappingURL=chunk-363RBGIR.js.map
|