@gh-symphony/cli 0.0.16 → 0.0.18

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,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "./chunk-EFMFGOWM.js";
5
- import "./chunk-TF3QNWNC.js";
4
+ } from "./chunk-LZE6YUSB.js";
5
+ import "./chunk-OL73UN2X.js";
6
6
  import {
7
7
  resolveRuntimeRoot
8
8
  } from "./chunk-5NV3LSAJ.js";
9
9
  import {
10
10
  handleMissingManagedProjectConfig,
11
11
  resolveManagedProjectConfig
12
- } from "./chunk-TH5QPO3Y.js";
12
+ } from "./chunk-C7G7RJ4G.js";
13
13
  import "./chunk-ROGRTUFI.js";
14
14
 
15
15
  // src/commands/run.ts
@@ -2,13 +2,13 @@
2
2
  import {
3
3
  shutdownForegroundOrchestrator,
4
4
  start_default
5
- } from "./chunk-MHIWAIVD.js";
6
- import "./chunk-JO3AXHQI.js";
5
+ } from "./chunk-ZYYY55WB.js";
6
+ import "./chunk-7UBUBSMH.js";
7
7
  import "./chunk-MVRF7BES.js";
8
- import "./chunk-EFMFGOWM.js";
9
- import "./chunk-TF3QNWNC.js";
8
+ import "./chunk-LZE6YUSB.js";
9
+ import "./chunk-OL73UN2X.js";
10
10
  import "./chunk-5NV3LSAJ.js";
11
- import "./chunk-TH5QPO3Y.js";
11
+ import "./chunk-C7G7RJ4G.js";
12
12
  import "./chunk-ROGRTUFI.js";
13
13
  export {
14
14
  start_default as default,
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  status_default
4
- } from "./chunk-6HBZC3BE.js";
4
+ } from "./chunk-XN5ABWZ6.js";
5
5
  import "./chunk-MVRF7BES.js";
6
6
  import "./chunk-5NV3LSAJ.js";
7
- import "./chunk-TH5QPO3Y.js";
7
+ import "./chunk-C7G7RJ4G.js";
8
8
  import "./chunk-ROGRTUFI.js";
9
9
  export {
10
10
  status_default as default
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  stop_default
4
- } from "./chunk-76QPITKI.js";
5
- import "./chunk-TH5QPO3Y.js";
4
+ } from "./chunk-Y6TYJMNT.js";
5
+ import "./chunk-C7G7RJ4G.js";
6
6
  import "./chunk-ROGRTUFI.js";
7
7
  export {
8
8
  stop_default as default
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/commands/version.ts
4
+ var handler = async (_args, options) => {
5
+ const version = "0.0.18";
6
+ if (options.json) {
7
+ process.stdout.write(JSON.stringify({ version }) + "\n");
8
+ } else {
9
+ process.stdout.write(`gh-symphony v${version}
10
+ `);
11
+ }
12
+ };
13
+ var version_default = handler;
14
+ export {
15
+ version_default as default
16
+ };
@@ -3,7 +3,7 @@ import {
3
3
  classifySessionExit,
4
4
  parseWorkflowMarkdown,
5
5
  readEnvFile
6
- } from "./chunk-TF3QNWNC.js";
6
+ } from "./chunk-OL73UN2X.js";
7
7
 
8
8
  // ../worker/dist/index.js
9
9
  import { spawn as spawn2 } from "child_process";
@@ -770,7 +770,7 @@ function shutdown(signal) {
770
770
  }
771
771
  stopOrchestratorHeartbeatTimer();
772
772
  emitOrchestratorHeartbeat();
773
- await persistTokenUsageArtifact(launcherEnv, runtimeState.tokenUsage);
773
+ await persistSessionTokenUsageArtifact(launcherEnv);
774
774
  await waitForPendingOrchestratorChannelFlush(resolveTerminalOrchestratorChannelFlushTimeoutMs());
775
775
  console.log(`Worker stopped on ${signal}`);
776
776
  process.exit(0);
