@nylorun/core 0.24.0-beta → 0.25.0-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/dist/compatibility.d.ts +47 -36
  3. package/dist/compatibility.js +47 -36
  4. package/dist/contracts.d.ts +133 -87
  5. package/dist/contracts.js +185 -135
  6. package/dist/definition/approval.d.ts +1 -1
  7. package/dist/definition/bound.d.ts +2 -0
  8. package/dist/definition/builder.d.ts +2 -2
  9. package/dist/definition/builder.js +1 -1
  10. package/dist/definition/code-tools.d.ts +1 -1
  11. package/dist/definition/declaration.js +3 -0
  12. package/dist/definition/delegate.d.ts +1 -1
  13. package/dist/definition/delegate.js +1 -1
  14. package/dist/definition/from.d.ts +2 -2
  15. package/dist/definition/from.js +1 -1
  16. package/dist/definition/http-tool.d.ts +3 -3
  17. package/dist/definition/mcp.d.ts +4 -4
  18. package/dist/definition/mcp.js +3 -3
  19. package/dist/definition/sections.d.ts +5 -4
  20. package/dist/definition/sections.js +30 -7
  21. package/dist/definition/variant.d.ts +1 -1
  22. package/dist/definition/variant.js +4 -4
  23. package/dist/harness-api/entries.d.ts +1 -1
  24. package/dist/harness-api/entries.js +1 -1
  25. package/dist/harness-api/gates.d.ts +1 -1
  26. package/dist/harness-api/gates.js +1 -1
  27. package/dist/harness-api/json-schema.d.ts +1 -1
  28. package/dist/harness-api/json-schema.js +1 -1
  29. package/dist/harness-api/mcp.js +1 -1
  30. package/dist/harness-api/messages.d.ts +6 -6
  31. package/dist/harness-api/schema.d.ts +7 -7
  32. package/dist/harness-api/schema.js +16 -16
  33. package/dist/harness-api/transcript.d.ts +1 -1
  34. package/dist/harness-api/transport.d.ts +1 -1
  35. package/dist/harness-api/transport.js +1 -1
  36. package/dist/manifest-schemas.js +2 -1
  37. package/dist/schemas/agent-manifest.schema.json +3 -3
  38. package/dist/schemas/harness-manifest.schema.json +1 -1
  39. package/dist/schemas/runtime-manifest.schema.json +2 -2
  40. package/dist/types/manifest.d.ts +21 -17
  41. package/dist/types/model.d.ts +1 -1
  42. package/dist/types/observe.d.ts +1 -1
  43. package/dist/types/part.d.ts +5 -0
  44. package/dist/types/tool.d.ts +4 -4
  45. package/dist/utils/definition-files.d.ts +3 -2
  46. package/dist/utils/definition-files.js +4 -3
  47. package/dist/utils/file-systems.d.ts +1 -1
  48. package/dist/utils/file-systems.js +1 -1
  49. package/dist/utils/harness-id.d.ts +1 -1
  50. package/dist/utils/harness-id.js +1 -1
  51. package/dist/utils/memory.d.ts +2 -2
  52. package/dist/utils/memory.js +2 -2
  53. package/dist/utils/runtime-limits.d.ts +5 -5
  54. package/dist/utils/runtime-limits.js +5 -5
  55. package/dist/utils/runtime-tools.d.ts +3 -3
  56. package/dist/utils/runtime-tools.js +3 -3
  57. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `approval` in a manifest (R5 step 2). Tool approvals are the Tenant's tool policy now, decided
2
+ * `approval` in a manifest. Tool approvals are the Tenant's tool policy now, decided
3
3
  * at the Runtime's Tool Gate for every harness: `PUT /v1/tenant/tool-policy`, a rule with
4
4
  * `effect: "ask"`. So `PUT /v1/agents/:id` and a turn's manifest refuse a definition that sets
5
5
  * `approval` on an HTTP tool, an MCP server or an MCP tool's settings, and the SDK refuses it
@@ -29,6 +29,8 @@ export interface DefinitionPart {
29
29
  readonly skills?: Readonly<Record<string, SkillManifest>>;
30
30
  /** Each skill file's bytes, by `sha256:<hex>`. Not a manifest field. */
31
31
  readonly skillFiles?: Readonly<Record<string, SkillFileSource>>;
32
+ /** The secret slots each skill's scripts read, by skill name. Not a manifest field. */
33
+ readonly skillSecrets?: Readonly<Record<string, readonly string[]>>;
32
34
  readonly mcpServers?: Readonly<Record<string, McpServerManifest>>;
33
35
  readonly sandbox?: SandboxManifest;
34
36
  }
