pi-daddy 0.46.1 → 0.47.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 (106) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +41 -11
  3. package/contracts/ledger-record/v1/governance-event.schema.json +65 -3
  4. package/dist/governance/approval-prompt.d.ts +4 -0
  5. package/dist/governance/approval-prompt.d.ts.map +1 -1
  6. package/dist/governance/approval-prompt.js +59 -4
  7. package/dist/governance/approval-prompt.js.map +1 -1
  8. package/dist/governance/auto-mode-policy.d.ts +11 -0
  9. package/dist/governance/auto-mode-policy.d.ts.map +1 -0
  10. package/dist/governance/auto-mode-policy.js +309 -0
  11. package/dist/governance/auto-mode-policy.js.map +1 -0
  12. package/dist/governance/execution-retention.d.ts +3 -0
  13. package/dist/governance/execution-retention.d.ts.map +1 -1
  14. package/dist/governance/execution-retention.js +30 -0
  15. package/dist/governance/execution-retention.js.map +1 -1
  16. package/dist/governance/ledger-events.d.ts +14 -1
  17. package/dist/governance/ledger-events.d.ts.map +1 -1
  18. package/dist/governance/ledger-events.js +13 -0
  19. package/dist/governance/ledger-events.js.map +1 -1
  20. package/dist/governance/ledger-report.d.ts.map +1 -1
  21. package/dist/governance/ledger-report.js +5 -3
  22. package/dist/governance/ledger-report.js.map +1 -1
  23. package/dist/governance/ledger-v3-validation.d.ts.map +1 -1
  24. package/dist/governance/ledger-v3-validation.js +17 -3
  25. package/dist/governance/ledger-v3-validation.js.map +1 -1
  26. package/dist/governance/ledger.d.ts +1 -1
  27. package/dist/governance/ledger.d.ts.map +1 -1
  28. package/dist/governance/ledger.js +1 -1
  29. package/dist/governance/ledger.js.map +1 -1
  30. package/dist/kernel/approval.d.ts +1 -1
  31. package/dist/kernel/approval.d.ts.map +1 -1
  32. package/dist/kernel/approval.js +1 -1
  33. package/dist/kernel/approval.js.map +1 -1
  34. package/dist/kernel/auto-mode.d.ts +35 -0
  35. package/dist/kernel/auto-mode.d.ts.map +1 -0
  36. package/dist/kernel/auto-mode.js +29 -0
  37. package/dist/kernel/auto-mode.js.map +1 -0
  38. package/dist/kernel/delegate-types.d.ts +2 -0
  39. package/dist/kernel/delegate-types.d.ts.map +1 -1
  40. package/dist/kernel/delegate-types.js.map +1 -1
  41. package/dist/kernel/delegate.d.ts.map +1 -1
  42. package/dist/kernel/delegate.js +2 -2
  43. package/dist/kernel/delegate.js.map +1 -1
  44. package/dist/kernel/env-names.d.ts +2 -0
  45. package/dist/kernel/env-names.d.ts.map +1 -1
  46. package/dist/kernel/env-names.js +4 -0
  47. package/dist/kernel/env-names.js.map +1 -1
  48. package/dist/kernel/propagation.d.ts +5 -1
  49. package/dist/kernel/propagation.d.ts.map +1 -1
  50. package/dist/kernel/propagation.js +8 -2
  51. package/dist/kernel/propagation.js.map +1 -1
  52. package/dist/products/dashboard-cli.d.ts +6 -0
  53. package/dist/products/dashboard-cli.d.ts.map +1 -1
  54. package/dist/products/dashboard-cli.js +248 -52
  55. package/dist/products/dashboard-cli.js.map +1 -1
  56. package/dist/products/dashboard-display-controls.d.ts +2 -1
  57. package/dist/products/dashboard-display-controls.d.ts.map +1 -1
  58. package/dist/products/dashboard-display-controls.js +61 -0
  59. package/dist/products/dashboard-display-controls.js.map +1 -1
  60. package/dist/products/dashboard-render.d.ts +2 -0
  61. package/dist/products/dashboard-render.d.ts.map +1 -1
  62. package/dist/products/dashboard-render.js +2 -2
  63. package/dist/products/dashboard-render.js.map +1 -1
  64. package/dist/products/dashboard-screen.d.ts +52 -0
  65. package/dist/products/dashboard-screen.d.ts.map +1 -0
  66. package/dist/products/dashboard-screen.js +262 -0
  67. package/dist/products/dashboard-screen.js.map +1 -0
  68. package/dist/products/dashboard-session-client.d.ts +34 -2
  69. package/dist/products/dashboard-session-client.d.ts.map +1 -1
  70. package/dist/products/dashboard-session-client.js +51 -0
  71. package/dist/products/dashboard-session-client.js.map +1 -1
  72. package/dist/products/ecosystem-versions.d.ts +19 -0
  73. package/dist/products/ecosystem-versions.d.ts.map +1 -0
  74. package/dist/products/ecosystem-versions.js +2 -0
  75. package/dist/products/ecosystem-versions.js.map +1 -0
  76. package/extensions/approvals.ts +3 -2
  77. package/extensions/dashboard-session-server.ts +32 -4
  78. package/extensions/delegate-chain.ts +2 -0
  79. package/extensions/delegation-ledger.ts +10 -6
  80. package/extensions/ecosystem-versions.ts +166 -0
  81. package/extensions/grants-command.ts +33 -3
  82. package/extensions/grants.ts +28 -2
  83. package/extensions/reload-environment.ts +16 -1
  84. package/extensions/run-delegation.ts +49 -3
  85. package/extensions/session-auto-mode.ts +132 -0
  86. package/extensions/session.ts +47 -37
  87. package/package.json +2 -2
  88. package/src/governance/approval-prompt.ts +62 -4
  89. package/src/governance/auto-mode-policy.ts +297 -0
  90. package/src/governance/execution-retention.ts +24 -0
  91. package/src/governance/ledger-events.ts +22 -1
  92. package/src/governance/ledger-report.ts +5 -3
  93. package/src/governance/ledger-v3-validation.ts +17 -3
  94. package/src/governance/ledger.ts +1 -0
  95. package/src/kernel/approval.ts +1 -1
  96. package/src/kernel/auto-mode.ts +56 -0
  97. package/src/kernel/delegate-types.ts +2 -0
  98. package/src/kernel/delegate.ts +2 -1
  99. package/src/kernel/env-names.ts +4 -0
  100. package/src/kernel/propagation.ts +11 -2
  101. package/src/products/dashboard-cli.ts +255 -53
  102. package/src/products/dashboard-display-controls.ts +52 -0
  103. package/src/products/dashboard-render.ts +2 -2
  104. package/src/products/dashboard-screen.ts +339 -0
  105. package/src/products/dashboard-session-client.ts +60 -1
  106. package/src/products/ecosystem-versions.ts +18 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog — pi-daddy
