@linimin/pi-letscook 0.1.42 → 0.1.43

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.43
6
+
7
+ ### Fixed
8
+
9
+ - stopped injecting completion-workflow reminder and compaction-resume context into ordinary primary-agent turns after canonical `continuation_policy` reaches `done`, so users must rerun `/cook` before the workflow protocol reactivates
10
+
5
11
  ## 0.1.42
6
12
 
7
13
  ### Changed
@@ -562,6 +562,10 @@ function isWorkflowDone(snapshot: CompletionStateSnapshot | undefined): boolean
562
562
  return asString(snapshot?.state?.continuation_policy) === "done";
563
563
  }
564
564
 
565
+ function shouldInjectCompletionWorkflowContext(snapshot: CompletionStateSnapshot | undefined): boolean {
566
+ return Boolean(snapshot) && !isWorkflowDone(snapshot);
567
+ }
568
+
565
569
  function extractTextFromMessageContent(content: unknown): string {
566
570
  if (typeof content === "string") return content.trim();
567
571
  if (!Array.isArray(content)) return "";
@@ -3733,7 +3737,7 @@ export default function completionExtension(pi: ExtensionAPI) {
3733
3737
  const fingerprint = completionContinuationFingerprint(loaded.snapshot);
3734
3738
  if (fingerprint) markQueuedDriverPromptInFlight(rootKey, fingerprint);
3735
3739
  }
3736
- if (!loaded) return;
3740
+ if (!loaded || !shouldInjectCompletionWorkflowContext(loaded.snapshot)) return;
3737
3741
  const markerText = await readText(loaded.snapshot.files.compactionMarkerPath);
3738
3742
  let marker: JsonRecord | undefined;
3739
3743
  if (markerText) {
@@ -3756,7 +3760,7 @@ export default function completionExtension(pi: ExtensionAPI) {
3756
3760
 
3757
3761
  pi.on("session_before_compact", async (event, ctx) => {
3758
3762
  const loaded = await loadCompletionDataForReminder(getCtxCwd(ctx));
3759
- if (!loaded) return;
3763
+ if (!loaded || !shouldInjectCompletionWorkflowContext(loaded.snapshot)) return;
3760
3764
  const { preparation } = event;
3761
3765
  const summary = buildResumeCapsule(loaded.snapshot, loaded.sliceHistory, loaded.stopHistory);
3762
3766
  await fsp.mkdir(loaded.snapshot.files.tmpDir, { recursive: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linimin/pi-letscook",
3
- "version": "0.1.42",
3
+ "version": "0.1.43",
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,
@@ -392,4 +392,48 @@ assert 'Verification evidence summary:' in text, text
392
392
  assert 'selected_slice' in text, text
393
393
  PY
394
394
 
395
+ python3 - <<'PY'
396
+ import json
397
+ from pathlib import Path
398
+
399
+ state_path = Path('.agent/state.json')
400
+ plan_path = Path('.agent/plan.json')
401
+ active_path = Path('.agent/active-slice.json')
402
+
403
+ state = json.loads(state_path.read_text())
404
+ state.update({
405
+ 'current_phase': 'done',
406
+ 'continuation_policy': 'done',
407
+ 'continuation_reason': 'Fixture is complete; ordinary primary-agent turns should stay outside completion until /cook runs again.',
408
+ 'project_done': True,
409
+ 'remaining_high_value_gaps': 0,
410
+ 'unsatisfied_contract_ids': [],
411
+ 'next_mandatory_action': None,
412
+ 'next_mandatory_role': None,
413
+ 'remaining_stop_judges': 0,
414
+ 'contract_status': 'done',
415
+ })
416
+ state_path.write_text(json.dumps(state, indent=2) + '\n')
417
+
418
+ plan = json.loads(plan_path.read_text())
419
+ for slice_data in plan.get('candidate_slices', []):
420
+ if slice_data.get('slice_id') == 'evidence-fixture':
421
+ slice_data['status'] = 'done'
422
+ plan_path.write_text(json.dumps(plan, indent=2) + '\n')
423
+
424
+ active = json.loads(active_path.read_text())
425
+ active['status'] = 'done'
426
+ active_path.write_text(json.dumps(active, indent=2) + '\n')
427
+ PY
428
+
429
+ rm -f "$SYSTEM_REMINDER"
430
+ PI_COMPLETION_TEST_SYSTEM_REMINDER_PATH="$SYSTEM_REMINDER" \
431
+ pi -e "$PKG_ROOT" -p "Summarize the latest release briefly." \
432
+ >"$TMPDIR/pi-canonical-evidence-done-reminder.out" 2>"$TMPDIR/pi-canonical-evidence-done-reminder.err"
433
+
434
+ [[ ! -f "$SYSTEM_REMINDER" ]] || {
435
+ echo "expected no completion reminder snapshot when continuation_policy is done" >&2
436
+ exit 1
437
+ }
438
+
395
439
  echo "canonical evidence artifact test passed: $TMPDIR"