pi-delegation-policy 0.6.0 → 0.7.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 +7 -0
- package/README.md +8 -5
- package/SECURITY.md +1 -1
- package/package.json +4 -4
- package/schema/delegation-policy.schema.json +1 -1
- package/src/config.ts +32 -12
- package/src/delegate-panel.ts +3 -1
- package/src/index.ts +4 -1
- package/src/prompt.ts +22 -3
- package/src/runtime.ts +6 -1
- package/src/types.ts +1 -1
- package/src/ui.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.7.0 - 2026-09-06
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Add the `orchestrator` intensity with `/delegate orchestrator` and `D:ORCH`. It delegates transferable research, detailed planning, implementation, testing, writing, review, and integration mechanics while keeping objectives, critical decisions, coordination, evidence, and final acceptance with the main agent.
|
|
10
|
+
- Add orchestrator guidance for batching small work, concise briefs and results with file references, and avoiding duplicate inspection without a concrete gap or risk.
|
|
11
|
+
|
|
5
12
|
## 0.6.0 - 2026-08-29
|
|
6
13
|
|
|
7
14
|
### Added
|
package/README.md
CHANGED
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
A local Pi extension that helps the main agent decide **when delegation is worth it** and which exact models to use for Small, Medium, Large, and optional Visual Design. It provides guidance; it is not a subagent runner.
|
|
4
4
|
|
|
5
|
-
> **Status:** Version **0.
|
|
5
|
+
> **Status:** Version **0.7.0** is the latest published package and supports `off`, `normal`, `aggressive`, and `orchestrator`. The package requires Pi `>=0.84.3`; Pi `0.84.3` is the explicitly checked baseline.
|
|
6
6
|
>
|
|
7
7
|
> **Docs:** [Read the documentation site](https://yivas.github.io/pi-delegation-policy/).
|
|
8
8
|
|
|
9
9
|
## Value and boundary
|
|
10
10
|
|
|
11
|
-
- Choose `off`, `normal`, or `
|
|
11
|
+
- Choose `off`, `normal`, `aggressive`, or `orchestrator` globally or for the current session branch.
|
|
12
12
|
- Configure an exact provider/model reference or explicitly disable each ordinary role.
|
|
13
13
|
- Keep global defaults and session-branch overrides across reload, resume, and tree navigation.
|
|
14
14
|
- Validate active configurations before injecting one policy block through Pi's public `before_agent_start` event.
|
|
15
15
|
|
|
16
|
-
The extension guides the main agent. It never creates, launches, routes, supervises, or blocks subagents; changes Pi's main model or thinking; stores credentials; intercepts tools; or makes its own network requests. It has no model fallback, telemetry, project configuration, presets, or external skill loading.
|
|
16
|
+
The extension guides the main agent. It never creates, launches, routes, supervises, or blocks subagents; changes Pi's main model or thinking; stores credentials; intercepts tools; or makes its own network requests. `orchestrator` delegates transferable execution detail and batches small work while the main agent retains objectives, critical decisions, coordination, integration responsibility, requested evidence, and final acceptance. It has no model fallback, telemetry, project configuration, presets, or external skill loading.
|
|
17
17
|
|
|
18
18
|
A valid active policy requires an explicit decision for Small, Medium, and Large: an exact model reference or disabled. At least one ordinary role must remain enabled. A disabled role is not validated. An absent role, an invalid enabled reference, or no enabled ordinary role produces `D:ERR` and injects no policy. `off` always produces `D:OFF` without injection.
|
|
19
19
|
|
|
@@ -30,11 +30,13 @@ pi install npm:pi-delegation-policy
|
|
|
30
30
|
|
|
31
31
|
1. Open `/delegate` (or press `Alt+G` in Pi's TUI).
|
|
32
32
|
2. For Small, Medium, and Large, select an exact authenticated provider/model or **Disable for this session**. Keep at least one enabled.
|
|
33
|
-
3. Select `normal` or `
|
|
33
|
+
3. Select `normal`, `aggressive`, or `orchestrator`, then choose **Apply changes**.
|
|
34
34
|
4. Run `/delegate status`. `disabled`, `not configured`, and exact references remain distinct. `D:ERR` means no policy is injected.
|
|
35
35
|
5. The applied state affects the **next** agent run.
|
|
36
36
|
|
|
37
|
-
Global defaults are stored at `~/.pi/agent/delegation-policy.json` and use schema version 3. Schema 2 defaults and session entries are read and normalized in memory
|
|
37
|
+
Global defaults are stored at `~/.pi/agent/delegation-policy.json` and use schema version 3. Schema 2 defaults and session entries are read and normalized in memory without rewriting them. Schema 3 stores `null` for an explicitly disabled ordinary role. Session changes write a schema 2 `off` guard before the schema 3 state; saving defaults changes only the global file.
|
|
38
|
+
|
|
39
|
+
Before downgrading to `0.6.0`, change the global intensity to `off`, `normal`, or `aggressive` and run `/delegate off` in every active branch. For `<=0.5.0`, also convert global defaults to schema 2 and replace ordinary `null` values with exact model references. Schema 2 never accepts `orchestrator`. See the configuration reference for details.
|
|
38
40
|
|
|
39
41
|
See the [getting-started guide](https://yivas.github.io/pi-delegation-policy/getting-started/) and [configuration reference](https://yivas.github.io/pi-delegation-policy/configuration/).
|
|
40
42
|
|
|
@@ -45,6 +47,7 @@ See the [getting-started guide](https://yivas.github.io/pi-delegation-policy/get
|
|
|
45
47
|
/delegate off Disable policy for this session branch
|
|
46
48
|
/delegate normal Enable balanced delegation guidance
|
|
47
49
|
/delegate aggressive Enable delegation-first guidance
|
|
50
|
+
/delegate orchestrator Minimize main-agent execution and narration
|
|
48
51
|
/delegate status Show effective session state
|
|
49
52
|
/delegate reset Reset this branch to off and other fields to global defaults
|
|
50
53
|
```
|
package/SECURITY.md
CHANGED
|
@@ -14,4 +14,4 @@ Include the affected version or commit, operating system, Pi version, reproducti
|
|
|
14
14
|
|
|
15
15
|
## Supported versions
|
|
16
16
|
|
|
17
|
-
Only the latest published version is supported. Version 0.
|
|
17
|
+
Only the latest published version is supported. Version 0.7.0 is the current supported release.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-delegation-policy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A Pi extension for configurable delegation intensity and exact subagent role model references.",
|
|
6
6
|
"type": "module",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"@earendil-works/pi-ai": "0.84.3",
|
|
45
45
|
"@earendil-works/pi-coding-agent": "0.84.3",
|
|
46
46
|
"@earendil-works/pi-tui": "0.84.3",
|
|
47
|
-
"@eslint/js": "^
|
|
48
|
-
"@types/node": "^
|
|
47
|
+
"@eslint/js": "^10.0.1",
|
|
48
|
+
"@types/node": "^26.2.0",
|
|
49
49
|
"ajv": "^8.20.0",
|
|
50
|
-
"eslint": "^9.
|
|
50
|
+
"eslint": "^10.9.1",
|
|
51
51
|
"prettier": "^3.0.0",
|
|
52
52
|
"typescript": "^5.7.0",
|
|
53
53
|
"typescript-eslint": "^8.68.0"
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"required": ["schemaVersion"],
|
|
7
7
|
"properties": {
|
|
8
8
|
"schemaVersion": { "const": 3 },
|
|
9
|
-
"intensity": { "enum": ["off", "normal", "aggressive"] },
|
|
9
|
+
"intensity": { "enum": ["off", "normal", "aggressive", "orchestrator"] },
|
|
10
10
|
"preference": { "enum": ["efficient", "standard", "intensive"] },
|
|
11
11
|
"small": { "$ref": "#/$defs/ordinaryRole" },
|
|
12
12
|
"medium": { "$ref": "#/$defs/ordinaryRole" },
|
package/src/config.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { homedir } from "node:os";
|
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import {
|
|
5
5
|
CURRENT_SCHEMA_VERSION,
|
|
6
|
+
INTENSITIES,
|
|
6
7
|
emptyGlobalDefaults,
|
|
7
8
|
emptySessionState,
|
|
8
9
|
type EffectiveDelegateState,
|
|
@@ -56,7 +57,7 @@ export type GuardedAppendResult = "success" | "guard-failed" | "state-failed";
|
|
|
56
57
|
|
|
57
58
|
type Schema2GlobalDefaults = {
|
|
58
59
|
schemaVersion: 2;
|
|
59
|
-
intensity?:
|
|
60
|
+
intensity?: LegacyIntensity;
|
|
60
61
|
preference?: Preference;
|
|
61
62
|
small?: ModelRef;
|
|
62
63
|
medium?: ModelRef;
|
|
@@ -75,7 +76,14 @@ function hasOnlyKeys(value: Record<string, unknown>, allowedKeys: readonly strin
|
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
function isIntensity(value: unknown): value is Intensity {
|
|
78
|
-
return
|
|
79
|
+
return INTENSITIES.some((intensity) => intensity === value);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const LEGACY_INTENSITIES = ["off", "normal", "aggressive"] as const;
|
|
83
|
+
type LegacyIntensity = (typeof LEGACY_INTENSITIES)[number];
|
|
84
|
+
|
|
85
|
+
function isLegacyIntensity(value: unknown): value is LegacyIntensity {
|
|
86
|
+
return LEGACY_INTENSITIES.some((intensity) => intensity === value);
|
|
79
87
|
}
|
|
80
88
|
|
|
81
89
|
function isPreference(value: unknown): value is Preference {
|
|
@@ -99,12 +107,16 @@ function copyRoleSetting(value: OrdinaryRoleSetting | undefined): OrdinaryRoleSe
|
|
|
99
107
|
return value === null ? null : value ? { ...value } : undefined;
|
|
100
108
|
}
|
|
101
109
|
|
|
102
|
-
function hasValidEnvelope(
|
|
110
|
+
function hasValidEnvelope(
|
|
111
|
+
value: unknown,
|
|
112
|
+
schemaVersion: 2 | 3,
|
|
113
|
+
intensityValidator: (value: unknown) => boolean = isIntensity,
|
|
114
|
+
): value is Record<string, unknown> {
|
|
103
115
|
return (
|
|
104
116
|
isRecord(value) &&
|
|
105
117
|
hasOnlyKeys(value, CONFIG_KEYS) &&
|
|
106
118
|
value.schemaVersion === schemaVersion &&
|
|
107
|
-
(value.intensity === undefined ||
|
|
119
|
+
(value.intensity === undefined || intensityValidator(value.intensity)) &&
|
|
108
120
|
(value.preference === undefined || isPreference(value.preference))
|
|
109
121
|
);
|
|
110
122
|
}
|
|
@@ -132,12 +144,14 @@ function parseSchema2Roles(
|
|
|
132
144
|
}
|
|
133
145
|
|
|
134
146
|
export function parseSchema2Config(value: unknown): Schema2GlobalDefaults | undefined {
|
|
135
|
-
if (!hasValidEnvelope(value, 2)) return undefined;
|
|
147
|
+
if (!hasValidEnvelope(value, 2, isLegacyIntensity)) return undefined;
|
|
148
|
+
const intensity = value.intensity;
|
|
149
|
+
if (intensity !== undefined && !isLegacyIntensity(intensity)) return undefined;
|
|
136
150
|
const roles = parseSchema2Roles(value);
|
|
137
151
|
if (!roles) return undefined;
|
|
138
152
|
return {
|
|
139
153
|
schemaVersion: 2,
|
|
140
|
-
...(
|
|
154
|
+
...(intensity ? { intensity } : {}),
|
|
141
155
|
...(value.preference ? { preference: value.preference as Preference } : {}),
|
|
142
156
|
...roles,
|
|
143
157
|
};
|
|
@@ -145,6 +159,8 @@ export function parseSchema2Config(value: unknown): Schema2GlobalDefaults | unde
|
|
|
145
159
|
|
|
146
160
|
export function parseSchema3Config(value: unknown): GlobalDefaults | undefined {
|
|
147
161
|
if (!hasValidEnvelope(value, CURRENT_SCHEMA_VERSION)) return undefined;
|
|
162
|
+
const intensity = value.intensity;
|
|
163
|
+
if (intensity !== undefined && !isIntensity(intensity)) return undefined;
|
|
148
164
|
const parseOrdinary = (setting: unknown): OrdinaryRoleSetting | undefined =>
|
|
149
165
|
setting === null ? null : parseModelRef(setting);
|
|
150
166
|
const small = value.small === undefined ? undefined : parseOrdinary(value.small);
|
|
@@ -160,7 +176,7 @@ export function parseSchema3Config(value: unknown): GlobalDefaults | undefined {
|
|
|
160
176
|
return undefined;
|
|
161
177
|
return {
|
|
162
178
|
schemaVersion: CURRENT_SCHEMA_VERSION,
|
|
163
|
-
...(
|
|
179
|
+
...(intensity ? { intensity } : {}),
|
|
164
180
|
...(value.preference ? { preference: value.preference as Preference } : {}),
|
|
165
181
|
...(small !== undefined ? { small } : {}),
|
|
166
182
|
...(medium !== undefined ? { medium } : {}),
|
|
@@ -172,7 +188,7 @@ export function parseSchema3Config(value: unknown): GlobalDefaults | undefined {
|
|
|
172
188
|
function migrateSchema2Config(value: Schema2GlobalDefaults): GlobalDefaults {
|
|
173
189
|
return {
|
|
174
190
|
schemaVersion: CURRENT_SCHEMA_VERSION,
|
|
175
|
-
...(value.intensity ? { intensity: value.intensity
|
|
191
|
+
...(value.intensity ? { intensity: value.intensity } : {}),
|
|
176
192
|
...(value.preference ? { preference: value.preference as Preference } : {}),
|
|
177
193
|
...(value.small ? { small: { ...value.small } } : {}),
|
|
178
194
|
...(value.medium ? { medium: { ...value.medium } } : {}),
|
|
@@ -192,7 +208,9 @@ export function parseConfig(value: unknown): GlobalDefaults | undefined {
|
|
|
192
208
|
}
|
|
193
209
|
|
|
194
210
|
function parseSchema2SessionState(value: unknown): Schema2SessionState | undefined {
|
|
195
|
-
if (!hasValidEnvelope(value, 2)) return undefined;
|
|
211
|
+
if (!hasValidEnvelope(value, 2, isLegacyIntensity)) return undefined;
|
|
212
|
+
const intensity = value.intensity;
|
|
213
|
+
if (intensity !== undefined && !isLegacyIntensity(intensity)) return undefined;
|
|
196
214
|
const uiDesign =
|
|
197
215
|
value.uiDesign === undefined || value.uiDesign === null
|
|
198
216
|
? value.uiDesign
|
|
@@ -202,7 +220,7 @@ function parseSchema2SessionState(value: unknown): Schema2SessionState | undefin
|
|
|
202
220
|
return undefined;
|
|
203
221
|
return {
|
|
204
222
|
schemaVersion: 2,
|
|
205
|
-
...(
|
|
223
|
+
...(intensity ? { intensity } : {}),
|
|
206
224
|
...(value.preference ? { preference: value.preference as Preference } : {}),
|
|
207
225
|
...roles,
|
|
208
226
|
...(uiDesign === null ? { uiDesign: null } : uiDesign ? { uiDesign } : {}),
|
|
@@ -211,6 +229,8 @@ function parseSchema2SessionState(value: unknown): Schema2SessionState | undefin
|
|
|
211
229
|
|
|
212
230
|
function parseSchema3SessionState(value: unknown): SessionDelegateState | undefined {
|
|
213
231
|
if (!hasValidEnvelope(value, CURRENT_SCHEMA_VERSION)) return undefined;
|
|
232
|
+
const intensity = value.intensity;
|
|
233
|
+
if (intensity !== undefined && !isIntensity(intensity)) return undefined;
|
|
214
234
|
const parseOrdinary = (setting: unknown): OrdinaryRoleSetting | undefined =>
|
|
215
235
|
setting === null ? null : parseModelRef(setting);
|
|
216
236
|
const small = value.small === undefined ? undefined : parseOrdinary(value.small);
|
|
@@ -229,7 +249,7 @@ function parseSchema3SessionState(value: unknown): SessionDelegateState | undefi
|
|
|
229
249
|
return undefined;
|
|
230
250
|
return {
|
|
231
251
|
schemaVersion: CURRENT_SCHEMA_VERSION,
|
|
232
|
-
...(
|
|
252
|
+
...(intensity ? { intensity } : {}),
|
|
233
253
|
...(value.preference ? { preference: value.preference as Preference } : {}),
|
|
234
254
|
...(small !== undefined ? { small } : {}),
|
|
235
255
|
...(medium !== undefined ? { medium } : {}),
|
|
@@ -241,7 +261,7 @@ function parseSchema3SessionState(value: unknown): SessionDelegateState | undefi
|
|
|
241
261
|
function migrateSchema2SessionState(value: Schema2SessionState): SessionDelegateState {
|
|
242
262
|
return {
|
|
243
263
|
schemaVersion: CURRENT_SCHEMA_VERSION,
|
|
244
|
-
...(value.intensity ? { intensity: value.intensity
|
|
264
|
+
...(value.intensity ? { intensity: value.intensity } : {}),
|
|
245
265
|
...(value.preference ? { preference: value.preference as Preference } : {}),
|
|
246
266
|
...(value.small ? { small: { ...value.small } } : {}),
|
|
247
267
|
...(value.medium ? { medium: { ...value.medium } } : {}),
|
package/src/delegate-panel.ts
CHANGED
|
@@ -445,7 +445,8 @@ export class DelegatePanel implements Component, Focusable {
|
|
|
445
445
|
effective.intensity !== "off" && this.hasRuntimeError
|
|
446
446
|
? ["D:ERR · policy unavailable; fix the reported role diagnostics"]
|
|
447
447
|
: buildPolicyPreview(effective);
|
|
448
|
-
const maximum =
|
|
448
|
+
const maximum =
|
|
449
|
+
width >= 60 && budget >= 8 ? (effective.intensity === "orchestrator" ? 5 : 4) : 2;
|
|
449
450
|
return ["Effective policy preview", ...lines]
|
|
450
451
|
.slice(0, maximum)
|
|
451
452
|
.map((line) => truncateToWidth(this.theme.fg("dim", line), width, ""));
|
|
@@ -492,6 +493,7 @@ export class DelegatePanel implements Component, Focusable {
|
|
|
492
493
|
off: "No policy is injected.",
|
|
493
494
|
normal: "Delegate when the expected benefit clearly outweighs overhead.",
|
|
494
495
|
aggressive: "Delegate suitable substantial work by default.",
|
|
496
|
+
orchestrator: "Delegate transferable detail and keep ownership with the main agent.",
|
|
495
497
|
}
|
|
496
498
|
: {
|
|
497
499
|
efficient: "Tie-break comparable fits toward Small.",
|
package/src/index.ts
CHANGED
|
@@ -136,7 +136,10 @@ export default function piDelegationPolicy(pi: ExtensionAPI): void {
|
|
|
136
136
|
await setSessionIntensity(pi, ctx, action.intensity);
|
|
137
137
|
return;
|
|
138
138
|
}
|
|
139
|
-
ctx.ui.notify(
|
|
139
|
+
ctx.ui.notify(
|
|
140
|
+
"Usage: /delegate, /delegate off|normal|aggressive|orchestrator|status|reset",
|
|
141
|
+
"error",
|
|
142
|
+
);
|
|
140
143
|
},
|
|
141
144
|
});
|
|
142
145
|
|
package/src/prompt.ts
CHANGED
|
@@ -10,6 +10,8 @@ const NORMAL_POLICY =
|
|
|
10
10
|
"Delegate substantial, separable work only when the expected benefit clearly outweighs briefing, supervision, review, and integration cost. Count parallelism as a benefit only when valuable work can advance now or elapsed time matters. A merely possible fresh perspective is not enough by itself. Keep borderline work with the main agent.";
|
|
11
11
|
const AGGRESSIVE_POLICY =
|
|
12
12
|
"Default to delegating substantial, separable, independently checkable work with a clear objective and acceptance criteria. Delegate when the benefit is plausible even if not proven, including a useful independent perspective. Keep work with the main agent when it is poorly bounded, tightly coupled, dominated by integration or final accountability, or has clearly prohibitive delegation overhead.";
|
|
13
|
+
const ORCHESTRATOR_POLICY =
|
|
14
|
+
"Minimize the main agent's execution and generated narration without surrendering ownership. Delegate research, detailed planning, implementation, testing, detailed writing, review, and integration mechanics when the work is transferable and a capable enabled role can satisfy the objective, acceptance, and evidence. Batch small independent work when doing so reduces launches and duplicated context, request minimal briefs and results with file references and evidence, and do not duplicate inspection unless there is a concrete gap, risk, or contradiction. Keep objectives, critical decisions, coordination, integration responsibility, requested detail, safety, and final acceptance with the main agent. Delegate detailed review and integration mechanics when transferable; final acceptance does not require the main agent to execute every detail. Keep narration and final text concise, but never omit risks, evidence, safety, or requested detail. Do not promise savings or force recursive fanout. Do work directly, regardless of size, when it is not transferable, no enabled role can satisfy it, or transfer and context costs exceed doing it here.";
|
|
13
15
|
|
|
14
16
|
const ROLE_SELECTION_POLICY = `Choose the role by task fit before considering model preference:
|
|
15
17
|
- demand: execute, search, plan, decide, coordinate, or unblock;
|
|
@@ -24,9 +26,12 @@ Use Medium directly when the combined task fit materially requires planning, red
|
|
|
24
26
|
|
|
25
27
|
When Small and Medium are enabled alternatives, use Large only to unblock genuinely stuck work: persistent failures, severe framework conflicts, contradictory hypotheses, or reliable prior evidence that ordinary roles have not produced a trustworthy answer. Do not require ceremonial failed attempts. Large remains exceptional in a complete ordinary-role configuration.
|
|
26
28
|
|
|
27
|
-
A more capable enabled role may cover work normally suited to a disabled role only when it can satisfy the same acceptance and evidence. Never choose a less capable role merely because it is the only enabled role. Large quantities of repetitive, independent work favor multiple Small delegations; volume alone does not justify Medium or Large. Agent type does not determine the model role. Apply preference only when Small and Medium are comparably credible fits. That tie-break applies only when both are enabled
|
|
29
|
+
A more capable enabled role may cover work normally suited to a disabled role only when it can satisfy the same acceptance and evidence. Never choose a less capable role merely because it is the only enabled role. Large quantities of repetitive, independent work favor multiple Small delegations; volume alone does not justify Medium or Large. Agent type does not determine the model role. Apply preference only when Small and Medium are comparably credible fits. That tie-break applies only when both are enabled.`;
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
const LEGACY_OWNERSHIP_POLICY =
|
|
32
|
+
"In every intensity, keep global strategy, coordination, integration, final review, and work whose essential context is too costly or risky to transfer with the main agent.";
|
|
33
|
+
const ORCHESTRATOR_OWNERSHIP_POLICY =
|
|
34
|
+
"In orchestrator, keep global strategy, objectives, critical decisions, coordination, integration responsibility, requested evidence, safety, and final acceptance with the main agent. Detailed review and integration mechanics may be delegated when transferable; retaining final responsibility does not require executing every detail.";
|
|
30
35
|
|
|
31
36
|
const VISUAL_DESIGN_POLICY = `Visual Design is an optional specialist role. Use it only when all four conditions hold:
|
|
32
37
|
1. the primary acceptance criterion is a visual or user-experience result;
|
|
@@ -118,6 +123,9 @@ export function buildPolicyPreview(effective: EffectiveDelegateState): string[]
|
|
|
118
123
|
`${effective.intensity} · task fit first · ${preferencePreview(effective.preference, enabled)}`,
|
|
119
124
|
`Enabled: ${enabled.map(roleName).join(", ")}${disabled.length ? ` · Disabled: ${disabled.map(roleName).join(", ")}` : ""}`,
|
|
120
125
|
`${references} · exact model plus per-task thinking required; neither uses an ambient default.`,
|
|
126
|
+
...(effective.intensity === "orchestrator"
|
|
127
|
+
? ["Batch transferable detail; main agent keeps ownership and final acceptance."]
|
|
128
|
+
: []),
|
|
121
129
|
];
|
|
122
130
|
}
|
|
123
131
|
|
|
@@ -128,7 +136,16 @@ export function buildDelegationPolicy(state: RuntimeState): string | undefined {
|
|
|
128
136
|
const { enabled, disabled } = rolesByState(effective);
|
|
129
137
|
if (enabled.length === 0) return undefined;
|
|
130
138
|
|
|
131
|
-
const intensityPolicy =
|
|
139
|
+
const intensityPolicy =
|
|
140
|
+
effective.intensity === "normal"
|
|
141
|
+
? NORMAL_POLICY
|
|
142
|
+
: effective.intensity === "aggressive"
|
|
143
|
+
? AGGRESSIVE_POLICY
|
|
144
|
+
: ORCHESTRATOR_POLICY;
|
|
145
|
+
const ownershipPolicy =
|
|
146
|
+
effective.intensity === "orchestrator"
|
|
147
|
+
? ORCHESTRATOR_OWNERSHIP_POLICY
|
|
148
|
+
: LEGACY_OWNERSHIP_POLICY;
|
|
132
149
|
const uiDesign = effective.uiDesign
|
|
133
150
|
? `\n- Visual Design: ${formatReference(effective.uiDesign)}; exact model base: ${formatLaunchModel(effective.uiDesign)}; pi-subagents form: ${formatThinkingLaunchModel(effective.uiDesign)}`
|
|
134
151
|
: "";
|
|
@@ -145,6 +162,8 @@ ${intensityPolicy}
|
|
|
145
162
|
|
|
146
163
|
${ROLE_SELECTION_POLICY}
|
|
147
164
|
|
|
165
|
+
${ownershipPolicy}
|
|
166
|
+
|
|
148
167
|
Enabled ordinary roles: ${enabled.map(roleName).join(", ")}.${disabled.length ? `\nDisabled ordinary roles: ${disabled.map(roleName).join(", ")}.` : ""}
|
|
149
168
|
|
|
150
169
|
Model preference: ${effective.preference}. ${preferenceGuidance(effective.preference, enabled)}
|
package/src/runtime.ts
CHANGED
|
@@ -160,7 +160,12 @@ export function hasRuntimeError(state: RuntimeState): boolean {
|
|
|
160
160
|
export function statusLabel(state: RuntimeState): string {
|
|
161
161
|
if (state.effective.intensity === "off") return "D:OFF";
|
|
162
162
|
if (hasRuntimeError(state)) return "D:ERR";
|
|
163
|
-
|
|
163
|
+
const labels = {
|
|
164
|
+
normal: "D:NORM",
|
|
165
|
+
aggressive: "D:AGG",
|
|
166
|
+
orchestrator: "D:ORCH",
|
|
167
|
+
} as const;
|
|
168
|
+
return labels[state.effective.intensity];
|
|
164
169
|
}
|
|
165
170
|
|
|
166
171
|
export function formatModelRef(reference: ModelRef | null | undefined): string {
|
package/src/types.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Api, Model } from "@earendil-works/pi-ai";
|
|
|
2
2
|
|
|
3
3
|
export const CURRENT_SCHEMA_VERSION = 3 as const;
|
|
4
4
|
|
|
5
|
-
export const INTENSITIES = ["off", "normal", "aggressive"] as const;
|
|
5
|
+
export const INTENSITIES = ["off", "normal", "aggressive", "orchestrator"] as const;
|
|
6
6
|
export type Intensity = (typeof INTENSITIES)[number];
|
|
7
7
|
|
|
8
8
|
export const PREFERENCES = ["efficient", "standard", "intensive"] as const;
|
package/src/ui.ts
CHANGED
|
@@ -13,7 +13,7 @@ export async function openDelegateEditor(ctx: ExtensionContext, pi: ExtensionAPI
|
|
|
13
13
|
if (!ctx.hasUI) return;
|
|
14
14
|
if (ctx.mode !== "tui") {
|
|
15
15
|
ctx.ui.notify(
|
|
16
|
-
"The delegation editor requires TUI mode. Use /delegate off, normal, aggressive, status, or reset here.",
|
|
16
|
+
"The delegation editor requires TUI mode. Use /delegate off, normal, aggressive, orchestrator, status, or reset here.",
|
|
17
17
|
"warning",
|
|
18
18
|
);
|
|
19
19
|
return;
|