@nylorun/core 0.20.0-beta → 0.21.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 (88) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/README.md +2 -2
  3. package/dist/compatibility.d.ts +84 -10
  4. package/dist/compatibility.js +84 -10
  5. package/dist/contracts.d.ts +1328 -110
  6. package/dist/contracts.js +544 -157
  7. package/dist/define.d.ts +14 -12
  8. package/dist/define.js +10 -7
  9. package/dist/definition/approval.js +12 -14
  10. package/dist/definition/assemble.d.ts +6 -10
  11. package/dist/definition/assemble.js +48 -105
  12. package/dist/definition/bind-agent.d.ts +3 -4
  13. package/dist/definition/bind-agent.js +12 -30
  14. package/dist/definition/binding.d.ts +2 -2
  15. package/dist/definition/bound.d.ts +10 -10
  16. package/dist/definition/builder.d.ts +16 -20
  17. package/dist/definition/builder.js +29 -81
  18. package/dist/definition/code-tools.d.ts +3 -3
  19. package/dist/definition/code-tools.js +6 -21
  20. package/dist/definition/declaration.d.ts +4 -7
  21. package/dist/definition/declaration.js +29 -99
  22. package/dist/definition/{tools-capability.d.ts → deferred-tools.d.ts} +3 -13
  23. package/dist/definition/{tools-capability.js → deferred-tools.js} +2 -18
  24. package/dist/definition/delegate.d.ts +2 -4
  25. package/dist/definition/delegate.js +8 -10
  26. package/dist/definition/from.d.ts +7 -4
  27. package/dist/definition/from.js +72 -117
  28. package/dist/definition/helpers.d.ts +0 -7
  29. package/dist/definition/helpers.js +0 -5
  30. package/dist/definition/implementations.d.ts +6 -8
  31. package/dist/definition/manifest.d.ts +11 -5
  32. package/dist/definition/manifest.js +26 -26
  33. package/dist/definition/mcp.d.ts +1 -52
  34. package/dist/definition/mcp.js +0 -52
  35. package/dist/definition/media-reference.d.ts +23 -0
  36. package/dist/definition/media-reference.js +26 -0
  37. package/dist/definition/removed.d.ts +3 -10
  38. package/dist/definition/removed.js +10 -17
  39. package/dist/definition/runtime-manifest.d.ts +30 -0
  40. package/dist/definition/runtime-manifest.js +132 -0
  41. package/dist/definition/sandbox-tools.d.ts +1 -1
  42. package/dist/definition/sandbox-tools.js +1 -1
  43. package/dist/definition/skill-tools.d.ts +13 -7
  44. package/dist/definition/skill-tools.js +23 -10
  45. package/dist/definition/trace.d.ts +18 -0
  46. package/dist/definition/trace.js +42 -0
  47. package/dist/definition/variant.d.ts +5 -4
  48. package/dist/definition/variant.js +18 -51
  49. package/dist/definition/workflow/runnable.js +1 -1
  50. package/dist/errors.d.ts +1 -1
  51. package/dist/harness-api/entries.d.ts +1 -0
  52. package/dist/harness-api/entries.js +1 -0
  53. package/dist/harness-api/gates.d.ts +1 -6
  54. package/dist/harness-api/gates.js +1 -3
  55. package/dist/harness-api/harness-api.schema.json +11 -92
  56. package/dist/harness-api/index.d.ts +2 -2
  57. package/dist/harness-api/index.js +2 -2
  58. package/dist/harness-api/mcp.d.ts +0 -4
  59. package/dist/harness-api/mcp.js +0 -2
  60. package/dist/harness-api/messages.d.ts +1 -3
  61. package/dist/harness-api/messages.js +1 -3
  62. package/dist/harness-api/schema.d.ts +5 -17
  63. package/dist/harness-api/schema.js +9 -6
  64. package/dist/index.d.ts +1 -1
  65. package/dist/manifest-schemas.d.ts +6 -0
  66. package/dist/manifest-schemas.js +34 -0
  67. package/dist/schemas/agent-manifest.schema.json +897 -0
  68. package/dist/schemas/environment-manifest.schema.json +329 -0
  69. package/dist/types/agent.d.ts +1 -1
  70. package/dist/types/manifest.d.ts +33 -19
  71. package/dist/types/model.d.ts +2 -2
  72. package/dist/types/observe.d.ts +5 -18
  73. package/dist/types/part.d.ts +25 -0
  74. package/dist/types/tool.d.ts +1 -1
  75. package/dist/types/transcript.d.ts +5 -0
  76. package/dist/utils/definition-files.d.ts +11 -6
  77. package/dist/utils/definition-files.js +19 -9
  78. package/dist/utils/runtime-tools.d.ts +19 -0
  79. package/dist/utils/runtime-tools.js +30 -0
  80. package/dist/utils/sandbox.d.ts +1 -1
  81. package/dist/utils/sandbox.js +1 -1
  82. package/package.json +9 -3
  83. package/dist/definition/capability.d.ts +0 -43
  84. package/dist/definition/capability.js +0 -82
  85. package/dist/definition/sandbox-capability.d.ts +0 -44
  86. package/dist/definition/sandbox-capability.js +0 -139
  87. package/dist/types/middleware.d.ts +0 -94
  88. /package/dist/types/{middleware.js → part.js} +0 -0
