@nylorun/core 0.12.0-beta → 0.15.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 (90) hide show
  1. package/CHANGELOG.md +159 -0
  2. package/dist/compatibility.d.ts +84 -50
  3. package/dist/compatibility.js +84 -67
  4. package/dist/contracts.d.ts +462 -1196
  5. package/dist/contracts.js +403 -681
  6. package/dist/define.d.ts +13 -10
  7. package/dist/define.js +7 -4
  8. package/dist/definition/assemble.d.ts +0 -3
  9. package/dist/definition/assemble.js +13 -19
  10. package/dist/definition/bind-agent.js +0 -2
  11. package/dist/definition/bind-tool.js +0 -1
  12. package/dist/definition/bound.d.ts +3 -10
  13. package/dist/definition/builder.d.ts +19 -55
  14. package/dist/definition/builder.js +19 -130
  15. package/dist/definition/capability.d.ts +3 -15
  16. package/dist/definition/capability.js +3 -25
  17. package/dist/definition/code-tools.d.ts +22 -0
  18. package/dist/definition/code-tools.js +46 -0
  19. package/dist/definition/declaration.d.ts +0 -3
  20. package/dist/definition/declaration.js +8 -11
  21. package/dist/definition/delegate.d.ts +7 -7
  22. package/dist/definition/flow/compile.d.ts +4 -5
  23. package/dist/definition/flow/compile.js +120 -72
  24. package/dist/definition/flow/from.d.ts +2 -2
  25. package/dist/definition/flow/from.js +14 -33
  26. package/dist/definition/flow/index.d.ts +2 -2
  27. package/dist/definition/flow/index.js +2 -2
  28. package/dist/definition/flow/paths.d.ts +32 -17
  29. package/dist/definition/flow/paths.js +35 -14
  30. package/dist/definition/flow/spec.d.ts +6 -9
  31. package/dist/definition/flow/spec.js +49 -31
  32. package/dist/definition/flow/types.d.ts +40 -116
  33. package/dist/definition/from.js +36 -41
  34. package/dist/definition/helpers.d.ts +1 -1
  35. package/dist/definition/helpers.js +1 -1
  36. package/dist/definition/http-tool.d.ts +66 -0
  37. package/dist/definition/http-tool.js +131 -0
  38. package/dist/definition/implementations.d.ts +0 -3
  39. package/dist/definition/manifest.js +5 -4
  40. package/dist/definition/mcp.d.ts +4 -2
  41. package/dist/definition/mcp.js +14 -18
  42. package/dist/definition/removed.d.ts +10 -0
  43. package/dist/definition/removed.js +26 -0
  44. package/dist/definition/sandbox-capability.d.ts +2 -0
  45. package/dist/definition/sandbox-capability.js +11 -1
  46. package/dist/definition/schema.js +0 -3
  47. package/dist/definition/skill-tools.d.ts +16 -2
  48. package/dist/definition/skill-tools.js +38 -31
  49. package/dist/definition/variant.d.ts +1 -1
  50. package/dist/definition/variant.js +3 -14
  51. package/dist/definition/workflow/diagnostics.d.ts +1 -7
  52. package/dist/definition/workflow/diagnostics.js +1 -24
  53. package/dist/definition/workflow/index.d.ts +3 -17
  54. package/dist/definition/workflow/index.js +2 -9
  55. package/dist/definition/workflow/runnable.d.ts +2 -34
  56. package/dist/definition/workflow/runnable.js +8 -142
  57. package/dist/definition/workflow/types.d.ts +1 -10
  58. package/dist/harness-api/messages.d.ts +24 -27
  59. package/dist/harness-api/messages.js +1 -1
  60. package/dist/harness-api/schema.d.ts +0 -16
  61. package/dist/harness-api/schema.js +5 -12
  62. package/dist/index.d.ts +1 -1
  63. package/dist/types/manifest.d.ts +41 -14
  64. package/dist/types/middleware.d.ts +11 -16
  65. package/dist/types/observe.d.ts +0 -6
  66. package/dist/types/tool.d.ts +0 -6
  67. package/dist/types/workflow.d.ts +54 -110
  68. package/dist/utils/definition-files.d.ts +31 -0
  69. package/dist/utils/definition-files.js +84 -0
  70. package/package.json +1 -1
  71. package/dist/definition/hooks.d.ts +0 -19
  72. package/dist/definition/hooks.js +0 -67
  73. package/dist/definition/workflow/build.d.ts +0 -28
  74. package/dist/definition/workflow/build.js +0 -40
  75. package/dist/definition/workflow/chain.d.ts +0 -49
  76. package/dist/definition/workflow/chain.js +0 -40
  77. package/dist/definition/workflow/loop.d.ts +0 -54
  78. package/dist/definition/workflow/loop.js +0 -100
  79. package/dist/definition/workflow/map.d.ts +0 -17
  80. package/dist/definition/workflow/map.js +0 -45
  81. package/dist/definition/workflow/parallel.d.ts +0 -19
  82. package/dist/definition/workflow/parallel.js +0 -36
  83. package/dist/definition/workflow/patch.d.ts +0 -11
  84. package/dist/definition/workflow/patch.js +0 -45
  85. package/dist/definition/workflow/slot.d.ts +0 -23
  86. package/dist/definition/workflow/slot.js +0 -16
  87. package/dist/definition/workflow/switch.d.ts +0 -26
  88. package/dist/definition/workflow/switch.js +0 -64
  89. package/dist/types/dynamics.d.ts +0 -101
  90. package/dist/types/dynamics.js +0 -1
