pi-daddy 0.46.0 → 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.
- package/CHANGELOG.md +14 -0
- package/README.md +77 -11
- package/contracts/ledger-record/v1/governance-event.schema.json +67 -3
- package/dist/governance/approval-prompt.d.ts +8 -11
- package/dist/governance/approval-prompt.d.ts.map +1 -1
- package/dist/governance/approval-prompt.js +138 -24
- package/dist/governance/approval-prompt.js.map +1 -1
- package/dist/governance/auto-mode-policy.d.ts +11 -0
- package/dist/governance/auto-mode-policy.d.ts.map +1 -0
- package/dist/governance/auto-mode-policy.js +309 -0
- package/dist/governance/auto-mode-policy.js.map +1 -0
- package/dist/governance/execution-retention.d.ts +3 -0
- package/dist/governance/execution-retention.d.ts.map +1 -1
- package/dist/governance/execution-retention.js +30 -0
- package/dist/governance/execution-retention.js.map +1 -1
- package/dist/governance/ledger-events.d.ts +14 -1
- package/dist/governance/ledger-events.d.ts.map +1 -1
- package/dist/governance/ledger-events.js +13 -0
- package/dist/governance/ledger-events.js.map +1 -1
- package/dist/governance/ledger-report.d.ts.map +1 -1
- package/dist/governance/ledger-report.js +5 -3
- package/dist/governance/ledger-report.js.map +1 -1
- package/dist/governance/ledger-v3-validation.d.ts.map +1 -1
- package/dist/governance/ledger-v3-validation.js +18 -4
- package/dist/governance/ledger-v3-validation.js.map +1 -1
- package/dist/governance/ledger.d.ts +4 -5
- package/dist/governance/ledger.d.ts.map +1 -1
- package/dist/governance/ledger.js +2 -2
- package/dist/governance/ledger.js.map +1 -1
- package/dist/kernel/approval.d.ts +1 -1
- package/dist/kernel/approval.d.ts.map +1 -1
- package/dist/kernel/approval.js +1 -1
- package/dist/kernel/approval.js.map +1 -1
- package/dist/kernel/auto-mode.d.ts +35 -0
- package/dist/kernel/auto-mode.d.ts.map +1 -0
- package/dist/kernel/auto-mode.js +29 -0
- package/dist/kernel/auto-mode.js.map +1 -0
- package/dist/kernel/delegate-types.d.ts +2 -0
- package/dist/kernel/delegate-types.d.ts.map +1 -1
- package/dist/kernel/delegate-types.js.map +1 -1
- package/dist/kernel/delegate.d.ts.map +1 -1
- package/dist/kernel/delegate.js +2 -2
- package/dist/kernel/delegate.js.map +1 -1
- package/dist/kernel/env-names.d.ts +2 -0
- package/dist/kernel/env-names.d.ts.map +1 -1
- package/dist/kernel/env-names.js +4 -0
- package/dist/kernel/env-names.js.map +1 -1
- package/dist/kernel/propagation.d.ts +5 -1
- package/dist/kernel/propagation.d.ts.map +1 -1
- package/dist/kernel/propagation.js +8 -2
- package/dist/kernel/propagation.js.map +1 -1
- package/dist/products/dashboard-cli.d.ts +6 -0
- package/dist/products/dashboard-cli.d.ts.map +1 -1
- package/dist/products/dashboard-cli.js +248 -52
- package/dist/products/dashboard-cli.js.map +1 -1
- package/dist/products/dashboard-display-controls.d.ts +2 -1
- package/dist/products/dashboard-display-controls.d.ts.map +1 -1
- package/dist/products/dashboard-display-controls.js +61 -0
- package/dist/products/dashboard-display-controls.js.map +1 -1
- package/dist/products/dashboard-render.d.ts +2 -0
- package/dist/products/dashboard-render.d.ts.map +1 -1
- package/dist/products/dashboard-render.js +2 -2
- package/dist/products/dashboard-render.js.map +1 -1
- package/dist/products/dashboard-screen.d.ts +52 -0
- package/dist/products/dashboard-screen.d.ts.map +1 -0
- package/dist/products/dashboard-screen.js +262 -0
- package/dist/products/dashboard-screen.js.map +1 -0
- package/dist/products/dashboard-session-client.d.ts +34 -2
- package/dist/products/dashboard-session-client.d.ts.map +1 -1
- package/dist/products/dashboard-session-client.js +51 -0
- package/dist/products/dashboard-session-client.js.map +1 -1
- package/dist/products/ecosystem-versions.d.ts +19 -0
- package/dist/products/ecosystem-versions.d.ts.map +1 -0
- package/dist/products/ecosystem-versions.js +2 -0
- package/dist/products/ecosystem-versions.js.map +1 -0
- package/extensions/activity-timeline.ts +94 -31
- package/extensions/approvals.ts +3 -2
- package/extensions/dashboard-session-server.ts +32 -4
- package/extensions/delegate-chain.ts +2 -0
- package/extensions/delegation-ledger.ts +10 -6
- package/extensions/ecosystem-versions.ts +166 -0
- package/extensions/execution-controls.ts +42 -0
- package/extensions/grants-command.ts +37 -3
- package/extensions/grants.ts +29 -2
- package/extensions/reload-environment.ts +16 -1
- package/extensions/run-delegation.ts +49 -3
- package/extensions/session-auto-mode.ts +132 -0
- package/extensions/session.ts +47 -37
- package/package.json +2 -2
- package/src/governance/approval-prompt.ts +144 -29
- package/src/governance/auto-mode-policy.ts +297 -0
- package/src/governance/execution-retention.ts +24 -0
- package/src/governance/ledger-events.ts +22 -1
- package/src/governance/ledger-report.ts +5 -3
- package/src/governance/ledger-v3-validation.ts +18 -4
- package/src/governance/ledger.ts +4 -4
- package/src/kernel/approval.ts +1 -1
- package/src/kernel/auto-mode.ts +56 -0
- package/src/kernel/delegate-types.ts +2 -0
- package/src/kernel/delegate.ts +2 -1
- package/src/kernel/env-names.ts +4 -0
- package/src/kernel/propagation.ts +11 -2
- package/src/products/dashboard-cli.ts +255 -53
- package/src/products/dashboard-display-controls.ts +52 -0
- package/src/products/dashboard-render.ts +2 -2
- package/src/products/dashboard-screen.ts +339 -0
- package/src/products/dashboard-session-client.ts +60 -1
- package/src/products/ecosystem-versions.ts +18 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
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
|
+
|
|
11
|
+
## 0.46.1 — 2026-10-08
|
|
12
|
+
|
|
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.
|
|
14
|
+
- Interactive approvals now wait for the human by default. Explicit `PI_DADDY_APPROVAL_TIMEOUT` deadlines still work; expiry, dismissal and caller cancellation remain refusals with distinct outcomes and retry guidance. The published ledger `gateOutcome` enum adds `expired` and `aborted`; schema-pinned consumers must update their pin.
|
|
15
|
+
- Show effective child wall/idle deadlines and diagnostic retention settings in `/grants`. Existing child defaults remain unchanged. Document a single-launch private native-session/diagnostic opt-in, separate from JEV/LoRA consent.
|
|
16
|
+
|
|
3
17
|
## 0.46.0 — 2026-10-08
|
|
4
18
|
|
|
5
19
|
Qualify owned Herdr execution on Linux x64 with client/server 0.8.2 and protocol 20. Native ownership gates execution and independently reaps descendants after coordinator, launcher or server loss; final answers use the same Pi 1.0.4 settled/persisted checks as captured execution. Add a durable session settlement journal and trusted runtime snapshot bridge for one-shot Principal resume. Unsupported versions refuse without backend substitution.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pi-daddy
|
|
2
2
|
|
|
3
|
-
Source target: **0.
|
|
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
|
-
|
|
167
|
-
without a UI; a gate with neither
|
|
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.
|
|
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`
|
|
251
|
-
beside the session.
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
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` |
|
|
@@ -276,6 +306,16 @@ limits still apply independently; this is not a lifetime call quota.
|
|
|
276
306
|
The retired `PI_DADDY_EPISODE_COST_CEILING`, `PI_DADDY_ADVISOR`, `PI_DADDY_ADVISOR_KEY`,
|
|
277
307
|
`PI_DADDY_ADVISOR_MODEL` and `PI_DADDY_ADVISOR_TASK_EGRESS` inputs are inert compatibility inputs.
|
|
278
308
|
|
|
309
|
+
Interactive approval prompts wait for the human by default. Set `PI_DADDY_APPROVAL_TIMEOUT` to canonical
|
|
310
|
+
whole seconds (1 through 2,147,483) for an explicit deadline; unset it or use literal `0` to wait indefinitely.
|
|
311
|
+
Expiry, user dismissal and caller cancellation have distinct `expired`, `dismissed` and `aborted` outcomes.
|
|
312
|
+
Each grants no permission and explains how to retry the delegation for a new prompt. Existing approvals
|
|
313
|
+
remain usable without consulting an unused timeout setting. Malformed values refuse a needed new prompt.
|
|
314
|
+
|
|
315
|
+
`/grants` shows effective child deadlines, approval waiting policy, and diagnostic retention settings.
|
|
316
|
+
Child wall/idle controls remain runtime safety bounds; zero or malformed child settings select their defaults.
|
|
317
|
+
They do not add time or token instructions to model prompts.
|
|
318
|
+
|
|
279
319
|
`PI_DADDY_CHILD_IDLE_TIMEOUT` is seconds without activity before a child is stopped (default fifteen minutes);
|
|
280
320
|
activity is output, a child-session-file change, or Linux process-tree CPU/descendant activity.
|
|
281
321
|
`PI_DADDY_CHILD_TIMEOUT` is the runaway ceiling for a child that never goes quiet (default six hours). The remaining
|
|
@@ -315,6 +355,32 @@ or a connected dashboard to edit session overrides. Delegation never opens an au
|
|
|
315
355
|
Valid thinking values are `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. `/grants` shows the
|
|
316
356
|
resolved value and source for every displayed definition.
|
|
317
357
|
|
|
358
|
+
### Keep evidence for one diagnostic session
|
|
359
|
+
|
|
360
|
+
Native child transcripts and execution diagnostics are separate opt-ins. To retain them for one Pi launch,
|
|
361
|
+
create private local directories outside the repository and scope the settings to that command:
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
diagnostic_root=$(mktemp -d "${TMPDIR:-/tmp}/pi-daddy-diagnostic.XXXXXX")
|
|
365
|
+
mkdir -m 700 "$diagnostic_root/native" "$diagnostic_root/archive"
|
|
366
|
+
PI_DADDY_RETAIN_NATIVE_SESSIONS=1 \
|
|
367
|
+
PI_DADDY_NATIVE_SESSION_ROOT="$diagnostic_root/native" \
|
|
368
|
+
PI_DADDY_EXECUTION_ARCHIVE="$diagnostic_root/archive" \
|
|
369
|
+
pi
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
Use `/grants` to confirm the session's opt-in and destinations. The native root must be an existing canonical
|
|
373
|
+
absolute path owned by your user, mode 0700, without symlink ancestors. Each delegated execution gets a fresh
|
|
374
|
+
native JSONL session. The coordinator keeps its normal Pi session. Diagnostic manifests and bounded captured
|
|
375
|
+
bytes go under `archive`; inspect each delegation result's retention status and manifest coverage for losses.
|
|
376
|
+
An opt-in is not a claim that every observation was retained. Keep the private directory until diagnosis is done;
|
|
377
|
+
the operator controls its lifetime and disposal.
|
|
378
|
+
|
|
379
|
+
These files may contain task text, tool output and private model reasoning. Local diagnostic retention does not
|
|
380
|
+
enable JEV, provider egress, LoRA collection or training. Existing `/skill-harness` consent remains separate.
|
|
381
|
+
Without native-session opt-in, temporary child transcripts are removed after settlement and cannot be recovered
|
|
382
|
+
later from the activity timeline.
|
|
383
|
+
|
|
318
384
|
## Retired intervention inputs
|
|
319
385
|
|
|
320
386
|
External advisors, monetary cost gates and the first-delegation model chooser were removed. These recognized old
|
|
@@ -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": {
|
|
@@ -411,6 +412,8 @@
|
|
|
411
412
|
"enum": [
|
|
412
413
|
"declined",
|
|
413
414
|
"dismissed",
|
|
415
|
+
"expired",
|
|
416
|
+
"aborted",
|
|
414
417
|
"no-ui",
|
|
415
418
|
"error"
|
|
416
419
|
]
|
|
@@ -1151,7 +1154,8 @@
|
|
|
1151
1154
|
"trigger": {
|
|
1152
1155
|
"enum": [
|
|
1153
1156
|
"first-delegation",
|
|
1154
|
-
"grants-models"
|
|
1157
|
+
"grants-models",
|
|
1158
|
+
"auto-mode"
|
|
1155
1159
|
]
|
|
1156
1160
|
},
|
|
1157
1161
|
"overrides": {
|
|
@@ -1174,6 +1178,32 @@
|
|
|
1174
1178
|
],
|
|
1175
1179
|
"additionalProperties": false
|
|
1176
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
|
|
1177
1207
|
}
|
|
1178
1208
|
},
|
|
1179
1209
|
"required": [
|
|
@@ -1185,7 +1215,41 @@
|
|
|
1185
1215
|
"trigger",
|
|
1186
1216
|
"overrides"
|
|
1187
1217
|
],
|
|
1188
|
-
"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
|
+
]
|
|
1189
1253
|
},
|
|
1190
1254
|
"episodeOutcome": {
|
|
1191
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. */
|
|
@@ -32,20 +33,13 @@ export interface PromptRequest {
|
|
|
32
33
|
bindingKey?: string;
|
|
33
34
|
signal?: AbortSignal;
|
|
34
35
|
}
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
*
|
|
38
|
-
* `scope: null` alone conflates four different kinds of no — a caller that needs to know whether a
|
|
39
|
-
* PERSON actually declined (as opposed to nobody being there to ask, a dismissal, or the dialog itself
|
|
40
|
-
* breaking) cannot recover that from `scope` or from parsing `reason`. Only "declined" means a human said
|
|
41
|
-
* no; the other three are absence-of-signal, not a signal.
|
|
42
|
-
*/
|
|
43
|
-
export declare const PROMPT_OUTCOME_KINDS: readonly ["granted", "declined", "dismissed", "no-ui", "error"];
|
|
36
|
+
/** Only declined means a human chose Deny. Expiry, cancellation and dismissal grant nothing. */
|
|
37
|
+
export declare const PROMPT_OUTCOME_KINDS: readonly ["granted", "declined", "dismissed", "expired", "aborted", "no-ui", "error"];
|
|
44
38
|
export type PromptOutcomeKind = (typeof PROMPT_OUTCOME_KINDS)[number];
|
|
45
39
|
export interface PromptOutcome {
|
|
46
40
|
/** The scope the human chose, or null for any form of no. */
|
|
47
41
|
scope: ApprovalScope | null;
|
|
48
|
-
/** Which
|
|
42
|
+
/** Which outcome this was. Set on every return path. */
|
|
49
43
|
kind: PromptOutcomeKind;
|
|
50
44
|
/** Why, when the answer was no. */
|
|
51
45
|
reason?: string;
|
|
@@ -59,6 +53,8 @@ export interface PromptOutcome {
|
|
|
59
53
|
* one. The rider's honest source is `session`, and this flag is how the caller can tell.
|
|
60
54
|
*/
|
|
61
55
|
joined?: boolean;
|
|
56
|
+
/** Provisional Auto permission; the admission caller must still check the live owner policy. */
|
|
57
|
+
source?: "auto";
|
|
62
58
|
}
|
|
63
59
|
export interface ApprovalGateOptions {
|
|
64
60
|
ui: ApprovalUI;
|
|
@@ -68,6 +64,7 @@ export interface ApprovalGateOptions {
|
|
|
68
64
|
mode: string;
|
|
69
65
|
/** Resolve only when this caller must open a new dialog; unused invalid settings cannot revoke authority. */
|
|
70
66
|
timeoutMs?: number | (() => number | undefined);
|
|
67
|
+
autoMode?: AutoModeReader;
|
|
71
68
|
}
|
|
72
69
|
export interface ApprovalGate {
|
|
73
70
|
request(request: PromptRequest): Promise<PromptOutcome>;
|
|
@@ -75,7 +72,7 @@ export interface ApprovalGate {
|
|
|
75
72
|
/**
|
|
76
73
|
* Read `PI_DADDY_APPROVAL_TIMEOUT`, in SECONDS, into the milliseconds pi expects.
|
|
77
74
|
*
|
|
78
|
-
*
|
|
75
|
+
* Absent or literal `0` waits for the human without a deadline. Other values must be canonical whole seconds
|
|
79
76
|
* within Node's signed 32-bit millisecond timer limit; malformed settings refuse a needed prompt.
|
|
80
77
|
*/
|
|
81
78
|
export declare function timeoutMsFromEnv(raw: string | undefined): number | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval-prompt.d.ts","sourceRoot":"","sources":["../../src/governance/approval-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"approval-prompt.d.ts","sourceRoot":"","sources":["../../src/governance/approval-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAA8B,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC1G,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,gEAAgE;AAChE,MAAM,WAAW,UAAU;IACzB,MAAM,CACJ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EAAE,EACjB,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GAChD,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC/B,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,IAAI,CAAC;CACpE;AAED,eAAO,MAAM,UAAU,SAAS,CAAC;AAEjC,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAItD,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,UAAU,CAAC;IACvB,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,YAAY,CAAC;IACnB,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iGAAiG;IACjG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,gGAAgG;AAChG,eAAO,MAAM,oBAAoB,uFAQvB,CAAC;AACX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBA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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 = {
|
|
@@ -16,26 +17,24 @@ export const SCOPE_LABELS = {
|
|
|
16
17
|
session: "Allow for this session",
|
|
17
18
|
always: "Always allow in this project (30 days)",
|
|
18
19
|
};
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
/** Only declined means a human chose Deny. Expiry, cancellation and dismissal grant nothing. */
|
|
21
|
+
export const PROMPT_OUTCOME_KINDS = [
|
|
22
|
+
"granted",
|
|
23
|
+
"declined",
|
|
24
|
+
"dismissed",
|
|
25
|
+
"expired",
|
|
26
|
+
"aborted",
|
|
27
|
+
"no-ui",
|
|
28
|
+
"error",
|
|
29
|
+
];
|
|
29
30
|
/**
|
|
30
31
|
* Read `PI_DADDY_APPROVAL_TIMEOUT`, in SECONDS, into the milliseconds pi expects.
|
|
31
32
|
*
|
|
32
|
-
*
|
|
33
|
+
* Absent or literal `0` waits for the human without a deadline. Other values must be canonical whole seconds
|
|
33
34
|
* within Node's signed 32-bit millisecond timer limit; malformed settings refuse a needed prompt.
|
|
34
35
|
*/
|
|
35
36
|
export function timeoutMsFromEnv(raw) {
|
|
36
|
-
if (raw === undefined)
|
|
37
|
-
return DEFAULT_TIMEOUT_MS;
|
|
38
|
-
if (raw === "0")
|
|
37
|
+
if (raw === undefined || raw === "0")
|
|
39
38
|
return undefined;
|
|
40
39
|
if (!/^[1-9][0-9]*$/.test(raw) || Number(raw) > 2_147_483)
|
|
41
40
|
throw new Error("PI_DADDY_APPROVAL_TIMEOUT must be literal 0 or whole seconds 1..2147483 without signs, padding or units");
|
|
@@ -44,6 +43,99 @@ export function timeoutMsFromEnv(raw) {
|
|
|
44
43
|
function labelToScope(label, scopes) {
|
|
45
44
|
return scopes.find((s) => SCOPE_LABELS[s] === label) ?? null;
|
|
46
45
|
}
|
|
46
|
+
const autoApproval = () => ({ scope: "once", kind: "granted", source: "auto" });
|
|
47
|
+
const interrupted = (request, kind) => ({
|
|
48
|
+
scope: null,
|
|
49
|
+
kind,
|
|
50
|
+
reason: `approval for ${request.capability} ${kind === "expired" ? "expired before an answer" : "was canceled"}. ` +
|
|
51
|
+
"No permission was granted. Retry the delegation to open a new approval prompt.",
|
|
52
|
+
});
|
|
53
|
+
/** Own the deadline so Pi's undefined dismissal cannot erase whether our timer or cancellation fired. */
|
|
54
|
+
async function selectApproval(options, request, title, labels) {
|
|
55
|
+
const timeout = typeof options.timeoutMs === "function" ? options.timeoutMs() : options.timeoutMs;
|
|
56
|
+
const controller = new AbortController();
|
|
57
|
+
let outcome;
|
|
58
|
+
let settled = false;
|
|
59
|
+
let wake;
|
|
60
|
+
const stopped = new Promise((resolve) => {
|
|
61
|
+
wake = resolve;
|
|
62
|
+
});
|
|
63
|
+
const settle = (next) => {
|
|
64
|
+
if (settled)
|
|
65
|
+
return;
|
|
66
|
+
settled = true;
|
|
67
|
+
outcome = next;
|
|
68
|
+
// Resolve our tagged outcome before a UI reacts to abort by returning undefined.
|
|
69
|
+
wake(outcome);
|
|
70
|
+
controller.abort();
|
|
71
|
+
};
|
|
72
|
+
const stop = (kind) => settle(interrupted(request, kind));
|
|
73
|
+
const abort = () => stop("aborted");
|
|
74
|
+
request.signal?.addEventListener("abort", abort, { once: true });
|
|
75
|
+
const timer = timeout === undefined ? undefined : setTimeout(() => stop("expired"), timeout);
|
|
76
|
+
let untrack;
|
|
77
|
+
try {
|
|
78
|
+
if (request.signal?.aborted)
|
|
79
|
+
stop("aborted");
|
|
80
|
+
if (outcome)
|
|
81
|
+
return outcome;
|
|
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]);
|
|
112
|
+
return outcome ?? chosen;
|
|
113
|
+
}
|
|
114
|
+
finally {
|
|
115
|
+
controller.abort();
|
|
116
|
+
untrack?.();
|
|
117
|
+
if (timer !== undefined)
|
|
118
|
+
clearTimeout(timer);
|
|
119
|
+
request.signal?.removeEventListener("abort", abort);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
async function joinApproval(pending, request) {
|
|
123
|
+
if (!request.signal)
|
|
124
|
+
return pending;
|
|
125
|
+
let abort;
|
|
126
|
+
const stopped = new Promise((resolve) => {
|
|
127
|
+
abort = () => resolve(interrupted(request, "aborted"));
|
|
128
|
+
request.signal.addEventListener("abort", abort, { once: true });
|
|
129
|
+
if (request.signal.aborted)
|
|
130
|
+
abort();
|
|
131
|
+
});
|
|
132
|
+
try {
|
|
133
|
+
return await Promise.race([pending, stopped]);
|
|
134
|
+
}
|
|
135
|
+
finally {
|
|
136
|
+
request.signal.removeEventListener("abort", abort);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
47
139
|
/**
|
|
48
140
|
* Build gates that SHARE one single-flight queue.
|
|
49
141
|
*
|
|
@@ -66,15 +158,22 @@ export function createApprovalGateProvider() {
|
|
|
66
158
|
*/
|
|
67
159
|
export function createApprovalGate(options, inFlight = new Map()) {
|
|
68
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
|
+
}
|
|
69
171
|
const scopes = offeredScopes(request.path);
|
|
70
172
|
const title = `grants: approve ${request.capability} for ${request.subject}?` +
|
|
71
173
|
(request.task ? `\n task: ${request.task}` : "");
|
|
72
174
|
let chosen;
|
|
73
175
|
try {
|
|
74
|
-
chosen = await options
|
|
75
|
-
timeout: typeof options.timeoutMs === "function" ? options.timeoutMs() : options.timeoutMs,
|
|
76
|
-
signal: request.signal,
|
|
77
|
-
});
|
|
176
|
+
chosen = await selectApproval(options, request, title, [DENY_LABEL, ...scopes.map((s) => SCOPE_LABELS[s])]);
|
|
78
177
|
}
|
|
79
178
|
catch (error) {
|
|
80
179
|
// A governance layer that errors must deny, not permit. This is a dialog malfunction, not a
|
|
@@ -82,10 +181,17 @@ export function createApprovalGate(options, inFlight = new Map()) {
|
|
|
82
181
|
return { scope: null, kind: "error", reason: `approval dialog failed, denying (${String(error)})` };
|
|
83
182
|
}
|
|
84
183
|
if (request.signal?.aborted)
|
|
85
|
-
return
|
|
86
|
-
|
|
184
|
+
return interrupted(request, "aborted");
|
|
185
|
+
if (typeof chosen === "object")
|
|
186
|
+
return chosen;
|
|
187
|
+
// Only an ordinary UI dismissal reaches undefined; our deadline and abort carry explicit outcomes.
|
|
87
188
|
if (chosen === undefined) {
|
|
88
|
-
return {
|
|
189
|
+
return {
|
|
190
|
+
scope: null,
|
|
191
|
+
kind: "dismissed",
|
|
192
|
+
reason: `approval for ${request.capability} was dismissed. No permission was granted. ` +
|
|
193
|
+
"Retry the delegation to open a new approval prompt.",
|
|
194
|
+
};
|
|
89
195
|
}
|
|
90
196
|
if (chosen === DENY_LABEL) {
|
|
91
197
|
return { scope: null, kind: "declined", reason: `${request.capability} was denied by a human` };
|
|
@@ -98,7 +204,15 @@ export function createApprovalGate(options, inFlight = new Map()) {
|
|
|
98
204
|
return {
|
|
99
205
|
async request(request) {
|
|
100
206
|
if (request.signal?.aborted)
|
|
101
|
-
return
|
|
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
|
+
}
|
|
102
216
|
if (!options.hasUI) {
|
|
103
217
|
// Nobody was there to ask — distinct from a person declining, which is why this is its own kind
|
|
104
218
|
// rather than being folded into "declined" (see PromptOutcomeKind).
|
|
@@ -119,9 +233,9 @@ export function createApprovalGate(options, inFlight = new Map()) {
|
|
|
119
233
|
const existing = inFlight.get(key);
|
|
120
234
|
if (!existing)
|
|
121
235
|
break;
|
|
122
|
-
const outcome = await existing;
|
|
236
|
+
const outcome = await joinApproval(existing, request);
|
|
123
237
|
if (request.signal?.aborted)
|
|
124
|
-
return
|
|
238
|
+
return interrupted(request, "aborted");
|
|
125
239
|
// **`joined` marks the rider, and the ledger depends on it (R-66).** Sharing a non-`once` outcome
|
|
126
240
|
// is correct — the human authorised the capability for the session, not for one child — but the
|
|
127
241
|
// caller then stamped `approvalSource: "prompt"` on every one of them, so a fan-out of eight wrote
|
|
@@ -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
|
|
1
|
+
{"version":3,"file":"approval-prompt.js","sourceRoot":"","sources":["../../src/governance/approval-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,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,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,SAAS;IACT,UAAU;IACV,WAAW;IACX,SAAS;IACT,SAAS;IACT,OAAO;IACP,OAAO;CACC,CAAC;AAuCX;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAuB;IACtD,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,GAAG;QAAE,OAAO,SAAS,CAAC;IACvD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,MAAM,CAA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,CAAC,GAAG,EAAE,OAAO,CAAC,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"}
|