@chit-run/cli 0.3.1 → 0.4.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.
Files changed (2) hide show
  1. package/dist/chit.js +40 -13
  2. package/package.json +2 -2
package/dist/chit.js CHANGED
@@ -35004,9 +35004,16 @@ function readBody(store, runId, ref) {
35004
35004
  return `<blob unavailable: ${err.message}>`;
35005
35005
  }
35006
35006
  }
35007
- function auditTimeline(store, runId, events2, includeBodies) {
35008
- return events2.map((e) => {
35009
- if (!includeBodies)
35007
+ function isReceiptEvent(e) {
35008
+ return e.type !== "adapter.event";
35009
+ }
35010
+ function hiddenAdapterEventCount(events2) {
35011
+ return events2.reduce((n, e) => e.type === "adapter.event" ? n + 1 : n, 0);
35012
+ }
35013
+ function auditTimeline(store, runId, events2, opts) {
35014
+ const rows = opts.verbose ? events2 : events2.filter(isReceiptEvent);
35015
+ return rows.map((e) => {
35016
+ if (!opts.includeBodies)
35010
35017
  return e;
35011
35018
  if (e.type === "adapter.call.started") {
35012
35019
  return { ...e, input: readBody(store, runId, e.inputBlob) };
@@ -35023,12 +35030,12 @@ function auditTimeline(store, runId, events2, includeBodies) {
35023
35030
  return e;
35024
35031
  });
35025
35032
  }
35026
- function showAudit(store, runId, includeBodies) {
35033
+ function showAudit(store, runId, opts) {
35027
35034
  const events2 = store.readEvents(runId);
35028
35035
  const summary = summarizeRun(runId, events2);
35029
35036
  const out = {
35030
35037
  summary,
35031
- timeline: auditTimeline(store, runId, events2, includeBodies)
35038
+ timeline: auditTimeline(store, runId, events2, opts)
35032
35039
  };
35033
35040
  if (summary.status === "incomplete")
35034
35041
  out.incompleteReason = describeIncomplete(summary, events2);
@@ -35036,6 +35043,12 @@ function showAudit(store, runId, includeBodies) {
35036
35043
  if (started?.type === "run.started" && started.participants !== undefined) {
35037
35044
  out.participants = started.participants;
35038
35045
  }
35046
+ if (!opts.verbose) {
35047
+ const hidden = hiddenAdapterEventCount(events2);
35048
+ if (hidden > 0) {
35049
+ out.note = `${hidden} raw adapter events hidden; pass verbose to include them, include_bodies to show blob bodies.`;
35050
+ }
35051
+ }
35039
35052
  return out;
35040
35053
  }
35041
35054
 
@@ -36454,14 +36467,15 @@ server.registerTool("chit_audit_list", {
36454
36467
  return jsonResult({ runs: listAudit(auditStore, limit) });
36455
36468
  });
36456
36469
  server.registerTool("chit_audit_show", {
36457
- description: "Show one audited run: a summary (manifest/surface/scope/status/usage), the recorded participant config, and the event timeline. An incomplete run carries the reason (open call / failed step / abandoned). Prompt/output/event bodies are included ONLY when include_bodies is true (they can be large or hold secrets), and only for blob refs the run's own events carry.",
36470
+ description: "Show one audited run as a receipt: a summary (manifest/surface/scope/status/usage), the recorded participant config, and a step-level timeline (run/step lifecycle and adapter calls with duration and usage). The raw per-call adapter event stream is hidden by default; set verbose to include those rows. Prompt/output/event bodies are included ONLY when include_bodies is true (they can be large or hold secrets), and only for blob refs the run's own events carry. verbose and include_bodies are independent.",
36458
36471
  inputSchema: {
36459
36472
  run_id: exports_external.string(),
36460
- include_bodies: exports_external.boolean().default(false).describe("Include rendered prompt/output/event bodies. Off by default.")
36473
+ verbose: exports_external.boolean().default(false).describe("Include the raw adapter.event rows (the CLI event stream). Off by default."),
36474
+ include_bodies: exports_external.boolean().default(false).describe("Resolve blob bodies (rendered prompts/outputs/events) for shown rows. Off by default.")
36461
36475
  }
36462
- }, async ({ run_id, include_bodies }) => {
36476
+ }, async ({ run_id, verbose, include_bodies }) => {
36463
36477
  try {
36464
- return jsonResult(showAudit(auditStore, run_id, include_bodies));
36478
+ return jsonResult(showAudit(auditStore, run_id, { includeBodies: include_bodies, verbose }));
36465
36479
  } catch (e) {
36466
36480
  return errorResult(e.message);
36467
36481
  }
@@ -36480,13 +36494,14 @@ var defaultIO2 = {
36480
36494
  var AUDIT_HELP = `chit audit <command> [options]
36481
36495
 
36482
36496
  list List audited runs, newest first.
36483
- show <runId> Show one run's event timeline.
36497
+ show <runId> Show one run as a receipt (summary, participants, timeline).
36484
36498
 
36485
36499
  list options:
36486
36500
  --json Emit the run summaries as JSON.
36487
36501
 
36488
36502
  show options:
36489
36503
  --json Emit the raw events as JSON.
36504
+ --verbose Include the raw adapter.event rows (the CLI event stream).
36490
36505
  --blobs, --include-bodies Print blob bodies (rendered prompts, outputs).
36491
36506
 
36492
36507
  Audited runs live under the local state dir (XDG_STATE_HOME or ~/.local/state,
@@ -36625,11 +36640,20 @@ participants (recorded config):
36625
36640
  io.out(`
36626
36641
  timeline:
36627
36642
  `);
36628
- for (const e of events2) {
36643
+ const rows = opts.verbose ? events2 : events2.filter(isReceiptEvent);
36644
+ for (const e of rows) {
36629
36645
  for (const line of renderEvent(store, runId, e, opts.blobs))
36630
36646
  io.out(` ${line}
36631
36647
  `);
36632
36648
  }
36649
+ if (!opts.verbose) {
36650
+ const hidden = hiddenAdapterEventCount(events2);
36651
+ if (hidden > 0) {
36652
+ io.out(`
36653
+ (${hidden} raw adapter events hidden; pass --verbose to include them.)
36654
+ `);
36655
+ }
36656
+ }
36633
36657
  return 0;
36634
36658
  }
36635
36659
  function parseAuditArgs(argv) {
@@ -36637,13 +36661,15 @@ function parseAuditArgs(argv) {
36637
36661
  if (sub !== "list" && sub !== "show") {
36638
36662
  throw new UsageError2(`unknown audit command ${JSON.stringify(sub ?? "")}`);
36639
36663
  }
36640
- const out = { command: sub, json: false, blobs: false };
36664
+ const out = { command: sub, json: false, blobs: false, verbose: false };
36641
36665
  for (let i = 1;i < argv.length; i++) {
36642
36666
  const a = argv[i];
36643
36667
  if (a === "--json")
36644
36668
  out.json = true;
36645
36669
  else if (a === "--blobs" || a === "--include-bodies")
36646
36670
  out.blobs = true;
36671
+ else if (a === "--verbose")
36672
+ out.verbose = true;
36647
36673
  else if (a !== undefined && !a.startsWith("--") && out.command === "show" && out.runId === undefined) {
36648
36674
  out.runId = a;
36649
36675
  } else {
@@ -36676,7 +36702,8 @@ ${AUDIT_HELP}`);
36676
36702
  return runList(store, io, parsed.json);
36677
36703
  return runShow(store, parsed.runId, io, {
36678
36704
  json: parsed.json,
36679
- blobs: parsed.blobs
36705
+ blobs: parsed.blobs,
36706
+ verbose: parsed.verbose
36680
36707
  });
36681
36708
  }
36682
36709
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chit-run/cli",
3
- "version": "0.3.1",
4
- "description": "A thin runtime for multi-agent workflows. Stop being the glue between your agents.",
3
+ "version": "0.4.1",
4
+ "description": "Versioned, cross-vendor agent routines with an audit trail. Stop being the glue between your agents.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "homepage": "https://chit.run",