@nylorun/core 0.23.0-beta → 0.24.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.
- package/CHANGELOG.md +24 -0
- package/dist/compatibility.d.ts +96 -39
- package/dist/compatibility.js +97 -40
- package/dist/contracts.d.ts +2316 -842
- package/dist/contracts.js +1010 -407
- package/dist/define.d.ts +1 -0
- package/dist/define.js +1 -0
- package/dist/definition/removed.d.ts +7 -0
- package/dist/definition/removed.js +21 -1
- package/dist/definition/sections.d.ts +63 -0
- package/dist/definition/sections.js +204 -0
- package/dist/harness-api/harness-api.schema.json +182 -6
- package/dist/harness-api/index.d.ts +3 -3
- package/dist/harness-api/index.js +3 -3
- package/dist/harness-api/json-schema.js +2 -2
- package/dist/harness-api/messages.d.ts +5 -3
- package/dist/harness-api/messages.js +1 -1
- package/dist/harness-api/schema.d.ts +76 -7
- package/dist/harness-api/schema.js +52 -8
- package/dist/manifest-schemas.d.ts +9 -5
- package/dist/manifest-schemas.js +23 -27
- package/dist/schemas/agent-manifest.schema.json +1534 -250
- package/dist/schemas/harness-manifest.schema.json +1273 -0
- package/dist/schemas/{environment-manifest.schema.json → runtime-manifest.schema.json} +109 -68
- package/dist/types/manifest.d.ts +69 -1
- package/dist/types/manifest.js +4 -0
- package/dist/types/model.d.ts +5 -0
- package/dist/utils/memory.d.ts +64 -0
- package/dist/utils/memory.js +139 -0
- package/dist/utils/runtime-limits.d.ts +53 -2
- package/dist/utils/runtime-limits.js +104 -1
- package/package.json +6 -5
package/dist/define.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export { bindTool } from "./definition/bind-tool.js";
|
|
|
44
44
|
export { bindOutputContract } from "./definition/output-contract.js";
|
|
45
45
|
export type { TurnOutputContract } from "./definition/output-contract.js";
|
|
46
46
|
export { agentFrom } from "./definition/from.js";
|
|
47
|
+
export { harnessIdOf, harnessSectionOf, isWorkflowHarness, kindMeets, loopManifestOf, normalizeCredentialUrl, pluginsOf, runtimeOf, sandboxNeedOf, sectionGaps, type SandboxNeed, } from "./definition/sections.js";
|
|
47
48
|
export { mediaReferenceOf, type MediaReference } from "./definition/media-reference.js";
|
|
48
49
|
export type { SessionToolRef } from "./definition/from.js";
|
|
49
50
|
export { schemaFromJSON } from "./definition/schema-json.js";
|
package/dist/define.js
CHANGED
|
@@ -23,6 +23,7 @@ export { isVariantOf } from "./definition/variant.js";
|
|
|
23
23
|
export { bindTool } from "./definition/bind-tool.js";
|
|
24
24
|
export { bindOutputContract } from "./definition/output-contract.js";
|
|
25
25
|
export { agentFrom } from "./definition/from.js";
|
|
26
|
+
export { harnessIdOf, harnessSectionOf, isWorkflowHarness, kindMeets, loopManifestOf, normalizeCredentialUrl, pluginsOf, runtimeOf, sandboxNeedOf, sectionGaps, } from "./definition/sections.js";
|
|
26
27
|
export { mediaReferenceOf } from "./definition/media-reference.js";
|
|
27
28
|
export { schemaFromJSON } from "./definition/schema-json.js";
|
|
28
29
|
export { normalizeSchema } from "./definition/schema.js";
|
|
@@ -6,3 +6,10 @@ export declare const REMOVED_MANIFEST_FIELDS: Readonly<Record<string, string>>;
|
|
|
6
6
|
export declare function manifestVersionIssue(version: unknown): string | undefined;
|
|
7
7
|
/** Why a workflow manifest with this `workflowSchemaVersion` is refused, or undefined for version 3. */
|
|
8
8
|
export declare function workflowVersionIssue(version: unknown): string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Why an agent manifest with this `manifestSchemaVersion` is refused at
|
|
11
|
+
* `/v1/agent-manifests/{name}` (protocol 16), or undefined for version 8.
|
|
12
|
+
*/
|
|
13
|
+
export declare function agentManifestVersionIssue(version: unknown): string | undefined;
|
|
14
|
+
/** Fields an environment manifest had that the runtime section of agent manifest v8 refuses. */
|
|
15
|
+
export declare const REMOVED_RUNTIME_SECTION_FIELDS: Readonly<Record<string, string>>;
|
|
@@ -9,7 +9,7 @@ export const REMOVED_MANIFEST_FIELDS = Object.freeze({
|
|
|
9
9
|
model: "Manifest must not include top-level model; Runtime owns model resolution",
|
|
10
10
|
hooks: "hooks were removed: the Runtime runs agents from their manifests alone. Use an HTTP tool, the Tenant's tool policy, or a loop verifier instead (see MIGRATION.md)",
|
|
11
11
|
capabilities: "Manifest v7 has no capabilities: the agent's instructions, tools, skills and mcpServers are top-level fields. Rebuild the agent with the current SDK (see MIGRATION.md)",
|
|
12
|
-
runtime: "
|
|
12
|
+
runtime: "This is a pre-v8 runtime block: since protocol 15 the harness writes the model's instructions and defines the sandbox and skill tools. In agent manifest v8, runtime is a top-level section beside harness and says what the Runtime provides (see MIGRATION.md)",
|
|
13
13
|
});
|
|
14
14
|
/** Why a manifest with this `manifestSchemaVersion` is refused, or undefined for version 7. */
|
|
15
15
|
export function manifestVersionIssue(version) {
|
|
@@ -27,3 +27,23 @@ export function workflowVersionIssue(version) {
|
|
|
27
27
|
return `workflowSchemaVersion ${version} is no longer supported: flows run no code since manifest v5 (no input, on, verify or decide functions). Rebuild the flow with the current SDK (see MIGRATION.md)`;
|
|
28
28
|
return `Unsupported workflowSchemaVersion ${String(version)}`;
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Why an agent manifest with this `manifestSchemaVersion` is refused at
|
|
32
|
+
* `/v1/agent-manifests/{name}` (protocol 16), or undefined for version 8.
|
|
33
|
+
*/
|
|
34
|
+
export function agentManifestVersionIssue(version) {
|
|
35
|
+
if (version === 8)
|
|
36
|
+
return undefined;
|
|
37
|
+
if (version === 7)
|
|
38
|
+
return "manifestSchemaVersion 7 is no longer saved: agent manifest v8 holds a harness and a runtime section. Rebuild it with nylorun migrate v8 (see MIGRATION.md)";
|
|
39
|
+
if (typeof version === "number" && version >= 3 && version <= 6)
|
|
40
|
+
return `manifestSchemaVersion ${version} is no longer supported. Rebuild the agent with the current SDK, then run nylorun migrate v8 (see MIGRATION.md)`;
|
|
41
|
+
return `Unsupported manifestSchemaVersion ${String(version)}: use 8`;
|
|
42
|
+
}
|
|
43
|
+
/** Fields an environment manifest had that the runtime section of agent manifest v8 refuses. */
|
|
44
|
+
export const REMOVED_RUNTIME_SECTION_FIELDS = Object.freeze({
|
|
45
|
+
harness: "runtime.harness moved to harness.id in agent manifest v8: the harness section names the harness that runs the loop",
|
|
46
|
+
manifestSchemaVersion: "manifestSchemaVersion belongs at the top of the agent manifest, not in runtime",
|
|
47
|
+
name: "name belongs at the top of the agent manifest, not in runtime",
|
|
48
|
+
description: "description belongs at the top of the agent manifest, not in runtime",
|
|
49
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent manifest v8's two sections against each other (protocol 16, track T2). The Runtime sees
|
|
3
|
+
* both sections when a manifest is saved, so it checks there what `requires` used to check when a
|
|
4
|
+
* session opened: every gap is named in one `422 manifest_inconsistent`, and a dry run reports
|
|
5
|
+
* them as plan errors. The CLI and the SDK run the same checks while they compose the files.
|
|
6
|
+
*/
|
|
7
|
+
import type { AgentManifestV8, RuntimeSection } from "../contracts.js";
|
|
8
|
+
import type { AgentHarnessSection, AgentManifest, HarnessSection, WorkflowHarnessSection } from "../types/manifest.js";
|
|
9
|
+
import type { WorkflowManifest } from "../types/workflow.js";
|
|
10
|
+
/** What the loop needs of the runtime: a pod, any sandbox (`virtual` or `pod`), or nothing. */
|
|
11
|
+
export type SandboxNeed = "pod" | "sandbox" | "none";
|
|
12
|
+
export declare function isWorkflowHarness(harness: HarnessSection): harness is WorkflowHarnessSection;
|
|
13
|
+
/** The harness that runs the loop: `harness.id`, else ours. */
|
|
14
|
+
export declare function harnessIdOf(harness: HarnessSection): string;
|
|
15
|
+
/**
|
|
16
|
+
* What the harness section needs of the runtime, derived rather than declared: a custom harness
|
|
17
|
+
* needs a pod (it runs from the pod's image); skills need a sandbox to be mounted in; otherwise
|
|
18
|
+
* nothing.
|
|
19
|
+
*/
|
|
20
|
+
export declare function sandboxNeedOf(harness: HarnessSection): SandboxNeed;
|
|
21
|
+
/** Whether a runtime of `kind` gives the loop what it needs. */
|
|
22
|
+
export declare function kindMeets(kind: RuntimeSection["kind"], need: SandboxNeed): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* A credential URL as the vault compares it: origin, path and query, with the default port and
|
|
25
|
+
* no fragment. Undefined for a URL the vault would refuse. The vault binds a `bearer` or
|
|
26
|
+
* `headers` credential to one URL and sends it to a server or HTTP tool declared at exactly that
|
|
27
|
+
* URL, so a slot covers a server when the two normalize the same.
|
|
28
|
+
*/
|
|
29
|
+
export declare function normalizeCredentialUrl(input: string): string | undefined;
|
|
30
|
+
/** The runtime section an Agent made from `manifest` has: `kind: "none"` when it is absent. */
|
|
31
|
+
export declare function runtimeOf(manifest: Pick<AgentManifestV8, "runtime">): RuntimeSection;
|
|
32
|
+
/**
|
|
33
|
+
* Every gap between the harness and runtime sections, worded for a person, in the manifest's
|
|
34
|
+
* order. Empty when they fit:
|
|
35
|
+
*
|
|
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.
|
|
40
|
+
* 3. The runtime's kind gives the harness the sandbox it needs (`sandboxNeedOf`).
|
|
41
|
+
*/
|
|
42
|
+
export declare function sectionGaps(manifest: Pick<AgentManifestV8, "harness" | "runtime">): string[];
|
|
43
|
+
/**
|
|
44
|
+
* The loop manifest the harness runs for a version of an agent manifest: the harness section
|
|
45
|
+
* with the manifest's name as its id, in the shape the engine reads (agent manifest v7, workflow
|
|
46
|
+
* manifest v3). The fields only the Runtime reads (`credential`, a skill's `secrets`, `plugins`,
|
|
47
|
+
* `loop`, the harness id) stay out.
|
|
48
|
+
*/
|
|
49
|
+
export declare function loopManifestOf(manifest: Pick<AgentManifestV8, "name" | "description" | "metadata" | "harness">): AgentManifest | WorkflowManifest;
|
|
50
|
+
/**
|
|
51
|
+
* The harness section a loop manifest makes (an SDK-built agent or flow, or a v7 manifest being
|
|
52
|
+
* migrated): its loop fields, without its identity, which the agent manifest holds. A v7
|
|
53
|
+
* manifest's `requires.secrets` become no skill's: the composer asks for them by name.
|
|
54
|
+
*/
|
|
55
|
+
export declare function harnessSectionOf(loop: AgentManifest | WorkflowManifest, options?: {
|
|
56
|
+
harness?: string;
|
|
57
|
+
plugins?: AgentHarnessSection["plugins"];
|
|
58
|
+
}): HarnessSection;
|
|
59
|
+
/** The Agent Plugins whose labels a loop manifest's skills and servers carry, each once, by name. */
|
|
60
|
+
export declare function pluginsOf(loop: AgentManifest | WorkflowManifest): {
|
|
61
|
+
name: string;
|
|
62
|
+
version?: string;
|
|
63
|
+
}[];
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { DEFAULT_HARNESS } from "../utils/harness-id.js";
|
|
2
|
+
export function isWorkflowHarness(harness) {
|
|
3
|
+
return harness.kind === "workflow";
|
|
4
|
+
}
|
|
5
|
+
/** The harness that runs the loop: `harness.id`, else ours. */
|
|
6
|
+
export function harnessIdOf(harness) {
|
|
7
|
+
return harness.id ?? DEFAULT_HARNESS;
|
|
8
|
+
}
|
|
9
|
+
/** Whether a loop manifest, or any agent it embeds or delegates to, carries skills. */
|
|
10
|
+
function hasSkills(manifest) {
|
|
11
|
+
if ("kind" in manifest)
|
|
12
|
+
return Object.values(manifest.agents).some(hasSkills);
|
|
13
|
+
if (Object.keys(manifest.skills ?? {}).length > 0)
|
|
14
|
+
return true;
|
|
15
|
+
return (manifest.tools ?? []).some((tool) => tool.agent !== undefined && hasSkills(tool.agent));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* What the harness section needs of the runtime, derived rather than declared: a custom harness
|
|
19
|
+
* needs a pod (it runs from the pod's image); skills need a sandbox to be mounted in; otherwise
|
|
20
|
+
* nothing.
|
|
21
|
+
*/
|
|
22
|
+
export function sandboxNeedOf(harness) {
|
|
23
|
+
if (harnessIdOf(harness) !== DEFAULT_HARNESS)
|
|
24
|
+
return "pod";
|
|
25
|
+
if (isWorkflowHarness(harness))
|
|
26
|
+
return Object.values(harness.agents).some(hasSkills) ? "sandbox" : "none";
|
|
27
|
+
if (Object.keys(harness.skills ?? {}).length > 0)
|
|
28
|
+
return "sandbox";
|
|
29
|
+
return (harness.tools ?? []).some((tool) => tool.agent !== undefined && hasSkills(tool.agent)) ? "sandbox" : "none";
|
|
30
|
+
}
|
|
31
|
+
/** Whether a runtime of `kind` gives the loop what it needs. */
|
|
32
|
+
export function kindMeets(kind, need) {
|
|
33
|
+
if (need === "pod")
|
|
34
|
+
return kind === "pod";
|
|
35
|
+
if (need === "sandbox")
|
|
36
|
+
return kind === "virtual" || kind === "pod";
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A credential URL as the vault compares it: origin, path and query, with the default port and
|
|
41
|
+
* no fragment. Undefined for a URL the vault would refuse. The vault binds a `bearer` or
|
|
42
|
+
* `headers` credential to one URL and sends it to a server or HTTP tool declared at exactly that
|
|
43
|
+
* URL, so a slot covers a server when the two normalize the same.
|
|
44
|
+
*/
|
|
45
|
+
export function normalizeCredentialUrl(input) {
|
|
46
|
+
let url;
|
|
47
|
+
try {
|
|
48
|
+
url = new URL(input);
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
if (url.username !== "" || url.password !== "" || url.hash !== "")
|
|
54
|
+
return undefined;
|
|
55
|
+
if (url.protocol !== "https:" && url.protocol !== "http:")
|
|
56
|
+
return undefined;
|
|
57
|
+
if ((url.protocol === "https:" && url.port === "443") || (url.protocol === "http:" && url.port === "80"))
|
|
58
|
+
url.port = "";
|
|
59
|
+
return `${url.origin}${url.pathname}${url.search}`;
|
|
60
|
+
}
|
|
61
|
+
const quoted = (value) => JSON.stringify(value);
|
|
62
|
+
/** The runtime section an Agent made from `manifest` has: `kind: "none"` when it is absent. */
|
|
63
|
+
export function runtimeOf(manifest) {
|
|
64
|
+
return manifest.runtime ?? { kind: "none" };
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Every gap between the harness and runtime sections, worded for a person, in the manifest's
|
|
68
|
+
* order. Empty when they fit:
|
|
69
|
+
*
|
|
70
|
+
* 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.
|
|
74
|
+
* 3. The runtime's kind gives the harness the sandbox it needs (`sandboxNeedOf`).
|
|
75
|
+
*/
|
|
76
|
+
export function sectionGaps(manifest) {
|
|
77
|
+
const { harness } = manifest;
|
|
78
|
+
const runtime = runtimeOf(manifest);
|
|
79
|
+
const gaps = [];
|
|
80
|
+
const kindText = manifest.runtime === undefined ? "the manifest has no runtime section" : `the runtime is ${quoted(runtime.kind)}`;
|
|
81
|
+
// 1. A custom harness runs from its pod's image.
|
|
82
|
+
const harnessId = harnessIdOf(harness);
|
|
83
|
+
if (harnessId !== DEFAULT_HARNESS) {
|
|
84
|
+
if (runtime.kind !== "pod")
|
|
85
|
+
gaps.push(`harness.id ${quoted(harnessId)} needs runtime.kind "pod"; ${kindText}`);
|
|
86
|
+
else if (runtime.image === undefined)
|
|
87
|
+
gaps.push(`harness.id ${quoted(harnessId)} needs runtime.image: a custom harness runs from its pod's image`);
|
|
88
|
+
}
|
|
89
|
+
// 2. Credentials name declared slots of the right type.
|
|
90
|
+
const slots = runtime.secrets ?? {};
|
|
91
|
+
const urlSlot = (where, name, url, what) => {
|
|
92
|
+
const slot = slots[name];
|
|
93
|
+
if (slot === undefined) {
|
|
94
|
+
gaps.push(`${where} ${quoted(name)} is not a secret slot in runtime.secrets`);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (slot.type !== "bearer" && slot.type !== "headers") {
|
|
98
|
+
gaps.push(`${where} ${quoted(name)} is a slot of type ${slot.type}; ${what} needs a bearer or headers slot`);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const want = normalizeCredentialUrl(url);
|
|
102
|
+
if (want === undefined || normalizeCredentialUrl(slot.url) !== want)
|
|
103
|
+
gaps.push(`${where} ${quoted(name)} is bound to ${slot.url}, not to ${what}'s URL ${url}`);
|
|
104
|
+
};
|
|
105
|
+
if (!isWorkflowHarness(harness)) {
|
|
106
|
+
for (const [key, server] of Object.entries(harness.mcpServers ?? {}))
|
|
107
|
+
if (server.credential !== undefined)
|
|
108
|
+
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");
|
|
112
|
+
for (const [key, skill] of Object.entries(harness.skills ?? {}))
|
|
113
|
+
for (const name of skill.secrets ?? []) {
|
|
114
|
+
const slot = slots[name];
|
|
115
|
+
if (slot === undefined)
|
|
116
|
+
gaps.push(`harness.skills.${key}.secrets ${quoted(name)} is not a secret slot in runtime.secrets`);
|
|
117
|
+
else if (slot.type !== "environment_secret" && slot.type !== "environment_variable")
|
|
118
|
+
gaps.push(`harness.skills.${key}.secrets ${quoted(name)} is a slot of type ${slot.type}; a skill reads environment_secret or environment_variable slots`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// 3. The sandbox the loop needs. A custom harness's pod is gap 1.
|
|
122
|
+
const need = sandboxNeedOf(harness);
|
|
123
|
+
if (need === "sandbox" && !kindMeets(runtime.kind, need)) {
|
|
124
|
+
const what = isWorkflowHarness(harness) ? "harness.agents carry skills, which need" : "harness.skills needs";
|
|
125
|
+
gaps.push(manifest.runtime === undefined
|
|
126
|
+
? `${what} a sandbox; the manifest has no runtime section, so an Agent made from it has none`
|
|
127
|
+
: `${what} a sandbox; runtime.kind ${quoted(runtime.kind)} has none`);
|
|
128
|
+
}
|
|
129
|
+
return gaps;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The loop manifest the harness runs for a version of an agent manifest: the harness section
|
|
133
|
+
* with the manifest's name as its id, in the shape the engine reads (agent manifest v7, workflow
|
|
134
|
+
* manifest v3). The fields only the Runtime reads (`credential`, a skill's `secrets`, `plugins`,
|
|
135
|
+
* `loop`, the harness id) stay out.
|
|
136
|
+
*/
|
|
137
|
+
export function loopManifestOf(manifest) {
|
|
138
|
+
const { harness } = manifest;
|
|
139
|
+
const identity = {
|
|
140
|
+
id: manifest.name,
|
|
141
|
+
...(manifest.description === undefined ? {} : { description: manifest.description }),
|
|
142
|
+
...(manifest.metadata === undefined ? {} : { metadata: manifest.metadata }),
|
|
143
|
+
};
|
|
144
|
+
if (isWorkflowHarness(harness))
|
|
145
|
+
return {
|
|
146
|
+
kind: "workflow",
|
|
147
|
+
workflowSchemaVersion: 3,
|
|
148
|
+
...identity,
|
|
149
|
+
...(harness.inputSchema === undefined ? {} : { inputSchema: harness.inputSchema }),
|
|
150
|
+
...(harness.outputSchema === undefined ? {} : { outputSchema: harness.outputSchema }),
|
|
151
|
+
root: harness.root,
|
|
152
|
+
agents: harness.agents,
|
|
153
|
+
};
|
|
154
|
+
const skills = Object.entries(harness.skills ?? {}).map(([key, { secrets: _, ...skill }]) => [key, skill]);
|
|
155
|
+
const servers = Object.entries(harness.mcpServers ?? {}).map(([key, { credential: _, ...server }]) => [key, server]);
|
|
156
|
+
return {
|
|
157
|
+
manifestSchemaVersion: 7,
|
|
158
|
+
...identity,
|
|
159
|
+
...(harness.outputSchema === undefined ? {} : { outputSchema: harness.outputSchema }),
|
|
160
|
+
...(harness.instructions === undefined ? {} : { instructions: harness.instructions }),
|
|
161
|
+
...(harness.tools === undefined ? {} : { tools: harness.tools }),
|
|
162
|
+
...(skills.length === 0 ? {} : { skills: Object.fromEntries(skills) }),
|
|
163
|
+
...(servers.length === 0 ? {} : { mcpServers: Object.fromEntries(servers) }),
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* The harness section a loop manifest makes (an SDK-built agent or flow, or a v7 manifest being
|
|
168
|
+
* migrated): its loop fields, without its identity, which the agent manifest holds. A v7
|
|
169
|
+
* manifest's `requires.secrets` become no skill's: the composer asks for them by name.
|
|
170
|
+
*/
|
|
171
|
+
export function harnessSectionOf(loop, options = {}) {
|
|
172
|
+
const plugins = options.plugins ?? pluginsOf(loop);
|
|
173
|
+
const extra = {
|
|
174
|
+
...(options.harness === undefined || options.harness === DEFAULT_HARNESS ? {} : { id: options.harness }),
|
|
175
|
+
...(plugins.length === 0 ? {} : { plugins }),
|
|
176
|
+
};
|
|
177
|
+
if ("kind" in loop)
|
|
178
|
+
return {
|
|
179
|
+
kind: "workflow",
|
|
180
|
+
...extra,
|
|
181
|
+
...(loop.inputSchema === undefined ? {} : { inputSchema: loop.inputSchema }),
|
|
182
|
+
...(loop.outputSchema === undefined ? {} : { outputSchema: loop.outputSchema }),
|
|
183
|
+
root: loop.root,
|
|
184
|
+
agents: loop.agents,
|
|
185
|
+
};
|
|
186
|
+
return {
|
|
187
|
+
...extra,
|
|
188
|
+
...(loop.instructions === undefined ? {} : { instructions: loop.instructions }),
|
|
189
|
+
...(loop.tools === undefined ? {} : { tools: loop.tools }),
|
|
190
|
+
...(loop.skills === undefined ? {} : { skills: loop.skills }),
|
|
191
|
+
...(loop.mcpServers === undefined ? {} : { mcpServers: loop.mcpServers }),
|
|
192
|
+
...(loop.outputSchema === undefined ? {} : { outputSchema: loop.outputSchema }),
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
/** The Agent Plugins whose labels a loop manifest's skills and servers carry, each once, by name. */
|
|
196
|
+
export function pluginsOf(loop) {
|
|
197
|
+
if ("kind" in loop)
|
|
198
|
+
return [];
|
|
199
|
+
const byName = new Map();
|
|
200
|
+
for (const item of [...Object.values(loop.skills ?? {}), ...Object.values(loop.mcpServers ?? {})])
|
|
201
|
+
if (item.plugin !== undefined && !byName.has(item.plugin.name))
|
|
202
|
+
byName.set(item.plugin.name, { ...item.plugin });
|
|
203
|
+
return [...byName.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
204
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://docs.nylorun.com/schemas/harness-api/
|
|
4
|
-
"title": "Nylorun Harness API
|
|
3
|
+
"$id": "https://docs.nylorun.com/schemas/harness-api/v5.json",
|
|
4
|
+
"title": "Nylorun Harness API 5",
|
|
5
5
|
"$defs": {
|
|
6
6
|
"ArtifactMeta": {
|
|
7
7
|
"type": "object",
|
|
@@ -179,6 +179,27 @@
|
|
|
179
179
|
"kind"
|
|
180
180
|
],
|
|
181
181
|
"additionalProperties": false
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"type": "object",
|
|
185
|
+
"properties": {
|
|
186
|
+
"kind": {
|
|
187
|
+
"type": "string",
|
|
188
|
+
"const": "runtime"
|
|
189
|
+
},
|
|
190
|
+
"operation": {
|
|
191
|
+
"type": "string",
|
|
192
|
+
"enum": [
|
|
193
|
+
"schedule_wake",
|
|
194
|
+
"memory"
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
"required": [
|
|
199
|
+
"kind",
|
|
200
|
+
"operation"
|
|
201
|
+
],
|
|
202
|
+
"additionalProperties": false
|
|
182
203
|
}
|
|
183
204
|
]
|
|
184
205
|
},
|
|
@@ -600,10 +621,31 @@
|
|
|
600
621
|
"kind"
|
|
601
622
|
],
|
|
602
623
|
"additionalProperties": false
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
"type": "object",
|
|
627
|
+
"properties": {
|
|
628
|
+
"kind": {
|
|
629
|
+
"type": "string",
|
|
630
|
+
"const": "runtime"
|
|
631
|
+
},
|
|
632
|
+
"operation": {
|
|
633
|
+
"type": "string",
|
|
634
|
+
"enum": [
|
|
635
|
+
"schedule_wake",
|
|
636
|
+
"memory"
|
|
637
|
+
]
|
|
638
|
+
}
|
|
639
|
+
},
|
|
640
|
+
"required": [
|
|
641
|
+
"kind",
|
|
642
|
+
"operation"
|
|
643
|
+
],
|
|
644
|
+
"additionalProperties": false
|
|
603
645
|
}
|
|
604
646
|
]
|
|
605
647
|
},
|
|
606
|
-
"
|
|
648
|
+
"TurnAgent": {
|
|
607
649
|
"type": "object",
|
|
608
650
|
"properties": {
|
|
609
651
|
"id": {
|
|
@@ -631,6 +673,9 @@
|
|
|
631
673
|
"workspace"
|
|
632
674
|
],
|
|
633
675
|
"additionalProperties": false
|
|
676
|
+
},
|
|
677
|
+
"selfWake": {
|
|
678
|
+
"type": "boolean"
|
|
634
679
|
}
|
|
635
680
|
},
|
|
636
681
|
"required": [
|
|
@@ -1106,6 +1151,58 @@
|
|
|
1106
1151
|
},
|
|
1107
1152
|
"additionalProperties": {}
|
|
1108
1153
|
},
|
|
1154
|
+
"definition": {
|
|
1155
|
+
"type": "object",
|
|
1156
|
+
"properties": {
|
|
1157
|
+
"name": {
|
|
1158
|
+
"type": "string"
|
|
1159
|
+
},
|
|
1160
|
+
"version": {
|
|
1161
|
+
"type": "integer",
|
|
1162
|
+
"exclusiveMinimum": 0,
|
|
1163
|
+
"maximum": 9007199254740991
|
|
1164
|
+
}
|
|
1165
|
+
},
|
|
1166
|
+
"required": [
|
|
1167
|
+
"name",
|
|
1168
|
+
"version"
|
|
1169
|
+
],
|
|
1170
|
+
"additionalProperties": false
|
|
1171
|
+
},
|
|
1172
|
+
"loop": {
|
|
1173
|
+
"type": "object",
|
|
1174
|
+
"propertyNames": {
|
|
1175
|
+
"type": "string"
|
|
1176
|
+
},
|
|
1177
|
+
"additionalProperties": {}
|
|
1178
|
+
},
|
|
1179
|
+
"memory": {
|
|
1180
|
+
"type": "object",
|
|
1181
|
+
"properties": {
|
|
1182
|
+
"access": {
|
|
1183
|
+
"type": "string",
|
|
1184
|
+
"enum": [
|
|
1185
|
+
"read_write",
|
|
1186
|
+
"read_only"
|
|
1187
|
+
]
|
|
1188
|
+
},
|
|
1189
|
+
"instructions": {
|
|
1190
|
+
"type": "string"
|
|
1191
|
+
},
|
|
1192
|
+
"index": {
|
|
1193
|
+
"type": "string"
|
|
1194
|
+
},
|
|
1195
|
+
"truncated": {
|
|
1196
|
+
"type": "boolean"
|
|
1197
|
+
}
|
|
1198
|
+
},
|
|
1199
|
+
"required": [
|
|
1200
|
+
"access",
|
|
1201
|
+
"index",
|
|
1202
|
+
"truncated"
|
|
1203
|
+
],
|
|
1204
|
+
"additionalProperties": false
|
|
1205
|
+
},
|
|
1109
1206
|
"checkpoint": {
|
|
1110
1207
|
"type": "object",
|
|
1111
1208
|
"propertyNames": {
|
|
@@ -1431,7 +1528,7 @@
|
|
|
1431
1528
|
],
|
|
1432
1529
|
"additionalProperties": false
|
|
1433
1530
|
},
|
|
1434
|
-
"
|
|
1531
|
+
"agent": {
|
|
1435
1532
|
"type": "object",
|
|
1436
1533
|
"properties": {
|
|
1437
1534
|
"id": {
|
|
@@ -1459,6 +1556,9 @@
|
|
|
1459
1556
|
"workspace"
|
|
1460
1557
|
],
|
|
1461
1558
|
"additionalProperties": false
|
|
1559
|
+
},
|
|
1560
|
+
"selfWake": {
|
|
1561
|
+
"type": "boolean"
|
|
1462
1562
|
}
|
|
1463
1563
|
},
|
|
1464
1564
|
"required": [
|
|
@@ -3134,7 +3234,7 @@
|
|
|
3134
3234
|
"properties": {
|
|
3135
3235
|
"api": {
|
|
3136
3236
|
"type": "number",
|
|
3137
|
-
"const":
|
|
3237
|
+
"const": 5
|
|
3138
3238
|
},
|
|
3139
3239
|
"tenantId": {
|
|
3140
3240
|
"type": "string",
|
|
@@ -3246,6 +3346,58 @@
|
|
|
3246
3346
|
},
|
|
3247
3347
|
"additionalProperties": {}
|
|
3248
3348
|
},
|
|
3349
|
+
"definition": {
|
|
3350
|
+
"type": "object",
|
|
3351
|
+
"properties": {
|
|
3352
|
+
"name": {
|
|
3353
|
+
"type": "string"
|
|
3354
|
+
},
|
|
3355
|
+
"version": {
|
|
3356
|
+
"type": "integer",
|
|
3357
|
+
"exclusiveMinimum": 0,
|
|
3358
|
+
"maximum": 9007199254740991
|
|
3359
|
+
}
|
|
3360
|
+
},
|
|
3361
|
+
"required": [
|
|
3362
|
+
"name",
|
|
3363
|
+
"version"
|
|
3364
|
+
],
|
|
3365
|
+
"additionalProperties": false
|
|
3366
|
+
},
|
|
3367
|
+
"loop": {
|
|
3368
|
+
"type": "object",
|
|
3369
|
+
"propertyNames": {
|
|
3370
|
+
"type": "string"
|
|
3371
|
+
},
|
|
3372
|
+
"additionalProperties": {}
|
|
3373
|
+
},
|
|
3374
|
+
"memory": {
|
|
3375
|
+
"type": "object",
|
|
3376
|
+
"properties": {
|
|
3377
|
+
"access": {
|
|
3378
|
+
"type": "string",
|
|
3379
|
+
"enum": [
|
|
3380
|
+
"read_write",
|
|
3381
|
+
"read_only"
|
|
3382
|
+
]
|
|
3383
|
+
},
|
|
3384
|
+
"instructions": {
|
|
3385
|
+
"type": "string"
|
|
3386
|
+
},
|
|
3387
|
+
"index": {
|
|
3388
|
+
"type": "string"
|
|
3389
|
+
},
|
|
3390
|
+
"truncated": {
|
|
3391
|
+
"type": "boolean"
|
|
3392
|
+
}
|
|
3393
|
+
},
|
|
3394
|
+
"required": [
|
|
3395
|
+
"access",
|
|
3396
|
+
"index",
|
|
3397
|
+
"truncated"
|
|
3398
|
+
],
|
|
3399
|
+
"additionalProperties": false
|
|
3400
|
+
},
|
|
3249
3401
|
"checkpoint": {
|
|
3250
3402
|
"type": "object",
|
|
3251
3403
|
"propertyNames": {
|
|
@@ -3571,7 +3723,7 @@
|
|
|
3571
3723
|
],
|
|
3572
3724
|
"additionalProperties": false
|
|
3573
3725
|
},
|
|
3574
|
-
"
|
|
3726
|
+
"agent": {
|
|
3575
3727
|
"type": "object",
|
|
3576
3728
|
"properties": {
|
|
3577
3729
|
"id": {
|
|
@@ -3599,6 +3751,9 @@
|
|
|
3599
3751
|
"workspace"
|
|
3600
3752
|
],
|
|
3601
3753
|
"additionalProperties": false
|
|
3754
|
+
},
|
|
3755
|
+
"selfWake": {
|
|
3756
|
+
"type": "boolean"
|
|
3602
3757
|
}
|
|
3603
3758
|
},
|
|
3604
3759
|
"required": [
|
|
@@ -3839,6 +3994,27 @@
|
|
|
3839
3994
|
"kind"
|
|
3840
3995
|
],
|
|
3841
3996
|
"additionalProperties": false
|
|
3997
|
+
},
|
|
3998
|
+
{
|
|
3999
|
+
"type": "object",
|
|
4000
|
+
"properties": {
|
|
4001
|
+
"kind": {
|
|
4002
|
+
"type": "string",
|
|
4003
|
+
"const": "runtime"
|
|
4004
|
+
},
|
|
4005
|
+
"operation": {
|
|
4006
|
+
"type": "string",
|
|
4007
|
+
"enum": [
|
|
4008
|
+
"schedule_wake",
|
|
4009
|
+
"memory"
|
|
4010
|
+
]
|
|
4011
|
+
}
|
|
4012
|
+
},
|
|
4013
|
+
"required": [
|
|
4014
|
+
"kind",
|
|
4015
|
+
"operation"
|
|
4016
|
+
],
|
|
4017
|
+
"additionalProperties": false
|
|
3842
4018
|
}
|
|
3843
4019
|
]
|
|
3844
4020
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `@nylorun/core/harness-api`: the public contract between core and a harness (Harness API
|
|
2
|
+
* `@nylorun/core/harness-api`: the public contract between core and a harness (Harness API 5).
|
|
3
3
|
* Everything a harness sends or reads has a schema here, and the Runtime validates with the same
|
|
4
4
|
* schemas, so these types are the enforced ones: the frames and messages (`schema.ts`), the
|
|
5
5
|
* transport and the pod join (`transport.ts`), the Model and Tool Gate bodies (`gates.ts`), the
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
* no I/O.
|
|
9
9
|
*
|
|
10
10
|
* Three version numbers apply: the transport (path and header, 1), the messages
|
|
11
|
-
* (`HARNESS_API_VERSION`,
|
|
11
|
+
* (`HARNESS_API_VERSION`, 5) and the Runtime protocol, which only the Runtime's own APIs carry.
|
|
12
12
|
*/
|
|
13
13
|
export * from "./messages.js";
|
|
14
14
|
export { HarnessApiError } from "./errors.js";
|
|
15
15
|
export { effectRequestHash, requestIdentity } from "./hash.js";
|
|
16
16
|
export { TranscriptFoldError, applyUpdate, applyUpdates, transcriptOf, transcriptUpdates, withTranscript, type TranscriptUpdate, } from "./transcript.js";
|
|
17
17
|
export { createChannel, memoryChannels, memoryPorts, type Frame, type HarnessChannel, type MemoryPortsOptions, type MessageListener, type Port, type RequestHandler, } from "./rpc.js";
|
|
18
|
-
export { ArtifactMetaSchema, CompactionFactsSchema, EffectIntentSchema, FrameSchema, HarnessCheckpointSchema, IntentAnswerSchema, ModelDescriptorSchema, EffectTargetSchema,
|
|
18
|
+
export { ArtifactMetaSchema, CompactionFactsSchema, EffectIntentSchema, FrameSchema, HarnessCheckpointSchema, IntentAnswerSchema, ModelDescriptorSchema, EffectTargetSchema, TurnAgentSchema, OutcomeAnswerSchema, RecordedOutcomeSchema, RunGrantSchema, RunRoutingSchema, TraceContextSchema, TranscriptUpdateSchema, TurnOutputSchema, TurnStartSchema, TurnMemorySchema, coreMessages, coreRequests, harnessRequests, validateFrame, validateMessage, validateParams, validateResult, } from "./schema.js";
|
|
19
19
|
export * from "./transport.js";
|
|
20
20
|
export * from "./gates.js";
|
|
21
21
|
export * from "./mcp.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `@nylorun/core/harness-api`: the public contract between core and a harness (Harness API
|
|
2
|
+
* `@nylorun/core/harness-api`: the public contract between core and a harness (Harness API 5).
|
|
3
3
|
* Everything a harness sends or reads has a schema here, and the Runtime validates with the same
|
|
4
4
|
* schemas, so these types are the enforced ones: the frames and messages (`schema.ts`), the
|
|
5
5
|
* transport and the pod join (`transport.ts`), the Model and Tool Gate bodies (`gates.ts`), the
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
* no I/O.
|
|
9
9
|
*
|
|
10
10
|
* Three version numbers apply: the transport (path and header, 1), the messages
|
|
11
|
-
* (`HARNESS_API_VERSION`,
|
|
11
|
+
* (`HARNESS_API_VERSION`, 5) and the Runtime protocol, which only the Runtime's own APIs carry.
|
|
12
12
|
*/
|
|
13
13
|
export * from "./messages.js";
|
|
14
14
|
export { HarnessApiError } from "./errors.js";
|
|
15
15
|
export { effectRequestHash, requestIdentity } from "./hash.js";
|
|
16
16
|
export { TranscriptFoldError, applyUpdate, applyUpdates, transcriptOf, transcriptUpdates, withTranscript, } from "./transcript.js";
|
|
17
17
|
export { createChannel, memoryChannels, memoryPorts, } from "./rpc.js";
|
|
18
|
-
export { ArtifactMetaSchema, CompactionFactsSchema, EffectIntentSchema, FrameSchema, HarnessCheckpointSchema, IntentAnswerSchema, ModelDescriptorSchema, EffectTargetSchema,
|
|
18
|
+
export { ArtifactMetaSchema, CompactionFactsSchema, EffectIntentSchema, FrameSchema, HarnessCheckpointSchema, IntentAnswerSchema, ModelDescriptorSchema, EffectTargetSchema, TurnAgentSchema, OutcomeAnswerSchema, RecordedOutcomeSchema, RunGrantSchema, RunRoutingSchema, TraceContextSchema, TranscriptUpdateSchema, TurnOutputSchema, TurnStartSchema, TurnMemorySchema, coreMessages, coreRequests, harnessRequests, validateFrame, validateMessage, validateParams, validateResult, } from "./schema.js";
|
|
19
19
|
export * from "./transport.js";
|
|
20
20
|
export * from "./gates.js";
|
|
21
21
|
export * from "./mcp.js";
|