@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.
Files changed (67) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/compatibility.d.ts +127 -59
  3. package/dist/compatibility.js +128 -60
  4. package/dist/contracts.d.ts +2413 -893
  5. package/dist/contracts.js +1144 -491
  6. package/dist/define.d.ts +1 -0
  7. package/dist/define.js +1 -0
  8. package/dist/definition/approval.d.ts +1 -1
  9. package/dist/definition/bound.d.ts +2 -0
  10. package/dist/definition/builder.d.ts +2 -2
  11. package/dist/definition/builder.js +1 -1
  12. package/dist/definition/code-tools.d.ts +1 -1
  13. package/dist/definition/declaration.js +3 -0
  14. package/dist/definition/delegate.d.ts +1 -1
  15. package/dist/definition/delegate.js +1 -1
  16. package/dist/definition/from.d.ts +2 -2
  17. package/dist/definition/from.js +1 -1
  18. package/dist/definition/http-tool.d.ts +3 -3
  19. package/dist/definition/mcp.d.ts +4 -4
  20. package/dist/definition/mcp.js +3 -3
  21. package/dist/definition/removed.d.ts +7 -0
  22. package/dist/definition/removed.js +21 -1
  23. package/dist/definition/sections.d.ts +64 -0
  24. package/dist/definition/sections.js +227 -0
  25. package/dist/definition/variant.d.ts +1 -1
  26. package/dist/definition/variant.js +4 -4
  27. package/dist/harness-api/entries.d.ts +1 -1
  28. package/dist/harness-api/entries.js +1 -1
  29. package/dist/harness-api/gates.d.ts +1 -1
  30. package/dist/harness-api/gates.js +1 -1
  31. package/dist/harness-api/harness-api.schema.json +182 -6
  32. package/dist/harness-api/index.d.ts +3 -3
  33. package/dist/harness-api/index.js +3 -3
  34. package/dist/harness-api/json-schema.d.ts +1 -1
  35. package/dist/harness-api/json-schema.js +3 -3
  36. package/dist/harness-api/mcp.js +1 -1
  37. package/dist/harness-api/messages.d.ts +10 -8
  38. package/dist/harness-api/messages.js +1 -1
  39. package/dist/harness-api/schema.d.ts +82 -13
  40. package/dist/harness-api/schema.js +63 -19
  41. package/dist/harness-api/transcript.d.ts +1 -1
  42. package/dist/harness-api/transport.d.ts +1 -1
  43. package/dist/harness-api/transport.js +1 -1
  44. package/dist/manifest-schemas.d.ts +9 -5
  45. package/dist/manifest-schemas.js +24 -27
  46. package/dist/schemas/agent-manifest.schema.json +1534 -250
  47. package/dist/schemas/harness-manifest.schema.json +1273 -0
  48. package/dist/schemas/{environment-manifest.schema.json → runtime-manifest.schema.json} +109 -68
  49. package/dist/types/manifest.d.ts +87 -15
  50. package/dist/types/manifest.js +4 -0
  51. package/dist/types/model.d.ts +5 -0
  52. package/dist/types/observe.d.ts +1 -1
  53. package/dist/types/part.d.ts +5 -0
  54. package/dist/types/tool.d.ts +4 -4
  55. package/dist/utils/definition-files.d.ts +3 -2
  56. package/dist/utils/definition-files.js +4 -3
  57. package/dist/utils/file-systems.d.ts +1 -1
  58. package/dist/utils/file-systems.js +1 -1
  59. package/dist/utils/harness-id.d.ts +1 -1
  60. package/dist/utils/harness-id.js +1 -1
  61. package/dist/utils/memory.d.ts +64 -0
  62. package/dist/utils/memory.js +139 -0
  63. package/dist/utils/runtime-limits.d.ts +55 -4
  64. package/dist/utils/runtime-limits.js +106 -3
  65. package/dist/utils/runtime-tools.d.ts +3 -3
  66. package/dist/utils/runtime-tools.js +3 -3
  67. package/package.json +6 -5
