@nylorun/harness 0.32.0-beta → 0.33.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.33.0-beta
4
+
5
+ ### Minor Changes
6
+
7
+ - 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`.
8
+
9
+ ### Patch Changes
10
+
11
+ - Pin core to the tested release.
12
+ - Updated dependencies [2afa44d]
13
+ - @nylorun/core@0.36.0-beta
14
+
3
15
  ## 0.32.0-beta
4
16
 
5
17
  ### 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,
@@ -280,7 +280,8 @@ function checkedMemoryTool(run) {
280
280
  function identityOf(agent, tool, input, ref) {
281
281
  const skill = skillOfToolCall(agent, tool, input);
282
282
  return {
283
- toolName: tool.name,
283
+ // A Runtime plugin's tool carries its own name (ADR-106): `memory`, not `nylorun__memory`.
284
+ toolName: tool.effectName ?? tool.name,
284
285
  ...(tool.target === undefined ? {} : { target: tool.target }),
285
286
  ...(skill === undefined ? {} : { skill }),
286
287
  ...(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
  }
@@ -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.
@@ -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
- ? { kind: "completed", output: { unknown: name, available: [...skills.keys()].sort() } }
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.32.0-beta",
3
+ "version": "0.33.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.35.0-beta"
80
+ "@nylorun/core": "0.36.0-beta"
81
81
  },
82
82
  "peerDependencies": {
83
83
  "zod": "^4.6.7"