@riddledc/riddle-proof 0.5.52 → 0.5.53

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/README.md CHANGED
@@ -64,6 +64,7 @@ Codex/CLI-style testing:
64
64
  ```sh
65
65
  riddle-proof-loop run --request-json request.json --checkpoint-mode yield
66
66
  riddle-proof-loop checkpoint --state-path /tmp/riddle-proof-run.json
67
+ riddle-proof-loop checkpoint --state-path /tmp/riddle-proof-run.json --format markdown
67
68
  riddle-proof-loop run --request-json request.json --agent local
68
69
  riddle-proof-loop status --state-path /tmp/riddle-proof-run.json
69
70
  riddle-proof-loop respond --state-path /tmp/riddle-proof-run.json --response-json response.json
package/dist/cli.cjs CHANGED
@@ -6401,7 +6401,7 @@ function usage() {
6401
6401
  return [
6402
6402
  "Usage:",
6403
6403
  " riddle-proof-loop run --request-json <file|json|-> [--agent disabled|local] [--checkpoint-mode yield|auto]",
6404
- " riddle-proof-loop checkpoint --state-path <path> [--decision <decision>]",
6404
+ " riddle-proof-loop checkpoint --state-path <path> [--decision <decision>] [--format json|markdown]",
6405
6405
  " riddle-proof-loop respond --state-path <path> --response-json <file|json|->",
6406
6406
  " riddle-proof-loop respond --state-path <path> --decision <decision> --summary <text> [--payload-json <file|json|->]",
6407
6407
  " riddle-proof-loop status --state-path <path>",
@@ -6474,6 +6474,65 @@ function hasPlaceholderValue(value) {
6474
6474
  }
6475
6475
  return false;
6476
6476
  }
6477
+ function markdownJson(value) {
6478
+ return JSON.stringify(value ?? null, null, 2);
6479
+ }
6480
+ function formatCheckpointMarkdown(input) {
6481
+ const packet = input.checkpointPacket;
6482
+ const runCard = input.runCard;
6483
+ const lines = [
6484
+ "# Riddle Proof Checkpoint",
6485
+ "",
6486
+ `Run: ${packet.run_id}`,
6487
+ `State: ${input.statePath}`,
6488
+ `Status: ${input.status || "awaiting_checkpoint"}`,
6489
+ `Stage: ${packet.stage}`,
6490
+ `Checkpoint: ${packet.checkpoint}`,
6491
+ `Kind: ${packet.kind}`,
6492
+ "",
6493
+ "## Goal",
6494
+ "",
6495
+ runCard?.goal?.change_request || packet.change_request,
6496
+ "",
6497
+ "## Next Action",
6498
+ "",
6499
+ packet.question,
6500
+ "",
6501
+ "## Allowed Decisions",
6502
+ "",
6503
+ ...packet.allowed_decisions.map((decision) => `- ${decision}`),
6504
+ ""
6505
+ ];
6506
+ if (packet.artifacts?.length) {
6507
+ lines.push("## Artifacts", "");
6508
+ for (const artifact of packet.artifacts) {
6509
+ lines.push(`- ${artifact.role}: ${artifact.url || artifact.path || artifact.name || "available"}`);
6510
+ }
6511
+ lines.push("");
6512
+ }
6513
+ if (packet.evidence_excerpt && Object.keys(packet.evidence_excerpt).length) {
6514
+ lines.push("## Evidence Excerpt", "", "```json", markdownJson(packet.evidence_excerpt), "```", "");
6515
+ }
6516
+ if (packet.state_excerpt && Object.keys(packet.state_excerpt).length) {
6517
+ lines.push("## State Excerpt", "", "```json", markdownJson(packet.state_excerpt), "```", "");
6518
+ }
6519
+ lines.push(
6520
+ "## Response Template",
6521
+ "",
6522
+ "```json",
6523
+ markdownJson(input.responseTemplate),
6524
+ "```",
6525
+ "",
6526
+ "## Next Command",
6527
+ "",
6528
+ "```sh",
6529
+ `riddle-proof-loop respond --state-path ${input.statePath} --decision ${input.responseTemplate.decision} --summary <summary> --payload-json <file|json|->`,
6530
+ "```",
6531
+ ""
6532
+ );
6533
+ return `${lines.join("\n")}
6534
+ `;
6535
+ }
6477
6536
  function checkpointResponseForFlags(statePath, options) {
6478
6537
  const state = readRunState(statePath);
6479
6538
  if (!state.checkpoint_packet) {
@@ -6577,6 +6636,18 @@ async function main() {
6577
6636
  decision: optionString(options, "decision"),
6578
6637
  source_kind: optionString(options, "sourceKind") || "codex"
6579
6638
  });
6639
+ const format = optionString(options, "format") || "json";
6640
+ if (format === "markdown" || format === "md") {
6641
+ process.stdout.write(formatCheckpointMarkdown({
6642
+ statePath,
6643
+ status: snapshot?.status || state.status,
6644
+ checkpointPacket: state.checkpoint_packet,
6645
+ runCard: snapshot?.run_card || state.run_card || null,
6646
+ responseTemplate
6647
+ }));
6648
+ return;
6649
+ }
6650
+ if (format !== "json") throw new Error("--format must be json or markdown.");
6580
6651
  process.stdout.write(`${JSON.stringify({
6581
6652
  checkpoint_packet: state.checkpoint_packet,
6582
6653
  run_card: snapshot?.run_card || state.run_card || null,
package/dist/cli.js CHANGED
@@ -23,7 +23,7 @@ function usage() {
23
23
  return [
24
24
  "Usage:",
25
25
  " riddle-proof-loop run --request-json <file|json|-> [--agent disabled|local] [--checkpoint-mode yield|auto]",
26
- " riddle-proof-loop checkpoint --state-path <path> [--decision <decision>]",
26
+ " riddle-proof-loop checkpoint --state-path <path> [--decision <decision>] [--format json|markdown]",
27
27
  " riddle-proof-loop respond --state-path <path> --response-json <file|json|->",
28
28
  " riddle-proof-loop respond --state-path <path> --decision <decision> --summary <text> [--payload-json <file|json|->]",
29
29
  " riddle-proof-loop status --state-path <path>",
@@ -96,6 +96,65 @@ function hasPlaceholderValue(value) {
96
96
  }
97
97
  return false;
98
98
  }
99
+ function markdownJson(value) {
100
+ return JSON.stringify(value ?? null, null, 2);
101
+ }
102
+ function formatCheckpointMarkdown(input) {
103
+ const packet = input.checkpointPacket;
104
+ const runCard = input.runCard;
105
+ const lines = [
106
+ "# Riddle Proof Checkpoint",
107
+ "",
108
+ `Run: ${packet.run_id}`,
109
+ `State: ${input.statePath}`,
110
+ `Status: ${input.status || "awaiting_checkpoint"}`,
111
+ `Stage: ${packet.stage}`,
112
+ `Checkpoint: ${packet.checkpoint}`,
113
+ `Kind: ${packet.kind}`,
114
+ "",
115
+ "## Goal",
116
+ "",
117
+ runCard?.goal?.change_request || packet.change_request,
118
+ "",
119
+ "## Next Action",
120
+ "",
121
+ packet.question,
122
+ "",
123
+ "## Allowed Decisions",
124
+ "",
125
+ ...packet.allowed_decisions.map((decision) => `- ${decision}`),
126
+ ""
127
+ ];
128
+ if (packet.artifacts?.length) {
129
+ lines.push("## Artifacts", "");
130
+ for (const artifact of packet.artifacts) {
131
+ lines.push(`- ${artifact.role}: ${artifact.url || artifact.path || artifact.name || "available"}`);
132
+ }
133
+ lines.push("");
134
+ }
135
+ if (packet.evidence_excerpt && Object.keys(packet.evidence_excerpt).length) {
136
+ lines.push("## Evidence Excerpt", "", "```json", markdownJson(packet.evidence_excerpt), "```", "");
137
+ }
138
+ if (packet.state_excerpt && Object.keys(packet.state_excerpt).length) {
139
+ lines.push("## State Excerpt", "", "```json", markdownJson(packet.state_excerpt), "```", "");
140
+ }
141
+ lines.push(
142
+ "## Response Template",
143
+ "",
144
+ "```json",
145
+ markdownJson(input.responseTemplate),
146
+ "```",
147
+ "",
148
+ "## Next Command",
149
+ "",
150
+ "```sh",
151
+ `riddle-proof-loop respond --state-path ${input.statePath} --decision ${input.responseTemplate.decision} --summary <summary> --payload-json <file|json|->`,
152
+ "```",
153
+ ""
154
+ );
155
+ return `${lines.join("\n")}
156
+ `;
157
+ }
99
158
  function checkpointResponseForFlags(statePath, options) {
100
159
  const state = readRunState(statePath);
101
160
  if (!state.checkpoint_packet) {
@@ -199,6 +258,18 @@ async function main() {
199
258
  decision: optionString(options, "decision"),
200
259
  source_kind: optionString(options, "sourceKind") || "codex"
201
260
  });
261
+ const format = optionString(options, "format") || "json";
262
+ if (format === "markdown" || format === "md") {
263
+ process.stdout.write(formatCheckpointMarkdown({
264
+ statePath,
265
+ status: snapshot?.status || state.status,
266
+ checkpointPacket: state.checkpoint_packet,
267
+ runCard: snapshot?.run_card || state.run_card || null,
268
+ responseTemplate
269
+ }));
270
+ return;
271
+ }
272
+ if (format !== "json") throw new Error("--format must be json or markdown.");
202
273
  process.stdout.write(`${JSON.stringify({
203
274
  checkpoint_packet: state.checkpoint_packet,
204
275
  run_card: snapshot?.run_card || state.run_card || null,
@@ -115,7 +115,7 @@ declare function buildSetupArgs(params: WorkflowParams, config: ReturnType<typeo
115
115
  target_image_hash: string;
116
116
  viewport_matrix_json: string;
117
117
  deterministic_setup_json: string;
118
- reference: "prod" | "before" | "both";
118
+ reference: "before" | "prod" | "both";
119
119
  base_branch: string;
120
120
  before_ref: string;
121
121
  allow_static_preview_fallback: string;
@@ -115,7 +115,7 @@ declare function buildSetupArgs(params: WorkflowParams, config: ReturnType<typeo
115
115
  target_image_hash: string;
116
116
  viewport_matrix_json: string;
117
117
  deterministic_setup_json: string;
118
- reference: "prod" | "before" | "both";
118
+ reference: "before" | "prod" | "both";
119
119
  base_branch: string;
120
120
  before_ref: string;
121
121
  allow_static_preview_fallback: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.5.52",
3
+ "version": "0.5.53",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",