@nylorun/core 0.53.0-beta → 0.55.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 (81) hide show
  1. package/CHANGELOG.md +126 -99
  2. package/dist/compatibility.d.ts +39 -12
  3. package/dist/compatibility.js +37 -10
  4. package/dist/contracts.d.ts +126 -44
  5. package/dist/contracts.js +127 -69
  6. package/dist/define.d.ts +2 -2
  7. package/dist/define.js +1 -1
  8. package/dist/definition/bound.d.ts +3 -1
  9. package/dist/definition/declaration.js +1 -0
  10. package/dist/definition/delegate.d.ts +7 -4
  11. package/dist/definition/delegate.js +4 -3
  12. package/dist/definition/from.js +3 -1
  13. package/dist/definition/manifest.js +7 -1
  14. package/dist/definition/sections.d.ts +9 -8
  15. package/dist/definition/sections.js +13 -5
  16. package/dist/definition/variant.d.ts +2 -2
  17. package/dist/definition/variant.js +4 -4
  18. package/dist/definition/workflow/runnable.d.ts +1 -1
  19. package/dist/definition/workflow/runnable.js +1 -1
  20. package/dist/definition/workflow/verdict.d.ts +1 -1
  21. package/dist/definition/workflow/verdict.js +1 -1
  22. package/dist/engine/blocks.d.ts +2 -2
  23. package/dist/engine/blocks.js +3 -3
  24. package/dist/engine/explain.d.ts +1 -1
  25. package/dist/engine/explain.js +3 -3
  26. package/dist/engine/features.d.ts +1 -1
  27. package/dist/engine/features.js +1 -1
  28. package/dist/engine/index.d.ts +1 -1
  29. package/dist/engine/index.js +1 -1
  30. package/dist/engine/mcp.d.ts +4 -4
  31. package/dist/engine/mcp.js +4 -4
  32. package/dist/engine/names.d.ts +1 -1
  33. package/dist/engine/names.js +1 -1
  34. package/dist/engine/preview.d.ts +2 -2
  35. package/dist/engine/preview.js +1 -1
  36. package/dist/engine/projection.d.ts +3 -3
  37. package/dist/engine/projection.js +8 -8
  38. package/dist/engine/tools.d.ts +8 -8
  39. package/dist/engine/tools.js +7 -7
  40. package/dist/errors.d.ts +1 -1
  41. package/dist/folder/compile.d.ts +1 -1
  42. package/dist/folder/compile.js +23 -14
  43. package/dist/folder/decompile.js +7 -7
  44. package/dist/folder/engine.d.ts +3 -3
  45. package/dist/folder/engine.js +3 -3
  46. package/dist/folder/fix.js +1 -1
  47. package/dist/folder/flow.d.ts +1 -1
  48. package/dist/folder/flow.js +1 -1
  49. package/dist/folder/index.d.ts +2 -2
  50. package/dist/folder/index.js +2 -2
  51. package/dist/folder/migrate-v3.js +2 -2
  52. package/dist/folder/migrate-v4.js +1 -1
  53. package/dist/folder/nested.js +9 -6
  54. package/dist/folder/plugins.d.ts +13 -1
  55. package/dist/folder/plugins.js +49 -12
  56. package/dist/folder/schemas.js +7 -7
  57. package/dist/folder/subagent-files.d.ts +9 -5
  58. package/dist/folder/subagent-files.js +96 -22
  59. package/dist/folder/v3.d.ts +2 -2
  60. package/dist/folder/v3.js +2 -2
  61. package/dist/harness-api/artifacts.d.ts +1 -1
  62. package/dist/harness-api/json-schema.js +6 -6
  63. package/dist/harness-api/messages.d.ts +1 -1
  64. package/dist/harness-api/messages.js +1 -1
  65. package/dist/harness-api/schema.d.ts +2 -2
  66. package/dist/harness-api/schema.js +8 -8
  67. package/dist/manifest-schemas.js +9 -6
  68. package/dist/plugins/index.js +1 -1
  69. package/dist/schemas/agent-manifest.schema.json +65 -2
  70. package/dist/schemas/harness-manifest.schema.json +55 -2
  71. package/dist/types/manifest.d.ts +32 -7
  72. package/dist/types/model.d.ts +3 -3
  73. package/dist/types/observe.d.ts +1 -1
  74. package/dist/types/part.d.ts +5 -3
  75. package/dist/types/transcript.d.ts +1 -1
  76. package/dist/utils/definition-files.d.ts +23 -0
  77. package/dist/utils/definition-files.js +50 -4
  78. package/dist/utils/memory.js +1 -1
  79. package/dist/utils/runtime-limits.d.ts +2 -2
  80. package/dist/utils/runtime-limits.js +3 -3
  81. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://docs.nylorun.com/schemas/agent-manifest/v8.5.json",
