@ian-pascoe/pi-advisor 0.3.4 → 0.3.5

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/README.md CHANGED
@@ -54,7 +54,7 @@ Consultation authorizes analysis and investigation, not implementation or other
54
54
  | Findings per Review | 4 |
55
55
  | Automatic Corrective Turns | 1 per request/task |
56
56
 
57
- A Tool Grant names tools; it does not sandbox their full native interfaces. Explicitly granting `lsp`, for example, permits its native operations, including mutations. Unavailable names are ignored and reported. Advisor never autogrants missing tools. Granting `codemode` lets the Advisor script its other granted tools; it inherits the observed `codemode.mode`, so under `"only"` the Advisor calls `advisor_report` from a script.
57
+ A Tool Grant names tools; it does not sandbox their full native interfaces. Explicitly granting `lsp`, for example, permits its native operations, including mutations. Unavailable names are ignored and reported. Advisor never autogrants missing tools. Granting `codemode` lets the Advisor script its other granted tools; it inherits the observed `codemode.mode`, so under `"only"` the Advisor calls `advisor_report` from a script. It also inherits whether scripts get the `models` API: Minimal Subagents Child Agents have none, so neither do their Advisors.
58
58
 
59
59
  The Advisor inherits each observed agent's model and thinking level independently unless configured otherwise. One root policy can cover current and future Minimal Subagents descendants when enabled.
60
60
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ian-pascoe/pi-advisor",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "private": false,
5
5
  "description": "Background review and attributed corrective advice for Pi agent sessions.",
6
6
  "keywords": [
@@ -31,6 +31,8 @@ export interface AdvisorResourceInputs {
31
31
  readonly hidden?: boolean | undefined;
32
32
  }[];
33
33
  flagValues: ReadonlyMap<string, boolean | string>;
34
+ /** Whether the owner's built-in codemode gives scripts the `models` API; Pi's default is true. */
35
+ codemodeModels?: boolean | undefined;
34
36
  }
35
37
 
36
38
  /** Fresh factories and native services; the observed session supplies data, never bound handlers. */
@@ -228,9 +230,13 @@ async function buildAdvisorSession(
228
230
  `Unsupported Advisor resources: this Pi runtime does not export ${factoryExport} to recreate ${extension.path}`,
229
231
  );
230
232
  recreated.add(index);
233
+ const codemodeModels = options.resourceInputs?.codemodeModels;
231
234
  builtins.push({
232
235
  name,
233
- factory: create(),
236
+ factory:
237
+ name === "codemode" && codemodeModels !== undefined
238
+ ? piSdk.createCodemodeExtension({ models: codemodeModels })
239
+ : create(),
234
240
  builtin: true,
235
241
  replaceable: extension.replaceable === true,
236
242
  });
package/src/index.ts CHANGED
@@ -40,6 +40,7 @@ const childRequestSchema = Type.Object({
40
40
  agentDir: Type.String({ minLength: 1 }),
41
41
  extensions: Type.Array(Type.Unknown()),
42
42
  flagValues: Type.Unknown(),
43
+ codemodeModels: Type.Optional(Type.Boolean()),
43
44
  }),
44
45
  });
45
46
 
@@ -246,6 +247,7 @@ export default function advisor(pi: ExtensionAPI): void {
246
247
  agentDir: payload.resourceInputs.agentDir,
247
248
  extensions,
248
249
  flagValues: new Map(resources.runtime.flagValues),
250
+ codemodeModels: payload.resourceInputs.codemodeModels,
249
251
  },
250
252
  observer: undefined,
251
253
  };