@4pm/cli 1.5.25 → 1.5.26

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 +23 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -34845,9 +34845,16 @@ var ONE_SHOT_DISALLOWED_CLAUDE_TOOLS = [
34845
34845
  "SendMessage",
34846
34846
  "PushNotification"
34847
34847
  ].join(",");
34848
+ var ONE_SHOT_MAX_TURNS = 4;
34848
34849
  function oneShotArgs(cmd) {
34849
34850
  if (!cmd.includes("claude")) return [];
34850
- return ["--max-turns=1", "--disallowedTools", ONE_SHOT_DISALLOWED_CLAUDE_TOOLS, "--permission-mode", "default"];
34851
+ return [
34852
+ `--max-turns=${ONE_SHOT_MAX_TURNS}`,
34853
+ "--disallowedTools",
34854
+ ONE_SHOT_DISALLOWED_CLAUDE_TOOLS,
34855
+ "--permission-mode",
34856
+ "default"
34857
+ ];
34851
34858
  }
34852
34859
  var READ_ONLY_DISALLOWED_CLAUDE_TOOLS = [
34853
34860
  "Edit",
@@ -34877,11 +34884,10 @@ var READ_ONLY_DISALLOWED_CLAUDE_TOOLS = [
34877
34884
  "PushNotification"
34878
34885
  ].join(",");
34879
34886
  var READ_ONLY_MAX_TURNS = 40;
34880
- function readOnlyArgs(cmd, profileMaxTurns) {
34887
+ function readOnlyArgs(cmd) {
34881
34888
  if (cmd.includes("claude")) {
34882
- const turns = typeof profileMaxTurns === "number" && profileMaxTurns > 0 ? Math.floor(profileMaxTurns) : READ_ONLY_MAX_TURNS;
34883
34889
  return [
34884
- `--max-turns=${turns}`,
34890
+ `--max-turns=${READ_ONLY_MAX_TURNS}`,
34885
34891
  "--disallowedTools",
34886
34892
  READ_ONLY_DISALLOWED_CLAUDE_TOOLS,
34887
34893
  "--permission-mode",
@@ -34969,9 +34975,7 @@ function buildRunArgs(profile, cmd, resumeId, oneShot = false, override, readOnl
34969
34975
  const model = override?.model?.trim() || profile.model?.trim();
34970
34976
  const modelArgs = model ? ["--model", model] : [];
34971
34977
  const resumeArgs = resumeId && cmd.includes("claude") ? ["--resume", resumeId] : [];
34972
- const turns = profile.maxTurns;
34973
- const perProfileTurns = !oneShot && !readOnly && cmd.includes("claude") && typeof turns === "number" && turns > 0 ? [`--max-turns=${Math.floor(turns)}`] : [];
34974
- const modeExtra = oneShot ? oneShotArgs(cmd) : readOnly ? readOnlyArgs(cmd, turns) : perProfileTurns;
34978
+ const modeExtra = oneShot ? oneShotArgs(cmd) : readOnly ? readOnlyArgs(cmd) : [];
34975
34979
  return [
34976
34980
  ...requiredArgs(cmd),
34977
34981
  ...resumeArgs,
@@ -37970,7 +37974,9 @@ function toDtoEntry(e) {
37970
37974
  level: e.level,
37971
37975
  resultKind: e.resultKind,
37972
37976
  // Processing time on a terminal `exit` entry (ADR-0249) — the web renders it inline.
37973
- ...e.durationMs != null ? { durationMs: e.durationMs } : {}
37977
+ ...e.durationMs != null ? { durationMs: e.durationMs } : {},
37978
+ // AI-run metadata on an `aireq` marker — powers the web's clickable CLI name → details modal.
37979
+ ...e.aiMeta ? { aiMeta: e.aiMeta } : {}
37974
37980
  };
37975
37981
  }
37976
37982
  var WsClient = class {
@@ -39076,7 +39082,14 @@ ${guardedPrompt}`;
39076
39082
  const plan = planAiRun(effectivePrompt, config, hint, resume, oneShot, aiConfig, readOnly);
39077
39083
  const markerArgs = plan.attempts[0]?.args ?? [];
39078
39084
  const startStamp = formatTimestampInZone(/* @__PURE__ */ new Date(), this.orgTimezone);
39079
- this.bus.push({ source: origin, kind: "aireq", text: `${startStamp} ${plan.cmd} \u2039 ${prompt}` });
39085
+ this.bus.push({
39086
+ source: origin,
39087
+ kind: "aireq",
39088
+ text: `${startStamp} ${plan.cmd} \u2039 ${prompt}`,
39089
+ // Carry the run's prompt + resolved flags so the web Console's clickable CLI name can open a
39090
+ // details modal (the representative first-attempt argv; failover may run a different profile's).
39091
+ aiMeta: { cmd: plan.cmd, args: markerArgs, prompt }
39092
+ });
39080
39093
  logger.info("command.ai", { commandId, origin, cmd: plan.cmd, profiles: plan.attempts.length });
39081
39094
  if (origin === "local") {
39082
39095
  this.send(WsChannels.COMMAND_ANNOUNCE, {
@@ -39134,7 +39147,7 @@ ${guardedPrompt}`;
39134
39147
  `, log: true });
39135
39148
  },
39136
39149
  onAttemptFail: (label, reason) => {
39137
- const text = reason === "limit" ? `profile "${label}" hit its session limit \u2014 trying next` : reason === "credits" ? `profile "${label}" is out of usage credits \u2014 trying next` : `profile "${label}" failed to authenticate \u2014 trying next`;
39150
+ const text = reason === "limit" ? `profile "${label}" hit its session limit \u2014 trying next` : reason === "credits" ? `profile "${label}" is out of usage credits \u2014 trying next` : reason === "auth" ? `profile "${label}" failed to authenticate \u2014 trying next` : `profile "${label}" run failed \u2014 trying next`;
39138
39151
  this.bus.push({ source: origin, kind: "log", text, level: "warn" });
39139
39152
  this.send(WsChannels.COMMAND_OUTPUT, { commandId, seq: seq++, chunk: `${text}
39140
39153
  `, log: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4pm/cli",
3
- "version": "1.5.25",
3
+ "version": "1.5.26",
4
4
  "private": false,
5
5
  "description": "4PM CLI — drives Claude/Codex CLIs on AI worker machines (Node + TypeScript)",
6
6
  "license": "LicenseRef-4PM-Source-Available",