2
2
 
3
+ ## 0.47.0 — 2026-10-09
4
+
5
+ - Add an explicit session Auto permission switch in the dashboard and `/grants auto on|off`, with `PI_DADDY_AUTO_MODE=0|1` setting the startup default. Descendants consult the live owner for every new admission; OFF prevents future automatic admissions without canceling already admitted work or revoking manual approvals. Reload retains the choice, new sessions reset it, and unavailable control refuses automatic approval.
6
+ - Put current work and actual pending approvals first in the terminal dashboard. Add keyboard navigation, focused details, a compact model view, collapsed history, resize-aware rendering and acknowledged Auto controls.
7
+ - Show loaded versus installed ecosystem versions, package sources and explicit native Pi update commands. Old extensions report an unknown loaded generation rather than borrowing the version on disk.
8
+ - Bound retained stdout/stderr snapshot growth using geometric checkpoints and a final bounded snapshot. Running captures indicate a not-yet-checkpointed suffix; a crash may omit that suffix. Recovered native-session reads no longer leave a false current-content-unavailable flag. Existing archive files are not removed.
9
+ - Record automatic admissions distinctly as once-only `approvalSources: auto`, plus session Auto changes. Schema-pinned current-record consumers must update their pin; historical ledger readers remain separate. JEV and LoRA consent are unchanged.
10
+
3
11
  ## 0.46.1 — 2026-10-08
4
12
 
5
13
  - Correct activity prompt/final attribution across consecutive root turns using Pi's actual hook order. Finalized message transformations are observed within the current turn; steering and canceled turns cannot seed the next task.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # pi-daddy
2
2
 
