@tintinweb/pi-subagents 0.8.0 → 0.9.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 +25 -0
- package/README.md +22 -1
- package/dist/default-agents.js +3 -3
- package/dist/enabled-models.d.ts +49 -0
- package/dist/enabled-models.js +145 -0
- package/dist/index.js +224 -84
- package/dist/settings.d.ts +23 -0
- package/dist/settings.js +5 -0
- package/package.json +1 -1
- package/src/default-agents.ts +3 -3
- package/src/enabled-models.ts +180 -0
- package/src/index.ts +247 -85
- package/src/settings.ts +27 -0
package/src/settings.ts
CHANGED
|
@@ -26,6 +26,28 @@ export interface SubagentsSettings {
|
|
|
26
26
|
* (next pi session); runtime menu/runtime-fire short-circuit is immediate.
|
|
27
27
|
*/
|
|
28
28
|
schedulingEnabled?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* When true, the effective model of each subagent spawn is validated
|
|
31
|
+
* against `enabledModels` from pi's settings — both global
|
|
32
|
+
* (`<agentDir>/settings.json`) and project-local (`<cwd>/.pi/settings.json`),
|
|
33
|
+
* with project overriding global (mirrors pi's SettingsManager deep-merge).
|
|
34
|
+
*
|
|
35
|
+
* scopeModels guards against runtime LLM choices, not user-level config.
|
|
36
|
+
* Out-of-scope handling reflects this:
|
|
37
|
+
* - Caller-supplied via `Agent({ model: "..." })` (only when frontmatter
|
|
38
|
+
* has no `model:`, since frontmatter is authoritative): hard error
|
|
39
|
+
* returned to the orchestrator, listing the allowed models. The LLM
|
|
40
|
+
* made an explicit out-of-scope choice and gets explicit feedback.
|
|
41
|
+
* - Frontmatter-pinned: warning toast + the pinned model runs. The
|
|
42
|
+
* agent's author/installer chose this; trust it.
|
|
43
|
+
* - Parent-inherited (neither caller nor frontmatter sets a model):
|
|
44
|
+
* warning toast + parent's model runs. The user chose the parent's
|
|
45
|
+
* model when starting the session; trust it.
|
|
46
|
+
*
|
|
47
|
+
* No-op when pi's `enabledModels` is empty or absent — nothing to validate
|
|
48
|
+
* against. Defaults to false: subagents may use any model.
|
|
49
|
+
*/
|
|
50
|
+
scopeModels?: boolean;
|
|
29
51
|
}
|
|
30
52
|
|
|
31
53
|
/** Setter hooks used by applySettings to wire persisted values into in-memory state. */
|
|
@@ -35,6 +57,7 @@ export interface SettingsAppliers {
|
|
|
35
57
|
setGraceTurns: (n: number) => void;
|
|
36
58
|
setDefaultJoinMode: (mode: JoinMode) => void;
|
|
37
59
|
setSchedulingEnabled: (b: boolean) => void;
|
|
60
|
+
setScopeModels: (enabled: boolean) => void;
|
|
38
61
|
}
|
|
39
62
|
|
|
40
63
|
/** Emit callback — a subset of `pi.events.emit` to keep helpers testable. */
|
|
@@ -81,6 +104,9 @@ function sanitize(raw: unknown): SubagentsSettings {
|
|
|
81
104
|
if (typeof r.schedulingEnabled === "boolean") {
|
|
82
105
|
out.schedulingEnabled = r.schedulingEnabled;
|
|
83
106
|
}
|
|
107
|
+
if (typeof r.scopeModels === "boolean") {
|
|
108
|
+
out.scopeModels = r.scopeModels;
|
|
109
|
+
}
|
|
84
110
|
return out;
|
|
85
111
|
}
|
|
86
112
|
|
|
@@ -136,6 +162,7 @@ export function applySettings(s: SubagentsSettings, appliers: SettingsAppliers):
|
|
|
136
162
|
if (typeof s.graceTurns === "number") appliers.setGraceTurns(s.graceTurns);
|
|
137
163
|
if (s.defaultJoinMode) appliers.setDefaultJoinMode(s.defaultJoinMode);
|
|
138
164
|
if (typeof s.schedulingEnabled === "boolean") appliers.setSchedulingEnabled(s.schedulingEnabled);
|
|
165
|
+
if (typeof s.scopeModels === "boolean") appliers.setScopeModels(s.scopeModels);
|
|
139
166
|
}
|
|
140
167
|
|
|
141
168
|
/**
|