@promptbook/cli 0.114.0-39 → 0.114.0-40

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,28 +1,22 @@
1
1
  Developer
2
2
 
3
-
4
-
5
3
  META VISUAL ascii-octopus
6
4
  META VISIBILITY PRIVATE
7
5
 
8
- RULE
9
- Keep in mind the DRY _(don't repeat yourself)_ principle.
10
-
11
- RULE
12
- Keep in mind the SOLID principles.
6
+ GOAL Implement best practices and coding standards for the development process.
13
7
 
14
- RULE
15
- Do a proper analysis of the current functionality before you start implementing.
8
+ KNOWLEDGE https://github.com/webgptorg/promptbook
9
+ KNOWLEDGE ./AGENTS.md
16
10
 
17
- RULE
18
- Keep small responsibilities of functions and classes, avoid creating big functions or classes that do many things.
19
-
20
- RULE
21
- Constants should always be `UPPER_SNAKE_CASE`.
11
+ RULE Keep in mind the DRY _(don't repeat yourself)_ principle.
12
+ RULE Keep in mind the SOLID principles.
13
+ RULE Do a proper analysis of the current functionality before you start implementing.
14
+ RULE Keep small responsibilities of functions and classes, avoid creating big functions or classes that do many things.
15
+ RULE Constants should always be `UPPER_SNAKE_CASE`.
16
+ RULE Boolean variables should always be prefixed with `is`, for example `isUserChatJobLeaseExpired` or `IS_DEBUG_MODE`.
17
+ RULE Do not use abbreviations, for example use `isExpired` instead of `isExp`, `translateMessage` instead of `t`, etc.
18
+ It is fine to use well-known abbreviations, for example `id`, `url`, `html`, etc.
22
19
 
23
- RULE
24
- Boolean variables should always be prefixed with `is`, for example `isUserChatJobLeaseExpired` or `IS_DEBUG_MODE`.
20
+ WRITING RULE Do not use long dashes (em-dashes); use a standard hyphen ("-") instead.
25
21
 
26
- RULE
27
- Do not use abbreviations, for example use `isExpired` instead of `isExp`, `translateMessage` instead of `t`, etc.
28
- It is fine to use well-known abbreviations, for example `id`, `url`, `html`, etc.
22
+ CLOSED
package/esm/index.es.js CHANGED
@@ -15,7 +15,6 @@ import { forTime, forEver } from 'waitasecond';
15
15
  import hexEncoder from 'crypto-js/enc-hex';
16
16
  import sha256 from 'crypto-js/sha256';
17
17
  import CryptoJS from 'crypto-js';
18
- import glob from 'glob-promise';
19
18
  import http, { createServer } from 'http';
20
19
  import express from 'express';
21
20
  import { Server } from 'socket.io';
@@ -26,6 +25,7 @@ import { renderToStaticMarkup } from 'react-dom/server';
26
25
  import Bottleneck from 'bottleneck';
27
26
  import showdown from 'showdown';
28
27
  import { Subject, BehaviorSubject } from 'rxjs';
28
+ import { glob } from 'glob';
29
29
  import ignore from 'ignore';
30
30
  import { EventEmitter } from 'events';
31
31
  import { tmpdir } from 'os';
@@ -48,7 +48,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
48
48
  * @generated
49
49
  * @see https://github.com/webgptorg/promptbook
50
50
  */
51
- const PROMPTBOOK_ENGINE_VERSION = '0.114.0-39';
51
+ const PROMPTBOOK_ENGINE_VERSION = '0.114.0-40';
52
52
  /**
53
53
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
54
54
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -25074,6 +25074,28 @@ function formatDurationMs(ms) {
25074
25074
  return parts.join(' ');
25075
25075
  }
25076
25076
 
25077
+ /**
25078
+ * Creates a line reader for one shell output stream.
25079
+ *
25080
+ * A chunk boundary can fall into the middle of a line, so the unterminated rest is remembered until the next chunk
25081
+ * completes it. Every observer of the live output therefore sees whole lines only, exactly as the finished output
25082
+ * would contain them. One reader belongs to one stream, because interleaving `stdout` and `stderr` into a single
25083
+ * buffer would splice two unrelated halves into one nonexistent line.
25084
+ *
25085
+ * @private internal utility of the script runners
25086
+ */
25087
+ function createScriptOutputLineReader() {
25088
+ let unterminatedLine = '';
25089
+ return {
25090
+ readCompletedLines(chunk) {
25091
+ var _a;
25092
+ const lines = `${unterminatedLine}${chunk}`.split(/\r?\n/);
25093
+ unterminatedLine = (_a = lines.pop()) !== null && _a !== void 0 ? _a : '';
25094
+ return lines;
25095
+ },
25096
+ };
25097
+ }
25098
+
25077
25099
  /**
25078
25100
  * Converts a file path to POSIX format.
25079
25101
  */
@@ -25298,6 +25320,10 @@ async function runBashScriptWithOutput(options) {
25298
25320
  scriptPath: options.scriptPath,
25299
25321
  logPath: options.logPath,
25300
25322
  });
25323
+ const outputLineReaders = {
25324
+ stdout: createScriptOutputLineReader(),
25325
+ stderr: createScriptOutputLineReader(),
25326
+ };
25301
25327
  let output = '';
25302
25328
  let settled = false;
25303
25329
  let isSettling = false;
@@ -25334,16 +25360,19 @@ async function runBashScriptWithOutput(options) {
25334
25360
  settleOnce(handler);
25335
25361
  });
