automata-cli 0.1.0-feature-030-do-work.184 → 0.1.0-feature-030-do-work.188

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.
@@ -70,6 +70,8 @@ function ConfigWizard() {
70
70
  );
71
71
  const initialExecutorIndex = EXECUTOR_OPTIONS.findIndex((o) => o.value === existing.doWork?.executor);
72
72
  const [doWorkExecutorIndex, setDoWorkExecutorIndex] = useState(Math.max(initialExecutorIndex, 0));
73
+ const [doWorkClaudeModel, setDoWorkClaudeModel] = useState(existing.doWork?.models?.claude ?? "");
74
+ const [doWorkCodexModel, setDoWorkCodexModel] = useState(existing.doWork?.models?.codex ?? "");
73
75
  const [doWorkMaxRuns, setDoWorkMaxRuns] = useState(
74
76
  String(existing.doWork?.maxRunsPerTick ?? DEFAULT_DO_WORK.maxRunsPerTick)
75
77
  );
@@ -105,7 +107,7 @@ function ConfigWizard() {
105
107
  } else if (key.downArrow) {
106
108
  setDoWorkExecutorIndex((i) => i < EXECUTOR_OPTIONS.length - 1 ? i + 1 : 0);
107
109
  } else if (key.return) {
108
- setScreen("do-work-max-runs");
110
+ setScreen("do-work-claude-model");
109
111
  } else if (key.escape) {
110
112
  setScreen("do-work-base-branch");
111
113
  } else if (key.ctrl && input === "c") {
@@ -113,6 +115,34 @@ function ConfigWizard() {
113
115
  }
114
116
  return true;
115
117
  }
118
+ if (screen === "do-work-claude-model") {
119
+ if (key.return) {
120
+ setScreen("do-work-codex-model");
121
+ } else if (key.backspace || key.delete) {
122
+ setDoWorkClaudeModel((v) => v.slice(0, -1));
123
+ } else if (key.escape) {
124
+ setScreen("do-work-executor");
125
+ } else if (key.ctrl && input === "c") {
126
+ exit();
127
+ } else if (input && !key.ctrl && !key.meta) {
128
+ setDoWorkClaudeModel((v) => v + input);
129
+ }
130
+ return true;
131
+ }
132
+ if (screen === "do-work-codex-model") {
133
+ if (key.return) {
134
+ setScreen("do-work-max-runs");
135
+ } else if (key.backspace || key.delete) {
136
+ setDoWorkCodexModel((v) => v.slice(0, -1));
137
+ } else if (key.escape) {
138
+ setScreen("do-work-claude-model");
139
+ } else if (key.ctrl && input === "c") {
140
+ exit();
141
+ } else if (input && !key.ctrl && !key.meta) {
142
+ setDoWorkCodexModel((v) => v + input);
143
+ }
144
+ return true;
145
+ }
116
146
  if (screen === "do-work-max-runs") {
117
147
  if (key.return) {
118
148
  const parsedMaxRuns = Number.parseInt(doWorkMaxRuns, 10);
@@ -123,6 +153,10 @@ function ConfigWizard() {
123
153
  ...current.doWork,
124
154
  baseBranch: doWorkBaseBranch.trim() || void 0,
125
155
  executor: EXECUTOR_OPTIONS[doWorkExecutorIndex].value,
156
+ models: {
157
+ claude: doWorkClaudeModel.trim() || void 0,
158
+ codex: doWorkCodexModel.trim() || void 0
159
+ },
126
160
  maxRunsPerTick: Number.isNaN(parsedMaxRuns) || parsedMaxRuns < 0 ? void 0 : parsedMaxRuns
127
161
  }
128
162
  });
@@ -572,6 +606,38 @@ function ConfigWizard() {
572
606
  /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2191/\u2193 to move \xB7 Enter to continue \xB7 Esc to go back \xB7 Ctrl+C to cancel" })
573
607
  ] });
574
608
  }
