@xzzpig/pi-subagents 0.24.0 → 0.24.2

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/bundle/{chunk-UFNSLL5D.js → chunk-224WMDIV.js} +86 -10
  3. package/bundle/{chunk-7K3Z6DM7.js → chunk-4UH4WS4G.js} +4 -4
  4. package/bundle/{chunk-KD2IMFN4.js → chunk-BQ2OAB4Q.js} +1 -1
  5. package/bundle/{chunk-F3NSN7UH.js → chunk-CYY5UMJU.js} +9 -4
  6. package/bundle/{chunk-LPVUHUZ7.js → chunk-EUPJB4S7.js} +1 -1
  7. package/bundle/{chunk-T65XRVVM.js → chunk-FG6SQJAR.js} +2 -2
  8. package/bundle/{chunk-MYCL5QEJ.js → chunk-JEA2ZKUA.js} +2 -2
  9. package/bundle/{chunk-RK2HDPLK.js → chunk-LVWU2HOO.js} +1 -1
  10. package/bundle/{chunk-OTLRAB22.js → chunk-O4D5PBVI.js} +3 -3
  11. package/bundle/{chunk-NCWCVJLT.js → chunk-RU522D5W.js} +4 -4
  12. package/bundle/{chunk-3G4JXNZ4.js → chunk-TMHVDPYW.js} +2 -0
  13. package/bundle/{chunk-NTRJDXBC.js → chunk-X6LOM3Z4.js} +2 -2
  14. package/bundle/{chunk-OFGSZBHP.js → chunk-XWWUDWUW.js} +14 -6
  15. package/bundle/index.js +1 -1
  16. package/docs/goal-auto-continuation-gate.md +26 -0
  17. package/node_modules/@xzzpig/pi-components/CHANGELOG.md +12 -0
  18. package/node_modules/@xzzpig/pi-components/README.md +94 -0
  19. package/node_modules/@xzzpig/pi-components/dist/src/transcript-presenter.d.ts +186 -0
  20. package/node_modules/@xzzpig/pi-components/dist/src/transcript-presenter.js +693 -0
  21. package/node_modules/@xzzpig/pi-components/package.json +5 -1
  22. package/package.json +3 -3
  23. package/src/extension/index.js +12 -0
  24. package/src/goal-auto-continue-gate.d.ts +17 -0
  25. package/src/goal-auto-continue-gate.js +61 -0
  26. package/src/goal-auto-continue-state.d.ts +22 -0
  27. package/src/goal-auto-continue-state.js +20 -0
  28. package/src/runs/background/async-execution.d.ts +3 -1
  29. package/src/runs/background/async-execution.js +4 -0
  30. package/src/runs/background/async-job-tracker.js +5 -0
  31. package/src/runs/background/async-status.d.ts +2 -0
  32. package/src/runs/background/async-status.js +2 -0
  33. package/src/runs/background/notify.d.ts +2 -0
  34. package/src/runs/background/notify.js +5 -0
  35. package/src/runs/foreground/subagent-executor.js +4 -0
  36. package/src/shared/types.d.ts +2 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.24.2] - 2026-11-01 (fork)
4
+
5
+ ### 维护
6
+
7
+ - 同步内嵌共享库依赖至 pi-components 0.5.0;fleet 继续使用既有无状态渲染入口,不隐式启用新的有状态展示策略。
8
+
9
+ ## [0.24.1] - 2026-10-31 (fork)
10
+
11
+ ### Fixed
12
+
13
+ - Coordinate goal auto-continuation with current-session async, workflow and
14
+ detached foreground runs while their native parent wake or result handoff is
15
+ pending. Preserve completion ownership and scheduled wake policy through
16
+ live and restored job projections without intercepting native notifications.
17
+
3
18
  ## [0.24.0] - 2026-10-30 (fork)
4
19
 
5
20
  ### Security
@@ -11,10 +11,10 @@ import {
11
11
  setInlineWorkflowCoverage,
12
12
  setMainThinkingLevelSource,
13
13
  widgetRenderKey
14
- } from "./chunk-NTRJDXBC.js";
14
+ } from "./chunk-X6LOM3Z4.js";
15
15
  import {
16
16
  package_default
17
- } from "./chunk-OTLRAB22.js";
17
+ } from "./chunk-O4D5PBVI.js";
18
18
  import {
19
19
  EXTERNAL_JOB_BRIDGE_REQUEST_DIR,
20
20
  REVIVAL_ORIGIN_FILE,
@@ -59,11 +59,12 @@ import {
59
59
  resumedRunStarted,
60
60
  runtimeReplacedAbortReason,
61
61
  sameProviderDiagnostics,
62
+ scheduledCompletionTriggersTurn,
62
63
  serviceExternalJobBridgeRequests,
63
64
  snapshotProviderDiagnostics,
64
65
  workflowResumeClaimState,
65
66
  workflowResumeRefusal
66
- } from "./chunk-F3NSN7UH.js";
67
+ } from "./chunk-CYY5UMJU.js";
67
68
  import {
68
69
  listHerdrProjectPaneRoots,
69
70
  restoreHerdrProjectPaneSnapshots
@@ -95,14 +96,14 @@ import {
95
96
  resolveWaitToolConfig,
96
97
  setDeclarationPinning,
97
98
  topLevelSupervisorTool
98
- } from "./chunk-LPVUHUZ7.js";
99
+ } from "./chunk-EUPJB4S7.js";
99
100
  import {
100
101
  deliverAsyncRunStop,
101
102
  ownerConfirmedDead,
102
103
  readSessionMessagesTail,
103
104
  resolveSubagentRunId,
104
105
  restoreForegroundRunHistory
105
- } from "./chunk-RK2HDPLK.js";
106
+ } from "./chunk-LVWU2HOO.js";
106
107
  import "./chunk-7J4ZXMY7.js";