@@ -0,0 +1,329 @@
1
+ {
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",
5
+ "type": "object",
6
+ "properties": {
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
+ "type": "string",
21
+ "maxLength": 1024
22
+ },
23
+ "kind": {
24
+ "type": "string",
25
+ "enum": [
26
+ "virtual",
27
+ "pod",
28
+ "none"
29
+ ]
30
+ },
31
+ "image": {
32
+ "type": "string",
33
+ "minLength": 1
34
+ },
35
+ "resources": {
36
+ "type": "object",
37
+ "properties": {
38
+ "cpus": {
39
+ "type": "integer",
40
+ "minimum": 1,
41
+ "maximum": 64
42
+ },
43
+ "memory": {
44
+ "type": "string"
45
+ }
46
+ },
47
+ "additionalProperties": false
48
+ },
49
+ "storage": {
50
+ "type": "string"
51
+ },
52
+ "network": {
53
+ "type": "object",
54
+ "properties": {
55
+ "allowedHosts": {
56
+ "type": "array",
57
+ "items": {
58
+ "type": "string"
59
+ }
60
+ }
61
+ },
62
+ "additionalProperties": false
63
+ },
64
+ "harness": {
65
+ "type": "string",
66
+ "pattern": "^[a-z][a-z0-9-]{1,62}$"
67
+ },
68
+ "lifecycle": {
69
+ "type": "object",
70
+ "properties": {
71
+ "idle": {
72
+ "type": "string"
73
+ },
74
+ "deleteAfter": {
75
+ "type": "string"
76
+ }
77
+ },
78
+ "additionalProperties": false
79
+ },
80
+ "setup": {
81
+ "maxItems": 16,
82
+ "type": "array",
83
+ "items": {
84
+ "type": "object",
85
+ "properties": {
86
+ "command": {
87
+ "type": "string",
88
+ "minLength": 1,
89
+ "maxLength": 4096
90
+ },
91
+ "cwd": {
92
+ "type": "string",
93
+ "minLength": 1,
94
+ "maxLength": 1024
95
+ },
96
+ "timeout": {
97
+ "type": "string"
98
+ }
99
+ },
100
+ "required": [
101
+ "command"
102
+ ],
103
+ "additionalProperties": false
104
+ }
105
+ },
106
+ "files": {
107
+ "maxItems": 16,
108
+ "type": "array",
109
+ "items": {
110
+ "anyOf": [
111
+ {
112
+ "type": "object",
113
+ "properties": {
114
+ "artifactId": {
115
+ "type": "string"
116
+ },
117
+ "version": {
118
+ "type": "integer",
119
+ "exclusiveMinimum": 0,
120
+ "maximum": 9007199254740991
121
+ },
122
+ "path": {
123
+ "type": "string",
124
+ "minLength": 1,
125
+ "maxLength": 1024
126
+ }
127
+ },
128
+ "required": [
129
+ "artifactId",
130
+ "version",
131
+ "path"
132
+ ],
133
+ "additionalProperties": false
134
+ },
135
+ {
136
+ "type": "object",
137
+ "properties": {
138
+ "path": {
139
+ "type": "string",
140
+ "minLength": 1,
141
+ "maxLength": 1024
142
+ },
143
+ "files": {
144
+ "type": "object",
145
+ "propertyNames": {
146
+ "type": "string",
147
+ "minLength": 1,
148
+ "maxLength": 1024
149
+ },
150
+ "additionalProperties": {
151
+ "type": "string"
152
+ }
153
+ }
154
+ },
155
+ "required": [
156
+ "path",
157
+ "files"
158
+ ],
159
+ "additionalProperties": false
160
+ }
161
+ ]
162
+ }
163
+ },
164
+ "secrets": {
165
+ "type": "object",
166
+ "propertyNames": {
167
+ "type": "string"
168
+ },
169
+ "additionalProperties": {
170
+ "oneOf": [
171
+ {
172
+ "type": "object",
173
+ "properties": {
174
+ "type": {
175
+ "type": "string",
176
+ "const": "environment_secret"
177
+ },
178
+ "allowedHosts": {
179
+ "minItems": 1,
180
+ "maxItems": 32,
181
+ "type": "array",
182
+ "items": {
183
+ "type": "string"
184
+ }
185
+ },
186
+ "inject": {
187
+ "type": "object",
188
+ "properties": {
189
+ "header": {
190
+ "type": "string",
191
+ "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
192
+ },
193
+ "format": {
194
+ "type": "string",
195
+ "minLength": 1
196
+ }
197
+ },
198
+ "required": [
199
+ "header",
200
+ "format"
201
+ ],
202
+ "additionalProperties": false
203
+ },
204
+ "required": {
205
+ "type": "boolean"
206
+ },
207
+ "description": {
208
+ "type": "string",
209
+ "maxLength": 500
210
+ }
211
+ },
212
+ "required": [
213
+ "type",
214
+ "allowedHosts"
215
+ ],
216
+ "additionalProperties": false
217
+ },
218
+ {
219
+ "type": "object",
220
+ "properties": {
221
+ "type": {
222
+ "type": "string",
223
+ "const": "environment_variable"
224
+ },
225
+ "required": {
226
+ "type": "boolean"
227
+ },
228
+ "description": {
229
+ "type": "string",
230
+ "maxLength": 500
231
+ }
232
+ },
233
+ "required": [
234
+ "type"
235
+ ],
236
+ "additionalProperties": false
237
+ },
238
+ {
239
+ "type": "object",
240
+ "properties": {
241
+ "type": {
242
+ "type": "string",
243
+ "const": "bearer"
244
+ },
245
+ "url": {
246
+ "type": "string",
247
+ "minLength": 1
248
+ },
249
+ "via": {
250
+ "type": "string"
251
+ },
252
+ "identity": {
253
+ "type": "object",
254
+ "properties": {
255
+ "header": {
256
+ "type": "string",
257
+ "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
258
+ }
259
+ },
260
+ "required": [
261
+ "header"
262
+ ],
263
+ "additionalProperties": false
264
+ },
265
+ "required": {
266
+ "type": "boolean"
267
+ },
268
+ "description": {
269
+ "type": "string",
270
+ "maxLength": 500
271
+ }
272
+ },
273
+ "required": [
274
+ "type",
275
+ "url"
276
+ ],
277
+ "additionalProperties": false
278
+ },
279
+ {
280
+ "type": "object",
281
+ "properties": {
282
+ "type": {
283
+ "type": "string",
284
+ "const": "headers"
285
+ },
286
+ "url": {
287
+ "type": "string",
288
+ "minLength": 1
289
+ },
290
+ "via": {
291
+ "type": "string"
292
+ },
293
+ "identity": {
294
+ "type": "object",
295
+ "properties": {
296
+ "header": {
297
+ "type": "string",
298
+ "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
299
+ }
300
+ },
301
+ "required": [
302
+ "header"
303
+ ],
304
+ "additionalProperties": false
305
+ },
306
+ "required": {
307
+ "type": "boolean"
308
+ },
309
+ "description": {
310
+ "type": "string",
311
+ "maxLength": 500
312
+ }
313
+ },
314
+ "required": [
315
+ "type",
316
+ "url"
317
+ ],
318
+ "additionalProperties": false
319
+ }
320
+ ]
321
+ }
322
+ }
323
+ },
324
+ "required": [
325
+ "manifestSchemaVersion",
326
+ "name"
327
+ ],
328
+ "additionalProperties": false
329
+ }
@@ -1,6 +1,6 @@
1
1
  import type { AgentBinding } from "../definition/binding.js";
