pi-subagents 0.85.0 → 0.86.0

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 (51) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/bundle/agents.js +3 -3
  3. package/bundle/child-tool-plan.js +2 -2
  4. package/bundle/{chunk-JWYG26RE.js → chunk-2IYBCYFU.js} +24 -23
  5. package/bundle/{chunk-KEY3UQMQ.js → chunk-374MZFF4.js} +1 -1
  6. package/bundle/{chunk-CS4O36CZ.js → chunk-3RKFH2UZ.js} +5 -5
  7. package/bundle/{chunk-7MAE3DJV.js → chunk-5H4BICQZ.js} +1 -1
  8. package/bundle/{chunk-RV5OGHLO.js → chunk-6VD7BGIC.js} +2 -2
  9. package/bundle/{chunk-KDMFBYFM.js → chunk-77ASNIEM.js} +1 -1
  10. package/bundle/{chunk-JNXT3MPI.js → chunk-7ADDXUGF.js} +5 -5
  11. package/bundle/{chunk-O7CPL6H4.js → chunk-7QA7ZA46.js} +9 -9
  12. package/bundle/{chunk-HFTBF7SG.js → chunk-7ZUFN6ME.js} +1 -1
  13. package/bundle/{chunk-RQAUNAWG.js → chunk-A637IMAO.js} +2 -2
  14. package/bundle/{chunk-LTPH2DXH.js → chunk-BGXEAYUM.js} +3 -3
  15. package/bundle/{chunk-JO67XSKD.js → chunk-BU6PFPVX.js} +4 -4
  16. package/bundle/{chunk-WOVMHDES.js → chunk-BWC2LVII.js} +39 -45
  17. package/bundle/{chunk-LGMILZNE.js → chunk-GJGTMLPE.js} +2 -2
  18. package/bundle/{chunk-PHZP3KHB.js → chunk-GRJHIXYF.js} +1 -1
  19. package/bundle/{chunk-QO75KJBT.js → chunk-LGINOOY5.js} +2 -2
  20. package/bundle/{chunk-GCSLVFCX.js → chunk-NAFLUJ26.js} +1 -1
  21. package/bundle/{chunk-3UZ5FVVJ.js → chunk-O3YH7XIY.js} +35 -31
  22. package/bundle/{chunk-PVIVCDG2.js → chunk-PYOAIN3V.js} +2 -2
  23. package/bundle/{chunk-UX4SCV5N.js → chunk-QGO6HXHG.js} +80 -35
  24. package/bundle/{chunk-DV2NCNPR.js → chunk-QM3JGE4W.js} +11 -11
  25. package/bundle/{chunk-H2NLFTC5.js → chunk-S2Q75LP3.js} +1 -1
  26. package/bundle/{chunk-KZ34KQQH.js → chunk-UR7OW5S7.js} +4 -4
  27. package/bundle/{chunk-L2ENOFVZ.js → chunk-WN2E5XHN.js} +66 -26
  28. package/bundle/{chunk-N7B2KD74.js → chunk-YK3QYNLE.js} +1 -1
  29. package/bundle/{chunk-IQIWF2VX.js → chunk-ZJJCPV3L.js} +4 -4
  30. package/bundle/{chunk-T5V5BRCL.js → chunk-ZPY5QZCS.js} +1 -1
  31. package/bundle/control-channel.js +2 -2
  32. package/bundle/index.js +1 -1
  33. package/bundle/intercom-bridge.js +2 -2
  34. package/bundle/preflight.js +8 -8
  35. package/bundle/project-panes.js +3 -3
  36. package/docs/agents.md +6 -0
  37. package/docs/configuration.md +2 -2
  38. package/docs/tool-reference.md +2 -0
  39. package/package.json +1 -1
  40. package/src/extension/tool-activation.js +10 -1
  41. package/src/extension/tool-description.d.ts +1 -1
  42. package/src/extension/tool-description.js +8 -8
  43. package/src/runs/background/run-status.js +5 -4
  44. package/src/runs/background/subagent-runner.js +6 -6
  45. package/src/runs/shared/acceptance.js +69 -26
  46. package/src/runs/shared/external-cli-contract.d.ts +49 -0
  47. package/src/runs/shared/external-cli-contract.js +18 -13
  48. package/src/runs/shared/structured-output.js +10 -3
  49. package/src/shared/types.d.ts +57 -48
  50. package/src/tui/render.js +83 -22
  51. package/src/workflows/workflow-receipt.js +36 -53