107
108
  import {
108
109
  ASYNC_STATUS_SNAPSHOT_KIND,
@@ -125,7 +126,7 @@ import {
125
126
  resolveAsyncStatusChild,
126
127
  stopStoppableAsyncStatusChildren,
127
128
  withCachedUiContext
128
- } from "./chunk-3G4JXNZ4.js";
129
+ } from "./chunk-TMHVDPYW.js";
129
130
  import "./chunk-FJWI64H7.js";
130
131
  import {
131
132
  disabledFeatureUseError,
@@ -880,6 +881,7 @@ function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
880
881
  toolCallId: run.toolCallId,
881
882
  status: run.state,
882
883
  sessionId: run.sessionId,
884
+ completionOwnerId: run.completionOwnerId,
883
885
  activityState: run.activityState,
884
886
  lastActivityAt: run.lastActivityAt,
885
887
  currentTool: run.currentTool,
@@ -889,6 +891,7 @@ function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
889
891
  toolCount: run.toolCount,
890
892
  steering: run.steering,
891
893
  mode: run.mode,
894
+ scheduleOrigin: run.scheduleOrigin,
892
895
  context: run.context,
893
896
  cwd: run.cwd,
894
897
  sessionRoot: run.sessionRoot,
@@ -1200,6 +1203,7 @@ function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
1200
1203
  else runningJobIds.delete(job.asyncId);
1201
1204
  if (!isTerminalJobStatus(job.status)) cancelCleanup(job.asyncId);
1202
1205
  job.sessionId = status.sessionId ?? job.sessionId;
1206
+ job.completionOwnerId = status.completionOwnerId ?? job.completionOwnerId;
1203
1207
  job.activityState = status.activityState;
1204
1208
  job.lastActivityAt = status.lastActivityAt ?? job.lastActivityAt;
1205
1209
  job.currentTool = status.currentTool;
@@ -1209,6 +1213,7 @@ function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
1209
1213
  job.toolCount = status.toolCount ?? job.toolCount;
1210
1214
  job.steering = status.steering ?? job.steering;
1211
1215
  job.mode = status.mode;
1216
+ job.scheduleOrigin = status.scheduleOrigin ?? job.scheduleOrigin;
1212
1217
  job.parentWorkflowRunId = status.parentWorkflowRunId ?? job.parentWorkflowRunId;
1213
1218
  job.workflowKey = status.workflowKey ?? job.workflowKey;
1214
1219
  job.lane = status.lane ?? job.lane;
@@ -1445,6 +1450,7 @@ function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
1445
1450
  ...typeof info.sessionId === "string" ? { sessionId: info.sessionId } : {},
1446
1451
  ...typeof info.completionOwnerId === "string" ? { completionOwnerId: info.completionOwnerId } : {},
1447
1452
  mode: info.mode ?? (info.chain ? "chain" : "single"),
1453
+ scheduleOrigin: info.scheduleOrigin,
1448
1454
  description: info.goal ?? info.task,
1449
1455
  agents,
1450
1456
  chainStepCount: info.chainStepCount,
@@ -5558,7 +5564,7 @@ function registerSlashCommands(pi, state, options = {}) {
5558
5564
  }
5559
5565
  fleetOpen = true;
5560
5566
  try {
5561
- const { openSubagentFleet } = await import("./chunk-NCWCVJLT.js");
5567
+ const { openSubagentFleet } = await import("./chunk-RU522D5W.js");
5562
5568
  await openSubagentFleet(ctx, state, { asyncDirRoot: DIRS.async, inspectorPlugins: () => getInspectorPlugins(pi), resultsDir: DIRS.results, fleetKeybindings: options.fleetKeybindings, events: pi.events });
5563
5569
  } finally {
5564
5570
  fleetOpen = false;
@@ -8300,6 +8306,64 @@ function buildActiveRunsSection(jobs, sessionId) {
8300
8306
  ].join("\n");
8301
8307
  }
8302
8308
 
8309
+ // src/goal-auto-continue-state.ts
8310
+ function hasGoalAutoContinueWakeWork(state, requestSessionId, queries) {
8311
+ if (!requestSessionId || state.supervisorOwnerSessionId !== requestSessionId) return false;
8312
+ for (const job of state.asyncJobs.values()) {
8313
+ if ((job.status === "queued" || job.status === "running") && job.scheduleOrigin?.quiet !== true && queries.ownsAsyncRun(job)) return true;
8314
+ }
8315
+ for (const control of state.foregroundControls.values()) {
8316
+ if (queries.ownsForegroundRun(control)) return true;
8317
+ }
8318
+ return queries.hasOwedResultHandoff() || queries.hasPendingNativeWake();
8319
+ }
8320
+
8321
+ // src/goal-auto-continue-gate.ts
8322
+ var GOAL_AUTO_CONTINUE_GATE_EVENT = "pi-goal:before-auto-continue:v1";
8323
+ var GOAL_AUTO_CONTINUE_GATE_VERSION = 1;
8324
+ function gateRequest(value) {
8325
+ if (!value || typeof value !== "object") return void 0;
8326
+ const candidate = value;
8327
+ if (typeof candidate.defer !== "function") return void 0;
8328
+ return candidate;
8329
+ }
8330
+ function registerGoalAutoContinueGate(pi, dependencies) {
8331
+ return pi.events.on(GOAL_AUTO_CONTINUE_GATE_EVENT, (value) => {
8332
+ const request = gateRequest(value);
8333
+ if (!request) return;
8334
+ try {
8335
+ if (request.version !== GOAL_AUTO_CONTINUE_GATE_VERSION || typeof request.sessionId !== "string" || typeof request.goalId !== "string") {
8336
+ request.defer({ owner: "pi-subagents", reason: "gate-protocol-invalid" });
8337
+ return;
8338
+ }
8339
+ const { state } = dependencies;
8340
+ if (state.supervisorOwnerSessionId !== request.sessionId) return;
8341
+ const blocked = hasGoalAutoContinueWakeWork(state, request.sessionId, {
8342
+ ownsAsyncRun: (job) => typeof job.sessionId === "string" && dependencies.ownership.owns(job.sessionId, job.completionOwnerId),
8343
+ ownsForegroundRun: (control) => typeof control.sessionId === "string" && ownsRun(state.currentSessionId, control.sessionId),
8344
+ hasOwedResultHandoff: () => {
8345
+ if (dependencies.isHeld()) return false;
8346
+ for (const runId of dependencies.owedResultRunIds) {
8347
+ const job = state.asyncJobs.get(runId);
8348
+ if (!job) return true;
8349
+ const outcome = job.status === "complete" ? "completed" : job.status;
8350
+ if (scheduledCompletionTriggersTurn(job.scheduleOrigin, outcome)) return true;
8351
+ }
8352
+ return false;
8353
+ },
8354
+ hasPendingNativeWake: () => !dependencies.isHeld() && (dependencies.notifier.hasPendingWake() || dependencies.parentWake.isPending())
8355
+ });
8356
+ if (blocked) request.defer({ owner: "pi-subagents", reason: "parent-wake-pending" });
8357
+ } catch {
8358
+ try {
8359
+ request.defer({ owner: "pi-subagents", reason: "state-unavailable" });
8360
+ } catch {
8361
+ }
8362
+ console.error("[pi-subagents] Goal auto-continuation state unavailable; deferring this send attempt.");
8363
+ }
8364
+ });
8365
+ }
8366
+
8303
8367
  // src/extension/tool-description.ts
8304
8368
  import * as fs13 from "node:fs";
8305
8369
  import * as path12 from "node:path";
@@ -8945,7 +9009,7 @@ function registerSubagentExtension(pi) {
8945
9009
  const ctx = withLastUiContext((current) => current);
8946
9010
  if (!ctx) return;
8947
9011
  try {
8948
- const { openSubagentFleet } = await import("./chunk-NCWCVJLT.js");
9012
+ const { openSubagentFleet } = await import("./chunk-RU522D5W.js");
8949
9013
  await openSubagentFleet(ctx, state, { initialKey: itemKey, asyncDirRoot: DIRS.async, resultsDir: DIRS.results, fleetKeybindings: config.fleetKeybindings, inspectorPlugins: () => getInspectorPlugins(pi), events: pi.events });
8950
9014
  } catch (error) {
8951
9015
  if (isStaleExtensionContextError(error)) {
@@ -8958,6 +9022,8 @@ function registerSubagentExtension(pi) {
8958
9022
  let goalTurnId = 0;
8959
9023
  let releaseHostSessionLiveness = () => {
8960
9024
  };
9025
+ let disposeGoalAutoContinueGate = () => {
9026
+ };
8961
9027
  const scheduledStoreRoot = config.scheduledRuns?.storeRoot === void 0 ? void 0 : resolveScheduledStoreRoot(config.scheduledRuns.storeRoot);
8962
9028
  const scheduledRunManager = createScheduledRunManager({
8963
9029
  config,
@@ -9141,7 +9207,7 @@ function registerSubagentExtension(pi) {
9141
9207
  let executor;
9142
9208
  let executorPromise;
9143
9209
  let executorModulePromise;
9144
- const loadExecutorModule = () => executorModulePromise ??= import("./chunk-OFGSZBHP.js");
9210
+ const loadExecutorModule = () => executorModulePromise ??= import("./chunk-XWWUDWUW.js");
9145
9211
  const getExecutor = () => {
9146
9212
  executorPromise ??= loadExecutorModule().then(({ createSubagentExecutor }) => {
9147
9213
  executor = createSubagentExecutor(executorDeps);
@@ -9155,7 +9221,7 @@ function registerSubagentExtension(pi) {
9155
9221
  modulePreloadTimer = setTimeout(() => {
9156
9222
  loadExecutorModule().catch(() => {
9157
9223
  });
9158
- if (fleetViewEnabled) import("./chunk-NCWCVJLT.js").catch(() => {
9224
+ if (fleetViewEnabled) import("./chunk-RU522D5W.js").catch(() => {
9159
9225
  });
9160
9226
  }, MODULE_PRELOAD_DELAY_MS);
9161
9227
  modulePreloadTimer.unref?.();
@@ -9429,6 +9495,7 @@ ${close}` }]
9429
9495
  }),
9430
9496
  pi.events.on(SUBAGENT_CONTROL_EVENT, controlEventHandler),
9431
9497
  pi.events.on(SUBAGENT_STEERING_NOTICE_EVENT, steeringNoticeHandler),
9498
+ () => disposeGoalAutoContinueGate(),
9432
9499
  herdrStatusBridge.dispose,
9433
9500
  rpcBridge.dispose
9434
9501
  ];
@@ -9741,8 +9808,17 @@ ${close}` }]
9741
9808
  startSessionMaintenance();
9742
9809
  scheduleModulePreload();
9743
9810
  const recovering = event.reason === "startup" || event.reason === "reload" || event.reason === "resume";
9811
+ disposeGoalAutoContinueGate();
9744
9812
  resetSessionState(ctx, recovering, event.previousSessionFile);
9745
9813
  refreshContextInjectionSnapshot(ctx);
9814
+ disposeGoalAutoContinueGate = registerGoalAutoContinueGate(pi, {
9815
+ state,
9816
+ ownership: resultDeliveryOwnership,
9817
+ notifier: completionNotifier,
9818
+ parentWake,
9819
+ isHeld: parentWake.isHeld,
9820
+ owedResultRunIds
9821
+ });
9746
9822
  releaseHostSessionLiveness();
9747
9823
  const sessionId = ctx.sessionManager.getSessionId();
9748
9824
  const sessionFile = ctx.sessionManager.getSessionFile();
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  rewriteSubagentPrompt
3
- } from "./chunk-T65XRVVM.js";
3
+ } from "./chunk-FG6SQJAR.js";
4
4
  import {
5
5
  package_default
6
- } from "./chunk-OTLRAB22.js";
7
- import "./chunk-LPVUHUZ7.js";
6
+ } from "./chunk-O4D5PBVI.js";
7
+ import "./chunk-EUPJB4S7.js";
8
8
  import {
9
9
  MODEL_ONLY_TOOL
10
- } from "./chunk-3G4JXNZ4.js";
10
+ } from "./chunk-TMHVDPYW.js";
11
11
  import "./chunk-FJWI64H7.js";
12
12
  import {
13
13
  appendAgentRefinementOverlay
@@ -16,7 +16,7 @@ import {
16
16
  } from "./chunk-35GII5EF.js";
17
17
  import {
18
18
  package_default
19
- } from "./chunk-OTLRAB22.js";
19
+ } from "./chunk-O4D5PBVI.js";
20
20
  import {
21
21
  HERDR_PI_MODE_ENV,
22
22
  HERDR_PI_PROTOCOL,
@@ -15,10 +15,10 @@ import {
15
15
  startWatchdogDiffBaselineCapture,
16
16
  writeUserWatchdogEnabled,
17
17
  writeWatchdogModelSettings
18
- } from "./chunk-LPVUHUZ7.js";
18
+ } from "./chunk-EUPJB4S7.js";
19
19
  import {
20
20
  resolveGitRepositoryIdentity
21
- } from "./chunk-RK2HDPLK.js";
21
+ } from "./chunk-LVWU2HOO.js";
22
22
  import {
23
23
  listAsyncRuns,
24
24
  ownsRun,
@@ -26,7 +26,7 @@ import {
26
26
  parseWorkflowChildSummary,
27
27
  readAsyncRecoveryDescriptor,
28
28
  resolveRetainedWorktreeCwd
29
- } from "./chunk-3G4JXNZ4.js";
29
+ } from "./chunk-TMHVDPYW.js";
30
30
  import {
31
31
  deepFreezeWorkflowArgs,
32
32
  normalizeWorkflowArgs
@@ -4547,6 +4547,7 @@ ${watchdogConcerns.map((warning) => `- ${warning}`).join("\n")}` : resultPreview
4547
4547
  function registerSubagentNotify(pi, state, options = {}) {
4548
4548
  const seen = /* @__PURE__ */ new Map();
4549
4549
  const pending = /* @__PURE__ */ new Map();
4550
+ const pendingWakeKeys = /* @__PURE__ */ new Set();
4550
4551
  const ttlMs = COMPLETION_SEND_TTL_MS;
4551
4552
  const now = options.now ?? Date.now;
4552
4553
  const sendRegistry = options.sendRegistry ?? processCompletionSendRegistry;
@@ -4564,6 +4565,7 @@ function registerSubagentNotify(pi, state, options = {}) {
4564
4565
  for (const item of items) {
4565
4566
  if (reason) traceNotification(reason, item.trace);
4566
4567
  pending.delete(item.key);
4568
+ pendingWakeKeys.delete(item.key);
4567
4569
  if (accepted) markSeenWithTtl(seen, item.key, now(), ttlMs);
4568
4570
  item.resolve(accepted);
4569
4571
  }
@@ -4650,6 +4652,7 @@ function registerSubagentNotify(pi, state, options = {}) {
4650
4652
  triggerTurn: result4.triggerTurn !== false && scheduledCompletionTriggersTurn(result4.scheduleOrigin, details.status),
4651
4653
  resolve: resolve4
4652
4654
  };
4655
+ if (item.triggerTurn) pendingWakeKeys.add(key);
4653
4656
  if (notificationDebug.enabled) item.trace = traceIdentity(result4);
4654
4657
  if (details.source === "foreground") {
4655
4658
  emit([item]);
@@ -4758,6 +4761,7 @@ function registerSubagentNotify(pi, state, options = {}) {
4758
4761
  return {
4759
4762
  deliver,
4760
4763
  hasPendingDelivery: () => pending.size > 0 || unstartedWakes.length > 0,
4764
+ hasPendingWake: () => !pi.isHeld() && (pendingWakeKeys.size > 0 || unstartedWakes.length > 0),
4761
4765
  messageStarted(message) {
4762
4766
  if (message.role !== "custom" || message.customType !== "subagent-notify") return;
4763
4767
  const index = unstartedWakes.indexOf(message.content);
@@ -6348,7 +6352,7 @@ function childSessionFactory() {
6348
6352
  }
6349
6353
  function createLazyPlacementFactory(local) {
6350
6354
  let placed;
6351
- const factory = async () => placed ??= (await import("./chunk-KD2IMFN4.js")).createPlacementAwareChildSessionFactory(local);
6355
+ const factory = async () => placed ??= (await import("./chunk-BQ2OAB4Q.js")).createPlacementAwareChildSessionFactory(local);
6352
6356
  return {
6353
6357
  async create(launch) {
6354
6358
  return launch.machine ? (await factory()).create(launch) : local.create(launch);
@@ -7287,6 +7291,7 @@ export {
7287
7291
  recordWorkflowResumeRefusal,
7288
7292
  refusalSentence,
7289
7293
  hasWorkflowResumeRefusal,
7294
+ scheduledCompletionTriggersTurn,
7290
7295
  incrementalChildCompletionTriggersTurn,
7291
7296
  formatIncrementalChildCompletion,
7292
7297
  parseSubagentNotifyContent,
@@ -11,7 +11,7 @@ import {
11
11
  projectTimeoutRecovery,
12
12
  readAsyncRecoveryDescriptor,
13
13
  utf8Tail
14
- } from "./chunk-3G4JXNZ4.js";
14
+ } from "./chunk-TMHVDPYW.js";
15
15
  import {
16
16
  MAX_ARGS_BYTES,
17
17
  MAX_ARGS_DEPTH,
@@ -15,12 +15,12 @@ import {
15
15
  resolveCurrentSessionId,
16
16
  resolveWatchdogReviewModel,
17
17
  startWatchdogDiffBaselineCapture
18
- } from "./chunk-LPVUHUZ7.js";
18
+ } from "./chunk-EUPJB4S7.js";
19
19
  import {
20
20
  MODEL_ONLY_TOOL,
21
21
  agentStreamOptions,
22
22
  opencodeSessionHeaders
23
- } from "./chunk-3G4JXNZ4.js";
23
+ } from "./chunk-TMHVDPYW.js";
24
24
  import {
25
25
  inheritedNestedRouteOf
26
26
  } from "./chunk-ICNYIALB.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  isTrustedRecordedSessionFile,
3
3
  resolveSubagentRunId
4
- } from "./chunk-RK2HDPLK.js";
4
+ } from "./chunk-LVWU2HOO.js";
5
5
  import {
6
6
  formatShellCommand
7
7
  } from "./chunk-7J4ZXMY7.js";
@@ -10,7 +10,7 @@ import {
10
10
  opencodeSessionHeaders,
11
11
  ownsRun,
12
12
  resolveAsyncResumeTarget
13
- } from "./chunk-3G4JXNZ4.js";
13
+ } from "./chunk-TMHVDPYW.js";
14
14
  import {
15
15
  currentCompletionOwnerId,
16
16
  listMissions,
@@ -13,7 +13,7 @@ import {
13
13
  summarizeContextModes,
14
14
  utf8Tail,
15
15
  workflowPreflightLaneForRuntimeKey
16
- } from "./chunk-3G4JXNZ4.js";
16
+ } from "./chunk-TMHVDPYW.js";
17
17
  import {
18
18
  assertSafeNestedId,
19
19
  checkRecordedPidLiveness,
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@xzzpig/pi-subagents",
4
- version: "0.24.0",
4
+ version: "0.24.2",
5
5
  description: "Pi extension for single-agent delegation and scripted multi-agent workflows",
6
6
  author: "Nico Bailon",
7
7
  license: "MIT",
@@ -28,7 +28,7 @@ var package_default = {
28
28
  },
29
29
  repository: {
30
30
  type: "git",
31
- url: "git+https://github.com/nicobailon/pi-subagents.git"
31
+ url: "git+https://github.com/xzzpig/pi-extensions.git"
32
32
  },
33
33
  homepage: "https://github.com/nicobailon/pi-subagents#readme",
34
34
  bugs: {
@@ -106,7 +106,7 @@ var package_default = {
106
106
  }
107
107
  },
108
108
  dependencies: {
109
- "@xzzpig/pi-components": "0.4.0",
109
+ "@xzzpig/pi-components": "0.5.0",
110
110
  "@js-temporal/polyfill": "0.5.1",
111
111
  acorn: "8.18.0",
112
112
  jiti: "2.7.0",
@@ -7,26 +7,26 @@ import {
7
7
  resolveWorkflowForegroundSteeringTarget,
8
8
  steerAsyncRun,
9
9
  steerWorkflowForegroundTarget
10
- } from "./chunk-MYCL5QEJ.js";
10
+ } from "./chunk-JEA2ZKUA.js";
11
11
  import {
12
12
  FLEET_STATUS_WIDGET_KEY,
13
13
  emitUiSpanSilent,
14
14
  reportFleetWarning,
15
15
  runningTone,
16
16
  stepTaskSummary
17
- } from "./chunk-NTRJDXBC.js";
17
+ } from "./chunk-X6LOM3Z4.js";
18
18
  import {
19
19
  foregroundChildStateLabel,
20
20
  formatAsyncRunTranscript,
21
21
  stopAsyncRun
22
- } from "./chunk-RK2HDPLK.js";
22
+ } from "./chunk-LVWU2HOO.js";
23
23
  import "./chunk-7J4ZXMY7.js";
24
24
  import {
25
25
  contextModeBadge,
26
26
  contextModeLabel,
27
27
  decodeUtf8Tail,
28
28
  listAsyncRuns
29
- } from "./chunk-3G4JXNZ4.js";
29
+ } from "./chunk-TMHVDPYW.js";
30
30
  import "./chunk-ICNYIALB.js";
31
31
  import {
32
32
  getArtifactPaths,
@@ -2351,6 +2351,7 @@ function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
2351
2351
  asyncDir,
2352
2352
  ...status.toolCallId ? { toolCallId: status.toolCallId } : {},
2353
2353
  ...status.sessionId ? { sessionId: status.sessionId } : {},
2354
+ ...status.completionOwnerId ? { completionOwnerId: status.completionOwnerId } : {},
2354
2355
  state: status.state,
2355
2356
  ...status.error ? { error: status.error } : {},
2356
2357
  activityState,
@@ -2362,6 +2363,7 @@ function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
2362
2363
  toolCount: status.toolCount,
2363
2364
  steering: status.steering,
2364
2365
  mode: status.mode,
2366
+ ...status.scheduleOrigin ? { scheduleOrigin: status.scheduleOrigin } : {},
2365
2367
  ...summarizeContextModes(summarizedSteps.map((step) => step.context)) ? { context: summarizeContextModes(summarizedSteps.map((step) => step.context)) } : {},
2366
2368
  ...sandbox ? { sandbox } : {},
2367
2369
  ...permissionProfile ? { permissionProfile } : {},
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  buildWorkflowChatProgressRows
3
- } from "./chunk-RK2HDPLK.js";
3
+ } from "./chunk-LVWU2HOO.js";
4
4
  import {
5
5
  aggregateStepStatus,
6
6
  contextModeBadge,
@@ -25,7 +25,7 @@ import {
25
25
  projectWorkflowChecklist,
26
26
  withCachedUiContext,
27
27
  workflowGraphStageNodes
28
- } from "./chunk-3G4JXNZ4.js";
28
+ } from "./chunk-TMHVDPYW.js";
29
29
  import {
30
30
  flatToLogicalStepIndex,
31
31
  formatWorkflowJsonPreview,
@@ -3,7 +3,7 @@ import {
3
3
  projectRuntimeAcknowledgedExtensions,
4
4
  registerSubagentPromptBoundary,
5
5
  registerSubagentPromptRuntime
6
- } from "./chunk-T65XRVVM.js";
6
+ } from "./chunk-FG6SQJAR.js";
7
7
  import {
8
8
  INSPECTOR_ACTIONS,
9
9
  canQueueRetainedAsyncFollowUp,
@@ -25,7 +25,7 @@ import {
25
25
  updateSteeringTarget,
26
26
  waitForSteeringAction,
27
27
  workflowAsyncChildSteeringGuidance
28
- } from "./chunk-MYCL5QEJ.js";
28
+ } from "./chunk-JEA2ZKUA.js";
29
29
  import {
30
30
  PLACED_RESTORE_UNSUPPORTED,
31
31
  formatHerdrMachineRunnerUnsupported,
@@ -120,7 +120,7 @@ import {
120
120
  workflowStopCause,
121
121
  writeWorkflowLaunchRecord,
122
122
  writeWorkflowReceipt
123
- } from "./chunk-F3NSN7UH.js";
123
+ } from "./chunk-CYY5UMJU.js";
124
124
  import {
125
125
  HERDR_PROJECT_PANE_ACTIONS,
126
126
  handleHerdrProjectPaneAction
@@ -140,7 +140,7 @@ import {
140
140
  resolveWatchdogConfig,
141
141
  sendRuleViolationWarning,
142
142
  writeWatchdogModelSettings
143
- } from "./chunk-LPVUHUZ7.js";
143
+ } from "./chunk-EUPJB4S7.js";
144
144
  import {
145
145
  MAX_REMEMBERED_FOREGROUND_RUNS,
146
146
  discardRunningForegroundRun,
@@ -153,7 +153,7 @@ import {
153
153
  resolveSubagentRunId,
154
154
  resolveWorkflowChatProgress,
155
155
  stopAsyncRun
156
- } from "./chunk-RK2HDPLK.js";
156
+ } from "./chunk-LVWU2HOO.js";
157
157
  import "./chunk-7J4ZXMY7.js";
158
158
  import {
159
159
  MODEL_ONLY_TOOL,
@@ -216,7 +216,7 @@ import {
216
216
  writeParallelHandoffGroup,
217
217
  writeRunFanoutBudgetDescriptor,
218
218
  writeWorktreeSetupHandoff
219
- } from "./chunk-3G4JXNZ4.js";
219
+ } from "./chunk-TMHVDPYW.js";
220
220
  import {
221
221
  authorizeWorkflowResourceHost,
222
222
  claimWorkflowChildPermit,
@@ -2887,6 +2887,7 @@ function executeAsyncChain(id, params) {
2887
2887
  ...initialCompletionOwnerId ? { completionOwnerId: initialCompletionOwnerId } : {},
2888
2888
  completionOwnerProcess,
2889
2889
  mode: resultMode,
2890
+ ...params.scheduleOrigin ? { scheduleOrigin: params.scheduleOrigin } : {},
2890
2891
  state: "running",
2891
2892
  startedAt: initialStatusAt,
2892
2893
  lastUpdate: initialStatusAt,
@@ -2995,6 +2996,7 @@ function executeAsyncChain(id, params) {
2995
2996
  (s) => isParallelStep(s) ? `[${s.parallel.map((t) => t.agent).join("+")}]` : isDynamicParallelStep(s) ? `expand:${s.parallel.agent}` : s.agent
2996
2997
  ),
2997
2998
  chainStepCount: eventChain.length,
2999
+ ...params.scheduleOrigin ? { scheduleOrigin: params.scheduleOrigin } : {},
2998
3000
  parallelGroups,
2999
3001
  workflowGraph,
3000
3002
  cwd: runnerCwd,
@@ -3509,6 +3511,7 @@ function executeAsyncSingle(id, params) {
3509
3511
  ...initialCompletionOwnerId ? { completionOwnerId: initialCompletionOwnerId } : {},
3510
3512
  completionOwnerProcess,
3511
3513
  mode: "single",
3514
+ ...params.scheduleOrigin ? { scheduleOrigin: params.scheduleOrigin } : {},
3512
3515
  ...params.toolCallId ? { toolCallId: params.toolCallId } : {},
3513
3516
  state: "running",
3514
3517
  startedAt: initialStatusAt,
@@ -3586,6 +3589,7 @@ function executeAsyncSingle(id, params) {
3586
3589
  sessionId: ctx.currentSessionId,
3587
3590
  completionOwnerId: ctx.completionOwnerId ?? currentCompletionOwnerId(),
3588
3591
  mode: "single",
3592
+ ...params.scheduleOrigin ? { scheduleOrigin: params.scheduleOrigin } : {},
3589
3593
  ...params.toolCallId ? { toolCallId: params.toolCallId } : {},
3590
3594
  agent,
3591
3595
  ...sandbox ? { sandbox } : {},
@@ -10778,6 +10782,7 @@ function appendStepToAsyncChain(input) {
10778
10782
  pi: input.deps.pi,
10779
10783
  cwd: input.ctx.cwd,
10780
10784
  currentSessionId: resolveCurrentSessionId(input.ctx.sessionManager),
10785
+ completionOwnerId: input.deps.state.completionOwnerId,
10781
10786
  parentSessionId: input.ctx.sessionManager.getSessionId() ?? void 0,
10782
10787
  parentSessionFile: input.ctx.sessionManager.getSessionFile() ?? void 0,
10783
10788
  currentModelProvider: parentModel?.provider,
@@ -12644,6 +12649,7 @@ async function runAsyncPath(data, deps) {
12644
12649
  pi: deps.pi,
12645
12650
  cwd: ctx.cwd,
12646
12651
  currentSessionId: data.parentSessionId,
12652
+ completionOwnerId: deps.state.completionOwnerId,
12647
12653
  parentSessionId: data.parentPiSessionId,
12648
12654
  parentSessionFile: ctx.sessionManager.getSessionFile() ?? void 0,
12649
12655
  currentModelProvider: parentModel?.provider,
@@ -12770,6 +12776,7 @@ async function runAsyncPath(data, deps) {
12770
12776
  parentWorkflowRunId: params.workflowParentRunId,
12771
12777
  workflowKey: params.workflowKey,
12772
12778
  lane: params.lane,
12779
+ scheduleOrigin: params.scheduleOrigin,
12773
12780
  workflowAwaitAsync: params.workflowAwaitAsync
12774
12781
  }));
12775
12782
  return waitForWorkflowAsyncSingleResult(params, asyncResult, { runId: id, task: params.task ?? "", signal: data.signal, state: deps.state, pi: deps.pi, kill: deps.kill });
@@ -14674,6 +14681,7 @@ Parent action: ${STATUS_ACTION}`,
14674
14681
  sessionId: currentSessionId ?? void 0,
14675
14682
  completionOwnerId,
14676
14683
  mode: "workflow",
14684
+ ...requestParams.scheduleOrigin ? { scheduleOrigin: requestParams.scheduleOrigin } : {},
14677
14685
  agent: "workflow",
14678
14686
  goal: derivedObjective.trim() ? PROMPT_REDACTED : void 0,
14679
14687
  ...timeout !== void 0 ? { timeoutMs: timeout, deadlineAt: startedAt + timeout } : {}
package/bundle/index.js CHANGED
@@ -17,7 +17,7 @@ function readInstalledPackageVersion() {
17
17
  var loadedPackageVersion = readInstalledPackageVersion();
18
18
 
19
19
  // index.ts
20
- var registerExtension = process.env[HERDR_PI_MODE_ENV] === "1" ? (await import("./chunk-7K3Z6DM7.js")).default : process.env.PI_SUBAGENT_CHILD === "1" ? void 0 : (await import("./chunk-UFNSLL5D.js")).default;
20
+ var registerExtension = process.env[HERDR_PI_MODE_ENV] === "1" ? (await import("./chunk-4UH4WS4G.js")).default : process.env.PI_SUBAGENT_CHILD === "1" ? void 0 : (await import("./chunk-224WMDIV.js")).default;
21
21
  function registerSubagentExtension(pi) {
22
22
  const installedVersion = readInstalledPackageVersion();
23
23
  if (installedVersion !== loadedPackageVersion) {
@@ -0,0 +1,26 @@
1
+ # Goal 自动续跑门禁接入
2
+
3
+ 本说明记录 pi-subagents 如何响应 goal-x 的 `pi-goal:before-auto-continue:v1` 同步门禁。该监听器只延迟 goal-x 自己的 fallback checkpoint;不拦截子代理结果、监督请求、用户输入或其他原生唤醒。
4
+
5
+ ## 状态来源与判据
6
+
7
+ | 工作阶段 | 读取的既有权威状态 | 门禁判据 |
8
+ | --- | --- | --- |
9
+ | Async / workflow root 仍在排队或运行 | `SubagentState.asyncJobs`,由 `SUBAGENT_ASYNC_STARTED_EVENT` 建立、session 恢复时由 `listAsyncRuns` 的状态投影恢复 | 只对 `queued` / `running` 且通过 `ResultDeliveryOwnership.owns(sessionId, completionOwnerId)` 的运行阻止。workflow root 是一个普通的活动 async job;嵌套/并行子任务不另建阻止计数。恢复与 live status refresh 均保留 `AsyncStatus.completionOwnerId`,新建 single/chain context 显式使用父扩展的 owner,确保此判据不会因状态投影丢失归属。 |
10
+ | 显式静默的定时运行 | 已投影的 `AsyncJobState.scheduleOrigin`(源自当前启动事件或 `AsyncStatus.scheduleOrigin`) | `scheduleOrigin.quiet === true` 不单独阻止续跑;其成功完成本来就不会触发父会话续跑。失败等可操作结果仍沿用原通知策略。 |
11
+ | Detached foreground 仍运行 | `SubagentState.foregroundControls`(当前扩展 session 的内存控制器) | 用现有 `ownsRun(state.currentSessionId, control.sessionId)` 复用 session succession 归属;不扫描会话文件或 transcript。 |
12
+ | Async 已终态、结果还未交给 notifier | 既有 `owedResultRunIds`,由当前拥有者的 `holdOwedResult` 在 job terminal 路径维护 | 只要仍欠一个拥有者结果交接,就阻止 checkpoint,覆盖 runner terminal 与 result watcher/notifier 之间的窗口。该 Set 原已用于 session liveness,不为门禁新增计数器。 |
13
+ | 通知正在发送或 Pi 已接受 wake、父回合尚未开始 | `CompletionNotifier.hasPendingWake()`:仅观察原 notifier 的 pending trigger-turn deliveries 和 `unstartedWakes`;`messageStarted` 按现有语义释放已启动 wake | 只有当前通知确实承诺 native turn wake 时阻止。显式 `triggerTurn:false`、quiet 成功结果、或当前 held 状态下没有已承诺的 wake 不阻止。 |
14
+
15
+ 门禁请求用当前 SDK `session_start` 的 `sessionManager.getSessionId()` UUID 与 `state.supervisorOwnerSessionId` 精确匹配。Async / foreground 运行归属仍由现有 ownership helper 按它们自己的 session 标识处理;绝不把 session UUID 和 session-file path 当作可直接比较的同类字符串。
16
+
17
+ ## 同步监听及生命周期
18
+
19
+ 监听器在 `session_start` 恢复当前运行状态后安装;会话替换时先 dispose 旧 listener 再安装新 listener,`session_shutdown` / 扩展 reload 由 runtime cleanup 移除。listener 在首个 `await` 前完成所有判断,只通过请求的单向 `defer` 回调投票;本地权威状态读取异常时 catch 并用固定短原因 fail closed,不调用模型、不读磁盘,也不改变 notifier、子代理状态或 goal 生命周期。
20
+
21
+ ## 明确不做
22
+
23
+ - 不解析任意 tool result、tool-call args/status/id 或任务文本来猜测后台工作。
24
+ - 不在门禁热路径扫描状态目录、result 文件、session transcript 或事件日志。
25
+ - 不新增 started/completed 计数器、等待/重试机制、用户设置、命令或持久化 schema。
26
+ - 不改变 `sendMessage`、结果去重/所有权、监督请求或 `message_start` 的交付顺序。
@@ -3,6 +3,18 @@
3
3
  All notable changes to the internal `@xzzpig/pi-components` shared library are
4
4
  documented here.
5
5
 
6
+ ## 0.5.0
7
+
8
+ ### Added
9
+
10
+ - **可选启用的 `TranscriptPresenter`(`@xzzpig/pi-components/transcript-presenter`)。**
11
+ 在既有 `TranscriptEntry` 值之上的有状态展示层:按稳定消息段保留原生用户/助手
12
+ 组件,把真实流式状态传给 Pi 的 `AssistantMessageComponent`,在内容更新和缩放后
13
+ 保留原生思考块的点击状态,暴露组件行范围与规范化鼠标分发,支持本地统一思考切换
14
+ (包括通过 Pi 原生 `MouseRegion` 点击路径展开已完成的块),并提供显式的
15
+ `sync`/`render`/`invalidate`/`clear`/`dispose` 生命周期钩子。既有
16
+ `renderTranscriptLines` 与 `TranscriptViewport` 行为不变。
17
+
6
18
  ## 0.4.0
7
19
 
8
20
  ### Added