3
- Source target: **0.46.1**. Before installation, verify that `npm view pi-daddy version` and Git tag `v0.46.1` both resolve to this release.
3
+ Source target: **0.47.0**. Before installation, verify that `npm view pi-daddy version` and Git tag `v0.47.0` both resolve to this release.
4
4
 
5
5
  **Capability governance and coordination for [pi](https://github.com/badlogic/pi-mono)'s multi-level agent system.**
6
6
  An orchestrator grants each sub-agent a deliberate subset of what it holds and withholds the rest. A sub-agent may
@@ -163,13 +163,26 @@ escape hatch for an operator who wants the old behaviour, and an explicitly empt
163
163
 
164
164
  ## Approvals
165
165
 
166
- A gated capability needs the UI of the session executing the delegation. Captured children use Pi's JSON mode
167
- without a UI; a gate with neither an inherited approval nor an available UI is denied. The answer is **once**, **for this session**, or **always** (persisted for a bounded period, offered only for a
166
+ With Auto OFF, a gated capability needs a valid approval or the UI of the session executing the delegation. Captured children use Pi's JSON mode
167
+ without a UI; a gate with neither a valid approval nor an available UI is denied. The answer is **once**, **for this session**, or **always** (persisted for a bounded period, offered only for a
168
168
  named definition, keyed `capability@subject`). Approvals inherit down the subtree intersected with each child's grant;
169
169
  a `once` never crosses a spawn. The approval store and governance ledger never store raw task text. `/grants
170
170
  approvals` lists what is persisted; `/grants revoke <capability>@<definition>` or `--all` removes it. The store lives
171
171
  in pi's agent directory, not in the workspace.
172
172
 
173
+ **Auto mode** lets the operator approve every Daddy permission request for the current session and its descendants.
174
+ Start Pi with `PI_DADDY_AUTO_MODE=1` for Auto ON, or `PI_DADDY_AUTO_MODE=0` (the default when unset) for Auto OFF.
175
+ In the connected dashboard, press **a** to switch it on or off. `/grants auto on` and `/grants auto off` control the
176
+ same session setting; `/grants` shows the current state and source. Reload preserves the session choice; a new
177
+ Pi session starts from the environment default.
178
+
179
+ Auto is checked again before each delegation or chain step. Turning it OFF stops future automatic admissions;
180
+ already admitted work continues and independently granted manual approvals remain valid. Turning it ON can release
181
+ an outstanding Daddy approval prompt. An unavailable owning session never grants automatic permission. Automatic
182
+ decisions are recorded as `source: auto`, once for that admission, rather than banked as human or persistent approvals.
183
+ Capability grants, definition identity, workspace routing and execution settlement checks still apply. JEV calls and
184
+ LoRA storage retain their separate consent controls.
185
+
173
186
  Monetary usage is observational. It never pauses, stops or authorizes a child. Available usage remains in
174
187
  lifecycle records and episode reports; missing or partial coverage is not a zero-cost claim. Permission approvals,
175
188
  depth, fan-out limits and execution timeouts are separate controls.
@@ -216,7 +229,7 @@ work, final availability, subtree cleanup and optional observation completeness
216
229
  execution returns `isError` with its available evidence. Display, diagnostics and optional recording cannot replace
217
230
  the primary final. Unknown cleanup retains capacity and workspace exclusion.
218
231
 
219
- Pi and TypeBox are wildcard host-provided peers so Pi's extension loader supplies one shared runtime copy. Development and release qualification pin exact Pi **1.0.4**; later Pi versions require new qualification. Prefer a Pi-managed install under a host pinned to 1.0.4. An ordinary standalone npm install may resolve newer peer versions and is outside this qualification. In a Pi-managed no-peer install, standalone help, version and reporting remain available; run initialization inside Pi with `/grants init`. Use Principal **4.11.1** with this runtime's `delegate_describe` contract. Native phases use `plan`, `build`, `review`, `debug`, and `investigate` with their returned `definitionId`; independent parallel work uses one `delegate_all` batch.
232
+ Pi and TypeBox are wildcard host-provided peers so Pi's extension loader supplies one shared runtime copy. Development and release qualification pin exact Pi **1.0.4**; later Pi versions require new qualification. Prefer a Pi-managed install under a host pinned to 1.0.4. An ordinary standalone npm install may resolve newer peer versions and is outside this qualification. In a Pi-managed no-peer install, standalone help, version and reporting remain available; run initialization inside Pi with `/grants init`. Use Principal **4.11.2** with this runtime's `delegate_describe` contract. Native phases use `plan`, `build`, `review`, `debug`, and `investigate` with their returned `definitionId`; independent parallel work uses one `delegate_all` batch.
220
233
 
221
234
  Final capture preserves whitespace and concatenates text blocks without inserting separators. Tool-call terminals, empty visible finals and non-`stop` reasons are unavailable. Persisted message comparisons ignore object key order while preserving array order and every field value. The shared `final-conformance.json` table checks these semantics in both runtime and harness. Capture remains bounded: 4 MiB visible final, 32 MiB protocol line, 64 MiB persisted session, and a 3-second bounded session read. Exceeding a limit reports an unavailable final and blocks dependent handoffs; it does not imply the worker failed to settle.
222
235
 
@@ -247,12 +260,29 @@ operator authorization, candidate and artifacts before consuming its checkpoint
247
260
  This bridge never grants capabilities, approves work or calls JEV/OpenAI/other models. The ledger schema is unchanged.
248
261
  Same-user hostile filesystem or co-loaded-extension authenticity is outside this cooperative ownership boundary.
249
262
 
250
- `pi-daddy-dashboard` renders a ledger or activity timeline in a terminal; `/grants dashboard` opens it in a Herdr pane
251
- beside the session. Its execution history and current episode cost are
252
- read-only. A dashboard connected through `/grants dashboard` accepts
253
- `m <definition> <provider:model> <thinking>` (or `m all ...`) over a private session-local socket and applies the same
254
- in-memory overrides and `session_config` audit event as `/grants models`; a standalone dashboard is read-only, and
255
- neither form can affect enforcement.
263
+ `pi-daddy-dashboard` shows current work and actual pending approvals first; completed history is collapsed by default.
264
+ `/grants dashboard` opens it beside the session in a Herdr pane. The header shows Auto ON/OFF and connection state.
265
+ Use **a** to switch Auto, arrow keys to select a row, **Enter** for details, **m** for session models, **h** for history,
266
+ and **?** for help. The view fits the terminal and follows resize events. A disconnected control displays its state
267
+ as unavailable until the owning session acknowledges a fresh snapshot.
268
+
269
+ A connected dashboard sends explicit Auto choices and model edits over a private session-local socket. Model edits
270
+ use the same in-memory overrides and `session_config` audit path as `/grants models`; `m <definition>
271
+ <provider:model> <thinking>` and `m all ...` remain available in command mode. A standalone dashboard is read-only.
272
+ Execution history and cost remain observations, and incomplete usage is shown as unavailable rather than zero.
273
+
274
+ Press **v** for ecosystem versions. Pi, Daddy, Principal and Harness each show the loaded package generation,
275
+ version currently installed on disk, source and path. A mismatch calls for a reload (restart for Pi itself).
276
+ Older extensions without the reporter show their installed version with the loaded version explicitly unknown.
277
+ Multiple sources are flagged for inspection rather than choosing one arbitrarily. Package versions describe
278
+ what is present; they do not establish compatibility qualification or that npm has no newer release.
279
+ Version details provide native Pi commands for changing an explicit npm pin and rechecking Principal's installed
280
+ agent definitions. `pi update --extensions` retains pinned versions; use `pi install npm:<package>@<version>` to
281
+ replace a pin, then deliberately reload. There are no background registry checks or silent installations.
282
+
283
+ **:** opens command mode, **Tab** changes the task filter, **p/f** shows retained prompt/final content,
284
+ **Esc** returns to the previous view and **q** closes the dashboard.
285
+
256
286
 
257
287
  ## Bounds and configuration
258
288
 
@@ -261,7 +291,7 @@ configuration where both exist.
261
291
 
262
292
  | Area | Variables |
263
293
  | :--- | :--- |
264
- | Governance | `PI_DADDY_GOVERNANCE`, `PI_DADDY_GRANT`, `PI_DADDY_GATED`, `PI_DADDY_MAX_DEPTH`, `PI_DADDY_FANOUT`, `PI_DADDY_LEDGER`, `PI_DADDY_APPROVAL_TIMEOUT` |
294
+ | Governance | `PI_DADDY_GOVERNANCE`, `PI_DADDY_GRANT`, `PI_DADDY_GATED`, `PI_DADDY_MAX_DEPTH`, `PI_DADDY_FANOUT`, `PI_DADDY_LEDGER`, `PI_DADDY_APPROVAL_TIMEOUT`, `PI_DADDY_AUTO_MODE` |
265
295
  | Child execution | `PI_DADDY_HERDR`, `PI_DADDY_HERDR_WORKSPACE`, `PI_DADDY_HERDR_KEEP_PANE`, `PI_DADDY_CHILD_IDLE_TIMEOUT`, `PI_DADDY_CHILD_TIMEOUT`, `PI_DADDY_ALLOW_UNRESOLVED_MODELS` |
266
296
  | Workspaces and retention | `PI_DADDY_WORKSPACE_REGISTRY`, `PI_DADDY_WORKSPACE_LEASE_DIR`, `PI_DADDY_EXECUTION_ARCHIVE`, `PI_DADDY_RETAIN_NATIVE_SESSIONS`, `PI_DADDY_NATIVE_SESSION_ROOT` |
267
297
  | Activity | `PI_DADDY_ACTIVITY_TIMELINE`, `PI_DADDY_ACTIVITY_CONTENT` |
@@ -235,7 +235,8 @@
235
235
  "prompt",
236
236
  "session",
237
237
  "persisted",
238
- "inherited"
238
+ "inherited",
239
+ "auto"
239
240
  ]
240
241
  },