@@ -1,22 +1,10 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://docs.nylorun.com/schemas/environment-manifest/v1.json",
4
- "title": "Nylorun environment manifest 1",
3
+ "$id": "https://docs.nylorun.com/schemas/runtime-manifest/v1.json",
4
+ "title": "Nylorun runtime manifest 1",
5
5
  "type": "object",
6
6
  "properties": {
7
7
  "$schema": {
8
- "type": "string",
9
- "description": "This document's JSON Schema, for editors; clients drop it before saving"
10
- },
11
- "manifestSchemaVersion": {
12
- "type": "number",
13
- "const": 1
14
- },
15
- "name": {
16
- "type": "string",
17
- "description": "An environment manifest's name, such as `analyst-box`"
18
- },
19
- "description": {
20
8
  "type": "string"
21
9
  },
22
10
  "kind": {
@@ -60,10 +48,6 @@
60
48
  },
61
49
  "additionalProperties": false
62
50
  },
63
- "harness": {
64
- "type": "string",
65
- "pattern": "^[a-z][a-z0-9-]{1,62}$"
66
- },
67
51
  "lifecycle": {
68
52
  "type": "object",
69
53
  "properties": {
@@ -105,63 +89,65 @@
105
89
  "items": {
106
90
  "anyOf": [
107
91
  {
108
- "type": "object",
109
- "properties": {
110
- "artifactId": {
111
- "type": "string"
112
- },
113
- "version": {
114
- "type": "integer",
115
- "exclusiveMinimum": 0,
116
- "maximum": 9007199254740991
117
- },
118
- "path": {
119
- "type": "string",
120
- "minLength": 1,
121
- "maxLength": 1024
122
- }
123
- },
124
- "required": [
125
- "artifactId",
126
- "version",
127
- "path"
128
- ],
129
- "additionalProperties": false
130
- },
131
- {
132
- "type": "object",
133
- "properties": {
134
- "path": {
135
- "type": "string",
136
- "minLength": 1,
137
- "maxLength": 1024
92
+ "anyOf": [
93
+ {
94
+ "type": "object",
95
+ "properties": {
96
+ "artifactId": {
97
+ "type": "string"
98
+ },
99
+ "version": {
100
+ "type": "integer",
101
+ "exclusiveMinimum": 0,
102
+ "maximum": 9007199254740991
103
+ },
104
+ "path": {
105
+ "type": "string",
106
+ "minLength": 1,
107
+ "maxLength": 1024
108
+ }
109
+ },
110
+ "required": [
111
+ "artifactId",
112
+ "version",
113
+ "path"
114
+ ],
115
+ "additionalProperties": false
138
116
  },
139
- "files": {
117
+ {
140
118
  "type": "object",
141
- "propertyNames": {
142
- "type": "string",
143
- "minLength": 1,
144
- "maxLength": 1024
119
+ "properties": {
120
+ "path": {
121
+ "type": "string",
122
+ "minLength": 1,
123
+ "maxLength": 1024
124
+ },
125
+ "files": {
126
+ "type": "object",
127
+ "propertyNames": {
128
+ "type": "string",
129
+ "minLength": 1,
130
+ "maxLength": 1024
131
+ },
132
+ "additionalProperties": {
133
+ "type": "string"
134
+ }
135
+ }
145
136
  },
146
- "additionalProperties": {
147
- "type": "string"
148
- }
137
+ "required": [
138
+ "path",
139
+ "files"
140
+ ],
141
+ "additionalProperties": false
149
142
  }
150
- },
151
- "required": [
152
- "path",
153
- "files"
154
- ],
155
- "additionalProperties": false
143
+ ]
156
144
  },
157
145
  {
158
146
  "type": "object",
159
- "description": "For the CLI only: a folder, relative to this file, that `nylorun environments manifests save` uploads by hash and saves as { path, files }",
160
147
  "properties": {
161
148
  "path": {
162
149
  "type": "string",
163
- "minLength": 1,
164
- "maxLength": 1024
150
+ "minLength": 1
165
151
  },
166
152
  "from": {
167
153
  "type": "string",
@@ -379,11 +365,66 @@
379
365
  }
380
366
  ]
381
367
  }
368
+ },
369
+ "triggers": {
370
+ "description": "What starts the Agent's turns with no client connected, by trigger id",
371
+ "type": "object",
372
+ "propertyNames": {
373
+ "type": "string",
374
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$",
375
+ "description": "A trigger's id, such as `hourly-check`"
376
+ },
377
+ "additionalProperties": {
378
+ "$ref": "#/$defs/Trigger"
379
+ }
380
+ },
381
+ "selfWake": {
382
+ "description": "Offer the agent schedule_wake: it books its session's next turn itself",
383
+ "type": "boolean"
382
384
  }
383
385
  },
384
386
  "required": [
385
- "manifestSchemaVersion",
386
- "name"
387
+ "kind"
387
388
  ],
388
- "additionalProperties": false
389
+ "additionalProperties": false,
390
+ "$defs": {
391
+ "Trigger": {
392
+ "type": "object",
393
+ "properties": {
394
+ "schedule": {
395
+ "type": "string",
396
+ "pattern": "^\\S+(\\s+\\S+){4}$"
397
+ },
398
+ "timezone": {
399
+ "type": "string",
400
+ "minLength": 1
401
+ },
402
+ "at": {
403
+ "type": "string",
404
+ "format": "date-time",
405
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
406
+ },
407
+ "webhook": {
408
+ "type": "string",
409
+ "enum": [
410
+ "standard-webhooks"
411
+ ]
412
+ },
413
+ "session": {
414
+ "type": "string",
415
+ "minLength": 1,
416
+ "maxLength": 200
417
+ },
418
+ "prompt": {
419
+ "type": "string",
420
+ "minLength": 1
421
+ }
422
+ },
423
+ "required": [
424
+ "session",
425
+ "prompt"
426
+ ],
427
+ "additionalProperties": false
428
+ }
429
+ }
389
430
  }
@@ -1,5 +1,5 @@
1
1
  import type { JsonObject } from "./shared.js";
2
- import type { WorkflowManifest } from "./workflow.js";
2
+ import type { WorkflowManifest, WorkflowNode } from "./workflow.js";
3
3
  /**
4
4
  * Published manifest schema version (no top-level model — Runtime-owned). Version 7 is flat: the
5
5
  * agent's instructions, tools, skills and MCP servers sit at the top level, with no capabilities.
@@ -11,8 +11,8 @@ export interface PluginLabel {
11
11
  readonly version?: string;
12
12
  }
13
13
  /**
14
- * Whether each call waits for a person's approval, in a manifest saved before R5 step 2 (the
15
- * Tool Gate holds such a call). New definitions use the Tenant's tool policy instead.
14
+ * Whether each call waits for a person's approval, in a manifest saved before the Tenant's tool
15
+ * policy (the Tool Gate holds such a call). New definitions use the Tenant's tool policy instead.
16
16
  */
17
17
  export type ApprovalMode = "never" | "always";
18
18
  /**
@@ -37,12 +37,16 @@ export interface HttpToolTarget {
37
37
  readonly method?: HttpToolMethod;
38
38
  /**
39
39
  * Adds a vault credential to each request, as for a remote MCP server: the credential in the
40
- * vault of the session's Environment bound to `url` (a `bearer` token or a `headers` map, sent
41
- * to its `via` when it has one, with its identity header). This name labels it in coverage.
40
+ * vault of the session's Agent bound to `url` (a `bearer` token or a `headers` map, sent to its
41
+ * `via` when it has one, with its identity header). In an agent manifest v8 it names a
42
+ * `runtime.secrets` slot, checked when the manifest is saved; it labels the tool in coverage.
42
43
  * When the vault holds none, the call fails with `http.credential` and is not sent.
43
44
  */
44
45
  readonly credential?: string;
45
- /** How long the service may take to answer. Default 60000, at most 300000. */
46
+ /**
47
+ * How long the service may take to answer. Default 60000, at most the Tenant's Runtime limit
48
+ * `httpToolTimeoutMs` (`PUT /v1/tenant/limits`).
49
+ */
46
50
  readonly timeoutMs?: number;
47
51
  }
48
52
  export interface ToolManifest {
@@ -59,7 +63,7 @@ export interface ToolManifest {
59
63
  /** Present when the Runtime runs this tool as an HTTP request. Never with `agent`. */
60
64
  readonly http?: HttpToolTarget;
61
65
  /**
62
- * @deprecated Removed in R5 step 2: the Runtime refuses a definition that sets it, and tool
66
+ * @deprecated Removed with the Tenant's tool policy: the Runtime refuses a definition that sets it, and tool
63
67
  * approvals are the Tenant's tool policy (`PUT /v1/tenant/tool-policy`). Read only from
64
68
  * manifests saved before, which the Tool Gate still holds for approval.
65
69
  */
@@ -78,17 +82,17 @@ export interface SkillManifest {
78
82
  readonly plugin?: PluginLabel;
79
83
  }
80
84
  /**
81
- * One tool's settings on an MCP server (manifest v6, R2b C9). Each setting resolves from the
85
+ * One tool's settings on an MCP server (manifest v6). Each setting resolves from the
82
86
  * tool's own entry, then the `"*"` entry, then the server, then the default.
83
87
  */
84
88
  export interface McpToolSettings {
85
89
  /** `false`: the tool never reaches the model and cannot be called. Default `true`. */
86
90
  readonly enabled?: boolean;
87
- /** @deprecated Removed in R5 step 2, as `ToolManifest.approval`; read only from older manifests. */
91
+ /** @deprecated Removed, as `ToolManifest.approval`; read only from older manifests. */
88
92
  readonly approval?: ApprovalMode;
89
93
  /**
90
94
  * `true`: the tool leaves the model's tool list; the model finds it with `tool_search` and runs
91
- * it with `tool_call` (R2b C10). A hint the harness reads (`turn.start.mcp`): Nylorun's engine
95
+ * it with `tool_call`. A hint the harness reads (`turn.start.mcp`): Nylorun's engine
92
96
  * follows it, and without one defers when the agent's MCP tools would take more than a tenth of
93
97
  * the model's context window.
94
98
  */
@@ -98,12 +102,12 @@ interface McpServerFields {
98
102
  readonly name: string;
99
103
  readonly url: string;
100
104
  readonly headers?: Readonly<Record<string, string>>;
101
- /** @deprecated Removed in R5 step 2, as `ToolManifest.approval`; read only from older manifests. */
105
+ /** @deprecated Removed, as `ToolManifest.approval`; read only from older manifests. */
102
106
  readonly approval?: ApprovalMode;
103
- /** Defers every tool of the server, or none (manifest v6, R2b C10). Default: automatic. */
107
+ /** Defers every tool of the server, or none (manifest v6). Default: automatic. */
104
108
  readonly deferred?: boolean;
105
109
  /**
106
- * Settings per tool (manifest v6, R2b C9), keyed by the server's own tool name (before C6
110
+ * Settings per tool (manifest v6), keyed by the server's own tool name (before
107
111
  * renaming), with `"*"` for every tool without an entry: `{"*": {enabled: false}}` and an
108
112
  * entry per wanted tool make an allowlist.
109
113
  */
@@ -151,14 +155,82 @@ export interface AgentManifest {
151
155
  readonly tools?: readonly ToolManifest[];
152
156
  readonly skills?: Readonly<Record<string, SkillManifest>>;
153
157
  readonly mcpServers?: Readonly<Record<string, McpServerManifest>>;
154
- /** What the agent needs of its session's Environment, checked when a session opens (D65). */
158
+ /** What the agent needs of its session's Environment, checked when a session opens. */
155
159
  readonly requires?: AgentRequirements;
156
160
  }
157
- /** What an agent needs of the Environment its session opens on (protocol 14, D65). */
161
+ /** What an agent needs of the Environment its session opens on (protocol 14). */
158
162
  export interface AgentRequirements {
159
163
  /** `any`: kind `virtual` or `pod`; `pod`: kind `pod`; `none`: nothing. */
160
164
  readonly sandbox?: "none" | "any" | "pod";
161
165
  /** Secret names (environment variables) its skills' scripts read, which the vault must hold. */
162
166
  readonly secrets?: readonly string[];
163
167
  }
168
+ /**
169
+ * Agent manifest v8 (protocol 16): one versioned document saved at
170
+ * `/v1/agent-manifests/{name}`, with what runs inside the agent loop (`harness`) and what the
171
+ * Runtime provides around it (`runtime`). An Agent is made from one version of it.
172
+ */
173
+ export type AgentManifestV8SchemaVersion = 8;
174
+ /** A skill as an agent manifest v8 declares it: a v7 skill, and the secret slots its scripts read. */
175
+ export interface HarnessSkill extends SkillManifest {
176
+ /**
177
+ * The `runtime.secrets` slots its scripts read, each of type `environment_secret` or
178
+ * `environment_variable`: checked when the manifest is saved. Replaces `requires.secrets`.
179
+ */
180
+ readonly secrets?: readonly string[];
181
+ }
182
+ /** A remote MCP server as an agent manifest v8 declares it: no `approval`, which v8 refuses. */
183
+ export type HarnessMcpServer = (McpServerManifest extends infer Server ? Server extends unknown ? Omit<Server, "approval"> : never : never) & {
184
+ /**
185
+ * The `runtime.secrets` slot of type `bearer` or `headers` bound to this server's URL: checked
186
+ * when the manifest is saved. A server that names none keeps matching the vault by its URL.
187
+ */
188
+ readonly credential?: string;
189
+ };
190
+ /** What runs inside the loop of an agent: the `harness` section of an agent manifest v8. */
191
+ export interface AgentHarnessSection {
192
+ /** The harness that runs the loop: `nylorun` (ours, the default) or a custom harness's id. */
193
+ readonly id?: string;
194
+ readonly instructions?: readonly string[];
195
+ /** An HTTP tool's `credential` names a `runtime.secrets` slot, checked at save. */
196
+ readonly tools?: readonly ToolManifest[];
197
+ readonly skills?: Readonly<Record<string, HarnessSkill>>;
198
+ readonly mcpServers?: Readonly<Record<string, HarnessMcpServer>>;
199
+ /** The Agent Plugins folded into it when it was composed, so a version records what built it. */
200
+ readonly plugins?: readonly PluginLabel[];
201
+ readonly outputSchema?: JsonObject;
202
+ /** The harness's own settings: passed to it in `turn.start`, never read by the Runtime. */
203
+ readonly loop?: JsonObject;
204
+ /** Turns on the Agent's memory: Markdown files it keeps across sessions. */
205
+ readonly memory?: AgentMemorySettings;
206
+ }
207
+ /**
208
+ * `harness.memory`: the Agent's memory, the same in every turn whoever starts it.
209
+ * `access` is `read_write` (the default) or `read_only`; `instructions` tell the model what this
210
+ * agent should remember, after the engine's own memory rules.
211
+ */
212
+ export interface AgentMemorySettings {
213
+ readonly access?: "read_write" | "read_only";
214
+ readonly instructions?: string;
215
+ }
216
+ /**
217
+ * A flow's `harness` section: workflow manifest v3's flow without its identity, which the
218
+ * manifest holds, or its sandbox, which the `runtime` section provides.
219
+ */
220
+ export interface WorkflowHarnessSection {
221
+ readonly kind: "workflow";
222
+ /** Flows run in our harness: `nylorun` when set. */
223
+ readonly id?: string;
224
+ readonly inputSchema?: JsonObject;
225
+ readonly outputSchema?: JsonObject;
226
+ readonly root: WorkflowNode;
227
+ readonly agents: Readonly<Record<string, AgentManifest | WorkflowManifest>>;
228
+ readonly plugins?: readonly PluginLabel[];
229
+ readonly loop?: JsonObject;
230
+ }
231
+ export type HarnessSection = AgentHarnessSection | WorkflowHarnessSection;
164
232
  export {};
233
+ /**
234
+ * The rest of agent manifest v8 (`AgentManifestV8`, `RuntimeSection`) is the zod schemas' output
235
+ * in `contracts.ts`: the runtime section reuses environment manifest v1's field schemas.
236
+ */
@@ -1 +1,5 @@
1
1
  export {};
2
+ /**
3
+ * The rest of agent manifest v8 (`AgentManifestV8`, `RuntimeSection`) is the zod schemas' output
4
+ * in `contracts.ts`: the runtime section reuses environment manifest v1's field schemas.
5
+ */
@@ -132,6 +132,11 @@ export interface ModelRequest {
132
132
  /** Canonical, immutable Harness-owned model configuration for this call. */
133
133
  readonly configuration: ModelConfigurationSnapshot;
134
134
  readonly instructions: readonly string[];
135
+ /**
136
+ * Text the engine keeps at the head of the conversation, after the instructions, as user-role
137
+ * context: the Agent's memory index. The same for every call until it is re-pinned.
138
+ */
139
+ readonly pinned?: readonly string[];
135
140
  readonly context: ContextSnapshot;
136
141
  readonly transcript: readonly TranscriptEntry[];
137
142
  readonly arrivals: readonly InputEvent[];
@@ -13,7 +13,7 @@ export interface WorkflowErrorPayload {
13
13
  *
14
14
  * @deprecated Use the event catalog (`EVENT_CATALOG`, `SessionEventOf<"node.agent">` in
15
15
  * `@nylorun/core/contracts`): it types the events the Runtime writes. `node.completed` is
16
- * written for a flow's HTTP stages only (R7.1), with more fields; `node.failed`,
16
+ * written for a flow's HTTP stages only, with more fields; `node.failed`,
17
17
  * `switch.selected`, `map.items` and `loop.waiting` are not written.
18
18
  */
19
19
  export type WorkflowLiveEventPayload = {
@@ -21,5 +21,10 @@ export interface PartDeclaration<Info = unknown> {
21
21
  readonly skills?: Readonly<Record<string, SkillManifest>>;
22
22
  /** Each skill file's bytes, by `sha256:<hex>`, for the client to upload. Not projected into the manifest. */
23
23
  readonly skillFiles?: Readonly<Record<string, SkillFileSource>>;
24
+ /**
25
+ * The secret slots each skill's scripts read, by skill name (a SKILL.md's `secrets`): the
26
+ * harness section's `skills.<name>.secrets` when the agent is saved. Not projected into the manifest.
27
+ */
28
+ readonly skillSecrets?: Readonly<Record<string, readonly string[]>>;
24
29
  readonly mcpServers?: Readonly<Record<string, McpServerManifest>>;
25
30
  }
@@ -154,7 +154,7 @@ export type ToolExecutionContext<Info = unknown> = ToolExecutionContextBase & {
154
154
  };
155
155
  export type ToolContent = JsonValue;
156
156
  /**
157
- * A file the model sees beside a tool's output (R2b C11): an image a tool returned, which the
157
+ * A file the model sees beside a tool's output: an image a tool returned, which the
158
158
  * Runtime stored as an artifact. `reference` is the host's, as a message's media part carries it:
159
159
  * the model call resolves it, and a model that reads no images gets a note instead.
160
160
  */
@@ -165,11 +165,11 @@ export type ToolResultFile = {
165
165
  export type ToolOutcome<Output = ToolContent> = {
166
166
  readonly kind: "completed";
167
167
  readonly output: Output;
168
- /** Files the model sees beside the output (R2b C11). */
168
+ /** Files the model sees beside the output. */
169
169
  readonly files?: readonly ToolResultFile[];
170
170
  /**
171
- * The output is the Runtime's preview of a larger result it stored as an artifact (R2b
172
- * C11), not the tool's own, so the tool's output schema is not checked against it.
171
+ * The output is the Runtime's preview of a larger result it stored as an artifact, not
172
+ * the tool's own, so the tool's output schema is not checked against it.
173
173
  */
174
174
  readonly truncated?: boolean;
175
175
  } | {
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * The most bytes one skill's files may hold together when the Tenant sets no limit of its own
3
- * (2 GiB, Tenant setting `skills.config`); an Environment's manifest may set a lower one. No file
3
+ * (2 GiB, Tenant setting `skills.config`); an agent manifest's `runtime.limits.skills.totalBytes`
4
+ * may set a lower one. No file
4
5
  * and no count of files has a limit of its own.
5
6
  */
6
7
  export declare const SKILL_TOTAL_BYTES_DEFAULT: number;
@@ -15,7 +16,7 @@ export declare const SKILLS_MOUNT = "/skills";
15
16
  */
16
17
  export declare const SKILL_FILE_PATH_MAX: number;
17
18
  /**
18
- * The folder of a sandbox that holds one version of a skill, read-only (D66):
19
+ * The folder of a sandbox that holds one version of a skill, read-only:
19
20
  * `/skills/<name>@<12 hex>`, the hex from the SHA-256 of its canonical file map. A version keeps
20
21
  * its folder and is never replaced, so sessions whose agents carry different versions of a skill
21
22
  * share an Environment without changing each other's files.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Definition files (track R2 M4): the files a definition names by content hash, uploaded once
2
+ * Definition files: the files a definition names by content hash, uploaded once
3
3
  * with `PUT /v1/files/sha256:<hex>` and held by the Runtime. Today they are the files of a
4
4
  * skill's folder (`SkillManifest.files`). Shared by the SDK, the wire schema and the Runtime.
5
5
  */
@@ -9,7 +9,8 @@ import { canonical } from "./canonical.js";
9
9
  import { FILE_NAME_MAX, FILE_PATH_MAX } from "./file-systems.js";
10
10
  /**
11
11
  * The most bytes one skill's files may hold together when the Tenant sets no limit of its own
12
- * (2 GiB, Tenant setting `skills.config`); an Environment's manifest may set a lower one. No file
12
+ * (2 GiB, Tenant setting `skills.config`); an agent manifest's `runtime.limits.skills.totalBytes`
13
+ * may set a lower one. No file
13
14
  * and no count of files has a limit of its own.
14
15
  */
15
16
  export const SKILL_TOTAL_BYTES_DEFAULT = 2 * 1024 * 1024 * 1024;
@@ -24,7 +25,7 @@ export const SKILLS_MOUNT = "/skills";
24
25
  */
25
26
  export const SKILL_FILE_PATH_MAX = FILE_PATH_MAX - `${SKILLS_MOUNT}/${"n".repeat(FILE_NAME_MAX)}@${"0".repeat(12)}/`.length;
26
27
  /**
27
- * The folder of a sandbox that holds one version of a skill, read-only (D66):
28
+ * The folder of a sandbox that holds one version of a skill, read-only:
28
29
  * `/skills/<name>@<12 hex>`, the hex from the SHA-256 of its canonical file map. A version keeps
29
30
  * its folder and is never replaced, so sessions whose agents carry different versions of a skill
30
31
  * share an Environment without changing each other's files.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * What the file systems a workspace lives on take (B15: constants fixed by a standard, not
2
+ * What the file systems a workspace lives on take (constants fixed by a standard, not
3
3
  * limits): artifact names and folder paths are written as file names and paths there, when an
4
4
  * artifact is copied into a sandbox, a folder unpacked, a skill mounted or a file downloaded.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * What the file systems a workspace lives on take (B15: constants fixed by a standard, not
2
+ * What the file systems a workspace lives on take (constants fixed by a standard, not
3
3
  * limits): artifact names and folder paths are written as file names and paths there, when an
4
4
  * artifact is copied into a sandbox, a folder unpacked, a skill mounted or a file downloaded.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Harness ids (track R4): the name a harness says in `hello`, an Environment's `harness`, and the
2
+ * Harness ids: the name a harness says in `hello`, an Environment's `harness`, and the
3
3
  * key of the Tenant's placement. A session runs the harness it pinned when it opened.
4
4
  */
5
5
  /** The harness of a session that names no other: ours (`@nylorun/harness`). */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Harness ids (track R4): the name a harness says in `hello`, an Environment's `harness`, and the
2
+ * Harness ids: the name a harness says in `hello`, an Environment's `harness`, and the
3
3
  * key of the Tenant's placement. A session runs the harness it pinned when it opened.
4
4
  */
5
5
  /** The harness of a session that names no other: ours (`@nylorun/harness`). */
@@ -0,0 +1,64 @@
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 declare const MEMORY_ROOT = "/memories";
13
+ /** The longest memory path, `/memories/` included. */
14
+ export declare const MEMORY_PATH_MAX = 512;
15
+ /** The longest `harness.memory.instructions`. */
16
+ export declare const MEMORY_INSTRUCTIONS_MAX = 4096;
17
+ /** The longest description an index line shows. */
18
+ export declare const MEMORY_DESCRIPTION_MAX = 200;
19
+ /** What `harness.memory.access` may be: reads and writes, or reads only. */
20
+ export declare const MEMORY_ACCESS: readonly ["read_write", "read_only"];
21
+ export type MemoryAccess = (typeof MEMORY_ACCESS)[number];
22
+ /** What changed a memory, as a version records it. */
23
+ export declare const MEMORY_OPERATIONS: readonly ["create", "str_replace", "insert", "delete", "rename"];
24
+ export type MemoryOperation = (typeof MEMORY_OPERATIONS)[number];
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 declare function memoryPathOf(raw: string, kind: "file" | "any"): {
32
+ path: string;
33
+ } | {
34
+ error: string;
35
+ };
36
+ /** Whether `path` is `folder` or inside it (`folder` a normalised memory path). */
37
+ export declare function memoryPathWithin(path: string, folder: string): boolean;
38
+ /**
39
+ * What a memory's index line shows: the `description` of its YAML frontmatter, when it has one,
40
+ * cut to `MEMORY_DESCRIPTION_MAX` characters; otherwise `null`. Frontmatter is optional and the
41
+ * Runtime never writes into a memory.
42
+ */
43
+ export declare function memoryDescriptionOf(content: string): string | null;
44
+ /** The `memory` tool's commands, Anthropic's memory tool's. */
45
+ export declare const MEMORY_COMMANDS: readonly ["view", "create", "str_replace", "insert", "delete", "rename"];
46
+ export type MemoryCommandName = (typeof MEMORY_COMMANDS)[number];
47
+ /**
48
+ * Checks a `memory` call's input against its command's parameters, which a JSON schema cannot
49
+ * tie to the command: answers the command, or the error text the model reads
50
+ * (`Error: create requires file_text.`). Our engine checks before it sends a call, and the
51
+ * Runtime checks again for every harness.
52
+ */
53
+ export declare function checkMemoryCall(input: unknown): {
54
+ command: MemoryCommandName;
55
+ args: Record<string, unknown>;
56
+ } | {
57
+ error: string;
58
+ };
59
+ /**
60
+ * The `memory` call a tool name stands for when a model names the command in it:
61
+ * `memory.create` and `memory/create` are `memory` with `command: "create"`. Answers the command,
62
+ * or `undefined` for any other name.
63
+ */
64
+ export declare function memoryAliasOf(name: string): MemoryCommandName | undefined;