@chit-run/cli 0.8.0 → 0.9.0

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 +56 -14
  2. package/package.json +1 -1
package/dist/chit.js CHANGED
@@ -1473,6 +1473,24 @@ var init_parse = __esm(() => {
1473
1473
  TEMPLATE_REF_RE = /\{\{\s*([\w.]+)\s*\}\}/g;
1474
1474
  });
1475
1475
  // ../../packages/core/src/show.ts
1476
+ function participantPermissionDisplay(p) {
1477
+ if (p.permissions.filesystem === "read_only") {
1478
+ return {
1479
+ filesystem: "read_only",
1480
+ readOnlyEnforcement: p.enforcesReadOnly ? "enforced" : "NOT ENFORCED",
1481
+ readOnlyEnforcementClass: p.enforcesReadOnly ? "ok" : "warn"
1482
+ };
1483
+ }
1484
+ return {
1485
+ filesystem: "write",
1486
+ readOnlyEnforcement: p.enforcesReadOnly ? "not requested (adapter supports)" : "not requested (adapter cannot enforce)",
1487
+ readOnlyEnforcementClass: "info"
1488
+ };
1489
+ }
1490
+ function participantPermissionText(p) {
1491
+ const display = participantPermissionDisplay(p);
1492
+ return `filesystem=${display.filesystem} read_only_enforcement=${display.readOnlyEnforcement}`;
1493
+ }
1476
1494
  function configPairs(c) {
1477
1495
  const pairs = [
1478
1496
  ["model", c.model ?? "default"],
@@ -1547,8 +1565,7 @@ function renderAscii(m) {
1547
1565
  out.push("");
1548
1566
  out.push("participants:");
1549
1567
  for (const [pid, p] of Object.entries(m.participants)) {
1550
- const enforces = p.enforcesReadOnly ? "enforces=yes" : "enforces=NO";
1551
- out.push(` ${pid} agent=${p.agentId} session=${p.session} permissions=${p.permissions.filesystem} adapter=${p.adapter} ${enforces}`);
1568
+ out.push(` ${pid} agent=${p.agentId} session=${p.session} ${participantPermissionText(p)} adapter=${p.adapter}`);
1552
1569
  if (p.adapter === "unknown") {
1553
1570
  out.push(" config unresolved (unknown agent)");
1554
1571
  } else {
@@ -1637,7 +1654,7 @@ function renderHtml(m) {
1637
1654
  levelColumns.push(renderLevelColumn(m, level));
1638
1655
  }
1639
1656
  const participantsSection = Object.entries(m.participants).map(([pid, p]) => {
1640
- const enforceBadge = p.enforcesReadOnly ? '<span class="badge ok">enforces read-only</span>' : '<span class="badge warn">does not enforce</span>';
1657
+ const permission = participantPermissionDisplay(p);
1641
1658
  const configBadges = p.adapter === "unknown" ? '<span class="badge warn">config: unresolved (unknown agent)</span>' : configPairs(p.config).map(([k, v]) => `<span class="badge info">${escapeHtml(k)}: ${escapeHtml(v)}</span>`).join(`
1642
1659
  `);
1643
1660
  return `<div class="participant">
@@ -1646,8 +1663,8 @@ function renderHtml(m) {
1646
1663
  <span class="badge info">agent: ${escapeHtml(p.agentId)}</span>
1647
1664
  <span class="badge info">adapter: ${escapeHtml(p.adapter)}</span>
1648
1665
  <span class="badge info">session: ${escapeHtml(p.session)}</span>
1649
- <span class="badge info">filesystem: ${escapeHtml(p.permissions.filesystem)}</span>
1650
- ${enforceBadge}
1666
+ <span class="badge info">filesystem: ${escapeHtml(permission.filesystem)}</span>
1667
+ <span class="badge ${permission.readOnlyEnforcementClass}">read_only enforcement: ${escapeHtml(permission.readOnlyEnforcement)}</span>
1651
1668
  </div>
1652
1669
  <div class="participant-config">
1653
1670
  ${configBadges}
@@ -36010,6 +36027,7 @@ class StdioServerTransport {
36010
36027
  }
36011
36028
 
36012
36029
  // src/audit/reader.ts
36030
+ init_src();
36013
36031
  var USAGE_KEYS2 = [
36014
36032
  "inputTokens",
36015
36033
  "outputTokens",
@@ -36107,6 +36125,30 @@ function listAudit(store, limit) {
36107
36125
  summaries.sort((a, b) => (b.startedAt ?? "").localeCompare(a.startedAt ?? ""));
36108
36126
  return limit !== undefined ? summaries.slice(0, limit) : summaries;
36109
36127
  }
36128
+ function receiptTimelineEvent(e) {
36129
+ if (e.type !== "run.started")
36130
+ return e;
36131
+ const { participants: _participants, ...rest } = e;
36132
+ return rest;
36133
+ }
36134
+ function participantReceipts(snapshots) {
36135
+ if (snapshots === undefined)
36136
+ return;
36137
+ return Object.fromEntries(Object.entries(snapshots).map(([pid, p]) => {
36138
+ const permission = participantPermissionDisplay(p);
36139
+ return [
36140
+ pid,
36141
+ {
36142
+ agentId: p.agentId,
36143
+ adapter: p.adapter,
36144
+ session: p.session,
36145
+ filesystem: permission.filesystem,
36146
+ readOnlyEnforcement: permission.readOnlyEnforcement,
36147
+ config: p.config
36148
+ }
36149
+ ];
36150
+ }));
36151
+ }
36110
36152
  function readBody(store, runId, ref) {
36111
36153
  try {
36112
36154
  return store.readBlob(runId, ref);
@@ -36123,21 +36165,22 @@ function hiddenAdapterEventCount(events2) {
36123
36165
  function auditTimeline(store, runId, events2, opts) {
36124
36166
  const rows = opts.verbose ? events2 : events2.filter(isReceiptEvent);
36125
36167
  return rows.map((e) => {
36168
+ const row = receiptTimelineEvent(e);
36126
36169
  if (!opts.includeBodies)
36127
- return e;
36170
+ return row;
36128
36171
  if (e.type === "adapter.call.started") {
36129
- return { ...e, input: readBody(store, runId, e.inputBlob) };
36172
+ return { ...row, input: readBody(store, runId, e.inputBlob) };
36130
36173
  }
36131
36174
  if (e.type === "adapter.event" && e.rawBlob !== undefined) {
36132
- return { ...e, raw: readBody(store, runId, e.rawBlob) };
36175
+ return { ...row, raw: readBody(store, runId, e.rawBlob) };
36133
36176
  }
36134
36177
  if (e.type === "adapter.call.completed") {
36135
- return { ...e, output: readBody(store, runId, e.outputBlob) };
36178
+ return { ...row, output: readBody(store, runId, e.outputBlob) };
36136
36179
  }
36137
36180
  if (e.type === "step.completed" && e.outputBlob !== undefined) {
36138
- return { ...e, output: readBody(store, runId, e.outputBlob) };
36181
+ return { ...row, output: readBody(store, runId, e.outputBlob) };
36139
36182
  }
36140
- return e;
36183
+ return row;
36141
36184
  });
36142
36185
  }
36143
36186
  function showAudit(store, runId, opts) {
@@ -36151,7 +36194,7 @@ function showAudit(store, runId, opts) {
36151
36194
  out.incompleteReason = describeIncomplete(summary, events2);
36152
36195
  const started = events2.find((e) => e.type === "run.started");
36153
36196
  if (started?.type === "run.started" && started.participants !== undefined) {
36154
- out.participants = started.participants;
36197
+ out.participants = participantReceipts(started.participants);
36155
36198
  }
36156
36199
  if (!opts.verbose) {
36157
36200
  const hidden = hiddenAdapterEventCount(events2);
@@ -37459,8 +37502,7 @@ participants (recorded config):
37459
37502
  `);
37460
37503
  } else {
37461
37504
  for (const [pid, p] of Object.entries(snapshots)) {
37462
- const enforces = p.enforcesReadOnly ? "enforces=yes" : "enforces=NO";
37463
- io.out(` ${pid} agent=${p.agentId} session=${p.session} permissions=${p.permissions.filesystem} adapter=${p.adapter} ${enforces}
37505
+ io.out(` ${pid} agent=${p.agentId} session=${p.session} ${participantPermissionText(p)} adapter=${p.adapter}
37464
37506
  `);
37465
37507
  const pairs = p.adapter === "unknown" ? "unresolved (unknown agent)" : configPairs(p.config).map(([k, v]) => `${k}=${v}`).join(" ");
37466
37508
  io.out(` config ${pairs}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chit-run/cli",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
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",