@linimin/pi-letscook 0.1.47 → 0.1.48

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 CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.1.48
6
+
7
+ ### Fixed
8
+
9
+ - stopped injecting active completion workflow routing into ordinary non-`/cook` main-chat turns after a repo had been activated earlier in the same Pi process, so stale canonical stop-wave state can no longer pull unrelated user requests into `completion-regrounder` unless a fresh `/cook` driver prompt is actually in flight
10
+
5
11
  ## 0.1.47
6
12
 
7
13
  ### Changed
@@ -242,8 +242,19 @@ function hasCompletionRoutingActivation(snapshot: CompletionStateSnapshot | unde
242
242
  return activatedCompletionRoutingRoots.has(path.resolve(snapshot.files.root));
243
243
  }
244
244
 
245
- function shouldInjectCompletionWorkflowContext(snapshot: CompletionStateSnapshot | undefined): boolean {
246
- return hasCompletionRoutingActivation(snapshot);
245
+ function latestUserOrCustomTurnText(ctx: { sessionManager?: any }): string | undefined {
246
+ return collectRecentDiscussionEntries(ctx as { sessionManager: any }, { isRecord, asString, isStaleContextError }, 1)[0]?.text;
247
+ }
248
+
249
+ function isCompletionDriverPromptTurn(ctx: { sessionManager?: any }): boolean {
250
+ const latest = latestUserOrCustomTurnText(ctx);
251
+ if (!latest) return false;
252
+ if (!/^\/skill:completion-protocol\b/.test(latest)) return false;
253
+ return /(?:Start or continue the completion workflow for this repo\.|Resume the completion workflow from canonical state\.)/.test(latest);
254
+ }
255
+
256
+ function shouldInjectCompletionWorkflowContext(snapshot: CompletionStateSnapshot | undefined, ctx: { sessionManager?: any }): boolean {
257
+ return hasCompletionRoutingActivation(snapshot) && isCompletionDriverPromptTurn(ctx);
247
258
  }
248
259
 
249
260
  function buildDoneWorkflowBoundaryReminder(snapshot: CompletionStateSnapshot): string {
@@ -939,7 +950,7 @@ export default function completionExtension(pi: ExtensionAPI) {
939
950
  await refreshCompletionStatus({ ctx, ...statusSurfaceArgs });
940
951
  if (shouldTestAutoContinueOnSessionStart()) {
941
952
  const snapshot = await loadCompletionSnapshot(getCtxCwd(ctx));
942
- if (hasCompletionRoutingActivation(snapshot)) {
953
+ if (hasCompletionRoutingActivation(snapshot) && isCompletionDriverPromptTurn(ctx)) {
943
954
  await autoContinueWorkflowIfNeeded(pi, ctx, driverDeps);
944
955
  }
945
956
  }
@@ -955,19 +966,20 @@ export default function completionExtension(pi: ExtensionAPI) {
955
966
  await fsp.rm(snapshot.files.compactionMarkerPath, { force: true });
956
967
  }
957
968
  await refreshCompletionStatus({ ctx, ...statusSurfaceArgs });
958
- if (hasCompletionRoutingActivation(snapshot)) {
969
+ if (hasCompletionRoutingActivation(snapshot) && isCompletionDriverPromptTurn(ctx)) {
959
970
  await autoContinueWorkflowIfNeeded(pi, ctx, driverDeps);
960
971
  }
961
972
  });
962
973
 
963
974
  pi.on("before_agent_start", async (_event, ctx) => {
964
975
  const loaded = await loadCompletionDataForReminder(getCtxCwd(ctx));
965
- if (loaded) {
976
+ const driverPromptTurn = isCompletionDriverPromptTurn(ctx);
977
+ if (loaded && driverPromptTurn) {
966
978
  const rootKey = completionRootKey(loaded.snapshot, getCtxCwd(ctx));
967
979
  const fingerprint = completionContinuationFingerprint(loaded.snapshot);
968
980
  if (fingerprint) markQueuedDriverPromptInFlight(rootKey, fingerprint);
969
981
  }
970
- if (!loaded || !shouldInjectCompletionWorkflowContext(loaded.snapshot)) return;
982
+ if (!loaded || !shouldInjectCompletionWorkflowContext(loaded.snapshot, ctx)) return;
971
983
  const additions = isWorkflowDone(loaded.snapshot)
972
984
  ? [buildDoneWorkflowBoundaryReminder(loaded.snapshot)]
973
985
  : [composeSystemReminder(loaded.snapshot, loaded.sliceHistory, loaded.stopHistory)];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linimin/pi-letscook",
3
- "version": "0.1.47",
3
+ "version": "0.1.48",
4
4
  "description": "Pi package for long-running completion workflows with canonical .agent state, role-based subagents, continuity, and verification helpers.",
5
5
  "license": "MIT",
6
6
  "private": false,