@nylorun/core 0.19.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 (98) hide show
  1. package/CHANGELOG.md +191 -0
  2. package/README.md +2 -2
  3. package/dist/compatibility.d.ts +148 -32
  4. package/dist/compatibility.js +154 -33
  5. package/dist/contracts.d.ts +2714 -495
  6. package/dist/contracts.js +1395 -493
  7. package/dist/define.d.ts +15 -12
  8. package/dist/define.js +11 -7
  9. package/dist/definition/approval.d.ts +16 -0
  10. package/dist/definition/approval.js +33 -0
  11. package/dist/definition/assemble.d.ts +6 -10
  12. package/dist/definition/assemble.js +48 -105
  13. package/dist/definition/bind-agent.d.ts +3 -4
  14. package/dist/definition/bind-agent.js +12 -30
  15. package/dist/definition/binding.d.ts +2 -2
  16. package/dist/definition/bound.d.ts +10 -10
  17. package/dist/definition/builder.d.ts +16 -20
  18. package/dist/definition/builder.js +29 -81
  19. package/dist/definition/code-tools.d.ts +4 -4
  20. package/dist/definition/code-tools.js +7 -22
  21. package/dist/definition/declaration.d.ts +4 -7
  22. package/dist/definition/declaration.js +29 -99
  23. package/dist/definition/{tools-capability.d.ts → deferred-tools.d.ts} +3 -13
  24. package/dist/definition/{tools-capability.js → deferred-tools.js} +2 -18
  25. package/dist/definition/delegate.d.ts +2 -4
  26. package/dist/definition/delegate.js +8 -10
  27. package/dist/definition/flow/compile.js +0 -2
  28. package/dist/definition/from.d.ts +7 -4
  29. package/dist/definition/from.js +72 -117
  30. package/dist/definition/helpers.d.ts +0 -7
  31. package/dist/definition/helpers.js +0 -5
  32. package/dist/definition/http-tool.d.ts +7 -4
  33. package/dist/definition/http-tool.js +6 -10
  34. package/dist/definition/implementations.d.ts +6 -8
  35. package/dist/definition/manifest.d.ts +11 -5
  36. package/dist/definition/manifest.js +27 -26
  37. package/dist/definition/mcp.d.ts +1 -52
  38. package/dist/definition/mcp.js +11 -60
  39. package/dist/definition/media-reference.d.ts +23 -0
  40. package/dist/definition/media-reference.js +26 -0
  41. package/dist/definition/removed.d.ts +3 -10
  42. package/dist/definition/removed.js +10 -17
  43. package/dist/definition/runtime-manifest.d.ts +30 -0
  44. package/dist/definition/runtime-manifest.js +132 -0
  45. package/dist/definition/sandbox-tools.d.ts +1 -1
  46. package/dist/definition/sandbox-tools.js +1 -1
  47. package/dist/definition/skill-tools.d.ts +13 -7
  48. package/dist/definition/skill-tools.js +23 -10
  49. package/dist/definition/trace.d.ts +18 -0
  50. package/dist/definition/trace.js +42 -0
  51. package/dist/definition/variant.d.ts +5 -4
  52. package/dist/definition/variant.js +23 -55
  53. package/dist/definition/workflow/runnable.js +1 -1
  54. package/dist/errors.d.ts +1 -1
  55. package/dist/harness-api/entries.d.ts +242 -0
  56. package/dist/harness-api/entries.js +118 -0
  57. package/dist/harness-api/gates.d.ts +167 -0
  58. package/dist/harness-api/gates.js +117 -0
  59. package/dist/harness-api/harness-api.schema.json +4975 -0
  60. package/dist/harness-api/index.d.ts +19 -3
  61. package/dist/harness-api/index.js +16 -3
  62. package/dist/harness-api/json-schema.d.ts +12 -0
  63. package/dist/harness-api/json-schema.js +61 -0
  64. package/dist/harness-api/mcp.d.ts +57 -0
  65. package/dist/harness-api/mcp.js +39 -0
  66. package/dist/harness-api/messages.d.ts +11 -5
  67. package/dist/harness-api/messages.js +5 -3
  68. package/dist/harness-api/schema.d.ts +346 -36
  69. package/dist/harness-api/schema.js +143 -22
  70. package/dist/harness-api/transport.d.ts +55 -0
  71. package/dist/harness-api/transport.js +61 -0
  72. package/dist/index.d.ts +1 -1
  73. package/dist/manifest-schemas.d.ts +6 -0
  74. package/dist/manifest-schemas.js +34 -0
  75. package/dist/schemas/agent-manifest.schema.json +897 -0
  76. package/dist/schemas/environment-manifest.schema.json +329 -0
  77. package/dist/types/agent.d.ts +1 -1
  78. package/dist/types/manifest.d.ts +48 -28
  79. package/dist/types/model.d.ts +2 -2
  80. package/dist/types/observe.d.ts +8 -20
  81. package/dist/types/part.d.ts +25 -0
  82. package/dist/types/tool.d.ts +1 -1
  83. package/dist/types/transcript.d.ts +5 -0
  84. package/dist/utils/definition-files.d.ts +11 -6
  85. package/dist/utils/definition-files.js +19 -9
  86. package/dist/utils/harness-id.d.ts +9 -0
  87. package/dist/utils/harness-id.js +11 -0
  88. package/dist/utils/runtime-tools.d.ts +19 -0
  89. package/dist/utils/runtime-tools.js +30 -0
  90. package/dist/utils/sandbox.d.ts +1 -1
  91. package/dist/utils/sandbox.js +1 -1
  92. package/package.json +11 -4
  93. package/dist/definition/capability.d.ts +0 -43
  94. package/dist/definition/capability.js +0 -82
  95. package/dist/definition/sandbox-capability.d.ts +0 -44
  96. package/dist/definition/sandbox-capability.js +0 -139
  97. package/dist/types/middleware.d.ts +0 -94
  98. /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,12 +1,19 @@
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.
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
+ }
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.
7
16
  */
