@eve-horizon/cli 0.2.36 → 0.2.38

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/index.js +175 -29
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -49613,7 +49613,14 @@ for cloud deployments. Credentials are stored globally per API URL.`,
49613
49613
  "--dry-run Show what would be set without actually setting",
49614
49614
  "",
49615
49615
  "Scope priority: --project > --org > user (default)",
49616
- "Default scope is user-level, so credentials are available to all your jobs."
49616
+ "Default scope is user-level, so credentials are available to all your jobs.",
49617
+ "",
49618
+ "Token type guidance:",
49619
+ " Tokens starting with sk-ant-oat01-* are long-lived setup-tokens (preferred).",
49620
+ " A warning is emitted when syncing any other Claude token (short-lived OAuth,",
49621
+ " ~15h). Generate a long-lived token with: claude setup-token",
49622
+ " Codex/Code tokens are automatically written back to their originating secret",
49623
+ " scope after each job when the CLI refreshes them during the session."
49617
49624
  ],
49618
49625
  examples: [
49619
49626
  "eve auth sync # Sync to user-level (default)",
@@ -49627,7 +49634,10 @@ for cloud deployments. Credentials are stored globally per API URL.`,
49627
49634
  usage: "eve auth creds [--claude] [--codex]",
49628
49635
  options: [
49629
49636
  "--claude Only check Claude/Anthropic credentials",
49630
- "--codex Only check Codex/OpenAI credentials"
49637
+ "--codex Only check Codex/OpenAI credentials",
49638
+ "",
49639
+ "Shows token type for Claude (setup-token = long-lived, oauth = short-lived ~15h)",
49640
+ "and expiry for Codex/Code tokens."
49631
49641
  ],
