@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
@@ -18,7 +18,7 @@ export const DEFAULT_ENGINE_TOOL_LIMITS = Object.freeze({
18
18
  * which may only view memory. `plan` offers `update_plan`: true for the session's root agent when
19
19
  * the version sets `harness.loop.plan`; `connections` offers `request_connection` alike
20
20
  * (`harness.loop.connections`). An agent whose own tools name one of them keeps its own.
21
- * `triggers` offers the `triggers` tool and its text (D83): true for the session's root agent when
21
+ * `triggers` offers the `triggers` tool and its text: true for the session's root agent when
22
22
  * the version declares `harness.engine.triggers` (`turn.start.agent.triggers`). What the agent
23
23
  * declares (`agent.engine`) decides the rest; a block it replaces is in its words.
24
24
  */
@@ -60,25 +60,25 @@ export function engineProjection(agent, runsOn, options, memory, plan = false, c
60
60
  use("artifacts_read");
61
61
  instructions.push(text("artifacts_read", ARTIFACTS_READ_TEXT));
62
62
  }
63
- // A session that may book its own next turn (track T4, D77).
63
+ // A session that may book its own next turn.
64
64
  const wake = runsOn?.selfWake === true;
65
65
  if (wake) {
66
66
  use("wake");
67
67
  instructions.push(text("wake", WAKE_TEXT));
68
68
  }
69
- // The triggers the agent sets up itself (D83): the root agent's, when the version declares them.
69
+ // The triggers the agent sets up itself: the root agent's, when the version declares them.
70
70
  const own = (name) => (agent.tools ?? []).some((tool) => tool.name === name);
71
71
  const triggering = triggers && !own(TRIGGERS_TOOL);
72
72
  if (triggering) {
73
73
  use("triggers");
74
74
  instructions.push(text("triggers", TRIGGERS_TEXT));
75
75
  }
76
- // The Agent's memory (track T5, D72).
76
+ // The Agent's memory.
77
77
  const writes = memory !== undefined && memory.root && memory.access === "read_write";
78
78
  if (memory) {
79
79
  use("memory");
80
80
  const own = replaced.memory;
81
- // The rule that text from outside is data stays, whatever the folder's wording (ADR-100).
81
+ // The rule that text from outside is data stays, whatever the folder's wording.
82
82
  const rules = own === undefined ? memoryRules(writes, memory.index !== false) : `${own}\n${writes ? MEMORY_DATA_RULE : MEMORY_READ_ONLY_DATA_RULE}`;
83
83
  instructions.push([rules, ...(memory.instructions ? [`Memory instructions for this agent:\n${memory.instructions}`] : [])].join("\n\n"));
84
84
  }
@@ -110,7 +110,7 @@ export function engineProjection(agent, runsOn, options, memory, plan = false, c
110
110
  features,
111
111
  };
112
112
  }
113
- /** The first line of server `nylorun`'s text (ADR-106). */
113
+ /** The first line of server `nylorun`'s text. */
114
114
  export const RUNTIME_SERVER_HEADING = "# Server nylorun\nThe Runtime's own tools, from the plugins this agent declares. Their names begin with nylorun__.";
115
115
  /** A sandbox section's network sentence: the hosts the runtime allows, or the policy note. */
116
116
  function networkSentence(hosts) {
@@ -119,8 +119,8 @@ function networkSentence(hosts) {
119
119
  return `It can reach only these hosts: ${hosts.join(", ")}. A download from any other host fails.`;
120
120
  }
121
121
  /**
122
- * Our engine's tools and text for an agent that declares the Runtime's plugins (`agent-folder/3`,
123
- * ADR-106). The same tools as without plugins, with the same effects, named `nylorun__<tool>` for
122
+ * Our engine's tools and text for an agent that declares the Runtime's plugins (`agent-folder/3`).
123
+ * The same tools as without plugins, with the same effects, named `nylorun__<tool>` for
124
124
  * the model; the Runtime's words are one text, server `nylorun`, built from the declared plugins'
125
125
  * sections in their order; their skills join the agent's own. `outputs`, the skills' usage and
126
126
  * catalog, and the skills' folder note stay our engine's blocks.
@@ -14,7 +14,7 @@ export interface EngineTool {
14
14
  readonly inputSchema: JsonObject;
15
15
  readonly outputSchema?: JsonObject;
16
16
  /**
17
- * Not in the model's tool list (R2b C10): the model finds it with `tool_search` and runs it
17
+ * Not in the model's tool list: the model finds it with `tool_search` and runs it
18
18
  * with `tool_call`, which makes the call as this tool's own.
19
19
  */
20
20
  readonly deferred?: boolean;
@@ -23,7 +23,7 @@ export interface EngineTool {
23
23
  /** What runs its calls: their effects' `target` (an MCP tool's identity, our engine's `harness`). */
24
24
  readonly target?: EffectTarget;
25
25
  /**
26
- * The name its calls' effects carry (`toolName`), when the model reads another (ADR-106): a
26
+ * The name its calls' effects carry (`toolName`), when the model reads another: a
27
27
  * Runtime plugin's tool is `nylorun__memory` to the model and `memory` to its effect, so the
28
28
  * record, tool policy and the harness's dispatch see it as without plugins.
29
29
  */
@@ -58,7 +58,7 @@ export declare const DEFAULT_SANDBOX_TOOL_LIMITS: SandboxToolLimits;
58
58
  export declare function sandboxToolLimitsOf(set?: Partial<SandboxToolLimits>): SandboxToolLimits;
59
59
  /**
60
60
  * The sandbox tools, in the order the model reads them, with `workspace` named in their text
61
- * and `limits` in their schemas: all six, or those `names` lists (ADR-100, `engine.sandbox`),
61
+ * and `limits` in their schemas: all six, or those `names` lists (`engine.sandbox`),
62
62
  * still in our order. Each is a `sandbox` effect named by its operation.
63
63
  */
64
64
  export declare function sandboxTools(limits: SandboxToolLimits, workspace: string, names?: readonly SandboxToolName[]): EngineTool[];
@@ -85,14 +85,14 @@ export declare const MEMORY_TOOL = "memory";
85
85
  export declare function memoryToolOf(writes: boolean): EngineTool;
86
86
  /** The self-wake tool's name. */
87
87
  export declare const SCHEDULE_WAKE_TOOL = "schedule_wake";
88
- /** `schedule_wake` (track T4): a `runtime` effect. */
88
+ /** `schedule_wake`: a `runtime` effect. */
89
89
  export declare function wakeToolOf(): EngineTool;
90
- /** The triggers tool's name (D83). */
90
+ /** The triggers tool's name. */
91
91
  export declare const TRIGGERS_TOOL = "triggers";
92
92
  /** What serves a `triggers` call: the Runtime, in the call's own transaction. */
93
93
  export declare const RUNTIME_TRIGGERS: EffectTarget;
94
94
  /**
95
- * `triggers` (D83): list, create and delete the triggers the calling session made, for an agent
95
+ * `triggers`: list, create and delete the triggers the calling session made, for an agent
96
96
  * whose version declares `engine.triggers`; the root agent's only. A `runtime` effect, operation
97
97
  * `triggers`; its input is `TriggerToolInputSchema`'s.
98
98
  */
@@ -122,7 +122,7 @@ export declare function deferredToolsTools(config: {
122
122
  readonly toolSearchDefaultLimit: number;
123
123
  readonly toolSearchMaxLimit: number;
124
124
  }): readonly EngineTool[];
125
- /** The question tool's name (ADR-106, `nylorun-interactions`). */
125
+ /** The question tool's name (`nylorun-interactions`). */
126
126
  export declare const ASK_TOOL = "ask";
127
127
  /** The most characters of a question, of a reason, and of one choice, and the most choices. */
128
128
  export declare const ASK_LIMITS: Readonly<{
@@ -132,7 +132,7 @@ export declare const ASK_LIMITS: Readonly<{
132
132
  choices: 6;
133
133
  }>;
134
134
  /**
135
- * `ask` (ADR-106): the agent asks whoever gave it the task a question it can't answer itself,
135
+ * `ask`: the agent asks whoever gave it the task a question it can't answer itself,
136
136
  * and waits. It runs in the harness, as `request_connection` does: a first call pauses the turn
137
137
  * with an interaction of kind `response` whose metadata says `kind: "question"`, which the A2A
138
138
  * server shows as a question (`INPUT_REQUIRED`); the answer runs it again with the value.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Our engine's own tools as the model reads them (protocol 15, ADR-100): each tool's name,
2
+ * Our engine's own tools as the model reads them (protocol 15): each tool's name,
3
3
  * description, input schema and the effect its calls make. Our harness runs them
4
4
  * (`@nylorun/harness`); the compiler and the SDK's `previewTurn` read the same definitions, so
5
5
  * what a preview shows is what a session is offered. Their schemas reach the model: change them
@@ -44,7 +44,7 @@ const object = (properties, required) => ({
44
44
  const pathField = { type: "string", minLength: 1 };
45
45
  /**
46
46
  * The sandbox tools, in the order the model reads them, with `workspace` named in their text
47
- * and `limits` in their schemas: all six, or those `names` lists (ADR-100, `engine.sandbox`),
47
+ * and `limits` in their schemas: all six, or those `names` lists (`engine.sandbox`),
48
48
  * still in our order. Each is a `sandbox` effect named by its operation.
49
49
  */
50
50
  export function sandboxTools(limits, workspace, names = SANDBOX_TOOL_NAMES) {
@@ -314,7 +314,7 @@ export function memoryToolOf(writes) {
314
314
  /** The self-wake tool's name. */
315
315
  export const SCHEDULE_WAKE_TOOL = "schedule_wake";
316
316
  const RUNTIME_WAKE = Object.freeze({ kind: "runtime", operation: "schedule_wake" });
317
- /** `schedule_wake` (track T4): a `runtime` effect. */
317
+ /** `schedule_wake`: a `runtime` effect. */
318
318
  export function wakeToolOf() {
319
319
  return {
320
320
  name: SCHEDULE_WAKE_TOOL,
@@ -333,12 +333,12 @@ export function wakeToolOf() {
333
333
  };
334
334
  }
335
335
  // --- triggers --------------------------------------------------------------------------------
336
- /** The triggers tool's name (D83). */
336
+ /** The triggers tool's name. */
337
337
  export const TRIGGERS_TOOL = "triggers";
338
338
  /** What serves a `triggers` call: the Runtime, in the call's own transaction. */
339
339
  export const RUNTIME_TRIGGERS = Object.freeze({ kind: "runtime", operation: "triggers" });
340
340
  /**
341
- * `triggers` (D83): list, create and delete the triggers the calling session made, for an agent
341
+ * `triggers`: list, create and delete the triggers the calling session made, for an agent
342
342
  * whose version declares `engine.triggers`; the root agent's only. A `runtime` effect, operation
343
343
  * `triggers`; its input is `TriggerToolInputSchema`'s.
344
344
  */
@@ -509,12 +509,12 @@ function definedOf(value) {
509
509
  return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== undefined));
510
510
  }
511
511
  // --- ask -------------------------------------------------------------------------------------
512
- /** The question tool's name (ADR-106, `nylorun-interactions`). */
512
+ /** The question tool's name (`nylorun-interactions`). */
513
513
  export const ASK_TOOL = "ask";
514
514
  /** The most characters of a question, of a reason, and of one choice, and the most choices. */
515
515
  export const ASK_LIMITS = Object.freeze({ questionChars: 1000, whyChars: 280, choiceChars: 120, choices: 6 });
516
516
  /**
517
- * `ask` (ADR-106): the agent asks whoever gave it the task a question it can't answer itself,
517
+ * `ask`: the agent asks whoever gave it the task a question it can't answer itself,
518
518
  * and waits. It runs in the harness, as `request_connection` does: a first call pauses the turn
519
519
  * with an interaction of kind `response` whose metadata says `kind: "question"`, which the A2A
520
520
  * server shows as a question (`INPUT_REQUIRED`); the answer runs it again with the value.
package/dist/errors.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /** Machine-readable error raised by Harness-owned code. */
2
2
  export type HarnessErrorCode = "execution.invalid-state" | "execution.invalid-input" | "execution.incompatible" | "execution.record-failed" | "tool.unregistered" | "tool.invalid-binding" | "agent.build-failed" | "agent.lifecycle-sealed" | "context.invalid-item" | "context.invalid-item-type" | "context.invalid-order" | "context.invalid-reason" | "context.invalid-slot" | "interaction.invalid" | "interaction.missing-resume" | "interaction.uncorrelated-resume" | "input.invalid-content" | "output.invalid" | "output.invalid-schema" | "json.invalid-data" | "json.invalid-object" | "model.candidate-missing" | "model.adapter-invalid-options" | "model.adapter-invalid-response" | "model.invalid-candidate" | "model.invalid-directive" | "model.unsupported-content" | "model.unsupported-output-schema"
3
- /** A provider failure the model adapter classified (Model Calls §6.1). */
3
+ /** A provider failure the model adapter classified. */
4
4
  | `model.${import("./types/model.js").ModelFailureCode}` | "configuration.duplicate-tool-name" | "configuration.invalid" | "configuration.invalid-instructions" | "configuration.invalid-order" | "configuration.invalid-reason" | "configuration.invalid-slot" | "configuration.invalid-tools" | "configuration.model-selection-conflict" | "response.invalid-replacement" | "tool.invalid" | "tool.invalid-arguments" | "tool.invalid-output" | "tool.invalid-name" | "tool.invalid-schema" | "tool.invalid-tool-result";
5
5
  export type HarnessErrorDetails = Readonly<Record<string, string | number | boolean>>;
6
6
  export interface HarnessErrorOptions {
@@ -3,7 +3,7 @@ import { type FolderScope } from "./nested.js";
3
3
  /** The compiler format this version builds by default: a folder with no `format`, or `format: 1`. */
4
4
  export declare const AGENT_FOLDER_COMPILER = "agent-folder/1";
5
5
  /**
6
- * The formats this compiler builds: `agent-folder/1`, and `agent-folder/2` (ADR-100), whose
6
+ * The formats this compiler builds: `agent-folder/1`, and `agent-folder/2`, whose
7
7
  * folder declares every engine feature it uses (`folder/engine.ts`).
8
8
  */
9
9
  export declare const AGENT_FOLDER_FORMATS: readonly ["agent-folder/1", "agent-folder/2", "agent-folder/3", "agent-folder/4"];
@@ -17,7 +17,7 @@ import { ENGINE_TEXT_DIR, compiledEngine, engineBlocksOf, engineDeclarations, fo
17
17
  /** The compiler format this version builds by default: a folder with no `format`, or `format: 1`. */
18
18
  export const AGENT_FOLDER_COMPILER = "agent-folder/1";
19
19
  /**
20
- * The formats this compiler builds: `agent-folder/1`, and `agent-folder/2` (ADR-100), whose
20
+ * The formats this compiler builds: `agent-folder/1`, and `agent-folder/2`, whose
21
21
  * folder declares every engine feature it uses (`folder/engine.ts`).
22
22
  */
23
23
  export const AGENT_FOLDER_FORMATS = ["agent-folder/1", "agent-folder/2", "agent-folder/3", "agent-folder/4"];
@@ -59,7 +59,8 @@ export const SCHEMA_URLS = {
59
59
  };
60
60
  const SKILL_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
61
61
  export const AGENT_KEYS = ["name", "description", "format", "harness", "inputSchema", "outputSchema", "mcpServers", "skills", "memory", "loop", "model", "roles", "engine", "plugins", "metadata"];
62
- const SKILL_KEYS = ["name", "description", "license", "compatibility", "metadata", "allowed-tools"];
62
+ /** Agent Skills' keys, and Claude Code's `disable-model-invocation`: a skill only a person starts. */
63
+ const SKILL_KEYS = ["name", "description", "license", "compatibility", "metadata", "allowed-tools", "disable-model-invocation"];
63
64
  export const TRIGGER_KEYS = ["schedule", "timezone", "at", "webhook", "session"];
64
65
  export const MCP_KEYS = ["$schema", "mcpServers"];
65
66
  export const SERVER_KEYS = ["type", "url", "headers"];
@@ -69,7 +70,7 @@ export const PLUGIN_SERVER_SETTING_KEYS = [...SERVER_SETTING_KEYS, "credential"]
69
70
  export const TOOL_KEYS = ["description", "inputSchema", "outputSchema", "http"];
70
71
  /**
71
72
  * The loop settings our harness reads from `loop`: `plan` (`true` offers the agent `update_plan`),
72
- * `connections` (`true` offers it `request_connection`), `ask`, and `compaction` (ADR-157: when
73
+ * `connections` (`true` offers it `request_connection`), `ask`, and `compaction` (when
73
74
  * the agent's sessions compact, `threshold` and `keepTokens`, and `roles.<role>` over them). A
74
75
  * custom harness reads its own.
75
76
  */
@@ -137,7 +138,7 @@ function classify(path) {
137
138
  return { kind: "schema" };
138
139
  return { kind: "other" };
139
140
  }
140
- // agent-folder/4 (ADR-164): a subagent is a file, with its flow file and schemas beside it.
141
+ // agent-folder/4: a subagent is a file, with its flow file and schemas beside it.
141
142
  if (top === "agents" && segments.length === 2) {
142
143
  if (base.endsWith(".flow.json"))
143
144
  return { kind: "subagent_flow" };
@@ -234,7 +235,7 @@ const show = (value) => JSON.stringify(value) ?? String(value);
234
235
  * compiler sets it when it compiles a folder inside another (`agents/<id>/`, a plugin's parts).
235
236
  */
236
237
  export function compileAgentFolder(input, scope) {
237
- // agent-folder/4 (ADR-164): its subagent files, expanded into the layout format 3 compiles.
238
+ // agent-folder/4: its subagent files, expanded into the layout format 3 compiles.
238
239
  if (!scope && folderIsV4(input))
239
240
  return compileFormat4(input, (expanded) => compileFolder(expanded, undefined));
240
241
  return compileFolder(input, scope);
@@ -244,7 +245,7 @@ function compileFolder(input, scope) {
244
245
  const diagnostics = [];
245
246
  /** The folder's format: the uploaded folder's `format`, which a folder inside it shares. */
246
247
  let format = scope?.engineFacts?.format ?? 1;
247
- /** The folder is `agent-folder/3` (ADR-106): its plugins stand for v2 declarations (folder/v3.ts). */
248
+ /** The folder is `agent-folder/3`: its plugins stand for v2 declarations (folder/v3.ts). */
248
249
  let v3 = scope?.engineFacts?.v3 === true;
249
250
  let v3Plugins;
250
251
  const parsed = new Map();
@@ -502,7 +503,7 @@ function compileFolder(input, scope) {
502
503
  const instructions = [];
503
504
  let metadata;
504
505
  const origins = [];
505
- /** agent-folder/4 (ADR-164): the uploaded folder is format 4, or this is one of its subagent files. */
506
+ /** agent-folder/4: the uploaded folder is format 4, or this is one of its subagent files. */
506
507
  const v4File = scope !== undefined && scope.role !== "plugin" && scope.engineFacts?.v4 !== undefined;
507
508
  let v4Root = false;
508
509
  /** What a format 4 subagent file, or root, keeps of what it inherits (folder/subagent-files.ts). */
@@ -551,6 +552,9 @@ function compileFolder(input, scope) {
551
552
  error("name_missing", "name is required: the agent manifest's name", AGENT_FILE, front.name === undefined ? undefined : ["name"]);
552
553
  else if (!isAgentManifestName(front.name))
553
554
  error("name_invalid", "name is 1-64 letters, digits, '.', '_' and '-', starting with a letter or digit", AGENT_FILE, ["name"]);
555
+ // A subagent file goes by its name, whatever the file is called: the tool the model calls.
556
+ else if (v4File && !/^[A-Za-z0-9_-]{1,64}$/.test(front.name))
557
+ error("name_invalid", "name is the tool the model calls: 1-64 letters, digits, '_' and '-'", AGENT_FILE, ["name"]);
554
558
  else if (input.name !== undefined && front.name !== input.name)
555
559
  error("name_mismatch", v4File ? `name is ${front.name}, and the file is agents/${input.name}.md: they must match` : `name is ${front.name}, and the folder is saved as ${input.name}: they must match`, AGENT_FILE, ["name"]);
556
560
  else
@@ -567,7 +571,7 @@ function compileFolder(input, scope) {
567
571
  error("format_unsupported", `format ${JSON.stringify(front.format)} is not supported: this compiler builds ${AGENT_FOLDER_FORMATS.join(" and ")} (the default, ${AGENT_FOLDER_COMPILER})`, AGENT_FILE, ["format"]);
568
572
  else if (!scope)
569
573
  format = folderFormatOf(front.format);
570
- // agent-folder/3 (ADR-106): the plugins stand for agent-folder/2's declarations.
574
+ // agent-folder/3: the plugins stand for agent-folder/2's declarations.
571
575
  if (v3 && scope?.role !== "plugin") {
572
576
  const role = scope?.role === "subagent" ? "subagent" : "root";
573
577
  v3Plugins = v3Declarations(front, {
@@ -641,7 +645,7 @@ function compileFolder(input, scope) {
641
645
  else
642
646
  error("value_invalid", `model is <provider>/<model>, such as anthropic/claude-sonnet-4-5: the provider's id (letters, digits, '.', '_' or '-'), a '/', then the model's id, at most ${AGENT_MODEL_MAX_CHARS} characters and no spaces${typeof front.model === "string" ? `, not ${JSON.stringify(front.model)}` : ""}`, AGENT_FILE, ["model"]);
643
647
  }
644
- // The model of each role a session may be opened with (Host feature `model-roles`, ADR-154).
648
+ // The model of each role a session may be opened with (Host feature `model-roles`).
645
649
  if (front.roles !== undefined) {
646
650
  if (!isObject(front.roles))
647
651
  error("value_invalid", "roles is a map from a role's name to its model, such as builder: anthropic/claude-sonnet-4-5", AGENT_FILE, ["roles"]);
@@ -689,7 +693,7 @@ function compileFolder(input, scope) {
689
693
  // A flow has no instructions of its own: its stages do.
690
694
  else if (agent?.hasFrontmatter && ![...kinds.values()].includes("flow"))
691
695
  warn("instructions_empty", `The agent has no instructions: ${AGENT_FILE}'s body is empty and instructions/ holds none, so the model gets the harness's own instructions only. Write them below the frontmatter`, AGENT_FILE, undefined, { at: { line: agent.bodyLine, column: 1 } });
692
- // A subagent file outside agent-folder/4 (ADR-164).
696
+ // A subagent file outside agent-folder/4.
693
697
  if (!v4Root && !v4File)
694
698
  for (const [path, kind] of kinds)
695
699
  if (kind === "subagent_file" || kind === "subagent_flow") {
@@ -718,7 +722,7 @@ function compileFolder(input, scope) {
718
722
  checkSchedule(RUNTIME_FILE, ["triggers", id], trigger);
719
723
  }
720
724
  }
721
- // --- engine: (agent-folder/2, ADR-100; folder/engine.ts) -------------------------------
725
+ // --- engine: (agent-folder/2; folder/engine.ts) -------------------------------
722
726
  /** Whether the session's Agent has a computer: the uploaded folder's runtime kind. */
723
727
  const runtimeKind = isObject(runtime) && typeof runtime.kind === "string" ? runtime.kind : "none";
724
728
  const computer = scope?.engineFacts ? scope.engineFacts.computer : runtimeKind === "virtual" || runtimeKind === "pod";
@@ -1055,6 +1059,11 @@ function compileFolder(input, scope) {
1055
1059
  error("skill_invalid", "description is required, at most 1024 characters", entryPath, data.description === undefined ? undefined : ["description"]);
1056
1060
  valid = false;
1057
1061
  }
1062
+ const personOnly = data["disable-model-invocation"];
1063
+ if (personOnly !== undefined && typeof personOnly !== "boolean") {
1064
+ error("skill_invalid", "disable-model-invocation is true or false: true keeps the skill from the model until a person starts it", entryPath, ["disable-model-invocation"]);
1065
+ valid = false;
1066
+ }
1058
1067
  const files = {};
1059
1068
  for (const path of paths.sort(compare)) {
1060
1069
  const relative = path.slice(`skills/${folder}/`.length);
@@ -1068,7 +1077,7 @@ function compileFolder(input, scope) {
1068
1077
  }
1069
1078
  if (!valid)
1070
1079
  continue;
1071
- skills[skillName] = { name: skillName, description: skillDescription, files };
1080
+ skills[skillName] = { name: skillName, description: skillDescription, files, ...(personOnly === true ? { disableModelInvocation: true } : {}) };
1072
1081
  origins.push([["harness", "skills", skillName], { file: entryPath, path: [] }]);
1073
1082
  }
1074
1083
  parts.mergeSkills(skills);
@@ -1157,7 +1166,7 @@ function compileFolder(input, scope) {
1157
1166
  }
1158
1167
  if (tools.length > 0)
1159
1168
  harness.tools = tools;
1160
- // agent-folder/4 (ADR-164): what a subagent file, or the root, keeps of the library.
1169
+ // agent-folder/4: what a subagent file, or the root, keeps of the library.
1161
1170
  if (narrowing)
1162
1171
  narrowParts(harness, narrowing, {
1163
1172
  role: v4File ? "subagent" : "root",
@@ -1587,7 +1596,7 @@ function trimBlankLines(text) {
1587
1596
  return lines.join("\n");
1588
1597
  }
1589
1598
  /**
1590
- * Checks `loop.compaction` (ADR-157): a map of `threshold` and `keepTokens`, positive whole numbers
1599
+ * Checks `loop.compaction`: a map of `threshold` and `keepTokens`, positive whole numbers
1591
1600
  * of tokens, and `roles`, a map from a role's name to the same two. The harness also ignores a
1592
1601
  * value it cannot use, so a folder that passes here never changes how its sessions compact by
1593
1602
  * accident.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The agent folder of a manifest (track T7, D80): `folderOfManifest` is `compileAgentFolder` run
2
+ * The agent folder of a manifest: `folderOfManifest` is `compileAgentFolder` run
3
3
  * backwards. It writes the folder that compiles back to the same agent manifest v8, for an agent
4
4
  * saved as JSON or from TypeScript (`nylorun export --folder`) and for the three-file format
5
5
  * (`nylorun migrate folder`). Like the compiler it is pure: no file system, clock or network.
@@ -14,8 +14,8 @@
14
14
  * `instructions/NN-<slug>.md`, zero-padded so path order and natural order agree.
15
15
  * - HTTP tools: `tools/<name>.json`, their schemas inline.
16
16
  * - Subagents (a tool with `agent`): `agents/<name>/`, an agent folder of the embedded agent
17
- * manifest v7 (or a flow, workflow manifest v3), as the compiler reads one (design §3.3).
18
- * - Flows (`kind: "workflow"`, design §3.8): `AGENT.md` with no body and `inputSchema`
17
+ * manifest v7 (or a flow, workflow manifest v3), as the compiler reads one.
18
+ * - Flows (`kind: "workflow"`): `AGENT.md` with no body and `inputSchema`
19
19
  * (`input.schema.json`), `flow.json` with v3's node tree naming agents by id and tools by file
20
20
  * name, and one flat `agents/<id>/` namespace at the flow root for every agent of the flow and
21
21
  * of its sub-flows. A sub-flow is an `agents/<id>/` with its own `flow.json` over the same
@@ -32,7 +32,7 @@
32
32
  * (`options.files`), a last `/workspace` entry becomes `files/`.
33
33
  * - Skills: the manifest has their files by hash only. Given the bytes (`options.files`, by
34
34
  * `sha256:<hex>`), each skill is written as its folder; a `SKILL.md` that still says `secrets`
35
- * loses that key, which `AGENT.md`'s `skills` block holds now (D80), so its hash changes.
35
+ * loses that key, which `AGENT.md`'s `skills` block holds now, so its hash changes.
36
36
  * Without them, a placeholder `SKILL.md` stands in and a note lists the files to copy in.
37
37
  *
38
38
  * What a folder cannot say is left out or written another way, with a note: an embedded agent's
@@ -250,7 +250,7 @@ function writeAgent(writer, place, identity, harness) {
250
250
  else {
251
251
  files.set(file, moved);
252
252
  note(root
253
- ? `skills/${key}/SKILL.md: secrets moved to AGENT.md's skills block (D80), so the file and its hash change.`
253
+ ? `skills/${key}/SKILL.md: secrets moved to AGENT.md's skills block, so the file and its hash change.`
254
254
  : `skills/${key}/SKILL.md: its secrets are left out, as only the root agent's skills get secrets, so the file and its hash change.`);
255
255
  }
256
256
  }
@@ -276,7 +276,7 @@ function writeAgent(writer, place, identity, harness) {
276
276
  else
277
277
  note("harness.loop is not a map, which AGENT.md needs: it is left out.");
278
278
  }
279
- // agent-folder/2 (ADR-100): the declarations, each replaced wording a file under engine/. The
279
+ // agent-folder/2: the declarations, each replaced wording a file under engine/. The
280
280
  // blocks are the compiler's to list again.
281
281
  if (harness.engine !== undefined && !root && !writer.declares)
282
282
  note("The subagent declares its engine features and the manifest does not: an agent-folder/1 folder cannot say so, so it gets the defaults.");
@@ -397,7 +397,7 @@ function writeEmbedded(writer, place, id, agent, namespace) {
397
397
  if (agent.id !== id)
398
398
  note(`The embedded agent's id is ${agent.id}, and in a folder it is its folder's name, ${id}.`);
399
399
  if (agent.name !== undefined)
400
- note(`The agent's display name "${agent.name}" is left out: in a folder an agent's name is its id (design §3.2).`);
400
+ note(`The agent's display name "${agent.name}" is left out: in a folder an agent's name is its id.`);
401
401
  const identity = { name: id, description: agent.description, metadata: agent.metadata };
402
402
  // Its `id` is the agent's, not the harness's: `AGENT.md`'s name holds it.
403
403
  if (isWorkflow(agent)) {
@@ -18,7 +18,7 @@ export interface EngineScopeFacts {
18
18
  readonly memory: boolean;
19
19
  /** The uploaded folder's runtime sets `selfWake`. */
20
20
  readonly selfWake: boolean;
21
- /** The uploaded folder is `agent-folder/3` (ADR-106). */
21
+ /** The uploaded folder is `agent-folder/3`. */
22
22
  readonly v3?: boolean;
23
23
  /** Its plugins, under format 3: a subagent's are a subset. */
24
24
  readonly plugins?: readonly {
@@ -26,7 +26,7 @@ export interface EngineScopeFacts {
26
26
  readonly tools: readonly string[];
27
27
  }[];
28
28
  /**
29
- * The uploaded folder is `agent-folder/4` (ADR-164): its folders under `agents/` are subagent
29
+ * The uploaded folder is `agent-folder/4`: its folders under `agents/` are subagent
30
30
  * files, expanded with the library. What they may not inherit unnamed: the root's skills with
31
31
  * secrets and servers it gives a credential.
32
32
  */
@@ -76,7 +76,7 @@ export declare function engineBlocksOf(agent: {
76
76
  };
77
77
  readonly plan: boolean;
78
78
  readonly connections: boolean;
79
- /** The root agent declares `engine.triggers` (D83). */
79
+ /** The root agent declares `engine.triggers`. */
80
80
  readonly triggers?: boolean;
81
81
  /** The root agent has `ask` (`agent-folder/3`, `harness.loop.ask`). */
82
82
  readonly ask?: boolean;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `agent-folder/2` (ADR-100): a folder declares every engine feature it uses, and our engine adds
2
+ * `agent-folder/2`: a folder declares every engine feature it uses, and our engine adds
3
3
  * nothing else. `AGENT.md` names the format (`format: agent-folder/2`, or `2`) and, in its
4
4
  * `engine:` block, the features no other key declares:
5
5
  *
@@ -11,7 +11,7 @@
11
11
  * artifacts: { read: true, save: false } # save needs a computer
12
12
  * outputs: true # save /workspace/outputs when a turn ends; needs a computer
13
13
  * toolSearch: false # no automatic deferral; a server's own `deferred` still applies
14
- * triggers: true # the triggers tool and its text (D83); the root agent's only
14
+ * triggers: true # the triggers tool and its text; the root agent's only
15
15
  * instructions: # a block's wording, replaced by a file under engine/
16
16
  * memory: engine/memory.md
17
17
  * ```
@@ -146,7 +146,7 @@ export function engineDeclarations(value, options) {
146
146
  engine.toolSearch = value.toolSearch;
147
147
  }
148
148
  }
149
- // triggers: the root agent's (D83). A subagent whose parent declares them is refused in
149
+ // triggers: the root agent's. A subagent whose parent declares them is refused in
150
150
  // `nested.ts`; one whose parent does not, here.
151
151
  if (value.triggers !== undefined) {
152
152
  const at = ["engine", "triggers"];
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The compiler's fix-its, applied to text (`nylorun check --fix`, track T7): each diagnostic's
2
+ * The compiler's fix-its, applied to text (`nylorun check --fix`): each diagnostic's
3
3
  * `fix` (`AgentFolderFix`) is one edit, and this makes it, touching nothing else. Like the
4
4
  * compiler it is pure: it is given the text of each file a fix names, and answers the new text
5
5
  * of each it changed.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `flow.json` (track T7, design §3.8): workflow manifest v3's node tree, as a folder writes it.
2
+ * `flow.json`: workflow manifest v3's node tree, as a folder writes it.
3
3
  * The node names are v3's (`agent`, `tool`, `chain`, `switch`, `parallel`, `map`, `loop`, and
4
4
  * `id` on any node), so a v3 tree pastes in. Two leaves differ, because a folder names things
5
5
  * instead of embedding them:
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `flow.json` (track T7, design §3.8): workflow manifest v3's node tree, as a folder writes it.
2
+ * `flow.json`: workflow manifest v3's node tree, as a folder writes it.
3
3
  * The node names are v3's (`agent`, `tool`, `chain`, `switch`, `parallel`, `map`, `loop`, and
4
4
  * `id` on any node), so a v3 tree pastes in. Two leaves differ, because a folder names things
5
5
  * instead of embedding them:
@@ -1,10 +1,10 @@
1
1
  /**
2
- * `@nylorun/core/folder`: agent folders (track T6, D79). An agent written as a folder of
2
+ * `@nylorun/core/folder`: agent folders. An agent written as a folder of
3
3
  * Markdown and JSON, compiled by `compileAgentFolder` into the agent manifest v8 the Runtime
4
4
  * runs. The Runtime compiles every folder it is sent with this code, and the CLI checks one
5
5
  * offline with the same code. `folderOfManifest` writes the folder of a saved manifest,
6
6
  * `agentFolderJsonSchemas` gives the JSON Schema of each kind of file in a folder, for editors, and
7
- * `applyFolderFixes` makes the fix-its its diagnostics carry (track T7).
7
+ * `applyFolderFixes` makes the fix-its its diagnostics carry.
8
8
  */
9
9
  export { AGENT_FOLDER_COMPILER, AGENT_FOLDER_LIMITS, compileAgentFolder, folderTextPaths, type AgentFolderDiagnostic, type AgentFolderEntry, type AgentFolderFix, type AgentFolderLimits, type CompileAgentFolderInput, type CompiledAgentFolder, } from "./compile.js";
10
10
  export { folderOfManifest, type FolderOfManifest, type FolderOfManifestOptions } from "./decompile.js";
@@ -1,10 +1,10 @@
1
1
  /**
2
- * `@nylorun/core/folder`: agent folders (track T6, D79). An agent written as a folder of
2
+ * `@nylorun/core/folder`: agent folders. An agent written as a folder of
3
3
  * Markdown and JSON, compiled by `compileAgentFolder` into the agent manifest v8 the Runtime
4
4
  * runs. The Runtime compiles every folder it is sent with this code, and the CLI checks one
5
5
  * offline with the same code. `folderOfManifest` writes the folder of a saved manifest,
6
6
  * `agentFolderJsonSchemas` gives the JSON Schema of each kind of file in a folder, for editors, and
7
- * `applyFolderFixes` makes the fix-its its diagnostics carry (track T7).
7
+ * `applyFolderFixes` makes the fix-its its diagnostics carry.
8
8
  */
9
9
  export { AGENT_FOLDER_COMPILER, AGENT_FOLDER_LIMITS, compileAgentFolder, folderTextPaths, } from "./compile.js";
10
10
  export { folderOfManifest } from "./decompile.js";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `agent-folder/2` → `agent-folder/3` (ADR-106): the plugins that keep what an agent gets, written
2
+ * `agent-folder/2` → `agent-folder/3`: the plugins that keep what an agent gets, written
3
3
  * in place of the declarations they stand for. `nylorun migrate folder <dir> --to 3` runs it on a
4
4
  * folder's `AGENT.md` and each subagent's, and on `runtime.json`, then checks that every agent
5
5
  * keeps the same tools and features.
@@ -75,7 +75,7 @@ export function folderV3Edit(input) {
75
75
  }
76
76
  // The frontmatter, edited in place: comments and the other keys stay as they are.
77
77
  doc.delete("memory");
78
- // loop keeps the harness's own settings (compaction, ADR-157); its plan, connections and ask are plugins now.
78
+ // loop keeps the harness's own settings (compaction); its plan, connections and ask are plugins now.
79
79
  const loopNode = doc.get("loop", true);
80
80
  if (isMap(loopNode)) {
81
81
  for (const key of ["plan", "connections", "ask"])
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `agent-folder/3` → `agent-folder/4` (ADR-164): each subagent folder becomes one file,
2
+ * `agent-folder/3` → `agent-folder/4`: each subagent folder becomes one file,
3
3
  * `agents/<id>.md`, and what it held moves into the manifest's library. `nylorun migrate folder
4
4
  * <dir> --to 4` plans it here, applies it to a copy, and writes it only when the copy compiles to
5
5
  * the same agent manifest.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The folders inside an agent folder (track T7, D80; design §3.3, §3.8), compiled by the same
2
+ * The folders inside an agent folder, compiled by the same
3
3
  * compiler, one level in:
4
4
  *
5
5
  * - **Subagents.** `agents/<id>/` of an agent (no `flow.json` beside it) is an agent folder
@@ -56,7 +56,7 @@ export function scopedSchema(scope, value, fail) {
56
56
  export function folderParts(ctx) {
57
57
  const isFlow = [...ctx.kinds.values()].includes("flow");
58
58
  let plugins;
59
- const folded = () => (plugins ??= isFlow ? { servers: new Map(), skills: new Map() } : foldPlugins(ctx));
59
+ const folded = () => (plugins ??= isFlow ? { servers: new Map(), skills: new Map(), mounted: new Map() } : foldPlugins(ctx));
60
60
  return {
61
61
  /** Adds the plugins' MCP servers, before `AGENT.md` says how the agent uses them. */
62
62
  mergeServers(servers) {
@@ -116,7 +116,7 @@ export function folderParts(ctx) {
116
116
  nestedChecks(ctx);
117
117
  if (isFlow)
118
118
  return composeFlow(ctx);
119
- composeAgent(ctx);
119
+ composeAgent(ctx, folded().mounted);
120
120
  return true;
121
121
  },
122
122
  };
@@ -198,7 +198,7 @@ function nestedChecks(ctx) {
198
198
  for (const [key, message] of Object.entries(keys))
199
199
  if (ctx.front[key] !== undefined)
200
200
  refuse(message, AGENT_FILE, [key]);
201
- // Triggers are the root agent's (D83): a subagent of a parent without them fails engine_subset.
201
+ // Triggers are the root agent's: a subagent of a parent without them fails engine_subset.
202
202
  if (isObject(ctx.front.engine) &&
203
203
  ctx.front.engine.triggers === true &&
204
204
  (ctx.scope.role === "stage" || ctx.scope.engineFacts?.engine?.triggers === true))
@@ -223,7 +223,7 @@ function nestedChecks(ctx) {
223
223
  ctx.report("error", "credential_unsupported", `Only the root agent's skills get secrets: ${what}'s skill ${key} gets none`, AGENT_FILE, ["skills", key, "secrets"]);
224
224
  }
225
225
  /** An agent: its `agents/` are tools, and its plugins are listed. */
226
- function composeAgent(ctx) {
226
+ function composeAgent(ctx, mounted) {
227
227
  if (ctx.front.inputSchema !== undefined)
228
228
  ctx.report("error", "input_schema_refused", "inputSchema is for a manifest driven by a flow: one driven by a model loop takes the message, and a subagent used as a tool takes { task }. flow.json makes a manifest driven by a flow", AGENT_FILE, ["inputSchema"], { key: true });
229
229
  const harness = ctx.harness;
@@ -268,6 +268,9 @@ function composeAgent(ctx) {
268
268
  if (label && !labels.has(label.name))
269
269
  labels.set(label.name, { ...label });
270
270
  }
271
+ // A plugin mounted whole carries its files, whether or not its parts carry its label.
272
+ for (const plugin of mounted.values())
273
+ labels.set(plugin.name, plugin);
271
274
  if (labels.size > 0)
272
275
  harness.plugins = [...labels.values()].sort((a, b) => a.name.localeCompare(b.name));
273
276
  }
@@ -313,7 +316,7 @@ function composeFlow(ctx) {
313
316
  });
314
317
  }
315
318
  const noted = new Set();
316
- // agent-folder/4 (ADR-164): a flow root's mcp.json, skills/, plugins/ and tools are the library
319
+ // agent-folder/4: a flow root's mcp.json, skills/, plugins/ and tools are the library
317
320
  // its stages draw on, not its own.
318
321
  const library = !ctx.scope && ctx.engineFacts().v4 !== undefined;
319
322
  for (const [path, kind] of ctx.kinds) {
@@ -6,7 +6,7 @@ export interface PluginLabel {
6
6
  readonly name: string;
7
7
  readonly version?: string;
8
8
  }
9
- /** A plugin's skills and servers, labelled, with the file each came from. */
9
+ /** A plugin's skills and servers, labelled, with the file each came from, and the plugins mounted whole. */
10
10
  export interface FoldedPlugins {
11
11
  readonly servers: Map<string, {
12
12
  readonly server: Record<string, unknown>;
@@ -16,8 +16,20 @@ export interface FoldedPlugins {
16
16
  readonly skill: Record<string, unknown>;
17
17
  readonly file: string;
18
18
  }>;
19
+ /** By name: each plugin holding files beyond the parts the manifest carries, with all its files. */
20
+ readonly mounted: Map<string, {
21
+ readonly name: string;
22
+ readonly version?: string;
23
+ readonly files: Record<string, string>;
24
+ }>;
19
25
  }
20
26
  /** The files of `plugins/<name>/` the compiler reads, relative to the plugin's folder. */
21
27
  export declare function pluginTextPaths(paths: readonly string[]): string[];
28
+ /** A plugin's subagent file, relative to the plugin's folder (`agents/<file>.md`): its file name, or undefined. */
29
+ export declare function pluginSubagentFile(path: string): string | undefined;
30
+ /** A JSON file beside a plugin's subagent files, such as the flow file a subagent's `flow:` names. */
31
+ export declare function pluginSubagentFlow(path: string): boolean;
32
+ /** A plugin's label as its `plugin.json` gives it, read quietly: undefined when it names none. */
33
+ export declare function pluginLabelOf(manifest: unknown): PluginLabel | undefined;
22
34
  /** Folds every plugin under `plugins/`. */
23
35
  export declare function foldPlugins(ctx: FolderContext): FoldedPlugins;