pi-daddy 0.17.1 → 0.18.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 +54 -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/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 +68 -72
- 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/refusals.d.ts +16 -0
- package/dist/refusals.d.ts.map +1 -0
- package/dist/refusals.js +51 -0
- package/dist/refusals.js.map +1 -0
- 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/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 +80 -179
- 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/refusals.ts +66 -0
- 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
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shapes `planDelegation` consumes and produces. Split out of `./delegate.ts` only to stay under the
|
|
3
|
+
* 400-line module ceiling this project enforces mechanically; `./delegate.ts` re-exports all three, so
|
|
4
|
+
* "the delegate module" remains one import for every caller.
|
|
5
|
+
*/
|
|
6
|
+
import type { Capability, ResolveResult } from "./resolve.ts";
|
|
7
|
+
import type { DefinitionDigest, SkillDefinition } from "./definitions.ts";
|
|
8
|
+
import type { InheritableApproval } from "./approval.ts";
|
|
9
|
+
import type { Catalog } from "./catalog.ts";
|
|
10
|
+
import type { ApprovalBinding, CorrelationMetadata } from "./correlation.ts";
|
|
11
|
+
import type { StructuredRefusal } from "./refusals.ts";
|
|
12
|
+
export interface DelegationRequest {
|
|
13
|
+
task: string;
|
|
14
|
+
/**
|
|
15
|
+
* Capabilities the delegator wants the child to hold.
|
|
16
|
+
*
|
|
17
|
+
* Optional since ADR-0016: prefer `agent`, which names an operator-authored definition. This form
|
|
18
|
+
* lets the MODEL choose the capability set, which is the weaker arrangement — it is still bounded by
|
|
19
|
+
* the session grant (ADR-0008), so it cannot escalate, but nothing about it was reviewed by a human.
|
|
20
|
+
*/
|
|
21
|
+
tools?: string[];
|
|
22
|
+
/**
|
|
23
|
+
* Name of a `SKILL.md` definition to spawn (ADR-0016).
|
|
24
|
+
*
|
|
25
|
+
* When given, the definition's `allowed-tools` is the ceiling and its body is the child's system
|
|
26
|
+
* prompt. The model chooses only *which* definition and *what* task; the capability set is the
|
|
27
|
+
* operator's, written down in a file.
|
|
28
|
+
*/
|
|
29
|
+
agent?: string;
|
|
30
|
+
model?: string;
|
|
31
|
+
provider?: string;
|
|
32
|
+
thinking?: string;
|
|
33
|
+
/** Optional external join metadata. It never participates in capability authority. */
|
|
34
|
+
correlation?: CorrelationMetadata;
|
|
35
|
+
/**
|
|
36
|
+
* Trusted binding scope, supplied by the caller that actually resolved and leased the
|
|
37
|
+
* workspace. Deliberately separate from `correlation`, whose values are a model-supplied
|
|
38
|
+
* claim: reading the workspace id out of correlation let a bound approval be spent outside
|
|
39
|
+
* the workspace it named (R-110).
|
|
40
|
+
*/
|
|
41
|
+
boundWorkspaceId?: string;
|
|
42
|
+
boundContextId?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface DelegationContext {
|
|
45
|
+
ownGrant: Capability[];
|
|
46
|
+
depth: number;
|
|
47
|
+
maxDepth: number;
|
|
48
|
+
gated: Capability[];
|
|
49
|
+
/**
|
|
50
|
+
* Approvals in force for this delegation, with subject and scope (ADR-0014).
|
|
51
|
+
*
|
|
52
|
+
* One source of truth for two different questions. The **gate check here** honours every entry,
|
|
53
|
+
* including `once` — that approval applies to *this* spawn, which is exactly what the human said yes
|
|
54
|
+
* to. What crosses to the CHILD is `inheritApprovals`, which drops `once` and keeps the subject, so
|
|
55
|
+
* the same list cannot silently authorise a subtree.
|
|
56
|
+
*/
|
|
57
|
+
approved?: InheritableApproval[];
|
|
58
|
+
ledgerPath?: string;
|
|
59
|
+
/** Path to this extension, so a child granted `tool:delegate` can delegate in turn. */
|
|
60
|
+
extensionPath?: string;
|
|
61
|
+
/** Live capability catalog. When supplied, capabilities absent from it are refused as unknown. */
|
|
62
|
+
catalog?: Catalog;
|
|
63
|
+
/**
|
|
64
|
+
* Absolute path per skill NAME, from the catalog's `source` field (R-32).
|
|
65
|
+
*
|
|
66
|
+
* Without it every granted `skill:` capability is unresolvable and the delegation is refused, which
|
|
67
|
+
* is the correct direction: a caller that cannot say where a skill lives cannot honestly grant it.
|
|
68
|
+
*/
|
|
69
|
+
skillPaths?: Record<string, string>;
|
|
70
|
+
/** Let the child load `AGENTS.md` / `CLAUDE.md`. Default false — see `planSpawn`. */
|
|
71
|
+
contextFiles?: boolean;
|
|
72
|
+
/** Known `SKILL.md` definitions by name, for `DelegationRequest.agent` (ADR-0016). */
|
|
73
|
+
definitions?: Map<string, SkillDefinition>;
|
|
74
|
+
/**
|
|
75
|
+
* Build an INTERACTIVE plan — no `--print` — for an executor that drives the child after starting it.
|
|
76
|
+
*
|
|
77
|
+
* `runHerdrPane` requires this: `--print` makes pi process the prompt and exit, so it never reaches the
|
|
78
|
+
* interactive readiness `herdr agent start` waits for and the agent is never detected. Default is the
|
|
79
|
+
* non-interactive plan, because a governed child should not sit waiting for a human by accident.
|
|
80
|
+
*/
|
|
81
|
+
interactive?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Total descendants this session may still create (`src/fanout.ts`). Split among children by the caller.
|
|
84
|
+
*
|
|
85
|
+
* Omitted means unbounded, which is the pre-fan-out behaviour and correct for a single blocking
|
|
86
|
+
* delegation — the accident that used to bound cardinality to one.
|
|
87
|
+
*/
|
|
88
|
+
fanoutBudget?: number;
|
|
89
|
+
/** This session's ledger id, so a child's `parentId` names its real parent (F8). */
|
|
90
|
+
spawnId?: string;
|
|
91
|
+
/** Ledger id assigned to THIS child, distinguishing it from its siblings (F8). */
|
|
92
|
+
childSpawnId?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface Delegation {
|
|
95
|
+
ok: boolean;
|
|
96
|
+
reason?: string;
|
|
97
|
+
/** Stable machine-readable refusal accompanying the unchanged human diagnostic. */
|
|
98
|
+
refusal?: StructuredRefusal;
|
|
99
|
+
args: string[];
|
|
100
|
+
/** Per-child environment — never merged into the parent's process.env. */
|
|
101
|
+
env: Record<string, string>;
|
|
102
|
+
effective: Capability[];
|
|
103
|
+
/**
|
|
104
|
+
* The result this plan was made from. **Required** (B-I3): while it was optional the extension
|
|
105
|
+
* guarded its ledger write with `if (ledgerPath && plan.result)`, silently dropping every refusal
|
|
106
|
+
* that returned before `resolve()` ran. The type is what keeps a new early exit auditable.
|
|
107
|
+
*/
|
|
108
|
+
result: ResolveResult;
|
|
109
|
+
childDepth: number;
|
|
110
|
+
/**
|
|
111
|
+
* The capabilities this delegation asked for, whatever route named them.
|
|
112
|
+
*
|
|
113
|
+
* Carried on the plan rather than re-derived by the caller (the B-I3 lesson): with `agent`, the
|
|
114
|
+
* request names a DEFINITION and the capabilities come from its `allowed-tools`, so a ledger that
|
|
115
|
+
* read the tool parameters would record an empty request for every definition spawn.
|
|
116
|
+
*/
|
|
117
|
+
requested: Capability[];
|
|
118
|
+
/** Ledger id for this child, if the caller assigned one (F8). */
|
|
119
|
+
childId?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Which operator-authored instructions this spawn used (ADR-0018).
|
|
122
|
+
*
|
|
123
|
+
* Absent for a `tools:`-style delegation, which has no definition and therefore no instructions to
|
|
124
|
+
* identify — and absent on an ADR-0017 authorisation refusal, which is decided before the file is read.
|
|
125
|
+
*/
|
|
126
|
+
definitionDigest?: DefinitionDigest;
|
|
127
|
+
/** Trusted SHA-256 of the exact model-authored task. The task text itself is never stored. */
|
|
128
|
+
taskDigest: string;
|
|
129
|
+
/** Non-authoritative external join metadata, snapshotted at planning time. */
|
|
130
|
+
correlation?: CorrelationMetadata;
|
|
131
|
+
/** Exact approval scope, present when correlation/workspace context requested task-bound approval. */
|
|
132
|
+
approvalBinding?: ApprovalBinding;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Plan a governed delegation. Pure: returns argv and env, spawns nothing.
|
|
136
|
+
*
|
|
137
|
+
* Fails closed on depth, on any requested capability the delegator does not hold, on gated capabilities
|
|
138
|
+
* without approval, and on a grant that cannot narrow (a universal capability slipping through).
|
|
139
|
+
*/
|
|
140
|
+
//# sourceMappingURL=delegate-types.d.ts.map
|
|
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/**
|
|
3
|
+
* Plan a governed delegation. Pure: returns argv and env, spawns nothing.
|
|
4
|
+
*
|
|
5
|
+
* Fails closed on depth, on any requested capability the delegator does not hold, on gated capabilities
|
|
6
|
+
* without approval, and on a grant that cannot narrow (a universal capability slipping through).
|
|
7
|
+
*/
|
|
8
|
+
//# sourceMappingURL=delegate-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegate-types.js","sourceRoot":"","sources":["../src/delegate-types.ts"],"names":[],"mappings":";AA0IA;;;;;GAKG"}
|
package/dist/delegate.d.ts
CHANGED
|
@@ -1,133 +1,9 @@
|
|
|
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
|
-
import { type DefinitionDigest, type SkillDefinition } from "./definitions.ts";
|
|
18
|
-
import { type Capability, type ResolveResult } from "./resolve.ts";
|
|
19
5
|
export { DELEGATE_CAPABILITY, agentCapability, maySpawnDefinition, normaliseCapability } from "./capabilities.ts";
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
export interface DelegationRequest {
|
|
23
|
-
task: string;
|
|
24
|
-
/**
|
|
25
|
-
* Capabilities the delegator wants the child to hold.
|
|
26
|
-
*
|
|
27
|
-
* Optional since ADR-0016: prefer `agent`, which names an operator-authored definition. This form
|
|
28
|
-
* lets the MODEL choose the capability set, which is the weaker arrangement — it is still bounded by
|
|
29
|
-
* the session grant (ADR-0008), so it cannot escalate, but nothing about it was reviewed by a human.
|
|
30
|
-
*/
|
|
31
|
-
tools?: string[];
|
|
32
|
-
/**
|
|
33
|
-
* Name of a `SKILL.md` definition to spawn (ADR-0016).
|
|
34
|
-
*
|
|
35
|
-
* When given, the definition's `allowed-tools` is the ceiling and its body is the child's system
|
|
36
|
-
* prompt. The model chooses only *which* definition and *what* task; the capability set is the
|
|
37
|
-
* operator's, written down in a file.
|
|
38
|
-
*/
|
|
39
|
-
agent?: string;
|
|
40
|
-
model?: string;
|
|
41
|
-
provider?: string;
|
|
42
|
-
thinking?: string;
|
|
43
|
-
}
|
|
44
|
-
export interface DelegationContext {
|
|
45
|
-
ownGrant: Capability[];
|
|
46
|
-
depth: number;
|
|
47
|
-
maxDepth: number;
|
|
48
|
-
gated: Capability[];
|
|
49
|
-
/**
|
|
50
|
-
* Approvals in force for this delegation, with subject and scope (ADR-0014).
|
|
51
|
-
*
|
|
52
|
-
* One source of truth for two different questions. The **gate check here** honours every entry,
|
|
53
|
-
* including `once` — that approval applies to *this* spawn, which is exactly what the human said yes
|
|
54
|
-
* to. What crosses to the CHILD is `inheritApprovals`, which drops `once` and keeps the subject, so
|
|
55
|
-
* the same list cannot silently authorise a subtree.
|
|
56
|
-
*/
|
|
57
|
-
approved?: InheritableApproval[];
|
|
58
|
-
ledgerPath?: string;
|
|
59
|
-
/** Path to this extension, so a child granted `tool:delegate` can delegate in turn. */
|
|
60
|
-
extensionPath?: string;
|
|
61
|
-
/** Live capability catalog. When supplied, capabilities absent from it are refused as unknown. */
|
|
62
|
-
catalog?: Catalog;
|
|
63
|
-
/**
|
|
64
|
-
* Absolute path per skill NAME, from the catalog's `source` field (R-32).
|
|
65
|
-
*
|
|
66
|
-
* Without it every granted `skill:` capability is unresolvable and the delegation is refused, which
|
|
67
|
-
* is the correct direction: a caller that cannot say where a skill lives cannot honestly grant it.
|
|
68
|
-
*/
|
|
69
|
-
skillPaths?: Record<string, string>;
|
|
70
|
-
/** Let the child load `AGENTS.md` / `CLAUDE.md`. Default false — see `planSpawn`. */
|
|
71
|
-
contextFiles?: boolean;
|
|
72
|
-
/** Known `SKILL.md` definitions by name, for `DelegationRequest.agent` (ADR-0016). */
|
|
73
|
-
definitions?: Map<string, SkillDefinition>;
|
|
74
|
-
/**
|
|
75
|
-
* Build an INTERACTIVE plan — no `--print` — for an executor that drives the child after starting it.
|
|
76
|
-
*
|
|
77
|
-
* `runHerdrPane` requires this: `--print` makes pi process the prompt and exit, so it never reaches the
|
|
78
|
-
* interactive readiness `herdr agent start` waits for and the agent is never detected. Default is the
|
|
79
|
-
* non-interactive plan, because a governed child should not sit waiting for a human by accident.
|
|
80
|
-
*/
|
|
81
|
-
interactive?: boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Total descendants this session may still create (`src/fanout.ts`). Split among children by the caller.
|
|
84
|
-
*
|
|
85
|
-
* Omitted means unbounded, which is the pre-fan-out behaviour and correct for a single blocking
|
|
86
|
-
* delegation — the accident that used to bound cardinality to one.
|
|
87
|
-
*/
|
|
88
|
-
fanoutBudget?: number;
|
|
89
|
-
/** This session's ledger id, so a child's `parentId` names its real parent (F8). */
|
|
90
|
-
spawnId?: string;
|
|
91
|
-
/** Ledger id assigned to THIS child, distinguishing it from its siblings (F8). */
|
|
92
|
-
childSpawnId?: string;
|
|
93
|
-
}
|
|
94
|
-
export interface Delegation {
|
|
95
|
-
ok: boolean;
|
|
96
|
-
reason?: string;
|
|
97
|
-
args: string[];
|
|
98
|
-
/** Per-child environment — never merged into the parent's process.env. */
|
|
99
|
-
env: Record<string, string>;
|
|
100
|
-
effective: Capability[];
|
|
101
|
-
/**
|
|
102
|
-
* The result this plan was made from. **Required** (B-I3): while it was optional the extension
|
|
103
|
-
* guarded its ledger write with `if (ledgerPath && plan.result)`, silently dropping every refusal
|
|
104
|
-
* that returned before `resolve()` ran. The type is what keeps a new early exit auditable.
|
|
105
|
-
*/
|
|
106
|
-
result: ResolveResult;
|
|
107
|
-
childDepth: number;
|
|
108
|
-
/**
|
|
109
|
-
* The capabilities this delegation asked for, whatever route named them.
|
|
110
|
-
*
|
|
111
|
-
* Carried on the plan rather than re-derived by the caller (the B-I3 lesson): with `agent`, the
|
|
112
|
-
* request names a DEFINITION and the capabilities come from its `allowed-tools`, so a ledger that
|
|
113
|
-
* read the tool parameters would record an empty request for every definition spawn.
|
|
114
|
-
*/
|
|
115
|
-
requested: Capability[];
|
|
116
|
-
/** Ledger id for this child, if the caller assigned one (F8). */
|
|
117
|
-
childId?: string;
|
|
118
|
-
/**
|
|
119
|
-
* Which operator-authored instructions this spawn used (ADR-0018).
|
|
120
|
-
*
|
|
121
|
-
* Absent for a `tools:`-style delegation, which has no definition and therefore no instructions to
|
|
122
|
-
* identify — and absent on an ADR-0017 authorisation refusal, which is decided before the file is read.
|
|
123
|
-
*/
|
|
124
|
-
definitionDigest?: DefinitionDigest;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Plan a governed delegation. Pure: returns argv and env, spawns nothing.
|
|
128
|
-
*
|
|
129
|
-
* Fails closed on depth, on any requested capability the delegator does not hold, on gated capabilities
|
|
130
|
-
* without approval, and on a grant that cannot narrow (a universal capability slipping through).
|
|
131
|
-
*/
|
|
6
|
+
import type { Delegation, DelegationContext, DelegationRequest } from "./delegate-types.ts";
|
|
7
|
+
export type { Delegation, DelegationContext, DelegationRequest } from "./delegate-types.ts";
|
|
132
8
|
export declare function planDelegation(request: DelegationRequest, ctx: DelegationContext): Delegation;
|
|
133
9
|
//# sourceMappingURL=delegate.d.ts.map
|
package/dist/delegate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegate.d.ts","sourceRoot":"","sources":["../src/delegate.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"delegate.d.ts","sourceRoot":"","sources":["../src/delegate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAYlH,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC5F,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE5F,wBAAgB,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,GAAG,EAAE,iBAAiB,GAAG,UAAU,CA+Q7F"}
|
package/dist/delegate.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
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
|
-
* Fails closed on depth, on any requested capability the delegator does not hold, on gated capabilities
|
|
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";
|
|
35
19
|
export function planDelegation(request, ctx) {
|
|
36
20
|
const childDepth = ctx.depth + 1;
|
|
21
|
+
const denied = (plan, code) => plan.reason ? { ...plan, refusal: refusal(code, plan.reason) } : plan;
|
|
37
22
|
// G6 / B-I3: every refusal carries a result, including the four below that return before `resolve()`
|
|
38
23
|
// is ever called. The extension guarded its ledger write with `if (ledgerPath && plan.result)`, so
|
|
39
24
|
// those four governance decisions — disabled, too deep, no task, unknown capability — were never
|
|
40
25
|
// audited at all. An empty result is the honest record: nothing was resolved, and that is the fact.
|
|
26
|
+
// Bounded/whitelisted correlation is a REFUSAL, not an exception escaping the planner. It is reachable
|
|
27
|
+
// from a model-facing tool parameter on all three delegation tools, and throwing from here produced a
|
|
28
|
+
// governed refusal with no code and no ledger line at all — the ledger file was never even created
|
|
29
|
+
// (R-112). Caught here so it becomes an ordinary recorded decision.
|
|
30
|
+
let correlation;
|
|
31
|
+
let correlationRefused;
|
|
32
|
+
try {
|
|
33
|
+
correlation = normaliseCorrelation(request.correlation);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
correlationRefused = error instanceof GovernanceRefusal
|
|
37
|
+
? { code: error.code, message: error.message, ...(error.details ? { details: error.details } : {}) }
|
|
38
|
+
: refusal("CORRELATION_INVALID", String(error instanceof Error ? error.message : error));
|
|
39
|
+
}
|
|
40
|
+
const taskDigest = digestTask(request.task ?? "");
|
|
41
41
|
const empty = {
|
|
42
42
|
ok: false,
|
|
43
43
|
args: [],
|
|
@@ -45,15 +45,21 @@ export function planDelegation(request, ctx) {
|
|
|
45
45
|
effective: [],
|
|
46
46
|
childDepth,
|
|
47
47
|
requested: [],
|
|
48
|
+
taskDigest,
|
|
49
|
+
...(correlation ? { correlation } : {}),
|
|
48
50
|
result: { effective: [], denied: [], clipped: [], gatedBlocked: [], universal: [], subsumedBy: [] },
|
|
49
51
|
};
|
|
50
|
-
if (
|
|
51
|
-
return { ...empty, reason:
|
|
52
|
+
if (correlationRefused) {
|
|
53
|
+
return { ...empty, reason: correlationRefused.message, refusal: correlationRefused };
|
|
54
|
+
}
|
|
55
|
+
if (ctx.maxDepth <= 0) {
|
|
56
|
+
return denied({ ...empty, reason: "delegation is disabled (maxDepth 0)" }, "DEPTH_EXCEEDED");
|
|
57
|
+
}
|
|
52
58
|
if (childDepth > ctx.maxDepth) {
|
|
53
|
-
return { ...empty, reason: `delegation depth limit reached (${ctx.maxDepth})` };
|
|
59
|
+
return denied({ ...empty, reason: `delegation depth limit reached (${ctx.maxDepth})` }, "DEPTH_EXCEEDED");
|
|
54
60
|
}
|
|
55
61
|
if (!request.task?.trim())
|
|
56
|
-
return { ...empty, reason: "a delegation needs a task" };
|
|
62
|
+
return denied({ ...empty, reason: "a delegation needs a task" }, "TASK_MISSING");
|
|
57
63
|
// ADR-0016. A named definition replaces the model's tool list with an operator-authored ceiling.
|
|
58
64
|
let requested;
|
|
59
65
|
let systemPrompt;
|
|
@@ -68,11 +74,11 @@ export function planDelegation(request, ctx) {
|
|
|
68
74
|
// here is simply an error.
|
|
69
75
|
if (!definition) {
|
|
70
76
|
const known = [...(ctx.definitions?.keys() ?? [])].sort();
|
|
71
|
-
return {
|
|
77
|
+
return denied({
|
|
72
78
|
...empty,
|
|
73
79
|
reason: `unknown agent "${request.agent}"` +
|
|
74
80
|
(known.length > 0 ? ` — known definitions: ${known.join(", ")}` : " — no definitions were found"),
|
|
75
|
-
};
|
|
81
|
+
}, "UNKNOWN_DEFINITION");
|
|
76
82
|
}
|
|
77
83
|
// ADR-0017: authorisation comes BEFORE anything is said about the file. Which definitions this
|
|
78
84
|
// session may spawn is a governance question about the SESSION; whether the file declares its tools
|
|
@@ -85,7 +91,7 @@ export function planDelegation(request, ctx) {
|
|
|
85
91
|
if (!maySpawnDefinition(ctx.ownGrant, definition.name)) {
|
|
86
92
|
const authorising = agentCapability(definition.name);
|
|
87
93
|
const held = ctx.ownGrant.filter((c) => c.startsWith("agent:")).sort();
|
|
88
|
-
return {
|
|
94
|
+
return denied({
|
|
89
95
|
...empty,
|
|
90
96
|
requested: [authorising],
|
|
91
97
|
result: { ...empty.result, denied: [authorising] },
|
|
@@ -94,7 +100,7 @@ export function planDelegation(request, ctx) {
|
|
|
94
100
|
(held.length > 0
|
|
95
101
|
? `It may spawn: ${held.join(", ")}.`
|
|
96
102
|
: `It may spawn no definitions at all; add ${authorising} to its grant to allow this one.`),
|
|
97
|
-
};
|
|
103
|
+
}, "DEFINITION_NOT_AUTHORIZED");
|
|
98
104
|
}
|
|
99
105
|
// ADR-0018. Recorded from here on — after authorisation, because the digest is a fact about a file
|
|
100
106
|
// this caller was allowed to read, and before every remaining outcome, because a spawn refused for a
|
|
@@ -108,19 +114,19 @@ export function planDelegation(request, ctx) {
|
|
|
108
114
|
Object.assign(empty, { definitionDigest });
|
|
109
115
|
const ceiling = ceilingForDefinition(definition);
|
|
110
116
|
if (ceiling.undeclared) {
|
|
111
|
-
return {
|
|
117
|
+
return denied({
|
|
112
118
|
...empty,
|
|
113
119
|
reason: `agent "${definition.name}" declares no \`allowed-tools\`, so it cannot be spawned — add one ` +
|
|
114
120
|
`to ${definition.source}. An undeclared capability set is treated as NONE, never as everything.`,
|
|
115
|
-
};
|
|
121
|
+
}, "UNDECLARED_TOOLS");
|
|
116
122
|
}
|
|
117
123
|
if (ceiling.patterns.length > 0) {
|
|
118
|
-
return {
|
|
124
|
+
return denied({
|
|
119
125
|
...empty,
|
|
120
126
|
reason: `agent "${definition.name}" restricts a tool with a pattern (${ceiling.patterns.join(", ")}), ` +
|
|
121
127
|
`which pi's --tools cannot express — it matches whole tool names only. Granting the bare tool ` +
|
|
122
128
|
`would widen the declaration and dropping it would silently narrow, so neither is done.`,
|
|
123
|
-
};
|
|
129
|
+
}, "CEILING_PATTERNS_UNRESOLVED");
|
|
124
130
|
}
|
|
125
131
|
requested = ceiling.capabilities;
|
|
126
132
|
systemPrompt = definition.body;
|
|
@@ -144,55 +150,38 @@ export function planDelegation(request, ctx) {
|
|
|
144
150
|
return s === null ? null : `${c} → did you mean ${s}?`;
|
|
145
151
|
})
|
|
146
152
|
.filter((h) => h !== null);
|
|
147
|
-
return {
|
|
153
|
+
return denied({
|
|
148
154
|
...empty,
|
|
149
155
|
requested,
|
|
150
156
|
reason: `unknown capabilit${unknown.length === 1 ? "y" : "ies"}: ${unknown.join(", ")} — not present in ` +
|
|
151
157
|
`this session's catalog (typo, or an uninstalled package?)` +
|
|
152
158
|
(hints.length > 0 ? ` — ${hints.join("; ")}` : ""),
|
|
153
|
-
};
|
|
159
|
+
}, "UNKNOWN_TOOL");
|
|
154
160
|
}
|
|
155
161
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
const result = resolve({
|
|
162
|
+
const { result, approvalBinding, bindingMismatch } = resolveDelegationApproval({
|
|
163
|
+
task: request.task,
|
|
164
|
+
agent: request.agent,
|
|
165
|
+
boundWorkspaceId: request.boundWorkspaceId,
|
|
166
|
+
boundContextId: request.boundContextId,
|
|
162
167
|
requested,
|
|
163
168
|
parentGrant: ctx.ownGrant,
|
|
164
169
|
gated: ctx.gated,
|
|
165
|
-
approved:
|
|
170
|
+
approved: ctx.approved,
|
|
171
|
+
spawned,
|
|
172
|
+
definitionDigest,
|
|
173
|
+
correlation,
|
|
174
|
+
parentId: ctx.spawnId ?? `d${ctx.depth}`,
|
|
166
175
|
});
|
|
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
|
-
}
|
|
176
|
+
if (approvalBinding)
|
|
177
|
+
Object.assign(empty, { approvalBinding });
|
|
189
178
|
if (result.denied.length > 0) {
|
|
190
|
-
return {
|
|
179
|
+
return denied({
|
|
191
180
|
...empty,
|
|
192
181
|
requested,
|
|
193
182
|
result,
|
|
194
183
|
reason: `cannot grant ${result.denied.join(", ")} — this session does not hold it (capability escalation blocked)`,
|
|
195
|
-
};
|
|
184
|
+
}, "CAPABILITY_ESCALATION");
|
|
196
185
|
}
|
|
197
186
|
// ADR-0011: narrowing is checked BEFORE the gate, and the order is load-bearing rather than
|
|
198
187
|
// stylistic. `assertNarrowing` refuses regardless of approval, so with the old order this returned
|
|
@@ -203,10 +192,14 @@ export function planDelegation(request, ctx) {
|
|
|
203
192
|
assertNarrowing(result);
|
|
204
193
|
}
|
|
205
194
|
catch (error) {
|
|
206
|
-
|
|
195
|
+
// ADR-0011's narrowing invariant is the hardest rule this package enforces, and it was the one
|
|
196
|
+
// refusal an external controller could not identify by code (R-109).
|
|
197
|
+
return denied({ ...empty, requested, result, reason: String(error instanceof Error ? error.message : error) }, "NARROWING_VIOLATED");
|
|
207
198
|
}
|
|
208
199
|
if (result.gatedBlocked.length > 0) {
|
|
209
|
-
|
|
200
|
+
const code = bindingMismatch ? "APPROVAL_SCOPE_MISMATCH" : "GATED_UNAPPROVED";
|
|
201
|
+
const suffix = bindingMismatch ? " (an approval exists, but its task/workspace/context scope does not match)" : "";
|
|
202
|
+
return denied({ ...empty, requested, result, reason: `${result.gatedBlocked.join(", ")} requires explicit approval${suffix}` }, code);
|
|
210
203
|
}
|
|
211
204
|
const canSubDelegate = result.effective.includes(DELEGATE_CAPABILITY);
|
|
212
205
|
const plan = planSpawn({
|
|
@@ -226,13 +219,13 @@ export function planDelegation(request, ctx) {
|
|
|
226
219
|
// not contain. `unknownCapabilities` above catches names absent from the catalog entirely; this
|
|
227
220
|
// catches one that is known but whose path we could not resolve, which is a different fault.
|
|
228
221
|
if (plan.unresolvedSkills.length > 0) {
|
|
229
|
-
return {
|
|
222
|
+
return denied({
|
|
230
223
|
...empty,
|
|
231
224
|
requested,
|
|
232
225
|
result,
|
|
233
226
|
reason: `cannot locate ${plan.unresolvedSkills.join(", ")} on disk — granted but unresolvable, so the ` +
|
|
234
227
|
`child would silently lack it`,
|
|
235
|
-
};
|
|
228
|
+
}, "DEFINITION_UNREADABLE");
|
|
236
229
|
}
|
|
237
230
|
// A child may only delegate further if it was granted the capability AND has the extension to do it.
|
|
238
231
|
const args = [...plan.args];
|
|
@@ -271,6 +264,9 @@ export function planDelegation(request, ctx) {
|
|
|
271
264
|
childDepth,
|
|
272
265
|
requested,
|
|
273
266
|
childId: ctx.childSpawnId,
|
|
267
|
+
taskDigest,
|
|
268
|
+
...(correlation ? { correlation } : {}),
|
|
269
|
+
...(approvalBinding ? { approvalBinding } : {}),
|
|
274
270
|
...(definitionDigest ? { definitionDigest } : {}),
|
|
275
271
|
};
|
|
276
272
|
}
|
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,EAA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