3
+ "$id": "https://docs.nylorun.com/schemas/agent-manifest/v8.7.json",
4
4
  "title": "Nylorun agent manifest 8",
5
5
  "type": "object",
6
6
  "properties": {
@@ -90,6 +90,10 @@
90
90
  "plugin": {
91
91
  "$ref": "#/$defs/PluginLabel"
92
92
  },
93
+ "disableModelInvocation": {
94
+ "type": "boolean",
95
+ "const": true
96
+ },
93
97
  "secrets": {
94
98
  "type": "array",
95
99
  "items": {
@@ -851,6 +855,9 @@
851
855
  "always"
852
856
  ]
853
857
  },
858
+ "plugin": {
859
+ "$ref": "#/$defs/PluginLabel"
860
+ },
854
861
  "fn": {
855
862
  "description": "Reserved for a later kind of tool; refused for now."
856
863
  },
@@ -940,6 +947,10 @@
940
947
  },
941
948
  "plugin": {
942
949
  "$ref": "#/$defs/PluginLabel"
950
+ },
951
+ "disableModelInvocation": {
952
+ "type": "boolean",
953
+ "const": true
943
954
  }
944
955
  },
945
956
  "required": [
@@ -1070,6 +1081,12 @@
1070
1081
  ]
1071
1082
  }
1072
1083
  },
1084
+ "plugins": {
1085
+ "type": "array",
1086
+ "items": {
1087
+ "$ref": "#/$defs/PluginManifest"
1088
+ }
1089
+ },
1073
1090
  "requires": {
1074
1091
  "type": "object",
1075
1092
  "properties": {
@@ -1281,6 +1298,10 @@
1281
1298
  },
1282
1299
  "plugin": {
1283
1300
  "$ref": "#/$defs/PluginLabel"
1301
+ },
1302
+ "disableModelInvocation": {
1303
+ "type": "boolean",
1304
+ "const": true
1284
1305
  }
1285
1306
  },
1286
1307
  "required": [
@@ -1411,6 +1432,12 @@
1411
1432
  ]
1412
1433
  }
1413
1434
  },
1435
+ "plugins": {
1436
+ "type": "array",
1437
+ "items": {
1438
+ "$ref": "#/$defs/PluginManifest"
1439
+ }
1440
+ },
1414
1441
  "requires": {
1415
1442
  "type": "object",
1416
1443
  "properties": {
@@ -1776,6 +1803,32 @@
1776
1803
  },
1777
1804
  "additionalProperties": false
1778
1805
  },
1806
+ "PluginManifest": {
1807
+ "type": "object",
1808
+ "properties": {
1809
+ "name": {
1810
+ "type": "string",
1811
+ "minLength": 1
1812
+ },
1813
+ "version": {
1814
+ "type": "string",
1815
+ "minLength": 1
1816
+ },
1817
+ "files": {
1818
+ "type": "object",
1819
+ "propertyNames": {
1820
+ "type": "string"
1821
+ },
1822
+ "additionalProperties": {
1823
+ "type": "string"
1824
+ }
1825
+ }
1826
+ },
1827
+ "required": [
1828
+ "name"
1829
+ ],
1830
+ "additionalProperties": false
1831
+ },
1779
1832
  "HarnessEngine": {
1780
1833
  "type": "object",
1781
1834
  "properties": {
@@ -1890,7 +1943,7 @@
1890
1943
  }
1891
1944
  },
1892
1945
  "plugins": {
1893
- "description": "The Runtime's plugins the agent declares (agent-folder/3, ADR-106): each with the tools left on and the hash of its files",
1946
+ "description": "The Runtime's plugins the agent declares (agent-folder/3): each with the tools left on and the hash of its files",
1894
1947
  "type": "array",
1895
1948
  "items": {
1896
1949
  "type": "object",
@@ -2047,6 +2100,10 @@
2047
2100
  },
2048
2101
  "plugin": {
2049
2102
  "$ref": "#/$defs/PluginLabel"
2103
+ },
2104
+ "disableModelInvocation": {
2105
+ "type": "boolean",
2106
+ "const": true
2050
2107
  }
2051
2108
  },
