pi-daddy 0.17.1 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +72 -0
- package/README.md +54 -25
- package/dist/approval-prompt.d.ts +3 -1
- package/dist/approval-prompt.d.ts.map +1 -1
- package/dist/approval-prompt.js +1 -1
- package/dist/approval-prompt.js.map +1 -1
- package/dist/approval-store.d.ts.map +1 -1
- package/dist/approval-store.js +4 -1
- package/dist/approval-store.js.map +1 -1
- package/dist/approval.d.ts +20 -2
- package/dist/approval.d.ts.map +1 -1
- package/dist/approval.js +26 -6
- package/dist/approval.js.map +1 -1
- package/dist/capabilities.d.ts +15 -0
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js +47 -0
- package/dist/capabilities.js.map +1 -1
- package/dist/chain.d.ts +6 -1
- package/dist/chain.d.ts.map +1 -1
- package/dist/chain.js +1 -1
- package/dist/chain.js.map +1 -1
- package/dist/check-runner.d.ts +61 -0
- package/dist/check-runner.d.ts.map +1 -0
- package/dist/check-runner.js +237 -0
- package/dist/check-runner.js.map +1 -0
- package/dist/correlation.d.ts +90 -0
- package/dist/correlation.d.ts.map +1 -0
- package/dist/correlation.js +183 -0
- package/dist/correlation.js.map +1 -0
- package/dist/delegate-types.d.ts +140 -0
- package/dist/delegate-types.d.ts.map +1 -0
- package/dist/delegate-types.js +8 -0
- package/dist/delegate-types.js.map +1 -0
- package/dist/delegate.d.ts +4 -128
- package/dist/delegate.d.ts.map +1 -1
- package/dist/delegate.js +70 -73
- package/dist/delegate.js.map +1 -1
- package/dist/delegation-approval.d.ts +36 -0
- package/dist/delegation-approval.d.ts.map +1 -0
- package/dist/delegation-approval.js +67 -0
- package/dist/delegation-approval.js.map +1 -0
- package/dist/git-identity.d.ts +13 -0
- package/dist/git-identity.d.ts.map +1 -0
- package/dist/git-identity.js +44 -0
- package/dist/git-identity.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/lease-record.d.ts +78 -0
- package/dist/lease-record.d.ts.map +1 -0
- package/dist/lease-record.js +52 -0
- package/dist/lease-record.js.map +1 -0
- package/dist/ledger-events.d.ts +87 -0
- package/dist/ledger-events.d.ts.map +1 -0
- package/dist/ledger-events.js +45 -0
- package/dist/ledger-events.js.map +1 -0
- package/dist/ledger-report.d.ts +19 -12
- package/dist/ledger-report.d.ts.map +1 -1
- package/dist/ledger-report.js +81 -1
- package/dist/ledger-report.js.map +1 -1
- package/dist/ledger.d.ts +44 -1
- package/dist/ledger.d.ts.map +1 -1
- package/dist/ledger.js +20 -2
- package/dist/ledger.js.map +1 -1
- package/dist/propagation.d.ts.map +1 -1
- package/dist/propagation.js +2 -1
- package/dist/propagation.js.map +1 -1
- package/dist/refusals.d.ts +16 -0
- package/dist/refusals.d.ts.map +1 -0
- package/dist/refusals.js +52 -0
- package/dist/refusals.js.map +1 -0
- package/dist/resolve.d.ts.map +1 -1
- package/dist/resolve.js +7 -1
- package/dist/resolve.js.map +1 -1
- package/dist/run-child.d.ts +4 -0
- package/dist/run-child.d.ts.map +1 -1
- package/dist/run-child.js +21 -1
- package/dist/run-child.js.map +1 -1
- package/dist/run-herdr.d.ts +7 -0
- package/dist/run-herdr.d.ts.map +1 -1
- package/dist/run-herdr.js +41 -12
- package/dist/run-herdr.js.map +1 -1
- package/dist/workspace-lease.d.ts +28 -0
- package/dist/workspace-lease.d.ts.map +1 -0
- package/dist/workspace-lease.js +276 -0
- package/dist/workspace-lease.js.map +1 -0
- package/dist/workspace.d.ts +32 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +79 -0
- package/dist/workspace.js.map +1 -0
- package/extensions/approval-banking.ts +66 -0
- package/extensions/approvals.ts +95 -7
- package/extensions/chain-approval-facts.ts +51 -0
- package/extensions/chain-ledger.ts +48 -0
- package/extensions/delegate-chain.ts +115 -81
- package/extensions/delegation.ts +81 -23
- package/extensions/execute-child.ts +289 -0
- package/extensions/fanout-outcome.ts +97 -0
- package/extensions/run-delegation.ts +130 -120
- package/extensions/session.ts +4 -0
- package/extensions/workspace-runtime.ts +165 -0
- package/package.json +17 -1
- package/src/approval-prompt.ts +4 -2
- package/src/approval-store.ts +4 -1
- package/src/approval.ts +47 -14
- package/src/capabilities.ts +53 -0
- package/src/chain.ts +3 -1
- package/src/check-runner.ts +341 -0
- package/src/correlation.ts +260 -0
- package/src/delegate-types.ts +144 -0
- package/src/delegate.ts +82 -180
- package/src/delegation-approval.ts +99 -0
- package/src/git-identity.ts +52 -0
- package/src/index.ts +50 -0
- package/src/lease-record.ts +119 -0
- package/src/ledger-events.ts +138 -0
- package/src/ledger-report.ts +90 -2
- package/src/ledger.ts +68 -3
- package/src/propagation.ts +2 -1
- package/src/refusals.ts +67 -0
- package/src/resolve.ts +7 -1
- package/src/run-child.ts +23 -1
- package/src/run-herdr.ts +41 -11
- package/src/workspace-lease.ts +303 -0
- package/src/workspace.ts +135 -0
package/dist/delegate.js
CHANGED
|
@@ -1,43 +1,44 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Governed delegation
|
|
3
|
-
*
|
|
4
|
-
* The `tool_call` interceptor can only *permit or refuse* a `pi-subagents` spawn, because that package's
|
|
5
|
-
* `Agent` tool has no `tools` parameter. When we do the spawning ourselves the grant becomes an argument,
|
|
6
|
-
* which is what "give them some tools but not others" actually requires.
|
|
7
|
-
*
|
|
8
|
-
* Two properties fall out of owning the spawn:
|
|
9
|
-
*
|
|
10
|
-
* 1. **No propagation race at all.** Each child receives its own explicit `env` object, so nothing is
|
|
11
|
-
* written to the shared `process.env`. The interceptor's constraint (only parent-level facts may be
|
|
12
|
-
* pushed, because the channel is global) does not apply here.
|
|
13
|
-
* 2. **Depth control by capability.** `tool:delegate` is itself a capability. Grant it and the child can
|
|
14
|
-
* sub-delegate; withhold it and the child is a leaf. No separate depth mechanism is required, though
|
|
15
|
-
* `maxDepth` remains as a cheap backstop.
|
|
2
|
+
* Governed delegation planning. Owning the spawn makes the grant an argument; each child receives its own
|
|
3
|
+
* environment, and `tool:delegate` determines whether it is a delegator or a leaf.
|
|
16
4
|
*/
|
|
17
5
|
import { planSpawn } from "./spawn.js";
|
|
18
6
|
import { ceilingForDefinition, digestDefinition } from "./definitions.js";
|
|
19
|
-
import {
|
|
20
|
-
import { AGENT_WILDCARD } from "./resolve.js";
|
|
7
|
+
import { assertNarrowing } from "./resolve.js";
|
|
21
8
|
import { DELEGATE_CAPABILITY, agentCapability, maySpawnDefinition, normaliseCapability } from "./capabilities.js";
|
|
22
9
|
// Re-exported so the split stays internal: `delegate.ts` has been the import site for these since 0.6.0 and
|
|
23
10
|
// four modules plus the test suite name it. Moving the definitions without moving the door would be churn
|
|
24
11
|
// charged to every caller for a line count they did not cause.
|
|
25
12
|
export { DELEGATE_CAPABILITY, agentCapability, maySpawnDefinition, normaliseCapability } from "./capabilities.js";
|
|
26
13
|
import { ENV_APPROVED, ENV_DEPTH, ENV_FANOUT, ENV_GATED, ENV_GRANT, ENV_LEDGER, ENV_MAX_DEPTH, ENV_PARENT_ID } from "./propagation.js";
|
|
27
|
-
import {
|
|
14
|
+
import { inheritApprovals } from "./approval.js";
|
|
28
15
|
import { suggestForUnknown, unknownCapabilities } from "./catalog.js";
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
* without approval, and on a grant that cannot narrow (a universal capability slipping through).
|
|
34
|
-
*/
|
|
16
|
+
import { GovernanceRefusal, refusal } from "./refusals.js";
|
|
17
|
+
import { digestTask, normaliseCorrelation, } from "./correlation.js";
|
|
18
|
+
import { resolveDelegationApproval } from "./delegation-approval.js";
|
|
19
|
+
import { assertCapabilitiesArePropagatable } from "./capabilities.js";
|
|
35
20
|
export function planDelegation(request, ctx) {
|
|
36
21
|
const childDepth = ctx.depth + 1;
|
|
22
|
+
const denied = (plan, code) => plan.reason ? { ...plan, refusal: refusal(code, plan.reason) } : plan;
|
|
37
23
|
// G6 / B-I3: every refusal carries a result, including the four below that return before `resolve()`
|
|
38
24
|
// is ever called. The extension guarded its ledger write with `if (ledgerPath && plan.result)`, so
|
|
39
25
|
// those four governance decisions — disabled, too deep, no task, unknown capability — were never
|
|
40
26
|
// audited at all. An empty result is the honest record: nothing was resolved, and that is the fact.
|
|
27
|
+
// Bounded/whitelisted correlation is a REFUSAL, not an exception escaping the planner. It is reachable
|
|
28
|
+
// from a model-facing tool parameter on all three delegation tools, and throwing from here produced a
|
|
29
|
+
// governed refusal with no code and no ledger line at all — the ledger file was never even created
|
|
30
|
+
// (R-112). Caught here so it becomes an ordinary recorded decision.
|
|
31
|
+
let correlation;
|
|
32
|
+
let correlationRefused;
|
|
33
|
+
try {
|
|
34
|
+
correlation = normaliseCorrelation(request.correlation);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
correlationRefused = error instanceof GovernanceRefusal
|
|
38
|
+
? { code: error.code, message: error.message, ...(error.details ? { details: error.details } : {}) }
|
|
39
|
+
: refusal("CORRELATION_INVALID", String(error instanceof Error ? error.message : error));
|
|
40
|
+
}
|
|
41
|
+
const taskDigest = digestTask(request.task ?? "");
|
|
41
42
|
const empty = {
|
|
42
43
|
ok: false,
|
|
43
44
|
args: [],
|
|
@@ -45,15 +46,21 @@ export function planDelegation(request, ctx) {
|
|
|
45
46
|
effective: [],
|
|
46
47
|
childDepth,
|
|
47
48
|
requested: [],
|
|
49
|
+
taskDigest,
|
|
50
|
+
...(correlation ? { correlation } : {}),
|
|
48
51
|
result: { effective: [], denied: [], clipped: [], gatedBlocked: [], universal: [], subsumedBy: [] },
|
|
49
52
|
};
|
|
50
|
-
if (
|
|
51
|
-
return { ...empty, reason:
|
|
53
|
+
if (correlationRefused) {
|
|
54
|
+
return { ...empty, reason: correlationRefused.message, refusal: correlationRefused };
|
|
55
|
+
}
|
|
56
|
+
if (ctx.maxDepth <= 0) {
|
|
57
|
+
return denied({ ...empty, reason: "delegation is disabled (maxDepth 0)" }, "DEPTH_EXCEEDED");
|
|
58
|
+
}
|
|
52
59
|
if (childDepth > ctx.maxDepth) {
|
|
53
|
-
return { ...empty, reason: `delegation depth limit reached (${ctx.maxDepth})` };
|
|
60
|
+
return denied({ ...empty, reason: `delegation depth limit reached (${ctx.maxDepth})` }, "DEPTH_EXCEEDED");
|
|
54
61
|
}
|
|
55
62
|
if (!request.task?.trim())
|
|
56
|
-
return { ...empty, reason: "a delegation needs a task" };
|
|
63
|
+
return denied({ ...empty, reason: "a delegation needs a task" }, "TASK_MISSING");
|
|
57
64
|
// ADR-0016. A named definition replaces the model's tool list with an operator-authored ceiling.
|
|
58
65
|
let requested;
|
|
59
66
|
let systemPrompt;
|
|
@@ -68,11 +75,11 @@ export function planDelegation(request, ctx) {
|
|
|
68
75
|
// here is simply an error.
|
|
69
76
|
if (!definition) {
|
|
70
77
|
const known = [...(ctx.definitions?.keys() ?? [])].sort();
|
|
71
|
-
return {
|
|
78
|
+
return denied({
|
|
72
79
|
...empty,
|
|
73
80
|
reason: `unknown agent "${request.agent}"` +
|
|
74
81
|
(known.length > 0 ? ` — known definitions: ${known.join(", ")}` : " — no definitions were found"),
|
|
75
|
-
};
|
|
82
|
+
}, "UNKNOWN_DEFINITION");
|
|
76
83
|
}
|
|
77
84
|
// ADR-0017: authorisation comes BEFORE anything is said about the file. Which definitions this
|
|
78
85
|
// session may spawn is a governance question about the SESSION; whether the file declares its tools
|
|
@@ -85,7 +92,7 @@ export function planDelegation(request, ctx) {
|
|
|
85
92
|
if (!maySpawnDefinition(ctx.ownGrant, definition.name)) {
|
|
86
93
|
const authorising = agentCapability(definition.name);
|
|
87
94
|
const held = ctx.ownGrant.filter((c) => c.startsWith("agent:")).sort();
|
|
88
|
-
return {
|
|
95
|
+
return denied({
|
|
89
96
|
...empty,
|
|
90
97
|
requested: [authorising],
|
|
91
98
|
result: { ...empty.result, denied: [authorising] },
|
|
@@ -94,7 +101,7 @@ export function planDelegation(request, ctx) {
|
|
|
94
101
|
(held.length > 0
|
|
95
102
|
? `It may spawn: ${held.join(", ")}.`
|
|
96
103
|
: `It may spawn no definitions at all; add ${authorising} to its grant to allow this one.`),
|
|
97
|
-
};
|
|
104
|
+
}, "DEFINITION_NOT_AUTHORIZED");
|
|
98
105
|
}
|
|
99
106
|
// ADR-0018. Recorded from here on — after authorisation, because the digest is a fact about a file
|
|
100
107
|
// this caller was allowed to read, and before every remaining outcome, because a spawn refused for a
|
|
@@ -108,19 +115,19 @@ export function planDelegation(request, ctx) {
|
|
|
108
115
|
Object.assign(empty, { definitionDigest });
|
|
109
116
|
const ceiling = ceilingForDefinition(definition);
|
|
110
117
|
if (ceiling.undeclared) {
|
|
111
|
-
return {
|
|
118
|
+
return denied({
|
|
112
119
|
...empty,
|
|
113
120
|
reason: `agent "${definition.name}" declares no \`allowed-tools\`, so it cannot be spawned — add one ` +
|
|
114
121
|
`to ${definition.source}. An undeclared capability set is treated as NONE, never as everything.`,
|
|
115
|
-
};
|
|
122
|
+
}, "UNDECLARED_TOOLS");
|
|
116
123
|
}
|
|
117
124
|
if (ceiling.patterns.length > 0) {
|
|
118
|
-
return {
|
|
125
|
+
return denied({
|
|
119
126
|
...empty,
|
|
120
127
|
reason: `agent "${definition.name}" restricts a tool with a pattern (${ceiling.patterns.join(", ")}), ` +
|
|
121
128
|
`which pi's --tools cannot express — it matches whole tool names only. Granting the bare tool ` +
|
|
122
129
|
`would widen the declaration and dropping it would silently narrow, so neither is done.`,
|
|
123
|
-
};
|
|
130
|
+
}, "CEILING_PATTERNS_UNRESOLVED");
|
|
124
131
|
}
|
|
125
132
|
requested = ceiling.capabilities;
|
|
126
133
|
systemPrompt = definition.body;
|
|
@@ -144,55 +151,38 @@ export function planDelegation(request, ctx) {
|
|
|
144
151
|
return s === null ? null : `${c} → did you mean ${s}?`;
|
|
145
152
|
})
|
|
146
153
|
.filter((h) => h !== null);
|
|
147
|
-
return {
|
|
154
|
+
return denied({
|
|
148
155
|
...empty,
|
|
149
156
|
requested,
|
|
150
157
|
reason: `unknown capabilit${unknown.length === 1 ? "y" : "ies"}: ${unknown.join(", ")} — not present in ` +
|
|
151
158
|
`this session's catalog (typo, or an uninstalled package?)` +
|
|
152
159
|
(hints.length > 0 ? ` — ${hints.join("; ")}` : ""),
|
|
153
|
-
};
|
|
160
|
+
}, "UNKNOWN_TOOL");
|
|
154
161
|
}
|
|
155
162
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
const result = resolve({
|
|
163
|
+
const { result, approvalBinding, bindingMismatch } = resolveDelegationApproval({
|
|
164
|
+
task: request.task,
|
|
165
|
+
agent: request.agent,
|
|
166
|
+
boundWorkspaceId: request.boundWorkspaceId,
|
|
167
|
+
boundContextId: request.boundContextId,
|
|
162
168
|
requested,
|
|
163
169
|
parentGrant: ctx.ownGrant,
|
|
164
170
|
gated: ctx.gated,
|
|
165
|
-
approved:
|
|
171
|
+
approved: ctx.approved,
|
|
172
|
+
spawned,
|
|
173
|
+
definitionDigest,
|
|
174
|
+
correlation,
|
|
175
|
+
parentId: ctx.spawnId ?? `d${ctx.depth}`,
|
|
166
176
|
});
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
*
|
|
170
|
-
* `gatedBlocked` is a filter over `requested`, and for a definition spawn `requested` is the definition's
|
|
171
|
-
* CEILING — so the id that authorises it was never a candidate, and `PI_GRANTS_GATED=agent:deploy` did
|
|
172
|
-
* nothing at all on the path an operator writing it means. It half-worked when some *other* definition
|
|
173
|
-
* passed the id down in its own `allowed-tools`, which is worse than not working (R-47, R-25's shape).
|
|
174
|
-
*
|
|
175
|
-
* Evaluated here rather than by adding the id to `requested`, and that is the load-bearing part: a
|
|
176
|
-
* capability in `requested` flows to `effective`, which becomes the CHILD's grant — so the child would
|
|
177
|
-
* hold `agent:deploy` and could spawn `deploy` itself without anyone being asked. This is the parent's
|
|
178
|
-
* authority to run the definition *now*, not something the child receives.
|
|
179
|
-
*
|
|
180
|
-
* `agent:*` in the gate covers every definition, so "ask me before any definition runs" is one variable.
|
|
181
|
-
*/
|
|
182
|
-
if (spawned) {
|
|
183
|
-
const authorising = agentCapability(spawned.name);
|
|
184
|
-
const gatedHere = ctx.gated.includes(authorising) || ctx.gated.includes(AGENT_WILDCARD);
|
|
185
|
-
if (gatedHere && !approvedCapabilities.includes(authorising)) {
|
|
186
|
-
result.gatedBlocked = [...result.gatedBlocked, authorising];
|
|
187
|
-
}
|
|
188
|
-
}
|
|
177
|
+
if (approvalBinding)
|
|
178
|
+
Object.assign(empty, { approvalBinding });
|
|
189
179
|
if (result.denied.length > 0) {
|
|
190
|
-
return {
|
|
180
|
+
return denied({
|
|
191
181
|
...empty,
|
|
192
182
|
requested,
|
|
193
183
|
result,
|
|
194
184
|
reason: `cannot grant ${result.denied.join(", ")} — this session does not hold it (capability escalation blocked)`,
|
|
195
|
-
};
|
|
185
|
+
}, "CAPABILITY_ESCALATION");
|
|
196
186
|
}
|
|
197
187
|
// ADR-0011: narrowing is checked BEFORE the gate, and the order is load-bearing rather than
|
|
198
188
|
// stylistic. `assertNarrowing` refuses regardless of approval, so with the old order this returned
|
|
@@ -203,10 +193,14 @@ export function planDelegation(request, ctx) {
|
|
|
203
193
|
assertNarrowing(result);
|
|
204
194
|
}
|
|
205
195
|
catch (error) {
|
|
206
|
-
|
|
196
|
+
// ADR-0011's narrowing invariant is the hardest rule this package enforces, and it was the one
|
|
197
|
+
// refusal an external controller could not identify by code (R-109).
|
|
198
|
+
return denied({ ...empty, requested, result, reason: String(error instanceof Error ? error.message : error) }, "NARROWING_VIOLATED");
|
|
207
199
|
}
|
|
208
200
|
if (result.gatedBlocked.length > 0) {
|
|
209
|
-
|
|
201
|
+
const code = bindingMismatch ? "APPROVAL_SCOPE_MISMATCH" : "GATED_UNAPPROVED";
|
|
202
|
+
const suffix = bindingMismatch ? " (an approval exists, but its task/workspace/context scope does not match)" : "";
|
|
203
|
+
return denied({ ...empty, requested, result, reason: `${result.gatedBlocked.join(", ")} requires explicit approval${suffix}` }, code);
|
|
210
204
|
}
|
|
211
205
|
const canSubDelegate = result.effective.includes(DELEGATE_CAPABILITY);
|
|
212
206
|
const plan = planSpawn({
|
|
@@ -226,13 +220,13 @@ export function planDelegation(request, ctx) {
|
|
|
226
220
|
// not contain. `unknownCapabilities` above catches names absent from the catalog entirely; this
|
|
227
221
|
// catches one that is known but whose path we could not resolve, which is a different fault.
|
|
228
222
|
if (plan.unresolvedSkills.length > 0) {
|
|
229
|
-
return {
|
|
223
|
+
return denied({
|
|
230
224
|
...empty,
|
|
231
225
|
requested,
|
|
232
226
|
result,
|
|
233
227
|
reason: `cannot locate ${plan.unresolvedSkills.join(", ")} on disk — granted but unresolvable, so the ` +
|
|
234
228
|
`child would silently lack it`,
|
|
235
|
-
};
|
|
229
|
+
}, "DEFINITION_UNREADABLE");
|
|
236
230
|
}
|
|
237
231
|
// A child may only delegate further if it was granted the capability AND has the extension to do it.
|
|
238
232
|
const args = [...plan.args];
|
|
@@ -242,7 +236,7 @@ export function planDelegation(request, ctx) {
|
|
|
242
236
|
args.splice(args.length - 1, 0, "-e", ctx.extensionPath);
|
|
243
237
|
}
|
|
244
238
|
const env = {
|
|
245
|
-
[ENV_GRANT]: result.effective.join(","),
|
|
239
|
+
[ENV_GRANT]: (assertCapabilitiesArePropagatable(result.effective), result.effective.join(",")),
|
|
246
240
|
[ENV_DEPTH]: String(childDepth),
|
|
247
241
|
[ENV_MAX_DEPTH]: String(ctx.maxDepth),
|
|
248
242
|
};
|
|
@@ -271,6 +265,9 @@ export function planDelegation(request, ctx) {
|
|
|
271
265
|
childDepth,
|
|
272
266
|
requested,
|
|
273
267
|
childId: ctx.childSpawnId,
|
|
268
|
+
taskDigest,
|
|
269
|
+
...(correlation ? { correlation } : {}),
|
|
270
|
+
...(approvalBinding ? { approvalBinding } : {}),
|
|
274
271
|
...(definitionDigest ? { definitionDigest } : {}),
|
|
275
272
|
};
|
|
276
273
|
}
|
package/dist/delegate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegate.js","sourceRoot":"","sources":["../src/delegate.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"delegate.js","sourceRoot":"","sources":["../src/delegate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAA+C,MAAM,kBAAkB,CAAC;AACvH,OAAO,EAAE,eAAe,EAAuC,MAAM,cAAc,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAElH,4GAA4G;AAC5G,0GAA0G;AAC1G,+DAA+D;AAC/D,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAClH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACvI,OAAO,EAAE,gBAAgB,EAA4B,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAgB,MAAM,cAAc,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAA4C,MAAM,eAAe,CAAC;AACrG,OAAO,EACL,UAAU,EACV,oBAAoB,GAGrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,EAAE,iCAAiC,EAAE,MAAM,mBAAmB,CAAC;AAGtE,MAAM,UAAU,cAAc,CAAC,OAA0B,EAAE,GAAsB;IAC/E,MAAM,UAAU,GAAG,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,CAAC,IAAgB,EAA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,CAAC,YAAY;QACzB,UAAU;QACV,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/C,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAClD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type InheritableApproval } from "./approval.ts";
|
|
2
|
+
import { type ApprovalBinding, type CorrelationMetadata } from "./correlation.ts";
|
|
3
|
+
import type { DefinitionDigest, SkillDefinition } from "./definitions.ts";
|
|
4
|
+
import { type Capability, type ResolveResult } from "./resolve.ts";
|
|
5
|
+
/**
|
|
6
|
+
* Resolve the approval half of one delegation after its requested capability set is known.
|
|
7
|
+
*
|
|
8
|
+
* Kept as one function because the ordering is security-relevant: compute the unapproved and potential
|
|
9
|
+
* effective sets first, derive the exact binding from those trusted values, then decide which approvals
|
|
10
|
+
* match. An approval must never define the scope against which it is checked.
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveDelegationApproval(input: {
|
|
13
|
+
task: string;
|
|
14
|
+
agent?: string;
|
|
15
|
+
requested: Capability[];
|
|
16
|
+
parentGrant: Capability[];
|
|
17
|
+
gated: Capability[];
|
|
18
|
+
approved?: InheritableApproval[];
|
|
19
|
+
spawned?: SkillDefinition;
|
|
20
|
+
definitionDigest?: DefinitionDigest;
|
|
21
|
+
/**
|
|
22
|
+
* Present iff this call is task-bound. Its VALUES never enter the binding — only its presence selects
|
|
23
|
+
* the exact-bound regime over the legacy subject-scoped one.
|
|
24
|
+
*/
|
|
25
|
+
correlation?: CorrelationMetadata;
|
|
26
|
+
/** Trusted: an id that was resolved against the operator registry and leased. Never a caller claim. */
|
|
27
|
+
boundWorkspaceId?: string;
|
|
28
|
+
/** Caller-declared label. Narrows the binding only; asserts nothing about enforcement. */
|
|
29
|
+
boundContextId?: string;
|
|
30
|
+
parentId: string;
|
|
31
|
+
}): {
|
|
32
|
+
result: ResolveResult;
|
|
33
|
+
approvalBinding?: ApprovalBinding;
|
|
34
|
+
bindingMismatch: boolean;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=delegation-approval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegation-approval.d.ts","sourceRoot":"","sources":["../src/delegation-approval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAA2B,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAE5F;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,UAAU,EAAE,CAAC;IACxB,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACjC,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC;;;OAGG;IACH,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,uGAAuG;IACvG,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,0FAA0F;IAC1F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,eAAe,CAAC,EAAE,eAAe,CAAC;IAAC,eAAe,EAAE,OAAO,CAAA;CAAE,CA6DzF"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { DELEGATE_SUBJECT } from "./approval.js";
|
|
2
|
+
import { agentCapability } from "./capabilities.js";
|
|
3
|
+
import { approvalBindingsEqual, buildApprovalBinding, } from "./correlation.js";
|
|
4
|
+
import { AGENT_WILDCARD, resolve } from "./resolve.js";
|
|
5
|
+
/**
|
|
6
|
+
* Resolve the approval half of one delegation after its requested capability set is known.
|
|
7
|
+
*
|
|
8
|
+
* Kept as one function because the ordering is security-relevant: compute the unapproved and potential
|
|
9
|
+
* effective sets first, derive the exact binding from those trusted values, then decide which approvals
|
|
10
|
+
* match. An approval must never define the scope against which it is checked.
|
|
11
|
+
*/
|
|
12
|
+
export function resolveDelegationApproval(input) {
|
|
13
|
+
const subject = input.agent ?? DELEGATE_SUBJECT;
|
|
14
|
+
const unapproved = resolve({
|
|
15
|
+
requested: input.requested,
|
|
16
|
+
parentGrant: input.parentGrant,
|
|
17
|
+
gated: input.gated,
|
|
18
|
+
approved: [],
|
|
19
|
+
});
|
|
20
|
+
// ADR-0024: a definition's authorising id is gated as the PARENT's authority to run it now. It never
|
|
21
|
+
// joins requested/effective, because that would hand the child authority to recursively spawn itself.
|
|
22
|
+
let authorisingCapability;
|
|
23
|
+
if (input.spawned) {
|
|
24
|
+
const authorising = agentCapability(input.spawned.name);
|
|
25
|
+
if (input.gated.includes(authorising) || input.gated.includes(AGENT_WILDCARD)) {
|
|
26
|
+
authorisingCapability = authorising;
|
|
27
|
+
unapproved.gatedBlocked = [...unapproved.gatedBlocked, authorising];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const potential = resolve({
|
|
31
|
+
requested: input.requested,
|
|
32
|
+
parentGrant: input.parentGrant,
|
|
33
|
+
gated: input.gated,
|
|
34
|
+
// If the definition also declares its own authorising `agent:<name>`, the same approval unblocks
|
|
35
|
+
// that requested child capability too; excluding it here would bind a smaller set than we provision.
|
|
36
|
+
approved: unapproved.gatedBlocked,
|
|
37
|
+
});
|
|
38
|
+
const approvalBinding = input.correlation
|
|
39
|
+
? buildApprovalBinding({
|
|
40
|
+
task: input.task,
|
|
41
|
+
requested: input.requested,
|
|
42
|
+
effective: potential.effective,
|
|
43
|
+
definitionSha256: input.definitionDigest?.sha256,
|
|
44
|
+
parentId: input.parentId,
|
|
45
|
+
workspaceId: input.boundWorkspaceId,
|
|
46
|
+
contextId: input.boundContextId,
|
|
47
|
+
})
|
|
48
|
+
: undefined;
|
|
49
|
+
const forSubject = (input.approved ?? []).filter((approval) => approval.subject === subject);
|
|
50
|
+
const approvedCapabilities = forSubject
|
|
51
|
+
.filter((approval) => approvalBinding
|
|
52
|
+
? approvalBindingsEqual(approval.binding, approvalBinding)
|
|
53
|
+
: approval.binding === undefined)
|
|
54
|
+
.map((approval) => approval.capability);
|
|
55
|
+
const bindingMismatch = approvalBinding !== undefined && forSubject.some((approval) => approval.binding !== undefined && !approvalBindingsEqual(approval.binding, approvalBinding));
|
|
56
|
+
const result = resolve({
|
|
57
|
+
requested: input.requested,
|
|
58
|
+
parentGrant: input.parentGrant,
|
|
59
|
+
gated: input.gated,
|
|
60
|
+
approved: approvedCapabilities,
|
|
61
|
+
});
|
|
62
|
+
if (authorisingCapability && !approvedCapabilities.includes(authorisingCapability)) {
|
|
63
|
+
result.gatedBlocked = [...result.gatedBlocked, authorisingCapability];
|
|
64
|
+
}
|
|
65
|
+
return { result, ...(approvalBinding ? { approvalBinding } : {}), bindingMismatch };
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=delegation-approval.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegation-approval.js","sourceRoot":"","sources":["../src/delegation-approval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA4B,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CA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M,CAAC,YAAY,GAAG,CAAC,GAAG,MAAM,CAAC,YAAY,EAAE,qBAAqB,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC;AACtF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ValidatedWorkspace } from "./workspace.ts";
|
|
2
|
+
export interface GitCandidateIdentity {
|
|
3
|
+
headSha: string;
|
|
4
|
+
treeSha: string;
|
|
5
|
+
}
|
|
6
|
+
/** Compute HEAD plus NON-IGNORED tracked/untracked candidate content without changing the real index.
|
|
7
|
+
*
|
|
8
|
+
* NOT the exact working tree: `git add -A` honours `.gitignore`, `core.excludesFile` and
|
|
9
|
+
* `$GIT_DIR/info/exclude`, and records only a gitlink for a submodule. And it is not read-only — it writes
|
|
10
|
+
* blob objects into the real `.git/objects`. `docs/SPEC.md` retracted the word "exact"; this comment said
|
|
11
|
+
* it for one more round. */
|
|
12
|
+
export declare function computeGitCandidateIdentity(workspace: ValidatedWorkspace): Promise<GitCandidateIdentity>;
|
|
13
|
+
//# sourceMappingURL=git-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-identity.d.ts","sourceRoot":"","sources":["../src/git-identity.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAIzD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;4BAK4B;AAC5B,wBAAsB,2BAA2B,CAAC,SAAS,EAAE,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA8B9G"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { mkdtemp, rm } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
import { GovernanceRefusal, refusal } from "./refusals.js";
|
|
7
|
+
const execFileAsync = promisify(execFile);
|
|
8
|
+
/** Compute HEAD plus NON-IGNORED tracked/untracked candidate content without changing the real index.
|
|
9
|
+
*
|
|
10
|
+
* NOT the exact working tree: `git add -A` honours `.gitignore`, `core.excludesFile` and
|
|
11
|
+
* `$GIT_DIR/info/exclude`, and records only a gitlink for a submodule. And it is not read-only — it writes
|
|
12
|
+
* blob objects into the real `.git/objects`. `docs/SPEC.md` retracted the word "exact"; this comment said
|
|
13
|
+
* it for one more round. */
|
|
14
|
+
export async function computeGitCandidateIdentity(workspace) {
|
|
15
|
+
const dir = await mkdtemp(join(tmpdir(), "pi-daddy-index-"));
|
|
16
|
+
const index = join(dir, "index");
|
|
17
|
+
const env = {
|
|
18
|
+
PATH: process.env.PATH,
|
|
19
|
+
HOME: process.env.HOME,
|
|
20
|
+
LANG: process.env.LANG,
|
|
21
|
+
LC_ALL: process.env.LC_ALL,
|
|
22
|
+
TMPDIR: process.env.TMPDIR,
|
|
23
|
+
GIT_INDEX_FILE: index,
|
|
24
|
+
};
|
|
25
|
+
const git = async (args) => (await execFileAsync("git", ["-C", workspace.root, ...args], {
|
|
26
|
+
env, encoding: "utf8", maxBuffer: 16 * 1024 * 1024,
|
|
27
|
+
})).stdout.trim();
|
|
28
|
+
try {
|
|
29
|
+
const headSha = await git(["rev-parse", "HEAD"]);
|
|
30
|
+
await git(["read-tree", "HEAD"]);
|
|
31
|
+
await git(["add", "-A"]);
|
|
32
|
+
const treeSha = await git(["write-tree"]);
|
|
33
|
+
if (!/^[a-f0-9]{40,64}$/i.test(headSha) || !/^[a-f0-9]{40,64}$/i.test(treeSha))
|
|
34
|
+
throw new Error("Git returned an invalid object id");
|
|
35
|
+
return { headSha, treeSha };
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
throw new GovernanceRefusal(refusal("CHECK_IDENTITY_UNAVAILABLE", `could not compute exact Git head/candidate-tree identity for workspace ${workspace.workspaceId} (${String(error)})`, { workspace_id: workspace.workspaceId }));
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
await rm(dir, { recursive: true, force: true });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=git-identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-identity.js","sourceRoot":"","sources":["../src/git-identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG3D,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAO1C;;;;;4BAK4B;AAC5B,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,SAA6B;IAC7E,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAC7D,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACjC,MAAM,GAAG,GAAsB;QAC7B,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI;QACtB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI;QACtB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI;QACtB,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM;QAC1B,M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E,CAAC,CAAC;IAClD,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
export { resolve, assertNarrowing, toPiToolsAllowlist, UNIVERSAL_CAPABILITIES, type Capability, type ResolveInput, type ResolveResult, } from "./resolve.ts";
|
|
2
|
-
export { appendRecord, buildRecord, isEscalationAttempt, type GrantRecord, type LedgerOptions, } from "./ledger.ts";
|
|
2
|
+
export { appendLedgerEvent, appendRecord, buildChildLifecycleEvent, buildRecord, buildWorkspaceLeaseEvent, isEscalationAttempt, LEDGER_VERSION, type CheckReceiptLedgerEvent, type ChildLifecycleEvent, type GrantRecord, type LedgerOptions, type RuntimeLedgerEvent, type WorkspaceLeaseEvent, type WorkspaceLeaseOutcome, } from "./ledger.ts";
|
|
3
3
|
export { planSpawn, type SpawnPlan, type SpawnPlanInput } from "./spawn.ts";
|
|
4
4
|
export { APPROVAL_TTL_DAYS, DELEGATE_SUBJECT, approvalKey, entryVerdict, expiryFor, inheritApprovals, offeredScopes, resolveApprovals, shouldSeekApproval, type ApprovalEntry, type ApprovalPath, type ApprovalScope, type ApprovalSource, type EntryVerdict, type SubjectSnapshot, } from "./approval.ts";
|
|
5
5
|
export { approvalsPath, loadApprovals, revokeAll, revokeApproval, saveApproval, type DroppedApproval, type SubjectLookup, } from "./approval-store.ts";
|
|
6
|
+
export { approvalBindingDigest, approvalBindingsEqual, buildApprovalBinding, digestCapabilities, digestTask, isApprovalBinding, normaliseCorrelation, type ApprovalBinding, type CorrelationMetadata, type JsonValue, } from "./correlation.ts";
|
|
7
|
+
export { GovernanceRefusal, REFUSAL_CODES, refusal, type RefusalCode, type StructuredRefusal, } from "./refusals.ts";
|
|
8
|
+
export { acquireWorkspaceLease, defaultWorkspaceLeaseDir, loadWorkspaceRegistry, resolveWorkspace, validateRegisteredWorkspace, type ValidatedWorkspace, type WorkspaceAccess, type WorkspaceLease, type WorkspaceRegistryFile, } from "./workspace.ts";
|
|
9
|
+
export { buildCheckEnvironment, runNamedCheck, type CheckDefinition, type CheckReceipt, type CheckRegistry, } from "./check-runner.ts";
|
|
6
10
|
export { createApprovalGate, createApprovalGateProvider, timeoutMsFromEnv, type ApprovalGate, type InFlightApprovals, type ApprovalUI, type PromptOutcome, type PromptOutcomeKind, type PromptRequest, } from "./approval-prompt.ts";
|
|
7
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,KAAK,WAAW,EAChB,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,wBAAwB,EACxB,WAAW,EACX,wBAAwB,EACxB,mBAAmB,EACnB,cAAc,EACd,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,GAC3B,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5E,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,aAAa,EACb,aAAa,EACb,SAAS,EACT,cAAc,EACd,YAAY,EACZ,KAAK,eAAe,EACpB,KAAK,aAAa,GACnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,UAAU,EACV,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,SAAS,GACf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,OAAO,EACP,KAAK,WAAW,EAChB,KAAK,iBAAiB,GACvB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,gBAAgB,EAChB,2BAA2B,EAC3B,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,qBAAqB,GAC3B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,gBAAgB,EAChB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,aAAa,GACnB,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
export { resolve, assertNarrowing, toPiToolsAllowlist, UNIVERSAL_CAPABILITIES, } from "./resolve.js";
|
|
2
|
-
export { appendRecord, buildRecord, isEscalationAttempt, } from "./ledger.js";
|
|
2
|
+
export { appendLedgerEvent, appendRecord, buildChildLifecycleEvent, buildRecord, buildWorkspaceLeaseEvent, isEscalationAttempt, LEDGER_VERSION, } from "./ledger.js";
|
|
3
3
|
export { planSpawn } from "./spawn.js";
|
|
4
4
|
export { APPROVAL_TTL_DAYS, DELEGATE_SUBJECT, approvalKey, entryVerdict, expiryFor, inheritApprovals, offeredScopes, resolveApprovals, shouldSeekApproval, } from "./approval.js";
|
|
5
5
|
export { approvalsPath, loadApprovals, revokeAll, revokeApproval, saveApproval, } from "./approval-store.js";
|
|
6
|
+
export { approvalBindingDigest, approvalBindingsEqual, buildApprovalBinding, digestCapabilities, digestTask, isApprovalBinding, normaliseCorrelation, } from "./correlation.js";
|
|
7
|
+
export { GovernanceRefusal, REFUSAL_CODES, refusal, } from "./refusals.js";
|
|
8
|
+
export { acquireWorkspaceLease, defaultWorkspaceLeaseDir, loadWorkspaceRegistry, resolveWorkspace, validateRegisteredWorkspace, } from "./workspace.js";
|
|
9
|
+
export { buildCheckEnvironment, runNamedCheck, } from "./check-runner.js";
|
|
6
10
|
export { createApprovalGate, createApprovalGateProvider, timeoutMsFromEnv, } from "./approval-prompt.js";
|
|
7
11
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,eAAe,EACf,kBAAkB,EAClB,sBAAsB,GAIvB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,YAAY,EACZ,WAAW,EACX,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,eAAe,EACf,kBAAkB,EAClB,sBAAsB,GAIvB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,wBAAwB,EACxB,WAAW,EACX,wBAAwB,EACxB,mBAAmB,EACnB,cAAc,GAQf,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,SAAS,EAAuC,MAAM,YAAY,CAAC;AAE5E,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,kBAAkB,GAOnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,aAAa,EACb,aAAa,EACb,SAAS,EACT,cAAc,EACd,YAAY,GAGb,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,UAAU,EACV,iBAAiB,EACjB,oBAAoB,GAIrB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,OAAO,GAGR,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,gBAAgB,EAChB,2BAA2B,GAK5B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,qBAAqB,EACrB,aAAa,GAId,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,gBAAgB,GAOjB,MAAM,sBAAsB,CAAC"}
|