2
2
  import type { AgentManifest } from "./manifest.js";
3
- /** An agent definition composed with Agent(...).use(...). Optional `.build()` is a no-op facade. */
3
+ /** An agent definition built with Agent(...). Optional `.build()` is a no-op facade. */
4
4
  export interface BuiltAgent<Info = unknown, Output = string> {
5
5
  readonly id: string;
6
6
  readonly name?: string;
@@ -1,11 +1,15 @@
1
1
  import type { JsonObject } from "./shared.js";
2
2
  import type { WorkflowManifest } from "./workflow.js";
3
3
  /**
4
- * Published manifest schema version (no top-level model — Runtime-owned). Version 6 (R2b C9) adds
5
- * an MCP server's `tools` and `deferred`; a manifest that uses neither stays version 5, so its
6
- * hash is unchanged, and the Runtime accepts both.
4
+ * Published manifest schema version (no top-level model — Runtime-owned). Version 7 is flat: the
5
+ * agent's instructions, tools, skills and MCP servers sit at the top level, with no capabilities.
7
6
  */
8
- export type ManifestSchemaVersion = 5 | 6;
7
+ export type ManifestSchemaVersion = 7;
8
+ /** Which Agent Plugin brought a skill or an MCP server: its `plugin.json` name and version. */
9
+ export interface PluginLabel {
10
+ readonly name: string;
11
+ readonly version?: string;
12
+ }
9
13
  /**
10
14
  * Whether each call waits for a person's approval, in a manifest saved before R5 step 2 (the
11
15
  * Tool Gate holds such a call). New definitions use the Tenant's tool policy instead.
@@ -61,6 +65,8 @@ export interface SkillManifest {
61
65
  * the Runtime holds and serves. `SKILL.md` is required.
62
66
  */
63
67
  readonly files: Readonly<Record<string, string>>;
68
+ /** The Agent Plugin that brought the skill. Absent: the agent's own. */
69
+ readonly plugin?: PluginLabel;
64
70
  }