@@ -32,7 +32,7 @@ interface BuilderSnapshot {
32
32
  readonly metadata?: JsonObject;
33
33
  readonly outputSchema?: ToolSchemaSource;
34
34
  readonly inputSchema?: ToolSchemaSource;
35
- /** What the agent needs of its session's Environment (D65). */
35
+ /** What the agent needs of its session's Environment. */
36
36
  readonly requires?: AgentRequirements;
37
37
  readonly entries: readonly DefinitionPart[];
38
38
  /** Builder-level problems, reported with the assembly diagnostics. */
@@ -101,7 +101,7 @@ export declare class AgentBuilder<Info = unknown, Schema extends ToolSchemaSourc
101
101
  /** The structured output. Set once. */
102
102
  output<S extends ToolSchemaSource>(schema: S): AgentBuilder<Info, S, Id>;
103
103
  /**
104
- * What the agent needs of the Environment its session opens on (protocol 14, D65): a sandbox
104
+ * What the agent needs of the Environment its session opens on (protocol 14): a sandbox
105
105
  * (`any` or `pod`) and secret names its skills' scripts read. A session whose Environment lacks
106
106
  * them is refused when it opens. The agent still names no Environment. Set once.
107
107
  */
@@ -145,7 +145,7 @@ export class AgentBuilder {
145
145
  return this.spawn({ ...snapshot, outputSchema: schema });
146
146
  }
147
147
  /**
148
- * What the agent needs of the Environment its session opens on (protocol 14, D65): a sandbox
148
+ * What the agent needs of the Environment its session opens on (protocol 14): a sandbox
149
149
  * (`any` or `pod`) and secret names its skills' scripts read. A session whose Environment lacks
150
150
  * them is refused when it opens. The agent still names no Environment. Set once.
151
151
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Tools that would run the developer's code (track R2 M6): an agent's own tool with no `http`
2
+ * Tools that would run the developer's code: an agent's own tool with no `http`
3
3
  * and no `agent`, and a flow agent's `tool` stage without `http`. The tools in a pinned
4
4
  * manifest's `runtime` block are the Runtime's own. The
5
5
  * Runtime runs agents from their manifests alone, so `PUT /v1/agents/:id` refuses a definition
@@ -20,6 +20,9 @@ export function compileDeclaration(declaration) {
20
20
  ...(declaration.skillFiles === undefined || Object.keys(declaration.skillFiles).length === 0
21
21
  ? {}
22
22
  : { skillFiles: declaration.skillFiles }),
23
+ ...(declaration.skillSecrets === undefined || Object.keys(declaration.skillSecrets).length === 0
24
+ ? {}
25
+ : { skillSecrets: declaration.skillSecrets }),
23
26
  ...(declaration.mcpServers === undefined || Object.keys(declaration.mcpServers).length === 0
24
27
  ? {}
25
28
  : { mcpServers: declaration.mcpServers }),
@@ -21,7 +21,7 @@ export declare function isFlowDelegate(delegate: Delegate): delegate is Delegate
21
21
  readonly manifest: WorkflowManifest;
22
22
  };
23
23
  /**
24
- * The longest tool name every model provider accepts (R2b C6, Q14): OpenAI's and Anthropic's
24
+ * The longest tool name every model provider accepts: OpenAI's and Anthropic's
25
25
  * `^[a-zA-Z0-9_-]{1,64}$`. A provider's ceiling, not a setting.
26
26
  */
27
27
  export declare const MODEL_TOOL_NAME_MAX = 64;
@@ -9,7 +9,7 @@ export function isFlowDelegate(delegate) {
9
9
  return delegate.manifest.kind === "workflow";
10
10
  }
11
11
  /**
12
- * The longest tool name every model provider accepts (R2b C6, Q14): OpenAI's and Anthropic's
12
+ * The longest tool name every model provider accepts: OpenAI's and Anthropic's
13
13
  * `^[a-zA-Z0-9_-]{1,64}$`. A provider's ceiling, not a setting.
14
14
  */
15
15
  export const MODEL_TOOL_NAME_MAX = 64;
@@ -7,12 +7,12 @@ export interface SessionToolRef {
7
7
  readonly name: string;
8
8
  /**
9
9
  * Text the model reads while the tool is advertised, such as `tool_search`'s note of the
10
- * servers whose tools are deferred (R2b C10). Not hashed.
10
+ * servers whose tools are deferred. Not hashed.
11
11
  */
12
12
  readonly instructions?: readonly string[];
13
13
  }
14
14
  /**
15
- * Rebuild an agent from its manifest and the code of its tools, by name (T28). Agents used as
15
+ * Rebuild an agent from its manifest and the code of its tools, by name. Agents used as
16
16
  * tools and HTTP tools need no code. A session tool (`sessionTools`) is offered in the session
17
17
  * part, after the agent's own, with `sessionInstructions` (text not tied to one tool) before its
18
18
  * tools' own; it needs its code, and its name may not be one of the agent's tools.
@@ -7,7 +7,7 @@ import { httpToolFromManifest, httpToolOf } from "./http-tool.js";
7
7
  import { SESSION_PART_ID } from "./manifest.js";
8
8
  import { AgentManifestSchema } from "../contracts.js";
9
9
  /**
10
- * Rebuild an agent from its manifest and the code of its tools, by name (T28). Agents used as
10
+ * Rebuild an agent from its manifest and the code of its tools, by name. Agents used as
11
11
  * tools and HTTP tools need no code. A session tool (`sessionTools`) is offered in the session
12
12
  * part, after the agent's own, with `sessionInstructions` (text not tied to one tool) before its
13
13
  * tools' own; it needs its code, and its name may not be one of the agent's tools.
@@ -1,8 +1,8 @@
1
1
  /**
2
- * HTTP tools (R2 M3): a tool the manifest describes as one HTTP request, which the Runtime makes
2
+ * HTTP tools: a tool the manifest describes as one HTTP request, which the Runtime makes
3
3
  * itself through its Tool Gate. No developer code runs for it: the tool value carries its target
4
4
  * (`http`) into the manifest, and its `execute` only says where it runs. Whether a call waits for
5
- * a person is the Tenant's tool policy, decided at the Tool Gate (R5 step 2), never the tool's.
5
+ * a person is the Tenant's tool policy, decided at the Tool Gate, never the tool's.
6
6
  * An HTTP tool is also a flow stage. `http({ url })` without a name and an input is a bare
7
7
  * target, a Loop's HTTP verifier: its manifest form is itself, `{ http: { url, … } }`.
8
8
  *
@@ -29,7 +29,7 @@ export declare const HTTP_TOOL_DEFAULT_TIMEOUT_MS = 60000;
29
29
  export interface HttpTool {
30
30
  readonly http: HttpToolTarget;
31
31
  /**
32
- * @deprecated A pinned manifest's `approval`, from before R5 step 2: kept so the rebuilt
32
+ * @deprecated A pinned manifest's `approval`, from before the Tenant's tool policy: kept so the rebuilt
33
33
  * definition hashes as pinned, and held by the Tool Gate. Nothing asks for it here, and
34
34
  * `http()` refuses it.
35
35
  */
@@ -14,17 +14,17 @@ export declare class McpError extends Error {
14
14
  export declare function stdioMcpRefusal(name: string): string;
15
15
  /** Validate a map of MCP servers and fill each `name` from its key. */
16
16
  export declare function normalizeMcpServers(servers: Readonly<Record<string, McpServerSpec>>, caller?: string): Readonly<Record<string, McpServerManifest>>;
17
- /** The key of an MCP server's `tools` map that sets every tool without an entry (R2b C9). */
17
+ /** The key of an MCP server's `tools` map that sets every tool without an entry. */
18
18
  export declare const MCP_TOOL_DEFAULTS = "*";
19
- /** A tool's settings once resolved (R2b C9): its entry, then `"*"`, then the server, then the default. */
19
+ /** A tool's settings once resolved: its entry, then `"*"`, then the server, then the default. */
20
20
  export interface ResolvedMcpToolSettings {
21
21
  readonly enabled: boolean;
22
22
  readonly approval: ApprovalMode;
23
- /** Undefined: nothing sets it, and the harness decides (R2b C10, automatic deferral). */
23
+ /** Undefined: nothing sets it, and the harness decides (automatic deferral). */
24
24
  readonly deferred?: boolean;
25
25
  }
26
26
  /**
27
- * The settings of the server's tool named `serverToolName` (its own name, before C6 renaming):
27
+ * The settings of the server's tool named `serverToolName` (its own name, before renaming):
28
28
  * from the tool's entry in `tools`, then the `"*"` entry, then the server, then the default
29
29
  * (enabled, approval `never`, deferral automatic).
30
30
  */
@@ -40,10 +40,10 @@ export function normalizeMcpServers(servers, caller = "mcp()") {
40
40
  }
41
41
  return Object.freeze(mcpServers);
42
42
  }
43
- /** The key of an MCP server's `tools` map that sets every tool without an entry (R2b C9). */
43
+ /** The key of an MCP server's `tools` map that sets every tool without an entry. */
44
44
  export const MCP_TOOL_DEFAULTS = "*";
45
45
  /**
46
- * The settings of the server's tool named `serverToolName` (its own name, before C6 renaming):
46
+ * The settings of the server's tool named `serverToolName` (its own name, before renaming):
47
47
  * from the tool's entry in `tools`, then the `"*"` entry, then the server, then the default
48
48
  * (enabled, approval `never`, deferral automatic).
49
49
  */
@@ -91,7 +91,7 @@ function isMcpServer(value) {
91
91
  (value.tools === undefined || isToolSettingsMap(value.tools)));
92
92
  return false;
93
93
  }