25336
25362
  };
25337
- commandProcess.stdout.on('data', (stdout) => {
25338
- const chunk = stdout.toString();
25339
- output += chunk;
25340
- printLiveScriptChunk(chunk, 'stdout', shouldPrintLiveOutput);
25341
- });
25342
- commandProcess.stderr.on('data', (stderr) => {
25343
- const chunk = stderr.toString();
25363
+ /**
25364
+ * Accumulates one output chunk and reports the lines it completed.
25365
+ */
25366
+ const handleChunk = (chunk, source) => {
25367
+ var _a;
25344
25368
  output += chunk;
25345
- printLiveScriptChunk(chunk, 'stderr', shouldPrintLiveOutput);
25346
- });
25369
+ printLiveScriptChunk(chunk, source, shouldPrintLiveOutput);
25370
+ for (const line of outputLineReaders[source].readCompletedLines(chunk)) {
25371
+ (_a = options.onOutputLine) === null || _a === void 0 ? void 0 : _a.call(options, line);
25372
+ }
25373
+ };
25374
+ commandProcess.stdout.on('data', (stdout) => handleChunk(stdout.toString(), 'stdout'));
25375
+ commandProcess.stderr.on('data', (stderr) => handleChunk(stderr.toString(), 'stderr'));
25347
25376
  /**
25348
25377
  * Handles process exit and resolves or rejects accordingly.
25349
25378
  */