2052
2109
  "required": [
@@ -2177,6 +2234,12 @@
2177
2234
  ]
2178
2235
  }
2179
2236
  },
2237
+ "plugins": {
2238
+ "type": "array",
2239
+ "items": {
2240
+ "$ref": "#/$defs/PluginManifest"
2241
+ }
2242
+ },
2180
2243
  "requires": {
2181
2244
  "type": "object",
2182
2245
  "properties": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://docs.nylorun.com/schemas/harness-manifest/v1.5.json",
3
+ "$id": "https://docs.nylorun.com/schemas/harness-manifest/v1.7.json",
4
4
  "title": "Nylorun harness manifest 1",
5
5
  "type": "object",
6
6
  "properties": {
@@ -59,6 +59,10 @@
59
59
  "plugin": {
60
60
  "$ref": "#/$defs/PluginLabel"
61
61
  },
62
+ "disableModelInvocation": {
63
+ "type": "boolean",
64
+ "const": true
65
+ },
62
66
  "secrets": {
63
67
  "type": "array",
64
68
  "items": {
@@ -378,6 +382,9 @@
378
382
  "always"
379
383
  ]
380
384
  },
385
+ "plugin": {
386
+ "$ref": "#/$defs/PluginLabel"
387
+ },
381
388
  "fn": {
382
389
  "description": "Reserved for a later kind of tool; refused for now."
383
390
  },
@@ -467,6 +474,10 @@
467
474
  },
468
475
  "plugin": {
469
476
  "$ref": "#/$defs/PluginLabel"
477
+ },
478
+ "disableModelInvocation": {
479
+ "type": "boolean",
480
+ "const": true
470
481
  }
471
482
  },
472
483
  "required": [
@@ -597,6 +608,12 @@
597
608
  ]
598
609
  }
599
610
  },
611
+ "plugins": {
612
+ "type": "array",
613
+ "items": {
614
+ "$ref": "#/$defs/PluginManifest"
615
+ }
616
+ },
600
617
  "requires": {
601
618
  "type": "object",
602
619
  "properties": {
@@ -808,6 +825,10 @@
808
825
  },
809
826
  "plugin": {
810
827
  "$ref": "#/$defs/PluginLabel"
828
+ },
829
+ "disableModelInvocation": {
830
+ "type": "boolean",
831
+ "const": true
811
832
  }
812
833
  },
813
834
  "required": [
@@ -938,6 +959,12 @@
938
959
  ]
939
960
  }
940
961
  },
962
+ "plugins": {
963
+ "type": "array",
964
+ "items": {
965
+ "$ref": "#/$defs/PluginManifest"
966
+ }
967
+ },
941
968
  "requires": {
942
969
  "type": "object",
943
970
  "properties": {
@@ -1303,6 +1330,32 @@
1303
1330
  },
1304
1331
  "additionalProperties": false
1305
1332
  },
1333
+ "PluginManifest": {
1334
+ "type": "object",
1335
+ "properties": {
1336
+ "name": {
1337
+ "type": "string",
1338
+ "minLength": 1
1339
+ },
1340
+ "version": {
1341
+ "type": "string",
1342
+ "minLength": 1
1343
+ },
1344
+ "files": {
1345
+ "type": "object",
1346
+ "propertyNames": {
1347
+ "type": "string"
1348
+ },
1349
+ "additionalProperties": {
1350
+ "type": "string"
1351
+ }
1352
+ }
1353
+ },
1354
+ "required": [
1355
+ "name"
1356
+ ],
1357
+ "additionalProperties": false
1358
+ },
1306
1359
  "HarnessEngine": {
1307
1360
  "type": "object",
1308
1361
  "properties": {
@@ -1417,7 +1470,7 @@
1417
1470
  }
1418
1471
  },
