@parcha/agentrun-harness-acp 0.1.0-beta.62 → 0.1.0-beta.63

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
@@ -2,6 +2,17 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## 0.1.0-beta.63 (2026-11-26)
6
+
7
+ - Cursor is now told at each session's start that its own Write tool is refused, so it writes a file with a shell command (which asks the person first) and never stops at that refusal without an answer; a shell command the person denies is their answer, not asked again. An ACP recipe can carry `instructions`, given to the agent after the session's own, by the same route. A conversation begun before its recipe had them (or changed them) gets them once, ahead of its next prompt, when an agent with no system prompt loads it. They count as given only once a copy of the agent's history taken after it answered the prompt that carried them is kept, so a runner that stops before that gives them again on the next load; this covers a session's own instructions in its first prompt too. <!-- changes/cursor-write-through-shell.md -->
8
+ - A tool result is held to the model's context window, not only to the fixed 120,000-character bound: a model with a small window (an Ollama model at 65,536 tokens, a 16k one) is never handed a result that fills its context. <!-- changes/tool-result-window-bound.md -->
9
+ - `boundResult(text, budget?)` takes the model's window (`{ contextWindow, baseInputTokens? }`): a result may take at most a quarter of what the window leaves (`RESULT_WINDOW_SHARE`), at three characters a token (`RESULT_CHARS_PER_TOKEN`), and never more than `HOST_RESULT_MAX_CHARS`. Past that it is cut with a note saying it was cut to fit the window and how to read on; a window too small for any cut refuses the result in words, and a result of at most 400 characters (`RESULT_ALWAYS_WHOLE_CHARS`) always stands whole, so bounding a bound changes nothing. With no window the bound is exactly as before. `resultMaxChars(budget)` gives the bound, and `boundTo(text, max)` cuts to a given bound, saying how (`ResultBound`: the characters kept, the whole length, the bound).
10
+ - `SessionSpec.contextWindow` carries the session model's window, and each harness adapter (Claude, Codex, ACP, OpenCode) takes a `contextWindow` option for when the host passes none; Codex and OpenCode are told that window in place of their 272,000 guess. A Codex script cut off by a crash is answered within the same bound (`recoveryMaxChars`), not `EXEC_RECOVERY_MAX_CHARS`.
11
+ - agentrun-serve puts the run's model window from its catalog on every session, and pi now holds every tool result to it too: a host tool's and a pi-native one's (web_fetch, web_search, the browser's), which before reached the model up to pi's own output limits. What a host tool streams while it runs is held to the bound too (`boundedProgress`), since pi writes a call cut off past its restart limit from that text, without its hooks.
12
+ - A turn's results together fit what the window has left (`TurnBudget`, `ResultBudget.turn`): from what the context already holds (the last request's input tokens and its answer's output, else the session's system prompt and tool schemas counted with o200k), less the room kept for the model's answer (`answerReserve`: a quarter of the window, at most `ANSWER_RESERVE_MAX_TOKENS`, 16,384 tokens), each call the model made takes the smaller of its own bound and what is left over the calls still unanswered, so parallel calls split it, and below the least a cut keeps a result is refused in words. The kernel owns the rule; the session's model proxy reports each answer's facts (`ModelProxyOptions.turn`, its calls counted from the stream by `toolCallsIn`) for Claude, Codex, OpenCode and Goose, and pi and Claude Code on a person's login report them from their own hooks (pi's afterResponse, the login's stream booking). `windowBudget(window, system?)` builds the budget with its turn. A call whose result goes to the harness's own tool rather than the model (`ToolBridgeOptions.outsideTurn`: Codex's code-mode script calls) takes the per-result bound alone, outside the turn's split.
13
+ - The bridge records each cut it hands a harness (`bound:<callId>`, `boundKey`), and a replay of the call is cut by that record. Codex compares a nested call's two records on those lengths, never on the note's words; `boundOf` is gone. A session written before the record still agrees where Codex got the host's bound's cut, as before.
14
+ - On Claude, Codex, ACP and OpenCode, a turn's budget outlasts a process that stops in the turn (a park, a crash): each answer's facts and each result's length as it was handed go to the session's journal as they happen (`journalTurn`, `TURN_STREAM`), and a budget that has read no answer yet takes them back before any call claims (`TurnBudget.restore`). The calls a resume answers split what their answer left, and a result handed before the stop keeps its part. Codex's recovered script outputs claim their room in the turn too and are held to that claim (`ResultBudget.maxChars`). pi's turn budget is not journaled yet: a pi session opened again starts a fresh one, and each result there keeps its per-result bound.
15
+
5
16
  ## 0.1.0-beta.62 (2026-11-26)
