@cr1ms0n/pi-subagent 0.8.8 → 0.8.9

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/src/extension.ts CHANGED
@@ -22,15 +22,9 @@ import {
22
22
  import { createGetPiCommand, getLaunchResolution } from "./launch.js";
23
23
  import { abortAsPromise } from "./maintenance.js";
24
24
  import { sweepSessionsLifecycle } from "./distill.js";
25
- import { runTasksWithContextPolicy } from "./orchestrator.js";
25
+ import { runTasks } from "./orchestrator.js";
26
26
  import { OutputManager } from "./output.js";
27
- import {
28
- CONTEXT_MANAGEMENT_TOOL_NAMES,
29
- readContextManagementPolicy,
30
- synthesisToolsForModel,
31
- type ContextManagementPolicy,
32
- } from "./context-policy.js";
33
- import { parseDepth, parseSpawnPolicy, SPAWNS_ENV_VAR, validateSubagentRequest, type ResolvedTask } from "./policy.js";
27
+ import { CONTEXT_MANAGEMENT_TOOLS, parseDepth, parseSpawnPolicy, SPAWNS_ENV_VAR, validateSubagentRequest, type ResolvedTask } from "./policy.js";
34
28
  import type { ChildRunner } from "./runner.js";
35
29
  import { ProcessLockManager } from "./process-lock.js";
36
30
  import { SessionScopedRunRegistry, snapshotFromLiveRun } from "./registry.js";
@@ -529,13 +523,7 @@ async function runSynthesis(
529
523
  runtime: SessionRuntime,
530
524
  instruction: string,
531
525
  results: TaskResult[],
532
- options: {
533
- runId: string;
534
- modelPolicy: ModelPolicySnapshot;
535
- contextPolicy: ContextManagementPolicy;
536
- parentContextTools: readonly string[];
537
- signal: AbortSignal;
538
- },
526
+ options: { runId: string; modelPolicy: ModelPolicySnapshot; signal: AbortSignal },
539
527
  ): Promise<TaskResult | undefined> {
540
528
  const sections = results.map((result, index) => {
541
529
  // Typed handoff: validated structured results feed the synthesis child
@@ -582,9 +570,7 @@ async function runSynthesis(
582
570
  label: "synthesis",
583
571
  profile: "review",
584
572
  canWrite: false,
585
- // Same exact target-model gate as ordinary children: a disallowed
586
- // synthesis model receives no context-manager tools at all.
587
- tools: synthesisToolsForModel(options.contextPolicy, approved.route.model, options.parentContextTools),
573
+ tools: ["read", ...CONTEXT_MANAGEMENT_TOOLS],
588
574
  model: approved.route.model,
589
575
  fallbackModels: [...approved.route.fallbackModels],
590
576
  thinking: approved.route.thinking ?? "low",
@@ -990,19 +976,12 @@ export default function registerSubagent(pi: ExtensionAPI): void {
990
976
  // restarting the parent session; no provider catalog or credentials are
991
977
  // loaded by this path.
992
978
  const dispatchConfig = loadConfig(await readConfigFile());
993
- // One Remote Context snapshot per dispatch: the same operator-owned
994
- // gateway allowlist gates initial validation, every fallback attempt,
995
- // and the internally constructed synthesis child. Missing/invalid/off
996
- // toolkit configuration fails closed to an empty allowlist.
997
- const contextPolicy = await readContextManagementPolicy();
998
- const parentToolNames = pi.getAllTools().map((tool) => tool.name);
999
- const parentContextTools = CONTEXT_MANAGEMENT_TOOL_NAMES.filter((tool) => parentToolNames.includes(tool));
1000
979
  const model = ctx.model;
1001
980
  const validated = validateSubagentRequest(params, {
1002
981
  cwd: ctx.cwd,
1003
982
  model: model ? `${model.provider}/${model.id}` : undefined,
1004
983
  thinking: pi.getThinkingLevel() as TaskSpec["thinking"],
1005
- availableTools: parentToolNames,
984
+ availableTools: pi.getAllTools().map((tool) => tool.name),
1006
985
  activeTools: pi.getActiveTools(),
1007
986
  depth: parseDepth(),
1008
987
  sessionFile: ctx.sessionManager.getSessionFile() ?? undefined,
@@ -1014,7 +993,6 @@ export default function registerSubagent(pi: ExtensionAPI): void {
1014
993
  agents: agentCatalog(runtime),
1015
994
  modelPolicy: dispatchConfig.modelPolicy,
1016
995
  modelPolicyError: dispatchConfig.modelPolicyError,
1017
- contextPolicy,
1018
996
  });
1019
997
  if (!validated.ok) fail(validated.error);
1020
998
 
@@ -1196,7 +1174,6 @@ export default function registerSubagent(pi: ExtensionAPI): void {
1196
1174
  }
1197
1175
 
1198
1176
  const specs: TaskSpec[] = validated.tasks.map((task: ResolvedTask) => ({
1199
- backend: task.backend,
1200
1177
  task: task.task,
1201
1178
  label: task.label,
1202
1179
  systemPrompt: task.systemPrompt,
@@ -1285,7 +1262,7 @@ export default function registerSubagent(pi: ExtensionAPI): void {
1285
1262
 
1286
1263
  const work = (async () => {
1287
1264
  try {
1288
- const result = await runTasksWithContextPolicy(specs, {
1265
+ const result = await runTasks(specs, {
1289
1266
  semaphore: runtime.semaphore,
1290
1267
  getPiCommand: runtime.getPiCommand,
1291
1268
  sessionDir: runtime.config.sessionDir,
@@ -1299,8 +1276,6 @@ export default function registerSubagent(pi: ExtensionAPI): void {
1299
1276
  stallAfterMs: runtime.config.stallAfterMs,
1300
1277
  stallKillAfterMs: runtime.config.stallKillAfterMs,
1301
1278
  maxRetries: runtime.config.maxRetries,
1302
- contextPolicy,
1303
- parentContextTools,
1304
1279
  onRunnerCreated: (index, runner) => {
1305
1280
  let runners = runtime.liveRunners.get(runId);
1306
1281
  if (!runners) runtime.liveRunners.set(runId, (runners = new Map()));
@@ -1347,8 +1322,6 @@ export default function registerSubagent(pi: ExtensionAPI): void {
1347
1322
  const synthesized = await runSynthesis(runtime, validated.synthesis, result.results, {
1348
1323
  runId,
1349
1324
  modelPolicy: dispatchConfig.modelPolicy!,
1350
- contextPolicy,
1351
- parentContextTools,
1352
1325
  signal: controller.signal,
1353
1326
  });
1354
1327
  if (synthesized) result.results = [synthesized, ...result.results];