1419
1472
  "plugins": {
1420
- "description": "The Runtime's plugins the agent declares (agent-folder/3, ADR-106): each with the tools left on and the hash of its files",
1473
+ "description": "The Runtime's plugins the agent declares (agent-folder/3): each with the tools left on and the hash of its files",
1421
1474
  "type": "array",
1422
1475
  "items": {
1423
1476
  "type": "object",
@@ -11,6 +11,15 @@ export interface PluginLabel {
11
11
  readonly name: string;
12
12
  readonly version?: string;
13
13
  }
14
+ /**
15
+ * An Agent Plugin an agent was composed with. `files` is set when the plugin holds files beyond the
16
+ * parts the manifest carries (its skills, servers and subagent files): then every file of the
17
+ * plugin but secret-shaped ones, by path, as `sha256:<hex>`, mounted read-only in the sandbox at
18
+ * `/plugins/<name>@<hash>/` (`pluginFolderOf`).
19
+ */
20
+ export interface PluginManifest extends PluginLabel {
21
+ readonly files?: Readonly<Record<string, string>>;
22
+ }
14
23
  /**
15
24
  * Whether each call waits for a person's approval, in a manifest saved before the Tenant's tool
16
25
  * policy (the Tool Gate holds such a call). New definitions use the Tenant's tool policy instead.
@@ -61,6 +70,11 @@ export interface ToolManifest {
61
70
  * agent (workflow manifest v3) runs in its own linked session on the Runtime.
62
71
  */
63
72
  readonly agent?: AgentManifest | WorkflowManifest;
73
+ /**
74
+ * The Agent Plugin an agent used as a tool came from, as a plugin's skills and MCP servers are
75
+ * labelled: only with `agent`. Shown by `nylorun check` and Studio; the run ignores it.
76
+ */
77
+ readonly plugin?: PluginLabel;
64
78
  /** Present when the Runtime runs this tool as an HTTP request. Never with `agent`. */
65
79
  readonly http?: HttpToolTarget;
66
80
  /**
@@ -73,6 +87,12 @@ export interface ToolManifest {
73
87
  export interface SkillManifest {
74
88
  readonly name: string;
75
89
  readonly description: string;
90
+ /**
91
+ * Only a person starts this skill (`SKILL.md`'s `disable-model-invocation: true`): the model's
92
+ * catalog and `load_skill` leave it out unless the turn's message names it (`skill`), and an
93
+ * agent used as a tool never gets it. Absent means the model may load it.
94
+ */
95
+ readonly disableModelInvocation?: true;
76
96
  /**
77
97
  * Every file of the skill's folder, by its path in the folder (`/`-separated, e.g.
78
98
  * `SKILL.md`, `scripts/run.py`, `assets/logo.png`), as `sha256:<hex>`: the definition files
@@ -156,10 +176,12 @@ export interface AgentManifest {
156
176
  readonly tools?: readonly ToolManifest[];
157
177
  readonly skills?: Readonly<Record<string, SkillManifest>>;
158
178
  readonly mcpServers?: Readonly<Record<string, McpServerManifest>>;
179
+ /** The Agent Plugins whose files are mounted in the sandbox: each with its `files`. */
180
+ readonly plugins?: readonly PluginManifest[];
159
181
  /** What the agent needs of its session's Environment, checked when a session opens. */
160
182
  readonly requires?: AgentRequirements;
161
183
  /**
162
- * The engine features the agent declares (ADR-100, `agent-folder/2`): with it, our engine adds
184
+ * The engine features the agent declares (`agent-folder/2`): with it, our engine adds
163
185
  * only what it names; without it, every default of `agent-folder/1`.
164
186
  */
165
187
  readonly engine?: HarnessEngine;
@@ -167,7 +189,7 @@ export interface AgentManifest {
167
189
  /** A sandbox tool our engine may offer: `bash`, `read`, `write`, `edit`, `grep` or `glob`. */
168
190
  export type EngineSandboxTool = "bash" | "read" | "write" | "edit" | "grep" | "glob";
169
191
  /**
170
- * The engine features an agent declares (ADR-100): `harness.engine` of an agent manifest v8,
192
+ * The engine features an agent declares: `harness.engine` of an agent manifest v8,
171
193
  * `engine` of the loop manifest the harness runs. Its presence turns the defaults off: an agent
172
194
  * with it gets no engine tool and no engine text it does not name. Memory, skills, `loop` and
173
195
  * `runtime.selfWake` stay declared by their own keys.
@@ -184,14 +206,14 @@ export interface HarnessEngine {
184
206
  readonly outputs?: boolean;
185
207
  /** MCP tools deferred behind `tool_search` when their schemas pass the threshold. */
186
208
  readonly toolSearch?: boolean;
187
- /** The `triggers` tool and its text (D83): the root agent sets up its own triggers. */
209
+ /** The `triggers` tool and its text: the root agent sets up its own triggers. */
188
210
  readonly triggers?: boolean;
189
211
  /** A block's wording replaced by the folder's text, by block name. */
190
212
  readonly instructions?: Readonly<Partial<Record<EngineBlockName, string>>>;
191
213
  /** The engine text blocks the agent gets, each with its version and the hash of its text. */
192
214
  readonly blocks?: readonly EngineBlockRef[];
193
215
  /**
194
- * The Runtime's plugins the agent declares (`agent-folder/3`, ADR-106), each with the tools left
216
+ * The Runtime's plugins the agent declares (`agent-folder/3`), each with the tools left
195
217
  * on and the hash of its files. With it, the engine presents its tools as the server `nylorun`.
196
218
  */
197
219
  readonly plugins?: readonly HarnessEnginePlugin[];
@@ -250,8 +272,11 @@ export interface AgentHarnessSection {
250
272
  readonly tools?: readonly ToolManifest[];
251
273
  readonly skills?: Readonly<Record<string, HarnessSkill>>;
252
274
  readonly mcpServers?: Readonly<Record<string, HarnessMcpServer>>;
253
- /** The Agent Plugins folded into it when it was composed, so a version records what built it. */
254
- readonly plugins?: readonly PluginLabel[];
275
+ /**
276
+ * The Agent Plugins folded into it when it was composed, so a version records what built it; one
277
+ * with `files` is mounted in the sandbox.
278
+ */
279
+ readonly plugins?: readonly PluginManifest[];
255
280
  readonly outputSchema?: JsonObject;
256
281
  /** The harness's own settings: passed to it in `turn.start`, never read by the Runtime. */
257
282
  readonly loop?: JsonObject;
@@ -267,7 +292,7 @@ export interface AgentHarnessSection {
267
292
  * feature `model-roles`): a session opened with `role` runs on that role's model.
268
293
  */
269
294
  readonly roles?: Readonly<Record<string, string>>;
270
- /** The engine features the agent declares (ADR-100), for itself; its subagents declare their own. */
295
+ /** The engine features the agent declares, for itself; its subagents declare their own. */
271
296
  readonly engine?: HarnessEngine;
272
297
  }
273
298
  /**
@@ -48,7 +48,7 @@ export interface ModelCandidate {
48
48
  readonly usage?: ModelUsage;
49
49
  readonly evidence?: ModelEvidence;
50
50
  }
51
- /** Why a model call failed in a known way (Model Calls §6.1). */
51
+ /** Why a model call failed in a known way. */
52
52
  export type ModelFailureCode = "context_overflow" | "rate_limited" | "overloaded" | "timeout" | "transient" | "content_policy" | "auth" | "invalid_request" | "invalid_output"
53
53
  /**
54
54
  * The call holds a part the model or its provider API cannot take (protocol 15): a file kind
@@ -173,7 +173,7 @@ export type PromptContentPart = {
173
173
  readonly name: string;
174
174
  readonly args: JsonObject;
175
175
  };
176
- /** The provider, API and model that produced an assistant message (Model Calls §12). */
176
+ /** The provider, API and model that produced an assistant message. */
177
177
  export interface ModelProducer {
178
178
  readonly provider: string;
179
179
  readonly api?: string;
@@ -216,7 +216,7 @@ export interface ModelAdapterContext {
216
216
  readonly invocationId: string;
217
217
  readonly signal: AbortSignal;
218
218
  /**
219
- * Set when the engine calls the model to summarize history (Model Calls §8). Engine-internal:
219
+ * Set when the engine calls the model to summarize history. Engine-internal:
220
220
  * the call's effect says `purpose: "summary"`, and the compaction's facts go with its
221
221
  * transcript edit.
222
222
  */
@@ -9,7 +9,7 @@ export interface WorkflowErrorPayload {
9
9
  readonly path?: string;
10
10
  }
11
11
  /**
12
- * LiveEvent payloads for workflow sessions (`workflows.md` §11, `loops.md` §4.6).
12
+ * LiveEvent payloads for workflow sessions.
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
@@ -1,5 +1,5 @@
1
1
  import type { AgentTool } from "./agent.js";
2
- import type { McpServerManifest, SkillManifest } from "./manifest.js";
2
+ import type { McpServerManifest, PluginManifest, SkillManifest } from "./manifest.js";
3
3
  import type { ToolDefinition } from "./tool.js";
4
4
  /**
5
5
  * The bytes of one skill file the manifest names (`SkillManifest.files`), held on the developer
@@ -10,8 +10,8 @@ export interface SkillFileSource {
10
10
  readonly size: number;
11
11
  read(): Promise<Uint8Array>;
12
12
  /**
13
- * The bytes as a stream, for a file too large to hold in memory (an org's skill of a gigabyte,
14
- * ADR-93). When present, the client's upload sends it instead of `read()`'s bytes. Each call
13
+ * The bytes as a stream, for a file too large to hold in memory (an org's skill of a gigabyte).
14
+ * When present, the client's upload sends it instead of `read()`'s bytes. Each call
15
15
  * opens a new stream.
16
16
  */
17
17
  stream?(): ReadableStream<Uint8Array>;
@@ -33,4 +33,6 @@ export interface PartDeclaration<Info = unknown> {
33
33
  */
34
34
  readonly skillSecrets?: Readonly<Record<string, readonly string[]>>;
35
35
  readonly mcpServers?: Readonly<Record<string, McpServerManifest>>;
36
+ /** Agent Plugins mounted whole, with their `files`; the files' bytes are in `skillFiles`. */
37
+ readonly plugins?: readonly PluginManifest[];
36
38
  }
@@ -63,7 +63,7 @@ export interface TranscriptFinalEntry {
63
63
  readonly output: JsonValue;
64
64
  }
65
65
  /**
66
- * A summary that replaced the older part of the transcript (Model Calls §8). It is always
66
+ * A summary that replaced the older part of the transcript. It is always
67
67
  * the first entry; the entries after it are the kept tail, sent verbatim.
68
68
  */
69
69
  export interface TranscriptCompactionEntry {
@@ -25,10 +25,24 @@ export declare function skillFolderOf(skill: {
25
25
  readonly name: string;
26
26
  readonly files: Readonly<Record<string, string>>;
27
27
  }): string;
28
+ /** Where a session's sandbox holds each mounted Agent Plugin's files, read-only: `/plugins/<name>@<hash>/`. */
29
+ export declare const PLUGINS_MOUNT = "/plugins";
30
+ /** The longest path of a file in a mounted plugin's folder, as `SKILL_FILE_PATH_MAX` is a skill's. */
31
+ export declare const PLUGIN_FILE_PATH_MAX: number;
32
+ /**
33
+ * The folder of a sandbox that holds one version of an Agent Plugin's files, read-only:
34
+ * `/plugins/<name>@<12 hex>`, the hex from the SHA-256 of its canonical file map, as `skillFolderOf`.
35
+ */
36
+ export declare function pluginFolderOf(plugin: {
37
+ readonly name: string;
38
+ readonly files: Readonly<Record<string, string>>;
39
+ }): string;
28
40
  /** `sha256:<hex>`, the way a manifest names a definition file. */
29
41
  export declare function isDefinitionFileHash(value: unknown): value is string;
30
42
  /** Why `path` cannot name a file in a skill's folder, or undefined when it can. */
31
43
  export declare function skillFilePathIssue(path: string): string | undefined;
44
+ /** Why `files` is not a mounted plugin's file map, or undefined when it is. */
45
+ export declare function pluginFilesIssue(files: unknown): string | undefined;
32
46
  /** Why `files` is not a skill's file map, or undefined when it is. */
33
47
  export declare function skillFilesIssue(files: unknown): string | undefined;
34
48
  /**
@@ -36,6 +50,15 @@ export declare function skillFilesIssue(files: unknown): string | undefined;
36
50
  * agents it uses as tools, and those of a flow's agents, as `sha256:<hex>`.
37
51
  */
38
52
  export declare function definitionFilesOf(document: unknown, into?: Set<string>): Set<string>;
53
+ /**
54
+ * Every Agent Plugin a definition document mounts whole (a loop manifest's `plugins` with
55
+ * `files`): its agents', those of the agents it uses as tools, and those of a flow's agents. A
56
+ * plugin two agents carry comes once for each.
57
+ */
58
+ export declare function mountedPluginsOf(document: unknown): Generator<{
59
+ readonly name?: unknown;
60
+ readonly files?: Readonly<Record<string, unknown>>;
61
+ }>;
39
62
  /**
40
63
  * Every skill a definition document carries, as written: its agents' skills, those of the agents
41
64
  * it uses as tools, and those of a flow's agents. A skill two agents carry comes once for each.
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * Definition files: 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.
3
+ * with `PUT /v1/files/sha256:<hex>` and held by the Runtime: the files of a skill's folder
4
+ * (`SkillManifest.files`), and those of an Agent Plugin mounted whole (`PluginManifest.files`).
5
+ * Shared by the SDK, the wire schema and the Runtime.
5
6
  */
6
7
  import { sha256 } from "@noble/hashes/sha2.js";
7
8
  import { bytesToHex, utf8ToBytes } from "@noble/hashes/utils.js";
@@ -33,6 +34,17 @@ export const SKILL_FILE_PATH_MAX = FILE_PATH_MAX - `${SKILLS_MOUNT}/${"n".repeat
33
34
  export function skillFolderOf(skill) {
34
35
  return `${SKILLS_MOUNT}/${skill.name}@${bytesToHex(sha256(utf8ToBytes(canonical(skill.files)))).slice(0, 12)}`;
35
36
  }
37
+ /** Where a session's sandbox holds each mounted Agent Plugin's files, read-only: `/plugins/<name>@<hash>/`. */
38
+ export const PLUGINS_MOUNT = "/plugins";
39
+ /** The longest path of a file in a mounted plugin's folder, as `SKILL_FILE_PATH_MAX` is a skill's. */
40
+ export const PLUGIN_FILE_PATH_MAX = FILE_PATH_MAX - `${PLUGINS_MOUNT}/${"n".repeat(FILE_NAME_MAX)}@${"0".repeat(12)}/`.length;
41
+ /**
42
+ * The folder of a sandbox that holds one version of an Agent Plugin's files, read-only:
43
+ * `/plugins/<name>@<12 hex>`, the hex from the SHA-256 of its canonical file map, as `skillFolderOf`.
44
+ */
45
+ export function pluginFolderOf(plugin) {
46
+ return `${PLUGINS_MOUNT}/${plugin.name}@${bytesToHex(sha256(utf8ToBytes(canonical(plugin.files)))).slice(0, 12)}`;
47
+ }
36
48
  const FILE_HASH = /^sha256:[0-9a-f]{64}$/;
37
49
  /** `sha256:<hex>`, the way a manifest names a definition file. */
38
50
  export function isDefinitionFileHash(value) {
@@ -53,6 +65,19 @@ export function skillFilePathIssue(path) {
53
65
  return "must not have empty, . or .. segments";
54
66
  return undefined;
55
67
  }
68
+ /** Why `files` is not a mounted plugin's file map, or undefined when it is. */
69
+ export function pluginFilesIssue(files) {
70
+ if (!files || typeof files !== "object" || Array.isArray(files))
71
+ return `files must map each path in the plugin's folder to sha256:<hex>`;
72
+ for (const [path, hash] of Object.entries(files)) {
73
+ const issue = path.length > PLUGIN_FILE_PATH_MAX ? `must be 1 to ${PLUGIN_FILE_PATH_MAX} characters` : skillFilePathIssue(path)?.replace("the skill's folder", "the plugin's folder");
74
+ if (issue)
75
+ return `file path ${JSON.stringify(path.slice(0, FILE_PATH_MAX))} ${issue}`;
76
+ if (!isDefinitionFileHash(hash))
77
+ return `file ${JSON.stringify(path)} must name its content as sha256:<64 lowercase hex>`;
78
+ }
79
+ return undefined;
80
+ }
56
81
  /** Why `files` is not a skill's file map, or undefined when it is. */
57
82
  export function skillFilesIssue(files) {
58
83
  if (!files || typeof files !== "object" || Array.isArray(files))
@@ -74,12 +99,33 @@ export function skillFilesIssue(files) {
74
99
  * agents it uses as tools, and those of a flow's agents, as `sha256:<hex>`.
75
100
  */
76
101
  export function definitionFilesOf(document, into = new Set()) {
77
- for (const skill of skillsOf(document))
78
- for (const hash of Object.values(skill.files ?? {}))
102
+ for (const owner of [...skillsOf(document), ...mountedPluginsOf(document)])
103
+ for (const hash of Object.values(owner.files ?? {}))
79
104
  if (isDefinitionFileHash(hash))
80
105
  into.add(hash);
81
106
  return into;
82
107
  }
108
+ /**
109
+ * Every Agent Plugin a definition document mounts whole (a loop manifest's `plugins` with
110
+ * `files`): its agents', those of the agents it uses as tools, and those of a flow's agents. A
111
+ * plugin two agents carry comes once for each.
112
+ */
113
+ export function* mountedPluginsOf(document) {
114
+ if (!document || typeof document !== "object")
115
+ return;
116
+ const value = document;
117
+ if (value.kind === "workflow") {
118
+ for (const agent of Object.values(value.agents ?? {}))
119
+ yield* mountedPluginsOf(agent);
120
+ return;
121
+ }
122
+ if (Array.isArray(value.plugins))
123
+ for (const plugin of value.plugins)
124
+ if (plugin?.files)
125
+ yield plugin;
126
+ for (const tool of value.tools ?? [])
127
+ yield* mountedPluginsOf(tool.agent);
128
+ }
83
129
  /**
84
130
  * Every skill a definition document carries, as written: its agents' skills, those of the agents
85
131
  * it uses as tools, and those of a flow's agents. A skill two agents carry comes once for each.
@@ -20,7 +20,7 @@ export const MEMORY_DESCRIPTION_MAX = 200;
20
20
  export const MEMORY_ACCESS = ["read_write", "read_only"];
21
21
  /** What changed a memory, as a version records it. */
22
22
  export const MEMORY_OPERATIONS = ["create", "str_replace", "insert", "delete", "rename"];
23
- // Control characters (C0, DEL, C1) and the backslash; a path holds neither.
23
+ // Control characters (DEL) and the backslash; a path holds neither.
24
24
  const FORBIDDEN = /[\u0000-\u001f\u007f-\u009f\\]/;
25
25
  /**
26
26
  * Normalises a path the model or an API caller sent: a trailing `/` is dropped, and a path
@@ -136,12 +136,12 @@ export declare const LINUX_ARG_MAX_BYTES: number;
136
136
  * Agent refused their turn's start (its disk being copied, its pod lost, the Agent deleted); the
137
137
  * start is tried again meanwhile, and after it they fail (`queue.failed`).
138
138
  *
139
- * Flows (`workflows.md` §13):
139
+ * Flows:
140
140
  * - `flowConcurrency`: the most effects one flow turn runs at once; the rest wait their turn.
141
141
  * - `flowMapItems`: the most items one map stage may fan out to (`map.too-many-items` past it).
142
142
  * - `flowLoopIterations`: the most iterations one loop stage runs (`loop.too-many-iterations`).
143
143
  *
144
- * Agent folders (track T7, checked when a folder is saved, and by the compiler):
144
+ * Agent folders (checked when a folder is saved, and by the compiler):
145
145
  * - `folderFiles`: the most files one agent folder holds.
146
146
  * - `folderBytes`: the most bytes its files hold together.
147
147
  * - `folderTextFileBytes`: the largest Markdown or JSON file of a folder the compiler reads.
@@ -179,12 +179,12 @@ const harnessLimits = {
179
179
  * Agent refused their turn's start (its disk being copied, its pod lost, the Agent deleted); the
180
180
  * start is tried again meanwhile, and after it they fail (`queue.failed`).
181
181
  *
182
- * Flows (`workflows.md` §13):
182
+ * Flows:
183
183
  * - `flowConcurrency`: the most effects one flow turn runs at once; the rest wait their turn.
184
184
  * - `flowMapItems`: the most items one map stage may fan out to (`map.too-many-items` past it).
185
185
  * - `flowLoopIterations`: the most iterations one loop stage runs (`loop.too-many-iterations`).
186
186
  *
187
- * Agent folders (track T7, checked when a folder is saved, and by the compiler):
187
+ * Agent folders (checked when a folder is saved, and by the compiler):
188
188
  * - `folderFiles`: the most files one agent folder holds.
189
189
  * - `folderBytes`: the most bytes its files hold together.
190
190
  * - `folderTextFileBytes`: the largest Markdown or JSON file of a folder the compiler reads.
@@ -548,7 +548,7 @@ export const RUNTIME_LIMIT_DEFAULTS = Object.freeze({
548
548
  flowConcurrency: 8,
549
549
  flowMapItems: 1_000,
550
550
  flowLoopIterations: 100,
551
- // T6's fixed values (`AGENT_FOLDER_LIMITS` in `@nylorun/core/folder`).
551
+ // The compiler's fixed values (`AGENT_FOLDER_LIMITS` in `@nylorun/core/folder`).
552
552
  folderFiles: 2_000,
553
553
  folderBytes: 50 * 1024 * 1024,
554
554
  folderTextFileBytes: 1024 * 1024,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nylorun/core",
3
- "version": "0.53.0-beta",
3
+ "version": "0.55.0-beta",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Shared agent definitions and wire contracts",