@@ -854,7 +854,7 @@ function emitOrchestratorHeartbeat() {
854
854
  type: "heartbeat",
855
855
  issueId,
856
856
  lastEventAt: runtimeState.lastEventAt,
857
- tokenUsage: { ...runtimeState.tokenUsage },
857
+ tokenUsage: resolveSessionTokenUsageDelta(),
858
858
  rateLimits: runtimeState.rateLimits ? { ...runtimeState.rateLimits } : null,
859
859
  sessionInfo: { ...runtimeState.sessionInfo },
860
860
  executionPhase: runtimeState.executionPhase,
@@ -890,7 +890,7 @@ function emitOrchestratorChannelEvent(event) {
890
890
  type: "codex_update",
891
891
  issueId,
892
892
  lastEventAt,
893
- tokenUsage: { ...runtimeState.tokenUsage },
893
+ tokenUsage: resolveSessionTokenUsageDelta(),
894
894
  sessionInfo: { ...runtimeState.sessionInfo },
895
895
  executionPhase: runtimeState.executionPhase,
896
896
  runPhase: runtimeState.runPhase,
@@ -915,6 +915,12 @@ function resolveTurnTokenUsageDelta(baseline) {
915
915
  totalTokens: Math.max(0, runtimeState.tokenUsage.totalTokens - baseline.totalTokens)
916
916
  };
917
917
  }
918
+ function resolveSessionTokenUsageDelta() {
919
+ return resolveTurnTokenUsageDelta(sessionBudgetState.tokenUsageBaseline);
920
+ }
921
+ async function persistSessionTokenUsageArtifact(env) {
922
+ await persistTokenUsageArtifact(env, resolveSessionTokenUsageDelta());
923
+ }
918
924
  function emitTurnStartedEvent(turn) {
919
925
  const issueId = runtimeState.run?.issueId;
920
926
  if (!issueId) {
@@ -1014,7 +1020,7 @@ async function startAssignedRun() {
1014
1020
  runtimeState.run.lastError = code === 0 && !signal ? null : `codex app-server exited with ${signal ?? code ?? "unknown"}`;
1015
1021
  }
1016
1022
  }
1017
- void persistTokenUsageArtifact(launcherEnv, runtimeState.tokenUsage);
1023
+ void persistSessionTokenUsageArtifact(launcherEnv);
1018
1024
  });
1019
1025
  childProcess.once("error", (error) => {
1020
1026
  runtimeState.status = "failed";
@@ -1022,7 +1028,7 @@ async function startAssignedRun() {
1022
1028
  if (runtimeState.run) {
1023
1029
  runtimeState.run.lastError = error.message;
1024
1030
  }
1025
- void persistTokenUsageArtifact(launcherEnv, runtimeState.tokenUsage);
1031
+ void persistSessionTokenUsageArtifact(launcherEnv);
1026
1032
  });
1027
1033
  } catch (error) {
1028
1034
  runtimeState.status = "failed";
@@ -1030,7 +1036,7 @@ async function startAssignedRun() {
1030
1036
  if (runtimeState.run) {
1031
1037
  runtimeState.run.lastError = error instanceof Error ? error.message : "Unknown worker startup error";
1032
1038
  }
1033
- await persistTokenUsageArtifact(launcherEnv, runtimeState.tokenUsage);
1039
+ await persistSessionTokenUsageArtifact(launcherEnv);
1034
1040
  }
1035
1041
  }
1036
1042
  async function runCodexClientProtocol(child, plan, env, options) {
@@ -1414,7 +1420,7 @@ async function runCodexClientProtocol(child, plan, env, options) {
1414
1420
  });
1415
1421
  stopOrchestratorHeartbeatTimer();
1416
1422
  emitOrchestratorHeartbeat();
1417
- await persistTokenUsageArtifact(env, runtimeState.tokenUsage);
1423
+ await persistSessionTokenUsageArtifact(env);
1418
1424
  await waitForPendingOrchestratorChannelFlush(resolveTerminalOrchestratorChannelFlushTimeoutMs());