609
+ if (screen === "do-work-claude-model") {
610
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginY: 1, children: [
611
+ /* @__PURE__ */ jsx(Text, { bold: true, children: "Do Work \u2014 Claude Model" }),
612
+ /* @__PURE__ */ jsx(Text, { children: " " }),
613
+ /* @__PURE__ */ jsxs(Text, { children: [
614
+ "Default model when the executor is Claude (blank = the executor's own default):",
615
+ " ",
616
+ /* @__PURE__ */ jsxs(Text, { color: "cyan", children: [
617
+ doWorkClaudeModel,
618
+ /* @__PURE__ */ jsx(Text, { children: "_" })
619
+ ] })
620
+ ] }),
621
+ /* @__PURE__ */ jsx(Text, { children: " " }),
622
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Type model \xB7 Enter to continue \xB7 Esc to go back \xB7 Ctrl+C to cancel" })
623
+ ] });
624
+ }
625
+ if (screen === "do-work-codex-model") {
626
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginY: 1, children: [
627
+ /* @__PURE__ */ jsx(Text, { bold: true, children: "Do Work \u2014 Codex Model" }),
628
+ /* @__PURE__ */ jsx(Text, { children: " " }),
629
+ /* @__PURE__ */ jsxs(Text, { children: [
630
+ "Default model when the executor is Codex (blank = the executor's own default):",
631
+ " ",
632
+ /* @__PURE__ */ jsxs(Text, { color: "cyan", children: [
633
+ doWorkCodexModel,
634
+ /* @__PURE__ */ jsx(Text, { children: "_" })
635
+ ] })
636
+ ] }),
637
+ /* @__PURE__ */ jsx(Text, { children: " " }),
638
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Type model \xB7 Enter to continue \xB7 Esc to go back \xB7 Ctrl+C to cancel" })
639
+ ] });
640
+ }
575
641
  if (screen === "do-work-max-runs") {
576
642
  return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginY: 1, children: [
577
643
  /* @__PURE__ */ jsx(Text, { bold: true, children: "Do Work \u2014 Max Runs Per Tick" }),
package/dist/index.js CHANGED
@@ -118,14 +118,22 @@ var configSetDoWorkExecutor = new Command("do-work-executor").description("Set t
118
118
  process.stdout.write(`do-work executor set to: ${value}
119
119
  `);
120
120
  });
121
- var configSetDoWorkModel = new Command("do-work-model").description("Set the model identifier `do-work` passes to the executor").argument("<value>", "Model identifier").action((value) => {
121
+ var configSetDoWorkModel = new Command("do-work-model").description("Set the default model `do-work` passes to one executor").argument("<executor>", `Executor: ${VALID_EXECUTORS.join(", ")}`).argument("<value>", "Model identifier").action((executor, value) => {
122
+ if (!VALID_EXECUTORS.includes(executor)) {
123
+ process.stderr.write(
124
+ `Error: invalid executor "${executor}". Must be one of: ${VALID_EXECUTORS.join(", ")}
125
+ `
126
+ );
127
+ process.exit(1);
128
+ }
122
129
  const model = value.trim();
123
130
  if (model.length === 0) {
124
131
  process.stderr.write("Error: do-work-model requires a non-empty model identifier.\n");
125
132
  process.exit(1);
126
133
  }
127
- writeDoWork({ model });
128
- process.stdout.write(`do-work model set to: ${model}
134
+ const current = readRawConfig();
135
+ writeDoWork({ models: { ...current.doWork?.models, [executor]: model } });
136
+ process.stdout.write(`do-work ${executor} model set to: ${model}
129
137
  `);
130
138
  });
131
139
  var configSetDoWorkMaxRuns = new Command("do-work-max-runs").description("Set the maximum number of model runs `do-work` performs per tick (0 = unlimited)").argument("<value>", "Non-negative integer").action((value) => {
@@ -175,7 +183,7 @@ var configCommand = new Command("config").description("Configure automata settin
175
183
  const [{ render }, React, { ConfigWizard }] = await Promise.all([
176
184
  import("ink"),
177
185
  import("react"),
178
- import("./ConfigWizard-KXVUQJ76.js")
186
+ import("./ConfigWizard-SS7OOS5T.js")
179
187
  ]);
180
188
  const { waitUntilExit } = render(React.createElement(ConfigWizard));
181
189
  await waitUntilExit();
@@ -2838,7 +2846,8 @@ function resolveSettings(options) {
2838
2846
  return {
2839
2847
  baseBranch: doWork.baseBranch ?? DEFAULT_DO_WORK.baseBranch,
2840
2848
  executor,
2841
- model: options.model ?? doWork.model,
2849
+ // --model wins; otherwise take the default for the executor in use.
2850
+ model: options.model ?? doWork.models?.[executor],
2842
2851
  maxRuns: options.maxRuns !== void 0 ? parsePositiveInt(options.maxRuns, "--max-runs") : doWork.maxRunsPerTick ?? DEFAULT_DO_WORK.maxRunsPerTick,
2843
2852
  lockStaleMinutes: doWork.lockStaleMinutes ?? DEFAULT_DO_WORK.lockStaleMinutes,
2844
2853
  limit: parsePositiveInt(options.limit, "--limit"),
@@ -3047,7 +3056,7 @@ function summarize(reports) {
3047
3056
  }
3048
3057
  var doWorkCommand = new Command6("do-work").description(
3049
3058
  "Run one tick of the autonomous loop: find the issues whose newest authorized message the agent has not answered, and answer them"
3050
- ).option("--with <executor>", "Executor to use: claude or codex (default: from config, else claude)").option("--model <string>", "Model identifier to pass to the executor").option("--issue <number>", "Restrict the tick to a single issue").option("--limit <n>", "Maximum number of issues to fetch", "10").option("--max-runs <n>", "Maximum number of model runs this tick").option("--dry-run", "Print the work plan and exit without changing anything").option("--json", "Emit the work plan and outcomes as JSON on stdout").option("--silent", "Suppress step-by-step Claude output; show only the final summary").action(async (options) => {
3059
+ ).option("--with <executor>", "Executor to use: claude or codex (default: from config, else claude)").option("--model <string>", "Model identifier to pass to the executor, overriding the configured default for it").option("--issue <number>", "Restrict the tick to a single issue").option("--limit <n>", "Maximum number of issues to fetch", "10").option("--max-runs <n>", "Maximum number of model runs this tick").option("--dry-run", "Print the work plan and exit without changing anything").option("--json", "Emit the work plan and outcomes as JSON on stdout").option("--silent", "Suppress step-by-step Claude output; show only the final summary").action(async (options) => {
3051
3060
  const settings = resolveSettings(options);
3052
3061
  const lock = acquireRunLock("do-work", settings.lockStaleMinutes);
3053
3062
  if (!lock.ok) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "automata-cli",
3
- "version": "0.1.0-feature-030-do-work.184",
3
+ "version": "0.1.0-feature-030-do-work.188",
4
4
  "description": "Automata CLI tool",
5
5
  "type": "module",
6
6
  "bin": {