@nylorun/core 0.22.0-beta → 0.23.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 +102 -0
- package/README.md +1 -1
- package/dist/compatibility.d.ts +32 -16
- package/dist/compatibility.js +33 -17
- package/dist/contracts.d.ts +531 -88
- package/dist/contracts.js +297 -199
- package/dist/define.d.ts +8 -12
- package/dist/define.js +7 -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.js +1 -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 +2422 -924
- 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 +45 -17
- package/dist/harness-api/messages.js +20 -5
- package/dist/harness-api/schema.d.ts +538 -198
- package/dist/harness-api/schema.js +298 -59
- 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/schemas/agent-manifest.schema.json +5 -146
- package/dist/schemas/environment-manifest.schema.json +56 -16
- package/dist/types/manifest.d.ts +3 -13
- package/dist/types/model.d.ts +10 -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/runtime-limits.d.ts +229 -0
- package/dist/utils/runtime-limits.js +482 -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 +1 -1
- 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,128 @@
|
|
|
1
|
+
/** The media type of bytes nothing says more about. */
|
|
2
|
+
export const DEFAULT_CONTENT_TYPE = "application/octet-stream";
|
|
3
|
+
const MEDIA_TYPE = /^[a-z0-9][a-z0-9!#$&^_.+-]{0,126}\/[a-z0-9][a-z0-9!#$&^_.+-]{0,126}$/;
|
|
4
|
+
const BY_EXTENSION = {
|
|
5
|
+
png: "image/png",
|
|
6
|
+
jpg: "image/jpeg",
|
|
7
|
+
jpeg: "image/jpeg",
|
|
8
|
+
gif: "image/gif",
|
|
9
|
+
webp: "image/webp",
|
|
10
|
+
svg: "image/svg+xml",
|
|
11
|
+
pdf: "application/pdf",
|
|
12
|
+
doc: "application/msword",
|
|
13
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
14
|
+
xls: "application/vnd.ms-excel",
|
|
15
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
16
|
+
ppt: "application/vnd.ms-powerpoint",
|
|
17
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
18
|
+
txt: "text/plain",
|
|
19
|
+
md: "text/markdown",
|
|
20
|
+
csv: "text/csv",
|
|
21
|
+
html: "text/html",
|
|
22
|
+
htm: "text/html",
|
|
23
|
+
css: "text/css",
|
|
24
|
+
js: "text/javascript",
|
|
25
|
+
mjs: "text/javascript",
|
|
26
|
+
ts: "text/x-typescript",
|
|
27
|
+
py: "text/x-python",
|
|
28
|
+
sh: "text/x-sh",
|
|
29
|
+
json: "application/json",
|
|
30
|
+
xml: "application/xml",
|
|
31
|
+
yaml: "application/yaml",
|
|
32
|
+
yml: "application/yaml",
|
|
33
|
+
zip: "application/zip",
|
|
34
|
+
tar: "application/x-tar",
|
|
35
|
+
gz: "application/gzip",
|
|
36
|
+
mp3: "audio/mpeg",
|
|
37
|
+
wav: "audio/wav",
|
|
38
|
+
mp4: "video/mp4",
|
|
39
|
+
};
|
|
40
|
+
/** Images the model reads as images. */
|
|
41
|
+
export const MODEL_IMAGE_TYPES = Object.freeze([
|
|
42
|
+
"image/png",
|
|
43
|
+
"image/jpeg",
|
|
44
|
+
"image/webp",
|
|
45
|
+
"image/gif",
|
|
46
|
+
]);
|
|
47
|
+
/** The type part of a `Content-Type` value, lowercased, without parameters. */
|
|
48
|
+
export function essence(contentType) {
|
|
49
|
+
return contentType.split(";")[0].trim().toLowerCase();
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The longest `Content-Type` kept, its parameters included: RFC 6838 §4.2's type and subtype of at
|
|
53
|
+
* most 127 characters each and the slash between them. A standard's constant.
|
|
54
|
+
*/
|
|
55
|
+
const MEDIA_TYPE_MAX = 127 + 1 + 127;
|
|
56
|
+
/** A declared `Content-Type` as stored, or undefined when it is not a media type. */
|
|
57
|
+
export function normalizeContentType(value) {
|
|
58
|
+
if (value === undefined)
|
|
59
|
+
return undefined;
|
|
60
|
+
const trimmed = value.trim();
|
|
61
|
+
if (trimmed === "" || trimmed.length > MEDIA_TYPE_MAX)
|
|
62
|
+
return undefined;
|
|
63
|
+
return MEDIA_TYPE.test(essence(trimmed)) ? trimmed : undefined;
|
|
64
|
+
}
|
|
65
|
+
/** The media type a file name implies, or `application/octet-stream`. */
|
|
66
|
+
export function contentTypeFor(name) {
|
|
67
|
+
const dot = name.lastIndexOf(".");
|
|
68
|
+
if (dot < 0)
|
|
69
|
+
return DEFAULT_CONTENT_TYPE;
|
|
70
|
+
return BY_EXTENSION[name.slice(dot + 1).toLowerCase()] ?? DEFAULT_CONTENT_TYPE;
|
|
71
|
+
}
|
|
72
|
+
export function isModelImage(contentType) {
|
|
73
|
+
return MODEL_IMAGE_TYPES.includes(essence(contentType));
|
|
74
|
+
}
|
|
75
|
+
/** Files the model reads as text: `text/*`, JSON, XML, YAML and their `+json`/`+xml` kin. */
|
|
76
|
+
export function isText(contentType) {
|
|
77
|
+
const type = essence(contentType);
|
|
78
|
+
return (type.startsWith("text/") ||
|
|
79
|
+
type === "application/json" ||
|
|
80
|
+
type === "application/xml" ||
|
|
81
|
+
type === "application/yaml" ||
|
|
82
|
+
type === "application/x-yaml" ||
|
|
83
|
+
type === "application/javascript" ||
|
|
84
|
+
type.endsWith("+json") ||
|
|
85
|
+
type.endsWith("+xml"));
|
|
86
|
+
}
|
|
87
|
+
/** The usual extension of a media type, for a name the Runtime gives a file; undefined if none. */
|
|
88
|
+
export function extensionFor(contentType) {
|
|
89
|
+
const type = essence(contentType);
|
|
90
|
+
return Object.keys(BY_EXTENSION).find((extension) => BY_EXTENSION[extension] === type);
|
|
91
|
+
}
|
|
92
|
+
/** Word, Excel and PowerPoint documents, old and Open XML. */
|
|
93
|
+
export function isOffice(contentType) {
|
|
94
|
+
const type = essence(contentType);
|
|
95
|
+
return (type === "application/msword" ||
|
|
96
|
+
type === "application/vnd.ms-excel" ||
|
|
97
|
+
type === "application/vnd.ms-powerpoint" ||
|
|
98
|
+
type.startsWith("application/vnd.openxmlformats-officedocument."));
|
|
99
|
+
}
|
|
100
|
+
/** The model input a file of `contentType` is, or undefined for a type no model reads. */
|
|
101
|
+
export function modelInputOf(contentType) {
|
|
102
|
+
const type = essence(contentType);
|
|
103
|
+
if (isText(type))
|
|
104
|
+
return "text";
|
|
105
|
+
if (type.startsWith("image/"))
|
|
106
|
+
return "image";
|
|
107
|
+
if (type === "application/pdf")
|
|
108
|
+
return "pdf";
|
|
109
|
+
if (isOffice(type))
|
|
110
|
+
return "office";
|
|
111
|
+
if (type.startsWith("audio/"))
|
|
112
|
+
return "audio";
|
|
113
|
+
if (type.startsWith("video/"))
|
|
114
|
+
return "video";
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
const LABELS = {
|
|
118
|
+
text: "text files",
|
|
119
|
+
image: "images",
|
|
120
|
+
pdf: "PDFs",
|
|
121
|
+
office: "Office documents",
|
|
122
|
+
audio: "audio",
|
|
123
|
+
video: "video",
|
|
124
|
+
};
|
|
125
|
+
/** An input, in a sentence: "PDFs", "Office documents"; "files of this type" for none. */
|
|
126
|
+
export function inputLabel(input) {
|
|
127
|
+
return input === undefined ? "files of this type" : LABELS[input];
|
|
128
|
+
}
|
|
@@ -0,0 +1,229 @@
|
|
|
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
|
+
/**
|
|
15
|
+
* S2's largest record: 1 MiB, metered as 8 bytes, plus its headers, plus its body. The stream
|
|
16
|
+
* relay writes each event's JSON as one record's body, with no headers.
|
|
17
|
+
*/
|
|
18
|
+
export declare const S2_RECORD_MAX_BYTES: number;
|
|
19
|
+
/**
|
|
20
|
+
* Room an event's envelope takes beside its payload: ids, cursor, time, writer and principal
|
|
21
|
+
* come to about 1 KiB; 64 KiB leaves them ample room under `S2_RECORD_MAX_BYTES`.
|
|
22
|
+
*/
|
|
23
|
+
export declare const RECORD_ENVELOPE_RESERVE_BYTES: number;
|
|
24
|
+
/**
|
|
25
|
+
* The longest string V8 makes on 64-bit (`String::kMaxLength`, 2^29 - 24 code units): a JSON
|
|
26
|
+
* body the Runtime reads whole, or a file it sends a provider in base64, is one such string.
|
|
27
|
+
*/
|
|
28
|
+
export declare const JS_STRING_MAX_LENGTH: number;
|
|
29
|
+
/**
|
|
30
|
+
* The longest delay a JavaScript timer takes (`setTimeout`, `setInterval`, `AbortSignal.timeout`):
|
|
31
|
+
* a signed 32-bit count of milliseconds, about 24.8 days. A longer one fires at once.
|
|
32
|
+
*/
|
|
33
|
+
export declare const TIMER_MAX_MS: number;
|
|
34
|
+
/**
|
|
35
|
+
* The longest single argument Linux passes to a program (`MAX_ARG_STRLEN`, 32 pages of 4 KiB),
|
|
36
|
+
* its terminating NUL included: a setup command is one argument of `/bin/sh -c`.
|
|
37
|
+
*/
|
|
38
|
+
export declare const LINUX_ARG_MAX_BYTES: number;
|
|
39
|
+
/**
|
|
40
|
+
* The Runtime limits: the harness's (above), and the ones only the Runtime checks (B15), by area.
|
|
41
|
+
*
|
|
42
|
+
* Requests and uploads:
|
|
43
|
+
* - `requestBodyBytes`: the largest JSON body a Runtime or Management API route reads.
|
|
44
|
+
* - `messageParts`: the most parts one user message carries (text and files).
|
|
45
|
+
* - `pageItems`: the most items one page of a listing holds (`limit`), and `exportPageItems` one
|
|
46
|
+
* page of the model call export (`GET /v1/tenant/calls/model`). A page asked for with no
|
|
47
|
+
* `limit` holds the route's default, or this limit when it is lower; one asking more holds this
|
|
48
|
+
* many. `environmentEventItems`: the most events one read of an Environment's events returns.
|
|
49
|
+
* - `inlineFileBytes`: the largest file a message carries inline, decoded (AG-UI, A2A). Such an
|
|
50
|
+
* endpoint reads a body of one file at this size in base64 and `requestBodyBytes` more
|
|
51
|
+
* (`inlineBodyBytes`).
|
|
52
|
+
* - `a2aWaitMs`: how long a blocking A2A `SendMessage` waits for its task to end or ask for input.
|
|
53
|
+
* - `errorExcerptChars`: how much of a failed MCP server's or HTTP tool's answer an error quotes.
|
|
54
|
+
* - `traceContentBytes`: the most UTF-8 bytes of one content attribute of an exported span.
|
|
55
|
+
*
|
|
56
|
+
* Labels (an Environment's and an artifact's, checked whenever they are set):
|
|
57
|
+
* - `environmentLabels`, `artifactLabels`: the most labels one Environment, and one artifact,
|
|
58
|
+
* carries.
|
|
59
|
+
* - `labelKeyChars`, `labelValueChars`: the longest label key, and value.
|
|
60
|
+
*
|
|
61
|
+
* Environments (checked when one is made):
|
|
62
|
+
* - `environmentSetupCommands`, `environmentFiles`: the most setup commands, and input file
|
|
63
|
+
* entries, one manifest holds.
|
|
64
|
+
* - `environmentFilesPerEntry`: the most files one input file entry by hash names.
|
|
65
|
+
* - `environmentSecretSlots`: the most secret slots one manifest declares.
|
|
66
|
+
* - `setupCommandChars`: the longest setup command.
|
|
67
|
+
* - `setupCommandMs`: the longest `timeout` one setup command may ask for (a command's default is
|
|
68
|
+
* 10 minutes).
|
|
69
|
+
* - `setupOutputChars`: how much of a failed setup command's output its event keeps.
|
|
70
|
+
* - `setupReasonChars`, `setupCommandExcerptChars`: how much of the end of that output, and of
|
|
71
|
+
* the start of the command, a failed pod's reason quotes.
|
|
72
|
+
* - `manifestDescriptionChars`, `secretDescriptionChars`: the longest description of an
|
|
73
|
+
* environment manifest, and of one of its secret slots.
|
|
74
|
+
*
|
|
75
|
+
* Secrets (checked when one is written, and a manifest's slots when it is put):
|
|
76
|
+
* - `secretValueChars`: the longest value of an `environment_secret` or `environment_variable`.
|
|
77
|
+
* - `secretHosts`: the most hosts one `environment_secret` may be sent to (`allowedHosts`).
|
|
78
|
+
*
|
|
79
|
+
* Disk versions:
|
|
80
|
+
* - `diskVersionEntries`, `diskVersionBytes`: the most entries, and bytes of files, one version
|
|
81
|
+
* of an Environment's disk holds (an Environment's manifest may set less: `limits.disk`).
|
|
82
|
+
* - `diskLeaseMs`: how long a disk copy's lease lasts unrenewed; the copy renews it every quarter
|
|
83
|
+
* of it, and a copy whose process died is taken over once it lapses.
|
|
84
|
+
* - `diskPodWaitMs`: how long a disk copy waits for a pod's engine to connect.
|
|
85
|
+
*
|
|
86
|
+
* Model calls (the Model Gate's provider calls):
|
|
87
|
+
* - `modelRequestMs`: the longest one provider request may take.
|
|
88
|
+
* - `modelIdleMs`: how long a provider's stream may go without an event before the attempt is
|
|
89
|
+
* abandoned and tried again.
|
|
90
|
+
* - `modelAttempts`: the attempts one call makes, the first included.
|
|
91
|
+
* - `modelRetryDelayMs`: the delay before the second attempt; it doubles each time, with jitter.
|
|
92
|
+
* - `modelProviderRetries`, `modelRetryDelayMaxMs`: the retries the provider's SDK makes within
|
|
93
|
+
* one attempt, and the longest delay it waits before one.
|
|
94
|
+
*
|
|
95
|
+
* Tools:
|
|
96
|
+
* - `toolAttempts`: how many times an MCP or HTTP tool call is sent, across crashes and lost
|
|
97
|
+
* hops, before it fails to the model as `tool.interrupted`.
|
|
98
|
+
* - `httpToolTimeoutMs`: the longest `timeoutMs` an HTTP tool may ask for (a tool's default is
|
|
99
|
+
* 60 s), checked when an agent is deployed and when the tool is called.
|
|
100
|
+
* - `mcpSnapshotBytes`: the most JSON a session pins of what its MCP servers said at discovery
|
|
101
|
+
* (tools with their schemas, instructions), which every `turn.start.mcp` carries. A server that
|
|
102
|
+
* does not fit is left out, with a diagnostic.
|
|
103
|
+
* - `mcpPreviewMs`: how long an MCP preview may take, `initialize` and every `tools/list` page.
|
|
104
|
+
* - `mcpMetadataBytes`: the largest protected-resource metadata document a preview reads.
|
|
105
|
+
* - `toolRules`: the most rules the Tenant's tool policy holds; `toolRuleFieldChars` the longest
|
|
106
|
+
* selector (`tool`, `server`, `agent`) or `when` path of one, and `toolRuleTextChars` the
|
|
107
|
+
* longest `reason` or `matches` expression.
|
|
108
|
+
* - `modelBudgets`: the most model budgets the Tenant sets.
|
|
109
|
+
*
|
|
110
|
+
* Flows (`workflows.md` §13):
|
|
111
|
+
* - `flowConcurrency`: the most effects one flow turn runs at once; the rest wait their turn.
|
|
112
|
+
* - `flowMapItems`: the most items one map stage may fan out to (`map.too-many-items` past it).
|
|
113
|
+
* - `flowLoopIterations`: the most iterations one loop stage runs (`loop.too-many-iterations`).
|
|
114
|
+
*/
|
|
115
|
+
export declare const RuntimeLimitsSchema: z.ZodObject<{
|
|
116
|
+
recordEntryBytes: z.ZodNumber;
|
|
117
|
+
modelCallBytes: z.ZodNumber;
|
|
118
|
+
modelFileBytes: z.ZodNumber;
|
|
119
|
+
toolAnswerBytes: z.ZodNumber;
|
|
120
|
+
harnessStateBytes: z.ZodNumber;
|
|
121
|
+
chunkBytes: z.ZodNumber;
|
|
122
|
+
folderEntries: z.ZodNumber;
|
|
123
|
+
requestBodyBytes: z.ZodNumber;
|
|
124
|
+
messageParts: z.ZodNumber;
|
|
125
|
+
pageItems: z.ZodNumber;
|
|
126
|
+
exportPageItems: z.ZodNumber;
|
|
127
|
+
environmentEventItems: z.ZodNumber;
|
|
128
|
+
inlineFileBytes: z.ZodNumber;
|
|
129
|
+
a2aWaitMs: z.ZodNumber;
|
|
130
|
+
errorExcerptChars: z.ZodNumber;
|
|
131
|
+
traceContentBytes: z.ZodNumber;
|
|
132
|
+
environmentLabels: z.ZodNumber;
|
|
133
|
+
artifactLabels: z.ZodNumber;
|
|
134
|
+
labelKeyChars: z.ZodNumber;
|
|
135
|
+
labelValueChars: z.ZodNumber;
|
|
136
|
+
environmentSetupCommands: z.ZodNumber;
|
|
137
|
+
environmentFiles: z.ZodNumber;
|
|
138
|
+
environmentFilesPerEntry: z.ZodNumber;
|
|
139
|
+
environmentSecretSlots: z.ZodNumber;
|
|
140
|
+
setupCommandChars: z.ZodNumber;
|
|
141
|
+
setupCommandMs: z.ZodNumber;
|
|
142
|
+
setupOutputChars: z.ZodNumber;
|
|
143
|
+
setupReasonChars: z.ZodNumber;
|
|
144
|
+
setupCommandExcerptChars: z.ZodNumber;
|
|
145
|
+
manifestDescriptionChars: z.ZodNumber;
|
|
146
|
+
secretDescriptionChars: z.ZodNumber;
|
|
147
|
+
secretValueChars: z.ZodNumber;
|
|
148
|
+
secretHosts: z.ZodNumber;
|
|
149
|
+
diskVersionEntries: z.ZodNumber;
|
|
150
|
+
diskVersionBytes: z.ZodNumber;
|
|
151
|
+
diskLeaseMs: z.ZodNumber;
|
|
152
|
+
diskPodWaitMs: z.ZodNumber;
|
|
153
|
+
modelRequestMs: z.ZodNumber;
|
|
154
|
+
modelIdleMs: z.ZodNumber;
|
|
155
|
+
modelAttempts: z.ZodNumber;
|
|
156
|
+
modelRetryDelayMs: z.ZodNumber;
|
|
157
|
+
modelProviderRetries: z.ZodNumber;
|
|
158
|
+
modelRetryDelayMaxMs: z.ZodNumber;
|
|
159
|
+
toolAttempts: z.ZodNumber;
|
|
160
|
+
httpToolTimeoutMs: z.ZodNumber;
|
|
161
|
+
mcpSnapshotBytes: z.ZodNumber;
|
|
162
|
+
mcpPreviewMs: z.ZodNumber;
|
|
163
|
+
mcpMetadataBytes: z.ZodNumber;
|
|
164
|
+
toolRules: z.ZodNumber;
|
|
165
|
+
toolRuleFieldChars: z.ZodNumber;
|
|
166
|
+
toolRuleTextChars: z.ZodNumber;
|
|
167
|
+
modelBudgets: z.ZodNumber;
|
|
168
|
+
flowConcurrency: z.ZodNumber;
|
|
169
|
+
flowMapItems: z.ZodNumber;
|
|
170
|
+
flowLoopIterations: z.ZodNumber;
|
|
171
|
+
}, z.core.$strict>;
|
|
172
|
+
export type RuntimeLimits = z.infer<typeof RuntimeLimitsSchema>;
|
|
173
|
+
export type RuntimeLimit = keyof RuntimeLimits;
|
|
174
|
+
/**
|
|
175
|
+
* The Runtime limits a harness must respect (`turn.start.limits`). A limit the Runtime adds later
|
|
176
|
+
* that a harness does not know is dropped when it parses them.
|
|
177
|
+
*/
|
|
178
|
+
export declare const HarnessLimitsSchema: z.ZodObject<{
|
|
179
|
+
recordEntryBytes: z.ZodNumber;
|
|
180
|
+
modelCallBytes: z.ZodNumber;
|
|
181
|
+
modelFileBytes: z.ZodNumber;
|
|
182
|
+
toolAnswerBytes: z.ZodNumber;
|
|
183
|
+
harnessStateBytes: z.ZodNumber;
|
|
184
|
+
chunkBytes: z.ZodNumber;
|
|
185
|
+
folderEntries: z.ZodNumber;
|
|
186
|
+
}, z.core.$strip>;
|
|
187
|
+
export type HarnessLimits = z.infer<typeof HarnessLimitsSchema>;
|
|
188
|
+
export type HarnessLimit = keyof HarnessLimits;
|
|
189
|
+
/** The part of `limits` a harness is sent. */
|
|
190
|
+
export declare function harnessLimitsOf(limits: RuntimeLimits): HarnessLimits;
|
|
191
|
+
/** What a limit counts. */
|
|
192
|
+
export type RuntimeLimitUnit = "bytes" | "entries" | "characters" | "milliseconds" | "attempts" | "retries" | "effects" | "iterations";
|
|
193
|
+
interface Ceiling {
|
|
194
|
+
readonly value: number;
|
|
195
|
+
readonly unit: RuntimeLimitUnit;
|
|
196
|
+
readonly why: string;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Each limit's ceiling, which no setting may pass, what it counts, and the dependency it comes
|
|
200
|
+
* from.
|
|
201
|
+
*/
|
|
202
|
+
export declare const RUNTIME_LIMIT_CEILINGS: {
|
|
203
|
+
readonly [K in RuntimeLimit]: Ceiling;
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* The limits a Tenant that sets none runs with: today's sizes and times. `recordEntryBytes` is
|
|
207
|
+
* its ceiling, so every event S2 took before is still taken; what keeps a step's tool results
|
|
208
|
+
* well inside it is the harness's shaping of them (Nylorun's engine: 256 KiB a step,
|
|
209
|
+
* `shapeToolOutcome` in `@nylorun/harness`), since the record refuses an entry past it.
|
|
210
|
+
*/
|
|
211
|
+
export declare const RUNTIME_LIMIT_DEFAULTS: RuntimeLimits;
|
|
212
|
+
/** The Runtime limits a harness gets when the Tenant sets none. */
|
|
213
|
+
export declare const HARNESS_LIMIT_DEFAULTS: HarnessLimits;
|
|
214
|
+
/** The limits in force: `set`, with the default for each it leaves out. */
|
|
215
|
+
export declare function runtimeLimitsOf(set: Partial<RuntimeLimits> | undefined): RuntimeLimits;
|
|
216
|
+
/** Why `set` cannot be put: each limit above its ceiling, naming the ceiling and its dependency. */
|
|
217
|
+
export declare function runtimeLimitIssues(set: Partial<RuntimeLimits> | undefined): string[];
|
|
218
|
+
/**
|
|
219
|
+
* The message of a write refused for passing limit `name`: what was sent, the limit, and where an
|
|
220
|
+
* operator sets it.
|
|
221
|
+
*/
|
|
222
|
+
export declare function limitExceededMessage(what: string, amount: number, name: RuntimeLimit, limit: number): string;
|
|
223
|
+
/**
|
|
224
|
+
* The body an endpoint that takes files inline reads (AG-UI, A2A): one file at `inlineFileBytes`
|
|
225
|
+
* in base64 (a third larger), and `requestBodyBytes` for the rest of the request; never more
|
|
226
|
+
* than one string holds.
|
|
227
|
+
*/
|
|
228
|
+
export declare function inlineBodyBytes(limits: Pick<RuntimeLimits, "inlineFileBytes" | "requestBodyBytes">): number;
|
|
229
|
+
export {};
|