94
- /** A server, or one of its tools' settings, that sets `approval` (removed in R5 step 2). */
94
+ /** A server, or one of its tools' settings, that sets `approval` (removed with the Tenant's tool policy). */
95
95
  function setsApproval(server) {
96
96
  if (server.approval !== undefined)
97
97
  return true;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Agent manifest v8's two sections against each other (protocol 16, track T2). The Runtime sees
2
+ * Agent manifest v8's two sections against each other (protocol 16). The Runtime sees
3
3
  * both sections when a manifest is saved, so it checks there what `requires` used to check when a
4
4
  * session opened: every gap is named in one `422 manifest_inconsistent`, and a dry run reports
5
5
  * them as plan errors. The CLI and the SDK run the same checks while they compose the files.
@@ -34,9 +34,10 @@ export declare function runtimeOf(manifest: Pick<AgentManifestV8, "runtime">): R
34
34
  * order. Empty when they fit:
35
35
  *
36
36
  * 1. A custom harness (`harness.id` not `nylorun`) needs `runtime.kind` `pod` with an `image`.
37
- * 2. Every credential the harness names is a declared slot of the right type: an MCP server's or
38
- * HTTP tool's `credential` a `bearer` or `headers` slot bound to its URL, a skill's `secrets`
39
- * `environment_secret` or `environment_variable` slots.
37
+ * 2. Every credential the harness names is a declared slot of the right type: an MCP server's,
38
+ * HTTP tool's, flow HTTP stage's or HTTP verifier's `credential` (an embedded agent's too) a
39
+ * `bearer` or `headers` slot bound to its URL, a skill's `secrets` `environment_secret` or
40
+ * `environment_variable` slots.
40
41
  * 3. The runtime's kind gives the harness the sandbox it needs (`sandboxNeedOf`).
41
42
  */
