@nylorun/harness 0.32.0-beta → 0.34.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 +31 -0
- package/dist/api/host.js +3 -0
- package/dist/api/run.js +5 -1
- package/dist/loop/delegation.d.ts +6 -0
- package/dist/loop/run.js +26 -0
- package/dist/run/durable.d.ts +9 -1
- package/dist/run/durable.js +27 -2
- package/dist/tools/ask.d.ts +32 -0
- package/dist/tools/ask.js +68 -0
- package/dist/tools/engine-tools.d.ts +1 -1
- package/dist/tools/engine-tools.js +2 -2
- package/dist/tools/skills.d.ts +1 -1
- package/dist/tools/skills.js +21 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.34.0-beta
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- c649f33: A message can steer a running turn (D85). `delivery: "steer"` on a `message` command, behind the
|
|
8
|
+
optional Host feature `steer`: to a busy agent session it waits in the session queue marked
|
|
9
|
+
`steer`, and our engine takes it into the running turn before its next step, after the tool
|
|
10
|
+
results, through a new effect kind, `inputs`, which core answers in the transaction that journals
|
|
11
|
+
it (Harness API 5, `harness-api/v5.4.json`). Each taken message's `command.message` is written
|
|
12
|
+
under the running turn, then `queue.taken` with the `step`. The queued answer and
|
|
13
|
+
`message.queued` say which delivery applied; a workflow session queues. A steer the turn doesn't
|
|
14
|
+
take starts the next turn like any queued message, and D76's defaults never choose steer.
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Pin core to the tested release.
|
|
19
|
+
- Updated dependencies [c649f33]
|
|
20
|
+
- @nylorun/core@0.37.0-beta
|
|
21
|
+
|
|
22
|
+
## 0.33.0-beta
|
|
23
|
+
|
|
24
|
+
### Minor Changes
|
|
25
|
+
|
|
26
|
+
- 2afa44d: The Runtime's primitives as its own Agent Plugins (ADR-106, D84). An `agent-folder/3` folder lists them under `plugins:` (`nylorun-memory`, `nylorun-triggers`, `nylorun-plan`, `nylorun-interactions`, `nylorun-artifacts`, `nylorun-sandbox`, which needs a computer), with no versions, and turns one of their tools off with `mcpServers.nylorun.tools.<tool>.enabled: false`. The compiler reads them as the `agent-folder/2` declarations they stand for (`memory`, `loop`, `engine.sandbox`, `engine.artifacts`, `engine.triggers`, which v3 refuses) and records them in `harness.engine.plugins`, each with its tools and the hash of its files. The engine presents their tools as the reserved server `nylorun`: the model reads `nylorun__memory` and the declared plugins' words as one text, with their skills (`memory`, `triggers`) in the catalog, served from the bundle; every effect keeps its target and `toolName`, so the record, tool policy (`kind: "runtime"` rules) and dispatch are unchanged. New: `ask` (`nylorun-interactions`, `harness.loop.ask`), a question that pauses the turn as an A2A `question`; `removeTools` takes `nylorun__<tool>`; `triggers` answers carry `now`; under `nylorun-triggers`, an agent-made trigger's run starts with a `[trigger <id> · <title> · nobody is watching]` line, and a turn a trigger started may set a one-off follow-up (`in` or `at`, `session: "this"`); the sandbox's instructions name the hosts `runtime.json` allows. `nylorun migrate folder <dir> --to 3` writes the plugins that keep an agent's tools and features, and `nylorun check --explain` names the plugin behind each. The JSON Schemas are republished as `agent-manifest/v8.4`, `harness-manifest/v1.4` and `agent-folder/v1/agent-md.4`.
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Pin core to the tested release.
|
|
31
|
+
- Updated dependencies [2afa44d]
|
|
32
|
+
- @nylorun/core@0.36.0-beta
|
|
33
|
+
|
|
3
34
|
## 0.32.0-beta
|
|
4
35
|
|
|
5
36
|
### Minor Changes
|
package/dist/api/host.js
CHANGED
|
@@ -25,6 +25,7 @@ import { StepBudget, jsonBytes, mayNeedShaping, shapeToolOutcome, spillKey, } fr
|
|
|
25
25
|
import { isToolSearch, runToolSearch } from "../tools/tool-search.js";
|
|
26
26
|
import { isPlanTool, runPlanTool } from "../tools/plan.js";
|
|
27
27
|
import { isConnectionTool, runConnectionTool } from "../tools/connection.js";
|
|
28
|
+
import { isAskTool, runAskTool } from "../tools/ask.js";
|
|
28
29
|
import { runAbortKind } from "./abort.js";
|
|
29
30
|
/**
|
|
30
31
|
* The host of one run. A `harness` tool call is one of our engine's own tools, run here: the skill
|
|
@@ -192,6 +193,8 @@ export function apiHost(channel, executors, run, engine, mcp) {
|
|
|
192
193
|
return runPlanTool(effect, { channel, run, signal });
|
|
193
194
|
if (isConnectionTool(effect))
|
|
194
195
|
return Promise.resolve(runConnectionTool(effect));
|
|
196
|
+
if (isAskTool(effect))
|
|
197
|
+
return Promise.resolve(runAskTool(effect));
|
|
195
198
|
if (isArtifactTool(effect.toolName))
|
|
196
199
|
return runArtifactTool(effect, {
|
|
197
200
|
channel,
|
package/dist/api/run.js
CHANGED
|
@@ -69,6 +69,8 @@ export async function runTurn(ctx, run) {
|
|
|
69
69
|
: undefined;
|
|
70
70
|
const plan = loop?.plan === true;
|
|
71
71
|
const connections = loop?.connections === true;
|
|
72
|
+
// `ask` (ADR-106, `nylorun-interactions`): the version's `harness.loop.ask`, for the root agent.
|
|
73
|
+
const ask = loop?.ask === true;
|
|
72
74
|
// The triggers the agent sets up itself (D83): the version declares `harness.engine.triggers`,
|
|
73
75
|
// for the root agent only.
|
|
74
76
|
const triggers = start.engine === "agent" && start.agent?.triggers === true;
|
|
@@ -78,7 +80,7 @@ export async function runTurn(ctx, run) {
|
|
|
78
80
|
root: agent.id === rootId,
|
|
79
81
|
// No index is pinned when the version sets `harness.memory.index: false` (ADR-100).
|
|
80
82
|
index: memory.index !== undefined,
|
|
81
|
-
}, plan && agent.id === rootId, connections && agent.id === rootId, triggers && agent.id === rootId);
|
|
83
|
+
}, plan && agent.id === rootId, connections && agent.id === rootId, triggers && agent.id === rootId, ask && agent.id === rootId);
|
|
82
84
|
const mcp = start.engine === "agent" && start.mcp
|
|
83
85
|
? mcpToolSet(start.mcp, start.manifest, {
|
|
84
86
|
config: ctx.engine.mcpTools,
|
|
@@ -123,6 +125,8 @@ export async function runTurn(ctx, run) {
|
|
|
123
125
|
// Another session wrote the memory since this one's last turn: its index again.
|
|
124
126
|
...(memory?.refresh ? { refreshPinned: true } : {}),
|
|
125
127
|
...(start.options.yieldAfter ? { yieldAfter: start.options.yieldAfter } : {}),
|
|
128
|
+
// Core answers the `inputs` effect (D85): messages steered into the turn.
|
|
129
|
+
takeInputs: true,
|
|
126
130
|
...(start.model ? { model: start.model } : {}),
|
|
127
131
|
files: filesOf(ctx, run, start, start.manifest.engine),
|
|
128
132
|
loop: ctx.engine.loop,
|
|
@@ -40,6 +40,12 @@ export interface ExecuteInternals {
|
|
|
40
40
|
};
|
|
41
41
|
/** The loop's settings (compaction, a failed child's partial output). Default `DEFAULT_LOOP_CONFIG`. */
|
|
42
42
|
readonly loop?: LoopConfig;
|
|
43
|
+
/**
|
|
44
|
+
* The messages steered into the running turn (D85), asked before every step but the turn's
|
|
45
|
+
* first: each one's input as its message gave it, which the loop reads as a user message. Set
|
|
46
|
+
* for the root invocation only; an agent used as a tool never takes them.
|
|
47
|
+
*/
|
|
48
|
+
readonly takeInputs?: (turnId: string, stepNumber: number) => Promise<readonly unknown[]>;
|
|
43
49
|
}
|
|
44
50
|
/** Codes are curated: a child's provider error bodies never reach the parent's context. */
|
|
45
51
|
export declare const INTERACTION_UNSUPPORTED = "Agents used as tools can't ask for input, approval or a wait yet; do this work on the parent agent.";
|
package/dist/loop/run.js
CHANGED
|
@@ -2,6 +2,7 @@ import { HostSuspension } from "./host-suspension.js";
|
|
|
2
2
|
import { HarnessError, isHarnessError } from "@nylorun/core/define";
|
|
3
3
|
import { runStep } from "./step/run.js";
|
|
4
4
|
import { compact, contextBudget, estimateTokens } from "./compaction/index.js";
|
|
5
|
+
import { normalizeInput } from "./state.js";
|
|
5
6
|
import { createId } from "../utils/ids.js";
|
|
6
7
|
import { dispatchPlan } from "./dispatch.js";
|
|
7
8
|
import { createInvocation } from "./invocation.js";
|
|
@@ -114,6 +115,31 @@ export async function execute(agent, options, internals = {}) {
|
|
|
114
115
|
invocation.state = { ...invocation.state, turn: { turnId } };
|
|
115
116
|
return finish({ status: "yielded" });
|
|
116
117
|
}
|
|
118
|
+
// Messages steered into the running turn (D85): every step but the turn's first may take
|
|
119
|
+
// them, after the tool results the model sees next, and never while a plan dispatches.
|
|
120
|
+
if (internals.takeInputs && stepNumber > 1 && !invocation.state.plan) {
|
|
121
|
+
// Each is a message's input as sent (text, or a user message with parts), as at turn start.
|
|
122
|
+
const steered = (await internals.takeInputs(turnId, stepNumber)).flatMap((value) => {
|
|
123
|
+
try {
|
|
124
|
+
const event = normalizeInput(value);
|
|
125
|
+
return event.kind === "user-message" ? [event] : [];
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
if (steered.length > 0) {
|
|
132
|
+
invocation.state = {
|
|
133
|
+
...invocation.state,
|
|
134
|
+
transcript: [
|
|
135
|
+
...invocation.state.transcript,
|
|
136
|
+
...steered.map((event) => ({ kind: "input", turnId, event })),
|
|
137
|
+
],
|
|
138
|
+
};
|
|
139
|
+
await record();
|
|
140
|
+
arrivals = steered;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
117
143
|
stepsRun++;
|
|
118
144
|
const stepId = createId("step");
|
|
119
145
|
// Keep the next prompt inside the model's window, before it is sent.
|
package/dist/run/durable.d.ts
CHANGED
|
@@ -32,8 +32,10 @@ export interface HostEffect {
|
|
|
32
32
|
/**
|
|
33
33
|
* `delegation` journals when an agent used as a tool starts and settles; hosts record it and resolve it at once.
|
|
34
34
|
* Flow effects: `agent` and `tool` (node) — each carries `path`, `key`, and `iterations`.
|
|
35
|
+
* `inputs` (D85) takes the messages steered into the running turn before a step; hosts answer it
|
|
36
|
+
* at once with `{events}`.
|
|
35
37
|
*/
|
|
36
|
-
readonly kind: "model" | "tool" | "delegation" | "agent";
|
|
38
|
+
readonly kind: "model" | "tool" | "delegation" | "agent" | "inputs";
|
|
37
39
|
/** Set on work for an agent used as a tool; `agentId` stays the session's root agent. */
|
|
38
40
|
readonly agent?: AgentRef;
|
|
39
41
|
/** The name the model called a tool by, for display; the record routes by `target`. */
|
|
@@ -141,6 +143,12 @@ export declare function runDurable(options: {
|
|
|
141
143
|
readonly steps?: number;
|
|
142
144
|
readonly ms?: number;
|
|
143
145
|
};
|
|
146
|
+
/**
|
|
147
|
+
* Ask the host for the messages steered into the turn (D85) before every step but its first:
|
|
148
|
+
* an `inputs` effect, which a host that serves it answers at once with `{events}`. Off unless
|
|
149
|
+
* set; the Harness API run sets it, since core serves it. Not hashed.
|
|
150
|
+
*/
|
|
151
|
+
takeInputs?: boolean;
|
|
144
152
|
/** The model the turn's calls use (`turn.start.model`), for the root and every child. */
|
|
145
153
|
model?: ModelDescriptor;
|
|
146
154
|
/** How the turn's files reach the model (`representFiles`), for the root and every child. */
|
package/dist/run/durable.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HarnessError } from "@nylorun/core/define";
|
|
2
|
-
import { effectIdOf } from "@nylorun/core/harness-api";
|
|
2
|
+
import { effectIdOf, HarnessApiError, } from "@nylorun/core/harness-api";
|
|
3
3
|
import { engineFeaturesOf } from "@nylorun/core/engine";
|
|
4
4
|
import { AgentManifestSchema, checkMemoryCall } from "@nylorun/core/contracts";
|
|
5
5
|
import { agentFrom, withHttpTarget } from "@nylorun/core/define";
|
|
@@ -201,6 +201,29 @@ export async function runDurable(options) {
|
|
|
201
201
|
});
|
|
202
202
|
},
|
|
203
203
|
};
|
|
204
|
+
/**
|
|
205
|
+
* The messages steered into the root's turn (D85), before step `stepNumber`: an `inputs`
|
|
206
|
+
* effect, journaled by core even when empty, so a replay takes the same at the same step. A
|
|
207
|
+
* core that doesn't know the kind (`invalid`) turns taking off for this run: its steers start
|
|
208
|
+
* the next turn instead.
|
|
209
|
+
*/
|
|
210
|
+
let takesInputs = true;
|
|
211
|
+
const takeInputs = async (turnId, stepNumber) => {
|
|
212
|
+
if (!takesInputs)
|
|
213
|
+
return [];
|
|
214
|
+
try {
|
|
215
|
+
const outcome = await effect("inputs", { step: stepNumber }, { turnId, stepNumber }, `step:${stepNumber}`);
|
|
216
|
+
const events = outcome.value?.events;
|
|
217
|
+
return Array.isArray(events) ? events : [];
|
|
218
|
+
}
|
|
219
|
+
catch (error) {
|
|
220
|
+
if (error instanceof HarnessApiError && error.code === "invalid") {
|
|
221
|
+
takesInputs = false;
|
|
222
|
+
return [];
|
|
223
|
+
}
|
|
224
|
+
throw error;
|
|
225
|
+
}
|
|
226
|
+
};
|
|
204
227
|
const hosted = hostedDefinition(manifest);
|
|
205
228
|
// Manifest reconstruction must retain definition identity, including schemas and instructions.
|
|
206
229
|
if (hosted.hash !== checkpoint.manifestHash)
|
|
@@ -217,6 +240,7 @@ export async function runDurable(options) {
|
|
|
217
240
|
...(options.files === undefined ? {} : { files: options.files }),
|
|
218
241
|
}, {
|
|
219
242
|
delegation,
|
|
243
|
+
...(options.takeInputs ? { takeInputs } : {}),
|
|
220
244
|
...(options.yieldAfter ? { yieldAfter: options.yieldAfter } : {}),
|
|
221
245
|
...(options.loop ? { loop: options.loop } : {}),
|
|
222
246
|
}));
|
|
@@ -280,7 +304,8 @@ function checkedMemoryTool(run) {
|
|
|
280
304
|
function identityOf(agent, tool, input, ref) {
|
|
281
305
|
const skill = skillOfToolCall(agent, tool, input);
|
|
282
306
|
return {
|
|
283
|
-
|
|
307
|
+
// A Runtime plugin's tool carries its own name (ADR-106): `memory`, not `nylorun__memory`.
|
|
308
|
+
toolName: tool.effectName ?? tool.name,
|
|
284
309
|
...(tool.target === undefined ? {} : { target: tool.target }),
|
|
285
310
|
...(skill === undefined ? {} : { skill }),
|
|
286
311
|
...(ref ? { agent: ref } : {}),
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { HostEffect } from "../run/durable.js";
|
|
2
|
+
export { ASK_LIMITS, ASK_TOOL } from "@nylorun/core/engine";
|
|
3
|
+
/** True when `effect` is a call of `ask` (ours: a `harness` call). */
|
|
4
|
+
export declare function isAskTool(effect: HostEffect): boolean;
|
|
5
|
+
/** Runs a call of `ask`: the interaction to wait on, or, once answered, the answer. */
|
|
6
|
+
export declare function runAskTool(effect: HostEffect): {
|
|
7
|
+
readonly kind: "failed";
|
|
8
|
+
readonly code: "ask.invalid_input";
|
|
9
|
+
readonly message: "Give question, what you need to know.";
|
|
10
|
+
readonly output?: undefined;
|
|
11
|
+
readonly interaction?: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
readonly code?: undefined;
|
|
14
|
+
readonly message?: undefined;
|
|
15
|
+
readonly kind: "completed";
|
|
16
|
+
readonly output: `Answer: ${string}`;
|
|
17
|
+
readonly interaction?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
readonly code?: undefined;
|
|
20
|
+
readonly message?: undefined;
|
|
21
|
+
readonly output?: undefined;
|
|
22
|
+
readonly kind: "interaction-required";
|
|
23
|
+
readonly interaction: {
|
|
24
|
+
readonly kind: "response";
|
|
25
|
+
readonly prompt: string;
|
|
26
|
+
readonly metadata: {
|
|
27
|
+
readonly kind: "question";
|
|
28
|
+
readonly choices?: string[] | undefined;
|
|
29
|
+
readonly why?: string | undefined;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ask` (ADR-106, `nylorun-interactions`): the agent asks whoever gave it the task a question it
|
|
3
|
+
* can't answer itself, and waits. Offered to the session's root agent when the version sets
|
|
4
|
+
* `harness.loop.ask: true` (`turn.start.loop.ask`; in an `agent-folder/3` folder, the
|
|
5
|
+
* `nylorun-interactions` plugin with its `ask` tool on).
|
|
6
|
+
*
|
|
7
|
+
* It runs here (`harness`), as `request_connection` does. A first call pauses the turn with an
|
|
8
|
+
* interaction of kind `response` whose `metadata` is `{ kind: "question", choices?, why? }`, which
|
|
9
|
+
* the session's waits carry and the A2A server shows as a question (`TASK_STATE_INPUT_REQUIRED`).
|
|
10
|
+
* The answer (`respond`) runs it again, in the next segment, with the value: `Answer: <value>`.
|
|
11
|
+
* A replayed call answers its recorded outcome.
|
|
12
|
+
*
|
|
13
|
+
* Long input is cut, never refused: the question at `ASK_LIMITS.questionChars`, the reason at
|
|
14
|
+
* `whyChars`, each choice at `choiceChars`, and at most `choices` of them.
|
|
15
|
+
*/
|
|
16
|
+
import { ASK_LIMITS, ASK_TOOL } from "@nylorun/core/engine";
|
|
17
|
+
import { cut } from "./plan.js";
|
|
18
|
+
export { ASK_LIMITS, ASK_TOOL } from "@nylorun/core/engine";
|
|
19
|
+
/** True when `effect` is a call of `ask` (ours: a `harness` call). */
|
|
20
|
+
export function isAskTool(effect) {
|
|
21
|
+
return effect.target?.kind === "harness" && effect.toolName === ASK_TOOL;
|
|
22
|
+
}
|
|
23
|
+
/** The answer as the model reads it: a string as it is, anything else as JSON. */
|
|
24
|
+
function answerOf(value) {
|
|
25
|
+
if (typeof value === "string")
|
|
26
|
+
return value;
|
|
27
|
+
if (typeof value === "object" &&
|
|
28
|
+
value !== null &&
|
|
29
|
+
typeof value.answer === "string")
|
|
30
|
+
return value.answer;
|
|
31
|
+
return JSON.stringify(value ?? null);
|
|
32
|
+
}
|
|
33
|
+
/** Runs a call of `ask`: the interaction to wait on, or, once answered, the answer. */
|
|
34
|
+
export function runAskTool(effect) {
|
|
35
|
+
const input = (effect.input ?? {});
|
|
36
|
+
const question = typeof input.question === "string" ? input.question.trim() : "";
|
|
37
|
+
if (question === "")
|
|
38
|
+
return {
|
|
39
|
+
kind: "failed",
|
|
40
|
+
code: "ask.invalid_input",
|
|
41
|
+
message: "Give question, what you need to know.",
|
|
42
|
+
};
|
|
43
|
+
const choices = Array.isArray(input.choices)
|
|
44
|
+
? input.choices
|
|
45
|
+
.filter((choice) => typeof choice === "string" && choice.trim() !== "")
|
|
46
|
+
.slice(0, ASK_LIMITS.choices)
|
|
47
|
+
.map((choice) => cut(choice.trim(), ASK_LIMITS.choiceChars))
|
|
48
|
+
: [];
|
|
49
|
+
const why = typeof input.why === "string" && input.why.trim() !== ""
|
|
50
|
+
? cut(input.why.trim(), ASK_LIMITS.whyChars)
|
|
51
|
+
: undefined;
|
|
52
|
+
const resume = effect.context?.resume;
|
|
53
|
+
if (resume?.kind === "response")
|
|
54
|
+
return { kind: "completed", output: `Answer: ${answerOf(resume.value)}` };
|
|
55
|
+
const prompt = cut(question, ASK_LIMITS.questionChars);
|
|
56
|
+
return {
|
|
57
|
+
kind: "interaction-required",
|
|
58
|
+
interaction: {
|
|
59
|
+
kind: "response",
|
|
60
|
+
prompt,
|
|
61
|
+
metadata: {
|
|
62
|
+
kind: "question",
|
|
63
|
+
...(choices.length > 0 ? { choices } : {}),
|
|
64
|
+
...(why === undefined ? {} : { why }),
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -61,4 +61,4 @@ export interface EngineTools {
|
|
|
61
61
|
* version declares `harness.engine.triggers` (`turn.start.agent.triggers`). An agent whose own
|
|
62
62
|
* tools name one of them keeps its own.
|
|
63
63
|
*/
|
|
64
|
-
export declare function engineToolsFor(agent: Pick<AgentManifest, "skills" | "tools" | "engine">, runsOn: TurnAgent | undefined, options: Pick<EngineToolOptions, "artifactPageBytes" | "sandboxTools" | "skillReadBytes">, memory?: EngineMemory, plan?: boolean, connections?: boolean, triggers?: boolean): EngineTools;
|
|
64
|
+
export declare function engineToolsFor(agent: Pick<AgentManifest, "skills" | "tools" | "engine">, runsOn: TurnAgent | undefined, options: Pick<EngineToolOptions, "artifactPageBytes" | "sandboxTools" | "skillReadBytes">, memory?: EngineMemory, plan?: boolean, connections?: boolean, triggers?: boolean, ask?: boolean): EngineTools;
|
|
@@ -9,6 +9,6 @@ import { engineProjection, } from "@nylorun/core/engine";
|
|
|
9
9
|
* version declares `harness.engine.triggers` (`turn.start.agent.triggers`). An agent whose own
|
|
10
10
|
* tools name one of them keeps its own.
|
|
11
11
|
*/
|
|
12
|
-
export function engineToolsFor(agent, runsOn, options, memory, plan = false, connections = false, triggers = false) {
|
|
13
|
-
return engineProjection(agent, runsOn, options, memory, plan, connections, triggers);
|
|
12
|
+
export function engineToolsFor(agent, runsOn, options, memory, plan = false, connections = false, triggers = false, ask = false) {
|
|
13
|
+
return engineProjection(agent, runsOn, options, memory, plan, connections, triggers, ask);
|
|
14
14
|
}
|
package/dist/tools/skills.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export interface SkillToolContext {
|
|
|
38
38
|
readonly channel: Pick<HarnessChannel, "request">;
|
|
39
39
|
readonly run: HarnessRun;
|
|
40
40
|
/** The agent whose skill the call reads: the turn's agent, or the agent used as a tool. */
|
|
41
|
-
readonly agent: Pick<AgentManifest, "skills">;
|
|
41
|
+
readonly agent: Pick<AgentManifest, "skills" | "engine">;
|
|
42
42
|
/**
|
|
43
43
|
* The most bytes of one file read into the model's context: the harness's `skillReadBytes`.
|
|
44
44
|
* The answer is also held to the run's `limits.recordEntryBytes`, since it is one record entry.
|
package/dist/tools/skills.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* for a folder the sandbox already holds since it last started.
|
|
23
23
|
*/
|
|
24
24
|
import { SKILL_ENTRY, SKILLS_MOUNT, skillFolderOf, skillInstructions, } from "@nylorun/core/define";
|
|
25
|
-
import { LOAD_SKILL_TOOL, READ_SKILL_RESOURCE_TOOL, SKILLS_USAGE, formatSkillCatalog, } from "@nylorun/core/engine";
|
|
25
|
+
import { LOAD_SKILL_TOOL, READ_SKILL_RESOURCE_TOOL, pluginSkill, pluginSkills, SKILLS_USAGE, formatSkillCatalog, } from "@nylorun/core/engine";
|
|
26
26
|
import { fromBase64 } from "@nylorun/core/harness-api";
|
|
27
27
|
export { DEFAULT_SKILL_READ_BYTES, LOAD_SKILL_TOOL, READ_SKILL_RESOURCE_TOOL, SKILLS_USAGE, formatSkillCatalog, skillFolderNote, skillTools, } from "@nylorun/core/engine";
|
|
28
28
|
/** True when `name` is one of our engine's skill tools. */
|
|
@@ -86,9 +86,28 @@ export async function runSkillTool(effect, context) {
|
|
|
86
86
|
const skills = new Map(Object.values(context.agent.skills ?? {}).map((skill) => [skill.name, skill]));
|
|
87
87
|
const name = typeof input.name === "string" ? input.name : "";
|
|
88
88
|
const skill = skills.get(name);
|
|
89
|
+
// A skill of a Runtime plugin the agent declares (ADR-106) is the plugin's: served from the bundle.
|
|
90
|
+
const declared = (context.agent.engine?.plugins ?? []).map((plugin) => plugin.name);
|
|
91
|
+
const ofPlugin = skill ? undefined : pluginSkill(declared, name);
|
|
92
|
+
if (ofPlugin)
|
|
93
|
+
return effect.toolName === LOAD_SKILL_TOOL
|
|
94
|
+
? {
|
|
95
|
+
kind: "completed",
|
|
96
|
+
output: { name: ofPlugin.name, content: skillInstructions(ofPlugin.text) },
|
|
97
|
+
}
|
|
98
|
+
: failed("skill.unknown_resource", `Skill '${ofPlugin.name}' has no resource '${typeof input.path === "string" ? input.path : ""}'.`);
|
|
89
99
|
if (!skill)
|
|
90
100
|
return effect.toolName === LOAD_SKILL_TOOL
|
|
91
|
-
? {
|
|
101
|
+
? {
|
|
102
|
+
kind: "completed",
|
|
103
|
+
output: {
|
|
104
|
+
unknown: name,
|
|
105
|
+
available: [
|
|
106
|
+
...skills.keys(),
|
|
107
|
+
...pluginSkills(declared).map((item) => item.name),
|
|
108
|
+
].sort(),
|
|
109
|
+
},
|
|
110
|
+
}
|
|
92
111
|
: failed("skill.unknown", `There is no skill '${name}'.`);
|
|
93
112
|
const { sandboxed } = context;
|
|
94
113
|
const recordBytes = context.run.start.limits.recordEntryBytes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nylorun/harness",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0-beta",
|
|
4
4
|
"description": "Nylorun's TypeScript agent execution engine. See github.com/nylorun/agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"zod": "^4.6.7"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@nylorun/core": "0.
|
|
80
|
+
"@nylorun/core": "0.37.0-beta"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
83
83
|
"zod": "^4.6.7"
|