automata-cli 0.1.0-feature-032-message-tool-model.258 → 0.1.0-feature-032-message-tool-model.260

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 +34 -31
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2978,8 +2978,8 @@ function composePrompt(input) {
2978
2978
 
2979
2979
  // src/github/runDirective.ts
2980
2980
  var VALID_TOOLS = ["claude", "codex"];
2981
- var TOOL_PATTERN = /(?<![A-Za-z0-9_:-])tool:([A-Za-z0-9._-]+)/gi;
2982
- var MODEL_PATTERN = /(?<![A-Za-z0-9_:-])model:([A-Za-z0-9._/+@-]+)/gi;
2981
+ var TOOL_PATTERN = /(?<![a-z0-9_:-])tool:([a-z0-9._-]+)/gi;
2982
+ var MODEL_PATTERN = /(?<![a-z0-9_:-])model:([a-z0-9._/+@-]+)/gi;
2983
2983
  function lastCapture(body, pattern) {
2984
2984
  const matches = [...body.matchAll(new RegExp(pattern.source, pattern.flags))];
2985
2985
  return matches.at(-1)?.[1];
@@ -3020,6 +3020,11 @@ function triggeringMessage(item) {
3020
3020
  function isExecutor(value) {
3021
3021
  return VALID_TOOLS.includes(value);
3022
3022
  }
3023
+ function baselineExecutorSource(withOption, configExecutor) {
3024
+ if (withOption !== void 0) return "option";
3025
+ if (configExecutor !== void 0) return "config";
3026
+ return "default";
3027
+ }
3023
3028
  function trimmed(value) {
3024
3029
  if (value === void 0) return void 0;
3025
3030
  const cleaned = value.trim();
@@ -3037,7 +3042,7 @@ function resolveExecution(input) {
3037
3042
  return { ok: false, invalidTool: directive.tool };
3038
3043
  }
3039
3044
  const baseline = withOption ?? configExecutor ?? input.defaultExecutor;
3040
- const baselineSource = withOption !== void 0 ? "option" : configExecutor !== void 0 ? "config" : "default";
3045
+ const baselineSource = baselineExecutorSource(withOption, configExecutor);
3041
3046
  const executor = directive.tool ?? baseline;
3042
3047
  const executorSource = directive.tool === void 0 ? baselineSource : "message";
3043
3048
  const switched = directive.tool !== void 0 && directive.tool !== baseline;
@@ -3062,7 +3067,8 @@ function describeExecution(execution) {
3062
3067
  return `${execution.executor}${model}${effort}${fromMessage}`;
3063
3068
  }
3064
3069
  function describeInvalidTool(invalidTool) {
3065
- return `the newest message asks for \`tool:${invalidTool}\`, which is not an executor automata knows (valid values are ${VALID_TOOLS.map((tool) => `\`${tool}\``).join(" and ")})`;
3070
+ const valid = VALID_TOOLS.map((tool) => `\`${tool}\``).join(" and ");
3071
+ return `the newest message asks for \`tool:${invalidTool}\`, which is not an executor automata knows (valid values are ${valid})`;
3066
3072
  }
3067
3073
 
3068
3074
  // src/github/markerReconciliation.ts
@@ -3888,6 +3894,18 @@ function repairIssueLink(item, baseBranch) {
3888
3894
  return false;
3889
3895
  }
3890
3896
  }
3897
+ function refuseBeforeRun(base, marker, detail, markerText) {
3898
+ progress(` failed: ${detail}
3899
+ `);
3900
+ inFlightMarker = null;
3901
+ try {
3902
+ updateMarker(marker, markerText);
3903
+ } catch (err) {
3904
+ progress(` warning: could not update the marker comment: ${err.message}
3905
+ `);
3906
+ }
3907
+ return { ...base, outcome: "failed", detail };
3908
+ }
3891
3909
  async function processItem(planned, settings, silent) {
3892
3910
  progress(`
3893
3911
  #${String(planned.issue.number)} ${planned.turn}: ${planned.reason}
@@ -3956,37 +3974,22 @@ async function processItem(planned, settings, silent) {
3956
3974
  });
3957
3975
  const oversized = describeOversizedPrompt(prompt);
3958
3976
  if (oversized !== null) {
3959
- const detail = oversized;
3960
- progress(` failed: ${detail}
3961
- `);
3962
- inFlightMarker = null;
3963
- try {
3964
- updateMarker(
3965
- marker,
3966
- `automata do-work: could not start a run because ${detail} Summarise the discussion in a new issue, or shorten the thread, and try again.`
3967
- );
3968
- } catch (err) {
3969
- progress(` warning: could not update the marker comment: ${err.message}
3970
- `);
3971
- }
3972
- return { ...base, outcome: "failed", detail };
3977
+ return refuseBeforeRun(
3978
+ base,
3979
+ marker,
3980
+ oversized,
3981
+ `automata do-work: could not start a run because ${oversized} Summarise the discussion in a new issue, or shorten the thread, and try again.`
3982
+ );
3973
3983
  }
3974
3984
  const resolved = resolveItemExecution(item, settings);
3975
3985
  if (!resolved.ok) {
3976
3986
  const detail = describeInvalidTool(resolved.invalidTool);
3977
- progress(` failed: ${detail}
3978
- `);
3979
- inFlightMarker = null;
3980
- try {
3981
- updateMarker(
3982
- marker,
3983
- `automata do-work: ${detail}. No run was started. Reply here with a corrected directive, or none at all, to have another attempt made.`
3984
- );
3985
- } catch (err) {
3986
- progress(` warning: could not update the marker comment: ${err.message}
3987
- `);
3988
- }
3989
- return { ...base, outcome: "failed", detail };
3987
+ return refuseBeforeRun(
3988
+ base,
3989
+ marker,
3990
+ detail,
3991
+ `automata do-work: ${detail}. No run was started. Reply here with a corrected directive, or none at all, to have another attempt made.`
3992
+ );
3990
3993
  }
3991
3994
  const execution = toExecution(resolved);
3992
3995
  let runError = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "automata-cli",
3
- "version": "0.1.0-feature-032-message-tool-model.258",
3
+ "version": "0.1.0-feature-032-message-tool-model.260",
4
4
  "description": "Automata CLI tool",
5
5
  "type": "module",
6
6
  "engines": {