@@ -1,29 +1,24 @@
1
- import { bindingFromAgent } from "../binding.js";
2
1
  import { normalizeToolDefinition, normalizeSchema } from "../schema.js";
3
2
  import { HarnessError } from "../../errors.js";
4
3
  import { isBuiltWorkflow } from "./types.js";
5
- import { failOne } from "./diagnostics.js";
6
- import { isSlot } from "./slot.js";
4
+ import { diagnostic, fail } from "./diagnostics.js";
7
5
  export function isToolDefinition(value) {
8
6
  if (!value || typeof value !== "object")
9
7
  return false;
10
8
  if (!("name" in value) || typeof value.name !== "string")
11
9
  return false;
10
+ // A named Agent builder has `name` and an `.input()` method; agents and flows are never tools.
11
+ if (isBuiltWorkflow(value) || isAgentOrBuilder(value))
12
+ return false;
12
13
  const v = value;
13
14
  return (typeof v.execute === "function" ||
14
15
  typeof v.run === "function" ||
15
16
  v.inputSchema !== undefined ||
16
17
  v.input !== undefined);
17
18
  }
18
- export function isAgentLike(value) {
19
- if (!value || typeof value !== "object")
20
- return false;
21
- if (isBuiltWorkflow(value))
22
- return false;
23
- return ("id" in value &&
24
- typeof value.id === "string" &&
25
- "manifest" in value &&
26
- typeof value.getBinding === "function");
19
+ function isAgentOrBuilder(value) {
20
+ return (typeof value.getBinding === "function" ||
21
+ typeof value.build === "function");
27
22
  }
28
23
  export function builtAgentOf(run) {
29
24
  if (run &&
@@ -35,7 +30,7 @@ export function builtAgentOf(run) {
35
30
  return run;
36
31
  if (run && typeof run === "object" && "build" in run && typeof run.build === "function")
37
32
  return run.build();
38
- failOne("workflow.invalid-runnable", "Expected a built agent or Agent builder");
33
+ fail([diagnostic("workflow.invalid-runnable", "Expected a built agent or Agent builder")]);
39
34
  }
40
35
  /**
41
36
  * Project a tool for use as a workflow node.
@@ -90,132 +85,3 @@ export function toolManifestNode(bound) {
90
85
  },
91
86
  };
92
87
  }
93
- function agentNode(agent) {
94
- const binding = bindingFromAgent(agent);
95
- return {
96
- node: { agent: agent.id },
97
- agents: { [agent.id]: binding },
98
- };
99
- }
100
- function resolveRunnable(run, rename) {
101
- if (isBuiltWorkflow(run)) {
102
- const binding = run.getBinding();
103
- if (binding.manifest.workflowSchemaVersion !== 1)
104
- failOne("workflow.flow-agent-child", `Flow agent '${run.id}' can't be a child of Chain, Switch, Parallel, Map or Loop. Use it as a step of another flow agent: Agent({ id }).step(${run.id}).`);
105
- const manifest = binding.manifest;
106
- const id = rename ?? run.id;
107
- return {
108
- id,
109
- node: manifest.root,
110
- agents: { ...binding.agents },
111
- // A rename moves the whole subtree: the harness path uses the new part, not run.id.
112
- nodes: remapNodeKeys({ ...binding.nodes }, run.id, id),
113
- isReshapingSlot: false,
114
- };
115
- }
116
- if (isToolDefinition(run)) {
117
- const bound = bindToolNode(run);
118
- const id = rename ?? bound.name;
119
- return {
120
- id,
121
- node: toolManifestNode(bound),
122
- agents: {},
123
- nodes: { [id]: { kind: "tool", tool: bound } },
124
- tool: bound,
125
- isReshapingSlot: false,
126
- };
127
- }
128
- if (isAgentLike(run) ||
129
- (run && typeof run === "object" && "build" in run && typeof run.build === "function")) {
130
- const agent = builtAgentOf(run);
131
- const resolved = agentNode(agent);
132
- const id = rename ?? agent.id;
133
- return {
134
- id,
135
- node: resolved.node,
136
- agents: resolved.agents,
137
- nodes: {},
138
- isReshapingSlot: false,
139
- };
140
- }
141
- failOne("workflow.invalid-runnable", "Unsupported workflow runnable");
142
- }
143
- /**
144
- * Resolve a runnable or slot into a manifest node plus local bindings.
145
- * When the slot has `input`, the node is wrapped as `{ slot: { id?, input, run } }`.
146
- */
147
- export function resolveChild(child, defaultRename) {
148
- if (isSlot(child)) {
149
- const slot = child;
150
- const resolved = resolveRunnable(slot.run, slot.id ?? defaultRename);
151
- const id = slot.id ?? resolved.id;
152
- const hasInput = typeof slot.input === "function";
153
- if (!hasInput && slot.id === undefined) {
154
- return { ...resolved, id, isReshapingSlot: false };
155
- }
156
- const node = {
157
- slot: {
158
- ...(slot.id !== undefined ? { id: slot.id } : {}),
159
- ...(hasInput ? { input: { fn: true } } : {}),
160
- run: resolved.node,
161
- },
162
- };
163
- const remapped = remapNodeKeys(resolved.nodes, resolved.id, id);
164
- if (hasInput) {
165
- remapped[`${id}/input`] = {
166
- kind: "fn",
167
- fn: slot.input,
168
- };
169
- }
170
- return {
171
- id,
172
- node,
173
- agents: resolved.agents,
174
- nodes: remapped,
175
- tool: resolved.tool,
176
- isReshapingSlot: hasInput,
177
- };
178
- }
179
- return resolveRunnable(child, defaultRename);
180
- }
181
- /**
182
- * Rewrite node keys that are rooted at `fromRoot` so they sit at `toPath`.
183
- * Used when nesting a child under a parent path (workflows.md §6).
184
- *
185
- * Example: Loop nodes `{ code, code/decide }` nested at `ship/code` become
186
- * `{ ship/code, ship/code/decide }`.
187
- */
188
- export function remapNodeKeys(nodes, fromRoot, toPath) {
189
- if (fromRoot === toPath)
190
- return nodes;
191
- const out = {};
192
- for (const [key, impl] of Object.entries(nodes)) {
193
- if (key === fromRoot)
194
- out[toPath] = impl;
195
- else if (key.startsWith(`${fromRoot}/`))
196
- out[`${toPath}${key.slice(fromRoot.length)}`] = impl;
197
- else
198
- out[`${toPath}/${key}`] = impl;
199
- }
200
- return out;
201
- }
202
- /** @deprecated Prefer remapNodeKeys — kept for call-site clarity during migration. */
203
- export function prefixNodeKeys(nodes, parentPath) {
204
- return remapNodeKeys(nodes, "", parentPath);
205
- }
206
- export function runnableId(child) {
207
- if (isSlot(child)) {
208
- if (child.id !== undefined)
209
- return child.id;
210
- return runnableId(child.run);
211
- }
212
- if (isBuiltWorkflow(child))
213
- return child.id;
214
- if (isToolDefinition(child))
215
- return child.name;
216
- if (isAgentLike(child))
217
- return child.id;
218
- if (child && typeof child === "object" && "build" in child && typeof child.build === "function")
219
- return child.build().id;
220
- failOne("workflow.invalid-runnable", "Cannot determine runnable id");
221
- }
@@ -1,7 +1,7 @@
1
1
  import type { WorkflowBinding, WorkflowManifest } from "../../types/workflow.js";
2
2
  import type { JsonValue } from "../../types/shared.js";
3
3
  import type { ToolSchemaSource } from "../../types/tool.js";
4
- /** A workflow built with Chain / Switch / Parallel / Map / Loop. */
4
+ /** A built flow agent: its workflow manifest and the code its tool nodes run. */
5
5
  export interface BuiltWorkflow<In = JsonValue, Out = JsonValue> {
6
6
  readonly id: string;
7
7
  readonly manifest: WorkflowManifest;
@@ -14,12 +14,3 @@ export interface BuiltWorkflow<In = JsonValue, Out = JsonValue> {
14
14
  readonly __output?: Out;
15
15
  }
16
16
  export declare function isBuiltWorkflow(value: unknown): value is BuiltWorkflow;
17
- /** Infer a runnable's output type when known; otherwise JsonValue. */
18
- export type OutputOf<R> = R extends BuiltWorkflow<any, infer O> ? O : R extends {
19
- readonly __output?: infer O;
20
- } ? O : R extends {
21
- build(): BuiltWorkflow<any, infer O>;
22
- } ? O : JsonValue;
23
- export type InputOf<R> = R extends BuiltWorkflow<infer I, any> ? I : R extends {
24
- readonly __input?: infer I;
25
- } ? I : JsonValue;
@@ -1,13 +1,14 @@
1
1
  /**
2
- * Harness API v1 (blueprint D37–D42): the messages between core and a harness. A run is a
3
- * lease on one session's segment; core records, the harness runs the engine. Who executes what:
4
- * the harness runs model, MCP and sandbox calls; core runs Actions, hooks, flow work, linked
5
- * sessions, delegation journaling, settle and takeover.
2
+ * Harness API v2 (blueprint D37–D42; v2 is track R2: no Actions, so no held runs): the messages
3
+ * between core and a harness. A run is a lease on one session's segment; core records, the
4
+ * harness runs the engine. Who executes what: the harness runs model, MCP, HTTP and sandbox
5
+ * calls; core runs flow work, linked sessions, delegation journaling, `save_artifact`, the
6
+ * skill tools, settle and takeover.
6
7
  */
7
- import type { ActionOutcome } from "../contracts.js";
8
+ import type { EffectOutcome } from "../contracts.js";
8
9
  import type { AgentRef } from "../types/tool.js";
9
10
  import type { TranscriptUpdate } from "./transcript.js";
10
- export declare const HARNESS_API_VERSION = 1;
11
+ export declare const HARNESS_API_VERSION = 2;
11
12
  /** Why core stopped a run. Matches the advance's abort kinds. */
12
13
  export type AbortReason = "cancel" | "shutdown" | "deadline" | "ownership.lost";
13
14
  export declare const ABORT_REASONS: readonly AbortReason[];
@@ -28,15 +29,10 @@ export interface EffectIntent {
28
29
  readonly turnId: string;
29
30
  readonly agentId: string;
30
31
  readonly manifestHash: string;
31
- readonly kind: "model" | "tool" | "hook" | "delegation" | "agent" | "fn" | "verify";
32
+ readonly kind: "model" | "tool" | "delegation" | "agent";
32
33
  readonly agent?: AgentRef;
33
34
  readonly capabilityId?: string;
34
35
  readonly toolName?: string;
35
- readonly hook?: {
36
- readonly at: "before" | "after";
37
- readonly scope: "turn" | "step";
38
- readonly capabilityIds: readonly string[];
39
- };
40
36
  readonly path?: string;
41
37
  readonly key?: string;
42
38
  readonly iterations?: string;
@@ -47,7 +43,7 @@ export interface EffectIntent {
47
43
  export interface RecordedOutcome {
48
44
  readonly effectId: string;
49
45
  readonly requestHash: string;
50
- readonly outcome: ActionOutcome;
46
+ readonly outcome: EffectOutcome;
51
47
  }
52
48
  /** The lease on one run. `token` is the run token (F5) when the gates require one. */
53
49
  export interface RunGrant {
@@ -62,7 +58,6 @@ export interface RunGrant {
62
58
  export interface RunRouting {
63
59
  /** The session's pinned manifest: an effect's agent resolves against it. */
64
60
  readonly rootManifest: unknown;
65
- readonly pluginRoots: Readonly<Record<string, string>>;
66
61
  readonly mcpSnapshot?: unknown;
67
62
  /** The session that owns the tree's sandbox, and the sandbox resource it is attached to. */
68
63
  readonly sandbox?: {
@@ -93,11 +88,6 @@ export interface TurnStart {
93
88
  };
94
89
  readonly flowLimits?: unknown;
95
90
  readonly fixtureModel: boolean;
96
- /**
97
- * How long the run may wait for a pending Action's outcome in its lease (F6.2,
98
- * `effect.resolved`) before the segment ends as waiting. 0 or absent: it never waits.
99
- */
100
- readonly holdMs?: number;
101
91
  };
102
92
  readonly routing: RunRouting;
103
93
  }
@@ -125,7 +115,7 @@ export interface TurnOutput {
125
115
  export type OutputMethod = "turn.completed" | "turn.paused" | "turn.waiting" | "turn.failed" | "checkpoint";
126
116
  export type IntentAnswer = {
127
117
  readonly status: "completed";
128
- readonly outcome: ActionOutcome;
118
+ readonly outcome: EffectOutcome;
129
119
  } | {
130
120
  readonly status: "pending" | "uncertain";
131
121
  } | {
@@ -134,7 +124,7 @@ export type IntentAnswer = {
134
124
  };
135
125
  export type OutcomeAnswer = {
136
126
  readonly status: "completed";
137
- readonly outcome: ActionOutcome;
127
+ readonly outcome: EffectOutcome;
138
128
  } | {
139
129
  readonly status: "uncertain";
140
130
  };
@@ -243,6 +233,19 @@ export interface HarnessRequests {
243
233
  sessionTools: unknown[];
244
234
  };
245
235
  };
236
+ /**
237
+ * A definition file's bytes, base64 (track R2 M4): one the run's definition names, for the
238
+ * skills its sandbox mounts.
239
+ */
240
+ "definition.file": {
241
+ params: {
242
+ runId: string;
243
+ sha256: string;
244
+ };
245
+ result: {
246
+ base64: string;
247
+ };
248
+ };
246
249
  "turn.completed": {
247
250
  params: TurnOutput;
248
251
  result: {
@@ -378,12 +381,6 @@ export interface CoreMessages {
378
381
  reason: AbortReason;
379
382
  message?: string;
380
383
  };
381
- /** F6.2: an Action's outcome for a run held while it is pending. */
382
- "effect.resolved": {
383
- runId: string;
384
- effectId: string;
385
- outcome: ActionOutcome;
386
- };
387
384
  }
388
385
  export type HarnessMethod = keyof HarnessRequests;
389
386
  export type CoreMethod = keyof CoreRequests;
@@ -1,4 +1,4 @@
1
- export const HARNESS_API_VERSION = 1;
1
+ export const HARNESS_API_VERSION = 2;
2
2
  export const ABORT_REASONS = [
3
3
  "cancel",
4
4
  "shutdown",
@@ -49,11 +49,8 @@ export declare const EffectIntentSchema: z.ZodObject<{
49
49
  kind: z.ZodEnum<{
50
50
  agent: "agent";
51
51
  delegation: "delegation";
52
- fn: "fn";
53
- hook: "hook";
54
52
  model: "model";
55
53
  tool: "tool";
56
- verify: "verify";
57
54
  }>;
58
55
  agent: z.ZodOptional<z.ZodObject<{
59
56
  id: z.ZodString;
@@ -62,17 +59,6 @@ export declare const EffectIntentSchema: z.ZodObject<{
62
59
  }, z.core.$strict>>;
63
60
  capabilityId: z.ZodOptional<z.ZodString>;
64
61
  toolName: z.ZodOptional<z.ZodString>;
65
- hook: z.ZodOptional<z.ZodObject<{
66
- at: z.ZodEnum<{
67
- after: "after";
68
- before: "before";
69
- }>;
70
- scope: z.ZodEnum<{
71
- step: "step";
72
- turn: "turn";
73
- }>;
74
- capabilityIds: z.ZodArray<z.ZodString>;
75
- }, z.core.$strict>>;
76
62
  path: z.ZodOptional<z.ZodString>;
77
63
  key: z.ZodOptional<z.ZodString>;
78
64
  iterations: z.ZodOptional<z.ZodString>;
@@ -109,11 +95,9 @@ export declare const TurnStartSchema: z.ZodObject<{
109
95
  }, z.core.$strict>>;
110
96
  flowLimits: z.ZodOptional<z.ZodUnknown>;
111
97
  fixtureModel: z.ZodBoolean;
112
- holdMs: z.ZodOptional<z.ZodNumber>;
113
98
  }, z.core.$strict>;
114
99
  routing: z.ZodObject<{
115
100
  rootManifest: z.ZodRecord<z.ZodString, z.ZodUnknown>;
116
- pluginRoots: z.ZodRecord<z.ZodString, z.ZodString>;
117
101
  mcpSnapshot: z.ZodOptional<z.ZodUnknown>;
118
102
  sandbox: z.ZodOptional<z.ZodObject<{
119
103
  ownerId: z.ZodString;
@@ -35,18 +35,10 @@ export const EffectIntentSchema = z
35
35
  turnId: id,
36
36
  agentId: id,
37
37
  manifestHash: z.string(),
38
- kind: z.enum(["model", "tool", "hook", "delegation", "agent", "fn", "verify"]),
38
+ kind: z.enum(["model", "tool", "delegation", "agent"]),
39
39
  agent: z.object({ id: z.string(), path: z.string(), delegationId: z.string().optional() }).strict().optional(),
40
40
  capabilityId: z.string().optional(),
41
41
  toolName: z.string().optional(),
42
- hook: z
43
- .object({
44
- at: z.enum(["before", "after"]),
45
- scope: z.enum(["turn", "step"]),
46
- capabilityIds: z.array(z.string()),
47
- })
48
- .strict()
49
- .optional(),
50
42
  path: z.string().optional(),
51
43
  key: z.string().optional(),
52
44
  iterations: z.string().optional(),
@@ -114,13 +106,11 @@ export const TurnStartSchema = z
114
106
  yieldAfter: z.object({ steps: z.number().optional(), ms: z.number().optional() }).strict().optional(),
115
107
  flowLimits: z.unknown().optional(),
116
108
  fixtureModel: z.boolean(),
117
- holdMs: z.number().int().nonnegative().optional(),
118
109
  })
119
110
  .strict(),
120
111
  routing: z
121
112
  .object({
122
113
  rootManifest: z.record(z.string(), z.unknown()),
123
- pluginRoots: z.record(z.string(), z.string()),
124
114
  mcpSnapshot: z.unknown().optional(),
125
115
  sandbox: z
126
116
  .object({ ownerId: id, sandboxId: id.optional(), spec: z.unknown().optional() })
@@ -220,6 +210,10 @@ const requests = {
220
210
  params: runId.extend({ snapshot: z.unknown().optional(), diagnostics: z.array(z.unknown()) }).strict(),
221
211
  result: z.object({ snapshot: z.unknown(), sessionTools: z.array(z.unknown()) }).strict(),
222
212
  },
213
+ "definition.file": {
214
+ params: runId.extend({ sha256: z.string().regex(/^sha256:[0-9a-f]{64}$/) }).strict(),
215
+ result: z.object({ base64: z.string() }).strict(),
216
+ },
223
217
  "turn.completed": { params: TurnOutputSchema, result: settled },
224
218
  "turn.paused": { params: TurnOutputSchema, result: settled },
225
219
  "turn.waiting": { params: TurnOutputSchema, result: settled },
@@ -248,7 +242,6 @@ const messages = {
248
242
  cancel: runId
249
243
  .extend({ reason: z.enum(ABORT_REASONS), message: z.string().optional() })
250
244
  .strict(),
251
- "effect.resolved": runId.extend({ effectId: id, outcome }).strict(),
252
245
  };
253
246
  function check(schema, value, what) {
254
247
  if (!schema)
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from "./contracts.js";
2
- export type * from "./types/dynamics.js";
3
2
  export type * from "./types/middleware.js";
4
3
  export type * from "./types/tool.js";
5
4
  export type * from "./types/agent.js";
@@ -9,3 +8,4 @@ export type * from "./types/shared.js";
9
8
  export type * from "./types/manifest.js";
10
9
  export type * from "./types/transcript.js";
11
10
  export type * from "./types/workflow.js";
11
+ export type { ModelCall } from "./define.js";
@@ -1,8 +1,29 @@
1
1
  import type { JsonObject } from "./shared.js";
2
- import type { HookManifest } from "./dynamics.js";
3
- import type { WorkflowManifestV2 } from "./workflow.js";
2
+ import type { WorkflowManifest } from "./workflow.js";
4
3
  /** Published manifest schema version (no top-level model — Runtime-owned). */
5
- export type ManifestSchemaVersion = 4;
4
+ export type ManifestSchemaVersion = 5;
5
+ /** Whether each call waits for a person's approval (`approve` on the session). Default `never`. */
6
+ export type ApprovalMode = "never" | "always";
7
+ /** The methods an HTTP tool may use: each sends the tool input as a JSON body. */
8
+ export type HttpToolMethod = "POST" | "PUT" | "PATCH";
9
+ /**
10
+ * A tool the Runtime runs as one HTTP request through its Tool Gate: the input as a JSON body,
11
+ * the answer as the output. A sibling of `agent`; `fn` and `command` are reserved for later kinds.
12
+ */
13
+ export interface HttpToolTarget {
14
+ /** Absolute `http` or `https` URL. */
15
+ readonly url: string;
16
+ /** Default `POST`. */
17
+ readonly method?: HttpToolMethod;
18
+ /**
19
+ * Adds a vault credential to each request, as for a remote MCP server: a credential in the
20
+ * session's vaults bound to `url`, chosen by the session's credential selection with this
21
+ * name (`credentialSelections[].serverName`) when several are; else the operator's resolver.
22
+ */
23
+ readonly credential?: string;
24
+ /** How long the service may take to answer. Default 60000, at most 300000. */
25
+ readonly timeoutMs?: number;
26
+ }
6
27
  export interface ToolManifest {
7
28
  readonly name: string;
8
29
  readonly description?: string;
@@ -11,31 +32,39 @@ export interface ToolManifest {
11
32
  /**
12
33
  * Present when this tool is another agent. The engine runs it with a fresh context and
13
34
  * returns its final output; its input is always `{ task: string }`. One level deep. A flow
14
- * agent (workflow manifest v2) runs in its own linked session on the Runtime.
35
+ * agent (workflow manifest v3) runs in its own linked session on the Runtime.
15
36
  */
16
- readonly agent?: AgentManifest | WorkflowManifestV2;
37
+ readonly agent?: AgentManifest | WorkflowManifest;
38
+ /** Present when the Runtime runs this tool as an HTTP request. Never with `agent`. */
39
+ readonly http?: HttpToolTarget;
40
+ /** Each call of an HTTP tool waits for approval. */
41
+ readonly approval?: ApprovalMode;
17
42
  }
18
43
  export interface SkillManifest {
19
44
  readonly name: string;
20
45
  readonly description: string;
46
+ /**
47
+ * Every file of the skill's folder, by its path in the folder (`/`-separated, e.g.
48
+ * `SKILL.md`, `scripts/run.py`, `assets/logo.png`), as `sha256:<hex>`: the definition files
49
+ * the Runtime holds and serves. `SKILL.md` is required.
50
+ */
51
+ readonly files: Readonly<Record<string, string>>;
21
52
  }
53
+ /** A remote MCP server, declared by URL. Nylorun accepts no stdio servers (`stdioMcpRefusal`). */
22
54
  export type McpServerManifest = {
23
- readonly name: string;
24
- readonly type: "stdio";
25
- readonly command: string;
26
- readonly args?: readonly string[];
27
- readonly env?: Readonly<Record<string, string>>;
28
- readonly cwd?: string;
29
- } | {
30
55
  readonly name: string;
31
56
  readonly type: "streamable-http";
32
57
  readonly url: string;
33
58
  readonly headers?: Readonly<Record<string, string>>;
59
+ /** Each call of every tool of the server waits for approval. */
60
+ readonly approval?: ApprovalMode;
34
61
  } | {
35
62
  readonly name: string;
36
63
  readonly type: "sse";
37
64
  readonly url: string;
38
65
  readonly headers?: Readonly<Record<string, string>>;
66
+ /** Each call of every tool of the server waits for approval. */
67
+ readonly approval?: ApprovalMode;
39
68
  };
40
69
  /** Network egress preset for a sandbox. Private ranges and metadata endpoints are always blocked. */
41
70
  export type SandboxNetworkPreset = "none" | "dev" | "open";
@@ -72,8 +101,6 @@ export interface CapabilityManifest {
72
101
  readonly mcpServers?: Readonly<Record<string, McpServerManifest>>;
73
102
  /** Present when this capability gives the agent a Runtime-owned sandbox. */
74
103
  readonly sandbox?: SandboxManifest;
75
- /** Hook points this capability registered, in canonical order. */
76
- readonly hooks?: readonly HookManifest[];
77
104
  }
78
105
  /** Reserved. Empty until later fields are defined. Omit `runtime` while it has no fields. */
79
106
  export interface RuntimeManifest {
@@ -2,15 +2,16 @@ import type { ContextMutationOptions, ModelCandidate, ModelDirective, ModelToolC
2
2
  import type { InputEvent, TranscriptEntry } from "./transcript.js";
3
3
  import type { AgentTool } from "./agent.js";
4
4
  import type { McpServerManifest, SkillManifest } from "./manifest.js";
5
- /** Skill files held on the developer binding. Not a manifest field. */
6
- export interface SkillRecord {
7
- readonly name: string;
8
- readonly description: string;
9
- readonly instructions: string;
10
- readonly resources?: Readonly<Record<string, string>>;
5
+ /**
6
+ * The bytes of one skill file the manifest names (`SkillManifest.files`), held on the developer
7
+ * binding: the client uploads the files the Runtime lacks before it registers the agent. Not a
8
+ * manifest field.
9
+ */
10
+ export interface SkillFileSource {
11
+ readonly size: number;
12
+ read(): Promise<Uint8Array>;
11
13
  }
12
14
  import type { ContextItem, JsonObject, Tripwire } from "./shared.js";
13
- import type { AfterHooks, BeforeHooks } from "./dynamics.js";
14
15
  import type { Interaction, ToolDefinition, ToolResult } from "./tool.js";
15
16
  interface StepRequestBase {
16
17
  /** Opaque identity of the execution that owns this Step. */
@@ -67,22 +68,16 @@ export interface CapabilityDeclaration<Info = unknown> {
67
68
  readonly tools?: CapabilityItems<ToolDefinition<any, Info, any>>;
68
69
  readonly instructions?: CapabilityItems<string>;
69
70
  readonly skills?: Readonly<Record<string, SkillManifest>>;
70
- /** File contents for load_skill. Omitted from the manifest. */
71
- readonly skillRecords?: Readonly<Record<string, SkillRecord>>;
71
+ /** Each skill file's bytes, by `sha256:<hex>`, for the client to upload. Not projected into the manifest. */
72
+ readonly skillFiles?: Readonly<Record<string, SkillFileSource>>;
72
73
  readonly mcpServers?: Readonly<Record<string, McpServerManifest>>;
73
- /** Resolved package directory. Not projected into the manifest. */
74
- readonly pluginRoot?: string;
75
74
  /**
76
75
  * @deprecated Model resolution is Runtime-owned. Not projected into the harness manifest.
77
76
  * Kept for local middleware composition through 1.0.
78
77
  */
79
78
  readonly model?: ModelDirective;
80
- /** @deprecated Prefer before / after hooks. Kept through 1.0. */
79
+ /** @deprecated Runs in the local engine only. Kept through 1.0. */
81
80
  readonly middleware?: StepMiddleware<Info>;
82
- /** Run before each turn or each model call (step). */
83
- readonly before?: BeforeHooks<Info>;
84
- /** Run after each model call (step) or after the turn's final answer. */
85
- readonly after?: AfterHooks<Info>;
86
81
  }
87
82
  /** What `.use()` accepts: a capability whose `tools` may also hold agents used as tools. */
88
83
  export type CapabilityInput<Info = unknown> = Omit<CapabilityDeclaration<Info>, "tools"> & {
@@ -65,12 +65,6 @@ export type WorkflowLiveEventPayload = {
65
65
  readonly feedback?: string;
66
66
  readonly data?: JsonValue;
67
67
  readonly verifierSessionId?: string;
68
- } | {
69
- readonly type: "loop.decided";
70
- readonly path: string;
71
- readonly n: number;
72
- readonly next: "input" | "output";
73
- readonly patched: boolean;
74
68
  };
75
69
  export type ObserveToolSnapshot = ToolDescriptor;
76
70
  /** JSON-only model-configuration view suitable for an observation stream. */
@@ -79,12 +79,6 @@ export interface ToolDefinition<InputSchema extends ToolInputSchema = ToolInputS
79
79
  readonly approval?: ToolApproval<InputSchema>;
80
80
  /** Code-only metadata — never serialized into the manifest. */
81
81
  readonly effects?: ToolEffects;
82
- /**
83
- * Runs in the background when an Action endpoint serves it: the endpoint answers the delivery
84
- * at once (`202`), heartbeats while the tool runs, and posts its outcome when it ends. For
85
- * tools that run longer than an endpoint's timeout. Code-only metadata — never serialized.
86
- */
87
- readonly background?: boolean;
88
82
  }
89
83
  /** A plain return value is treated as `{ kind: "completed", output }`. Legacy tagged outcomes remain valid. */
90
84
  export type ToolRunResult<Output = ToolContent> = Output | ToolOutcome<Output>;