@youdie006/prodex 0.28.0 → 0.28.1

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/dist/cli-help.js CHANGED
@@ -27,9 +27,9 @@ Ask / consult commands:
27
27
  prodex pro browser projects [--source-cli /absolute/path/to/dist/cli.js] [--port 9333] [--timeout-ms 15000] # read-only list of sidebar project names (for --project)
28
28
  prodex pro browser recover [--source-cli /absolute/path/to/dist/cli.js] [--cwd /absolute/path/to/repo] [--port 9333] --target-url <thread-url> [--timeout-ms 60000] # recover a finished answer from a thread whose send timed out
29
29
  prodex pro browser ask [--source-cli /absolute/path/to/dist/cli.js] [--cwd /absolute/path/to/repo] [--port 9333] [--timeout-ms 300000] [--busy-wait-ms 600000] [--target-url url --confirm-target] [--new-chat] [--stdin] [--json] [--auto-login|--no-auto-login] [--file path] [--attach path] [--tool deep-research|web-search|create-image] [--model Pro] [--pro-mode 기본|확장] [--effort 즉시|중간|높음|"매우 높음"] [--project "name" | --project-new "name"] "prompt" # explicit visible-browser send
30
- prodex pro latest [--source-cli /absolute/path/to/dist/cli.js] [--cwd /absolute/path/to/repo]
30
+ prodex pro latest [--source-cli /absolute/path/to/dist/cli.js] [--cwd /absolute/path/to/repo] [--json]
31
31
  prodex pro list [--source-cli /absolute/path/to/dist/cli.js] [--cwd /absolute/path/to/repo] [--json]
32
- prodex pro show <task-id|latest> [--source-cli /absolute/path/to/dist/cli.js] [--cwd /absolute/path/to/repo]
32
+ prodex pro show <task-id|latest> [--source-cli /absolute/path/to/dist/cli.js] [--cwd /absolute/path/to/repo] [--json]
33
33
 
34
34
  Bridge ledger (durable tasks/results/receipts/sessions under .bridge/):
35
35
  prodex init [--cwd /absolute/path/to/repo]
@@ -168,9 +168,9 @@ Commands:
168
168
  prodex pro browser smoke [--source-cli /absolute/path/to/dist/cli.js] [--cwd /absolute/path/to/repo]
169
169
  prodex pro browser models [--source-cli /absolute/path/to/dist/cli.js]
170
170
  prodex pro browser ask [--source-cli /absolute/path/to/dist/cli.js] [--cwd /absolute/path/to/repo] [--target-url url --confirm-target] [--new-chat] [--stdin] [--json] [--auto-login|--no-auto-login] [--file path] [--attach path] [--tool deep-research|web-search|create-image] [--model Pro] [--pro-mode 기본|확장] [--effort 즉시|중간|높음|"매우 높음"] [--project "name" | --project-new "name"] "prompt"
171
- prodex pro latest [--source-cli /absolute/path/to/dist/cli.js] [--cwd /absolute/path/to/repo]
171
+ prodex pro latest [--source-cli /absolute/path/to/dist/cli.js] [--cwd /absolute/path/to/repo] [--json]
172
172
  prodex pro list [--source-cli /absolute/path/to/dist/cli.js] [--cwd /absolute/path/to/repo] [--json]
173
- prodex pro show <task-id|latest> [--source-cli /absolute/path/to/dist/cli.js] [--cwd /absolute/path/to/repo]
173
+ prodex pro show <task-id|latest> [--source-cli /absolute/path/to/dist/cli.js] [--cwd /absolute/path/to/repo] [--json]
174
174
 
