@nylorun/core 0.22.0-beta → 0.24.0-beta
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 +126 -0
- package/README.md +1 -1
- package/dist/compatibility.d.ts +120 -47
- package/dist/compatibility.js +122 -49
- package/dist/contracts.d.ts +2824 -907
- package/dist/contracts.js +1286 -585
- package/dist/define.d.ts +9 -12
- package/dist/define.js +8 -11
- package/dist/definition/assemble.d.ts +1 -3
- package/dist/definition/assemble.js +4 -8
- package/dist/definition/bound.d.ts +1 -1
- package/dist/definition/delegate.d.ts +5 -0
- package/dist/definition/delegate.js +6 -1
- package/dist/definition/from.d.ts +4 -2
- package/dist/definition/from.js +11 -29
- package/dist/definition/http-tool.d.ts +5 -3
- package/dist/definition/http-tool.js +8 -5
- package/dist/definition/manifest.d.ts +7 -6
- package/dist/definition/manifest.js +7 -6
- package/dist/definition/mcp.d.ts +1 -1
- package/dist/definition/media-reference.d.ts +2 -11
- package/dist/definition/media-reference.js +0 -12
- package/dist/definition/model-failure.js +1 -0
- package/dist/definition/removed.d.ts +7 -0
- package/dist/definition/removed.js +21 -0
- package/dist/definition/sections.d.ts +63 -0
- package/dist/definition/sections.js +204 -0
- package/dist/definition/trace.d.ts +0 -7
- package/dist/definition/trace.js +0 -34
- package/dist/definition/variant.d.ts +1 -1
- package/dist/definition/variant.js +1 -3
- package/dist/harness-api/artifacts.d.ts +84 -0
- package/dist/harness-api/artifacts.js +128 -0
- package/dist/harness-api/gates.d.ts +0 -4
- package/dist/harness-api/gates.js +0 -4
- package/dist/harness-api/harness-api.schema.json +2798 -1124
- package/dist/harness-api/index.d.ts +9 -6
- package/dist/harness-api/index.js +9 -6
- package/dist/harness-api/json-schema.js +5 -2
- package/dist/harness-api/mcp.d.ts +77 -30
- package/dist/harness-api/mcp.js +42 -25
- package/dist/harness-api/messages.d.ts +47 -17
- package/dist/harness-api/messages.js +20 -5
- package/dist/harness-api/schema.d.ts +609 -200
- package/dist/harness-api/schema.js +345 -62
- package/dist/harness-api/transcript.d.ts +8 -10
- package/dist/harness-api/transcript.js +27 -11
- package/dist/harness-api/transport.d.ts +7 -1
- package/dist/harness-api/transport.js +10 -7
- package/dist/manifest-schemas.d.ts +9 -5
- package/dist/manifest-schemas.js +23 -27
- package/dist/schemas/agent-manifest.schema.json +1508 -365
- package/dist/schemas/harness-manifest.schema.json +1273 -0
- package/dist/schemas/{environment-manifest.schema.json → runtime-manifest.schema.json} +165 -84
- package/dist/types/manifest.d.ts +72 -14
- package/dist/types/manifest.js +4 -0
- package/dist/types/model.d.ts +15 -5
- package/dist/utils/definition-files.d.ts +20 -6
- package/dist/utils/definition-files.js +31 -17
- package/dist/utils/file-systems.d.ts +20 -0
- package/dist/utils/file-systems.js +20 -0
- package/dist/utils/harness-id.d.ts +4 -1
- package/dist/utils/harness-id.js +4 -1
- package/dist/utils/media-types.d.ts +30 -0
- package/dist/utils/media-types.js +128 -0
- package/dist/utils/memory.d.ts +64 -0
- package/dist/utils/memory.js +139 -0
- package/dist/utils/runtime-limits.d.ts +280 -0
- package/dist/utils/runtime-limits.js +585 -0
- package/dist/utils/runtime-tools.d.ts +8 -16
- package/dist/utils/runtime-tools.js +8 -27
- package/dist/utils/sandbox.d.ts +4 -1
- package/dist/utils/sandbox.js +4 -1
- package/package.json +6 -5
- package/dist/definition/deferred-tools.d.ts +0 -27
- package/dist/definition/deferred-tools.js +0 -82
- package/dist/definition/runtime-manifest.d.ts +0 -30
- package/dist/definition/runtime-manifest.js +0 -132
- package/dist/definition/sandbox-tools.d.ts +0 -5
- package/dist/definition/sandbox-tools.js +0 -109
- package/dist/definition/skill-tools.d.ts +0 -23
- package/dist/definition/skill-tools.js +0 -76
|
@@ -0,0 +1,585 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime limits (harness boundary S0, B15): the sizes, counts and deadlines the Runtime holds
|
|
3
|
+
* what crosses it to, one Tenant setting (`limits.config`, `GET`/`PUT /v1/tenant/limits`) with a
|
|
4
|
+
* default each. A harness learns the ones it must respect from `turn.start.limits`
|
|
5
|
+
* (`HarnessLimitsSchema`, a part of them).
|
|
6
|
+
*
|
|
7
|
+
* A limit is configuration; what the Runtime depends on is not. Each limit has a ceiling taken
|
|
8
|
+
* from a dependency (S2's largest record, the Harness API's largest WebSocket frame, the longest
|
|
9
|
+
* string the JavaScript engine makes, the longest timer it sets, the largest integer a JavaScript
|
|
10
|
+
* number holds exactly), and a setting above its ceiling is refused when it is put
|
|
11
|
+
* (`runtimeLimitIssues`).
|
|
12
|
+
*/
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
import { HARNESS_MAX_PAYLOAD } from "../harness-api/transport.js";
|
|
15
|
+
/**
|
|
16
|
+
* S2's largest record: 1 MiB, metered as 8 bytes, plus its headers, plus its body. The stream
|
|
17
|
+
* relay writes each event's JSON as one record's body, with no headers.
|
|
18
|
+
*/
|
|
19
|
+
export const S2_RECORD_MAX_BYTES = 1024 * 1024;
|
|
20
|
+
/**
|
|
21
|
+
* Room an event's envelope takes beside its payload: ids, cursor, time, writer and principal
|
|
22
|
+
* come to about 1 KiB; 64 KiB leaves them ample room under `S2_RECORD_MAX_BYTES`.
|
|
23
|
+
*/
|
|
24
|
+
export const RECORD_ENVELOPE_RESERVE_BYTES = 64 * 1024;
|
|
25
|
+
/**
|
|
26
|
+
* The longest string V8 makes on 64-bit (`String::kMaxLength`, 2^29 - 24 code units): a JSON
|
|
27
|
+
* body the Runtime reads whole, or a file it sends a provider in base64, is one such string.
|
|
28
|
+
*/
|
|
29
|
+
export const JS_STRING_MAX_LENGTH = 2 ** 29 - 24;
|
|
30
|
+
/**
|
|
31
|
+
* The longest delay a JavaScript timer takes (`setTimeout`, `setInterval`, `AbortSignal.timeout`):
|
|
32
|
+
* a signed 32-bit count of milliseconds, about 24.8 days. A longer one fires at once.
|
|
33
|
+
*/
|
|
34
|
+
export const TIMER_MAX_MS = 2 ** 31 - 1;
|
|
35
|
+
/**
|
|
36
|
+
* The longest single argument Linux passes to a program (`MAX_ARG_STRLEN`, 32 pages of 4 KiB),
|
|
37
|
+
* its terminating NUL included: a setup command is one argument of `/bin/sh -c`.
|
|
38
|
+
*/
|
|
39
|
+
export const LINUX_ARG_MAX_BYTES = 32 * 4096;
|
|
40
|
+
/** The longest setup command that fits it: UTF-8 takes at most 3 bytes for one UTF-16 code unit. */
|
|
41
|
+
const SETUP_COMMAND_MAX_CHARS = Math.floor((LINUX_ARG_MAX_BYTES - 1) / 3);
|
|
42
|
+
/** The most bytes base64 of `length` characters decodes to: groups of 4 characters, 3 bytes each. */
|
|
43
|
+
const base64Bytes = (length) => Math.floor(length / 4) * 3;
|
|
44
|
+
/** The fewest characters one item of a JSON list or map takes: its JSON and the comma after it. */
|
|
45
|
+
const minChars = (item) => JSON.stringify(item).length + 1;
|
|
46
|
+
/**
|
|
47
|
+
* The fewest characters one entry of a folder's manifest takes as JSON: an entry with a
|
|
48
|
+
* one-character path and type. A folder's manifest is read as one string, so it holds at most
|
|
49
|
+
* `JS_STRING_MAX_LENGTH` of them.
|
|
50
|
+
*/
|
|
51
|
+
const FOLDER_ENTRY_MIN_CHARS = minChars({ path: "a", size: 0, sha256: "0".repeat(64), contentType: "a" });
|
|
52
|
+
/** The fewest characters one entry of a disk listing takes as JSON (`DiskOp` `list`). */
|
|
53
|
+
const DISK_ENTRY_MIN_CHARS = minChars({ path: "a", type: "dir", mode: 0 });
|
|
54
|
+
/** The most bytes JSON escapes one character of a quoted text to: a control character, `\u0000`. */
|
|
55
|
+
const JSON_ESCAPE_MAX_BYTES = 6;
|
|
56
|
+
/**
|
|
57
|
+
* The limits a harness must respect, sent in `turn.start.limits`:
|
|
58
|
+
*
|
|
59
|
+
* - `recordEntryBytes`: the most JSON one entry of the record may hold: an event's payload (a
|
|
60
|
+
* harness's claimed event, a transcript update, core's own), and an effect outcome a harness
|
|
61
|
+
* reports. Past it the write is refused with `limit_exceeded`. A transcript edit fills events up
|
|
62
|
+
* to it (`transcriptUpdates`).
|
|
63
|
+
* - `modelCallBytes`: the largest model call body the Model Gate reads.
|
|
64
|
+
* - `modelFileBytes`: the largest file (an image, a text file) the Model Gate sends a model.
|
|
65
|
+
* - `toolAnswerBytes`: the largest answer the Tool Gate keeps of an MCP or HTTP tool
|
|
66
|
+
* (`mcp.too-large`, `http.too-large` past it), and the largest tool call body it reads.
|
|
67
|
+
* - `harnessStateBytes`: the most state a custom harness may keep per session, as JSON.
|
|
68
|
+
* - `chunkBytes`: the most bytes one chunked Harness API answer carries (`definition.file` and
|
|
69
|
+
* `artifact.read` with a range, a disk read).
|
|
70
|
+
* - `folderEntries`: the most files one folder artifact a harness writes may hold
|
|
71
|
+
* (`artifact.write` with `kind: "folder"`, such as our engine's outputs folder).
|
|
72
|
+
*/
|
|
73
|
+
const harnessLimits = {
|
|
74
|
+
recordEntryBytes: z.number().int().positive(),
|
|
75
|
+
modelCallBytes: z.number().int().positive(),
|
|
76
|
+
modelFileBytes: z.number().int().positive(),
|
|
77
|
+
toolAnswerBytes: z.number().int().positive(),
|
|
78
|
+
harnessStateBytes: z.number().int().positive(),
|
|
79
|
+
chunkBytes: z.number().int().positive(),
|
|
80
|
+
folderEntries: z.number().int().positive(),
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* The Runtime limits: the harness's (above), and the ones only the Runtime checks (B15), by area.
|
|
84
|
+
*
|
|
85
|
+
* Requests and uploads:
|
|
86
|
+
* - `requestBodyBytes`: the largest JSON body a Runtime or Management API route reads.
|
|
87
|
+
* - `messageParts`: the most parts one user message carries (text and files).
|
|
88
|
+
* - `pageItems`: the most items one page of a listing holds (`limit`), and `exportPageItems` one
|
|
89
|
+
* page of the model call export (`GET /v1/tenant/calls/model`). A page asked for with no
|
|
90
|
+
* `limit` holds the route's default, or this limit when it is lower; one asking more holds this
|
|
91
|
+
* many. `environmentEventItems`: the most events one read of an Environment's events returns.
|
|
92
|
+
* - `inlineFileBytes`: the largest file a message carries inline, decoded (AG-UI, A2A). Such an
|
|
93
|
+
* endpoint reads a body of one file at this size in base64 and `requestBodyBytes` more
|
|
94
|
+
* (`inlineBodyBytes`).
|
|
95
|
+
* - `a2aWaitMs`: how long a blocking A2A `SendMessage` waits for its task to end or ask for input.
|
|
96
|
+
* - `errorExcerptChars`: how much of a failed MCP server's or HTTP tool's answer an error quotes.
|
|
97
|
+
* - `traceContentBytes`: the most UTF-8 bytes of one content attribute of an exported span.
|
|
98
|
+
*
|
|
99
|
+
* Labels (an Environment's and an artifact's, checked whenever they are set):
|
|
100
|
+
* - `environmentLabels`, `artifactLabels`: the most labels one Environment, and one artifact,
|
|
101
|
+
* carries.
|
|
102
|
+
* - `labelKeyChars`, `labelValueChars`: the longest label key, and value.
|
|
103
|
+
*
|
|
104
|
+
* Environments (checked when one is made):
|
|
105
|
+
* - `environmentSetupCommands`, `environmentFiles`: the most setup commands, and input file
|
|
106
|
+
* entries, one manifest holds.
|
|
107
|
+
* - `environmentFilesPerEntry`: the most files one input file entry by hash names.
|
|
108
|
+
* - `environmentSecretSlots`: the most secret slots one manifest declares.
|
|
109
|
+
* - `setupCommandChars`: the longest setup command.
|
|
110
|
+
* - `setupCommandMs`: the longest `timeout` one setup command may ask for (a command's default is
|
|
111
|
+
* 10 minutes).
|
|
112
|
+
* - `setupOutputChars`: how much of a failed setup command's output its event keeps.
|
|
113
|
+
* - `setupReasonChars`, `setupCommandExcerptChars`: how much of the end of that output, and of
|
|
114
|
+
* the start of the command, a failed pod's reason quotes.
|
|
115
|
+
* - `manifestDescriptionChars`, `secretDescriptionChars`: the longest description of an
|
|
116
|
+
* environment manifest, and of one of its secret slots.
|
|
117
|
+
*
|
|
118
|
+
* Secrets (checked when one is written, and a manifest's slots when it is put):
|
|
119
|
+
* - `secretValueChars`: the longest value of an `environment_secret` or `environment_variable`.
|
|
120
|
+
* - `secretHosts`: the most hosts one `environment_secret` may be sent to (`allowedHosts`).
|
|
121
|
+
*
|
|
122
|
+
* Disk versions:
|
|
123
|
+
* - `diskVersionEntries`, `diskVersionBytes`: the most entries, and bytes of files, one version
|
|
124
|
+
* of an Environment's disk holds (an Environment's manifest may set less: `limits.disk`).
|
|
125
|
+
* - `diskLeaseMs`: how long a disk copy's lease lasts unrenewed; the copy renews it every quarter
|
|
126
|
+
* of it, and a copy whose process died is taken over once it lapses.
|
|
127
|
+
* - `diskPodWaitMs`: how long a disk copy waits for a pod's engine to connect.
|
|
128
|
+
*
|
|
129
|
+
* Model calls (the Model Gate's provider calls):
|
|
130
|
+
* - `modelRequestMs`: the longest one provider request may take.
|
|
131
|
+
* - `modelIdleMs`: how long a provider's stream may go without an event before the attempt is
|
|
132
|
+
* abandoned and tried again.
|
|
133
|
+
* - `modelAttempts`: the attempts one call makes, the first included.
|
|
134
|
+
* - `modelRetryDelayMs`: the delay before the second attempt; it doubles each time, with jitter.
|
|
135
|
+
* - `modelProviderRetries`, `modelRetryDelayMaxMs`: the retries the provider's SDK makes within
|
|
136
|
+
* one attempt, and the longest delay it waits before one.
|
|
137
|
+
*
|
|
138
|
+
* Tools:
|
|
139
|
+
* - `toolAttempts`: how many times an MCP or HTTP tool call is sent, across crashes and lost
|
|
140
|
+
* hops, before it fails to the model as `tool.interrupted`.
|
|
141
|
+
* - `httpToolTimeoutMs`: the longest `timeoutMs` an HTTP tool may ask for (a tool's default is
|
|
142
|
+
* 60 s), checked when an agent is deployed and when the tool is called.
|
|
143
|
+
* - `mcpSnapshotBytes`: the most JSON a session pins of what its MCP servers said at discovery
|
|
144
|
+
* (tools with their schemas, instructions), which every `turn.start.mcp` carries. A server that
|
|
145
|
+
* does not fit is left out, with a diagnostic.
|
|
146
|
+
* - `mcpPreviewMs`: how long an MCP preview may take, `initialize` and every `tools/list` page.
|
|
147
|
+
* - `mcpMetadataBytes`: the largest protected-resource metadata document a preview reads.
|
|
148
|
+
* - `toolRules`: the most rules the Tenant's tool policy holds; `toolRuleFieldChars` the longest
|
|
149
|
+
* selector (`tool`, `server`, `agent`) or `when` path of one, and `toolRuleTextChars` the
|
|
150
|
+
* longest `reason` or `matches` expression.
|
|
151
|
+
* - `modelBudgets`: the most model budgets the Tenant sets.
|
|
152
|
+
*
|
|
153
|
+
* Triggers (track T4, D74; checked when a manifest is saved, and when a trigger fires):
|
|
154
|
+
* - `triggersPerAgent`: the most triggers one agent manifest declares.
|
|
155
|
+
* - `triggerMinIntervalMs`: the shortest gap between two runs of one schedule (cron is minute
|
|
156
|
+
* grained, so at least a minute), checked over its next fires at save.
|
|
157
|
+
* - `triggerRunsPerHour`: the most runs one Agent's triggers start or queue in any hour; later
|
|
158
|
+
* ones are skipped (`rate_limited`). The guard against an Agent triggering itself.
|
|
159
|
+
* - `triggerJitterPercent`, `triggerJitterMaxMs`: how far each schedule's fixed offset may move
|
|
160
|
+
* its runs, as a part of its interval and at most.
|
|
161
|
+
* - `triggerPromptChars`: the longest prompt one trigger holds.
|
|
162
|
+
* - `triggerRunRetentionMs`: how long runs are kept; they dedupe repeated fires, so at least a day.
|
|
163
|
+
* - `wakeMaxAheadMs`: how far ahead `schedule_wake` may book a session's next turn (D77); at least
|
|
164
|
+
* `triggerMinIntervalMs` ahead too. A long wait is armed in steps, so it has no timer ceiling.
|
|
165
|
+
* - `wakeNoteChars`: the longest note a booked wake carries to its turn.
|
|
166
|
+
* - `webhookBodyBytes`: the largest delivery a webhook endpoint reads, before it verifies it
|
|
167
|
+
* (`413` past it); the payload goes into the turn's message, one record entry.
|
|
168
|
+
*
|
|
169
|
+
* Memory (track T5, D72; checked on every write):
|
|
170
|
+
* - `memoryBytes`: the largest memory, in UTF-8 bytes.
|
|
171
|
+
* - `memoriesPerAgent`: the most memories one Agent holds.
|
|
172
|
+
* - `memoryIndexLines`, `memoryIndexBytes`: the most lines and UTF-8 bytes of the index a session
|
|
173
|
+
* pins at its start (`turn.start.memory.index`); the newest memories come first.
|
|
174
|
+
*
|
|
175
|
+
* Sessions:
|
|
176
|
+
* - `sessionQueuedMessages`: the most messages one session's queue holds while its turn runs or
|
|
177
|
+
* waits (protocol 17); one more is `429 queue_full`.
|
|
178
|
+
*
|
|
179
|
+
* Flows (`workflows.md` §13):
|
|
180
|
+
* - `flowConcurrency`: the most effects one flow turn runs at once; the rest wait their turn.
|
|
181
|
+
* - `flowMapItems`: the most items one map stage may fan out to (`map.too-many-items` past it).
|
|
182
|
+
* - `flowLoopIterations`: the most iterations one loop stage runs (`loop.too-many-iterations`).
|
|
183
|
+
*/
|
|
184
|
+
export const RuntimeLimitsSchema = z
|
|
185
|
+
.object({
|
|
186
|
+
...harnessLimits,
|
|
187
|
+
requestBodyBytes: z.number().int().positive(),
|
|
188
|
+
messageParts: z.number().int().positive(),
|
|
189
|
+
pageItems: z.number().int().positive(),
|
|
190
|
+
exportPageItems: z.number().int().positive(),
|
|
191
|
+
environmentEventItems: z.number().int().positive(),
|
|
192
|
+
inlineFileBytes: z.number().int().positive(),
|
|
193
|
+
a2aWaitMs: z.number().int().positive(),
|
|
194
|
+
errorExcerptChars: z.number().int().positive(),
|
|
195
|
+
traceContentBytes: z.number().int().positive(),
|
|
196
|
+
environmentLabels: z.number().int().positive(),
|
|
197
|
+
artifactLabels: z.number().int().positive(),
|
|
198
|
+
labelKeyChars: z.number().int().positive(),
|
|
199
|
+
labelValueChars: z.number().int().positive(),
|
|
200
|
+
environmentSetupCommands: z.number().int().positive(),
|
|
201
|
+
environmentFiles: z.number().int().positive(),
|
|
202
|
+
environmentFilesPerEntry: z.number().int().positive(),
|
|
203
|
+
environmentSecretSlots: z.number().int().positive(),
|
|
204
|
+
setupCommandChars: z.number().int().positive(),
|
|
205
|
+
setupCommandMs: z.number().int().positive(),
|
|
206
|
+
setupOutputChars: z.number().int().positive(),
|
|
207
|
+
setupReasonChars: z.number().int().positive(),
|
|
208
|
+
setupCommandExcerptChars: z.number().int().positive(),
|
|
209
|
+
manifestDescriptionChars: z.number().int().positive(),
|
|
210
|
+
secretDescriptionChars: z.number().int().positive(),
|
|
211
|
+
secretValueChars: z.number().int().positive(),
|
|
212
|
+
secretHosts: z.number().int().positive(),
|
|
213
|
+
diskVersionEntries: z.number().int().positive(),
|
|
214
|
+
diskVersionBytes: z.number().int().positive(),
|
|
215
|
+
diskLeaseMs: z.number().int().positive(),
|
|
216
|
+
diskPodWaitMs: z.number().int().positive(),
|
|
217
|
+
modelRequestMs: z.number().int().positive(),
|
|
218
|
+
modelIdleMs: z.number().int().positive(),
|
|
219
|
+
modelAttempts: z.number().int().positive(),
|
|
220
|
+
modelRetryDelayMs: z.number().int().positive(),
|
|
221
|
+
modelProviderRetries: z.number().int().nonnegative(),
|
|
222
|
+
modelRetryDelayMaxMs: z.number().int().positive(),
|
|
223
|
+
toolAttempts: z.number().int().positive(),
|
|
224
|
+
httpToolTimeoutMs: z.number().int().positive(),
|
|
225
|
+
mcpSnapshotBytes: z.number().int().positive(),
|
|
226
|
+
mcpPreviewMs: z.number().int().positive(),
|
|
227
|
+
mcpMetadataBytes: z.number().int().positive(),
|
|
228
|
+
toolRules: z.number().int().positive(),
|
|
229
|
+
toolRuleFieldChars: z.number().int().positive(),
|
|
230
|
+
toolRuleTextChars: z.number().int().positive(),
|
|
231
|
+
modelBudgets: z.number().int().positive(),
|
|
232
|
+
triggersPerAgent: z.number().int().positive(),
|
|
233
|
+
triggerMinIntervalMs: z.number().int().positive(),
|
|
234
|
+
triggerRunsPerHour: z.number().int().positive(),
|
|
235
|
+
triggerJitterPercent: z.number().int().nonnegative(),
|
|
236
|
+
triggerJitterMaxMs: z.number().int().nonnegative(),
|
|
237
|
+
triggerPromptChars: z.number().int().positive(),
|
|
238
|
+
triggerRunRetentionMs: z.number().int().positive(),
|
|
239
|
+
webhookBodyBytes: z.number().int().positive(),
|
|
240
|
+
wakeMaxAheadMs: z.number().int().positive(),
|
|
241
|
+
wakeNoteChars: z.number().int().positive(),
|
|
242
|
+
memoryBytes: z.number().int().positive(),
|
|
243
|
+
memoriesPerAgent: z.number().int().positive(),
|
|
244
|
+
memoryIndexLines: z.number().int().positive(),
|
|
245
|
+
memoryIndexBytes: z.number().int().positive(),
|
|
246
|
+
sessionQueuedMessages: z.number().int().positive(),
|
|
247
|
+
flowConcurrency: z.number().int().positive(),
|
|
248
|
+
flowMapItems: z.number().int().positive(),
|
|
249
|
+
flowLoopIterations: z.number().int().positive(),
|
|
250
|
+
})
|
|
251
|
+
.strict();
|
|
252
|
+
/**
|
|
253
|
+
* The Runtime limits a harness must respect (`turn.start.limits`). A limit the Runtime adds later
|
|
254
|
+
* that a harness does not know is dropped when it parses them.
|
|
255
|
+
*/
|
|
256
|
+
export const HarnessLimitsSchema = z.object(harnessLimits);
|
|
257
|
+
const HARNESS_LIMIT_NAMES = Object.keys(harnessLimits);
|
|
258
|
+
/** The part of `limits` a harness is sent. */
|
|
259
|
+
export function harnessLimitsOf(limits) {
|
|
260
|
+
return Object.fromEntries(HARNESS_LIMIT_NAMES.map((name) => [name, limits[name]]));
|
|
261
|
+
}
|
|
262
|
+
const recordEntryCeiling = S2_RECORD_MAX_BYTES - RECORD_ENVELOPE_RESERVE_BYTES;
|
|
263
|
+
/** A time a JavaScript timer waits. */
|
|
264
|
+
const timer = (what) => ({
|
|
265
|
+
value: TIMER_MAX_MS,
|
|
266
|
+
unit: "milliseconds",
|
|
267
|
+
why: `${what} with a JavaScript timer, which waits at most ${TIMER_MAX_MS} ms`,
|
|
268
|
+
});
|
|
269
|
+
/** A number the Runtime counts or adds up, with no other bound. */
|
|
270
|
+
const counted = (unit, what) => ({
|
|
271
|
+
value: Number.MAX_SAFE_INTEGER,
|
|
272
|
+
unit,
|
|
273
|
+
why: `${what} in a JavaScript number, exact up to ${Number.MAX_SAFE_INTEGER}`,
|
|
274
|
+
});
|
|
275
|
+
/** A count of items one request carries, which is read as one string. */
|
|
276
|
+
const inRequest = (what, item) => {
|
|
277
|
+
const chars = minChars(item);
|
|
278
|
+
return {
|
|
279
|
+
value: Math.floor(JS_STRING_MAX_LENGTH / chars),
|
|
280
|
+
unit: "entries",
|
|
281
|
+
why: `${what} arrive in one request body, read as one string of at most ${JS_STRING_MAX_LENGTH} characters, and each takes at least ${chars}`,
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
/** A count of items one answer carries, which is written as one string. */
|
|
285
|
+
const inAnswer = (what, item) => {
|
|
286
|
+
const chars = minChars(item);
|
|
287
|
+
return {
|
|
288
|
+
value: Math.floor(JS_STRING_MAX_LENGTH / chars),
|
|
289
|
+
unit: "entries",
|
|
290
|
+
why: `${what} go in one response body, written as one string of at most ${JS_STRING_MAX_LENGTH} characters, and each takes at least ${chars}`,
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
/** A text one request carries. */
|
|
294
|
+
const inRequestText = (what) => ({
|
|
295
|
+
value: JS_STRING_MAX_LENGTH,
|
|
296
|
+
unit: "characters",
|
|
297
|
+
why: `${what} arrives in one request body, read as one string of at most ${JS_STRING_MAX_LENGTH} characters`,
|
|
298
|
+
});
|
|
299
|
+
/** A text quoted in one record entry, as JSON. */
|
|
300
|
+
const quoted = (what) => ({
|
|
301
|
+
value: Math.floor(recordEntryCeiling / JSON_ESCAPE_MAX_BYTES),
|
|
302
|
+
unit: "characters",
|
|
303
|
+
why: `${what} is kept in one record entry (at most ${recordEntryCeiling} bytes), where JSON may escape a character to ${JSON_ESCAPE_MAX_BYTES}`,
|
|
304
|
+
});
|
|
305
|
+
/**
|
|
306
|
+
* Each limit's ceiling, which no setting may pass, what it counts, and the dependency it comes
|
|
307
|
+
* from.
|
|
308
|
+
*/
|
|
309
|
+
export const RUNTIME_LIMIT_CEILINGS = {
|
|
310
|
+
recordEntryBytes: {
|
|
311
|
+
value: recordEntryCeiling,
|
|
312
|
+
unit: "bytes",
|
|
313
|
+
why: `S2 takes records of at most ${S2_RECORD_MAX_BYTES} bytes, and an event's envelope needs ${RECORD_ENVELOPE_RESERVE_BYTES} beside its payload`,
|
|
314
|
+
},
|
|
315
|
+
modelCallBytes: {
|
|
316
|
+
value: JS_STRING_MAX_LENGTH,
|
|
317
|
+
unit: "bytes",
|
|
318
|
+
why: `the Model Gate reads a call's body as one string, of at most ${JS_STRING_MAX_LENGTH} characters`,
|
|
319
|
+
},
|
|
320
|
+
modelFileBytes: {
|
|
321
|
+
value: base64Bytes(JS_STRING_MAX_LENGTH),
|
|
322
|
+
unit: "bytes",
|
|
323
|
+
why: `a file goes to the provider as one base64 string, of at most ${JS_STRING_MAX_LENGTH} characters`,
|
|
324
|
+
},
|
|
325
|
+
toolAnswerBytes: {
|
|
326
|
+
value: HARNESS_MAX_PAYLOAD / 2,
|
|
327
|
+
unit: "bytes",
|
|
328
|
+
why: `a harness reports the answer to core in one Harness API frame (${HARNESS_MAX_PAYLOAD} bytes), as JSON, whose escapes may double it`,
|
|
329
|
+
},
|
|
330
|
+
harnessStateBytes: {
|
|
331
|
+
value: HARNESS_MAX_PAYLOAD / 2,
|
|
332
|
+
unit: "bytes",
|
|
333
|
+
why: `the state crosses in one Harness API frame (${HARNESS_MAX_PAYLOAD} bytes) with the rest of its output or turn.start`,
|
|
334
|
+
},
|
|
335
|
+
chunkBytes: {
|
|
336
|
+
value: base64Bytes(HARNESS_MAX_PAYLOAD) - RECORD_ENVELOPE_RESERVE_BYTES,
|
|
337
|
+
unit: "bytes",
|
|
338
|
+
why: `a chunk crosses in base64 in one Harness API frame (${HARNESS_MAX_PAYLOAD} bytes), with room for the frame's own JSON`,
|
|
339
|
+
},
|
|
340
|
+
folderEntries: {
|
|
341
|
+
value: Math.floor(JS_STRING_MAX_LENGTH / FOLDER_ENTRY_MIN_CHARS),
|
|
342
|
+
unit: "entries",
|
|
343
|
+
why: `a folder's manifest is read as one string, of at most ${JS_STRING_MAX_LENGTH} characters, and each entry takes at least ${FOLDER_ENTRY_MIN_CHARS}`,
|
|
344
|
+
},
|
|
345
|
+
requestBodyBytes: {
|
|
346
|
+
value: JS_STRING_MAX_LENGTH,
|
|
347
|
+
unit: "bytes",
|
|
348
|
+
why: `a body is read as one string, of at most ${JS_STRING_MAX_LENGTH} characters`,
|
|
349
|
+
},
|
|
350
|
+
messageParts: inRequest("parts", { type: "text", text: "a" }),
|
|
351
|
+
pageItems: inAnswer("a page's items", {}),
|
|
352
|
+
exportPageItems: inAnswer("a page's calls", {}),
|
|
353
|
+
environmentEventItems: inAnswer("the events", {}),
|
|
354
|
+
inlineFileBytes: {
|
|
355
|
+
value: base64Bytes(JS_STRING_MAX_LENGTH),
|
|
356
|
+
unit: "bytes",
|
|
357
|
+
why: `a file sent inline arrives in base64 in a body read as one string, of at most ${JS_STRING_MAX_LENGTH} characters`,
|
|
358
|
+
},
|
|
359
|
+
a2aWaitMs: timer("the wait is timed"),
|
|
360
|
+
errorExcerptChars: quoted("the excerpt"),
|
|
361
|
+
traceContentBytes: {
|
|
362
|
+
value: recordEntryCeiling,
|
|
363
|
+
unit: "bytes",
|
|
364
|
+
why: `span content is cut from one record entry, which holds at most ${recordEntryCeiling} bytes`,
|
|
365
|
+
},
|
|
366
|
+
environmentLabels: inRequest("labels", { a: "" }),
|
|
367
|
+
artifactLabels: inRequest("labels", { a: "" }),
|
|
368
|
+
labelKeyChars: inRequestText("a label key"),
|
|
369
|
+
labelValueChars: inRequestText("a label value"),
|
|
370
|
+
environmentSetupCommands: inRequest("setup commands", { command: "a" }),
|
|
371
|
+
environmentFiles: inRequest("input file entries", { path: "/workspace", files: {} }),
|
|
372
|
+
environmentFilesPerEntry: inRequest("the files of an entry", { a: `sha256:${"0".repeat(64)}` }),
|
|
373
|
+
environmentSecretSlots: inRequest("secret slots", { A: { type: "environment_variable" } }),
|
|
374
|
+
setupCommandChars: {
|
|
375
|
+
value: SETUP_COMMAND_MAX_CHARS,
|
|
376
|
+
unit: "characters",
|
|
377
|
+
why: `a command runs as one argument of /bin/sh -c, which Linux takes up to ${LINUX_ARG_MAX_BYTES} bytes long (MAX_ARG_STRLEN, with its NUL), and UTF-8 may take 3 bytes for a character`,
|
|
378
|
+
},
|
|
379
|
+
setupCommandMs: timer("the engine times a command"),
|
|
380
|
+
setupOutputChars: quoted("the output"),
|
|
381
|
+
setupReasonChars: quoted("the reason"),
|
|
382
|
+
setupCommandExcerptChars: quoted("the reason"),
|
|
383
|
+
manifestDescriptionChars: inRequestText("a description"),
|
|
384
|
+
secretDescriptionChars: inRequestText("a description"),
|
|
385
|
+
secretValueChars: inRequestText("a value"),
|
|
386
|
+
secretHosts: inRequest("hosts", "a.b"),
|
|
387
|
+
diskVersionEntries: {
|
|
388
|
+
value: Math.min(Math.floor(JS_STRING_MAX_LENGTH / FOLDER_ENTRY_MIN_CHARS), Math.floor(HARNESS_MAX_PAYLOAD / DISK_ENTRY_MIN_CHARS)),
|
|
389
|
+
unit: "entries",
|
|
390
|
+
why: `a disk is listed in one Harness API frame (${HARNESS_MAX_PAYLOAD} bytes, each entry at least ${DISK_ENTRY_MIN_CHARS}), and a version's manifest is read as one string of at most ${JS_STRING_MAX_LENGTH} characters`,
|
|
391
|
+
},
|
|
392
|
+
diskVersionBytes: counted("bytes", "the files' sizes are added up"),
|
|
393
|
+
diskLeaseMs: timer("the lease is renewed"),
|
|
394
|
+
diskPodWaitMs: counted("milliseconds", "the deadline is reckoned from the clock"),
|
|
395
|
+
modelRequestMs: timer("the provider's SDK times the request"),
|
|
396
|
+
modelIdleMs: timer("the stream's silence is timed"),
|
|
397
|
+
modelAttempts: counted("attempts", "attempts are counted"),
|
|
398
|
+
modelRetryDelayMs: timer("the delay is waited"),
|
|
399
|
+
modelProviderRetries: counted("retries", "retries are counted"),
|
|
400
|
+
modelRetryDelayMaxMs: timer("the delay is waited"),
|
|
401
|
+
toolAttempts: counted("attempts", "sends are counted"),
|
|
402
|
+
httpToolTimeoutMs: timer("the call is timed"),
|
|
403
|
+
mcpSnapshotBytes: {
|
|
404
|
+
value: HARNESS_MAX_PAYLOAD / 4,
|
|
405
|
+
unit: "bytes",
|
|
406
|
+
why: `the facts cross in turn.start, one Harness API frame (${HARNESS_MAX_PAYLOAD} bytes), beside the harness's state (at most half of it) and the rest`,
|
|
407
|
+
},
|
|
408
|
+
mcpPreviewMs: timer("the preview is timed"),
|
|
409
|
+
mcpMetadataBytes: {
|
|
410
|
+
value: JS_STRING_MAX_LENGTH,
|
|
411
|
+
unit: "bytes",
|
|
412
|
+
why: `the document is read as one string, of at most ${JS_STRING_MAX_LENGTH} characters`,
|
|
413
|
+
},
|
|
414
|
+
toolRules: inRequest("rules", { effect: "allow" }),
|
|
415
|
+
toolRuleFieldChars: inRequestText("a selector"),
|
|
416
|
+
toolRuleTextChars: inRequestText("a text"),
|
|
417
|
+
modelBudgets: inRequest("budgets", { scope: "tenant" }),
|
|
418
|
+
triggersPerAgent: inRequest("triggers", { a: { at: "2026-01-01T00:00:00Z", session: "a", prompt: "a" } }),
|
|
419
|
+
triggerMinIntervalMs: counted("milliseconds", "the gap is reckoned from the clock"),
|
|
420
|
+
triggerRunsPerHour: counted("runs", "runs are counted"),
|
|
421
|
+
triggerJitterPercent: {
|
|
422
|
+
value: 50,
|
|
423
|
+
unit: "percent",
|
|
424
|
+
why: "an offset past half the interval could move a run past the next one",
|
|
425
|
+
},
|
|
426
|
+
triggerJitterMaxMs: timer("the offset is waited"),
|
|
427
|
+
triggerPromptChars: quoted("the prompt"),
|
|
428
|
+
triggerRunRetentionMs: counted("milliseconds", "the age is reckoned from the clock"),
|
|
429
|
+
wakeMaxAheadMs: counted("milliseconds", "the time is reckoned from the clock"),
|
|
430
|
+
wakeNoteChars: quoted("the note"),
|
|
431
|
+
memoryBytes: {
|
|
432
|
+
value: HARNESS_MAX_PAYLOAD / 2,
|
|
433
|
+
unit: "bytes",
|
|
434
|
+
why: `a memory reaches a harness in one Harness API frame (${HARNESS_MAX_PAYLOAD} bytes), as JSON, whose escapes may double it`,
|
|
435
|
+
},
|
|
436
|
+
memoriesPerAgent: counted("entries", "memories are counted"),
|
|
437
|
+
memoryIndexLines: counted("entries", "the lines are counted"),
|
|
438
|
+
memoryIndexBytes: {
|
|
439
|
+
value: HARNESS_MAX_PAYLOAD / 4,
|
|
440
|
+
unit: "bytes",
|
|
441
|
+
why: `the index crosses in turn.start, one Harness API frame (${HARNESS_MAX_PAYLOAD} bytes), beside the harness's state and the rest`,
|
|
442
|
+
},
|
|
443
|
+
webhookBodyBytes: {
|
|
444
|
+
value: recordEntryCeiling,
|
|
445
|
+
unit: "bytes",
|
|
446
|
+
why: `the payload goes into one record entry, which holds at most ${recordEntryCeiling} bytes`,
|
|
447
|
+
},
|
|
448
|
+
sessionQueuedMessages: counted("entries", "queued messages are counted"),
|
|
449
|
+
flowConcurrency: counted("effects", "running effects are counted"),
|
|
450
|
+
flowMapItems: counted("entries", "items are counted"),
|
|
451
|
+
flowLoopIterations: counted("iterations", "iterations are counted"),
|
|
452
|
+
};
|
|
453
|
+
/**
|
|
454
|
+
* The limits a Tenant that sets none runs with: today's sizes and times. `recordEntryBytes` is
|
|
455
|
+
* its ceiling, so every event S2 took before is still taken; what keeps a step's tool results
|
|
456
|
+
* well inside it is the harness's shaping of them (Nylorun's engine: 256 KiB a step,
|
|
457
|
+
* `shapeToolOutcome` in `@nylorun/harness`), since the record refuses an entry past it.
|
|
458
|
+
*/
|
|
459
|
+
export const RUNTIME_LIMIT_DEFAULTS = Object.freeze({
|
|
460
|
+
recordEntryBytes: RUNTIME_LIMIT_CEILINGS.recordEntryBytes.value,
|
|
461
|
+
modelCallBytes: 32 * 1024 * 1024,
|
|
462
|
+
modelFileBytes: 8 * 1024 * 1024,
|
|
463
|
+
toolAnswerBytes: 8 * 1024 * 1024,
|
|
464
|
+
harnessStateBytes: 256 * 1024,
|
|
465
|
+
chunkBytes: 16 * 1024 * 1024,
|
|
466
|
+
folderEntries: 10_000,
|
|
467
|
+
requestBodyBytes: 1024 * 1024,
|
|
468
|
+
messageParts: 32,
|
|
469
|
+
pageItems: 200,
|
|
470
|
+
exportPageItems: 1_000,
|
|
471
|
+
environmentEventItems: 1_000,
|
|
472
|
+
inlineFileBytes: 20 * 1024 * 1024,
|
|
473
|
+
a2aWaitMs: 5 * 60_000,
|
|
474
|
+
errorExcerptChars: 2_000,
|
|
475
|
+
traceContentBytes: 8 * 1024,
|
|
476
|
+
environmentLabels: 32,
|
|
477
|
+
artifactLabels: 32,
|
|
478
|
+
labelKeyChars: 63,
|
|
479
|
+
labelValueChars: 256,
|
|
480
|
+
environmentSetupCommands: 16,
|
|
481
|
+
environmentFiles: 16,
|
|
482
|
+
environmentFilesPerEntry: 1_000,
|
|
483
|
+
environmentSecretSlots: 64,
|
|
484
|
+
setupCommandChars: 4_096,
|
|
485
|
+
setupCommandMs: 30 * 60_000,
|
|
486
|
+
setupOutputChars: 4 * 1024,
|
|
487
|
+
setupReasonChars: 500,
|
|
488
|
+
setupCommandExcerptChars: 80,
|
|
489
|
+
manifestDescriptionChars: 1_024,
|
|
490
|
+
secretDescriptionChars: 500,
|
|
491
|
+
secretValueChars: 8_192,
|
|
492
|
+
secretHosts: 32,
|
|
493
|
+
diskVersionEntries: 200_000,
|
|
494
|
+
diskVersionBytes: 10 * 1024 ** 3,
|
|
495
|
+
diskLeaseMs: 2 * 60_000,
|
|
496
|
+
diskPodWaitMs: 60_000,
|
|
497
|
+
modelRequestMs: 600_000,
|
|
498
|
+
modelIdleMs: 300_000,
|
|
499
|
+
modelAttempts: 3,
|
|
500
|
+
modelRetryDelayMs: 2_000,
|
|
501
|
+
modelProviderRetries: 2,
|
|
502
|
+
modelRetryDelayMaxMs: 60_000,
|
|
503
|
+
toolAttempts: 3,
|
|
504
|
+
httpToolTimeoutMs: 300_000,
|
|
505
|
+
mcpSnapshotBytes: 4 * 1024 * 1024,
|
|
506
|
+
mcpPreviewMs: 15_000,
|
|
507
|
+
mcpMetadataBytes: 64 * 1024,
|
|
508
|
+
toolRules: 200,
|
|
509
|
+
toolRuleFieldChars: 200,
|
|
510
|
+
toolRuleTextChars: 500,
|
|
511
|
+
modelBudgets: 100,
|
|
512
|
+
triggersPerAgent: 20,
|
|
513
|
+
triggerMinIntervalMs: 60_000,
|
|
514
|
+
triggerRunsPerHour: 60,
|
|
515
|
+
triggerJitterPercent: 10,
|
|
516
|
+
triggerJitterMaxMs: 300_000,
|
|
517
|
+
triggerPromptChars: 8_000,
|
|
518
|
+
triggerRunRetentionMs: 30 * 24 * 3_600_000,
|
|
519
|
+
webhookBodyBytes: 256 * 1024,
|
|
520
|
+
wakeMaxAheadMs: 30 * 24 * 3_600_000,
|
|
521
|
+
wakeNoteChars: 2_000,
|
|
522
|
+
memoryBytes: 100 * 1024,
|
|
523
|
+
memoriesPerAgent: 10_000,
|
|
524
|
+
memoryIndexLines: 200,
|
|
525
|
+
memoryIndexBytes: 25 * 1024,
|
|
526
|
+
sessionQueuedMessages: 100,
|
|
527
|
+
flowConcurrency: 8,
|
|
528
|
+
flowMapItems: 1_000,
|
|
529
|
+
flowLoopIterations: 100,
|
|
530
|
+
});
|
|
531
|
+
/** The Runtime limits a harness gets when the Tenant sets none. */
|
|
532
|
+
export const HARNESS_LIMIT_DEFAULTS = Object.freeze(harnessLimitsOf(RUNTIME_LIMIT_DEFAULTS));
|
|
533
|
+
/** The limits in force: `set`, with the default for each it leaves out. */
|
|
534
|
+
export function runtimeLimitsOf(set) {
|
|
535
|
+
const limits = { ...RUNTIME_LIMIT_DEFAULTS };
|
|
536
|
+
for (const name of Object.keys(limits)) {
|
|
537
|
+
const value = set?.[name];
|
|
538
|
+
if (value !== undefined)
|
|
539
|
+
limits[name] = value;
|
|
540
|
+
}
|
|
541
|
+
return limits;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Limits with a floor, which no setting may go under, and why: a schedule's cron is minute
|
|
545
|
+
* grained, and runs dedupe repeated fires for as long as the execution's own dedupe lasts (a day).
|
|
546
|
+
*/
|
|
547
|
+
export const RUNTIME_LIMIT_FLOORS = {
|
|
548
|
+
triggerMinIntervalMs: { value: 60_000, why: "cron fires at most once a minute" },
|
|
549
|
+
triggerRunRetentionMs: {
|
|
550
|
+
value: 24 * 3_600_000,
|
|
551
|
+
why: "a run row dedupes a repeated fire or delivery, which Durable Session Execution may send again for a day",
|
|
552
|
+
},
|
|
553
|
+
};
|
|
554
|
+
/** Why `set` cannot be put: each limit above its ceiling or under its floor, naming why. */
|
|
555
|
+
export function runtimeLimitIssues(set) {
|
|
556
|
+
const issues = [];
|
|
557
|
+
for (const [name, floor] of Object.entries(RUNTIME_LIMIT_FLOORS)) {
|
|
558
|
+
const asked = set?.[name];
|
|
559
|
+
if (asked !== undefined && asked < floor.value)
|
|
560
|
+
issues.push(`limits.${name} asks for ${asked}; its floor is ${floor.value}: ${floor.why}.`);
|
|
561
|
+
}
|
|
562
|
+
for (const name of Object.keys(RUNTIME_LIMIT_CEILINGS)) {
|
|
563
|
+
const asked = set?.[name];
|
|
564
|
+
const ceiling = RUNTIME_LIMIT_CEILINGS[name];
|
|
565
|
+
if (asked !== undefined && asked > ceiling.value)
|
|
566
|
+
issues.push(`limits.${name} asks for ${asked} ${ceiling.unit}; its ceiling is ${ceiling.value}: ${ceiling.why}.`);
|
|
567
|
+
}
|
|
568
|
+
return issues;
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* The message of a write refused for passing limit `name`: what was sent, the limit, and where an
|
|
572
|
+
* operator sets it.
|
|
573
|
+
*/
|
|
574
|
+
export function limitExceededMessage(what, amount, name, limit) {
|
|
575
|
+
const unit = RUNTIME_LIMIT_CEILINGS[name].unit;
|
|
576
|
+
return `${what} is ${amount} ${unit}, over the Runtime limit ${name} (${limit} ${unit}; PUT /v1/tenant/limits).`;
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* The body an endpoint that takes files inline reads (AG-UI, A2A): one file at `inlineFileBytes`
|
|
580
|
+
* in base64 (a third larger), and `requestBodyBytes` for the rest of the request; never more
|
|
581
|
+
* than one string holds.
|
|
582
|
+
*/
|
|
583
|
+
export function inlineBodyBytes(limits) {
|
|
584
|
+
return Math.min(JS_STRING_MAX_LENGTH, Math.ceil(limits.inlineFileBytes / 3) * 4 + limits.requestBodyBytes);
|
|
585
|
+
}
|
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Our engine's tool that stores a sandbox file, or inline text, as a file artifact of the session
|
|
3
|
+
* (F8.1). Since protocol 15 it runs in our harness (`@nylorun/harness`), not the Runtime.
|
|
4
|
+
*/
|
|
2
5
|
export declare const SAVE_ARTIFACT_TOOL = "save_artifact";
|
|
3
|
-
/** Reads an artifact of the session in pages (R2b C11). */
|
|
4
|
-
export declare const READ_ARTIFACT_TOOL = "read_artifact";
|
|
5
|
-
/** Loads a skill's `SKILL.md`. */
|
|
6
|
-
export declare const LOAD_SKILL_TOOL = "load_skill";
|
|
7
|
-
/** Reads one resource file of a skill. */
|
|
8
|
-
export declare const READ_SKILL_RESOURCE_TOOL = "read_skill_resource";
|
|
9
|
-
/** Finds deferred tools by a query (BM25 over their names and descriptions). */
|
|
10
|
-
export declare const TOOL_SEARCH_TOOL = "tool_search";
|
|
11
|
-
/** Runs a deferred tool by name, as a call of that tool. */
|
|
12
|
-
export declare const TOOL_CALL_TOOL = "tool_call";
|
|
13
6
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
7
|
+
* Our engine's tool that reads an artifact of the session in pages (R2b C11). Since protocol 15 it
|
|
8
|
+
* runs in our harness, which also names it in a spilled tool result's stub and in a file's
|
|
9
|
+
* reference line.
|
|
17
10
|
*/
|
|
18
|
-
export declare const
|
|
19
|
-
export declare function isRuntimeToolName(name: string): boolean;
|
|
11
|
+
export declare const READ_ARTIFACT_TOOL = "read_artifact";
|
|
@@ -1,30 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Our engine's tool that stores a sandbox file, or inline text, as a file artifact of the session
|
|
3
|
+
* (F8.1). Since protocol 15 it runs in our harness (`@nylorun/harness`), not the Runtime.
|
|
4
|
+
*/
|
|
3
5
|
export const SAVE_ARTIFACT_TOOL = "save_artifact";
|
|
4
|
-
/** Reads an artifact of the session in pages (R2b C11). */
|
|
5
|
-
export const READ_ARTIFACT_TOOL = "read_artifact";
|
|
6
|
-
/** Loads a skill's `SKILL.md`. */
|
|
7
|
-
export const LOAD_SKILL_TOOL = "load_skill";
|
|
8
|
-
/** Reads one resource file of a skill. */
|
|
9
|
-
export const READ_SKILL_RESOURCE_TOOL = "read_skill_resource";
|
|
10
|
-
/** Finds deferred tools by a query (BM25 over their names and descriptions). */
|
|
11
|
-
export const TOOL_SEARCH_TOOL = "tool_search";
|
|
12
|
-
/** Runs a deferred tool by name, as a call of that tool. */
|
|
13
|
-
export const TOOL_CALL_TOOL = "tool_call";
|
|
14
6
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
7
|
+
* Our engine's tool that reads an artifact of the session in pages (R2b C11). Since protocol 15 it
|
|
8
|
+
* runs in our harness, which also names it in a spilled tool result's stub and in a file's
|
|
9
|
+
* reference line.
|
|
18
10
|
*/
|
|
19
|
-
export const
|
|
20
|
-
...SANDBOX_TOOL_NAMES,
|
|
21
|
-
SAVE_ARTIFACT_TOOL,
|
|
22
|
-
READ_ARTIFACT_TOOL,
|
|
23
|
-
LOAD_SKILL_TOOL,
|
|
24
|
-
READ_SKILL_RESOURCE_TOOL,
|
|
25
|
-
TOOL_SEARCH_TOOL,
|
|
26
|
-
TOOL_CALL_TOOL,
|
|
27
|
-
]);
|
|
28
|
-
export function isRuntimeToolName(name) {
|
|
29
|
-
return RUNTIME_TOOL_NAMES.has(name);
|
|
30
|
-
}
|
|
11
|
+
export const READ_ARTIFACT_TOOL = "read_artifact";
|
package/dist/utils/sandbox.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/** Portable sandbox constants and parsers shared by the SDK, wire schema and Runtime. */
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* The sandbox operations a harness runs in a session's sandbox: a `sandbox` call names one as its
|
|
4
|
+
* tool (protocol 15). Our engine offers a tool of each name.
|
|
5
|
+
*/
|
|
3
6
|
export declare const SANDBOX_TOOL_NAMES: readonly ["bash", "read", "write", "edit", "grep", "glob"];
|
|
4
7
|
export type SandboxToolName = (typeof SANDBOX_TOOL_NAMES)[number];
|
|
5
8
|
export declare const SANDBOX_WORKSPACE = "/workspace";
|