@@ -1149,13 +1149,34 @@ function verifyRedactionEnv(env) {
1149
1149
  return value.length >= 4 && SENSITIVE_ENV_KEY_PATTERN.test(key);
1150
1150
  }));
1151
1151
  }
1152
- function redactVerifyEnv(value, env) {
1152
+ function verifySecrets(env) {
1153
+ return [...new Set(Object.values(verifyRedactionEnv(env)).filter(Boolean))].sort((left, right) => right.length - left.length);
1154
+ }
1155
+ function redactSecrets(value, secrets) {
1153
1156
  let redacted = value;
1154
- const secrets = [...new Set(Object.values(verifyRedactionEnv(env)).filter(Boolean))].sort((left, right) => right.length - left.length);
1155
1157
  for (const secret of secrets)
1156
1158
  redacted = redacted.replaceAll(secret, "[REDACTED]");
1157
1159
  return redacted;
1158
1160
  }
1161
+ function redactVerifyEnv(value, env) {
1162
+ return redactSecrets(value, verifySecrets(env));
1163
+ }
1164
+ /** Numbers are matched on their source text: parsing rounds or respells them (12345678901234567890, 1.50), which would hide a secret. */
1165
+ function parseRedactedVerifyValue(text, secrets) {
1166
+ return JSON.parse(text, (_key, value, context) => {
1167
+ if (typeof value === "string")
1168
+ return redactSecrets(value, secrets);
1169
+ if (typeof value === "number" && secrets.length > 0) {
1170
+ // Node 22+ and Bun pass the source text; without it, fail closed.
1171
+ const source = context?.source;
1172
+ return source !== undefined && redactSecrets(source, secrets) === source ? value : "[REDACTED]";
1173
+ }
1174
+ if (value && typeof value === "object" && !Array.isArray(value)) {
1175
+ return Object.fromEntries(Object.entries(value).map(([key, item]) => [redactSecrets(key, secrets), item]));
1176
+ }
1177
+ return value;
1178
+ });
1179
+ }
1159
1180
  function uniqueStrings(items) {
1160
1181
  return unique(items.map((item) => item?.trim()).filter((item) => Boolean(item)));
1161
1182
  }
@@ -1223,34 +1244,49 @@ const TYPED_VERIFY_OUTPUT_MAX_BYTES = 12_000;
1223
1244
  * A passing `output: "json"` command must print one JSON document on stdout.
1224
1245
  * The parsed value becomes the run's structured output; anything else turns
1225
1246
  * the passing run into a failed one so acceptance rejects rather than
1226
- * silently dropping the verdict. Stdout is already bounded by trimOutput, so a
1227
- * truncated document is detected by its marker instead of a parse guess.
1247
+ * silently dropping the verdict. The raw stdout is parsed, because the stored
1248
+ * stdout is redacted and redaction can hit JSON syntax (`true` in KDE_FULL_SESSION).
1249
+ * The schema checks the raw value so a redacted string cannot fail a correct
1250
+ * gate. Error messages quote parts of their input (a parse error quotes ~10
1251
+ * chars, schema paths escape `/` and `~`), so each one is built from the
1252
+ * redacted text or value, never the raw one.
1228
1253
  */
1229
- async function applyTypedVerifyOutput(command, run) {
1254
+ async function applyTypedVerifyOutput(command, run, rawStdout) {
1230
1255
  if (run.status !== "passed")
1231
1256
  return;
1232
- const stdout = run.stdout ?? "";
1257
+ const secrets = verifySecrets(command.env);
1258
+ const stdout = rawStdout.trim();
1233
1259
  const fail = (message) => {
1234
1260
  run.status = "failed";
1235
- run.structuredOutputError = message;
1261
+ run.structuredOutputError = redactSecrets(message, secrets);
1236
1262
  };
1237
- if (!stdout.trim())
1263
+ if (!stdout)
1238
1264
  return fail("output: \"json\" command printed nothing on stdout.");
1239
- if (stdout.endsWith("...[truncated]"))
1265
+ if (stdout.length > TYPED_VERIFY_OUTPUT_MAX_BYTES)
1240
1266
  return fail(`output: "json" stdout exceeded ${TYPED_VERIFY_OUTPUT_MAX_BYTES} characters and was truncated.`);
1241
1267
  let value;
1242
1268
  try {
1243
1269
  value = JSON.parse(stdout);
1244
1270
  }
1245
- catch (error) {
1246
- return fail(`output: "json" stdout is not valid JSON: ${error instanceof Error ? error.message : String(error)}`);
1271
+ catch {
1272
+ let reason = "parse failed";
1273
+ try {
1274
+ JSON.parse(redactSecrets(stdout, secrets));
1275
+ }
1276
+ catch (error) {
1277
+ reason = error instanceof Error ? error.message : String(error);
1278
+ }
1279
+ return fail(`output: "json" stdout is not valid JSON: ${reason}`);
1247
1280
  }
1281
+ const redactedValue = parseRedactedVerifyValue(stdout, secrets);
1248
1282
  if (command.schema) {
1249
1283
  const validation = await validateStructuredOutputValue(command.schema, value);
1250
- if (validation.status === "invalid")
1251
- return fail(`output: "json" stdout does not match gate.schema: ${validation.message}`);
1284
+ if (validation.status === "invalid") {
1285
+ const redactedValidation = await validateStructuredOutputValue(command.schema, redactedValue);
1286
+ return fail(`output: "json" stdout does not match gate.schema${redactedValidation.status === "invalid" ? `: ${redactedValidation.message}` : "."}`);
1287
+ }
1252
1288
  }
1253
- run.structuredOutput = value;
1289
+ run.structuredOutput = redactedValue;
1254
1290
  }
1255
1291
  /** The first typed verify result on a ledger, if any command produced one. */
1256
1292
  export function typedVerifyOutput(ledger) {
@@ -1258,6 +1294,13 @@ export function typedVerifyOutput(ledger) {
1258
1294
  return run ? { value: run.structuredOutput } : undefined;
1259
1295
  }
1260
1296
  async function runMemoizedVerifyCommand(command, defaultCwd, options = {}) {
1297
+ // Typed gates read inputs (a report file, a log) that can change without
1298
+ // the tracked tree changing, so their verdicts are never reused.
1299
+ if (command.output === "json") {
1300
+ const { run, rawStdout } = await runVerifyCommand(command, defaultCwd, options);
1301
+ await applyTypedVerifyOutput(command, run, rawStdout);
1302
+ return run;
1303
+ }
1261
1304
  const cwd = command.cwd ? path.resolve(defaultCwd, command.cwd) : defaultCwd;
1262
1305
  let workspaceState;
1263
1306
  try {
@@ -1266,10 +1309,8 @@ async function runMemoizedVerifyCommand(command, defaultCwd, options = {}) {
1266
1309
  catch {
1267
1310
  workspaceState = undefined;
1268
1311
  }
1269
- // Typed gates read inputs (a report file, a log) that can change without
1270
- // the tracked tree changing, so their verdicts are never reused.
1271
- if (!workspaceState || !options.artifactsDir || !options.runId || command.output === "json") {
1272
- return runVerifyCommand(command, defaultCwd, options);
1312
+ if (!workspaceState || !options.artifactsDir || !options.runId) {
1313
+ return (await runVerifyCommand(command, defaultCwd, options)).run;
1273
1314
  }
1274
1315
  const envKeys = Object.keys(command.env ?? {}).sort();
1275
1316
  const envHash = hash(JSON.stringify(Object.fromEntries(Object.entries(effectiveVerifyEnv(command.env)).sort(([left], [right]) => left.localeCompare(right)))));
@@ -1295,7 +1336,7 @@ async function runMemoizedVerifyCommand(command, defaultCwd, options = {}) {
1295
1336
  catch {
1296
1337
  // A cache miss or unreadable artifact must not prevent host verification.
1297
1338
  }
1298
- const result = await runVerifyCommand(command, defaultCwd, options);
1339
+ const { run: result } = await runVerifyCommand(command, defaultCwd, options);
1299
1340
  const evidenced = { ...result, artifactPath, cacheKey, memoized: false, envKeys, envHash, workspaceState };
1300
1341
  try {
1301
1342
  fs.mkdirSync(path.dirname(artifactPath), { recursive: true });
@@ -1363,6 +1404,7 @@ export function quoteExecutableForShell(command, platform = process.platform) {
1363
1404
  }
1364
1405
  return command;
1365
1406
  }
1407
+ /** `rawStdout` is unredacted and never stored; only typed output parsing reads it. */
1366
1408
  function runVerifyCommand(command, defaultCwd, options = {}) {
1367
1409
  return new Promise((resolve) => {
1368
1410
  const startedAt = Date.now();
@@ -1388,11 +1430,14 @@ function runVerifyCommand(command, defaultCwd, options = {}) {
1388
1430
  clearTimeout(hardKill);
1389
1431
  options.signal?.removeEventListener("abort", abortVerification);
1390
1432
  resolve({
1391
- id: command.id,
1392
- command: command.command,
1393
- cwd,
1394
- durationMs: Date.now() - startedAt,
1395
- ...result,
1433
+ run: {
1434
+ id: command.id,
1435
+ command: command.command,
1436
+ cwd,
1437
+ durationMs: Date.now() - startedAt,
1438
+ ...result,
1439
+ },
1440
+ rawStdout: stdout,
1396
1441
  });
1397
1442
  };
1398
1443
  const abortVerification = () => {
@@ -1531,8 +1576,6 @@ export async function evaluateAcceptance(input) {
1531
1576
  artifactsDir: input.artifactsDir,
1532
1577
  runId: input.runId,
1533
1578
  });
1534
- if (command.output === "json")
1535
- await applyTypedVerifyOutput(command, run);
1536
1579
  ledger.verifyRuns.push(run);
1537
1580
  if (input.signal?.aborted)
1538
1581
  break;
@@ -12,6 +12,55 @@ export declare function validateCodeOwnedProfileRunner(agent: {
12
12
  adapter?: string;
13
13
  };
14
14
  }): string | undefined;
15
+ export declare const EXTERNAL_CLI_ADAPTER_SAFETY: {
16
+ readonly "codex-exec": {
17
+ readonly sandbox: "read-only";
18
+ readonly approvalPolicy: "never";
19
+ readonly ephemeral: true;
20
+ };
21
+ readonly "codex-exec-writer": {
22
+ readonly access: "workspace-write";
23
+ readonly sandbox: "workspace-write";
24
+ readonly approvalPolicy: "never";
25
+ readonly ephemeral: true;
26
+ };
27
+ readonly "claude-code": {
28
+ readonly access: "read-only";
29
+ readonly authentication: "existing-cli-required";
30
+ readonly permissionMode: "plan";
31
+ readonly tools: "none";
32
+ readonly mcp: "empty-strict";
33
+ readonly settingSources: "user";
34
+ readonly userSettingsTrust: "required";
35
+ readonly sessionPersistence: false;
36
+ };
37
+ readonly "claude-code-writer": {
38
+ readonly access: "workspace-write";
39
+ readonly authentication: "existing-cli-required";
40
+ readonly permissionMode: "acceptEdits";
41
+ readonly tools: "Read,Write,Edit,Glob,Grep";
42
+ readonly mcp: "empty-strict";
43
+ readonly settingSources: "user";
44
+ readonly userSettingsTrust: "required";
45
+ readonly sessionPersistence: false;
46
+ };
47
+ readonly "cursor-agent": {
48
+ readonly access: "read-only";
49
+ readonly authentication: "cursor-api-key-or-existing-login";
50
+ readonly mode: "ask";
51
+ readonly sandbox: "enabled";
52
+ readonly workspaceTrust: "existing-required";
53
+ readonly sessionReuse: false;
54
+ };
55
+ readonly "cursor-agent-writer": {
56
+ readonly access: "workspace-write";
57
+ readonly authentication: "cursor-api-key-or-existing-login";
58
+ readonly mode: "print";
59
+ readonly sandbox: "enabled";
60
+ readonly workspaceTrust: "existing-required";
61
+ readonly sessionReuse: false;
62
+ };
63
+ };
15
64
  export declare function parseExternalCliCapabilityNarrowing(value: unknown, label: string): ExternalCliCapabilityNarrowing | undefined;
16
65
  export declare function resolveExternalCliRunnerStatus(input: {
17
66
  adapter?: CodeOwnedExternalCliAdapterId;
@@ -40,6 +40,16 @@ export function validateCodeOwnedProfileRunner(agent) {
40
40
  }
41
41
  return undefined;
42
42
  }
43
+ // What each adapter's own argv asks the CLI for. It is a profile, not a measurement:
44
+ // a runner command that wraps the CLI can grant something else.
45
+ export const EXTERNAL_CLI_ADAPTER_SAFETY = {
46
+ "codex-exec": { sandbox: "read-only", approvalPolicy: "never", ephemeral: true },
47
+ "codex-exec-writer": { access: "workspace-write", sandbox: "workspace-write", approvalPolicy: "never", ephemeral: true },
48
+ "claude-code": { access: "read-only", authentication: "existing-cli-required", permissionMode: "plan", tools: "none", mcp: "empty-strict", settingSources: "user", userSettingsTrust: "required", sessionPersistence: false },
49
+ "claude-code-writer": { access: "workspace-write", authentication: "existing-cli-required", permissionMode: "acceptEdits", tools: "Read,Write,Edit,Glob,Grep", mcp: "empty-strict", settingSources: "user", userSettingsTrust: "required", sessionPersistence: false },
50
+ "cursor-agent": { access: "read-only", authentication: "cursor-api-key-or-existing-login", mode: "ask", sandbox: "enabled", workspaceTrust: "existing-required", sessionReuse: false },
51
+ "cursor-agent-writer": { access: "workspace-write", authentication: "cursor-api-key-or-existing-login", mode: "print", sandbox: "enabled", workspaceTrust: "existing-required", sessionReuse: false },
52
+ };
43
53
  export function parseExternalCliCapabilityNarrowing(value, label) {
44
54
  if (value === undefined)
45
55
  return undefined;
@@ -56,13 +66,8 @@ export function parseExternalCliCapabilityNarrowing(value, label) {
56
66
  return input;
57
67
  }
58
68
  export function resolveExternalCliRunnerStatus(input) {
59
- const codexExec = input.adapter === "codex-exec";
60
- const codexExecWriter = input.adapter === "codex-exec-writer";
61
- const claudeCode = input.adapter === "claude-code";
62
- const claudeCodeWriter = input.adapter === "claude-code-writer";
63
- const cursorAgent = input.adapter === "cursor-agent";
64
- const cursorAgentWriter = input.adapter === "cursor-agent-writer";
65
- const cursor = cursorAgent || cursorAgentWriter;
69
+ const cursor = input.adapter === "cursor-agent" || input.adapter === "cursor-agent-writer";
70
+ const profileSafety = input.adapter ? EXTERNAL_CLI_ADAPTER_SAFETY[input.adapter] : undefined;
66
71
  const unsupported = cursor ? PROMPT_FILE_UNSUPPORTED : UNSUPPORTED;
67
72
  return {
68
73
  type: "external-cli",
@@ -70,12 +75,11 @@ export function resolveExternalCliRunnerStatus(input) {
70
75
  args: input.args ?? [],
71
76
  promptDelivery: cursor ? "prompt-file" : input.promptDelivery ?? "stdin",
72
77
  adapter: { id: input.adapter ?? "external-cli", version: 1, executionMode: cursor ? "one-shot-prompt-file" : "one-shot-stdin" },
73
- ...(codexExec ? { safety: { sandbox: "read-only", approvalPolicy: "never", ephemeral: true } } : {}),
74
- ...(codexExecWriter ? { safety: { access: "workspace-write", sandbox: "workspace-write", approvalPolicy: "never", ephemeral: true } } : {}),
75
- ...(claudeCode ? { safety: { access: "read-only", authentication: "existing-cli-required", permissionMode: "plan", tools: "none", mcp: "empty-strict", settingSources: "user", userSettingsTrust: "required", sessionPersistence: false } } : {}),
76
- ...(claudeCodeWriter ? { safety: { access: "workspace-write", authentication: "existing-cli-required", permissionMode: "acceptEdits", tools: "Read,Write,Edit,Glob,Grep", mcp: "empty-strict", settingSources: "user", userSettingsTrust: "required", sessionPersistence: false } } : {}),
77
- ...(cursorAgent ? { safety: { access: "read-only", authentication: "cursor-api-key-or-existing-login", mode: "ask", sandbox: "enabled", workspaceTrust: "existing-required", sessionReuse: false } } : {}),
78
- ...(cursorAgentWriter ? { safety: { access: "workspace-write", authentication: "cursor-api-key-or-existing-login", mode: "print", sandbox: "enabled", workspaceTrust: "existing-required", sessionReuse: false } } : {}),
78
+ ...(profileSafety ? {
79
+ safety: { ...profileSafety },
80
+ // A Herdr saved machine launches the remote adapter binary, never runner.command.
81
+ safetySource: { measured: false, ...(input.machine ? {} : { command: input.command }) },
82
+ } : {}),
79
83
  ...(input.machine ? { machine: input.machine } : {}),
80
84
  capabilities: {
81
85
  stop: true,
@@ -131,6 +135,7 @@ export function externalCliReceiptMetadata(input) {
131
135
  capabilities: { ...runner.capabilities },
132
136
  ...(machine ? { machine: { ...machine, ...(machine.remoteGit ? { remoteGit: { ...machine.remoteGit } } : {}) } } : {}),
133
137
  ...(runner.safety ? { safety: { ...runner.safety } } : {}),
138
+ ...(runner.safetySource ? { safetySource: { ...runner.safetySource } } : {}),
134
139
  ...(input.externalProcess ? {
135
140
  outputArtifacts: {
136
141
  stdoutPath: input.externalProcess.stdoutPath,
@@ -415,9 +415,16 @@ function validateWithCompile(compile, schema, value) {
415
415
  catch (error) {
416
416
  return { status: "invalid", message: `invalid outputSchema: ${error instanceof Error ? error.message : String(error)}` };
417
417
  }
418
- if (validator.Check(value))
419
- return { status: "valid" };
420
- const originalErrors = [...validator.Errors(value)];
418
+ let originalErrors;
419
+ try {
420
+ if (validator.Check(value))
421
+ return { status: "valid" };
422
+ originalErrors = [...validator.Errors(value)];
423
+ }
424
+ catch (error) {
425
+ // A recursive $ref compiles but overflows the stack when checked.
426
+ return { status: "invalid", message: `outputSchema cannot be validated (cyclic or too deep): ${error instanceof Error ? error.message : String(error)}` };
427
+ }
421
428
  const errors = [];
422
429
  const uniqueErrors = new Set();
423
430
  const seen = new Set();
@@ -1734,54 +1734,9 @@ export interface ExternalCliReceiptMetadata {
1734
1734
  };
1735
1735
  capabilities: ExternalCliCapabilities;
1736
1736
  machine?: ExternalCliMachineStatus;
1737
- safety?: {
1738
- sandbox: "read-only";
1739
- approvalPolicy: "never";
1740
- ephemeral: true;
1741
- } | {
1742
- access: "workspace-write";
1743
- sandbox: "workspace-write";
1744
- approvalPolicy: "never";
1745
- ephemeral: true;
1746
- } | {
1747
- permissionMode: "plan";
1748
- tools: "none";
1749
- mcp: "empty-strict";
1750
- settingSources: "none";
1751
- sessionPersistence: false;
1752
- } | {
1753
- access: "read-only";
1754
- authentication: "existing-cli-required";
1755
- permissionMode: "plan";
1756
- tools: "none";
1757
- mcp: "empty-strict";
1758
- settingSources: "user";
1759
- userSettingsTrust: "required";
1760
- sessionPersistence: false;
1761
- } | {
1762
- access: "workspace-write";
1763
- authentication: "existing-cli-required";
1764
- permissionMode: "acceptEdits";
1765
- tools: "Read,Write,Edit,Glob,Grep";
1766
- mcp: "empty-strict";
1767
- settingSources: "user";
1768
- userSettingsTrust: "required";
1769
- sessionPersistence: false;
1770
- } | {
1771
- access: "read-only";
1772
- authentication: "cursor-api-key-or-existing-login";
1773
- mode: "ask";
1774
- sandbox: "enabled";
1775
- workspaceTrust: "existing-required";
1776
- sessionReuse: false;
1777
- } | {
1778
- access: "workspace-write";
1779
- authentication: "cursor-api-key-or-existing-login";
1780
- mode: "print";
1781
- sandbox: "enabled";
1782
- workspaceTrust: "existing-required";
1783
- sessionReuse: false;
1784
- };
1737
+ safety?: ExternalCliProfileSafety;
1738
+ /** Where `safety` came from. Nothing in it is measured from the launched process. */
1739
+ safetySource?: ExternalCliSafetySource;
1785
1740
  outputArtifacts?: {
1786
1741
  stdoutPath?: string;
1787
1742
  stderrPath?: string;
@@ -1796,6 +1751,59 @@ export interface ExternalCliReceiptMetadata {
1796
1751
  };
1797
1752
  nonResumableReason: string;
1798
1753
  }
1754
+ export type ExternalCliProfileSafety = {
1755
+ sandbox: "read-only";
1756
+ approvalPolicy: "never";
1757
+ ephemeral: true;
1758
+ } | {
1759
+ access: "workspace-write";
1760
+ sandbox: "workspace-write";
1761
+ approvalPolicy: "never";
1762
+ ephemeral: true;
1763
+ } | {
1764
+ permissionMode: "plan";
1765
+ tools: "none";
1766
+ mcp: "empty-strict";
1767
+ settingSources: "none";
1768
+ sessionPersistence: false;
1769
+ } | {
1770
+ access: "read-only";
1771
+ authentication: "existing-cli-required";
1772
+ permissionMode: "plan";
1773
+ tools: "none";
1774
+ mcp: "empty-strict";
1775
+ settingSources: "user";
1776
+ userSettingsTrust: "required";
1777
+ sessionPersistence: false;
1778
+ } | {
1779
+ access: "workspace-write";
1780
+ authentication: "existing-cli-required";
1781
+ permissionMode: "acceptEdits";
1782
+ tools: "Read,Write,Edit,Glob,Grep";
1783
+ mcp: "empty-strict";
1784
+ settingSources: "user";
1785
+ userSettingsTrust: "required";
1786
+ sessionPersistence: false;
1787
+ } | {
1788
+ access: "read-only";
1789
+ authentication: "cursor-api-key-or-existing-login";
1790
+ mode: "ask";
1791
+ sandbox: "enabled";
1792
+ workspaceTrust: "existing-required";
1793
+ sessionReuse: false;
1794
+ } | {
1795
+ access: "workspace-write";
1796
+ authentication: "cursor-api-key-or-existing-login";
1797
+ mode: "print";
1798
+ sandbox: "enabled";
1799
+ workspaceTrust: "existing-required";
1800
+ sessionReuse: false;
1801
+ };
1802
+ export interface ExternalCliSafetySource {
1803
+ measured: false;
1804
+ /** The launch command, absent on a Herdr saved machine. A wrapper script here can grant more or less than the adapter profile. */
1805
+ command?: string;
1806
+ }
1799
1807
  export interface ExternalCliRunnerStatus {
1800
1808
  type: "external-cli";
1801
1809
  command: string;
@@ -1803,6 +1811,7 @@ export interface ExternalCliRunnerStatus {
1803
1811
  promptDelivery: "stdin" | "prompt-file";
1804
1812
  adapter: ExternalCliReceiptMetadata["adapter"];
1805
1813
  safety?: ExternalCliReceiptMetadata["safety"];
1814
+ safetySource?: ExternalCliSafetySource;
1806
1815
  capabilities: ExternalCliCapabilities;
1807
1816
  unsupportedReasons: Record<Exclude<keyof ExternalCliCapabilities, "stop">, string>;
1808
1817
  nonResumableReason: string;