49632
49642
  examples: [
49633
49643
  "eve auth creds",
@@ -58189,7 +58199,9 @@ var SecretResolveRequestSchema = external_exports.object({
58189
58199
  var SecretResolveItemSchema = external_exports.object({
58190
58200
  key: external_exports.string(),
58191
58201
  value: external_exports.string(),
58192
- type: SecretTypeSchema
58202
+ type: SecretTypeSchema,
58203
+ scope_type: external_exports.enum(["user", "org", "project", "system"]).optional(),
58204
+ scope_id: external_exports.string().optional()
58193
58205
  });
58194
58206
  var SecretResolveResponseSchema = external_exports.object({
58195
58207
  data: external_exports.array(SecretResolveItemSchema)
@@ -62188,6 +62200,84 @@ var import_child_process = require("child_process");
62188
62200
  var import_util4 = require("util");
62189
62201
  var execFileAsync = (0, import_util4.promisify)(import_child_process.execFile);
62190
62202
 
62203
+ // src/lib/logs.ts
62204
+ function normalizeLogLine(line) {
62205
+ const kind = line.kind;
62206
+ const raw = line.raw;
62207
+ if (!kind || !raw) {
62208
+ return {
62209
+ type: line.type || "log",
62210
+ message: line.message || line.text || void 0,
62211
+ tool: line.tool,
62212
+ toolInput: line.tool_input,
62213
+ raw: line
62214
+ };
62215
+ }
62216
+ const rawType = raw.type;
62217
+ const item = raw.item;
62218
+ if (rawType === "item.completed" && item) {
62219
+ const itemType = item.type;
62220
+ if (itemType === "agent_message" && typeof item.text === "string") {
62221
+ return { type: "assistant", message: item.text, raw: line };
62222
+ }
62223
+ if (itemType === "command_execution") {
62224
+ const cmd = item.command;
62225
+ const exitCode = item.exit_code;
62226
+ const status = item.status;
62227
+ if (status === "completed" || exitCode !== void 0) {
62228
+ return { type: "tool_result", message: `exit ${exitCode ?? "?"}`, tool: "bash", toolInput: cmd, raw: line };
62229
+ }
62230
+ return { type: "tool_use", tool: "bash", toolInput: cmd, raw: line };
62231
+ }
62232
+ if (itemType === "file_change") {
62233
+ const changes = item.changes;
62234
+ if (changes?.length) {
62235
+ const summary = changes.map((c) => {
62236
+ const changeKind = c.kind || "?";
62237
+ const filePath = c.path || "";
62238
+ const shortPath = filePath.split("/").slice(-3).join("/");
62239
+ return `${changeKind}: ${shortPath}`;
62240
+ }).join(", ");
62241
+ return { type: "tool_use", tool: "file_change", toolInput: summary, raw: line };
62242
+ }
62243
+ }
62244
+ }
62245
+ if (rawType === "item.started" && item) {
62246
+ const itemType = item.type;
62247
+ if (itemType === "command_execution") {
62248
+ const cmd = item.command;
62249
+ return { type: "tool_use", tool: "bash", toolInput: cmd, raw: line };
62250
+ }
62251
+ }
62252
+ if (rawType === "turn.completed") {
62253
+ return { type: "skip", raw: line };
62254
+ }
62255
+ if (rawType === "assistant") {
62256
+ const message = raw.message;
62257
+ const text = message?.content?.filter((c) => c.text).map((c) => c.text).join("\n");
62258
+ return { type: "assistant", message: text || void 0, raw: line };
62259
+ }
62260
+ if (kind === "assistant") {
62261
+ const msg = raw.msg;
62262
+ const text = msg?.text || item?.text || void 0;
62263
+ return { type: "assistant", message: text, raw: line };
62264
+ }
62265
+ if (kind === "tool_use") {
62266
+ return { type: "tool_use", tool: line.tool || void 0, raw: line };
62267
+ }
62268
+ if (kind === "error") {
62269
+ return { type: "error", message: raw.error || raw.content || void 0, raw: line };
62270
+ }
62271
+ if (rawType === "stderr") {
62272
+ const content = raw.content;
62273
+ return { type: "status", message: content, raw: line };
62274
+ }
62275
+ if (rawType === "harness_startup") {
62276
+ return { type: "skip", raw: line };
62277
+ }
62278
+ return { type: kind || "log", raw: line };
62279
+ }
62280
+
62191
62281
  // src/commands/job.ts
62192
62282
  async function handleJob(subcommand, positionals, flags, context2) {
62193
62283
  const json = Boolean(flags.json);
@@ -63720,30 +63810,46 @@ function formatLogEntry(log) {
63720
63810
  }
63721
63811
  return;
63722
63812
  }
63723
- const message = line.message || line.text || "";
63724
- const tool = line.tool;
63725
- const toolInput = line.tool_input;
63813
+ const normalized = normalizeLogLine(line);
63814
+ const nType = normalized.type;
63815
+ if (nType === "skip") return;
63816
+ const message = normalized.message || line.message || line.text || "";
63817
+ const tool = normalized.tool || line.tool || void 0;
63818
+ const toolInput = normalized.toolInput || line.tool_input || void 0;
63726
63819
  const toolResult = line.tool_result;
63727
- switch (type) {
63820
+ switch (nType) {
63728
63821
  case "assistant":
63729
63822
  case "text":
63730
- console.log(`[${timestamp}] \u{1F916} ${message || JSON.stringify(line)}`);
63823
+ if (message) {
63824
+ console.log(`[${timestamp}] ${message}`);
63825
+ }
63731
63826
  break;
63732
63827
  case "tool_use":
63733
- console.log(`[${timestamp}] \u{1F527} ${tool || "tool"}: ${toolInput || JSON.stringify(line)}`);
63828
+ if (tool) {
63829
+ const inputPreview = toolInput ? ` ${toolInput.substring(0, 80)}${toolInput.length > 80 ? "..." : ""}` : "";
63830
+ console.log(`[${timestamp}] ${tool}${inputPreview}`);
63831
+ }
63734
63832
  break;
63735
63833
  case "tool_result":
63736
- const resultPreview = (toolResult || "").substring(0, 100);
63737
- console.log(`[${timestamp}] \u2192 ${resultPreview}${(toolResult?.length || 0) > 100 ? "..." : ""}`);
63834
+ const resultPreview = (toolResult || normalized.message || "").substring(0, 100);
63835
+ if (resultPreview) {
63836
+ console.log(`[${timestamp}] -> ${resultPreview}${(toolResult?.length || 0) > 100 ? "..." : ""}`);
63837
+ }
63738
63838
  break;
63739
63839
  case "error":
63740
- console.log(`[${timestamp}] \u274C ${message || JSON.stringify(line)}`);
63840
+ console.log(`[${timestamp}] Error: ${message || JSON.stringify(line)}`);
63741
63841
  break;
63742
63842
  case "status":
63743
- console.log(`[${timestamp}] \u2139\uFE0F ${message || JSON.stringify(line)}`);
63843
+ if (message) {
63844
+ console.log(`[${timestamp}] > ${message}`);
63845
+ }
63744
63846
  break;
63745
63847
  default:
63746
- console.log(`[${timestamp}] ${JSON.stringify(line)}`);
63848
+ if (message) {
63849
+ console.log(`[${timestamp}] ${message}`);
63850
+ } else if (Object.keys(line).length > 0) {
63851
+ console.log(`[${timestamp}] ${JSON.stringify(line)}`);
63852
+ }
63747
63853
  }
63748
63854
  }
63749
63855
  function getLifecycleIcon(phase) {
@@ -64664,10 +64770,13 @@ function formatFollowLogLine(event) {
64664
64770
  );
64665
64771
  return;
64666
64772
  }
64667
- const message = line.message || line.text || "";
64668
- const tool = line.tool;
64669
- const toolInput = line.tool_input;
64670
- switch (type) {
64773
+ const normalized = normalizeLogLine(line);
64774
+ const nType = normalized.type;
64775
+ if (nType === "skip") return;
64776
+ const message = normalized.message || line.message || line.text || "";
64777
+ const tool = normalized.tool || line.tool || void 0;
64778
+ const toolInput = normalized.toolInput || line.tool_input || void 0;
64779
+ switch (nType) {
64671
64780
  case "assistant":
64672
64781
  case "text":
64673
64782
  if (message) {
@@ -64676,14 +64785,16 @@ function formatFollowLogLine(event) {
64676
64785
  break;
64677
64786
  case "tool_use":
64678
64787
  if (tool) {
64679
- const inputPreview = toolInput ? ` ${toolInput.substring(0, 60)}${toolInput.length > 60 ? "..." : ""}` : "";
64680
- console.log(`[${timestamp}] Tool: ${tool}${inputPreview}`);
64788
+ const inputPreview = toolInput ? ` ${toolInput.substring(0, 80)}${toolInput.length > 80 ? "..." : ""}` : "";
64789
+ console.log(`[${timestamp}] ${tool}${inputPreview}`);
64681
64790
  }
64682
64791
  break;
64683
64792
  case "tool_result":
64684
64793
  break;
64685
64794
  case "status":
64686
- console.log(`[${timestamp}] ${message || JSON.stringify(line)}`);
64795
+ if (message) {
64796
+ console.log(`[${timestamp}] > ${message}`);
64797
+ }
64687
64798
  break;
64688
64799
  case "error":
64689
64800
  console.log(`[${timestamp}] Error: ${message || JSON.stringify(line)}`);
@@ -65559,6 +65670,18 @@ Permissions (${data.permissions.length}):`);
65559
65670
  );
65560
65671
  return;
65561
65672
  }
65673
+ const warnings = [];
65674
+ const claudeToken = extractedTokens.CLAUDE_CODE_OAUTH_TOKEN;
65675
+ if (claudeToken && !claudeToken.startsWith("sk-ant-oat01-")) {
65676
+ warnings.push("Found short-lived Claude OAuth token (expires in ~15h). For reliable agent execution, generate a long-lived token: claude setup-token\nThen re-run: eve auth sync");
65677
+ if (!json) {
65678
+ process.stderr.write(`\u26A0 Found short-lived Claude OAuth token (expires in ~15h).
65679
+ For reliable agent execution, generate a long-lived token: claude setup-token
65680
+ Then re-run: eve auth sync
65681
+
65682
+ `);
65683
+ }
65684
+ }
65562
65685
  const targetLabel = scope.type === "user" ? "user" : scope.type === "org" ? `org ${scope.orgId}` : `project ${scope.projectId}`;
65563
65686
  if (dryRun) {
65564
65687
  const tokenList = Object.keys(extractedTokens).map((key) => ({
@@ -65566,7 +65689,7 @@ Permissions (${data.permissions.length}):`);
65566
65689
  value: `${extractedTokens[key].substring(0, 10)}...`
65567
65690
  }));
65568
65691
  outputJson(
65569
- { dry_run: true, would_set: tokenList, target: targetLabel, scope },
65692
+ { dry_run: true, would_set: tokenList, target: targetLabel, scope, warnings },
65570
65693
  json,
65571
65694
  `Would set ${tokenList.length} token(s) on ${targetLabel}:
65572
65695
  ${tokenList.map((t) => ` - ${t.name}`).join("\n")}`
@@ -65601,7 +65724,8 @@ ${tokenList.map((t) => ` - ${t.name}`).join("\n")}`
65601
65724
  scope,
65602
65725
  results,
65603
65726
  success: successCount,
65604
- failed: failCount
65727
+ failed: failCount,
65728
+ warnings
65605
65729
  },
65606
65730
  json,
65607
65731
  `\u2713 Set ${successCount} secret(s) on ${targetLabel}${failCount > 0 ? ` (${failCount} failed)` : ""}`
@@ -65620,6 +65744,7 @@ ${tokenList.map((t) => ` - ${t.name}`).join("\n")}`
65620
65744
  let claudeSource = "";
65621
65745
  let claudePreview = "";
65622
65746
  let claudeExpires;
65747
+ let claudeTokenType;
65623
65748
  if (plat === "darwin" && !claudeFound) {
65624
65749
  for (const service of ["Claude Code-credentials", "anthropic.claude"]) {
65625
65750
  try {
@@ -65630,7 +65755,15 @@ ${tokenList.map((t) => ` - ${t.name}`).join("\n")}`
65630
65755
  if (output) {
65631
65756
  claudeFound = true;
65632
65757
  claudeSource = `macOS Keychain (${service})`;
65633
- claudePreview = output.substring(0, 15) + "...";
65758
+ let tokenStr = output;
65759
+ try {
65760
+ const parsed = JSON.parse(output);
65761
+ const claudeOauth = parsed.claudeAiOauth;
65762
+ if (typeof claudeOauth?.accessToken === "string") tokenStr = claudeOauth.accessToken;
65763
+ } catch {
65764
+ }
65765
+ claudeTokenType = tokenStr.startsWith("sk-ant-oat01-") ? "setup-token" : "oauth";
65766
+ claudePreview = tokenStr.substring(0, 15) + "...";
65634
65767
  break;
65635
65768
  }
65636
65769
  } catch {
@@ -65652,7 +65785,9 @@ ${tokenList.map((t) => ` - ${t.name}`).join("\n")}`
65652
65785
  if (claudeOauth?.accessToken) {
65653
65786
  claudeFound = true;
65654
65787
  claudeSource = credPath.replace((0, import_node_os3.homedir)(), "~");
65655
- claudePreview = claudeOauth.accessToken.substring(0, 15) + "...";
65788
+ const tokenStr = claudeOauth.accessToken;
65789
+ claudePreview = tokenStr.substring(0, 15) + "...";
65790
+ claudeTokenType = tokenStr.startsWith("sk-ant-oat01-") ? "setup-token" : "oauth";
65656
65791
  if (claudeOauth.expiresAt) {
65657
65792
  const expDate = new Date(claudeOauth.expiresAt);
65658
65793
  claudeExpires = expDate.toISOString();
@@ -65664,6 +65799,7 @@ ${tokenList.map((t) => ` - ${t.name}`).join("\n")}`
65664
65799
  claudeSource = credPath.replace((0, import_node_os3.homedir)(), "~");
65665
65800
  const token = creds.oauth_token || creds.access_token;
65666
65801
  claudePreview = token.substring(0, 15) + "...";
65802
+ claudeTokenType = token.startsWith("sk-ant-oat01-") ? "setup-token" : "oauth";
65667
65803
  break;
65668
65804
  }
65669
65805
  } catch {
@@ -65676,7 +65812,8 @@ ${tokenList.map((t) => ` - ${t.name}`).join("\n")}`
65676
65812
  source: claudeFound ? claudeSource : "not found",
65677
65813
  found: claudeFound,
65678
65814
  preview: claudePreview || void 0,
65679
- expiresAt: claudeExpires
65815
+ expiresAt: claudeExpires,
65816
+ tokenType: claudeTokenType
65680
65817
  });
65681
65818
  }
65682
65819
  if (checkCodex) {
@@ -65700,6 +65837,7 @@ ${tokenList.map((t) => ` - ${t.name}`).join("\n")}`
65700
65837
  }
65701
65838
  }
65702
65839
  }
65840
+ let codexExpires;
65703
65841
  if (!codexFound) {
65704
65842
  const freshest = pickFreshestCodeAuth();
65705
65843
  if (freshest) {
@@ -65711,13 +65849,17 @@ ${tokenList.map((t) => ` - ${t.name}`).join("\n")}`
65711
65849
  codexSource += " (API key)";
65712
65850
  codexPreview = freshest.apiKey.substring(0, 10) + "...";
65713
65851
  }
65852
+ if (freshest.expiresAt > 0) {
65853
+ codexExpires = new Date(freshest.expiresAt * 1e3).toISOString();
65854
+ }
65714
65855
  }
65715
65856
  }
65716
65857
  credentials2.push({
65717
65858
  name: "Codex/Code OAuth",
65718
65859
  source: codexFound ? codexSource : "not found",
65719
65860
  found: codexFound,
65720
- preview: codexPreview || void 0
65861
+ preview: codexPreview || void 0,
65862
+ expiresAt: codexExpires
65721
65863
  });
65722
65864
  }
65723
65865
  const foundCount = credentials2.filter((c) => c.found).length;
@@ -65731,6 +65873,10 @@ ${tokenList.map((t) => ` - ${t.name}`).join("\n")}`
65731
65873
  const status = cred.found ? "\u2713" : "\u2717";
65732
65874
  console.log(` ${status} ${cred.name}`);
65733
65875
  console.log(` Source: ${cred.source}`);
65876
+ if (cred.tokenType) {
65877
+ const typeLabel = cred.tokenType === "setup-token" ? "setup-token (long-lived)" : "oauth (short-lived, ~15h)";
65878
+ console.log(` Type: ${typeLabel}`);
65879
+ }
65734
65880
  if (cred.preview) {
65735
65881
  console.log(` Token: ${cred.preview}`);
65736
65882
  }
@@ -65738,8 +65884,8 @@ ${tokenList.map((t) => ` - ${t.name}`).join("\n")}`
65738
65884
  const expDate = new Date(cred.expiresAt);
65739
65885
  const now = /* @__PURE__ */ new Date();
65740
65886
  const isExpired = expDate < now;
65741
- const expLabel = isExpired ? "(expired)" : "";
65742
- console.log(` Expires: ${cred.expiresAt} ${expLabel}`);
65887
+ const expLabel = isExpired ? " (expired)" : "";
65888
+ console.log(` Expires: ${cred.expiresAt}${expLabel}`);
65743
65889
  }
65744
65890
  console.log("");
65745
65891
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eve-horizon/cli",
3
- "version": "0.2.36",
3
+ "version": "0.2.38",
4
4
  "description": "Eve Horizon CLI",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -18,9 +18,6 @@
18
18
  "assets",
19
19
  "README.md"
20
20
  ],
21
- "scripts": {
22
- "build": "rm -rf dist && esbuild src/index.ts --bundle --platform=node --target=node22 --outfile=dist/index.js --format=cjs --external:yaml"
23
- },
24
21
  "publishConfig": {
25
22
  "access": "public"
26
23
  },
@@ -31,11 +28,14 @@
31
28
  "yaml": "^2.5.1"
32
29
  },
33
30
  "devDependencies": {
34
- "@eve/migrate": "workspace:*",
35
- "@eve/shared": "workspace:*",
36
31
  "@types/node": "^22.0.0",
37
32
  "esbuild": "^0.27.3",
38
33
  "postgres": "^3.4.0",
39
- "typescript": "^5.7.0"
34
+ "typescript": "^5.7.0",
35
+ "@eve/migrate": "0.0.1",
36
+ "@eve/shared": "0.0.1"
37
+ },
38
+ "scripts": {
39
+ "build": "rm -rf dist && esbuild src/index.ts --bundle --platform=node --target=node22 --outfile=dist/index.js --format=cjs --external:yaml"
40
40
  }
41
- }
41
+ }