42
43
  export declare function sectionGaps(manifest: Pick<AgentManifestV8, "harness" | "runtime">): string[];
@@ -1,4 +1,5 @@
1
1
  import { DEFAULT_HARNESS } from "../utils/harness-id.js";
2
+ import { forEachFlowNode } from "./flow/paths.js";
2
3
  export function isWorkflowHarness(harness) {
3
4
  return harness.kind === "workflow";
4
5
  }
@@ -68,9 +69,10 @@ export function runtimeOf(manifest) {
68
69
  * order. Empty when they fit:
69
70
  *
70
71
  * 1. A custom harness (`harness.id` not `nylorun`) needs `runtime.kind` `pod` with an `image`.
71
- * 2. Every credential the harness names is a declared slot of the right type: an MCP server's or
72
- * HTTP tool's `credential` a `bearer` or `headers` slot bound to its URL, a skill's `secrets`
73
- * `environment_secret` or `environment_variable` slots.
72
+ * 2. Every credential the harness names is a declared slot of the right type: an MCP server's,
73
+ * HTTP tool's, flow HTTP stage's or HTTP verifier's `credential` (an embedded agent's too) a
74
+ * `bearer` or `headers` slot bound to its URL, a skill's `secrets` `environment_secret` or
75
+ * `environment_variable` slots.
74
76
  * 3. The runtime's kind gives the harness the sandbox it needs (`sandboxNeedOf`).
75
77
  */
