@drisp/cli 0.5.0 → 0.5.2

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  startDaemon
4
- } from "./chunk-SHLHZL5F.js";
4
+ } from "./chunk-LKLNEXTK.js";
5
5
  import "./chunk-MRAM6EYI.js";
6
6
  import {
7
7
  resolveGatewayPaths,
@@ -176,7 +176,18 @@ function createInstanceSocketClient(opts) {
176
176
  function sendFeedEvent(event) {
177
177
  send({ type: "feed_event", ...event });
178
178
  }
179
- return { connect, close, onFrame, onClose, sendRunEvent, sendFeedEvent };
179
+ function sendDecisionAck(input) {
180
+ send({ type: "decision_ack", ...input });
181
+ }
182
+ return {
183
+ connect,
184
+ close,
185
+ onFrame,
186
+ onClose,
187
+ sendRunEvent,
188
+ sendFeedEvent,
189
+ sendDecisionAck
190
+ };
180
191
  }
181
192
 
182
193
  // src/infra/daemon/pidLock.ts
@@ -392,4 +403,4 @@ export {
392
403
  acquirePidLock,
393
404
  readPidLock
394
405
  };
395
- //# sourceMappingURL=chunk-ZVOGOZNT.js.map
406
+ //# sourceMappingURL=chunk-JV7CRNTC.js.map
@@ -2240,7 +2240,7 @@ var cachedVersion = null;
2240
2240
  function readVersion() {
2241
2241
  if (cachedVersion !== null) return cachedVersion;
2242
2242
  try {
2243
- const injected = "0.5.0";
2243
+ const injected = "0.5.2";
2244
2244
  if (typeof injected === "string" && injected.length > 0) {
2245
2245
  cachedVersion = injected;
2246
2246
  return cachedVersion;
@@ -4121,4 +4121,4 @@ async function startDaemon(opts) {
4121
4121
  export {
4122
4122
  startDaemon
4123
4123
  };
4124
- //# sourceMappingURL=chunk-SHLHZL5F.js.map
4124
+ //# sourceMappingURL=chunk-LKLNEXTK.js.map
@@ -16,7 +16,7 @@ import {
16
16
  import {
17
17
  createInstanceSocketClient,
18
18
  writeAttachmentMirror
19
- } from "./chunk-ZVOGOZNT.js";
19
+ } from "./chunk-JV7CRNTC.js";
20
20
  import {
21
21
  TransportUnreachableError,
22
22
  createUdsClientTransport,
@@ -12588,6 +12588,10 @@ function createDashboardPairedExecution(options) {
12588
12588
  decision: frame.decision,
12589
12589
  receivedAt: now()
12590
12590
  });
12591
+ client.sendDecisionAck({
12592
+ athenaSessionId: frame.athenaSessionId,
12593
+ requestId: frame.requestId
12594
+ });
12591
12595
  }
12592
12596
  function handleCancel(frame) {
12593
12597
  const entry = active.get(frame.runId);
@@ -12732,6 +12736,7 @@ async function runDashboardRuntimeDaemon(options = {}) {
12732
12736
  const feedOutbox = options.feedOutbox ?? createDashboardFeedOutbox();
12733
12737
  const decisionInbox = options.decisionInbox ?? createDashboardDecisionInbox();
12734
12738
  const feedDrainIntervalMs = options.feedDrainIntervalMs ?? DEFAULT_FEED_DRAIN_INTERVAL_MS;
12739
+ const retryInitialConnect = options.retryInitialConnect ?? true;
12735
12740
  const startedAt = now();
12736
12741
  let stopped = false;
12737
12742
  let reconnectAttempt = 0;
@@ -12755,6 +12760,11 @@ async function runDashboardRuntimeDaemon(options = {}) {
12755
12760
  return;
12756
12761
  }
12757
12762
  current.sendRunEvent(event);
12763
+ },
12764
+ sendDecisionAck(input) {
12765
+ const current = client;
12766
+ if (!current) return;
12767
+ current.sendDecisionAck(input);
12758
12768
  }
12759
12769
  };
12760
12770
  const pairedExecution = createDashboardPairedExecution({
@@ -12950,7 +12960,18 @@ async function runDashboardRuntimeDaemon(options = {}) {
12950
12960
  }
12951
12961
  }
12952
12962
  }
12953
- await connectOnce();
12963
+ try {
12964
+ await connectOnce();
12965
+ } catch (err) {
12966
+ if (!retryInitialConnect) {
12967
+ throw err;
12968
+ }
12969
+ log(
12970
+ "warn",
12971
+ `dashboard runtime daemon initial connect failed: ${err instanceof Error ? err.message : String(err)}`
12972
+ );
12973
+ void reconnectLoop();
12974
+ }
12954
12975
  return {
12955
12976
  snapshot() {
12956
12977
  const executionSnapshot = pairedExecution.snapshot();
@@ -13259,4 +13280,4 @@ export {
13259
13280
  startUdsServer,
13260
13281
  sendUdsRequest
13261
13282
  };
13262
- //# sourceMappingURL=chunk-K53YMYTG.js.map
13283
+ //# sourceMappingURL=chunk-PC46SGTK.js.map
package/dist/cli.js CHANGED
@@ -68,7 +68,7 @@ import {
68
68
  todoGlyphSet,
69
69
  writeGatewayClientConfig,
70
70
  wsClientOptionsForEndpoint
71
- } from "./chunk-K53YMYTG.js";
71
+ } from "./chunk-PC46SGTK.js";
72
72
  import {
73
73
  generateId as generateId2
74
74
  } from "./chunk-BTKQ67RE.js";
@@ -80,7 +80,7 @@ import {
80
80
  readPidLock,
81
81
  removeAttachmentMirror,
82
82
  writeAttachmentMirror
83
- } from "./chunk-ZVOGOZNT.js";
83
+ } from "./chunk-JV7CRNTC.js";
84
84
  import {
85
85
  dashboardClientConfigPath,
86
86
  disableTelemetry,
@@ -10680,6 +10680,22 @@ function deriveStatus(currentRun, runSummaries, errorReason) {
10680
10680
  if (last.status === "SUCCEEDED") return "idle";
10681
10681
  return "idle";
10682
10682
  }
10683
+ function isCodexHarness(input) {
10684
+ const rawHarness = input.harness?.toLowerCase() ?? "";
10685
+ const rawAgentType = input.session?.agent_type?.toLowerCase() ?? "";
10686
+ return rawHarness.includes("codex") || rawAgentType.includes("codex");
10687
+ }
10688
+ function countDistinctTurnIds(events) {
10689
+ const turnIds = /* @__PURE__ */ new Set();
10690
+ for (const event of events) {
10691
+ const data = typeof event.data === "object" && event.data !== null ? event.data : {};
10692
+ const turnId = data["turn_id"];
10693
+ if (typeof turnId === "string" && turnId.length > 0) {
10694
+ turnIds.add(turnId);
10695
+ }
10696
+ }
10697
+ return turnIds.size;
10698
+ }
10683
10699
  function buildHeaderModel(input) {
10684
10700
  const {
10685
10701
  session,
@@ -10698,6 +10714,7 @@ function buildHeaderModel(input) {
10698
10714
  Math.max(1, Math.trunc(input.sessionIndex ?? sessionTotal)),
10699
10715
  sessionTotal
10700
10716
  ) : null;
10717
+ const codexHarness = isCodexHarness(input);
10701
10718
  return {
10702
10719
  session_id: session?.session_id ?? "\u2013",
10703
10720
  session_index: sessionIndex,
@@ -10707,7 +10724,9 @@ function buildHeaderModel(input) {
10707
10724
  model_name: input.modelName ?? null,
10708
10725
  context: { used: input.contextUsed ?? null, max: input.contextMax ?? null },
10709
10726
  total_tokens: input.totalTokens ?? null,
10710
- run_count: input.runCount ?? 0,
10727
+ token_label: codexHarness ? "Billable" : "Tokens",
10728
+ run_count: codexHarness ? input.turnCount ?? input.runCount ?? 0 : input.runCount ?? 0,
10729
+ run_label: codexHarness ? "Turns" : "Runs",
10711
10730
  engine: session?.agent_type,
10712
10731
  progress: todoPanel.todoItems.length > 0 ? { done: todoPanel.doneCount, total: todoPanel.todoItems.length } : void 0,
10713
10732
  status,
@@ -10720,6 +10739,11 @@ function buildHeaderModel(input) {
10720
10739
  function formatTokenCount(value) {
10721
10740
  if (value === null) return "--";
10722
10741
  if (value < 1e3) return String(value);
10742
+ if (value >= 1e6) {
10743
+ const m = value / 1e6;
10744
+ if (Number.isInteger(m)) return `${m}m`;
10745
+ return `${parseFloat(m.toFixed(1))}m`;
10746
+ }
10723
10747
  const k = value / 1e3;
10724
10748
  if (Number.isInteger(k)) return `${k}k`;
10725
10749
  return `${parseFloat(k.toFixed(1))}k`;
@@ -10907,6 +10931,8 @@ function renderHeaderLines(model, width, hasColor, theme) {
10907
10931
  const wfText = `${style("Workflow: ", palette.label)}${style(model.workflow, palette.value)}`;
10908
10932
  const harnessText = `${style("Harness: ", palette.label)}${style(model.harness, palette.value)}`;
10909
10933
  const modelText = `${style("Model: ", palette.label)}${style(formatModelName(model.model_name), palette.value)}`;
10934
+ const tokenLabel = model.token_label ?? "Tokens";
10935
+ const runLabel = model.run_label ?? "Runs";
10910
10936
  const leftTokens = [
10911
10937
  { text: athena, priority: 100 },
10912
10938
  { text: divider, priority: 5 },
@@ -10917,14 +10943,14 @@ function renderHeaderLines(model, width, hasColor, theme) {
10917
10943
  // Token count (e.g., "Tokens: 45.2k")
10918
10944
  ...model.total_tokens !== null ? [
10919
10945
  {
10920
- text: `${style("Tokens: ", palette.label)}${style(formatTokenCount(model.total_tokens), palette.value)}`,
10946
+ text: `${style(`${tokenLabel}: `, palette.label)}${style(formatTokenCount(model.total_tokens), palette.value)}`,
10921
10947
  priority: 40
10922
10948
  }
10923
10949
  ] : [],
10924
10950
  // Run count (e.g., "Runs: 3")
10925
10951
  ...model.run_count > 0 ? [
10926
10952
  {
10927
- text: `${style("Runs: ", palette.label)}${style(String(model.run_count), palette.value)}`,
10953
+ text: `${style(`${runLabel}: `, palette.label)}${style(String(model.run_count), palette.value)}`,
10928
10954
  priority: 50
10929
10955
  }
10930
10956
  ] : []
@@ -13520,6 +13546,10 @@ function AppContent({
13520
13546
  verbose
13521
13547
  });
13522
13548
  const { runSummaries, filteredEntries, searchMatches, getEntrySearchText } = timeline;
13549
+ const codexTurnCount = useMemo17(
13550
+ () => countDistinctTurnIds(feedEvents),
13551
+ [feedEvents]
13552
+ );
13523
13553
  const todoPanel = useTodoPanel({
13524
13554
  tasks,
13525
13555
  isWorking: appMode.type === "working",
@@ -14209,6 +14239,7 @@ function AppContent({
14209
14239
  contextMax: tokenUsage.contextWindowSize,
14210
14240
  totalTokens: tokenUsage.total,
14211
14241
  runCount: runSummaries.length,
14242
+ turnCount: codexTurnCount,
14212
14243
  sessionIndex: sessionScope.current,
14213
14244
  sessionTotal: sessionScope.total,
14214
14245
  harness,
@@ -14222,6 +14253,7 @@ function AppContent({
14222
14253
  sessionAgentType,
14223
14254
  timelineCurrentRun,
14224
14255
  runSummaries,
14256
+ codexTurnCount,
14225
14257
  metrics.failures,
14226
14258
  metrics.blocks,
14227
14259
  todoPanel.doneCount,
@@ -16020,7 +16052,7 @@ var cachedVersion = null;
16020
16052
  function readPackageVersion() {
16021
16053
  if (cachedVersion !== null) return cachedVersion;
16022
16054
  try {
16023
- const injected = "0.5.0";
16055
+ const injected = "0.5.2";
16024
16056
  if (typeof injected === "string" && injected.length > 0) {
16025
16057
  cachedVersion = injected;
16026
16058
  return cachedVersion;
@@ -16494,6 +16526,7 @@ async function runDashboardCommand(input, deps = {}) {
16494
16526
  refreshAccessToken: async () => performRefreshImpl("connect"),
16495
16527
  makeInstanceSocketClient: deps.makeInstanceSocketClient,
16496
16528
  executeRemoteAssignment: deps.executeRemoteAssignment,
16529
+ retryInitialConnect: false,
16497
16530
  log: (level, message) => {
16498
16531
  if (level === "error" || level === "warn") {
16499
16532
  logError(`dashboard daemon: ${message}`);
@@ -2,14 +2,14 @@ import {
2
2
  ensureDaemonStateDir,
3
3
  runDashboardRuntimeDaemon,
4
4
  startUdsServer
5
- } from "./chunk-K53YMYTG.js";
5
+ } from "./chunk-PC46SGTK.js";
6
6
  import "./chunk-BTKQ67RE.js";
7
7
  import {
8
8
  openDaemonLog
9
9
  } from "./chunk-2OJ3GGIP.js";
10
10
  import {
11
11
  acquirePidLock
12
- } from "./chunk-ZVOGOZNT.js";
12
+ } from "./chunk-JV7CRNTC.js";
13
13
  import {
14
14
  readDashboardClientConfig,
15
15
  refreshDashboardAccessToken
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  startDaemon
4
- } from "./chunk-SHLHZL5F.js";
4
+ } from "./chunk-LKLNEXTK.js";
5
5
  import "./chunk-MRAM6EYI.js";
6
6
  import {
7
7
  openDaemonLog
@@ -11,7 +11,7 @@ import {
11
11
  attachmentMirrorPath,
12
12
  createInstanceSocketClient,
13
13
  readAttachmentMirror
14
- } from "./chunk-ZVOGOZNT.js";
14
+ } from "./chunk-JV7CRNTC.js";
15
15
  import {
16
16
  readDashboardClientConfig,
17
17
  refreshDashboardAccessToken,
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "hooks",
18
18
  "dashboard"
19
19
  ],
20
- "version": "0.5.0",
20
+ "version": "0.5.2",
21
21
  "license": "MIT",
22
22
  "bin": {
23
23
  "athena": "dist/cli.js",