175
175
  Use \`prodex pro ask\` for dry-run/manual previews.
176
176
  Use \`prodex pro browser ask\` only when you want an explicit visible-browser send.
package/dist/cli-pro.js CHANGED
@@ -575,7 +575,7 @@ export async function runProCommand(rest, io, runCliFn) {
575
575
  if (subcommand === "latest") {
576
576
  if (printHelpIfRequested(proArgs, "pro latest", io.stdout, printProHelp, { valueFlags: ["--cwd", "--source-cli"] }))
577
577
  return 0;
578
- assertOnlyOptions(proArgs, "pro latest", ["--cwd", "--source-cli"]);
578
+ assertOnlyOptions(proArgs, "pro latest", ["--cwd", "--source-cli"], ["--json"]);
579
579
  const targetCwd = resolveCwdFlag(io.cwd, proArgs);
580
580
  const targetStore = new BridgeStore(targetCwd);
581
581
  const sourceCli = resolveOptionalFileFlag(io.cwd, proArgs, "--source-cli");
@@ -589,13 +589,19 @@ export async function runProCommand(rest, io, runCliFn) {
589
589
  }
590
590
  if (!consult)
591
591
  throw new Error("No GPT Pro answers found");
592
- io.stdout(formatProAnswer(consult, sourceCli, answerOptions));
592
+ if (proArgs.includes("--json")) {
593
+ const modelUsed = await recordedModelUsed(targetStore, consult.task.id);
594
+ io.stdout(formatProAnswerJson(consult, sourceCli, answerOptions, modelUsed ? { modelUsed } : {}));
595
+ }
596
+ else {
597
+ io.stdout(formatProAnswer(consult, sourceCli, answerOptions));
598
+ }
593
599
  return 0;
594
600
  }
595
601
  if (subcommand === "show") {
596
602
  if (printHelpIfRequested(proArgs, "pro show", io.stdout, printProHelp, { valueFlags: ["--cwd", "--source-cli"], maxPositionals: 1 }))
597
603
  return 0;
598
- const [taskId] = readPositionalsWithOptions(proArgs, "pro show", 1, ["--cwd", "--source-cli"]);
604
+ const [taskId] = readPositionalsWithOptions(proArgs, "pro show", 1, ["--cwd", "--source-cli"], ["--json"]);
599
605
  if (!taskId)
600
606
  throw new Error("pro show requires <task-id|latest>");
601
607
  const targetCwd = resolveCwdFlag(io.cwd, proArgs);
@@ -611,7 +617,13 @@ export async function runProCommand(rest, io, runCliFn) {
611
617
  }
612
618
  if (!consult)
613
619
  throw new Error(taskId === "latest" ? "No GPT Pro answers found" : `GPT Pro answer not found: ${taskId}`);
614
- io.stdout(formatProAnswer(consult, sourceCli, answerOptions));
620
+ if (proArgs.includes("--json")) {
621
+ const modelUsed = await recordedModelUsed(targetStore, consult.task.id);
622
+ io.stdout(formatProAnswerJson(consult, sourceCli, answerOptions, modelUsed ? { modelUsed } : {}));
623
+ }
624
+ else {
625
+ io.stdout(formatProAnswer(consult, sourceCli, answerOptions));
626
+ }
615
627
  return 0;
616
628
  }
617
629
  if (subcommand === "debate-prompt") {
@@ -1432,6 +1444,42 @@ export function browserSendBlockerFromError(error) {
1432
1444
  next_step: "Resolve the visible browser issue manually, then rerun the consult if needed."
1433
1445
  };
1434
1446
  }
1447
+ /**
1448
+ * The same answer as `formatProAnswer`, shaped for a program.
1449
+ *
1450
+ * Every other read path is JSON; these two printed only the human rendering,
1451
+ * so an agent after the thread or the model that produced an answer had to
1452
+ * scrape prose.
1453
+ */
1454
+ export function formatProAnswerJson(consult, sourceCli, options = {}, extras = {}) {
1455
+ const blocker = sourceAwareProAnswerBlocker(consult, sourceCli, options);
1456
+ return JSON.stringify({
1457
+ task_id: consult.task.id,
1458
+ status: consult.result.status,
1459
+ thread: consult.task.provenance.thread ?? null,
1460
+ created_at: consult.result.created_at,
1461
+ answer: consult.result.summary,
1462
+ ...(extras.modelUsed ? { model_used: extras.modelUsed } : {}),
1463
+ warnings: consult.result.warnings ?? [],
1464
+ ...(blocker ? { blocker } : {})
1465
+ }, null, 2);
1466
+ }
1467
+ /**
1468
+ * Which model actually answered, from the receipt that recorded the answer.
1469
+ * It lives there rather than on the task because it is what ChatGPT tagged the
1470
+ * message with, not what prodex asked for.
1471
+ */
1472
+ async function recordedModelUsed(store, taskId) {
1473
+ try {
1474
+ const receipts = await store.listReceiptsReadOnly({ kind: "consult_answer_saved", task_id: taskId });
1475
+ const value = receipts[0]?.metadata?.model_used;
1476
+ return typeof value === "string" ? value : undefined;
1477
+ }
1478
+ catch {
1479
+ // A missing or unreadable receipt just means the field is unknown.
1480
+ return undefined;
1481
+ }
1482
+ }
1435
1483
  export function formatProAnswer(consult, sourceCli, options = {}) {
1436
1484
  const blocker = sourceAwareProAnswerBlocker(consult, sourceCli, options);
1437
1485
  const summary = sourceAwareProAnswerSummary(consult.result.summary, consult.result.blocker, blocker);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@youdie006/prodex",
3
- "version": "0.28.0",
3
+ "version": "0.28.1",
4
4
  "description": "Local receipt bus for coordinating Codex execution with ChatGPT Pro/Projects consultation.",
5
5
  "author": "youdie006",
6
6
  "license": "MIT",