1419
1425
  setTimeout(() => {
1420
1426
  process.exit(0);
@@ -1600,7 +1606,7 @@ async function runCodexClientProtocol(child, plan, env, options) {
1600
1606
  });
1601
1607
  stopOrchestratorHeartbeatTimer();
1602
1608
  emitOrchestratorHeartbeat();
1603
- await persistTokenUsageArtifact(env, runtimeState.tokenUsage);
1609
+ await persistSessionTokenUsageArtifact(env);
1604
1610
  await waitForPendingOrchestratorChannelFlush(resolveTerminalOrchestratorChannelFlushTimeoutMs());
1605
1611
  setTimeout(() => {
1606
1612
  process.exit(userInputRequired || turnTerminalFailurePhase ? 1 : 0);
@@ -1638,7 +1644,7 @@ async function runCodexClientProtocol(child, plan, env, options) {
1638
1644
  }
1639
1645
  stopOrchestratorHeartbeatTimer();
1640
1646
  emitOrchestratorHeartbeat();
1641
- await persistTokenUsageArtifact(env, runtimeState.tokenUsage);
1647
+ await persistSessionTokenUsageArtifact(env);
1642
1648
  await waitForPendingOrchestratorChannelFlush(resolveTerminalOrchestratorChannelFlushTimeoutMs());
1643
1649
  setTimeout(() => {
1644
1650
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gh-symphony/cli",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "license": "MIT",
5
5
  "author": "hojinzs",
6
6
  "description": "Interactive CLI for GitHub Symphony orchestration",
@@ -41,11 +41,11 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "tsup": "^8.5.1",
44
- "@gh-symphony/dashboard": "0.0.14",
45
44
  "@gh-symphony/core": "0.0.14",
46
- "@gh-symphony/worker": "0.0.14",
45
+ "@gh-symphony/dashboard": "0.0.14",
47
46
  "@gh-symphony/tracker-github": "0.0.14",
48
- "@gh-symphony/orchestrator": "0.0.14"
47
+ "@gh-symphony/orchestrator": "0.0.14",
48
+ "@gh-symphony/worker": "0.0.14"
49
49
  },
50
50
  "scripts": {
51
51
  "build": "tsup",
@@ -1,67 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- loadGlobalConfig,
4
- loadProjectConfig
5
- } from "./chunk-ROGRTUFI.js";
6
-
7
- // src/project-selection.ts
8
- import * as p from "@clack/prompts";
9
- function isInteractiveTerminal() {
10
- return process.stdin.isTTY === true && process.stdout.isTTY === true;
11
- }
12
- function explicitProjectRequiredMessage() {
13
- return "Multiple projects are configured. Re-run with --project-id in non-interactive environments.\n";
14
- }
15
- async function resolveManagedProjectConfig(input) {
16
- if (input.requestedProjectId) {
17
- return loadProjectConfig(input.configDir, input.requestedProjectId);
18
- }
19
- const global = await loadGlobalConfig(input.configDir);
20
- const projectIds = global?.projects ?? [];
21
- if (projectIds.length === 0) {
22
- return null;
23
- }
24
- if (projectIds.length === 1) {
25
- return loadProjectConfig(input.configDir, projectIds[0]);
26
- }
27
- if (!isInteractiveTerminal()) {
28
- process.stderr.write(explicitProjectRequiredMessage());
29
- process.exitCode = 1;
30
- return null;
31
- }
32
- const projects = await Promise.all(
33
- projectIds.map(async (projectId) => ({
34
- projectId,
35
- config: await loadProjectConfig(input.configDir, projectId)
36
- }))
37
- );
38
- const selected = await p.select({
39
- message: "Select a project:",
40
- options: projects.map(({ projectId, config }) => ({
41
- value: projectId,
42
- label: config?.displayName ?? config?.slug ?? projectId,
43
- hint: projectId === global?.activeProject ? "current" : config && config.displayName && config.displayName !== projectId ? projectId : void 0
44
- })),
45
- maxItems: 10
46
- });
47
- if (p.isCancel(selected)) {
48
- p.cancel("Cancelled.");
49
- process.exitCode = 130;
50
- return null;
51
- }
52
- return loadProjectConfig(input.configDir, selected);
53
- }
54
- function handleMissingManagedProjectConfig() {
55
- if (process.exitCode) {
56
- return;
57
- }
58
- process.stderr.write(
59
- "No project configured. Run 'gh-symphony project add' first.\n"
60
- );
61
- process.exitCode = 1;
62
- }
63
-
64
- export {
65
- resolveManagedProjectConfig,
66
- handleMissingManagedProjectConfig
67
- };
@@ -1,30 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/commands/version.ts
4
- import { readFile } from "fs/promises";
5
- import { resolve, dirname } from "path";
6
- import { fileURLToPath } from "url";
7
- var handler = async (_args, options) => {
8
- let version = "0.0.0";
9
- try {
10
- const pkgPath = resolve(
11
- dirname(fileURLToPath(import.meta.url)),
12
- "..",
13
- "..",
14
- "package.json"
15
- );
16
- const pkg = JSON.parse(await readFile(pkgPath, "utf8"));
17
- version = pkg.version ?? version;
18
- } catch {
19
- }
20
- if (options.json) {
21
- process.stdout.write(JSON.stringify({ version }) + "\n");
22
- } else {
23
- process.stdout.write(`gh-symphony v${version}
24
- `);
25
- }
26
- };
27
- var version_default = handler;
28
- export {
29
- version_default as default
30
- };