6
17
 
7
18
  - A late MCP call of a call that ended first (a cancel can report a call failed while its MCP call is on its way) takes its own announcement again before a live one that names no tool or reports no input, such as the agent's own think, whether that one was announced before the MCP call or while it held. Before, it could take that one's id: on a recipe with no announces field the think's, and on any recipe one announced during the hold. <!-- changes/acp-ended-own-first.md -->
package/dist/adapter.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { AgentAdapter, ModelPort } from "@parcha/agentrun-kernel";
2
+ import { type TurnBudget } from "@parcha/agentrun-kernel/process";
2
3
  import { type ParentWatch } from "@parcha/agentrun-kernel/host";
3
4
  import { type AcpRecipe } from "./recipe.js";
4
5
  import type { ConfineChild } from "./host/child.js";
@@ -22,6 +23,10 @@ export interface AcpAdapterOptions {
22
23
  callIdWaitMs?: number;
23
24
  /** How long the agent may take to start and open its session. Default 60 s. */
24
25
  startMs?: number;
26
+ /** The model's context window, in tokens: the host's bound on one tool result is its share of it (the kernel's
27
+ * resultMaxChars), under HOST_RESULT_MAX_CHARS. A session's own (SessionSpec.contextWindow) wins. Absent, and none on
28
+ * the session: the host's bound alone. */
29
+ contextWindow?: number;
25
30
  log?: (message: string, fields?: Record<string, unknown>) => void;
26
31
  /** Log each call the agent announces, ids and names only (AcpHarnessOptions.debug). */
27
32
  debug?: boolean;
@@ -35,6 +40,8 @@ export interface AcpProxySession {
35
40
  readonly tools: readonly string[];
36
41
  /** Ends the agent's drive: its turn ends failed in `reason`'s words. */
37
42
  halt(reason: unknown): void;
43
+ /** The session's turn budget (ResultBudget.turn): a proxy opens it with each answer's facts (ModelProxyOptions.turn). */
44
+ readonly turn?: TurnBudget;
38
45
  }
39
46
  /** A proxy for one agent process: the variables that point it at the proxy, and the proxy's close. */
40
47
  export type AcpProxy = (session: AcpProxySession) => Promise<{
package/dist/adapter.js CHANGED
@@ -10,7 +10,7 @@ import { createHash, randomUUID } from "node:crypto";
10
10
  import { join } from "node:path";
11
11
  import { toolSchemaProblems } from "@parcha/agentrun-kernel";
12
12
  import { abortedOutcome, openDrive, pendingSubmissions, SessionHalt } from "@parcha/agentrun-kernel/kernel";
13
- import { bridgeTool, recoveryNote, settleTurn, transcriptOf } from "@parcha/agentrun-kernel/process";
13
+ import { bridgeTool, recoveryNote, settleTurn, transcriptOf, windowBudget } from "@parcha/agentrun-kernel/process";
14
14
  import { serialWriter } from "@parcha/agentrun-kernel/host";
15
15
  import { acpHarness, sentSubmissions } from "./harness.js";
16
16
  import { recipeProblems } from "./recipe.js";
@@ -74,16 +74,21 @@ export function acpAdapter(options) {
74
74
  throw new Error("acp: a session needs a private directory: the host lends one (io.dir), or pass sessionsDir");
75
75
  const instructions = spec.system.join("\n\n");
76
76
  let control;
77
+ // Each tool result held to the model's share of its window (the session's, else this adapter's; none: the host's
78
+ // bound), and a turn's results to what it has left, which a proxy reads from each answer.
79
+ const budget = windowBudget(spec.contextWindow ?? options.contextWindow, spec.system);
80
+ const turn = budget.resultBudget?.turn;
77
81
  const harness = acpHarness({
78
82
  recipe,
79
83
  tools: spec.tools.map((tool) => bridgeTool(tool)),
84
+ ...budget,
80
85
  ...(instructions ? { instructions } : {}),
81
86
  dir,
82
87
  ...(io.cwd ? { cwd: io.cwd } : {}),
83
88
  ...(options.confine ? { confine: options.confine } : {}),
84
89
  ...(options.parentWatch ? { parentWatch: options.parentWatch } : {}),
85
90
  ...(options.env ? { env: options.env } : {}),
86
- ...(options.proxy ? { proxy: (drive) => options.proxy({ models: io.models, tools: spec.tools.map((tool) => tool.name), halt: drive.halt }) } : {}),
91
+ ...(options.proxy ? { proxy: (drive) => options.proxy({ models: io.models, tools: spec.tools.map((tool) => tool.name), halt: drive.halt, ...(turn ? { turn } : {}) }) } : {}),
87
92
  ...(options.beforeStart ? { beforeStart: options.beforeStart } : {}),
88
93
  ...(options.callIdWaitMs !== undefined ? { callIdWaitMs: options.callIdWaitMs } : {}),
89
94
  ...(options.startMs !== undefined ? { startMs: options.startMs } : {}),
package/dist/harness.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { GateAnswer, GateCall } from "@parcha/agentrun-kernel";
2
2
  import type { DriveContext, HostTool, SessionState } from "@parcha/agentrun-kernel/kernel";
3
+ import { type ResultBudget } from "@parcha/agentrun-kernel/process";
3
4
  import type { ParentWatch } from "@parcha/agentrun-kernel/host";
4
5
  import { type AcpRecipe } from "./recipe.js";
5
6
  import type { ConfineChild } from "./host/child.js";
@@ -21,6 +22,13 @@ export declare const REASK_LIMIT = 3;
21
22
  export declare const TOOLS_STREAM = "acp.tools";
22
23
  /** The model chosen for the agent's session (recipe.model, as the agent lists it), one record each time one is chosen. */
23
24
  export declare const MODEL_STREAM = "acp.model";
25
+ /** Instructions a prompt carried ahead of its words (an agent with no system prompt), one record each time, written only
26
+ * with a copy of the agent's history taken after it answered that prompt: `sessionId` the session, `text` the recipe's
27
+ * part, `whole` when the session's own came too (its first prompt). A loaded session is given the recipe's again when
28
+ * they differ from the last of its records (a recipe that gained or changed them since), and all of them when it was
29
+ * opened to get them in a prompt (SESSION_STREAM `prompted`) and has no `whole` record: a crash before the copy
30
+ * leaves a history without them. */
31
+ export declare const INSTRUCTIONS_STREAM = "acp.instructions";
24
32
  /** How long a session waits for the agent to start and answer initialize, or open its session. */
25
33
  export declare const START_MS = 60000;
26
34
  /** How long an MCP call waits for the agent's tool_call that announces it. */
@@ -49,6 +57,9 @@ export interface AcpHarnessOptions {
49
57
  env?: Readonly<Record<string, string | undefined>>;
50
58
  /** The host's gate (SessionIO.gate). Absent: every call runs. */
51
59
  gate?: (call: GateCall) => Promise<GateAnswer>;
60
+ /** What the session's model can take of one tool result (its context window): the tool bridge holds every result to
61
+ * it (boundResult's budget). Absent: the host's bound alone (HOST_RESULT_MAX_CHARS). */
62
+ resultBudget?: ResultBudget;
52
63
  /** Proxy billing: what each agent process gets to reach the host's model proxy (its variables), closed with it.
53
64
  * `halt` ends the drive the process serves. */
54
65
  proxy?: (drive: {
package/dist/harness.js CHANGED
@@ -18,7 +18,7 @@ import { chmodSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
18
18
  import { dirname, isAbsolute, join, normalize } from "node:path";
19
19
  import { fileURLToPath } from "node:url";
20
20
  import { PROTOCOL_VERSION } from "@agentclientprotocol/sdk";
21
- import { askGate, journalRecords, NativeJournal, openTurn, placeSubmissions, recoveryNote, resumeUnstartedCalls, toolBridge, toolKey, transcriptOf } from "@parcha/agentrun-kernel/process";
21
+ import { askGate, journalRecords, journalTurn, NativeJournal, openTurn, placeSubmissions, recoveryNote, resumeUnstartedCalls, toolBridge, toolKey, transcriptOf } from "@parcha/agentrun-kernel/process";
22
22
  import { announceCall, announcedField, announcesAt, CallIds, declaresProperty, joinsByOne, mcpServerName, nameCall, namesTooLong, ourTool, permissionCallId, toolsLeftOut } from "./calls.js";
23
23
  import { ACP_CODES } from "./facts.js";
24
24
  import { allowFileText, homePath } from "./recipe.js";
@@ -44,6 +44,13 @@ export const REASK_LIMIT = 3;
44
44
  export const TOOLS_STREAM = "acp.tools";
45
45
  /** The model chosen for the agent's session (recipe.model, as the agent lists it), one record each time one is chosen. */
46
46
  export const MODEL_STREAM = "acp.model";
47
+ /** Instructions a prompt carried ahead of its words (an agent with no system prompt), one record each time, written only
48
+ * with a copy of the agent's history taken after it answered that prompt: `sessionId` the session, `text` the recipe's
49
+ * part, `whole` when the session's own came too (its first prompt). A loaded session is given the recipe's again when
50
+ * they differ from the last of its records (a recipe that gained or changed them since), and all of them when it was
51
+ * opened to get them in a prompt (SESSION_STREAM `prompted`) and has no `whole` record: a crash before the copy
52
+ * leaves a history without them. */
53
+ export const INSTRUCTIONS_STREAM = "acp.instructions";
47
54
  /** How long a session waits for the agent to start and answer initialize, or open its session. */
48
55
  export const START_MS = 60_000;
49
56
  /** How long an MCP call waits for the agent's tool_call that announces it. */
@@ -210,17 +217,19 @@ export function acpHarness(options, control) {
210
217
  /** Why an agent that ended did: its last words on stderr, else the error's, else that it said nothing. On a hushed run,
211
218
  * its exit status alone. */
212
219
  const whyEnded = (agent, error) => hushed ? `${agent.ended() ?? "its end is not known yet"}; what it printed is kept nowhere on this run` : lastWords(agent.stderrTail()) || lastWords(message(error)) || "it said nothing";
213
- /** Mirror the agent's session store into `journal` (the caller flushes). A failure is said and never thrown: the next
214
- * point takes the mirror again, and a turn's outcome is never lost to it. */
220
+ /** Mirror the agent's session store into `journal` (the caller flushes); true once taken. A failure is said and never
221
+ * thrown: the next point takes the mirror again, and a turn's outcome is never lost to it. */
215
222
  const mirrorInto = (rt, journal) => {
216
223
  // A HOME removed with its process holds nothing to take: read now, it would say the agent deleted its whole store.
217
224
  if (rt.wiped)
218
- return;
225
+ return false;
219
226
  try {
220
227
  rt.mirror.take(journal);
228
+ return true;
221
229
  }
222
230
  catch (error) {
223
231
  log("acp: the mirror of the agent's session store failed; the next point takes it again", { error: said(error) });
232
+ return false;
224
233
  }
225
234
  };
226
235
  /** The open turn's limit of tool calls, counted from the records: past it, the turn is cancelled with a named reason. */
@@ -669,7 +678,8 @@ export function acpHarness(options, control) {
669
678
  const server = recipe.declares.mcp === "http"
670
679
  ? { type: "http", name: rt.server, url: mcp.url, headers: [{ name: "Authorization", value: `Bearer ${key}` }] }
671
680
  : { name: rt.server, command: process.execPath, args: [STDIO_BRIDGE], env: [{ name: "AGENTRUN_MCP_URL", value: mcp.url }, { name: "AGENTRUN_MCP_KEY", value: key }] };
672
- const instructions = options.instructions?.trim() ? options.instructions : undefined;
681
+ // The session's own, then the recipe's (how it runs the agent, which the agent cannot see).
682
+ const instructions = [options.instructions, recipe.instructions].filter((each) => !!each?.trim()).join("\n\n") || undefined;
673
683
  const systemPrompt = instructions && caps.sessionCapabilities?.systemPrompt ? { mode: "append", content: [{ type: "text", text: instructions }] } : undefined;
674
684
  const last = journalRecords(ctx.state(), SESSION_STREAM).map((r) => r.data?.sessionId).filter((id) => typeof id === "string").at(-1);
675
685
  /** What session/load or session/new answered: the models it lists, for one. */
@@ -691,14 +701,33 @@ export function acpHarness(options, control) {
691
701
  rt.loading = false;
692
702
  }
693
703
  }
704
+ // session/load carries no instructions for an agent with no system prompt: they are in its history once a copy of
705
+ // it taken after the prompt that carried them says so (INSTRUCTIONS_STREAM). The session's own come again when
706
+ // that prompt was cut (a crash before the copy); the recipe's too, or when they came or changed since (an upgrade).
707
+ const recipeTold = recipe.instructions?.trim() ? recipe.instructions : undefined;
708
+ if (!rt.fresh && instructions && !systemPrompt) {
709
+ const prompted = journalRecords(ctx.state(), SESSION_STREAM).some((r) => r.data?.sessionId === last && r.data?.prompted === true);
710
+ const given = journalRecords(ctx.state(), INSTRUCTIONS_STREAM).map((r) => r.data).filter((d) => d?.sessionId === last);
711
+ if (prompted && !given.some((d) => d?.whole === true)) {
712
+ rt.firstBlocks.push(`Instructions for this session, from the host that runs you:\n\n${instructions}`);
713
+ rt.told = { text: recipeTold, whole: true };
714
+ }
715
+ else if (recipeTold && given.map((d) => d?.text).at(-1) !== recipeTold) {
716
+ rt.firstBlocks.push(`Instructions for this session, from the host that runs you:\n\n${recipeTold}`);
717
+ rt.told = { text: recipeTold };
718
+ }
719
+ }
694
720
  if (rt.fresh) {
695
721
  const opened = await ask("session/new", () => live.connection.agent.request("session/new", { cwd: root, mcpServers: [server], ...(systemPrompt ? { systemPrompt } : {}) }));
696
722
  rt.sessionId = opened.sessionId;
697
- journal.append(SESSION_STREAM, { sessionId: opened.sessionId });
723
+ // `prompted`: its instructions go in its first prompt, so a load checks they reached its history.
724
+ journal.append(SESSION_STREAM, { sessionId: opened.sessionId, ...(instructions && !systemPrompt ? { prompted: true } : {}) });
698
725
  mirrorInto(rt, journal);
699
726
  await journal.flush();
700
- if (instructions && !systemPrompt)
727
+ if (instructions && !systemPrompt) {
701
728
  rt.firstBlocks.push(`Instructions for this session, from the host that runs you:\n\n${instructions}`);
729
+ rt.told = { text: recipeTold, whole: true };
730
+ }
702
731
  const context = contextNote(ctx.state());
703
732
  if (context)
704
733
  rt.firstBlocks.push(context);
@@ -741,11 +770,14 @@ export function acpHarness(options, control) {
741
770
  };
742
771
  async function driveOnce(ctx) {
743
772
  const journal = new NativeJournal(ctx);
773
+ // The turn's budget kept on this drive's journal: a resume answers the calls it left on its answer's facts.
774
+ journalTurn(options.resultBudget?.turn, journal);
744
775
  const gate = options.gate;
745
776
  // The gate is asked once the call's `seen` record is in the log: a call the gate parks is found again on a resume.
746
777
  const bridge = toolBridge(ctx, options.tools, {
747
778
  ...(gate ? { gate: async (call) => (await journal.flush(), gate(call)) } : {}),
748
779
  beforeNever: () => journal.flush(),
780
+ ...(options.resultBudget ? { budget: options.resultBudget } : {}),
749
781
  });
750
782
  const cur = { ctx, journal, bridge, signal: ctx.signal, inflight: new Set() };
751
783
  // A resumed session: each call of ours the agent made and the records never answered goes through the bridge before
@@ -818,6 +850,10 @@ export function acpHarness(options, control) {
818
850
  }
819
851
  // The send's mark, in the log first: a crash between the two reads "marked, maybe sent", never sent twice.
820
852
  journal.append(PROMPT_STREAM, { submission, ...(covers.length ? { covers: [...covers] } : {}) });
853
+ // The instructions this prompt carries are recorded given only with a copy of the agent's history taken after it
854
+ // answered (below): a crash before that leaves a copy without them, and the next load gives them again.
855
+ const telling = agent.told;
856
+ agent.told = undefined;
821
857
  await journal.flush();
822
858
  const prompt = [...agent.firstBlocks.splice(0), ...body].map((text) => ({ type: "text", text }));
823
859
  let ended;
@@ -859,7 +895,8 @@ export function acpHarness(options, control) {
859
895
  }
860
896
  if (ctx.signal.aborted)
861
897
  throw ctx.signal.reason;
862
- mirrorInto(agent, journal);
898
+ if (mirrorInto(agent, journal) && telling && answer !== undefined)
899
+ journal.append(INSTRUCTIONS_STREAM, { sessionId: agent.sessionId, ...telling });
863
900
  // Cancelled by the session's interrupt: no end is written, the turn stays open (its host settles it).
864
901
  if (interrupting) {
865
902
  await journal.flush();
@@ -318,6 +318,7 @@ export function gooseProxy(options) {
318
318
  const proxy = await startModelProxy({
319
319
  policy: goosePolicy({ model: options.model, tools: session.tools, ...(options.maxOutputTokens ? { maxOutputTokens: options.maxOutputTokens } : {}), ...(options.provider.auth ? { auth: options.provider.auth } : {}) }),
320
320
  hooks: session.models,
321
+ ...(session.turn ? { turn: session.turn } : {}),
321
322
  model: options.model,
322
323
  origin: options.provider.origin,
323
324
  credential: async () => (await options.provider.credential()) ?? "",
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { acpAdapter, type AcpAdapterOptions, type AcpProxy, type AcpProxySession
2
2
  export { ACP_CODES, acpFacts, type AcpFacts } from "./facts.js";
3
3
  export { ALLOW_FILE_FORMS, allowFileText, announcesProblems, AUTH_METHOD, homePath, MODEL_ID, recipeProblems, RESERVED_ENV, type AcpAllowFile, type AcpAllowForm, type AcpBilling, type AcpRecipe, type AcpRefusal } from "./recipe.js";
4
4
  export { ANNOUNCES_PATH, type AcpAnnounces } from "./calls.js";
5
- export { CALL_STREAM, contextNote, MODEL_STREAM, PERMISSION_STREAM, PROMPT_STREAM, REASK_LIMIT, SESSION_STREAM, sentSubmissions, TOOLS_STREAM } from "./harness.js";
5
+ export { CALL_STREAM, contextNote, INSTRUCTIONS_STREAM, MODEL_STREAM, PERMISSION_STREAM, PROMPT_STREAM, REASK_LIMIT, SESSION_STREAM, sentSubmissions, TOOLS_STREAM } from "./harness.js";
6
6
  export { STATE_BUDGET, STATE_STREAM, stateBudgetPassed, stateFiles, type StateRecord } from "./state.js";
7
7
  export type { ConfineChild } from "./host/child.js";
8
8
  export { GOOSE_INSTALL, GOOSE_NOT_INSTALLED, gooseFacts } from "./goose-facts.js";
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ export { acpAdapter } from "./adapter.js";
3
3
  export { ACP_CODES, acpFacts } from "./facts.js";
4
4
  export { ALLOW_FILE_FORMS, allowFileText, announcesProblems, AUTH_METHOD, homePath, MODEL_ID, recipeProblems, RESERVED_ENV } from "./recipe.js";
5
5
  export { ANNOUNCES_PATH } from "./calls.js";
6
- export { CALL_STREAM, contextNote, MODEL_STREAM, PERMISSION_STREAM, PROMPT_STREAM, REASK_LIMIT, SESSION_STREAM, sentSubmissions, TOOLS_STREAM } from "./harness.js";
6
+ export { CALL_STREAM, contextNote, INSTRUCTIONS_STREAM, MODEL_STREAM, PERMISSION_STREAM, PROMPT_STREAM, REASK_LIMIT, SESSION_STREAM, sentSubmissions, TOOLS_STREAM } from "./harness.js";
7
7
  export { STATE_BUDGET, STATE_STREAM, stateBudgetPassed, stateFiles } from "./state.js";
8
8
  export { GOOSE_INSTALL, GOOSE_NOT_INSTALLED, gooseFacts } from "./goose-facts.js";
9
9
  export { gooseAdapter, gooseRecipe, recipeFile } from "./goose.js";
package/dist/recipe.d.ts CHANGED
@@ -85,6 +85,10 @@ export interface AcpRecipe {
85
85
  * (`gpt-5.4-nano`): chosen with session/set_model among those session/new lists, before the first prompt. One it
86
86
  * does not list is refused with ACP_CODES.modelUnlisted. Absent: the agent's own default. */
87
87
  readonly model?: string;
88
+ /** What the agent is told at each session's start about how the recipe runs it, which it cannot see for itself
89
+ * (Cursor: its own Write tool is refused, so a file is written with a shell command): after the session's own
90
+ * instructions, by the same route (the system prompt the agent advertises, else ahead of the first prompt). */
91
+ readonly instructions?: string;
88
92
  /** Files written into its private HOME before it starts, by their path in HOME (`.config/goose/config.yaml`). */
89
93
  readonly files?: Readonly<Record<string, string>>;
90
94
  /** A file in HOME, written at each start from the tools that start's MCP server lists, that tells the agent to run
package/dist/recipe.js CHANGED
@@ -63,6 +63,9 @@ export function recipeProblems(recipe) {
63
63
  problems.push("the command must be an absolute path");
64
64
  if (!recipe.declares || typeof recipe.declares.load !== "boolean" || (recipe.declares.mcp !== "http" && recipe.declares.mcp !== "stdio"))
65
65
  problems.push('declares needs load (true or false) and mcp ("http" or "stdio")');
66
+ const told = recipe.instructions;
67
+ if (told !== undefined && (typeof told !== "string" || !told.trim()))
68
+ problems.push("the instructions must be words, when there are any");
66
69
  const billing = recipe.billing;
67
70
  if (billing?.kind === "plan") {
68
71
  if (!Number.isInteger(billing.maxTurns) || billing.maxTurns < 1)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcha/agentrun-harness-acp",
3
- "version": "0.1.0-beta.62",
3
+ "version": "0.1.0-beta.63",
4
4
  "description": "Any Agent Client Protocol agent as an AgentRun harness: the agent over stdio in a private HOME, the host's tools as one loopback MCP server, its permission asks through the host's gate, durable in AgentRun's own store.",
5
5
  "keywords": [
6
6
  "agentrun",
@@ -49,7 +49,7 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@agentclientprotocol/sdk": "2.7.0",
52
- "@parcha/agentrun-kernel": "0.1.0-beta.62",
52
+ "@parcha/agentrun-kernel": "0.1.0-beta.63",
53
53
  "zod": "4.6.6"
54
54
  },
55
55
  "publishConfig": {
@@ -6,6 +6,7 @@
6
6
  "files": {
7
7
  ".config/cursor/cli-config.json":"{\"version\":1,\"permissions\":{\"allow\":[],\"deny\":[\"Write(**)\"]},\"approvalMode\":\"allowlist\"}\n"
8
8
  },
9
+ "instructions": "Your own file-writing tool (Write) is turned off here: every write with it is refused, and asking does not turn it on. To create or change a file, run a shell command that writes it (a heredoc such as cat > name <<'EOF' ... EOF, or a short script); a shell command asks the person first. When Write refuses a write, write the file with a shell command instead: never stop at that refusal or answer without the file. When the person denies a shell command, that is their answer: do not ask again for the same write; stop and say what you could not do.",
9
10
  "state": [".config/cursor/acp-sessions"],
10
11
  "credentials": [".config/cursor/auth.json"],
11
12
  "refusals": [