larness 0.5.0 → 0.5.1

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.
@@ -30599,8 +30599,7 @@ function createWebTools(options = {}) {
30599
30599
  })];
30600
30600
  }
30601
30601
  // src/modules/agent/turnRunner.ts
30602
- function commandDisplay(params) {
30603
- const request = CommandRequestSchema.parse(normalizeCommandRequest(params));
30602
+ function commandDisplay(request) {
30604
30603
  const redact = (value) => new OutputRedactor([]).push(value, true);
30605
30604
  if (request.mode === "shell") return {
30606
30605
  command: redact(request.command),
@@ -30617,6 +30616,15 @@ function commandDisplay(params) {
30617
30616
  })
30618
30617
  };
30619
30618
  }
30619
+ /**
30620
+ * Display helpers must never fail the Turn. Invalid tool arguments are already
30621
+ * reported to the model; parsing them here again used to throw a ZodError and
30622
+ * turn the whole Turn into an opaque INTERNAL failure.
30623
+ */
30624
+ function commandDisplayForArgs(params) {
30625
+ const parsed = CommandRequestSchema.safeParse(normalizeCommandRequest(params));
30626
+ return parsed.success ? commandDisplay(parsed.data) : void 0;
30627
+ }
30620
30628
  const APPROVAL_POLL_MS = 100;
30621
30629
  const CHECKPOINT_MIN_GAIN = 200;
30622
30630
  const DEFAULT_LOCK_WAIT_MS = 1e4;
@@ -30952,12 +30960,15 @@ var TurnRunner = class {
30952
30960
  if (checkBudget() !== "ok" || lockLost) throw new Error("Execution no longer authorized");
30953
30961
  },
30954
30962
  isBudgetExpired: () => deadlineReached,
30955
- onCreated: (commandId) => this.#emit(turn, session, "tool.command.created", {
30956
- turnId: turn.id,
30957
- toolCallId: request.id,
30958
- commandId,
30959
- command: commandDisplay(params)
30960
- })
30963
+ onCreated: (commandId) => {
30964
+ if (!parsedRequest.success) return;
30965
+ this.#emit(turn, session, "tool.command.created", {
30966
+ turnId: turn.id,
30967
+ toolCallId: request.id,
30968
+ commandId,
30969
+ command: commandDisplay(parsedRequest.data)
30970
+ });
30971
+ }
30961
30972
  }, params);
30962
30973
  const output = await this.#options.commands.output(row.id, 0, 500);
30963
30974
  const bounded = boundedCommandOutput(output.chunks.map((chunk) => chunk.data).join(""), 32e3);
@@ -32177,8 +32188,9 @@ var TurnRunner = class {
32177
32188
  }
32178
32189
  if (risk !== "L0") {
32179
32190
  const redact = (text) => redactOperationText(text, loadSecrets(), this.#options.secretStore);
32180
- const commandData = (request.name === "run_command" || request.name === "run_shell") && result.result.data !== void 0 ? result.result.data : void 0;
32181
- const display = commandData === void 0 ? void 0 : commandDisplay(request.args);
32191
+ const commandDataValue = result.result.data;
32192
+ const commandData = (request.name === "run_command" || request.name === "run_shell") && typeof commandDataValue === "object" && commandDataValue !== null && ("exitCode" in commandDataValue || "output" in commandDataValue) ? commandDataValue : void 0;
32193
+ const display = commandData === void 0 ? void 0 : commandDisplayForArgs(request.args);
32182
32194
  const displayText = display === void 0 ? void 0 : "command" in display ? `${display.cwd}$ ${display.command}` : `${display.cwd}$ ${[display.executable, ...display.args].join(" ")}`;
32183
32195
  const safeDisplay = displayText === void 0 ? void 0 : redact(displayText);
32184
32196
  const outputTail = typeof commandData?.output === "string" ? commandData.output.slice(-800) : void 0;
package/package.json CHANGED
@@ -77,7 +77,7 @@
77
77
  "bin": {
78
78
  "larness": "app.js"
79
79
  },
80
- "version": "0.5.0",
80
+ "version": "0.5.1",
81
81
  "description": "Larness — local-first agent workspace for projects, terminals, services and deployments",
82
82
  "license": "MIT",
83
83
  "keywords": [