76
78
  export function sectionGaps(manifest) {
@@ -102,13 +104,34 @@ export function sectionGaps(manifest) {
102
104
  if (want === undefined || normalizeCredentialUrl(slot.url) !== want)
103
105
  gaps.push(`${where} ${quoted(name)} is bound to ${slot.url}, not to ${what}'s URL ${url}`);
104
106
  };
105
- if (!isWorkflowHarness(harness)) {
107
+ // The Tool Gate sends an HTTP target's `credential` from the vault by that name, wherever the
108
+ // target sits: an agent's HTTP tool, a flow's HTTP stage or HTTP verifier, or one of an
109
+ // embedded agent's.
110
+ const agentTools = (tools, at) => {
111
+ for (const tool of tools ?? []) {
112
+ if (tool.http?.credential !== undefined)
113
+ urlSlot(`${at}.tools.${tool.name}.http.credential`, tool.http.credential, tool.http.url, "an HTTP tool");
114
+ if (tool.agent !== undefined)
115
+ embedded(tool.agent, `${at}.tools.${tool.name}.agent`);
116
+ }
117
+ };
118
+ const flowStages = (flow, at) => {
119
+ forEachFlowNode(flow.root, ({ node, key, role }) => {
120
+ const http = "http" in node ? node.http : "tool" in node ? node.tool.http : undefined;
121
+ if (http?.credential !== undefined)
122
+ urlSlot(`${at}.root stage ${quoted(key)} http.credential`, http.credential, http.url, role === "verify" ? "an HTTP verifier" : "an HTTP stage");
123
+ });
124
+ for (const [id, agent] of Object.entries(flow.agents))
125
+ embedded(agent, `${at}.agents.${id}`);
126
+ };
127
+ const embedded = (agent, at) => "kind" in agent ? flowStages(agent, at) : agentTools(agent.tools, at);
128
+ if (isWorkflowHarness(harness))
129
+ flowStages(harness, "harness");
130
+ else {
106
131
  for (const [key, server] of Object.entries(harness.mcpServers ?? {}))
107
132
  if (server.credential !== undefined)
108
133
  urlSlot(`harness.mcpServers.${key}.credential`, server.credential, server.url, "an MCP server");
109
- for (const tool of harness.tools ?? [])
110
- if (tool.http?.credential !== undefined)
111
- urlSlot(`harness.tools.${tool.name}.http.credential`, tool.http.credential, tool.http.url, "an HTTP tool");
134
+ agentTools(harness.tools, "harness");
112
135
  for (const [key, skill] of Object.entries(harness.skills ?? {}))
113
136
  for (const name of skill.secrets ?? []) {
114
137
  const slot = slots[name];
@@ -2,7 +2,7 @@ import type { AgentManifest } from "../types/manifest.js";
2
2
  /**
3
3
  * Whether `candidate` is a valid turn-manifest variant of the session's pinned manifest
4
4
  * (`loops.md` §3.4). A variant may remove tools (agents used as tools and HTTP tools included),
5
- * tighten its MCP servers' tool settings (R2b C9, Q18), and change its instructions, name,
5
+ * tighten its MCP servers' tool settings, and change its instructions, name,
6
6
  * description and metadata. Its skills and servers are setup: the sandbox holds the skills from
7
7
  * the session's start.
8
8
  */
@@ -19,10 +19,10 @@ function removeOnlyTools(pinned, candidate) {
19
19
  return true;
20
20
  }
21
21
  /**
22
- * One tool setting, or the `"*"` entry, only tightened (R2b C9, Q18): `enabled` kept or set to
22
+ * One tool setting, or the `"*"` entry, only tightened: `enabled` kept or set to
23
23
  * `false`, `approval` and `deferred` kept. Each level of a tool's resolution (its entry, then
24
24
  * `"*"`) either keeps its value or tightens it, so the tool does too. A variant adds no
25
- * approval: tool approvals are the Tenant's tool policy (R5 step 2).
25
+ * approval: tool approvals are the Tenant's tool policy.
26
26
  */
27
27
  function tightensSettings(prior, next) {
28
28
  return ((next.enabled === prior?.enabled || next.enabled === false) &&
@@ -31,7 +31,7 @@ function tightensSettings(prior, next) {
31
31
  }
32
32
  /**
33
33
  * The servers of a turn variant: the pinned ones, the same but for their `tools` maps, where a
34
- * variant may only disable a tool (R2b C9, Q18). An entry the pin has
34
+ * variant may only disable a tool. An entry the pin has
35
35
  * stays, since dropping one could widen.
36
36
  */
37
37
  function tightensServers(pinned, candidate) {
@@ -56,7 +56,7 @@ function tightensServers(pinned, candidate) {
56
56
  /**
57
57
  * Whether `candidate` is a valid turn-manifest variant of the session's pinned manifest
58
58
  * (`loops.md` §3.4). A variant may remove tools (agents used as tools and HTTP tools included),
59
- * tighten its MCP servers' tool settings (R2b C9, Q18), and change its instructions, name,
59
+ * tighten its MCP servers' tool settings, and change its instructions, name,
60
60
  * description and metadata. Its skills and servers are setup: the sandbox holds the skills from
61
61
  * the session's start.
62
62
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * What a harness writes into the session's record besides its effects (R4.5): transcript
2
+ * What a harness writes into the session's record besides its effects: transcript
3
3
  * entries, and the effect id rule replays depend on.
4
4
  *
5
5
  * Transcript. A session's transcript is shared by every turn: a run reads it once
@@ -1,5 +1,5 @@
1
1
  /**
2
- * What a harness writes into the session's record besides its effects (R4.5): transcript
2
+ * What a harness writes into the session's record besides its effects: transcript
3
3
  * entries, and the effect id rule replays depend on.
4
4
  *
5
5
  * Transcript. A session's transcript is shared by every turn: a run reads it once
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The gates a harness calls (R4.5): the Model Gate and the Tool Gate, on the gateway's port. A
2
+ * The gates a harness calls: the Model Gate and the Tool Gate, on the gateway's port. A
3
3
  * harness never holds a model or tool credential: it presents the run token of the run it holds
4
4
  * (`RunGrant.token`) as `Authorization: Bearer`, and the gate takes the session, turn and agent
5
5
  * from the token. Every call is keyed by its effect id, sent as `Idempotency-Key`: a re-send
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The gates a harness calls (R4.5): the Model Gate and the Tool Gate, on the gateway's port. A
2
+ * The gates a harness calls: the Model Gate and the Tool Gate, on the gateway's port. A
3
3
  * harness never holds a model or tool credential: it presents the run token of the run it holds
4
4
  * (`RunGrant.token`) as `Authorization: Bearer`, and the gate takes the session, turn and agent
5
5
  * from the token. Every call is keyed by its effect id, sent as `Idempotency-Key`: a re-send
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The Harness API as one JSON Schema document (R4.5, Q4), generated from the same zod schemas the
2
+ * The Harness API as one JSON Schema document, generated from the same zod schemas the
3
3
  * Runtime validates with, so a harness written in another language validates against what core
4
4
  * enforces. The build writes it to `dist/harness-api/harness-api.schema.json`
5
5
  * (`@nylorun/core/harness-api/schema.json`). `$defs` holds every published schema by name, and
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The Harness API as one JSON Schema document (R4.5, Q4), generated from the same zod schemas the
2
+ * The Harness API as one JSON Schema document, generated from the same zod schemas the
3
3
  * Runtime validates with, so a harness written in another language validates against what core
4
4
  * enforces. The build writes it to `dist/harness-api/harness-api.schema.json`
5
5
  * (`@nylorun/core/harness-api/schema.json`). `$defs` holds every published schema by name, and
@@ -42,7 +42,7 @@ export const McpSnapshotSchema = z.object({
42
42
  });
43
43
  /** One tool of a server, as a turn sees it. */
44
44
  export const McpToolFactSchema = McpToolRecordSchema.extend({
45
- /** False when the turn's manifest disables it (R2b C9): the record refuses its calls. */
45
+ /** False when the turn's manifest disables it: the record refuses its calls. */
46
46
  enabled: z.boolean(),
47
47
  /** The manifest's `deferred` setting of the tool; absent, the harness decides. */
48
48
  deferred: z.boolean().optional(),
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Harness API v4 (blueprint D37–D42; the harness boundary, protocol 15): the messages between
2
+ * Harness API v4 (the harness boundary, protocol 15): the messages between
3
3
  * core and a harness. A run is a lease on one session's segment; core records, the harness runs
4
4
  * the engine. Who executes what: the harness runs model, MCP, HTTP and sandbox calls and its own
5
5
  * tools (our engine's skill, artifact and deferred-tool tools among them, over the
@@ -43,7 +43,7 @@ export type EffectIntent = z.infer<typeof EffectIntentSchema>;
43
43
  export type EffectTarget = z.infer<typeof EffectTargetSchema>;
44
44
  /** The Environment a turn runs in (`turn.start.environment`, protocol 15). */
45
45
  export type TurnAgent = z.infer<typeof TurnAgentSchema>;
46
- /** The Agent's memory as a turn starts (`turn.start.memory`, track T5). */
46
+ /** The Agent's memory as a turn starts (`turn.start.memory`). */
47
47
  export type TurnMemory = z.infer<typeof TurnMemorySchema>;
48
48
  /** An artifact as the artifact seam shows it to a harness (`artifact.read`, `artifact.write`). */
49
49
  export type ArtifactMeta = z.infer<typeof ArtifactMetaSchema>;
@@ -60,11 +60,11 @@ export type ArtifactWriteResult = ResultOf<"artifact.write">;
60
60
  export type CompactionFacts = z.infer<typeof CompactionFactsSchema>;
61
61
  /** A completed outcome of the segment, with the hash of the request it answered. */
62
62
  export type RecordedOutcome = z.infer<typeof RecordedOutcomeSchema>;
63
- /** The lease on one run. `token` is the run token (F5) when the gates require one. */
63
+ /** The lease on one run. `token` is the run token when the gates require one. */
64
64
  export type RunGrant = z.infer<typeof RunGrantSchema>;
65
65
  /** Where a harness sends the session's tool calls. */
66
66
  export type RunRouting = z.infer<typeof RunRoutingSchema>;
67
- /** W3C trace context a turn carries (R4.10). */
67
+ /** W3C trace context a turn carries. */
68
68
  export type TraceContext = z.infer<typeof TraceContextSchema>;
69
69
  /** The model a turn's calls use when they name none (`turn.start.model`, protocol 15). */
70
70
  export type ModelDescriptor = z.infer<typeof ModelDescriptorSchema>;
@@ -88,9 +88,9 @@ export type WorkspaceSession = z.infer<typeof WorkspaceSessionSchema>;
88
88
  export type WorkspaceRecord = z.infer<typeof WorkspaceRecordSchema>;
89
89
  /** A sandbox tool call core sends to the harness that serves workspaces. */
90
90
  export type WorkspaceCall = z.infer<typeof WorkspaceCallSchema>;
91
- /** One operation on a workspace's disk (R2d step 3). */
91
+ /** One operation on a workspace's disk. */
92
92
  export type WorkspaceDiskCall = z.infer<typeof WorkspaceDiskCallSchema>;
93
- /** Requests core sends to a harness that declared `workspace` (F6.2), with their answers. */
93
+ /** Requests core sends to a harness that declared `workspace`, with their answers. */
94
94
  export type CoreRequests = RequestTypes<typeof coreRequests>;
95
95
  /** Messages core sends to a harness, without an answer. */
96
96
  export type CoreMessages = {
@@ -255,7 +255,7 @@ export declare const WorkspaceCallSchema: z.ZodObject<{
255
255
  input: z.ZodUnknown;
256
256
  }, z.core.$strict>;
257
257
  /**
258
- * One operation on the disk of a workspace (R2d step 3): `list` its entries (files with mode and
258
+ * One operation on the disk of a workspace: `list` its entries (files with mode and
259
259
  * modification time, links, empty directories; paths relative to the volume, `workspace/…` and
260
260
  * in a pod `harness/…`), `read` a range of one file (answered `{kind: "read", base64, eof}`),
261
261
  * `clear` it (the engine's own files stay), or `put` entries back in order. A `workspace.read`
@@ -323,7 +323,7 @@ export declare const WorkspaceDiskCallSchema: z.ZodObject<{
323
323
  }, z.core.$strict>>;
324
324
  }, z.core.$strict>]>;
325
325
  }, z.core.$strict>;
326
- /** The lease on one run. `token` is the run token (F5) when the gates require one. */
326
+ /** The lease on one run. `token` is the run token when the gates require one. */
327
327
  export declare const RunGrantSchema: z.ZodObject<{
328
328
  runId: z.ZodString;
329
329
  sessionId: z.ZodString;
@@ -343,7 +343,7 @@ export declare const RunRoutingSchema: z.ZodObject<{
343
343
  }, z.core.$strict>>;
344
344
  }, z.core.$strict>;
345
345
  /**
346
- * The fields of `TurnStart.checkpoint` a harness reads (R4.2); the rest are our engine's. An
346
+ * The fields of `TurnStart.checkpoint` a harness reads; the rest are our engine's. An
347
347
  * agent turn's `input` is the turn's message: a string, `{text, metadata?}`, `{content,
348
348
  * metadata?}` with user content parts, `{kind: "messages", messages}` for messages that waited in
349
349
  * the session's queue (protocol 17: each one of the shapes before, each its own user message, in
@@ -409,7 +409,7 @@ export declare const TurnAgentSchema: z.ZodObject<{
409
409
  selfWake: z.ZodOptional<z.ZodBoolean>;
410
410
  }, z.core.$strict>;
411
411
  /**
412
- * The Agent's memory as a turn starts (track T5, D72), present when the version its session runs
412
+ * The Agent's memory as a turn starts, present when the version its session runs
413
413
  * sets `harness.memory`: its access in every turn, the agent's own `instructions`, and the index a
414
414
  * harness pins in the session (one line per memory, newest first, with its description, within
415
415
  * the Runtime limits `memoryIndexLines` and `memoryIndexBytes`; `truncated` when some were left
@@ -632,7 +632,7 @@ export type RequestTypes<Schemas extends RequestSchemas> = {
632
632
  /** Requests a harness sends to core, with their answers. */
633
633
  export declare const harnessRequests: {
634
634
  /**
635
- * `features.workspace` declares that the harness serves the Tenant's workspaces (F6.2):
635
+ * `features.workspace` declares that the harness serves the Tenant's workspaces:
636
636
  * core then sends it the `workspace.*` requests. The answer names the Tenant (its workspace
637
637
  * keys are scoped by it) and the sandbox backend preference the harness selects with.
638
638
  */
@@ -967,7 +967,7 @@ export declare const harnessRequests: {
967
967
  }, z.core.$strict>;
968
968
  };
969
969
  /**
970
- * A definition file's bytes, base64 (track R2 M4): one the run's definition names, for the
970
+ * A definition file's bytes, base64: one the run's definition names, for the
971
971
  * skills its sandbox mounts. With `offset` and `length` (at most `turn.start.limits.chunkBytes`,
972
972
  * its default without `length`; more is `limit_exceeded`), only those bytes: fewer than
973
973
  * `length`, none past the end, once the file ends. Without them the whole file, which must then
@@ -1358,7 +1358,7 @@ export declare const harnessRequests: {
1358
1358
  };
1359
1359
  };
1360
1360
  /**
1361
- * Requests core sends to a harness that declared `workspace` (F6.2), with their answers. A
1361
+ * Requests core sends to a harness that declared `workspace`, with their answers. A
1362
1362
  * sandbox tool's answer is its `SandboxToolOutcome`; the harness claims its `environment.*` events
1363
1363
  * while the request is in flight.
1364
1364
  */
@@ -83,8 +83,8 @@ export const EffectTargetSchema = z.discriminatedUnion("kind", [
83
83
  z.object({ kind: z.literal("harness") }).strict(),
84
84
  /**
85
85
  * An operation the Runtime itself serves, in the transaction that journals the call, keyed by
86
- * the effect id (track T4): `schedule_wake` books the session's next turn (D77); `memory` (track
87
- * T5, D72) is a call of the `memory` tool, with Anthropic's memory tool parameters as its input,
86
+ * the effect id: `schedule_wake` books the session's next turn; `memory` is a
87
+ * call of the `memory` tool, with Anthropic's memory tool parameters as its input,
88
88
  * on the Agent's memories. Answered at once; the harness never executes it.
89
89
  */
90
90
  z.object({ kind: z.literal("runtime"), operation: z.enum(["schedule_wake", "memory"]) }).strict(),
@@ -188,7 +188,7 @@ export const WorkspaceCallSchema = z
188
188
  })
189
189
  .strict();
190
190
  /**
191
- * One operation on the disk of a workspace (R2d step 3): `list` its entries (files with mode and
191
+ * One operation on the disk of a workspace: `list` its entries (files with mode and
192
192
  * modification time, links, empty directories; paths relative to the volume, `workspace/…` and
193
193
  * in a pod `harness/…`), `read` a range of one file (answered `{kind: "read", base64, eof}`),
194
194
  * `clear` it (the engine's own files stay), or `put` entries back in order. A `workspace.read`
@@ -227,7 +227,7 @@ export const DiskOpSchema = z.union([
227
227
  export const WorkspaceDiskCallSchema = z
228
228
  .object({ session: WorkspaceSessionSchema, spec: z.unknown(), disk: DiskOpSchema })
229
229
  .strict();
230
- /** The lease on one run. `token` is the run token (F5) when the gates require one. */
230
+ /** The lease on one run. `token` is the run token when the gates require one. */
231
231
  export const RunGrantSchema = z
232
232
  .object({
233
233
  runId: id,
@@ -254,7 +254,7 @@ export const RunRoutingSchema = z
254
254
  environmentId: id.optional(),
255
255
  spec: z.unknown().optional(),
256
256
  /**
257
- * Variables every sandbox command gets (R2c, D50): each `environment_secret` name set to
257
+ * Variables every sandbox command gets: each `environment_secret` name set to
258
258
  * the sentinel `nylorun_managed`, and each `environment_variable`'s value. Never a secret.
259
259
  */
260
260
  environment: z.record(z.string(), z.string()).optional(),
@@ -264,7 +264,7 @@ export const RunRoutingSchema = z
264
264
  })
265
265
  .strict();
266
266
  /**
267
- * The fields of `TurnStart.checkpoint` a harness reads (R4.2); the rest are our engine's. An
267
+ * The fields of `TurnStart.checkpoint` a harness reads; the rest are our engine's. An
268
268
  * agent turn's `input` is the turn's message: a string, `{text, metadata?}`, `{content,
269
269
  * metadata?}` with user content parts, `{kind: "messages", messages}` for messages that waited in
270
270
  * the session's queue (protocol 17: each one of the shapes before, each its own user message, in
@@ -321,14 +321,14 @@ export const TurnAgentSchema = z
321
321
  /** Present when the session has a sandbox. */
322
322
  sandbox: z.object({ workspace: z.string().regex(/^\//) }).strict().optional(),
323
323
  /**
324
- * The version the session runs sets `runtime.selfWake` (track T4, D77): our engine offers
324
+ * The version the session runs sets `runtime.selfWake`: our engine offers
325
325
  * `schedule_wake`, a `runtime` effect.
326
326
  */
327
327
  selfWake: z.boolean().optional(),
328
328
  })
329
329
  .strict();
330
330
  /**
331
- * The Agent's memory as a turn starts (track T5, D72), present when the version its session runs
331
+ * The Agent's memory as a turn starts, present when the version its session runs
332
332
  * sets `harness.memory`: its access in every turn, the agent's own `instructions`, and the index a
333
333
  * harness pins in the session (one line per memory, newest first, with its description, within
334
334
  * the Runtime limits `memoryIndexLines` and `memoryIndexBytes`; `truncated` when some were left
@@ -361,7 +361,7 @@ export const TurnStartSchema = z
361
361
  * passes on without reading. Ours reads none yet.
362
362
  */
363
363
  loop: document.optional(),
364
- /** The Agent's memory (track T5), when the version its session runs sets `harness.memory`. Absent for a flow. */
364
+ /** The Agent's memory, when the version its session runs sets `harness.memory`. Absent for a flow. */
365
365
  memory: TurnMemorySchema.optional(),
366
366
  /** The segment's checkpoint; an agent's state has no transcript (`transcript.cursor`). */
367
367
  checkpoint: document,
@@ -382,14 +382,14 @@ export const TurnStartSchema = z
382
382
  flowLimits: z.unknown().optional(),
383
383
  /**
384
384
  * Informational: the Tenant answers model calls with the fixture model. The Model Gate
385
- * answers them itself (R4.3), so a harness calls the gate as for any model.
385
+ * answers them itself, so a harness calls the gate as for any model.
386
386
  */
387
387
  fixtureModel: z.boolean(),
388
388
  })
389
389
  .strict(),
390
390
  routing: RunRoutingSchema,
391
391
  /**
392
- * The turn's trace context (R4.10), when the Runtime traces: a harness may send it as
392
+ * The turn's trace context, when the Runtime traces: a harness may send it as
393
393
  * `traceparent` on its gate calls and as `TRACEPARENT` to the processes it starts, so its own
394
394
  * spans join the turn's trace. The Runtime never ingests a harness's spans.
395
395
  */
@@ -449,7 +449,7 @@ export const IntentAnswerSchema = z.union([
449
449
  status: z.literal("execute"),
450
450
  rejoin: z.literal(true).optional(),
451
451
  /**
452
- * The call's span context (R7.4), for a tool call: a harness hands it on as `TRACEPARENT`
452
+ * The call's span context, for a tool call: a harness hands it on as `TRACEPARENT`
453
453
  * to the command it runs, so the command's own spans join the call's.
454
454
  */
455
455
  traceparent: TraceContextSchema.shape.traceparent.optional(),
@@ -466,7 +466,7 @@ const outcomeObject = z.record(z.string(), z.unknown());
466
466
  /** Requests a harness sends to core, with their answers. */
467
467
  export const harnessRequests = {
468
468
  /**
469
- * `features.workspace` declares that the harness serves the Tenant's workspaces (F6.2):
469
+ * `features.workspace` declares that the harness serves the Tenant's workspaces:
470
470
  * core then sends it the `workspace.*` requests. The answer names the Tenant (its workspace
471
471
  * keys are scoped by it) and the sandbox backend preference the harness selects with.
472
472
  */
@@ -537,7 +537,7 @@ export const harnessRequests = {
537
537
  result: z.object({ mcp: McpFactsSchema.optional() }).strict(),
538
538
  },
539
539
  /**
540
- * A definition file's bytes, base64 (track R2 M4): one the run's definition names, for the
540
+ * A definition file's bytes, base64: one the run's definition names, for the
541
541
  * skills its sandbox mounts. With `offset` and `length` (at most `turn.start.limits.chunkBytes`,
542
542
  * its default without `length`; more is `limit_exceeded`), only those bytes: fewer than
543
543
  * `length`, none past the end, once the file ends. Without them the whole file, which must then
@@ -678,7 +678,7 @@ export const harnessRequests = {
678
678
  z
679
679
  .object({
680
680
  status: z.literal("refused"),
681
- /** The total a folder version would pass: the Tenant's, or the session's Environment's. */
681
+ /** The total a folder version would pass: the Tenant's, or the session's Agent's. */
682
682
  reason: z.enum(["tenant_total", "environment_total"]),
683
683
  message: z.string(),
684
684
  limit: z.number().int().nonnegative(),
@@ -695,7 +695,7 @@ export const harnessRequests = {
695
695
  checkpoint: { params: TurnOutputSchema, result: settled },
696
696
  };
697
697
  /**
698
- * Requests core sends to a harness that declared `workspace` (F6.2), with their answers. A
698
+ * Requests core sends to a harness that declared `workspace`, with their answers. A
699
699
  * sandbox tool's answer is its `SandboxToolOutcome`; the harness claims its `environment.*` events
700
700
  * while the request is in flight.
701
701
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Transcript edits (blueprint P0.3): a segment's transcript changes are recorded as
2
+ * Transcript edits: a segment's transcript changes are recorded as
3
3
  * `transcript.updated` events, each an edit of the transcript before it. Shared by core, which
4
4
  * records and folds them, and a harness, which computes them and keeps its cache with them.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * How a harness reaches core (R4.5). Three version numbers apply, and each moves on its own:
2
+ * How a harness reaches core. Three version numbers apply, and each moves on its own:
3
3
  *
4
4
  * - the transport: path `/nylorun/harness/v1` and header `Nylorun-Harness-Api: 1`, for the
5
5
  * WebSocket and its frames (`FrameSchema`), one JSON text message per frame;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * How a harness reaches core (R4.5). Three version numbers apply, and each moves on its own:
2
+ * How a harness reaches core. Three version numbers apply, and each moves on its own:
3
3
  *
4
4
  * - the transport: path `/nylorun/harness/v1` and header `Nylorun-Harness-Api: 1`, for the
5
5
  * WebSocket and its frames (`FrameSchema`), one JSON text message per frame;