65
71
  /**
66
72
  * One tool's settings on an MCP server (manifest v6, R2b C9). Each setting resolves from the
@@ -92,6 +98,8 @@ interface McpServerFields {
92
98
  * entry per wanted tool make an allowlist.
93
99
  */
94
100
  readonly tools?: Readonly<Record<string, McpToolSettings>>;
101
+ /** The Agent Plugin that brought the server. Absent: the agent's own. */
102
+ readonly plugin?: PluginLabel;
95
103
  }
96
104
  /** A remote MCP server, declared by URL. Nylorun accepts no stdio servers (`stdioMcpRefusal`). */
97
105
  export type McpServerManifest = (McpServerFields & {
@@ -122,21 +130,15 @@ export interface SandboxManifest {
122
130
  /** Stop compute after this long without use, e.g. "15m". Files persist. */
123
131
  readonly idle?: string;
124
132
  }
125
- export interface CapabilityManifest {
126
- readonly id: string;
127
- readonly type: "agent" | "agent-plugin";
128
- readonly name?: string;
129
- readonly description?: string;
130
- readonly metadata?: JsonObject;
131
- readonly instructions?: readonly string[];
132
- readonly skills?: Readonly<Record<string, SkillManifest>>;
133
- readonly tools?: readonly ToolManifest[];
134
- readonly mcpServers?: Readonly<Record<string, McpServerManifest>>;
135
- /** Present when this capability gives the agent a Runtime-owned sandbox. */
136
- readonly sandbox?: SandboxManifest;
137
- }
138
- /** Reserved. Empty until later fields are defined. Omit `runtime` while it has no fields. */
133
+ /**
134
+ * What the Runtime adds to a session's agent when it pins it: the session's sandbox, the tools the
135
+ * Runtime serves (the sandbox tools, the artifact tools, the skill tools) and the text that goes
136
+ * with them. Only the Runtime writes it; a definition or a turn variant that sets it is refused.
137
+ */
139
138
  export interface RuntimeManifest {
139
+ readonly sandbox?: SandboxManifest;
140
+ readonly tools?: readonly ToolManifest[];
141
+ readonly instructions?: readonly string[];
140
142
  }
141
143
  export interface AgentManifest {
142
144
  readonly manifestSchemaVersion: ManifestSchemaVersion;
@@ -145,7 +147,19 @@ export interface AgentManifest {
145
147
  readonly description?: string;
146
148
  readonly metadata?: JsonObject;
147
149
  readonly outputSchema?: JsonObject;
148
- readonly capabilities: readonly CapabilityManifest[];
150
+ readonly instructions?: readonly string[];
151
+ readonly tools?: readonly ToolManifest[];
152
+ readonly skills?: Readonly<Record<string, SkillManifest>>;
153
+ readonly mcpServers?: Readonly<Record<string, McpServerManifest>>;
154
+ /** What the agent needs of its session's Environment, checked when a session opens (D65). */
155
+ readonly requires?: AgentRequirements;
149
156
  readonly runtime?: RuntimeManifest;
150
157
  }
158
+ /** What an agent needs of the Environment its session opens on (protocol 14, D65). */
159
+ export interface AgentRequirements {
160
+ /** `any`: kind `virtual` or `pod`; `pod`: kind `pod`; `none`: nothing. */
161
+ readonly sandbox?: "none" | "any" | "pod";
162
+ /** Secret names (environment variables) its skills' scripts read, which the vault must hold. */
163
+ readonly secrets?: readonly string[];
164
+ }
151
165
  export {};
@@ -78,7 +78,7 @@ export interface ModelConfigurationMutationOptions {
78
78
  readonly reason?: string;
79
79
  }
80
80
  export interface ModelConfigurationContributor {
81
- readonly middlewareId: string;
81
+ readonly partId: string;
82
82
  readonly slot: string;
83
83
  readonly order: number;
84
84
  readonly reason?: string;
@@ -109,7 +109,7 @@ export interface ContextMutationOptions {
109
109
  readonly reason?: string;
110
110
  }
111
111
  export interface ContextContributor {
112
- readonly middlewareId: string;
112
+ readonly partId: string;
113
113
  readonly slot: string;
114
114
  readonly order: number;
115
115
  readonly reason?: string;
@@ -78,7 +78,7 @@ export interface ObserveSealedCall {
78
78
  readonly args: JsonValue;
79
79
  readonly invocationId: string;
80
80
  readonly owner: {
81
- readonly middlewareId: string;
81
+ readonly partId: string;
82
82
  readonly slot: string;
83
83
  };
84
84
  readonly interaction?: RequiredInteraction;
@@ -130,19 +130,6 @@ export type ObserveEvent = {
130
130
  readonly toolResults: readonly ToolResult[];
131
131
  readonly transcript: readonly TranscriptEntry[];
132
132
  };
133
- } | {
134
- readonly type: "middleware.entered" | "middleware.completed";
135
- readonly turnId: string;
136
- readonly stepId: string;
137
- readonly inputId?: string;
138
- readonly middlewareId: string;
139
- } | {
140
- readonly type: "middleware.lease-violation";
141
- readonly turnId: string;
142
- readonly stepId: string;
143
- readonly inputId?: string;
144
- readonly middlewareId: string;
145
- readonly reason: string;
146
133
  } | {
147
134
  readonly type: "tool.sealed";
148
135
  readonly turnId: string;
@@ -161,7 +148,7 @@ export type ObserveEvent = {
161
148
  readonly toolName: string;
162
149
  readonly callId: string;
163
150
  readonly invocationId: string;
164
- readonly middlewareId: string;
151
+ readonly partId: string;
165
152
  readonly slot: string;
166
153
  readonly attributes: {
167
154
  readonly args: JsonValue;
@@ -175,7 +162,7 @@ export type ObserveEvent = {
175
162
  readonly toolName: string;
176
163
  readonly callId: string;
177
164
  readonly invocationId: string;
178
- readonly middlewareId: string;
165
+ readonly partId: string;
179
166
  readonly slot: string;
180
167
  readonly attributes: {
181
168
  readonly message: string;
@@ -190,7 +177,7 @@ export type ObserveEvent = {
190
177
  readonly toolName: string;
191
178
  readonly callId: string;
192
179
  readonly invocationId: string;
193
- readonly middlewareId: string;
180
+ readonly partId: string;
194
181
  readonly slot: string;
195
182
  readonly outcome: string;
196
183
  readonly code?: string;
@@ -204,7 +191,7 @@ export type ObserveEvent = {
204
191
  readonly toolName: string;
205
192
  readonly callId: string;
206
193
  readonly invocationId: string;
207
- readonly middlewareId: string;
194
+ readonly partId: string;
208
195
  readonly slot: string;
209
196
  readonly attributes: {
210
197
  readonly token?: JsonValue;
@@ -0,0 +1,25 @@
1
+ import type { AgentTool } from "./agent.js";
2
+ import type { McpServerManifest, SkillManifest } from "./manifest.js";
3
+ import type { ToolDefinition } from "./tool.js";
4
+ /**
5
+ * The bytes of one skill file the manifest names (`SkillManifest.files`), held on the developer
6
+ * binding: the client uploads the files the Runtime lacks before it registers the agent. Not a
7
+ * manifest field.
8
+ */
9
+ export interface SkillFileSource {
10
+ readonly size: number;
11
+ read(): Promise<Uint8Array>;
12
+ }
13
+ /**
14
+ * @internal What one builder call, skills folder or plugin adds to an agent. The manifest holds
15
+ * the agent's parts merged: a plugin's skills and servers carry its `plugin` label.
16
+ */
17
+ export interface PartDeclaration<Info = unknown> {
18
+ readonly id: string;
19
+ readonly tools?: readonly (ToolDefinition<any, Info, any> | AgentTool)[];
20
+ readonly instructions?: readonly string[];
21
+ readonly skills?: Readonly<Record<string, SkillManifest>>;
22
+ /** Each skill file's bytes, by `sha256:<hex>`, for the client to upload. Not projected into the manifest. */
23
+ readonly skillFiles?: Readonly<Record<string, SkillFileSource>>;
24
+ readonly mcpServers?: Readonly<Record<string, McpServerManifest>>;
25
+ }
@@ -83,7 +83,7 @@ export interface ToolDefinition<InputSchema extends ToolInputSchema = ToolInputS
83
83
  /** A plain return value is treated as `{ kind: "completed", output }`. Legacy tagged outcomes remain valid. */
84
84
  export type ToolRunResult<Output = ToolContent> = Output | ToolOutcome<Output>;
85
85
  export interface ToolOwner {
86
- readonly middlewareId: string;
86
+ readonly partId: string;
87
87
  readonly slot: string;
88
88
  }
89
89
  export interface Interaction {
@@ -74,5 +74,10 @@ export interface TranscriptCompactionEntry {
74
74
  readonly trigger: "threshold" | "overflow";
75
75
  readonly tokensBefore: number;
76
76
  readonly tokensAfter: number;
77
+ /**
78
+ * The reference lines of the files the summarized part named (protocol 12), carried across
79
+ * compactions so the model can still read them with `read_artifact`.
80
+ */
81
+ readonly files?: readonly string[];
77
82
  }
78
83
  export type TranscriptEntry = TranscriptInputEntry | TranscriptCandidateEntry | TranscriptToolsEntry | TranscriptFinalEntry | TranscriptCompactionEntry;
@@ -1,8 +1,3 @@
1
- /**
2
- * Definition files (track R2 M4): the files a definition names by content hash, uploaded once
3
- * with `PUT /v1/files/sha256:<hex>` and held by the Runtime. Today they are the files of a
4
- * skill's folder (`SkillManifest.files`). Shared by the SDK, the wire schema and the Runtime.
5
- */
6
1
  /** The largest definition file the Runtime stores. */
7
2
  export declare const DEFINITION_FILE_MAX_BYTES: number;
8
3
  /** The most files one skill may have. */
@@ -11,8 +6,18 @@ export declare const SKILL_FILES_MAX = 500;
11
6
  export declare const SKILL_FILE_PATH_MAX = 512;
12
7
  /** The file every skill has: its frontmatter and instructions. */
13
8
  export declare const SKILL_ENTRY = "SKILL.md";
14
- /** Where a session's sandbox holds each skill's files, read-only: `/skills/<name>/`. */
9
+ /** Where a session's sandbox holds each skill's files, read-only: `/skills/<name>@<hash>/`. */
15
10
  export declare const SKILLS_MOUNT = "/skills";
11
+ /**
12
+ * The folder of a sandbox that holds one version of a skill, read-only (D66):
13
+ * `/skills/<name>@<12 hex>`, the hex from the SHA-256 of its canonical file map. A version keeps
14
+ * its folder and is never replaced, so sessions whose agents carry different versions of a skill
15
+ * share an Environment without changing each other's files.
16
+ */
17
+ export declare function skillFolderOf(skill: {
18
+ readonly name: string;
19
+ readonly files: Readonly<Record<string, string>>;
20
+ }): string;
16
21
  /** `sha256:<hex>`, the way a manifest names a definition file. */
17
22
  export declare function isDefinitionFileHash(value: unknown): value is string;
18
23
  /** Why `path` cannot name a file in a skill's folder, or undefined when it can. */
@@ -3,6 +3,9 @@
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
  */
6
+ import { sha256 } from "@noble/hashes/sha2.js";
7
+ import { bytesToHex, utf8ToBytes } from "@noble/hashes/utils.js";
8
+ import { canonical } from "./canonical.js";
6
9
  /** The largest definition file the Runtime stores. */
7
10
  export const DEFINITION_FILE_MAX_BYTES = 10 * 1024 * 1024;
8
11
  /** The most files one skill may have. */
@@ -11,8 +14,17 @@ export const SKILL_FILES_MAX = 500;
11
14
  export const SKILL_FILE_PATH_MAX = 512;
12
15
  /** The file every skill has: its frontmatter and instructions. */
13
16
  export const SKILL_ENTRY = "SKILL.md";
14
- /** Where a session's sandbox holds each skill's files, read-only: `/skills/<name>/`. */
17
+ /** Where a session's sandbox holds each skill's files, read-only: `/skills/<name>@<hash>/`. */
15
18
  export const SKILLS_MOUNT = "/skills";
19
+ /**
20
+ * The folder of a sandbox that holds one version of a skill, read-only (D66):
21
+ * `/skills/<name>@<12 hex>`, the hex from the SHA-256 of its canonical file map. A version keeps
22
+ * its folder and is never replaced, so sessions whose agents carry different versions of a skill
23
+ * share an Environment without changing each other's files.
24
+ */
25
+ export function skillFolderOf(skill) {
26
+ return `${SKILLS_MOUNT}/${skill.name}@${bytesToHex(sha256(utf8ToBytes(canonical(skill.files)))).slice(0, 12)}`;
27
+ }
16
28
  const FILE_HASH = /^sha256:[0-9a-f]{64}$/;
17
29
  /** `sha256:<hex>`, the way a manifest names a definition file. */
18
30
  export function isDefinitionFileHash(value) {
@@ -64,14 +76,12 @@ export function definitionFilesOf(document, into = new Set()) {
64
76
  definitionFilesOf(agent, into);
65
77
  return into;
66
78
  }
67
- for (const capability of value.capabilities ?? []) {
68
- for (const skill of Object.values(capability.skills ?? {}))
69
- for (const hash of Object.values(skill?.files ?? {}))
70
- if (isDefinitionFileHash(hash))
71
- into.add(hash);
72
- for (const tool of capability.tools ?? [])
73
- definitionFilesOf(tool.agent, into);
74
- }
79
+ for (const skill of Object.values(value.skills ?? {}))
80
+ for (const hash of Object.values(skill?.files ?? {}))
81
+ if (isDefinitionFileHash(hash))
82
+ into.add(hash);
83
+ for (const tool of value.tools ?? [])
84
+ definitionFilesOf(tool.agent, into);
75
85
  return into;
76
86
  }
77
87
  /**
@@ -0,0 +1,19 @@
1
+ /** Stores a sandbox file, or inline text, as a file artifact of the session (F8.1). */
2
+ 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
+ /**
14
+ * The tools the Runtime serves: the sandbox tools, the artifact tools, the skill tools and the
15
+ * deferred-tool pair. An agent's own tool may not take one of these names, so a tool's name alone
16
+ * says whose it is.
17
+ */
18
+ export declare const RUNTIME_TOOL_NAMES: ReadonlySet<string>;
19
+ export declare function isRuntimeToolName(name: string): boolean;