@nylorun/core 0.23.0-beta → 0.25.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 +37 -0
- package/dist/compatibility.d.ts +127 -59
- package/dist/compatibility.js +128 -60
- package/dist/contracts.d.ts +2413 -893
- package/dist/contracts.js +1144 -491
- package/dist/define.d.ts +1 -0
- package/dist/define.js +1 -0
- package/dist/definition/approval.d.ts +1 -1
- package/dist/definition/bound.d.ts +2 -0
- package/dist/definition/builder.d.ts +2 -2
- package/dist/definition/builder.js +1 -1
- package/dist/definition/code-tools.d.ts +1 -1
- package/dist/definition/declaration.js +3 -0
- package/dist/definition/delegate.d.ts +1 -1
- package/dist/definition/delegate.js +1 -1
- package/dist/definition/from.d.ts +2 -2
- package/dist/definition/from.js +1 -1
- package/dist/definition/http-tool.d.ts +3 -3
- package/dist/definition/mcp.d.ts +4 -4
- package/dist/definition/mcp.js +3 -3
- package/dist/definition/removed.d.ts +7 -0
- package/dist/definition/removed.js +21 -1
- package/dist/definition/sections.d.ts +64 -0
- package/dist/definition/sections.js +227 -0
- package/dist/definition/variant.d.ts +1 -1
- package/dist/definition/variant.js +4 -4
- package/dist/harness-api/entries.d.ts +1 -1
- package/dist/harness-api/entries.js +1 -1
- package/dist/harness-api/gates.d.ts +1 -1
- package/dist/harness-api/gates.js +1 -1
- package/dist/harness-api/harness-api.schema.json +182 -6
- package/dist/harness-api/index.d.ts +3 -3
- package/dist/harness-api/index.js +3 -3
- package/dist/harness-api/json-schema.d.ts +1 -1
- package/dist/harness-api/json-schema.js +3 -3
- package/dist/harness-api/mcp.js +1 -1
- package/dist/harness-api/messages.d.ts +10 -8
- package/dist/harness-api/messages.js +1 -1
- package/dist/harness-api/schema.d.ts +82 -13
- package/dist/harness-api/schema.js +63 -19
- package/dist/harness-api/transcript.d.ts +1 -1
- package/dist/harness-api/transport.d.ts +1 -1
- package/dist/harness-api/transport.js +1 -1
- package/dist/manifest-schemas.d.ts +9 -5
- package/dist/manifest-schemas.js +24 -27
- package/dist/schemas/agent-manifest.schema.json +1534 -250
- package/dist/schemas/harness-manifest.schema.json +1273 -0
- package/dist/schemas/{environment-manifest.schema.json → runtime-manifest.schema.json} +109 -68
- package/dist/types/manifest.d.ts +87 -15
- package/dist/types/manifest.js +4 -0
- package/dist/types/model.d.ts +5 -0
- package/dist/types/observe.d.ts +1 -1
- package/dist/types/part.d.ts +5 -0
- package/dist/types/tool.d.ts +4 -4
- package/dist/utils/definition-files.d.ts +3 -2
- package/dist/utils/definition-files.js +4 -3
- package/dist/utils/file-systems.d.ts +1 -1
- package/dist/utils/file-systems.js +1 -1
- package/dist/utils/harness-id.d.ts +1 -1
- package/dist/utils/harness-id.js +1 -1
- package/dist/utils/memory.d.ts +64 -0
- package/dist/utils/memory.js +139 -0
- package/dist/utils/runtime-limits.d.ts +55 -4
- package/dist/utils/runtime-limits.js +106 -3
- package/dist/utils/runtime-tools.d.ts +3 -3
- package/dist/utils/runtime-tools.js +3 -3
- package/package.json +6 -5
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent memory: what a memory's path may be, and what its index line shows.
|
|
3
|
+
* The Runtime and the engine's `memory` tool share these rules, so a path the tool accepts is one
|
|
4
|
+
* the Runtime stores.
|
|
5
|
+
*
|
|
6
|
+
* A memory is a Markdown file under `/memories`: its path is `/memories/` and one or more
|
|
7
|
+
* `/`-separated segments, ends in `.md`, has no `.` or `..` segment, no empty segment, no
|
|
8
|
+
* backslash or control character, and is at most `MEMORY_PATH_MAX` characters. Folders are only
|
|
9
|
+
* the prefixes of memory paths; no row holds one.
|
|
10
|
+
*/
|
|
11
|
+
/** Where an Agent's memories live, in the tool and in every path the Runtime stores. */
|
|
12
|
+
export const MEMORY_ROOT = "/memories";
|
|
13
|
+
/** The longest memory path, `/memories/` included. */
|
|
14
|
+
export const MEMORY_PATH_MAX = 512;
|
|
15
|
+
/** The longest `harness.memory.instructions`. */
|
|
16
|
+
export const MEMORY_INSTRUCTIONS_MAX = 4096;
|
|
17
|
+
/** The longest description an index line shows. */
|
|
18
|
+
export const MEMORY_DESCRIPTION_MAX = 200;
|
|
19
|
+
/** What `harness.memory.access` may be: reads and writes, or reads only. */
|
|
20
|
+
export const MEMORY_ACCESS = ["read_write", "read_only"];
|
|
21
|
+
/** What changed a memory, as a version records it. */
|
|
22
|
+
export const MEMORY_OPERATIONS = ["create", "str_replace", "insert", "delete", "rename"];
|
|
23
|
+
// Control characters (C0, DEL, C1) and the backslash; a path holds neither.
|
|
24
|
+
const FORBIDDEN = /[\u0000-\u001f\u007f-\u009f\\]/;
|
|
25
|
+
/**
|
|
26
|
+
* Normalises a path the model or an API caller sent: a trailing `/` is dropped, and a path
|
|
27
|
+
* without the leading `/` of `/memories` gets it. Answers the path, or why it is refused.
|
|
28
|
+
* `kind: "file"` requires a memory's path (ending in `.md`); `kind: "any"` also takes a folder,
|
|
29
|
+
* `/memories` itself included.
|
|
30
|
+
*/
|
|
31
|
+
export function memoryPathOf(raw, kind) {
|
|
32
|
+
let path = raw.trim();
|
|
33
|
+
if (path.startsWith("memories/") || path === "memories")
|
|
34
|
+
path = `/${path}`;
|
|
35
|
+
if (path.length > 1 && path.endsWith("/"))
|
|
36
|
+
path = path.slice(0, -1);
|
|
37
|
+
if (path !== MEMORY_ROOT && !path.startsWith(`${MEMORY_ROOT}/`))
|
|
38
|
+
return { error: `${raw} is not under ${MEMORY_ROOT}: memory paths start with ${MEMORY_ROOT}/` };
|
|
39
|
+
if (path.length > MEMORY_PATH_MAX)
|
|
40
|
+
return { error: `A memory path is at most ${MEMORY_PATH_MAX} characters` };
|
|
41
|
+
if (FORBIDDEN.test(path))
|
|
42
|
+
return { error: "A memory path has no backslash or control character" };
|
|
43
|
+
const segments = path.slice(MEMORY_ROOT.length + 1).split("/");
|
|
44
|
+
if (path !== MEMORY_ROOT && segments.some((segment) => segment === "" || segment === "." || segment === ".."))
|
|
45
|
+
return { error: `${raw} has an empty, "." or ".." segment` };
|
|
46
|
+
if (kind === "file") {
|
|
47
|
+
if (path === MEMORY_ROOT)
|
|
48
|
+
return { error: `${MEMORY_ROOT} is the memory folder, not a memory` };
|
|
49
|
+
if (!path.endsWith(".md") || path.endsWith("/.md"))
|
|
50
|
+
return { error: `${path} must end in .md: memories are Markdown files` };
|
|
51
|
+
}
|
|
52
|
+
return { path };
|
|
53
|
+
}
|
|
54
|
+
/** Whether `path` is `folder` or inside it (`folder` a normalised memory path). */
|
|
55
|
+
export function memoryPathWithin(path, folder) {
|
|
56
|
+
return folder === MEMORY_ROOT ? path.startsWith(`${MEMORY_ROOT}/`) : path === folder || path.startsWith(`${folder}/`);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* What a memory's index line shows: the `description` of its YAML frontmatter, when it has one,
|
|
60
|
+
* cut to `MEMORY_DESCRIPTION_MAX` characters; otherwise `null`. Frontmatter is optional and the
|
|
61
|
+
* Runtime never writes into a memory.
|
|
62
|
+
*/
|
|
63
|
+
export function memoryDescriptionOf(content) {
|
|
64
|
+
const match = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(content);
|
|
65
|
+
if (!match)
|
|
66
|
+
return null;
|
|
67
|
+
const line = /^description:[ \t]*(.*)$/m.exec(match[1]);
|
|
68
|
+
if (!line)
|
|
69
|
+
return null;
|
|
70
|
+
let value = line[1].trim();
|
|
71
|
+
if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'")))
|
|
72
|
+
value = value.slice(1, -1).trim();
|
|
73
|
+
if (value === "")
|
|
74
|
+
return null;
|
|
75
|
+
return value.length > MEMORY_DESCRIPTION_MAX ? `${value.slice(0, MEMORY_DESCRIPTION_MAX - 1)}…` : value;
|
|
76
|
+
}
|
|
77
|
+
/** The `memory` tool's commands, Anthropic's memory tool's. */
|
|
78
|
+
export const MEMORY_COMMANDS = ["view", "create", "str_replace", "insert", "delete", "rename"];
|
|
79
|
+
/** Each command's parameters: name → whether it is required, and its kind. */
|
|
80
|
+
const MEMORY_PARAMETERS = {
|
|
81
|
+
view: { path: { required: true, kind: "string" }, view_range: { required: false, kind: "range" } },
|
|
82
|
+
create: { path: { required: true, kind: "string" }, file_text: { required: true, kind: "string" } },
|
|
83
|
+
str_replace: {
|
|
84
|
+
path: { required: true, kind: "string" },
|
|
85
|
+
old_str: { required: true, kind: "string" },
|
|
86
|
+
new_str: { required: false, kind: "string" },
|
|
87
|
+
},
|
|
88
|
+
insert: {
|
|
89
|
+
path: { required: true, kind: "string" },
|
|
90
|
+
insert_line: { required: true, kind: "integer" },
|
|
91
|
+
insert_text: { required: true, kind: "string" },
|
|
92
|
+
},
|
|
93
|
+
delete: { path: { required: true, kind: "string" } },
|
|
94
|
+
rename: { old_path: { required: true, kind: "string" }, new_path: { required: true, kind: "string" } },
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Checks a `memory` call's input against its command's parameters, which a JSON schema cannot
|
|
98
|
+
* tie to the command: answers the command, or the error text the model reads
|
|
99
|
+
* (`Error: create requires file_text.`). Our engine checks before it sends a call, and the
|
|
100
|
+
* Runtime checks again for every harness.
|
|
101
|
+
*/
|
|
102
|
+
export function checkMemoryCall(input) {
|
|
103
|
+
const error = (message) => ({ error: `Error: ${message}` });
|
|
104
|
+
if (input === null || typeof input !== "object" || Array.isArray(input))
|
|
105
|
+
return error("the input is an object with a command.");
|
|
106
|
+
const args = input;
|
|
107
|
+
const command = args.command;
|
|
108
|
+
if (typeof command !== "string" || !MEMORY_COMMANDS.includes(command))
|
|
109
|
+
return error(`command must be one of ${MEMORY_COMMANDS.join(", ")}; got ${JSON.stringify(command ?? null)}.`);
|
|
110
|
+
const parameters = MEMORY_PARAMETERS[command];
|
|
111
|
+
const missing = Object.entries(parameters)
|
|
112
|
+
.filter(([name, spec]) => spec.required && (args[name] === undefined || args[name] === null))
|
|
113
|
+
.map(([name]) => name);
|
|
114
|
+
if (missing.length > 0)
|
|
115
|
+
return error(`${command} requires ${missing.join(" and ")}.`);
|
|
116
|
+
for (const [name, spec] of Object.entries(parameters)) {
|
|
117
|
+
const value = args[name];
|
|
118
|
+
if (value === undefined || value === null)
|
|
119
|
+
continue;
|
|
120
|
+
if (spec.kind === "string" && typeof value !== "string")
|
|
121
|
+
return error(`${name} must be a string.`);
|
|
122
|
+
if (spec.kind === "integer" && !(Number.isInteger(value) || (typeof value === "string" && /^-?\d+$/.test(value))))
|
|
123
|
+
return error(`${name} must be an integer.`);
|
|
124
|
+
if (spec.kind === "range" &&
|
|
125
|
+
!(Array.isArray(value) && value.length === 2 && value.every((item) => Number.isInteger(Number(item)))))
|
|
126
|
+
return error(`${name} must be [start_line, end_line].`);
|
|
127
|
+
}
|
|
128
|
+
return { command: command, args };
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The `memory` call a tool name stands for when a model names the command in it:
|
|
132
|
+
* `memory.create` and `memory/create` are `memory` with `command: "create"`. Answers the command,
|
|
133
|
+
* or `undefined` for any other name.
|
|
134
|
+
*/
|
|
135
|
+
export function memoryAliasOf(name) {
|
|
136
|
+
const match = /^memory[./]([a-z_]+)$/.exec(name);
|
|
137
|
+
const command = match?.[1];
|
|
138
|
+
return command && MEMORY_COMMANDS.includes(command) ? command : undefined;
|
|
139
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Runtime limits
|
|
2
|
+
* Runtime limits: the sizes, counts and deadlines the Runtime holds
|
|
3
3
|
* what crosses it to, one Tenant setting (`limits.config`, `GET`/`PUT /v1/tenant/limits`) with a
|
|
4
4
|
* default each. A harness learns the ones it must respect from `turn.start.limits`
|
|
5
5
|
* (`HarnessLimitsSchema`, a part of them).
|
|
@@ -37,7 +37,7 @@ export declare const TIMER_MAX_MS: number;
|
|
|
37
37
|
*/
|
|
38
38
|
export declare const LINUX_ARG_MAX_BYTES: number;
|
|
39
39
|
/**
|
|
40
|
-
* The Runtime limits: the harness's (above), and the ones only the Runtime checks
|
|
40
|
+
* The Runtime limits: the harness's (above), and the ones only the Runtime checks, by area.
|
|
41
41
|
*
|
|
42
42
|
* Requests and uploads:
|
|
43
43
|
* - `requestBodyBytes`: the largest JSON body a Runtime or Management API route reads.
|
|
@@ -107,6 +107,32 @@ export declare const LINUX_ARG_MAX_BYTES: number;
|
|
|
107
107
|
* longest `reason` or `matches` expression.
|
|
108
108
|
* - `modelBudgets`: the most model budgets the Tenant sets.
|
|
109
109
|
*
|
|
110
|
+
* Triggers (checked when a manifest is saved, and when a trigger fires):
|
|
111
|
+
* - `triggersPerAgent`: the most triggers one agent manifest declares.
|
|
112
|
+
* - `triggerMinIntervalMs`: the shortest gap between two runs of one schedule (cron is minute
|
|
113
|
+
* grained, so at least a minute), checked over its next fires at save.
|
|
114
|
+
* - `triggerRunsPerHour`: the most runs one Agent's triggers start or queue in any hour; later
|
|
115
|
+
* ones are skipped (`rate_limited`). The guard against an Agent triggering itself.
|
|
116
|
+
* - `triggerJitterPercent`, `triggerJitterMaxMs`: how far each schedule's fixed offset may move
|
|
117
|
+
* its runs, as a part of its interval and at most.
|
|
118
|
+
* - `triggerPromptChars`: the longest prompt one trigger holds.
|
|
119
|
+
* - `triggerRunRetentionMs`: how long runs are kept; they dedupe repeated fires, so at least a day.
|
|
120
|
+
* - `wakeMaxAheadMs`: how far ahead `schedule_wake` may book a session's next turn; at least
|
|
121
|
+
* `triggerMinIntervalMs` ahead too. A long wait is armed in steps, so it has no timer ceiling.
|
|
122
|
+
* - `wakeNoteChars`: the longest note a booked wake carries to its turn.
|
|
123
|
+
* - `webhookBodyBytes`: the largest delivery a webhook endpoint reads, before it verifies it
|
|
124
|
+
* (`413` past it); the payload goes into the turn's message, one record entry.
|
|
125
|
+
*
|
|
126
|
+
* Memory (checked on every write):
|
|
127
|
+
* - `memoryBytes`: the largest memory, in UTF-8 bytes.
|
|
128
|
+
* - `memoriesPerAgent`: the most memories one Agent holds.
|
|
129
|
+
* - `memoryIndexLines`, `memoryIndexBytes`: the most lines and UTF-8 bytes of the index a session
|
|
130
|
+
* pins at its start (`turn.start.memory.index`); the newest memories come first.
|
|
131
|
+
*
|
|
132
|
+
* Sessions:
|
|
133
|
+
* - `sessionQueuedMessages`: the most messages one session's queue holds while its turn runs or
|
|
134
|
+
* waits (protocol 17); one more is `429 queue_full`.
|
|
135
|
+
*
|
|
110
136
|
* Flows (`workflows.md` §13):
|
|
111
137
|
* - `flowConcurrency`: the most effects one flow turn runs at once; the rest wait their turn.
|
|
112
138
|
* - `flowMapItems`: the most items one map stage may fan out to (`map.too-many-items` past it).
|
|
@@ -165,6 +191,21 @@ export declare const RuntimeLimitsSchema: z.ZodObject<{
|
|
|
165
191
|
toolRuleFieldChars: z.ZodNumber;
|
|
166
192
|
toolRuleTextChars: z.ZodNumber;
|
|
167
193
|
modelBudgets: z.ZodNumber;
|
|
194
|
+
triggersPerAgent: z.ZodNumber;
|
|
195
|
+
triggerMinIntervalMs: z.ZodNumber;
|
|
196
|
+
triggerRunsPerHour: z.ZodNumber;
|
|
197
|
+
triggerJitterPercent: z.ZodNumber;
|
|
198
|
+
triggerJitterMaxMs: z.ZodNumber;
|
|
199
|
+
triggerPromptChars: z.ZodNumber;
|
|
200
|
+
triggerRunRetentionMs: z.ZodNumber;
|
|
201
|
+
webhookBodyBytes: z.ZodNumber;
|
|
202
|
+
wakeMaxAheadMs: z.ZodNumber;
|
|
203
|
+
wakeNoteChars: z.ZodNumber;
|
|
204
|
+
memoryBytes: z.ZodNumber;
|
|
205
|
+
memoriesPerAgent: z.ZodNumber;
|
|
206
|
+
memoryIndexLines: z.ZodNumber;
|
|
207
|
+
memoryIndexBytes: z.ZodNumber;
|
|
208
|
+
sessionQueuedMessages: z.ZodNumber;
|
|
168
209
|
flowConcurrency: z.ZodNumber;
|
|
169
210
|
flowMapItems: z.ZodNumber;
|
|
170
211
|
flowLoopIterations: z.ZodNumber;
|
|
@@ -189,7 +230,7 @@ export type HarnessLimit = keyof HarnessLimits;
|
|
|
189
230
|
/** The part of `limits` a harness is sent. */
|
|
190
231
|
export declare function harnessLimitsOf(limits: RuntimeLimits): HarnessLimits;
|
|
191
232
|
/** What a limit counts. */
|
|
192
|
-
export type RuntimeLimitUnit = "bytes" | "entries" | "characters" | "milliseconds" | "attempts" | "retries" | "effects" | "iterations";
|
|
233
|
+
export type RuntimeLimitUnit = "percent" | "runs" | "bytes" | "entries" | "characters" | "milliseconds" | "attempts" | "retries" | "effects" | "iterations";
|
|
193
234
|
interface Ceiling {
|
|
194
235
|
readonly value: number;
|
|
195
236
|
readonly unit: RuntimeLimitUnit;
|
|
@@ -213,7 +254,17 @@ export declare const RUNTIME_LIMIT_DEFAULTS: RuntimeLimits;
|
|
|
213
254
|
export declare const HARNESS_LIMIT_DEFAULTS: HarnessLimits;
|
|
214
255
|
/** The limits in force: `set`, with the default for each it leaves out. */
|
|
215
256
|
export declare function runtimeLimitsOf(set: Partial<RuntimeLimits> | undefined): RuntimeLimits;
|
|
216
|
-
/**
|
|
257
|
+
/**
|
|
258
|
+
* Limits with a floor, which no setting may go under, and why: a schedule's cron is minute
|
|
259
|
+
* grained, and runs dedupe repeated fires for as long as the execution's own dedupe lasts (a day).
|
|
260
|
+
*/
|
|
261
|
+
export declare const RUNTIME_LIMIT_FLOORS: {
|
|
262
|
+
readonly [K in RuntimeLimit]?: {
|
|
263
|
+
readonly value: number;
|
|
264
|
+
readonly why: string;
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
/** Why `set` cannot be put: each limit above its ceiling or under its floor, naming why. */
|
|
217
268
|
export declare function runtimeLimitIssues(set: Partial<RuntimeLimits> | undefined): string[];
|
|
218
269
|
/**
|
|
219
270
|
* The message of a write refused for passing limit `name`: what was sent, the limit, and where an
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Runtime limits
|
|
2
|
+
* Runtime limits: the sizes, counts and deadlines the Runtime holds
|
|
3
3
|
* what crosses it to, one Tenant setting (`limits.config`, `GET`/`PUT /v1/tenant/limits`) with a
|
|
4
4
|
* default each. A harness learns the ones it must respect from `turn.start.limits`
|
|
5
5
|
* (`HarnessLimitsSchema`, a part of them).
|
|
@@ -80,7 +80,7 @@ const harnessLimits = {
|
|
|
80
80
|
folderEntries: z.number().int().positive(),
|
|
81
81
|
};
|
|
82
82
|
/**
|
|
83
|
-
* The Runtime limits: the harness's (above), and the ones only the Runtime checks
|
|
83
|
+
* The Runtime limits: the harness's (above), and the ones only the Runtime checks, by area.
|
|
84
84
|
*
|
|
85
85
|
* Requests and uploads:
|
|
86
86
|
* - `requestBodyBytes`: the largest JSON body a Runtime or Management API route reads.
|
|
@@ -150,6 +150,32 @@ const harnessLimits = {
|
|
|
150
150
|
* longest `reason` or `matches` expression.
|
|
151
151
|
* - `modelBudgets`: the most model budgets the Tenant sets.
|
|
152
152
|
*
|
|
153
|
+
* Triggers (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; 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 (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
|
+
*
|
|
153
179
|
* Flows (`workflows.md` §13):
|
|
154
180
|
* - `flowConcurrency`: the most effects one flow turn runs at once; the rest wait their turn.
|
|
155
181
|
* - `flowMapItems`: the most items one map stage may fan out to (`map.too-many-items` past it).
|
|
@@ -203,6 +229,21 @@ export const RuntimeLimitsSchema = z
|
|
|
203
229
|
toolRuleFieldChars: z.number().int().positive(),
|
|
204
230
|
toolRuleTextChars: z.number().int().positive(),
|
|
205
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(),
|
|
206
247
|
flowConcurrency: z.number().int().positive(),
|
|
207
248
|
flowMapItems: z.number().int().positive(),
|
|
208
249
|
flowLoopIterations: z.number().int().positive(),
|
|
@@ -374,6 +415,37 @@ export const RUNTIME_LIMIT_CEILINGS = {
|
|
|
374
415
|
toolRuleFieldChars: inRequestText("a selector"),
|
|
375
416
|
toolRuleTextChars: inRequestText("a text"),
|
|
376
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"),
|
|
377
449
|
flowConcurrency: counted("effects", "running effects are counted"),
|
|
378
450
|
flowMapItems: counted("entries", "items are counted"),
|
|
379
451
|
flowLoopIterations: counted("iterations", "iterations are counted"),
|
|
@@ -437,6 +509,21 @@ export const RUNTIME_LIMIT_DEFAULTS = Object.freeze({
|
|
|
437
509
|
toolRuleFieldChars: 200,
|
|
438
510
|
toolRuleTextChars: 500,
|
|
439
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,
|
|
440
527
|
flowConcurrency: 8,
|
|
441
528
|
flowMapItems: 1_000,
|
|
442
529
|
flowLoopIterations: 100,
|
|
@@ -453,9 +540,25 @@ export function runtimeLimitsOf(set) {
|
|
|
453
540
|
}
|
|
454
541
|
return limits;
|
|
455
542
|
}
|
|
456
|
-
/**
|
|
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. */
|
|
457
555
|
export function runtimeLimitIssues(set) {
|
|
458
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
|
+
}
|
|
459
562
|
for (const name of Object.keys(RUNTIME_LIMIT_CEILINGS)) {
|
|
460
563
|
const asked = set?.[name];
|
|
461
564
|
const ceiling = RUNTIME_LIMIT_CEILINGS[name];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Our engine's tool that stores a sandbox file, or inline text, as a file artifact of the
|
|
3
|
-
*
|
|
2
|
+
* Our engine's tool that stores a sandbox file, or inline text, as a file artifact of the
|
|
3
|
+
* session. Since protocol 15 it runs in our harness (`@nylorun/harness`), not the Runtime.
|
|
4
4
|
*/
|
|
5
5
|
export declare const SAVE_ARTIFACT_TOOL = "save_artifact";
|
|
6
6
|
/**
|
|
7
|
-
* Our engine's tool that reads an artifact of the session in pages
|
|
7
|
+
* Our engine's tool that reads an artifact of the session in pages. Since protocol 15 it
|
|
8
8
|
* runs in our harness, which also names it in a spilled tool result's stub and in a file's
|
|
9
9
|
* reference line.
|
|
10
10
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Our engine's tool that stores a sandbox file, or inline text, as a file artifact of the
|
|
3
|
-
*
|
|
2
|
+
* Our engine's tool that stores a sandbox file, or inline text, as a file artifact of the
|
|
3
|
+
* session. Since protocol 15 it runs in our harness (`@nylorun/harness`), not the Runtime.
|
|
4
4
|
*/
|
|
5
5
|
export const SAVE_ARTIFACT_TOOL = "save_artifact";
|
|
6
6
|
/**
|
|
7
|
-
* Our engine's tool that reads an artifact of the session in pages
|
|
7
|
+
* Our engine's tool that reads an artifact of the session in pages. Since protocol 15 it
|
|
8
8
|
* runs in our harness, which also names it in a spilled tool result's stub and in a file's
|
|
9
9
|
* reference line.
|
|
10
10
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nylorun/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0-beta",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"description": "Shared agent definitions and wire contracts",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"@noble/hashes": "^2.4.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/node": "^26.6.
|
|
36
|
+
"@types/node": "^26.6.5",
|
|
37
37
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
38
|
-
"vitest": "^5.0.
|
|
38
|
+
"vitest": "^5.0.4"
|
|
39
39
|
},
|
|
40
40
|
"exports": {
|
|
41
41
|
".": {
|
|
@@ -72,10 +72,11 @@
|
|
|
72
72
|
"import": "./dist/manifest-schemas.js"
|
|
73
73
|
},
|
|
74
74
|
"./schemas/agent-manifest.json": "./dist/schemas/agent-manifest.schema.json",
|
|
75
|
-
"./schemas/
|
|
75
|
+
"./schemas/harness-manifest.json": "./dist/schemas/harness-manifest.schema.json",
|
|
76
|
+
"./schemas/runtime-manifest.json": "./dist/schemas/runtime-manifest.schema.json"
|
|
76
77
|
},
|
|
77
78
|
"peerDependencies": {
|
|
78
|
-
"zod": "^4.6.
|
|
79
|
+
"zod": "^4.6.7"
|
|
79
80
|
},
|
|
80
81
|
"sideEffects": false
|
|
81
82
|
}
|