241
242
  "approvalScope": {
@@ -1153,7 +1154,8 @@
1153
1154
  "trigger": {
1154
1155
  "enum": [
1155
1156
  "first-delegation",
1156
- "grants-models"
1157
+ "grants-models",
1158
+ "auto-mode"
1157
1159
  ]
1158
1160
  },
1159
1161
  "overrides": {
@@ -1176,6 +1178,32 @@
1176
1178
  ],
1177
1179
  "additionalProperties": false
1178
1180
  }
1181
+ },
1182
+ "autoMode": {
1183
+ "type": "object",
1184
+ "properties": {
1185
+ "enabled": {
1186
+ "type": "boolean"
1187
+ },
1188
+ "source": {
1189
+ "enum": [
1190
+ "default",
1191
+ "environment",
1192
+ "session"
1193
+ ]
1194
+ },
1195
+ "revision": {
1196
+ "type": "integer",
1197
+ "minimum": 0,
1198
+ "maximum": 9007199254740991
1199
+ }
1200
+ },
1201
+ "required": [
1202
+ "enabled",
1203
+ "source",
1204
+ "revision"
1205
+ ],
1206
+ "additionalProperties": false
1179
1207
  }
1180
1208
  },
1181
1209
  "required": [
@@ -1187,7 +1215,41 @@
1187
1215
  "trigger",
1188
1216
  "overrides"
1189
1217
  ],
