@linimin/pi-letscook 0.1.57 → 0.1.59

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.
@@ -47,6 +47,49 @@ with session_path.open('w', encoding='utf-8') as fh:
47
47
  PY
48
48
  }
49
49
 
50
+ write_session_messages() {
51
+ local session_path="$1"
52
+ local cwd="$2"
53
+ local messages_json="$3"
54
+ python3 - "$session_path" "$cwd" "$messages_json" <<'PY'
55
+ import json
56
+ import sys
57
+ from pathlib import Path
58
+
59
+ session_path = Path(sys.argv[1])
60
+ cwd = sys.argv[2]
61
+ messages = json.loads(sys.argv[3])
62
+ session_path.parent.mkdir(parents=True, exist_ok=True)
63
+ entries = [
64
+ {
65
+ "type": "session",
66
+ "version": 3,
67
+ "id": "11111111-1111-4111-8111-111111111111",
68
+ "timestamp": "2026-01-01T00:00:00.000Z",
69
+ "cwd": cwd,
70
+ },
71
+ ]
72
+ parent_id = None
73
+ for index, message in enumerate(messages, start=1):
74
+ entry_id = f"m{index:04d}"
75
+ entries.append({
76
+ "type": "message",
77
+ "id": entry_id,
78
+ "parentId": parent_id,
79
+ "timestamp": f"2026-01-01T00:00:{index:02d}.000Z",
80
+ "message": {
81
+ "role": message["role"],
82
+ "content": message["content"],
83
+ "timestamp": 1767225600000 + index * 1000,
84
+ },
85
+ })
86
+ parent_id = entry_id
87
+ with session_path.open('w', encoding='utf-8') as fh:
88
+ for entry in entries:
89
+ fh.write(json.dumps(entry, ensure_ascii=False) + "\n")
90
+ PY
91
+ }
92
+
50
93
  cleanup() {
51
94
  if [[ -n "$CURRENT_EVIDENCE_BACKUP" && -f "$CURRENT_EVIDENCE_BACKUP" ]]; then
52
95
  cp "$CURRENT_EVIDENCE_BACKUP" "$PKG_ROOT/.agent/verification-evidence.json"
@@ -139,11 +182,59 @@ bash .agent/verify_completion_control_plane.sh >/dev/null
139
182
  ROOT="$TMPDIR/repo"
140
183
  SYSTEM_REMINDER="$TMPDIR/system-reminder.txt"
141
184
  BOOTSTRAP_SESSION="$TMPDIR/session-canonical-evidence-bootstrap.jsonl"
142
- BOOTSTRAP_DISCUSSION=$'Mission: Exercise canonical evidence fixture bootstrap.\nScope:\n- Materialize canonical completion files for the evidence artifact fixture.\nConstraints:\n- Use supported bare /cook startup only.\nAcceptance:\n- Scaffold canonical files before the fixture rewrites them.'
185
+ BOOTSTRAP_MESSAGES="$(python3 - <<'PY'
186
+ import json
187
+ capsule = {
188
+ "kind": "cook_handoff",
189
+ "source": "primary_agent",
190
+ "captured_at": "2026-01-01T00:00:02.000Z",
191
+ "source_turn_id": "m0002",
192
+ "mission": "Exercise canonical evidence fixture bootstrap.",
193
+ "scope": [
194
+ "Materialize canonical completion files for the evidence artifact fixture.",
195
+ "Keep the verification-evidence bootstrap on the supported explicit-handoff startup path."
196
+ ],
197
+ "constraints": [
198
+ "Use supported bare /cook startup only."
199
+ ],
200
+ "acceptance": [
201
+ "Scaffold .agent/profile.json, .agent/state.json, .agent/plan.json, .agent/active-slice.json, and .agent/verification-evidence.json before the fixture rewrites them.",
202
+ "Keep scripts/canonical-evidence-artifact-test.sh aligned with packaged bootstrap behavior."
203
+ ],
204
+ "risks": [
205
+ "Evidence-artifact bootstrap must stay anchored to the fresh explicit handoff."
206
+ ],
207
+ "notes": [
208
+ "This fixture exists only to scaffold canonical files before rewriting them for evidence parity coverage."
209
+ ],
210
+ "handoff_kind": "implementation_workflow_handoff",
211
+ "first_slice_goal": "Scaffold canonical evidence-artifact fixture files before rewriting them for parity checks.",
212
+ "first_slice_non_goals": [
213
+ "Do not broaden the bootstrap fixture beyond the evidence-artifact surfaces."
214
+ ],
215
+ "implementation_surfaces": [
216
+ ".agent/verification-evidence.json",
217
+ "scripts/canonical-evidence-artifact-test.sh"
218
+ ],
219
+ "verification_commands": [
220
+ "bash ./scripts/canonical-evidence-artifact-test.sh"
221
+ ],
222
+ "why_this_slice_first": "The evidence-artifact fixture cannot validate fail-closed parity until canonical files exist.",
223
+ "task_type": "completion-workflow",
224
+ "evaluation_profile": "completion-rubric-v1",
225
+ "why_cook_now": "The fixture bootstrap is concrete enough to create canonical control-plane files."
226
+ }
227
+ messages = [
228
+ {"role": "user", "content": "Prepare the canonical evidence bootstrap fixture and tell me when it is ready for /cook."},
229
+ {"role": "assistant", "content": "The canonical evidence bootstrap fixture is ready for /cook. Run /cook to confirm it.\n\n```cook_handoff\n" + json.dumps(capsule, ensure_ascii=False, indent=2) + "\n```"},
230
+ ]
231
+ print(json.dumps(messages, ensure_ascii=False))
232
+ PY
233
+ )"
143
234
  mkdir -p "$ROOT"
144
235
  cd "$ROOT"
145
236
  git init -q
146
- write_session "$BOOTSTRAP_SESSION" "$ROOT" "$BOOTSTRAP_DISCUSSION"
237
+ write_session_messages "$BOOTSTRAP_SESSION" "$ROOT" "$BOOTSTRAP_MESSAGES"
147
238
 
148
239
  PI_COMPLETION_CONTEXT_PROPOSAL_ACTION=accept \
149
240
  PI_COMPLETION_DISABLE_CONTEXT_PROPOSAL_ANALYST=1 \