@@ -26209,6 +26238,10 @@ function resolveClaudeCodeResetTimestamp(rateLimitInfo) {
26209
26238
  * Polling interval used while waiting for Claude Code session limits to reset.
26210
26239
  */
26211
26240
  const CLAUDE_CODE_SESSION_RESURRECTION_POLL_MS = 30 * 1000;
26241
+ /**
26242
+ * Stream event type which carries a Claude Code subscription-limit update.
26243
+ */
26244
+ const CLAUDE_CODE_RATE_LIMIT_EVENT_TYPE = 'rate_limit_event';
26212
26245
  /**
26213
26246
  * Runs prompts via the Claude Code CLI.
26214
26247
  */
@@ -26223,7 +26256,9 @@ class ClaudeCodeRunner {
26223
26256
  /**
26224
26257
  * Returns the latest subscription-limit snapshot emitted by this Claude Code session.
26225
26258
  *
26226
- * Claude exposes these values in the normal stream after a response, so no separate quota-only model call is made.
26259
+ * Claude exposes these values in the normal stream, so no separate quota-only model call is made. The snapshot is
26260
+ * kept current while the prompt is still running, which is what lets the dashboard poll it instead of showing the
26261
+ * values of the previous prompt for the whole round.
26227
26262
  */
26228
26263
  async getSubscriptionUsage() {
26229
26264
  return this.subscriptionUsage;
@@ -26284,8 +26319,22 @@ class ClaudeCodeRunner {
26284
26319
  logPath: options.logPath,
26285
26320
  shouldPrintLiveOutput: options.shouldPrintLiveOutput,
26286
26321
  preserveArtifactsOnSuccess: options.preserveArtifactsOnSuccess,
26322
+ onOutputLine: (line) => this.updateSubscriptionUsageFromOutputLine(line),
26287
26323
  });
26288
26324
  }
26325
+ /**
26326
+ * Keeps the snapshot current from one line of the stream which is still being written.
26327
+ *
26328
+ * A coding prompt can run for hours, and a subscription window keeps moving during all of it. Only a rate-limit
26329
+ * event can change the snapshot, so the far more frequent tool and message lines are recognized by their type and
26330
+ * skipped before anything is parsed.
26331
+ */
26332
+ updateSubscriptionUsageFromOutputLine(line) {
26333
+ if (!line.includes(CLAUDE_CODE_RATE_LIMIT_EVENT_TYPE)) {
26334
+ return;
26335
+ }
26336
+ this.updateSubscriptionUsage(line);
26337
+ }
26289
26338
  /**
26290
26339
  * Keeps the newest usable Claude subscription-limit values reported by the stream.
26291
26340
  *
@@ -26946,8 +26995,10 @@ async function runScriptUntilMarkerIdle(options) {
26946
26995
  scriptPath,
26947
26996
  logPath: options.logPath,
26948
26997
  });
26949
- let stdoutBuffer = '';
26950
- let stderrBuffer = '';
26998
+ const outputLineReaders = {
26999
+ stdout: createScriptOutputLineReader(),
27000
+ stderr: createScriptOutputLineReader(),
27001
+ };
26951
27002
  let fullOutput = '';
26952
27003
  let markerSeen = false;
26953
27004
  let isCompletedAfterIdleTimeout = false;
@@ -27017,7 +27068,9 @@ async function runScriptUntilMarkerIdle(options) {
27017
27068
  * Processes completed output lines to detect completion markers.
27018
27069
  */
27019
27070
  const handleLines = (lines) => {
27071
+ var _a;
27020
27072
  for (const line of lines) {
27073
+ (_a = options.onOutputLine) === null || _a === void 0 ? void 0 : _a.call(options, line);
27021
27074
  if (completionLineMatcher.test(line)) {
27022
27075
  markerSeen = true;
27023
27076
  scheduleIdleExit();
@@ -27032,21 +27085,9 @@ async function runScriptUntilMarkerIdle(options) {
27032
27085
  * Handles output chunks from stdout or stderr.
27033
27086
  */
27034
27087
  const handleChunk = (chunk, source) => {
27035
- var _a, _b;
27036
27088
  fullOutput += chunk;
27037
27089
  printLiveScriptChunk(chunk, source, shouldPrintLiveOutput);
27038
- if (source === 'stdout') {
27039
- stdoutBuffer += chunk;
27040
- const lines = stdoutBuffer.split(/\r?\n/);
27041
- stdoutBuffer = (_a = lines.pop()) !== null && _a !== void 0 ? _a : '';
27042
- handleLines(lines);
27043
- }
27044
- else {
27045
- stderrBuffer += chunk;
27046
- const lines = stderrBuffer.split(/\r?\n/);
27047
- stderrBuffer = (_b = lines.pop()) !== null && _b !== void 0 ? _b : '';
27048
- handleLines(lines);
27049
- }
27090
+ handleLines(outputLineReaders[source].readCompletedLines(chunk));
27050
27091
  if (markerSeen && chunk.length > 0) {
27051
27092
  scheduleIdleExit();
27052
27093
  }
@@ -27108,6 +27149,7 @@ async function $runGoScriptUntilMarkerIdle(options) {
27108
27149
  idleTimeoutMs: options.idleTimeoutMs,
27109
27150
  logPath: options.logPath,
27110
27151
  shouldPrintLiveOutput: options.shouldPrintLiveOutput,
27152
+ onOutputLine: options.onOutputLine,
27111
27153
  });
27112
27154
  });
27113
27155
  }
@@ -56059,6 +56101,29 @@ async function prettifyPipelineString(pipelineString, options) {
56059
56101
  // TODO: Maybe use some Mermaid package instead of string templating
56060
56102
  // TODO: [🕌] When more than 2 functionalities, split into separate functions
56061
56103
 
56104
+ /**
56105
+ * Finds all filenames matching a glob pattern
56106
+ *
56107
+ * Note: This is the single place where `glob` is used, so that every caller gets the same shape of results
56108
+ * on every operating system - POSIX separators and a stable order - which `glob` itself does not guarantee
56109
+ *
56110
+ * @param pattern Glob pattern to match, for example `./src/**\/*.ts`
56111
+ * @param options Options passed to `glob`
56112
+ * @returns Matching filenames with `/` separators, sorted alphabetically
56113
+ * @private within the repository
56114
+ */
56115
+ async function findFilesByGlob(pattern, options = {}) {
56116
+ const { ignore, ...restOptions } = options;
56117
+ const matchedFilenames = await glob(pattern, {
56118
+ ...restOptions,
56119
+ ignore: typeof ignore === 'string' || ignore === undefined ? ignore : [...ignore],
56120
+ });
56121
+ return matchedFilenames
56122
+ .map((matchedFilename) => matchedFilename.split('\\').join('/'))
56123
+ .sort((filenameA, filenameB) => filenameA.localeCompare(filenameB, 'en'));
56124
+ }
56125
+ // Note: Not [~🟢~] because it is not directly dependent on `fs`, same as `listAllFiles`
56126
+
56062
56127
  /**
56063
56128
  * Initializes `prettify` command for Promptbook CLI utilities
56064
56129
  *
@@ -56080,7 +56145,7 @@ function $initializePrettifyCommand(program) {
56080
56145
  prettifyCommand.option('-i, --ignore <glob>', `Ignore as glob pattern`);
56081
56146
  prettifyCommand.action(handleActionErrors(async (filesGlob, cliOptions) => {
56082
56147
  const { ignore, verbose: isVerbose } = cliOptions;
56083
- const filenames = await glob(filesGlob, { ignore });
56148
+ const filenames = await findFilesByGlob(filesGlob, { ignore });
56084
56149
  // <- TODO: [😶]
56085
56150
  for (const filename of filenames) {
56086
56151
  if (!filename.endsWith('.book') && isVerbose) {
@@ -58912,7 +58977,7 @@ function $initializeTestCommand(program) {
58912
58977
  };
58913
58978
  }
58914
58979
  const ignore = ignoreRaw.split(',').map((pattern) => pattern.trim());
58915
- const filenames = await glob(filesGlob, { ignore });
58980
+ const filenames = await findFilesByGlob(filesGlob, { ignore });
58916
58981
  // <- TODO: [😶]
58917
58982
  // console.log({ filesGlob, ignore, filenames });
58918
58983
  // await forTime(1000000);
@@ -74185,7 +74250,7 @@ async function getPromptNumbering(options) {
74185
74250
  const month = (now.getMonth() + 1).toString().padStart(2, '0');
74186
74251
  const datePrefix = `${year}-${month}`;
74187
74252
  const step = (_b = options.step) !== null && _b !== void 0 ? _b : 10;
74188
- const promptFiles = await glob('**/*.md', {
74253
+ const promptFiles = await findFilesByGlob('**/*.md', {
74189
74254
  cwd: options.promptsDir,
74190
74255
  ignore: options.ignoreGlobs,
74191
74256
  nodir: true,
@@ -74331,7 +74396,7 @@ async function scanEmojiTagUsage(options) {
74331
74396
  async function findFilesToScan(rootDir, includeGlobs, ignoreGlobs) {
74332
74397
  const files = new Set();
74333
74398
  for (const pattern of includeGlobs) {
74334
- const matches = await glob(pattern, {
74399
+ const matches = await findFilesByGlob(pattern, {
74335
74400
  cwd: rootDir,
74336
74401
  ignore: Array.from(new Set([...ignoreGlobs, ...DEFAULT_IGNORE_GLOBS])),
74337
74402
  nodir: true,
@@ -75081,7 +75146,7 @@ async function listSourceFiles(rootDir, isIgnoredRelativePath) {
75081
75146
  const patterns = [...SOURCE_ROOTS.map((root) => `${root}/**/*.${extensionGlob}`), `*.${extensionGlob}`];
75082
75147
  const files = new Set();
75083
75148
  for (const pattern of patterns) {
75084
- const matches = await glob(pattern, {
75149
+ const matches = await findFilesByGlob(pattern, {
75085
75150
  cwd: rootDir,
75086
75151
  ignore: SOURCE_FILE_IGNORE_GLOBS,
75087
75152
  nodir: true,
@@ -75104,7 +75169,7 @@ async function listSourceFiles(rootDir, isIgnoredRelativePath) {
75104
75169
  async function buildExemptPathSet(rootDir, patterns, isIgnoredRelativePath) {
75105
75170
  const exemptPaths = new Set();
75106
75171
  for (const pattern of patterns) {
75107
- const matches = await glob(pattern, {
75172
+ const matches = await findFilesByGlob(pattern, {
75108
75173
  cwd: rootDir,
75109
75174
  ignore: SOURCE_FILE_IGNORE_GLOBS,
75110
75175
  nodir: true,
@@ -75149,7 +75214,7 @@ async function loadExistingPromptTargets(promptsDir) {
75149
75214
  if (!existsSync(promptsDir)) {
75150
75215
  return new Set();
75151
75216
  }
75152
- const promptFiles = await glob('**/*.md', {
75217
+ const promptFiles = await findFilesByGlob('**/*.md', {
75153
75218
  cwd: promptsDir,
75154
75219
  nodir: true,
75155
75220
  });
@@ -80067,30 +80132,6 @@ async function readPromptRuntimeLog(logPath) {
80067
80132
  }
80068
80133
  }
80069
80134
 
80070
- /**
80071
- * Refreshes optional harness subscription usage in the shared coder-run UI state.
80072
- *
80073
- * Subscription visibility is an enhancement, not a prerequisite for running prompts. A harness which cannot expose a
80074
- * snapshot, or whose account endpoint is temporarily unavailable, therefore leaves the existing dashboard unchanged.
80075
- *
80076
- * @private internal utility of coder run UI
80077
- */
80078
- async function refreshCoderRunUiSubscriptionUsage(options) {
80079
- const { runner, uiState } = options;
80080
- if (!uiState || !runner.getSubscriptionUsage) {
80081
- return;
80082
- }
80083
- try {
80084
- const subscriptionUsage = await runner.getSubscriptionUsage();
80085
- if (subscriptionUsage) {
80086
- uiState.setSubscriptionUsage(subscriptionUsage);
80087
- }
80088
- }
80089
- catch (_a) {
80090
- // A current subscription snapshot must never interrupt the coding queue.
80091
- }
80092
- }
80093
-
80094
80135
  /**
80095
80136
  * Maximum number of retry attempts performed after a prompt round throws an error.
80096
80137
  * After this many retries the round is finalized as failed.
@@ -80164,10 +80205,6 @@ async function runPromptRound({ options, runner, runnerMetadata, nextPrompt, pro
80164
80205
  }),
80165
80206
  waitForPauseCheckpoint: waitForRequestedPause,
80166
80207
  });
80167
- await refreshCoderRunUiSubscriptionUsage({
80168
- runner,
80169
- uiState: uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state,
80170
- });
80171
80208
  await finalizeSuccessfulPromptRound({
80172
80209
  options,
80173
80210
  nextPrompt,
@@ -81294,6 +81331,80 @@ async function createOptionalNodeCanvasFactory() {
81294
81331
  }
81295
81332
  }
81296
81333
 
81334
+ /**
81335
+ * Refreshes optional harness subscription usage in the shared coder-run UI state.
81336
+ *
81337
+ * Subscription visibility is an enhancement, not a prerequisite for running prompts. A harness which cannot expose a
81338
+ * snapshot, or whose account endpoint is temporarily unavailable, therefore leaves the existing dashboard unchanged.
81339
+ *
81340
+ * @private internal utility of coder run UI
81341
+ */
81342
+ async function refreshCoderRunUiSubscriptionUsage(options) {
81343
+ const { runner, uiState } = options;
81344
+ if (!uiState || !runner.getSubscriptionUsage) {
81345
+ return;
81346
+ }
81347
+ try {
81348
+ const subscriptionUsage = await runner.getSubscriptionUsage();
81349
+ if (subscriptionUsage) {
81350
+ uiState.setSubscriptionUsage(subscriptionUsage);
81351
+ }
81352
+ }
81353
+ catch (_a) {
81354
+ // A current subscription snapshot must never interrupt the coding queue.
81355
+ }
81356
+ }
81357
+
81358
+ /**
81359
+ * How often the harness subscription usage is re-read while `ptbk coder` is running.
81360
+ *
81361
+ * @private internal constant of coder run UI
81362
+ */
81363
+ const CODER_RUN_SUBSCRIPTION_USAGE_REFRESH_INTERVAL_MS = 5 * 1000;
81364
+ /**
81365
+ * Keeps the harness subscription usage of the coder-run dashboard current for the whole run.
81366
+ *
81367
+ * A single coding prompt can take hours, so reading the usage once per prompt leaves the dashboard showing values
81368
+ * which are long out of date. Reading it on its own clock instead means the percentages and reset countdowns always
81369
+ * describe the present moment, no matter how long the current prompt runs.
81370
+ *
81371
+ * Refreshes never overlap: a read which is still in flight when the next tick arrives simply skips that tick, so a
81372
+ * slow or hanging harness cannot pile up requests. The whole refresh is optional dashboard information, so a harness
81373
+ * without subscription limits and a run without a dashboard start no timer at all.
81374
+ *
81375
+ * @private internal utility of coder run UI
81376
+ */
81377
+ function startCoderRunUiSubscriptionUsageRefresh(options) {
81378
+ var _a;
81379
+ const { runner, uiState, refreshIntervalMs = CODER_RUN_SUBSCRIPTION_USAGE_REFRESH_INTERVAL_MS } = options;
81380
+ if (!uiState || !runner.getSubscriptionUsage) {
81381
+ return { stop: () => { } };
81382
+ }
81383
+ let isRefreshing = false;
81384
+ /**
81385
+ * Reads one fresh snapshot unless the previous read has not finished yet.
81386
+ */
81387
+ const refreshSubscriptionUsage = () => {
81388
+ if (isRefreshing) {
81389
+ return;
81390
+ }
81391
+ isRefreshing = true;
81392
+ void refreshCoderRunUiSubscriptionUsage({ runner, uiState }).finally(() => {
81393
+ isRefreshing = false;
81394
+ });
81395
+ };
81396
+ // Note: The dashboard shows the usage from its very first frames on instead of waiting out one whole interval
81397
+ refreshSubscriptionUsage();
81398
+ const refreshInterval = setInterval(refreshSubscriptionUsage, refreshIntervalMs);
81399
+ // Note: Optional dashboard information must never keep the `ptbk coder` process alive after the queue is done
81400
+ (_a = refreshInterval.unref) === null || _a === void 0 ? void 0 : _a.call(refreshInterval);
81401
+ return {
81402
+ stop() {
81403
+ clearInterval(refreshInterval);
81404
+ },
81405
+ };
81406
+ }
81407
+
81297
81408
  /**
81298
81409
  * Creates the one queue prompt used to repair a pre-existing test failure.
81299
81410
  */
@@ -81393,6 +81504,7 @@ async function runCodexPrompts(providedOptions) {
81393
81504
  }),
81394
81505
  });
81395
81506
  startPauseListenerIfNeeded(isRichUiEnabled);
81507
+ let subscriptionUsageRefresh;
81396
81508
  try {
81397
81509
  const resolvedCoderContext = await resolveCoderContext(options.context, process.cwd());
81398
81510
  const resolvedCoderAgent = await resolveCoderAgent(options.agent, process.cwd());
@@ -81418,7 +81530,8 @@ async function runCodexPrompts(providedOptions) {
81418
81530
  console.info(colors.green(`Running prompts with ${runner.name}`));
81419
81531
  initializeRunUi(uiHandle, runner.name, actualRunnerModel, options);
81420
81532
  await initializeRunUiAgentVisual(uiHandle, resolvedCoderAgent === null || resolvedCoderAgent === void 0 ? void 0 : resolvedCoderAgent.agentSource);
81421
- await refreshCoderRunUiSubscriptionUsage({
81533
+ // Note: The usage keeps refreshing on its own clock from here on, so a long prompt no longer freezes it
81534
+ subscriptionUsageRefresh = startCoderRunUiSubscriptionUsageRefresh({
81422
81535
  runner,
81423
81536
  uiState: uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state,
81424
81537
  });
@@ -81599,6 +81712,7 @@ async function runCodexPrompts(providedOptions) {
81599
81712
  }
81600
81713
  }
81601
81714
  finally {
81715
+ subscriptionUsageRefresh === null || subscriptionUsageRefresh === void 0 ? void 0 : subscriptionUsageRefresh.stop();
81602
81716
  cleanupRunDisplays(progressDisplay, uiHandle, options);
81603
81717
  resetCoderRunControls();
81604
81718
  }