@nylorun/core 0.52.0-beta → 0.54.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 +119 -98
- package/dist/compatibility.d.ts +39 -12
- package/dist/compatibility.js +37 -10
- package/dist/contracts.d.ts +126 -44
- package/dist/contracts.js +127 -69
- package/dist/define.d.ts +2 -2
- package/dist/define.js +1 -1
- package/dist/definition/bound.d.ts +3 -1
- package/dist/definition/declaration.js +1 -0
- package/dist/definition/delegate.d.ts +7 -4
- package/dist/definition/delegate.js +4 -3
- package/dist/definition/from.js +3 -1
- package/dist/definition/manifest.js +7 -1
- package/dist/definition/sections.d.ts +9 -8
- package/dist/definition/sections.js +13 -5
- package/dist/definition/variant.d.ts +2 -2
- package/dist/definition/variant.js +4 -4
- package/dist/definition/workflow/runnable.d.ts +1 -1
- package/dist/definition/workflow/runnable.js +1 -1
- package/dist/definition/workflow/verdict.d.ts +1 -1
- package/dist/definition/workflow/verdict.js +1 -1
- package/dist/engine/blocks.d.ts +2 -2
- package/dist/engine/blocks.js +3 -3
- package/dist/engine/explain.d.ts +1 -1
- package/dist/engine/explain.js +3 -3
- package/dist/engine/features.d.ts +1 -1
- package/dist/engine/features.js +1 -1
- package/dist/engine/index.d.ts +1 -1
- package/dist/engine/index.js +1 -1
- package/dist/engine/mcp.d.ts +4 -4
- package/dist/engine/mcp.js +4 -4
- package/dist/engine/names.d.ts +1 -1
- package/dist/engine/names.js +1 -1
- package/dist/engine/preview.d.ts +2 -2
- package/dist/engine/preview.js +1 -1
- package/dist/engine/projection.d.ts +3 -3
- package/dist/engine/projection.js +8 -8
- package/dist/engine/tools.d.ts +8 -8
- package/dist/engine/tools.js +7 -7
- package/dist/errors.d.ts +1 -1
- package/dist/folder/compile.d.ts +2 -2
- package/dist/folder/compile.js +111 -15
- package/dist/folder/decompile.js +7 -7
- package/dist/folder/engine.d.ts +8 -2
- package/dist/folder/engine.js +3 -3
- package/dist/folder/fix.js +1 -1
- package/dist/folder/flow.d.ts +1 -1
- package/dist/folder/flow.js +1 -1
- package/dist/folder/index.d.ts +4 -2
- package/dist/folder/index.js +4 -2
- package/dist/folder/migrate-v3.js +2 -2
- package/dist/folder/migrate-v4.d.ts +33 -0
- package/dist/folder/migrate-v4.js +207 -0
- package/dist/folder/nested.js +14 -6
- package/dist/folder/plugins.d.ts +13 -1
- package/dist/folder/plugins.js +49 -12
- package/dist/folder/schemas.js +29 -9
- package/dist/folder/subagent-files.d.ts +110 -0
- package/dist/folder/subagent-files.js +514 -0
- package/dist/folder/v3.d.ts +2 -2
- package/dist/folder/v3.js +2 -2
- package/dist/harness-api/artifacts.d.ts +1 -1
- package/dist/harness-api/json-schema.js +6 -6
- package/dist/harness-api/messages.d.ts +1 -1
- package/dist/harness-api/messages.js +1 -1
- package/dist/harness-api/schema.d.ts +2 -2
- package/dist/harness-api/schema.js +8 -8
- package/dist/manifest-schemas.js +9 -6
- package/dist/plugins/index.js +1 -1
- package/dist/schemas/agent-folder/agent-md.schema.json +67 -18
- package/dist/schemas/agent-manifest.schema.json +65 -2
- package/dist/schemas/harness-manifest.schema.json +55 -2
- package/dist/types/manifest.d.ts +32 -7
- package/dist/types/model.d.ts +3 -3
- package/dist/types/observe.d.ts +1 -1
- package/dist/types/part.d.ts +5 -3
- package/dist/types/transcript.d.ts +1 -1
- package/dist/utils/definition-files.d.ts +23 -0
- package/dist/utils/definition-files.js +50 -4
- package/dist/utils/memory.js +1 -1
- package/dist/utils/runtime-limits.d.ts +2 -2
- package/dist/utils/runtime-limits.js +3 -3
- package/package.json +1 -1
package/dist/types/model.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export interface ModelCandidate {
|
|
|
48
48
|
readonly usage?: ModelUsage;
|
|
49
49
|
readonly evidence?: ModelEvidence;
|
|
50
50
|
}
|
|
51
|
-
/** Why a model call failed in a known way
|
|
51
|
+
/** Why a model call failed in a known way. */
|
|
52
52
|
export type ModelFailureCode = "context_overflow" | "rate_limited" | "overloaded" | "timeout" | "transient" | "content_policy" | "auth" | "invalid_request" | "invalid_output"
|
|
53
53
|
/**
|
|
54
54
|
* The call holds a part the model or its provider API cannot take (protocol 15): a file kind
|
|
@@ -173,7 +173,7 @@ export type PromptContentPart = {
|
|
|
173
173
|
readonly name: string;
|
|
174
174
|
readonly args: JsonObject;
|
|
175
175
|
};
|
|
176
|
-
/** The provider, API and model that produced an assistant message
|
|
176
|
+
/** The provider, API and model that produced an assistant message. */
|
|
177
177
|
export interface ModelProducer {
|
|
178
178
|
readonly provider: string;
|
|
179
179
|
readonly api?: string;
|
|
@@ -216,7 +216,7 @@ export interface ModelAdapterContext {
|
|
|
216
216
|
readonly invocationId: string;
|
|
217
217
|
readonly signal: AbortSignal;
|
|
218
218
|
/**
|
|
219
|
-
* Set when the engine calls the model to summarize history
|
|
219
|
+
* Set when the engine calls the model to summarize history. Engine-internal:
|
|
220
220
|
* the call's effect says `purpose: "summary"`, and the compaction's facts go with its
|
|
221
221
|
* transcript edit.
|
|
222
222
|
*/
|
package/dist/types/observe.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface WorkflowErrorPayload {
|
|
|
9
9
|
readonly path?: string;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* LiveEvent payloads for workflow sessions
|
|
12
|
+
* LiveEvent payloads for workflow sessions.
|
|
13
13
|
*
|
|
14
14
|
* @deprecated Use the event catalog (`EVENT_CATALOG`, `SessionEventOf<"node.agent">` in
|
|
15
15
|
* `@nylorun/core/contracts`): it types the events the Runtime writes. `node.completed` is
|
package/dist/types/part.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentTool } from "./agent.js";
|
|
2
|
-
import type { McpServerManifest, SkillManifest } from "./manifest.js";
|
|
2
|
+
import type { McpServerManifest, PluginManifest, SkillManifest } from "./manifest.js";
|
|
3
3
|
import type { ToolDefinition } from "./tool.js";
|
|
4
4
|
/**
|
|
5
5
|
* The bytes of one skill file the manifest names (`SkillManifest.files`), held on the developer
|
|
@@ -10,8 +10,8 @@ export interface SkillFileSource {
|
|
|
10
10
|
readonly size: number;
|
|
11
11
|
read(): Promise<Uint8Array>;
|
|
12
12
|
/**
|
|
13
|
-
* The bytes as a stream, for a file too large to hold in memory (an org's skill of a gigabyte
|
|
14
|
-
*
|
|
13
|
+
* The bytes as a stream, for a file too large to hold in memory (an org's skill of a gigabyte).
|
|
14
|
+
* When present, the client's upload sends it instead of `read()`'s bytes. Each call
|
|
15
15
|
* opens a new stream.
|
|
16
16
|
*/
|
|
17
17
|
stream?(): ReadableStream<Uint8Array>;
|
|
@@ -33,4 +33,6 @@ export interface PartDeclaration<Info = unknown> {
|
|
|
33
33
|
*/
|
|
34
34
|
readonly skillSecrets?: Readonly<Record<string, readonly string[]>>;
|
|
35
35
|
readonly mcpServers?: Readonly<Record<string, McpServerManifest>>;
|
|
36
|
+
/** Agent Plugins mounted whole, with their `files`; the files' bytes are in `skillFiles`. */
|
|
37
|
+
readonly plugins?: readonly PluginManifest[];
|
|
36
38
|
}
|
|
@@ -63,7 +63,7 @@ export interface TranscriptFinalEntry {
|
|
|
63
63
|
readonly output: JsonValue;
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
|
-
* A summary that replaced the older part of the transcript
|
|
66
|
+
* A summary that replaced the older part of the transcript. It is always
|
|
67
67
|
* the first entry; the entries after it are the kept tail, sent verbatim.
|
|
68
68
|
*/
|
|
69
69
|
export interface TranscriptCompactionEntry {
|
|
@@ -25,10 +25,24 @@ export declare function skillFolderOf(skill: {
|
|
|
25
25
|
readonly name: string;
|
|
26
26
|
readonly files: Readonly<Record<string, string>>;
|
|
27
27
|
}): string;
|
|
28
|
+
/** Where a session's sandbox holds each mounted Agent Plugin's files, read-only: `/plugins/<name>@<hash>/`. */
|
|
29
|
+
export declare const PLUGINS_MOUNT = "/plugins";
|
|
30
|
+
/** The longest path of a file in a mounted plugin's folder, as `SKILL_FILE_PATH_MAX` is a skill's. */
|
|
31
|
+
export declare const PLUGIN_FILE_PATH_MAX: number;
|
|
32
|
+
/**
|
|
33
|
+
* The folder of a sandbox that holds one version of an Agent Plugin's files, read-only:
|
|
34
|
+
* `/plugins/<name>@<12 hex>`, the hex from the SHA-256 of its canonical file map, as `skillFolderOf`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function pluginFolderOf(plugin: {
|
|
37
|
+
readonly name: string;
|
|
38
|
+
readonly files: Readonly<Record<string, string>>;
|
|
39
|
+
}): string;
|
|
28
40
|
/** `sha256:<hex>`, the way a manifest names a definition file. */
|
|
29
41
|
export declare function isDefinitionFileHash(value: unknown): value is string;
|
|
30
42
|
/** Why `path` cannot name a file in a skill's folder, or undefined when it can. */
|
|
31
43
|
export declare function skillFilePathIssue(path: string): string | undefined;
|
|
44
|
+
/** Why `files` is not a mounted plugin's file map, or undefined when it is. */
|
|
45
|
+
export declare function pluginFilesIssue(files: unknown): string | undefined;
|
|
32
46
|
/** Why `files` is not a skill's file map, or undefined when it is. */
|
|
33
47
|
export declare function skillFilesIssue(files: unknown): string | undefined;
|
|
34
48
|
/**
|
|
@@ -36,6 +50,15 @@ export declare function skillFilesIssue(files: unknown): string | undefined;
|
|
|
36
50
|
* agents it uses as tools, and those of a flow's agents, as `sha256:<hex>`.
|
|
37
51
|
*/
|
|
38
52
|
export declare function definitionFilesOf(document: unknown, into?: Set<string>): Set<string>;
|
|
53
|
+
/**
|
|
54
|
+
* Every Agent Plugin a definition document mounts whole (a loop manifest's `plugins` with
|
|
55
|
+
* `files`): its agents', those of the agents it uses as tools, and those of a flow's agents. A
|
|
56
|
+
* plugin two agents carry comes once for each.
|
|
57
|
+
*/
|
|
58
|
+
export declare function mountedPluginsOf(document: unknown): Generator<{
|
|
59
|
+
readonly name?: unknown;
|
|
60
|
+
readonly files?: Readonly<Record<string, unknown>>;
|
|
61
|
+
}>;
|
|
39
62
|
/**
|
|
40
63
|
* Every skill a definition document carries, as written: its agents' skills, those of the agents
|
|
41
64
|
* it uses as tools, and those of a flow's agents. A skill two agents carry comes once for each.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Definition files: the files a definition names by content hash, uploaded once
|
|
3
|
-
* with `PUT /v1/files/sha256:<hex>` and held by the Runtime
|
|
4
|
-
*
|
|
3
|
+
* with `PUT /v1/files/sha256:<hex>` and held by the Runtime: the files of a skill's folder
|
|
4
|
+
* (`SkillManifest.files`), and those of an Agent Plugin mounted whole (`PluginManifest.files`).
|
|
5
|
+
* Shared by the SDK, the wire schema and the Runtime.
|
|
5
6
|
*/
|
|
6
7
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
7
8
|
import { bytesToHex, utf8ToBytes } from "@noble/hashes/utils.js";
|
|
@@ -33,6 +34,17 @@ export const SKILL_FILE_PATH_MAX = FILE_PATH_MAX - `${SKILLS_MOUNT}/${"n".repeat
|
|
|
33
34
|
export function skillFolderOf(skill) {
|
|
34
35
|
return `${SKILLS_MOUNT}/${skill.name}@${bytesToHex(sha256(utf8ToBytes(canonical(skill.files)))).slice(0, 12)}`;
|
|
35
36
|
}
|
|
37
|
+
/** Where a session's sandbox holds each mounted Agent Plugin's files, read-only: `/plugins/<name>@<hash>/`. */
|
|
38
|
+
export const PLUGINS_MOUNT = "/plugins";
|
|
39
|
+
/** The longest path of a file in a mounted plugin's folder, as `SKILL_FILE_PATH_MAX` is a skill's. */
|
|
40
|
+
export const PLUGIN_FILE_PATH_MAX = FILE_PATH_MAX - `${PLUGINS_MOUNT}/${"n".repeat(FILE_NAME_MAX)}@${"0".repeat(12)}/`.length;
|
|
41
|
+
/**
|
|
42
|
+
* The folder of a sandbox that holds one version of an Agent Plugin's files, read-only:
|
|
43
|
+
* `/plugins/<name>@<12 hex>`, the hex from the SHA-256 of its canonical file map, as `skillFolderOf`.
|
|
44
|
+
*/
|
|
45
|
+
export function pluginFolderOf(plugin) {
|
|
46
|
+
return `${PLUGINS_MOUNT}/${plugin.name}@${bytesToHex(sha256(utf8ToBytes(canonical(plugin.files)))).slice(0, 12)}`;
|
|
47
|
+
}
|
|
36
48
|
const FILE_HASH = /^sha256:[0-9a-f]{64}$/;
|
|
37
49
|
/** `sha256:<hex>`, the way a manifest names a definition file. */
|
|
38
50
|
export function isDefinitionFileHash(value) {
|
|
@@ -53,6 +65,19 @@ export function skillFilePathIssue(path) {
|
|
|
53
65
|
return "must not have empty, . or .. segments";
|
|
54
66
|
return undefined;
|
|
55
67
|
}
|
|
68
|
+
/** Why `files` is not a mounted plugin's file map, or undefined when it is. */
|
|
69
|
+
export function pluginFilesIssue(files) {
|
|
70
|
+
if (!files || typeof files !== "object" || Array.isArray(files))
|
|
71
|
+
return `files must map each path in the plugin's folder to sha256:<hex>`;
|
|
72
|
+
for (const [path, hash] of Object.entries(files)) {
|
|
73
|
+
const issue = path.length > PLUGIN_FILE_PATH_MAX ? `must be 1 to ${PLUGIN_FILE_PATH_MAX} characters` : skillFilePathIssue(path)?.replace("the skill's folder", "the plugin's folder");
|
|
74
|
+
if (issue)
|
|
75
|
+
return `file path ${JSON.stringify(path.slice(0, FILE_PATH_MAX))} ${issue}`;
|
|
76
|
+
if (!isDefinitionFileHash(hash))
|
|
77
|
+
return `file ${JSON.stringify(path)} must name its content as sha256:<64 lowercase hex>`;
|
|
78
|
+
}
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
56
81
|
/** Why `files` is not a skill's file map, or undefined when it is. */
|
|
57
82
|
export function skillFilesIssue(files) {
|
|
58
83
|
if (!files || typeof files !== "object" || Array.isArray(files))
|
|
@@ -74,12 +99,33 @@ export function skillFilesIssue(files) {
|
|
|
74
99
|
* agents it uses as tools, and those of a flow's agents, as `sha256:<hex>`.
|
|
75
100
|
*/
|
|
76
101
|
export function definitionFilesOf(document, into = new Set()) {
|
|
77
|
-
for (const
|
|
78
|
-
for (const hash of Object.values(
|
|
102
|
+
for (const owner of [...skillsOf(document), ...mountedPluginsOf(document)])
|
|
103
|
+
for (const hash of Object.values(owner.files ?? {}))
|
|
79
104
|
if (isDefinitionFileHash(hash))
|
|
80
105
|
into.add(hash);
|
|
81
106
|
return into;
|
|
82
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Every Agent Plugin a definition document mounts whole (a loop manifest's `plugins` with
|
|
110
|
+
* `files`): its agents', those of the agents it uses as tools, and those of a flow's agents. A
|
|
111
|
+
* plugin two agents carry comes once for each.
|
|
112
|
+
*/
|
|
113
|
+
export function* mountedPluginsOf(document) {
|
|
114
|
+
if (!document || typeof document !== "object")
|
|
115
|
+
return;
|
|
116
|
+
const value = document;
|
|
117
|
+
if (value.kind === "workflow") {
|
|
118
|
+
for (const agent of Object.values(value.agents ?? {}))
|
|
119
|
+
yield* mountedPluginsOf(agent);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (Array.isArray(value.plugins))
|
|
123
|
+
for (const plugin of value.plugins)
|
|
124
|
+
if (plugin?.files)
|
|
125
|
+
yield plugin;
|
|
126
|
+
for (const tool of value.tools ?? [])
|
|
127
|
+
yield* mountedPluginsOf(tool.agent);
|
|
128
|
+
}
|
|
83
129
|
/**
|
|
84
130
|
* Every skill a definition document carries, as written: its agents' skills, those of the agents
|
|
85
131
|
* it uses as tools, and those of a flow's agents. A skill two agents carry comes once for each.
|
package/dist/utils/memory.js
CHANGED
|
@@ -20,7 +20,7 @@ export const MEMORY_DESCRIPTION_MAX = 200;
|
|
|
20
20
|
export const MEMORY_ACCESS = ["read_write", "read_only"];
|
|
21
21
|
/** What changed a memory, as a version records it. */
|
|
22
22
|
export const MEMORY_OPERATIONS = ["create", "str_replace", "insert", "delete", "rename"];
|
|
23
|
-
// Control characters (
|
|
23
|
+
// Control characters (DEL) and the backslash; a path holds neither.
|
|
24
24
|
const FORBIDDEN = /[\u0000-\u001f\u007f-\u009f\\]/;
|
|
25
25
|
/**
|
|
26
26
|
* Normalises a path the model or an API caller sent: a trailing `/` is dropped, and a path
|
|
@@ -136,12 +136,12 @@ export declare const LINUX_ARG_MAX_BYTES: number;
|
|
|
136
136
|
* Agent refused their turn's start (its disk being copied, its pod lost, the Agent deleted); the
|
|
137
137
|
* start is tried again meanwhile, and after it they fail (`queue.failed`).
|
|
138
138
|
*
|
|
139
|
-
* Flows
|
|
139
|
+
* Flows:
|
|
140
140
|
* - `flowConcurrency`: the most effects one flow turn runs at once; the rest wait their turn.
|
|
141
141
|
* - `flowMapItems`: the most items one map stage may fan out to (`map.too-many-items` past it).
|
|
142
142
|
* - `flowLoopIterations`: the most iterations one loop stage runs (`loop.too-many-iterations`).
|
|
143
143
|
*
|
|
144
|
-
* Agent folders (
|
|
144
|
+
* Agent folders (checked when a folder is saved, and by the compiler):
|
|
145
145
|
* - `folderFiles`: the most files one agent folder holds.
|
|
146
146
|
* - `folderBytes`: the most bytes its files hold together.
|
|
147
147
|
* - `folderTextFileBytes`: the largest Markdown or JSON file of a folder the compiler reads.
|
|
@@ -179,12 +179,12 @@ const harnessLimits = {
|
|
|
179
179
|
* Agent refused their turn's start (its disk being copied, its pod lost, the Agent deleted); the
|
|
180
180
|
* start is tried again meanwhile, and after it they fail (`queue.failed`).
|
|
181
181
|
*
|
|
182
|
-
* Flows
|
|
182
|
+
* Flows:
|
|
183
183
|
* - `flowConcurrency`: the most effects one flow turn runs at once; the rest wait their turn.
|
|
184
184
|
* - `flowMapItems`: the most items one map stage may fan out to (`map.too-many-items` past it).
|
|
185
185
|
* - `flowLoopIterations`: the most iterations one loop stage runs (`loop.too-many-iterations`).
|
|
186
186
|
*
|
|
187
|
-
* Agent folders (
|
|
187
|
+
* Agent folders (checked when a folder is saved, and by the compiler):
|
|
188
188
|
* - `folderFiles`: the most files one agent folder holds.
|
|
189
189
|
* - `folderBytes`: the most bytes its files hold together.
|
|
190
190
|
* - `folderTextFileBytes`: the largest Markdown or JSON file of a folder the compiler reads.
|
|
@@ -548,7 +548,7 @@ export const RUNTIME_LIMIT_DEFAULTS = Object.freeze({
|
|
|
548
548
|
flowConcurrency: 8,
|
|
549
549
|
flowMapItems: 1_000,
|
|
550
550
|
flowLoopIterations: 100,
|
|
551
|
-
//
|
|
551
|
+
// The compiler's fixed values (`AGENT_FOLDER_LIMITS` in `@nylorun/core/folder`).
|
|
552
552
|
folderFiles: 2_000,
|
|
553
553
|
folderBytes: 50 * 1024 * 1024,
|
|
554
554
|
folderTextFileBytes: 1024 * 1024,
|