1190
- "additionalProperties": false
1218
+ "additionalProperties": false,
1219
+ "oneOf": [
1220
+ {
1221
+ "properties": {
1222
+ "trigger": {
1223
+ "const": "auto-mode"
1224
+ },
1225
+ "outcome": {
1226
+ "const": "changed"
1227
+ },
1228
+ "overrides": {
1229
+ "type": "object",
1230
+ "additionalProperties": false
1231
+ }
1232
+ },
1233
+ "required": [
1234
+ "autoMode"
1235
+ ]
1236
+ },
1237
+ {
1238
+ "properties": {
1239
+ "trigger": {
1240
+ "enum": [
1241
+ "first-delegation",
1242
+ "grants-models"
1243
+ ]
1244
+ }
1245
+ },
1246
+ "not": {
1247
+ "required": [
1248
+ "autoMode"
1249
+ ]
1250
+ }
1251
+ }
1252
+ ]
1191
1253
  },
1192
1254
  "episodeOutcome": {
1193
1255
  "type": "object",
@@ -9,6 +9,7 @@
9
9
  * Everything here denies on uncertainty. pi already agrees: in non-interactive modes it installs a
10
10
  * no-op UI context whose `select` resolves undefined, so even a missed `hasUI` check would deny.
11
11
  */
12
+ import type { AutoModeReader } from "../kernel/auto-mode.ts";
12
13
  import { type ApprovalPath, type ApprovalScope } from "../kernel/approval.ts";
13
14
  import type { Capability } from "../kernel/resolve.ts";
14
15
  /** The slice of pi's `ExtensionUIContext` this module needs. */
@@ -52,6 +53,8 @@ export interface PromptOutcome {
52
53
  * one. The rider's honest source is `session`, and this flag is how the caller can tell.
53
54
  */
54
55
  joined?: boolean;
56
+ /** Provisional Auto permission; the admission caller must still check the live owner policy. */
57
+ source?: "auto";
55
58
  }
56
59
  export interface ApprovalGateOptions {
57
60
  ui: ApprovalUI;
@@ -61,6 +64,7 @@ export interface ApprovalGateOptions {
61
64
  mode: string;
62
65
  /** Resolve only when this caller must open a new dialog; unused invalid settings cannot revoke authority. */
63
66
  timeoutMs?: number | (() => number | undefined);
67
+ autoMode?: AutoModeReader;
64
68
  }
65
69
  export interface ApprovalGate {
66
70
  request(request: PromptRequest): Promise<PromptOutcome>;
@@ -1 +1 @@
1
- {"version":3,"file":"approval-prompt.d.ts","sourceRoot":"","sources":["../../src/governance/approval-prompt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,EAAE,MAAM,CAAC;IACb,6GAA6G;IAC7G,SAAS,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC;IAChD,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CACzD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAO5E;AAoGD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,iBAAiB,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;AAEpE;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,IAAI,CAAC,OAAO,EAAE,mBAAmB,KAAK,YAAY,CAG3F;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,mBAAmB,EAC5B,QAAQ,GAAE,iBAA6B,GACtC,YAAY,CAgGd"}
@@ -9,6 +9,7 @@
9
9
  * Everything here denies on uncertainty. pi already agrees: in non-interactive modes it installs a
10
10
  * no-op UI context whose `select` resolves undefined, so even a missed `hasUI` check would deny.
11
11
  */
12
+ import { randomUUID } from "node:crypto";
12
13
  import { approvalKey, offeredScopes } from "../kernel/approval.js";
13
14
  export const DENY_LABEL = "Deny";
14
15
  export const SCOPE_LABELS = {
@@ -42,6 +43,7 @@ export function timeoutMsFromEnv(raw) {
42
43
  function labelToScope(label, scopes) {
43
44
  return scopes.find((s) => SCOPE_LABELS[s] === label) ?? null;
44
45
  }
46
+ const autoApproval = () => ({ scope: "once", kind: "granted", source: "auto" });
45
47
  const interrupted = (request, kind) => ({
46
48
  scope: null,
47
49
  kind,
@@ -53,30 +55,65 @@ async function selectApproval(options, request, title, labels) {
53
55
  const timeout = typeof options.timeoutMs === "function" ? options.timeoutMs() : options.timeoutMs;
54
56
  const controller = new AbortController();
55
57
  let outcome;
58
+ let settled = false;
56
59
  let wake;
57
60
  const stopped = new Promise((resolve) => {
58
61
  wake = resolve;
59
62
  });
60
- const stop = (kind) => {
61
- if (outcome)
63
+ const settle = (next) => {
64
+ if (settled)
62
65
  return;
63
- outcome = interrupted(request, kind);
66
+ settled = true;
67
+ outcome = next;
64
68
  // Resolve our tagged outcome before a UI reacts to abort by returning undefined.
65
69
  wake(outcome);
66
70
  controller.abort();
67
71
  };
72
+ const stop = (kind) => settle(interrupted(request, kind));
68
73
  const abort = () => stop("aborted");
69
74
  request.signal?.addEventListener("abort", abort, { once: true });
70
75
  const timer = timeout === undefined ? undefined : setTimeout(() => stop("expired"), timeout);
76
+ let untrack;
71
77
  try {
72
78
  if (request.signal?.aborted)
73
79
  stop("aborted");
74
80
  if (outcome)
75
81
  return outcome;
76
- const chosen = await Promise.race([options.ui.select(title, labels, { signal: controller.signal }), stopped]);
82
+ untrack = options.autoMode?.trackPending({
83
+ id: randomUUID(),
84
+ subject: request.subject,
85
+ capability: request.capability,
86
+ });
87
+ const selection = options.ui.select(title, labels, { signal: controller.signal }).then((chosen) => {
88
+ settled = true;
89
+ return chosen;
90
+ });
91
+ if (options.autoMode) {
92
+ const auto = options.autoMode;
93
+ void (async () => {
94
+ while (!controller.signal.aborted) {
95
+ await auto.waitEnabled(controller.signal);
96
+ // A notification is not authority: ON may already have changed back to OFF.
97
+ if (!controller.signal.aborted && (await auto.read()).enabled) {
98
+ settle(autoApproval());
99
+ return;
100
+ }
101
+ }
102
+ })().catch((error) => {
103
+ if (!controller.signal.aborted)
104
+ settle({
105
+ scope: null,
106
+ kind: "error",
107
+ reason: `Auto permission policy unavailable, denying (${String(error)})`,
108
+ });
109
+ });
110
+ }
111
+ const chosen = await Promise.race([selection, stopped]);
77
112
  return outcome ?? chosen;
78
113
  }
79
114
  finally {
115
+ controller.abort();
116
+ untrack?.();
80
117
  if (timer !== undefined)
81
118
  clearTimeout(timer);
82
119
  request.signal?.removeEventListener("abort", abort);
@@ -121,6 +158,16 @@ export function createApprovalGateProvider() {
121
158
  */
122
159
  export function createApprovalGate(options, inFlight = new Map()) {
123
160
  const ask = async (request) => {
161
+ // A queued once waiter owns its own decision. Auto may have changed while it joined another dialog.
162
+ if (options.autoMode) {
163
+ try {
164
+ if ((await options.autoMode.read()).enabled)
165
+ return request.signal?.aborted ? interrupted(request, "aborted") : autoApproval();
166
+ }
167
+ catch (error) {
168
+ return { scope: null, kind: "error", reason: `Auto permission policy unavailable, denying (${String(error)})` };
169
+ }
170
+ }
124
171
  const scopes = offeredScopes(request.path);
125
172
  const title = `grants: approve ${request.capability} for ${request.subject}?` +
126
173
  (request.task ? `\n task: ${request.task}` : "");
@@ -158,6 +205,14 @@ export function createApprovalGate(options, inFlight = new Map()) {
158
205
  async request(request) {
159
206
  if (request.signal?.aborted)
160
207
  return interrupted(request, "aborted");
208
+ try {
209
+ if (options.autoMode && (await options.autoMode.read()).enabled) {
210
+ return request.signal?.aborted ? interrupted(request, "aborted") : autoApproval();
211
+ }
212
+ }
213
+ catch (error) {
214
+ return { scope: null, kind: "error", reason: `Auto permission policy unavailable, denying (${String(error)})` };
215
+ }
161
216
  if (!options.hasUI) {
162
217
  // Nobody was there to ask — distinct from a person declining, which is why this is its own kind
163
218
  // rather than being folded into "declined" (see PromptOutcomeKind).
@@ -1 +1 @@
1
- {"version":3,"file":"approval-prompt.js","sourceRoot":"","sources":["../../src/governance/approval-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAyC,MAAM,uBAAuB,CAAC;AAa1G,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC;AAEjC,MAAM,CAAC,MAAM,YAAY,GAAkC;IACzD,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,wBAAwB;IACjC,MAAM,EAAE,wCAAwC;CACjD,CAAC;AAcF,gGAAgG;AAChG,MAA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AAC,CAAC;YAC3B,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { AutoModeReader, AutoModeRef, AutoModeSnapshot, AutoModeSource } from "../kernel/auto-mode.ts";
2
+ export interface AutoModeAuthority extends AutoModeReader {
3
+ snapshot(): AutoModeSnapshot;
4
+ set(enabled: boolean, source: AutoModeSource): AutoModeSnapshot;
5
+ }
6
+ export declare function createAutoModeAuthority(initial: {
7
+ enabled: boolean;
8
+ source: AutoModeSource;
9
+ }): Promise<AutoModeAuthority>;
10
+ export declare function connectAutoMode(reference: AutoModeRef): AutoModeReader;
11
+ //# sourceMappingURL=auto-mode-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auto-mode-policy.d.ts","sourceRoot":"","sources":["../../src/governance/auto-mode-policy.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,cAAc,EAEf,MAAM,wBAAwB,CAAC;AAShC,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACvD,QAAQ,IAAI,gBAAgB,CAAC;IAC7B,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,GAAG,gBAAgB,CAAC;CACjE;AAED,wBAAsB,uBAAuB,CAAC,OAAO,EAAE;IACrD,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,cAAc,CAAC;CACxB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA8J7B;AA8CD,wBAAgB,eAAe,CAAC,SAAS,EAAE,WAAW,GAAG,cAAc,CA8DtE"}