8
- export type ManifestSchemaVersion = 5 | 6;
9
- /** Whether each call waits for a person's approval (`approve` on the session). Default `never`. */
10
17
  export type ApprovalMode = "never" | "always";
11
18
  /** The methods an HTTP tool may use: each sends the tool input as a JSON body. */
12
19
  export type HttpToolMethod = "POST" | "PUT" | "PATCH";
@@ -20,11 +27,10 @@ export interface HttpToolTarget {
20
27
  /** Default `POST`. */
21
28
  readonly method?: HttpToolMethod;
22
29
  /**
23
- * Adds a vault credential to each request, as for a remote MCP server: a credential in the
24
- * session's vaults bound to `url` (a `bearer` token or a `headers` map, sent to its `via` when
25
- * it has one, with its identity header), chosen by the session's credential selection with
26
- * this name (`credentialSelections[].serverName`) when several are. When the vaults hold none,
27
- * the call fails with `http.credential` and is not sent.
30
+ * Adds a vault credential to each request, as for a remote MCP server: the credential in the
31
+ * vault of the session's Environment bound to `url` (a `bearer` token or a `headers` map, sent
32
+ * to its `via` when it has one, with its identity header). This name labels it in coverage.
33
+ * When the vault holds none, the call fails with `http.credential` and is not sent.
28
34
  */
29
35
  readonly credential?: string;
30
36
  /** How long the service may take to answer. Default 60000, at most 300000. */
@@ -43,7 +49,11 @@ export interface ToolManifest {
43
49
  readonly agent?: AgentManifest | WorkflowManifest;
44
50
  /** Present when the Runtime runs this tool as an HTTP request. Never with `agent`. */
45
51
  readonly http?: HttpToolTarget;
46
- /** Each call of an HTTP tool waits for approval. */
52
+ /**
53
+ * @deprecated Removed in R5 step 2: the Runtime refuses a definition that sets it, and tool
54
+ * approvals are the Tenant's tool policy (`PUT /v1/tenant/tool-policy`). Read only from
55
+ * manifests saved before, which the Tool Gate still holds for approval.
56
+ */
47
57
  readonly approval?: ApprovalMode;
48
58
  }
49
59
  export interface SkillManifest {
@@ -55,6 +65,8 @@ export interface SkillManifest {
55
65
  * the Runtime holds and serves. `SKILL.md` is required.
56
66
  */
57
67
  readonly files: Readonly<Record<string, string>>;
68
+ /** The Agent Plugin that brought the skill. Absent: the agent's own. */
69
+ readonly plugin?: PluginLabel;
58
70
  }
59
71
  /**
60
72
  * One tool's settings on an MCP server (manifest v6, R2b C9). Each setting resolves from the
@@ -63,7 +75,7 @@ export interface SkillManifest {
63
75
  export interface McpToolSettings {
64
76
  /** `false`: the tool never reaches the model and cannot be called. Default `true`. */
65
77
  readonly enabled?: boolean;
66
- /** `always`: each call waits for approval. Default: the server's `approval`, else `never`. */
78
+ /** @deprecated Removed in R5 step 2, as `ToolManifest.approval`; read only from older manifests. */
67
79
  readonly approval?: ApprovalMode;
68
80
  /**
69
81
  * `true`: the tool leaves the model's tool list; the model finds it with `tool_search` and runs
@@ -76,7 +88,7 @@ interface McpServerFields {
76
88
  readonly name: string;
77
89
  readonly url: string;
78
90
  readonly headers?: Readonly<Record<string, string>>;
79
- /** Each call of every tool of the server waits for approval. */
91
+ /** @deprecated Removed in R5 step 2, as `ToolManifest.approval`; read only from older manifests. */
80
92
  readonly approval?: ApprovalMode;
81
93
  /** Defers every tool of the server, or none (manifest v6, R2b C10). Default: automatic. */
82
94
  readonly deferred?: boolean;
@@ -86,6 +98,8 @@ interface McpServerFields {
86
98
  * entry per wanted tool make an allowlist.
87
99
  */
88
100
  readonly tools?: Readonly<Record<string, McpToolSettings>>;
101
+ /** The Agent Plugin that brought the server. Absent: the agent's own. */
102
+ readonly plugin?: PluginLabel;
89
103
  }
90
104
  /** A remote MCP server, declared by URL. Nylorun accepts no stdio servers (`stdioMcpRefusal`). */
91
105
  export type McpServerManifest = (McpServerFields & {
@@ -116,21 +130,15 @@ export interface SandboxManifest {
116
130
  /** Stop compute after this long without use, e.g. "15m". Files persist. */
117
131
  readonly idle?: string;
118
132
  }
119
- export interface CapabilityManifest {
120
- readonly id: string;
121
- readonly type: "agent" | "agent-plugin";
122
- readonly name?: string;
123
- readonly description?: string;
124
- readonly metadata?: JsonObject;
125
- readonly instructions?: readonly string[];
126
- readonly skills?: Readonly<Record<string, SkillManifest>>;
127
- readonly tools?: readonly ToolManifest[];
128
- readonly mcpServers?: Readonly<Record<string, McpServerManifest>>;
129
- /** Present when this capability gives the agent a Runtime-owned sandbox. */
130
- readonly sandbox?: SandboxManifest;
131
- }
132
- /** 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
+ */
133
138
  export interface RuntimeManifest {
139
+ readonly sandbox?: SandboxManifest;
140
+ readonly tools?: readonly ToolManifest[];
141
+ readonly instructions?: readonly string[];
134
142
  }
135
143
  export interface AgentManifest {
136
144
  readonly manifestSchemaVersion: ManifestSchemaVersion;
@@ -139,7 +147,19 @@ export interface AgentManifest {
139
147
  readonly description?: string;
140
148
  readonly metadata?: JsonObject;
141
149
  readonly outputSchema?: JsonObject;
142
- 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;
143
156
  readonly runtime?: RuntimeManifest;
144
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
+ }
145
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;
@@ -12,8 +12,9 @@ export interface WorkflowErrorPayload {
12
12
  * LiveEvent payloads for workflow sessions (`workflows.md` §11, `loops.md` §4.6).
13
13
  *
14
14
  * @deprecated Use the event catalog (`EVENT_CATALOG`, `SessionEventOf<"node.agent">` in
15
- * `@nylorun/core/contracts`): it types the events the Runtime writes. `node.completed`,
16
- * `node.failed`, `switch.selected`, `map.items` and `loop.waiting` are not written.
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`,
17
+ * `switch.selected`, `map.items` and `loop.waiting` are not written.
17
18
  */
18
19
  export type WorkflowLiveEventPayload = {
19
20
  readonly type: "node.started";
@@ -77,7 +78,7 @@ export interface ObserveSealedCall {
77
78
  readonly args: JsonValue;
78
79
  readonly invocationId: string;
79
80
  readonly owner: {
80
- readonly middlewareId: string;
81
+ readonly partId: string;
81
82
  readonly slot: string;
82
83
  };
83
84
  readonly interaction?: RequiredInteraction;
@@ -129,19 +130,6 @@ export type ObserveEvent = {
129
130
  readonly toolResults: readonly ToolResult[];
130
131
  readonly transcript: readonly TranscriptEntry[];
131
132
  };
132
- } | {
133
- readonly type: "middleware.entered" | "middleware.completed";
134
- readonly turnId: string;
135
- readonly stepId: string;
136
- readonly inputId?: string;
137
- readonly middlewareId: string;
138
- } | {
139
- readonly type: "middleware.lease-violation";
140
- readonly turnId: string;
141
- readonly stepId: string;
142
- readonly inputId?: string;
143
- readonly middlewareId: string;
144
- readonly reason: string;
145
133
  } | {
146
134
  readonly type: "tool.sealed";
147
135
  readonly turnId: string;
@@ -160,7 +148,7 @@ export type ObserveEvent = {
160
148
  readonly toolName: string;
161
149
  readonly callId: string;
162
150
  readonly invocationId: string;
163
- readonly middlewareId: string;
151
+ readonly partId: string;
164
152
  readonly slot: string;
165
153
  readonly attributes: {
166
154
  readonly args: JsonValue;
@@ -174,7 +162,7 @@ export type ObserveEvent = {
174
162
  readonly toolName: string;
175
163
  readonly callId: string;
176
164
  readonly invocationId: string;
177
- readonly middlewareId: string;
165
+ readonly partId: string;
178
166
  readonly slot: string;
179
167
  readonly attributes: {
180
168
  readonly message: string;
@@ -189,7 +177,7 @@ export type ObserveEvent = {
189
177
  readonly toolName: string;
190
178
  readonly callId: string;
191
179
  readonly invocationId: string;
192
- readonly middlewareId: string;
180
+ readonly partId: string;
193
181
  readonly slot: string;
194
182
  readonly outcome: string;
195
183
  readonly code?: string;
@@ -203,7 +191,7 @@ export type ObserveEvent = {
203
191
  readonly toolName: string;
204
192
  readonly callId: string;
205
193
  readonly invocationId: string;
206
- readonly middlewareId: string;
194
+ readonly partId: string;
207
195
  readonly slot: string;
208
196
  readonly attributes: {
209
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. */