@theokit/sdk 5.12.1 → 5.14.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 +74 -0
- package/dist/{agent-Cn0sphpA.d.cts → agent-DExqjqYy.d.cts} +18 -3
- package/dist/{agent-CVzDy_Oj.d.ts → agent-Dfw3VsIX.d.ts} +18 -3
- package/dist/{agent-IG7BP6GN.js → agent-T34LCGQM.js} +11 -11
- package/dist/{agent-IG7BP6GN.js.map → agent-T34LCGQM.js.map} +1 -1
- package/dist/{agent-BVKIUP7F.cjs → agent-TL4K7BTG.cjs} +12 -12
- package/dist/{agent-BVKIUP7F.cjs.map → agent-TL4K7BTG.cjs.map} +1 -1
- package/dist/auth/index.cjs +17 -16
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.js +5 -4
- package/dist/auth/index.js.map +1 -1
- package/dist/{chunk-NHOEXFZT.js → chunk-2HXTNVLM.js} +5 -2
- package/dist/chunk-2HXTNVLM.js.map +1 -0
- package/dist/{chunk-Q6WT5535.cjs → chunk-2WY2OFSC.cjs} +259 -79
- package/dist/chunk-2WY2OFSC.cjs.map +1 -0
- package/dist/{chunk-HN4IKB6X.cjs → chunk-2XWAYCFM.cjs} +15 -13
- package/dist/chunk-2XWAYCFM.cjs.map +1 -0
- package/dist/{chunk-3FSBE4PS.js → chunk-3GTN4HOO.js} +10 -6
- package/dist/chunk-3GTN4HOO.js.map +1 -0
- package/dist/{chunk-VVGFZQZC.js → chunk-3LMVJTNJ.js} +9 -5
- package/dist/chunk-3LMVJTNJ.js.map +1 -0
- package/dist/{chunk-4GUFNDZR.js → chunk-3ONIVO2I.js} +3 -3
- package/dist/{chunk-4GUFNDZR.js.map → chunk-3ONIVO2I.js.map} +1 -1
- package/dist/{chunk-7WARNHWW.cjs → chunk-3UMPP553.cjs} +5 -2
- package/dist/chunk-3UMPP553.cjs.map +1 -0
- package/dist/{chunk-NWWTYBD3.cjs → chunk-4KBI37F3.cjs} +5 -5
- package/dist/{chunk-NWWTYBD3.cjs.map → chunk-4KBI37F3.cjs.map} +1 -1
- package/dist/{chunk-S46WJTDL.cjs → chunk-4TEGFMSP.cjs} +6 -6
- package/dist/{chunk-S46WJTDL.cjs.map → chunk-4TEGFMSP.cjs.map} +1 -1
- package/dist/{chunk-QISSETTG.cjs → chunk-5645PMVU.cjs} +6 -4
- package/dist/chunk-5645PMVU.cjs.map +1 -0
- package/dist/{chunk-ZLFFDPXC.js → chunk-73IITAF7.js} +36 -14
- package/dist/chunk-73IITAF7.js.map +1 -0
- package/dist/{chunk-5A4UFBHW.cjs → chunk-A77UMVMD.cjs} +15 -11
- package/dist/chunk-A77UMVMD.cjs.map +1 -0
- package/dist/{chunk-IO4RI5ZJ.cjs → chunk-BZK5QL3N.cjs} +4 -4
- package/dist/{chunk-IO4RI5ZJ.cjs.map → chunk-BZK5QL3N.cjs.map} +1 -1
- package/dist/{chunk-5HSMH2ZZ.js → chunk-CJN5CEI3.js} +4 -4
- package/dist/{chunk-5HSMH2ZZ.js.map → chunk-CJN5CEI3.js.map} +1 -1
- package/dist/{chunk-XRPMZ7TO.js → chunk-CYWOJA6B.js} +6 -4
- package/dist/chunk-CYWOJA6B.js.map +1 -0
- package/dist/{chunk-AQW54OWQ.js → chunk-DFBWYETS.js} +5 -3
- package/dist/chunk-DFBWYETS.js.map +1 -0
- package/dist/{chunk-EPANMGH7.cjs → chunk-FLDHYF5C.cjs} +11 -2
- package/dist/chunk-FLDHYF5C.cjs.map +1 -0
- package/dist/{chunk-BJ7BPLQK.js → chunk-GARVAUCU.js} +209 -29
- package/dist/chunk-GARVAUCU.js.map +1 -0
- package/dist/{chunk-YOVZMN4P.cjs → chunk-LXG6VL6R.cjs} +3 -3
- package/dist/{chunk-YOVZMN4P.cjs.map → chunk-LXG6VL6R.cjs.map} +1 -1
- package/dist/{chunk-NJBJ3CUG.js → chunk-NAVUTK6X.js} +3 -3
- package/dist/{chunk-NJBJ3CUG.js.map → chunk-NAVUTK6X.js.map} +1 -1
- package/dist/{chunk-2SFLLOMN.js → chunk-NVQSBRG6.js} +3 -3
- package/dist/{chunk-2SFLLOMN.js.map → chunk-NVQSBRG6.js.map} +1 -1
- package/dist/{chunk-FEAWEBWN.cjs → chunk-PDOXYXWX.cjs} +6 -4
- package/dist/chunk-PDOXYXWX.cjs.map +1 -0
- package/dist/{chunk-MS3TQSXU.js → chunk-QD6B6W6I.js} +6 -4
- package/dist/chunk-QD6B6W6I.js.map +1 -0
- package/dist/{chunk-NBNRQN6T.js → chunk-QGDPMM3C.js} +11 -2
- package/dist/chunk-QGDPMM3C.js.map +1 -0
- package/dist/{chunk-ZWLFHSON.cjs → chunk-R35ZJAYT.cjs} +38 -15
- package/dist/chunk-R35ZJAYT.cjs.map +1 -0
- package/dist/{chunk-4YD2WI57.cjs → chunk-R427EOZE.cjs} +19 -15
- package/dist/chunk-R427EOZE.cjs.map +1 -0
- package/dist/chunk-R5UQL2R5.cjs +18 -0
- package/dist/{chunk-LO6LIUZ6.cjs.map → chunk-R5UQL2R5.cjs.map} +1 -1
- package/dist/{chunk-TLVI2OQK.cjs → chunk-SETHRLQS.cjs} +18 -2
- package/dist/chunk-SETHRLQS.cjs.map +1 -0
- package/dist/{chunk-LSWHDOCL.cjs → chunk-SNVYOX46.cjs} +88 -72
- package/dist/chunk-SNVYOX46.cjs.map +1 -0
- package/dist/{chunk-BO3PV3OP.js → chunk-TDED5XES.js} +18 -3
- package/dist/chunk-TDED5XES.js.map +1 -0
- package/dist/{chunk-NKQVLWDF.js → chunk-ULEK4OM4.js} +3 -3
- package/dist/{chunk-NKQVLWDF.js.map → chunk-ULEK4OM4.js.map} +1 -1
- package/dist/{chunk-XJ4C4NFX.js → chunk-ZOL3L4EH.js} +63 -49
- package/dist/chunk-ZOL3L4EH.js.map +1 -0
- package/dist/{compact-session-NM56BREJ.cjs → compact-session-D2MQDB6G.cjs} +15 -15
- package/dist/{compact-session-NM56BREJ.cjs.map → compact-session-D2MQDB6G.cjs.map} +1 -1
- package/dist/{compact-session-3U2JYTVG.js → compact-session-N2PPHQO6.js} +6 -6
- package/dist/{compact-session-3U2JYTVG.js.map → compact-session-N2PPHQO6.js.map} +1 -1
- package/dist/{cron-CHn-F0fC.d.ts → cron-BubDpFJG.d.ts} +2 -2
- package/dist/{cron-BWDYetbq.d.cts → cron-CK2v0VWA.d.cts} +2 -2
- package/dist/cron.cjs +11 -11
- package/dist/cron.d.cts +3 -3
- package/dist/cron.d.ts +3 -3
- package/dist/cron.js +10 -10
- package/dist/eval.cjs +15 -15
- package/dist/eval.js +10 -10
- package/dist/{executor-HKHT4CWS.cjs → executor-5QL5AXIZ.cjs} +18 -15
- package/dist/executor-5QL5AXIZ.cjs.map +1 -0
- package/dist/{executor-3D2UDJHW.js → executor-THUXNAFR.js} +6 -3
- package/dist/executor-THUXNAFR.js.map +1 -0
- package/dist/generate-object-A5F576IT.cjs +20 -0
- package/dist/{generate-object-XBWD2PU7.cjs.map → generate-object-A5F576IT.cjs.map} +1 -1
- package/dist/{generate-object-S7MNVF2V.js → generate-object-TBDOBBYW.js} +4 -4
- package/dist/{generate-object-S7MNVF2V.js.map → generate-object-TBDOBBYW.js.map} +1 -1
- package/dist/generate-object.d.ts +14 -1
- package/dist/index.cjs +81 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -7
- package/dist/index.d.ts +36 -7
- package/dist/index.js +44 -28
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-JVTZNQF6.cjs → inject-session-3ICZIJ2N.cjs} +4 -4
- package/dist/{inject-session-JVTZNQF6.cjs.map → inject-session-3ICZIJ2N.cjs.map} +1 -1
- package/dist/{inject-session-THABTKJY.js → inject-session-J26SHHIO.js} +3 -3
- package/dist/{inject-session-THABTKJY.js.map → inject-session-J26SHHIO.js.map} +1 -1
- package/dist/internal/agent-loop/prune-tool-results.d.ts +37 -0
- package/dist/internal/auth/credential-store.d.ts +1 -1
- package/dist/internal/auth/types.d.ts +4 -0
- package/dist/internal/providers/discovery.d.ts +2 -2
- package/dist/internal/providers/trust-gate.d.ts +35 -0
- package/dist/internal/runtime/plugin-loader/manifest-entry-import.d.ts +17 -0
- package/dist/internal/runtime/plugin-loader/workspace-plugin-trust.d.ts +16 -0
- package/dist/internal/runtime/skills/binary-on-path.d.ts +1 -0
- package/dist/internal/runtime/skills/discover-skills.d.ts +2 -0
- package/dist/internal/structured-output-helpers.d.ts +5 -2
- package/dist/mcp-auth.cjs +2 -2
- package/dist/mcp-auth.js +1 -1
- package/dist/models.cjs +11 -11
- package/dist/models.js +4 -4
- package/dist/providers.cjs +6 -6
- package/dist/providers.js +4 -4
- package/dist/sandbox/bwrap.d.cts +10 -8
- package/dist/sandbox/bwrap.d.ts +10 -8
- package/dist/sandbox/deny-read.d.cts +24 -0
- package/dist/sandbox/deny-read.d.ts +24 -0
- package/dist/sandbox/index.cjs +114 -35
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.d.cts +2 -1
- package/dist/sandbox/index.d.ts +2 -1
- package/dist/sandbox/index.js +96 -21
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/linux-sandbox.d.cts +16 -1
- package/dist/sandbox/linux-sandbox.d.ts +16 -1
- package/dist/sandbox/local-sandbox.d.cts +3 -1
- package/dist/sandbox/local-sandbox.d.ts +3 -1
- package/dist/sandbox/seccomp-delivery.d.cts +3 -0
- package/dist/sandbox/seccomp-delivery.d.ts +3 -0
- package/dist/sandbox/shell-escape.d.cts +14 -2
- package/dist/sandbox/shell-escape.d.ts +14 -2
- package/dist/sandbox/types.d.cts +45 -0
- package/dist/sandbox/types.d.ts +45 -0
- package/dist/{sdk-agent-4-dXI2GS.d.cts → sdk-agent-DwzHcuxy.d.cts} +28 -3
- package/dist/{sdk-agent-CTOJlWA_.d.ts → sdk-agent-a3fW1xUK.d.ts} +28 -3
- package/dist/skills.cjs +4 -4
- package/dist/skills.js +1 -1
- package/dist/stream-object-AS4YYM4B.cjs +20 -0
- package/dist/{stream-object-TEEK3CAX.cjs.map → stream-object-AS4YYM4B.cjs.map} +1 -1
- package/dist/stream-object-EKM4WGTI.js +7 -0
- package/dist/{stream-object-R6SMYV4R.js.map → stream-object-EKM4WGTI.js.map} +1 -1
- package/dist/stream-object.d.ts +14 -1
- package/dist/subagents-loader.d.cts +2 -2
- package/dist/subagents-loader.d.ts +2 -2
- package/dist/types/agent.d.ts +14 -1
- package/dist/types/run.d.ts +27 -2
- package/dist/workflow-as-tool.d.ts +39 -5
- package/dist/workflow-errors.d.ts +16 -0
- package/dist/workflow.cjs +31 -23
- package/dist/workflow.d.cts +55 -5
- package/dist/workflow.d.ts +55 -5
- package/dist/workflow.js +2 -2
- package/docs/adr/mutation-testing-scope.md +56 -0
- package/docs/error-codes.md +23 -18
- package/docs/harness-capability-map.md +78 -4
- package/package.json +1 -1
- package/dist/chunk-3FSBE4PS.js.map +0 -1
- package/dist/chunk-4YD2WI57.cjs.map +0 -1
- package/dist/chunk-5A4UFBHW.cjs.map +0 -1
- package/dist/chunk-7WARNHWW.cjs.map +0 -1
- package/dist/chunk-AQW54OWQ.js.map +0 -1
- package/dist/chunk-BJ7BPLQK.js.map +0 -1
- package/dist/chunk-BO3PV3OP.js.map +0 -1
- package/dist/chunk-EPANMGH7.cjs.map +0 -1
- package/dist/chunk-FEAWEBWN.cjs.map +0 -1
- package/dist/chunk-HN4IKB6X.cjs.map +0 -1
- package/dist/chunk-LO6LIUZ6.cjs +0 -18
- package/dist/chunk-LSWHDOCL.cjs.map +0 -1
- package/dist/chunk-MS3TQSXU.js.map +0 -1
- package/dist/chunk-NBNRQN6T.js.map +0 -1
- package/dist/chunk-NHOEXFZT.js.map +0 -1
- package/dist/chunk-Q6WT5535.cjs.map +0 -1
- package/dist/chunk-QISSETTG.cjs.map +0 -1
- package/dist/chunk-TLVI2OQK.cjs.map +0 -1
- package/dist/chunk-VVGFZQZC.js.map +0 -1
- package/dist/chunk-XJ4C4NFX.js.map +0 -1
- package/dist/chunk-XRPMZ7TO.js.map +0 -1
- package/dist/chunk-ZLFFDPXC.js.map +0 -1
- package/dist/chunk-ZWLFHSON.cjs.map +0 -1
- package/dist/executor-3D2UDJHW.js.map +0 -1
- package/dist/executor-HKHT4CWS.cjs.map +0 -1
- package/dist/generate-object-XBWD2PU7.cjs +0 -20
- package/dist/stream-object-R6SMYV4R.js +0 -7
- package/dist/stream-object-TEEK3CAX.cjs +0 -20
|
@@ -2,7 +2,19 @@
|
|
|
2
2
|
* POSIX shell escaping for values interpolated into a `SandboxBackend.execute`
|
|
3
3
|
* command string. `execute` runs via `/bin/sh -c`, so any untrusted value
|
|
4
4
|
* (repo URL, ref, path) MUST be quoted to prevent command injection.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Quotes `arg` as one word for POSIX `sh`, for a command line you build yourself and hand to
|
|
8
|
+
* `SandboxBackend.execute`. A value from outside cannot end the word and start another command,
|
|
9
|
+
* whatever it holds: quotes, `$()`, backticks, newlines, backslashes. An empty string comes back as
|
|
10
|
+
* `''`. Quoting does not stop the program you call from reading a leading dash as an option, so put
|
|
11
|
+
* `--` before the value for one that parses options. The derived helpers and `provisionRepo` use this
|
|
12
|
+
* same quoter.
|
|
5
13
|
*
|
|
6
|
-
*
|
|
14
|
+
* Wrap `arg` in single quotes, escaping embedded single quotes (`'\''`). A backslash before a quote,
|
|
15
|
+
* a backslash or the end is written outside the quotes too (`'\\'`), so the word parses the same
|
|
16
|
+
* under fish, which reads `\'` and `\\` inside single quotes as escapes, as under sh (B-600): the PTY
|
|
17
|
+
* runs the sandbox wrap under the user's `$SHELL`. After the first pass an original quote reads
|
|
18
|
+
* `'\''`, whose own backslash is always followed by `''`, so the second pass never matches it.
|
|
7
19
|
*/
|
|
8
|
-
export
|
|
20
|
+
export declare function shellEscapePosix(arg: string): string;
|
package/dist/sandbox/types.d.cts
CHANGED
|
@@ -52,6 +52,21 @@ export interface SandboxConfig {
|
|
|
52
52
|
*/
|
|
53
53
|
env?: EnvPolicy;
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* What a {@link SandboxBackend} states about its outbound network. It is a statement the backend
|
|
57
|
+
* makes about itself, for a caller that wants to ask before it trusts: this package enforces nothing
|
|
58
|
+
* from it, and a custom backend is responsible for the claim being true.
|
|
59
|
+
*
|
|
60
|
+
* `"unrestricted"` means a command can reach whatever the host can. `"none"` means it cannot reach
|
|
61
|
+
* the network at all. `"allowlist"` means it can reach only the destinations in `allow`, written as
|
|
62
|
+
* the backend's own firewall spells them (usually domain names); the field is meaningful only with
|
|
63
|
+
* that mode. A backend that says nothing leaves `networkPolicy` undefined, which is not the same as
|
|
64
|
+
* `"unrestricted"`: it means the backend makes no claim either way.
|
|
65
|
+
*/
|
|
66
|
+
export interface SandboxNetworkPolicy {
|
|
67
|
+
readonly mode: "unrestricted" | "allowlist" | "none";
|
|
68
|
+
readonly allow?: readonly string[];
|
|
69
|
+
}
|
|
55
70
|
/**
|
|
56
71
|
* A backend refused a command on policy grounds — the environment works, and it said no. Carries a
|
|
57
72
|
* stable `code: "sandbox_security"` for callers that prefer not to match on the class.
|
|
@@ -98,16 +113,36 @@ export declare class SandboxNotAvailableError extends TheokitAgentError {
|
|
|
98
113
|
* a reason to pin one. For genuinely untrusted code you want a container or VM backend, which this
|
|
99
114
|
* package does not ship — write it against these two methods.
|
|
100
115
|
*
|
|
116
|
+
* Two optional members let a backend say more about itself. {@link SandboxBackend.networkPolicy}
|
|
117
|
+
* states its egress: `LocalSandbox` declares `"unrestricted"`, `LinuxSandbox` declares `"none"` when
|
|
118
|
+
* bubblewrap unshares the network, and a backend that does not override it states nothing. Nothing in
|
|
119
|
+
* this package enforces an allowlist, so `"allowlist"` is only ever a claim a custom backend makes
|
|
120
|
+
* for itself. {@link SandboxBackend.dispose} releases what the backend holds, and the owner of the
|
|
121
|
+
* backend calls it.
|
|
122
|
+
*
|
|
101
123
|
* Because the derived helpers assemble shell command lines (arguments escaped for POSIX `sh`), a
|
|
102
124
|
* backend whose `execute` is not a POSIX shell must override them as well.
|
|
103
125
|
*/
|
|
104
126
|
export declare abstract class SandboxBackend {
|
|
105
127
|
protected config: SandboxConfig;
|
|
128
|
+
/**
|
|
129
|
+
* What this backend states about its outbound network, or `undefined` when it states nothing.
|
|
130
|
+
* Read it to check an isolation claim before trusting a backend; do not read `undefined` as
|
|
131
|
+
* "unrestricted". A subclass sets it as a field, and it is a statement only: the backend must
|
|
132
|
+
* enforce it itself.
|
|
133
|
+
*/
|
|
134
|
+
readonly networkPolicy?: SandboxNetworkPolicy;
|
|
106
135
|
constructor(config?: SandboxConfig);
|
|
107
136
|
abstract execute(command: string, opts?: {
|
|
108
137
|
timeoutMs?: number;
|
|
109
138
|
}): Promise<ExecuteResult>;
|
|
110
139
|
abstract uploadFile(path: string, content: string | Buffer): Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* Releases whatever the backend holds, such as a VM or a container. The default does nothing,
|
|
142
|
+
* which is correct for a backend that holds nothing, so existing subclasses need no change. Safe
|
|
143
|
+
* to call more than once. The owner of the backend calls it; nothing in this package does.
|
|
144
|
+
*/
|
|
145
|
+
dispose(): Promise<void>;
|
|
111
146
|
readFile(path: string): Promise<string>;
|
|
112
147
|
writeFile(path: string, content: string): Promise<void>;
|
|
113
148
|
glob(pattern: string, cwd?: string): Promise<string[]>;
|
|
@@ -141,3 +176,13 @@ export declare abstract class SandboxBackend {
|
|
|
141
176
|
export type SandboxProvider<Ctx = unknown> = SandboxBackend | ((ctx: Ctx) => SandboxBackend | Promise<SandboxBackend>);
|
|
142
177
|
/** Resolve a {@link SandboxProvider} to a concrete backend for `ctx`. */
|
|
143
178
|
export declare function resolveSandbox<Ctx>(provider: SandboxProvider<Ctx>, ctx: Ctx): Promise<SandboxBackend>;
|
|
179
|
+
/** Codex's three canonical sandbox modes; lives in this leaf module so bwrap.ts and deny-read.ts need not import each other. */
|
|
180
|
+
export type SandboxMode = "read-only" | "workspace-write" | "danger-full-access";
|
|
181
|
+
/** Result of probing for bubblewrap. Detection never throws. */
|
|
182
|
+
export type BwrapDetection = {
|
|
183
|
+
ok: true;
|
|
184
|
+
bin: string;
|
|
185
|
+
} | {
|
|
186
|
+
ok: false;
|
|
187
|
+
reason: string;
|
|
188
|
+
};
|
package/dist/sandbox/types.d.ts
CHANGED
|
@@ -52,6 +52,21 @@ export interface SandboxConfig {
|
|
|
52
52
|
*/
|
|
53
53
|
env?: EnvPolicy;
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* What a {@link SandboxBackend} states about its outbound network. It is a statement the backend
|
|
57
|
+
* makes about itself, for a caller that wants to ask before it trusts: this package enforces nothing
|
|
58
|
+
* from it, and a custom backend is responsible for the claim being true.
|
|
59
|
+
*
|
|
60
|
+
* `"unrestricted"` means a command can reach whatever the host can. `"none"` means it cannot reach
|
|
61
|
+
* the network at all. `"allowlist"` means it can reach only the destinations in `allow`, written as
|
|
62
|
+
* the backend's own firewall spells them (usually domain names); the field is meaningful only with
|
|
63
|
+
* that mode. A backend that says nothing leaves `networkPolicy` undefined, which is not the same as
|
|
64
|
+
* `"unrestricted"`: it means the backend makes no claim either way.
|
|
65
|
+
*/
|
|
66
|
+
export interface SandboxNetworkPolicy {
|
|
67
|
+
readonly mode: "unrestricted" | "allowlist" | "none";
|
|
68
|
+
readonly allow?: readonly string[];
|
|
69
|
+
}
|
|
55
70
|
/**
|
|
56
71
|
* A backend refused a command on policy grounds — the environment works, and it said no. Carries a
|
|
57
72
|
* stable `code: "sandbox_security"` for callers that prefer not to match on the class.
|
|
@@ -98,16 +113,36 @@ export declare class SandboxNotAvailableError extends TheokitAgentError {
|
|
|
98
113
|
* a reason to pin one. For genuinely untrusted code you want a container or VM backend, which this
|
|
99
114
|
* package does not ship — write it against these two methods.
|
|
100
115
|
*
|
|
116
|
+
* Two optional members let a backend say more about itself. {@link SandboxBackend.networkPolicy}
|
|
117
|
+
* states its egress: `LocalSandbox` declares `"unrestricted"`, `LinuxSandbox` declares `"none"` when
|
|
118
|
+
* bubblewrap unshares the network, and a backend that does not override it states nothing. Nothing in
|
|
119
|
+
* this package enforces an allowlist, so `"allowlist"` is only ever a claim a custom backend makes
|
|
120
|
+
* for itself. {@link SandboxBackend.dispose} releases what the backend holds, and the owner of the
|
|
121
|
+
* backend calls it.
|
|
122
|
+
*
|
|
101
123
|
* Because the derived helpers assemble shell command lines (arguments escaped for POSIX `sh`), a
|
|
102
124
|
* backend whose `execute` is not a POSIX shell must override them as well.
|
|
103
125
|
*/
|
|
104
126
|
export declare abstract class SandboxBackend {
|
|
105
127
|
protected config: SandboxConfig;
|
|
128
|
+
/**
|
|
129
|
+
* What this backend states about its outbound network, or `undefined` when it states nothing.
|
|
130
|
+
* Read it to check an isolation claim before trusting a backend; do not read `undefined` as
|
|
131
|
+
* "unrestricted". A subclass sets it as a field, and it is a statement only: the backend must
|
|
132
|
+
* enforce it itself.
|
|
133
|
+
*/
|
|
134
|
+
readonly networkPolicy?: SandboxNetworkPolicy;
|
|
106
135
|
constructor(config?: SandboxConfig);
|
|
107
136
|
abstract execute(command: string, opts?: {
|
|
108
137
|
timeoutMs?: number;
|
|
109
138
|
}): Promise<ExecuteResult>;
|
|
110
139
|
abstract uploadFile(path: string, content: string | Buffer): Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* Releases whatever the backend holds, such as a VM or a container. The default does nothing,
|
|
142
|
+
* which is correct for a backend that holds nothing, so existing subclasses need no change. Safe
|
|
143
|
+
* to call more than once. The owner of the backend calls it; nothing in this package does.
|
|
144
|
+
*/
|
|
145
|
+
dispose(): Promise<void>;
|
|
111
146
|
readFile(path: string): Promise<string>;
|
|
112
147
|
writeFile(path: string, content: string): Promise<void>;
|
|
113
148
|
glob(pattern: string, cwd?: string): Promise<string[]>;
|
|
@@ -141,3 +176,13 @@ export declare abstract class SandboxBackend {
|
|
|
141
176
|
export type SandboxProvider<Ctx = unknown> = SandboxBackend | ((ctx: Ctx) => SandboxBackend | Promise<SandboxBackend>);
|
|
142
177
|
/** Resolve a {@link SandboxProvider} to a concrete backend for `ctx`. */
|
|
143
178
|
export declare function resolveSandbox<Ctx>(provider: SandboxProvider<Ctx>, ctx: Ctx): Promise<SandboxBackend>;
|
|
179
|
+
/** Codex's three canonical sandbox modes; lives in this leaf module so bwrap.ts and deny-read.ts need not import each other. */
|
|
180
|
+
export type SandboxMode = "read-only" | "workspace-write" | "danger-full-access";
|
|
181
|
+
/** Result of probing for bubblewrap. Detection never throws. */
|
|
182
|
+
export type BwrapDetection = {
|
|
183
|
+
ok: true;
|
|
184
|
+
bin: string;
|
|
185
|
+
} | {
|
|
186
|
+
ok: false;
|
|
187
|
+
reason: string;
|
|
188
|
+
};
|
|
@@ -1577,6 +1577,17 @@ interface ToolResultGuardOptions {
|
|
|
1577
1577
|
/** Redact common PII patterns (email, phone) in tool-result content. */
|
|
1578
1578
|
redactPii?: boolean;
|
|
1579
1579
|
}
|
|
1580
|
+
/**
|
|
1581
|
+
* B-564 — how old a tool result may get, in tool rounds, before its content is pruned from the
|
|
1582
|
+
* next LLM request (`SendOptions.pruneToolResults`). Contract type owned by `types/`; the
|
|
1583
|
+
* implementation lives in `internal/agent-loop/prune-tool-results.ts`, which re-exports this.
|
|
1584
|
+
*
|
|
1585
|
+
* @public
|
|
1586
|
+
*/
|
|
1587
|
+
interface PruneToolResultsOptions {
|
|
1588
|
+
/** Keep the newest `olderThanRounds` tool rounds whole; an integer of at least 1. */
|
|
1589
|
+
olderThanRounds: number;
|
|
1590
|
+
}
|
|
1580
1591
|
/**
|
|
1581
1592
|
* Lifecycle status of a {@link Run}.
|
|
1582
1593
|
*
|
|
@@ -1868,7 +1879,7 @@ interface SDKUserMessage {
|
|
|
1868
1879
|
*
|
|
1869
1880
|
* ## Which options do I need?
|
|
1870
1881
|
*
|
|
1871
|
-
* Twenty-
|
|
1882
|
+
* Twenty-two optional fields with genuinely different audiences, so most callers read all of them to
|
|
1872
1883
|
* find their two. This table is the fix that was chosen; the alternative — nesting the groups under
|
|
1873
1884
|
* `observe?` and `toolPolicy?` and carrying the flat keys as deprecated aliases for one major — would
|
|
1874
1885
|
* have added surface to remove surface, and the harm here is the READING cost, not a representable
|
|
@@ -1878,7 +1889,7 @@ interface SDKUserMessage {
|
|
|
1878
1889
|
* | If you are… | you want |
|
|
1879
1890
|
* |---|---|
|
|
1880
1891
|
* | rendering a live UI | `onDelta`, `onStep`, `onRunEvent` |
|
|
1881
|
-
* | applying a policy | `permissionMode`, `activeTools`, `toolChoice`, `toolResultGuard`, `perToolTimeoutMs` |
|
|
1892
|
+
* | applying a policy | `permissionMode`, `activeTools`, `toolChoice`, `toolResultGuard`, `pruneToolResults`, `perToolTimeoutMs` |
|
|
1882
1893
|
* | running an eval or a harness | `maxIterations`, `completionCheck`, `doomLoop`, `signal` |
|
|
1883
1894
|
* | orchestrating agents | `origin`, `task`, `context` |
|
|
1884
1895
|
* | overriding this one send | `model`, `systemPrompt`, `tools`, `mcpServers`, `contextPaths`, `local` |
|
|
@@ -2023,6 +2034,20 @@ interface SendOptions {
|
|
|
2023
2034
|
* @public
|
|
2024
2035
|
*/
|
|
2025
2036
|
toolResultGuard?: ToolResultGuardOptions;
|
|
2037
|
+
/**
|
|
2038
|
+
* B-564 — opt-in pruning of aged tool results. With `{ olderThanRounds: n }`, the content of
|
|
2039
|
+
* every tool result older than `n` tool rounds is replaced by a short stub in each request the
|
|
2040
|
+
* run's agent loop sends (its `toolUseId` and `isError` kept; session compaction is not pruned); the transcript the run keeps, persists and resumes
|
|
2041
|
+
* from stays whole. `olderThanRounds` must be an integer of at least 1, else the send fails
|
|
2042
|
+
* with `ConfigurationError` code `invalid_prune_tool_results` before any provider call.
|
|
2043
|
+
* Undefined = no pruning (the request is unchanged). Pruning trades request size against
|
|
2044
|
+
* prefix-cache reuse: each new round turns one more previously sent result into a stub, so the
|
|
2045
|
+
* request prefix changes from that message onward on providers that cache message prefixes.
|
|
2046
|
+
* The cache-hit cost was not measured.
|
|
2047
|
+
*
|
|
2048
|
+
* @public
|
|
2049
|
+
*/
|
|
2050
|
+
pruneToolResults?: PruneToolResultsOptions;
|
|
2026
2051
|
/**
|
|
2027
2052
|
* Opt-in task wrapping (ADRs D363, D374). When truthy, the entire
|
|
2028
2053
|
* run is registered as a `Task` in the SDK's observable registry —
|
|
@@ -2557,4 +2582,4 @@ interface InvalidateCacheOptions {
|
|
|
2557
2582
|
applyNow?: boolean;
|
|
2558
2583
|
}
|
|
2559
2584
|
|
|
2560
|
-
export type { OutputProcessorContext as $, AgentConversationTurn as A, GenerateRunResult as B, ContextSettings as C, DoomLoopThresholds as D, EnvPolicy as E, ForkOptions as F, GoalOptions as G, InteractionUpdate as H, InputProcessorContext as I, JudgeResult as J, InvalidateCacheOptions as K, McpAuthConfig as L, McpServerConfig as M, McpHttpServerConfig as N, McpOAuthConfig as O, ProviderRoutingSettings as P, McpStdioServerConfig as Q, RunResult as R, SDKAgent as S, MemoryAdapter as T, MemoryAdapterCapabilities as U, MemoryContext as V, MemoryFact as W, MemoryRevision as X, MemoryToolSchema as Y, MemoryTurnMessage as Z, MessageOrigin as _, PluginsSettings as a,
|
|
2585
|
+
export type { OutputProcessorContext as $, AgentConversationTurn as A, GenerateRunResult as B, ContextSettings as C, DoomLoopThresholds as D, EnvPolicy as E, ForkOptions as F, GoalOptions as G, InteractionUpdate as H, InputProcessorContext as I, JudgeResult as J, InvalidateCacheOptions as K, McpAuthConfig as L, McpServerConfig as M, McpHttpServerConfig as N, McpOAuthConfig as O, ProviderRoutingSettings as P, McpStdioServerConfig as Q, RunResult as R, SDKAgent as S, MemoryAdapter as T, MemoryAdapterCapabilities as U, MemoryContext as V, MemoryFact as W, MemoryRevision as X, MemoryToolSchema as Y, MemoryTurnMessage as Z, MessageOrigin as _, PluginsSettings as a, TokenUsage as a$, PartialToolCallUpdate as a0, PersonalityPreset as a1, ProcessorControls as a2, ProcessorTripwire as a3, ProcessorViolation as a4, ProviderCapability as a5, ProviderRoute as a6, PruneToolResultsOptions as a7, ResolvedProviderRoute as a8, RunCompactBoundaryEvent as a9, SDKPluginMetadata as aA, SDKProvidersManager as aB, SDKRequestMessage as aC, SDKStatusMessage as aD, SDKSystemMessage as aE, SDKTaskMessage as aF, SDKThinkingMessage as aG, SDKToolUseMessage as aH, SDKUserMessage as aI, SDKUserMessageEvent as aJ, SendOptions as aK, ShellCommand as aL, ShellConversationTurn as aM, ShellOutput as aN, ShellOutputDeltaUpdate as aO, StepCompletedUpdate as aP, StepStartedUpdate as aQ, StreamToCompletionResult as aR, SummaryCompletedUpdate as aS, SummaryStartedUpdate as aT, SummaryUpdate as aU, SystemPromptSkillRef as aV, TextDeltaUpdate as aW, ThinkingCompletedUpdate as aX, ThinkingDeltaUpdate as aY, ThinkingMessage as aZ, TokenDeltaUpdate as a_, RunCompletionCheckEvent as aa, RunErrorDetail as ab, RunEvent as ac, RunGitInfo as ad, RunMemoryDegradedEvent as ae, RunPermissionDeniedEvent as af, RunRateLimitEvent as ag, RunStatus as ah, RunTaskCompletedEvent as ai, RunTaskStartedEvent as aj, RunTaskUpdatedEvent as ak, RunTimelineEvent as al, RunToCompletionOptions as am, RunToCompletionResult as an, RunToolProgressEvent as ao, RunTripwireEvent as ap, RunUntilIterator as aq, SDKAgentPlugins as ar, SDKAgentSkillDetail as as, SDKAgentSkills as at, SDKArtifact as au, SDKAssistantMessage as av, SDKContextManager as aw, SDKImage as ax, SDKImageDimension as ay, SDKObjectDelta as az, Run as b, ToolCall as b0, ToolCallCompletedUpdate as b1, ToolCallStartedUpdate as b2, ToolResult as b3, ToolResultGuardOptions as b4, ToolUseBlock as b5, TurnEndedUpdate as b6, UserMessage as b7, UserMessageAppendedUpdate as b8, Verdict as b9, Processor as c, GoalEvent as d, GoalResult as e, MemoryId as f, RunEventSink as g, SDKProvider as h, SDKMessage as i, AgentMemory as j, AgentOperation as k, AssistantMessage as l, CompletionCheck as m, CompletionCheckResult as n, ContextBudget as o, ContextManagerKind as p, ContextSnapshot as q, ContextSource as r, ContextSourceStatus as s, ConversationStep as t, ConversationTurn as u, CostBreakdown as v, CostSource as w, CostStatus as x, ForkResult as y, GenerateOptions as z };
|
|
@@ -1577,6 +1577,17 @@ interface ToolResultGuardOptions {
|
|
|
1577
1577
|
/** Redact common PII patterns (email, phone) in tool-result content. */
|
|
1578
1578
|
redactPii?: boolean;
|
|
1579
1579
|
}
|
|
1580
|
+
/**
|
|
1581
|
+
* B-564 — how old a tool result may get, in tool rounds, before its content is pruned from the
|
|
1582
|
+
* next LLM request (`SendOptions.pruneToolResults`). Contract type owned by `types/`; the
|
|
1583
|
+
* implementation lives in `internal/agent-loop/prune-tool-results.ts`, which re-exports this.
|
|
1584
|
+
*
|
|
1585
|
+
* @public
|
|
1586
|
+
*/
|
|
1587
|
+
interface PruneToolResultsOptions {
|
|
1588
|
+
/** Keep the newest `olderThanRounds` tool rounds whole; an integer of at least 1. */
|
|
1589
|
+
olderThanRounds: number;
|
|
1590
|
+
}
|
|
1580
1591
|
/**
|
|
1581
1592
|
* Lifecycle status of a {@link Run}.
|
|
1582
1593
|
*
|
|
@@ -1868,7 +1879,7 @@ interface SDKUserMessage {
|
|
|
1868
1879
|
*
|
|
1869
1880
|
* ## Which options do I need?
|
|
1870
1881
|
*
|
|
1871
|
-
* Twenty-
|
|
1882
|
+
* Twenty-two optional fields with genuinely different audiences, so most callers read all of them to
|
|
1872
1883
|
* find their two. This table is the fix that was chosen; the alternative — nesting the groups under
|
|
1873
1884
|
* `observe?` and `toolPolicy?` and carrying the flat keys as deprecated aliases for one major — would
|
|
1874
1885
|
* have added surface to remove surface, and the harm here is the READING cost, not a representable
|
|
@@ -1878,7 +1889,7 @@ interface SDKUserMessage {
|
|
|
1878
1889
|
* | If you are… | you want |
|
|
1879
1890
|
* |---|---|
|
|
1880
1891
|
* | rendering a live UI | `onDelta`, `onStep`, `onRunEvent` |
|
|
1881
|
-
* | applying a policy | `permissionMode`, `activeTools`, `toolChoice`, `toolResultGuard`, `perToolTimeoutMs` |
|
|
1892
|
+
* | applying a policy | `permissionMode`, `activeTools`, `toolChoice`, `toolResultGuard`, `pruneToolResults`, `perToolTimeoutMs` |
|
|
1882
1893
|
* | running an eval or a harness | `maxIterations`, `completionCheck`, `doomLoop`, `signal` |
|
|
1883
1894
|
* | orchestrating agents | `origin`, `task`, `context` |
|
|
1884
1895
|
* | overriding this one send | `model`, `systemPrompt`, `tools`, `mcpServers`, `contextPaths`, `local` |
|
|
@@ -2023,6 +2034,20 @@ interface SendOptions {
|
|
|
2023
2034
|
* @public
|
|
2024
2035
|
*/
|
|
2025
2036
|
toolResultGuard?: ToolResultGuardOptions;
|
|
2037
|
+
/**
|
|
2038
|
+
* B-564 — opt-in pruning of aged tool results. With `{ olderThanRounds: n }`, the content of
|
|
2039
|
+
* every tool result older than `n` tool rounds is replaced by a short stub in each request the
|
|
2040
|
+
* run's agent loop sends (its `toolUseId` and `isError` kept; session compaction is not pruned); the transcript the run keeps, persists and resumes
|
|
2041
|
+
* from stays whole. `olderThanRounds` must be an integer of at least 1, else the send fails
|
|
2042
|
+
* with `ConfigurationError` code `invalid_prune_tool_results` before any provider call.
|
|
2043
|
+
* Undefined = no pruning (the request is unchanged). Pruning trades request size against
|
|
2044
|
+
* prefix-cache reuse: each new round turns one more previously sent result into a stub, so the
|
|
2045
|
+
* request prefix changes from that message onward on providers that cache message prefixes.
|
|
2046
|
+
* The cache-hit cost was not measured.
|
|
2047
|
+
*
|
|
2048
|
+
* @public
|
|
2049
|
+
*/
|
|
2050
|
+
pruneToolResults?: PruneToolResultsOptions;
|
|
2026
2051
|
/**
|
|
2027
2052
|
* Opt-in task wrapping (ADRs D363, D374). When truthy, the entire
|
|
2028
2053
|
* run is registered as a `Task` in the SDK's observable registry —
|
|
@@ -2557,4 +2582,4 @@ interface InvalidateCacheOptions {
|
|
|
2557
2582
|
applyNow?: boolean;
|
|
2558
2583
|
}
|
|
2559
2584
|
|
|
2560
|
-
export type { OutputProcessorContext as $, AgentConversationTurn as A, GenerateRunResult as B, ContextSettings as C, DoomLoopThresholds as D, EnvPolicy as E, ForkOptions as F, GoalOptions as G, InteractionUpdate as H, InputProcessorContext as I, JudgeResult as J, InvalidateCacheOptions as K, McpAuthConfig as L, McpServerConfig as M, McpHttpServerConfig as N, McpOAuthConfig as O, ProviderRoutingSettings as P, McpStdioServerConfig as Q, RunResult as R, SDKAgent as S, MemoryAdapter as T, MemoryAdapterCapabilities as U, MemoryContext as V, MemoryFact as W, MemoryRevision as X, MemoryToolSchema as Y, MemoryTurnMessage as Z, MessageOrigin as _, PluginsSettings as a,
|
|
2585
|
+
export type { OutputProcessorContext as $, AgentConversationTurn as A, GenerateRunResult as B, ContextSettings as C, DoomLoopThresholds as D, EnvPolicy as E, ForkOptions as F, GoalOptions as G, InteractionUpdate as H, InputProcessorContext as I, JudgeResult as J, InvalidateCacheOptions as K, McpAuthConfig as L, McpServerConfig as M, McpHttpServerConfig as N, McpOAuthConfig as O, ProviderRoutingSettings as P, McpStdioServerConfig as Q, RunResult as R, SDKAgent as S, MemoryAdapter as T, MemoryAdapterCapabilities as U, MemoryContext as V, MemoryFact as W, MemoryRevision as X, MemoryToolSchema as Y, MemoryTurnMessage as Z, MessageOrigin as _, PluginsSettings as a, TokenUsage as a$, PartialToolCallUpdate as a0, PersonalityPreset as a1, ProcessorControls as a2, ProcessorTripwire as a3, ProcessorViolation as a4, ProviderCapability as a5, ProviderRoute as a6, PruneToolResultsOptions as a7, ResolvedProviderRoute as a8, RunCompactBoundaryEvent as a9, SDKPluginMetadata as aA, SDKProvidersManager as aB, SDKRequestMessage as aC, SDKStatusMessage as aD, SDKSystemMessage as aE, SDKTaskMessage as aF, SDKThinkingMessage as aG, SDKToolUseMessage as aH, SDKUserMessage as aI, SDKUserMessageEvent as aJ, SendOptions as aK, ShellCommand as aL, ShellConversationTurn as aM, ShellOutput as aN, ShellOutputDeltaUpdate as aO, StepCompletedUpdate as aP, StepStartedUpdate as aQ, StreamToCompletionResult as aR, SummaryCompletedUpdate as aS, SummaryStartedUpdate as aT, SummaryUpdate as aU, SystemPromptSkillRef as aV, TextDeltaUpdate as aW, ThinkingCompletedUpdate as aX, ThinkingDeltaUpdate as aY, ThinkingMessage as aZ, TokenDeltaUpdate as a_, RunCompletionCheckEvent as aa, RunErrorDetail as ab, RunEvent as ac, RunGitInfo as ad, RunMemoryDegradedEvent as ae, RunPermissionDeniedEvent as af, RunRateLimitEvent as ag, RunStatus as ah, RunTaskCompletedEvent as ai, RunTaskStartedEvent as aj, RunTaskUpdatedEvent as ak, RunTimelineEvent as al, RunToCompletionOptions as am, RunToCompletionResult as an, RunToolProgressEvent as ao, RunTripwireEvent as ap, RunUntilIterator as aq, SDKAgentPlugins as ar, SDKAgentSkillDetail as as, SDKAgentSkills as at, SDKArtifact as au, SDKAssistantMessage as av, SDKContextManager as aw, SDKImage as ax, SDKImageDimension as ay, SDKObjectDelta as az, Run as b, ToolCall as b0, ToolCallCompletedUpdate as b1, ToolCallStartedUpdate as b2, ToolResult as b3, ToolResultGuardOptions as b4, ToolUseBlock as b5, TurnEndedUpdate as b6, UserMessage as b7, UserMessageAppendedUpdate as b8, Verdict as b9, Processor as c, GoalEvent as d, GoalResult as e, MemoryId as f, RunEventSink as g, SDKProvider as h, SDKMessage as i, AgentMemory as j, AgentOperation as k, AssistantMessage as l, CompletionCheck as m, CompletionCheckResult as n, ContextBudget as o, ContextManagerKind as p, ContextSnapshot as q, ContextSource as r, ContextSourceStatus as s, ConversationStep as t, ConversationTurn as u, CostBreakdown as v, CostSource as w, CostStatus as x, ForkResult as y, GenerateOptions as z };
|
package/dist/skills.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk3UMPP553_cjs = require('./chunk-3UMPP553.cjs');
|
|
4
4
|
require('./chunk-3KIUY67P.cjs');
|
|
5
5
|
require('./chunk-SA6K24NB.cjs');
|
|
6
6
|
require('./chunk-6XQLTQB6.cjs');
|
|
@@ -11,15 +11,15 @@ require('./chunk-RNXXYF22.cjs');
|
|
|
11
11
|
|
|
12
12
|
Object.defineProperty(exports, "buildSkillsBlock", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunk3UMPP553_cjs.buildSkillsBlock; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "discoverSkills", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunk3UMPP553_cjs.discoverSkills; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "loadSkillInstructions", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunk3UMPP553_cjs.loadSkillInstructions; }
|
|
23
23
|
});
|
|
24
24
|
//# sourceMappingURL=skills.cjs.map
|
|
25
25
|
//# sourceMappingURL=skills.cjs.map
|
package/dist/skills.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { buildSkillsBlock, discoverSkills, loadSkillInstructions } from './chunk-
|
|
1
|
+
export { buildSkillsBlock, discoverSkills, loadSkillInstructions } from './chunk-2HXTNVLM.js';
|
|
2
2
|
import './chunk-PKRPV3R7.js';
|
|
3
3
|
import './chunk-UKMBRMGT.js';
|
|
4
4
|
import './chunk-Q7UG242V.js';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk2XWAYCFM_cjs = require('./chunk-2XWAYCFM.cjs');
|
|
4
|
+
require('./chunk-PDOXYXWX.cjs');
|
|
5
|
+
require('./chunk-AA27GEYS.cjs');
|
|
6
|
+
require('./chunk-CEGU5AVD.cjs');
|
|
7
|
+
require('./chunk-RNXXYF22.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
Object.defineProperty(exports, "StreamObjectError", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunk2XWAYCFM_cjs.StreamObjectError; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "streamObjectImpl", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunk2XWAYCFM_cjs.streamObjectImpl; }
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=stream-object-AS4YYM4B.cjs.map
|
|
20
|
+
//# sourceMappingURL=stream-object-AS4YYM4B.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"stream-object-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"stream-object-AS4YYM4B.cjs"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { StreamObjectError, streamObjectImpl } from './chunk-CYWOJA6B.js';
|
|
2
|
+
import './chunk-DFBWYETS.js';
|
|
3
|
+
import './chunk-7I5Z3UBJ.js';
|
|
4
|
+
import './chunk-TNFOU6SB.js';
|
|
5
|
+
import './chunk-3OY6H3I7.js';
|
|
6
|
+
//# sourceMappingURL=stream-object-EKM4WGTI.js.map
|
|
7
|
+
//# sourceMappingURL=stream-object-EKM4WGTI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"stream-object-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"stream-object-EKM4WGTI.js"}
|
package/dist/stream-object.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ZodType } from "zod";
|
|
2
2
|
import { StructuredOutputError } from "./errors.js";
|
|
3
|
-
import type { LocalOptions, ModelSelection } from "./types/agent.js";
|
|
3
|
+
import type { BuiltinToolName, LocalOptions, MemorySettings, ModelSelection } from "./types/agent.js";
|
|
4
4
|
import type { ProviderRoutingSettings } from "./types/providers.js";
|
|
5
5
|
/**
|
|
6
6
|
* Options accepted by {@link Agent.streamObject}. Same shape as
|
|
@@ -26,6 +26,19 @@ export interface StreamObjectOptions<T extends ZodType> {
|
|
|
26
26
|
* when the right env key is set under a different provider name.
|
|
27
27
|
*/
|
|
28
28
|
providers?: ProviderRoutingSettings;
|
|
29
|
+
/**
|
|
30
|
+
* Builtin tools removed from the transient agent's catalogue, forwarded to
|
|
31
|
+
* {@link AgentOptions.withheldBuiltinTools}. Absent ⇒ unchanged default: the agent holds
|
|
32
|
+
* `shell`. Pass `["shell"]` for a step that must only produce JSON. The `output` tool is
|
|
33
|
+
* never withheld.
|
|
34
|
+
*/
|
|
35
|
+
withheldBuiltinTools?: readonly BuiltinToolName[];
|
|
36
|
+
/**
|
|
37
|
+
* Memory settings for the transient agent, forwarded to {@link AgentOptions.memory}.
|
|
38
|
+
* Absent ⇒ unchanged default (a session transcript is written). Pass `{ enabled: false }`
|
|
39
|
+
* for a step that must leave no transcript.
|
|
40
|
+
*/
|
|
41
|
+
memory?: MemorySettings;
|
|
29
42
|
}
|
|
30
43
|
/**
|
|
31
44
|
* Recursive partial — `T` where every nested field becomes optional.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as AgentDefinition } from './agent-
|
|
2
|
-
import './sdk-agent-
|
|
1
|
+
import { a as AgentDefinition } from './agent-DExqjqYy.cjs';
|
|
2
|
+
import './sdk-agent-DwzHcuxy.cjs';
|
|
3
3
|
import './agent-prims-CZyxfCmS.cjs';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import './errors-base-B5g01neU.cjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as AgentDefinition } from './agent-
|
|
2
|
-
import './sdk-agent-
|
|
1
|
+
import { a as AgentDefinition } from './agent-Dfw3VsIX.js';
|
|
2
|
+
import './sdk-agent-a3fW1xUK.js';
|
|
3
3
|
import './agent-prims-CZyxfCmS.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import './errors-base-B5g01neU.js';
|
package/dist/types/agent.d.ts
CHANGED
|
@@ -344,6 +344,12 @@ export interface SkillsSettings {
|
|
|
344
344
|
* default `<cwd>/.theokit/skills`. Absent ⇒ the default root.
|
|
345
345
|
*/
|
|
346
346
|
skillsDir?: string;
|
|
347
|
+
/**
|
|
348
|
+
* B-546 — directories (each containing `<name>/SKILL.md`) an application ships inside its own
|
|
349
|
+
* package. They are read AFTER the project roots and plugin bundles, so a workspace skill of the
|
|
350
|
+
* same name always wins, and they are kept even when `skillsDir` replaces the default roots.
|
|
351
|
+
*/
|
|
352
|
+
bundledDirs?: string[];
|
|
347
353
|
/**
|
|
348
354
|
* M22 — code-defined skills (from `createSkill`) merged with the discovered ones. An inline skill
|
|
349
355
|
* overrides a discovered file skill of the same name.
|
|
@@ -581,7 +587,14 @@ export interface AgentOptions {
|
|
|
581
587
|
*
|
|
582
588
|
* - **Named-enable settings** — `{ enabled: ["name", ...] }`. Selects which
|
|
583
589
|
* file-discovered plugin providers (under `.theokit/plugins/`) are active.
|
|
584
|
-
* Plugin sources must also be active via `local.settingSources`.
|
|
590
|
+
* Plugin sources must also be active via `local.settingSources`. A folder
|
|
591
|
+
* under `<cwd>/.theokit/plugins/` whose `PLUGIN.md` names an `entry` has
|
|
592
|
+
* that entry imported and its default export (a `kind: "general"` plugin)
|
|
593
|
+
* registered, but only when the folder's absolute realpath is listed in
|
|
594
|
+
* `~/.theokit/plugins/trusted-workspace-plugins.json` (a JSON array, read on
|
|
595
|
+
* each `Agent.create`). The provider trust list never authorizes a workspace
|
|
596
|
+
* folder. An untrusted folder is listed and never imported; foreign roots
|
|
597
|
+
* are never imported.
|
|
585
598
|
* - **Code `Plugin` objects** — an array of `Plugin` instances, e.g.
|
|
586
599
|
* `plugins: [Handoff.asPlugin({ ... })]`. These are registered directly by
|
|
587
600
|
* the runtime (`extractCodePlugins`); no `settingSources` entry is needed.
|
package/dist/types/run.d.ts
CHANGED
|
@@ -24,6 +24,17 @@ export interface ToolResultGuardOptions {
|
|
|
24
24
|
/** Redact common PII patterns (email, phone) in tool-result content. */
|
|
25
25
|
redactPii?: boolean;
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* B-564 — how old a tool result may get, in tool rounds, before its content is pruned from the
|
|
29
|
+
* next LLM request (`SendOptions.pruneToolResults`). Contract type owned by `types/`; the
|
|
30
|
+
* implementation lives in `internal/agent-loop/prune-tool-results.ts`, which re-exports this.
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export interface PruneToolResultsOptions {
|
|
35
|
+
/** Keep the newest `olderThanRounds` tool rounds whole; an integer of at least 1. */
|
|
36
|
+
olderThanRounds: number;
|
|
37
|
+
}
|
|
27
38
|
/**
|
|
28
39
|
* Lifecycle status of a {@link Run}.
|
|
29
40
|
*
|
|
@@ -315,7 +326,7 @@ export interface SDKUserMessage {
|
|
|
315
326
|
*
|
|
316
327
|
* ## Which options do I need?
|
|
317
328
|
*
|
|
318
|
-
* Twenty-
|
|
329
|
+
* Twenty-two optional fields with genuinely different audiences, so most callers read all of them to
|
|
319
330
|
* find their two. This table is the fix that was chosen; the alternative — nesting the groups under
|
|
320
331
|
* `observe?` and `toolPolicy?` and carrying the flat keys as deprecated aliases for one major — would
|
|
321
332
|
* have added surface to remove surface, and the harm here is the READING cost, not a representable
|
|
@@ -325,7 +336,7 @@ export interface SDKUserMessage {
|
|
|
325
336
|
* | If you are… | you want |
|
|
326
337
|
* |---|---|
|
|
327
338
|
* | rendering a live UI | `onDelta`, `onStep`, `onRunEvent` |
|
|
328
|
-
* | applying a policy | `permissionMode`, `activeTools`, `toolChoice`, `toolResultGuard`, `perToolTimeoutMs` |
|
|
339
|
+
* | applying a policy | `permissionMode`, `activeTools`, `toolChoice`, `toolResultGuard`, `pruneToolResults`, `perToolTimeoutMs` |
|
|
329
340
|
* | running an eval or a harness | `maxIterations`, `completionCheck`, `doomLoop`, `signal` |
|
|
330
341
|
* | orchestrating agents | `origin`, `task`, `context` |
|
|
331
342
|
* | overriding this one send | `model`, `systemPrompt`, `tools`, `mcpServers`, `contextPaths`, `local` |
|
|
@@ -470,6 +481,20 @@ export interface SendOptions {
|
|
|
470
481
|
* @public
|
|
471
482
|
*/
|
|
472
483
|
toolResultGuard?: ToolResultGuardOptions;
|
|
484
|
+
/**
|
|
485
|
+
* B-564 — opt-in pruning of aged tool results. With `{ olderThanRounds: n }`, the content of
|
|
486
|
+
* every tool result older than `n` tool rounds is replaced by a short stub in each request the
|
|
487
|
+
* run's agent loop sends (its `toolUseId` and `isError` kept; session compaction is not pruned); the transcript the run keeps, persists and resumes
|
|
488
|
+
* from stays whole. `olderThanRounds` must be an integer of at least 1, else the send fails
|
|
489
|
+
* with `ConfigurationError` code `invalid_prune_tool_results` before any provider call.
|
|
490
|
+
* Undefined = no pruning (the request is unchanged). Pruning trades request size against
|
|
491
|
+
* prefix-cache reuse: each new round turns one more previously sent result into a stub, so the
|
|
492
|
+
* request prefix changes from that message onward on providers that cache message prefixes.
|
|
493
|
+
* The cache-hit cost was not measured.
|
|
494
|
+
*
|
|
495
|
+
* @public
|
|
496
|
+
*/
|
|
497
|
+
pruneToolResults?: PruneToolResultsOptions;
|
|
473
498
|
/**
|
|
474
499
|
* Opt-in task wrapping (ADRs D363, D374). When truthy, the entire
|
|
475
500
|
* run is registered as a `Task` in the SDK's observable registry —
|
|
@@ -14,13 +14,14 @@
|
|
|
14
14
|
* Measured twice on this file on 2026-09-01: once with the tag, and again when the comment
|
|
15
15
|
* EXPLAINING the trap quoted the tag verbatim and re-armed it.
|
|
16
16
|
*/
|
|
17
|
-
import type
|
|
17
|
+
import { type ZodType, z } from "zod";
|
|
18
18
|
import { TheokitAgentError } from "./errors.js";
|
|
19
19
|
import type { CustomTool } from "./types/agent.js";
|
|
20
|
-
import type { WorkflowRun } from "./types/workflow.js";
|
|
20
|
+
import type { WorkflowResumeOptions, WorkflowRun } from "./types/workflow.js";
|
|
21
21
|
/**
|
|
22
|
-
* Raised by a {@link workflowAsTool} tool when the
|
|
23
|
-
* reach `status: "completed"` (a step failed, the run was cancelled
|
|
22
|
+
* Raised by a {@link workflowAsTool} or {@link workflowResumeTool} tool when the
|
|
23
|
+
* run does not reach `status: "completed"` (a step failed, the run was cancelled,
|
|
24
|
+
* or it suspended without `reportSuspended`, which returns a report instead).
|
|
24
25
|
* The dispatch converts it to a `tool_result(isError)`.
|
|
25
26
|
*
|
|
26
27
|
* @public
|
|
@@ -47,6 +48,22 @@ export interface WorkflowAsToolSpec<T extends ZodType> {
|
|
|
47
48
|
description: string;
|
|
48
49
|
/** Zod schema for the workflow's input (a `Workflow` carries no top-level schema). */
|
|
49
50
|
inputSchema: T;
|
|
51
|
+
/**
|
|
52
|
+
* When `true`, a run that suspends returns `{"status":"suspended","runId":…,"stepId":…}` instead of
|
|
53
|
+
* raising {@link WorkflowToolError}, so the model can hand the run id to a
|
|
54
|
+
* {@link workflowResumeTool}. The report carries ids only, never the suspended payload; `stepId` is
|
|
55
|
+
* `null` for a run that carries no step result. Default `false`.
|
|
56
|
+
*/
|
|
57
|
+
reportSuspended?: boolean;
|
|
58
|
+
}
|
|
59
|
+
/** Spec for {@link workflowResumeTool}. */
|
|
60
|
+
export interface WorkflowResumeToolSpec {
|
|
61
|
+
/** Tool name surfaced to the LLM. Same constraints as a `CustomTool.name`. */
|
|
62
|
+
name: string;
|
|
63
|
+
/** Description surfaced to the LLM — when the agent should resume a suspended run. */
|
|
64
|
+
description: string;
|
|
65
|
+
/** Report a run that suspends again instead of raising, as in {@link WorkflowAsToolSpec}. */
|
|
66
|
+
reportSuspended?: boolean;
|
|
50
67
|
}
|
|
51
68
|
/**
|
|
52
69
|
* SE19 — expose a {@link Workflow} as an agent {@link CustomTool}, completing the
|
|
@@ -54,7 +71,8 @@ export interface WorkflowAsToolSpec<T extends ZodType> {
|
|
|
54
71
|
* The handler validates the model's args against `spec.inputSchema`, runs the
|
|
55
72
|
* workflow, and returns its output (a string as-is, else JSON). A run that does not
|
|
56
73
|
* reach `status: "completed"` raises a typed {@link WorkflowToolError} (workflow
|
|
57
|
-
* step errors do NOT throw — they surface via `run.status === "failed"`)
|
|
74
|
+
* step errors do NOT throw — they surface via `run.status === "failed"`), except a
|
|
75
|
+
* suspended run with `spec.reportSuspended`, which returns the suspended report.
|
|
58
76
|
*
|
|
59
77
|
* Accepts any `{ run }`-shaped workflow (structural), so it never imports the
|
|
60
78
|
* `Workflow` class directly.
|
|
@@ -64,3 +82,19 @@ export interface WorkflowAsToolSpec<T extends ZodType> {
|
|
|
64
82
|
export declare function workflowAsTool<T extends ZodType, TOutput = unknown>(workflow: {
|
|
65
83
|
run: (input: z.infer<T>) => Promise<WorkflowRun<TOutput>>;
|
|
66
84
|
}, spec: WorkflowAsToolSpec<T>): CustomTool;
|
|
85
|
+
/**
|
|
86
|
+
* B-677 — a {@link CustomTool} that resumes a suspended run of `workflow` by its run id, with an
|
|
87
|
+
* optional payload validated against the suspend step's schema. It returns the run's output like
|
|
88
|
+
* {@link workflowAsTool}; a run that suspends again keeps the same run id and is reported or raised
|
|
89
|
+
* per `spec.reportSuspended`. Snapshot errors (`WorkflowSnapshotNotFoundError` for an unknown or
|
|
90
|
+
* already-resumed id, `WorkflowResumeWorkflowMismatchError` for a run another workflow suspended,
|
|
91
|
+
* `WorkflowResumeStepNotFoundError` when `workflow` lacks the suspended step) and payload validation
|
|
92
|
+
* errors propagate to the dispatch.
|
|
93
|
+
*
|
|
94
|
+
* `workflow` must be the committed instance from `Workflow.create().commit()`. The default snapshot
|
|
95
|
+
* store is in memory and process-local: a host that resumes across processes configures a persistent
|
|
96
|
+
* backend. This tool resumes any run id it is given; deciding who may approve a run is the host's job.
|
|
97
|
+
*
|
|
98
|
+
* @public
|
|
99
|
+
*/
|
|
100
|
+
export declare function workflowResumeTool(workflow: WorkflowResumeOptions["workflow"], spec: WorkflowResumeToolSpec): CustomTool;
|
|
@@ -137,6 +137,22 @@ export declare class WorkflowResumeStepNotFoundError extends TheokitAgentError {
|
|
|
137
137
|
readonly name = "WorkflowResumeStepNotFoundError";
|
|
138
138
|
constructor(stepId: string, workflowName: string);
|
|
139
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Thrown by `Workflow.resume()` (and so by a `workflowResumeTool` tool) when the snapshot for the run
|
|
142
|
+
* id was written by a workflow of another name. The snapshot is left in the store, so the workflow
|
|
143
|
+
* that suspended the run can still resume it.
|
|
144
|
+
*
|
|
145
|
+
* Without this check the default store, one process-global memory store, would let workflow B run
|
|
146
|
+
* its own tail on workflow A's accumulated input whenever both declare a step with the suspended id.
|
|
147
|
+
* `name` is a label, not an identity: two workflows that share a name are not told apart here.
|
|
148
|
+
*/
|
|
149
|
+
export declare class WorkflowResumeWorkflowMismatchError extends TheokitAgentError {
|
|
150
|
+
readonly runId: string;
|
|
151
|
+
readonly snapshotWorkflowName: string;
|
|
152
|
+
readonly workflowName: string;
|
|
153
|
+
readonly name = "WorkflowResumeWorkflowMismatchError";
|
|
154
|
+
constructor(runId: string, snapshotWorkflowName: string, workflowName: string);
|
|
155
|
+
}
|
|
140
156
|
/**
|
|
141
157
|
* Aggregate failure from parallel branches.
|
|
142
158
|
*
|