@moxxy/mode-goal 0.27.0 → 0.28.0

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 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,eAAO,MAAM,QAAQ,8BAQnB,CAAC;AAEH,eAAO,MAAM,cAAc,6BAOzB,CAAC;AAEH,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,eAAO,MAAM,QAAQ,8BAanB,CAAC;AAEH,eAAO,MAAM,cAAc,6BAOzB,CAAC;AAEH,eAAe,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -5,11 +5,15 @@ import { runGoalMode } from './goal-loop.js';
5
5
  export { GOAL_MODE_NAME } from './constants.js';
6
6
  export const goalMode = defineMode({
7
7
  name: GOAL_MODE_NAME,
8
- description: 'Autonomous goal loop: works across many turns until it calls goal_complete (tools auto-approved)',
8
+ description: 'Autonomous goal run: works until it calls goal_complete (tools auto-approved), then hands back to your previous mode',
9
9
  // Goal mode auto-approves tools and keeps working unattended, so channels
10
10
  // surface a persistent accent badge while it's active — the user must always
11
11
  // know the agent is driving itself.
12
12
  badge: { label: 'GOAL', tone: 'attention' },
13
+ // One-shot: armed per objective, disarms itself when the goal concludes,
14
+ // and is never persisted as the boot/category default — `/goal` once must
15
+ // not make every future session autonomous.
16
+ transient: true,
13
17
  run: runGoalMode,
14
18
  });
15
19
  export const goalModePlugin = definePlugin({
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MA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,EAAE,IAAI,EAAE,WAAW,EAAE;IAC3C,yEAAyE;IACzE,0EAA0E;IAC1E,4CAA4C;IAC5C,SAAS,EAAE,IAAI;IACf,GAAG,EAAE,WAAW;CACjB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,YAAY,CAAC;IACzC,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,OAAO;IAChB,yEAAyE;IACzE,yDAAyD;IACzD,KAAK,EAAE,CAAC,QAAQ,CAAC;IACjB,KAAK,EAAE,SAAS;CACjB,CAAC,CAAC;AAEH,eAAe,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moxxy/mode-goal",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "description": "Goal mode: state a goal once and the agent works autonomously across many turns until it calls goal_complete (or goal_abandon), guarded by an iteration cap, a token budget, a stuck-loop detector, no-progress detection, and the user's abort.",
5
5
  "keywords": [
6
6
  "moxxy",
@@ -44,16 +44,16 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "zod": "^3.24.0",
47
- "@moxxy/sdk": "0.27.0"
47
+ "@moxxy/sdk": "0.28.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/node": "^22.10.0",
51
51
  "typescript": "^5.7.3",
52
52
  "vitest": "^2.1.8",
53
- "@moxxy/testing": "0.0.45",
53
+ "@moxxy/core": "0.28.0",
54
54
  "@moxxy/vitest-preset": "0.0.0",
55
- "@moxxy/core": "0.27.0",
56
- "@moxxy/tsconfig": "0.0.0"
55
+ "@moxxy/tsconfig": "0.0.0",
56
+ "@moxxy/testing": "0.0.46"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "tsc -p tsconfig.json",
package/src/constants.ts CHANGED
@@ -8,40 +8,15 @@ export const GOAL_COMPLETE_TOOL = 'goal_complete';
8
8
  /** Tool the model calls to give up gracefully (blocked, needs the user). */
9
9
  export const GOAL_ABANDON_TOOL = 'goal_abandon';
10
10
 
11
- /**
12
- * Hard cap on autonomous iterations. Goal mode keeps re-prompting the model to
13
- * continue until it calls {@link GOAL_COMPLETE_TOOL}; this is the backstop that
14
- * guarantees the loop terminates even if the model never declares done. High
15
- * enough for a substantial multi-step task, low enough to bound a runaway.
16
- */
17
- export const GOAL_MAX_ITERATIONS = 150;
18
-
19
11
  /**
20
12
  * Consecutive iterations where the model emits NO tool calls and hasn't
21
- * completed. After this many we stop (a stall) rather than spin forever
22
- * nudging a model that has decided it's done without saying so.
13
+ * completed. After this many we treat the run as done-in-spirit (the model has
14
+ * clearly decided it's finished without saying so) and end the turn cleanly
15
+ * rather than spin forever nudging — this is goal mode's natural-termination
16
+ * mechanism, not a guardrail: the model is always nudged back to work first.
23
17
  */
24
18
  export const GOAL_MAX_NOOP_ITERATIONS = 3;
25
19
 
26
- /**
27
- * Cumulative token ceiling (full prompt — input + cacheRead + cacheCreation +
28
- * output — across the whole goal run). A second backstop alongside the
29
- * iteration cap: a few long-context iterations can burn a lot of tokens even
30
- * under the iteration limit. Generous; the iteration cap is usually the binding
31
- * guard.
32
- */
33
- export const GOAL_TOKEN_BUDGET = 4_000_000;
34
-
35
- /**
36
- * Max consecutive retryable provider errors before goal mode bails with a fatal
37
- * error. Goal mode runs unattended with auto-approval, so a sustained retryable
38
- * condition (429 / overloaded / transient 5xx / ECONNRESET) must NOT busy-loop
39
- * the provider — back off exponentially and give up after this many in a row.
40
- * The counter resets on any clean provider call, so a long run can still
41
- * recover from transient blips.
42
- */
43
- export const MAX_CONSECUTIVE_RETRIES = 6;
44
-
45
20
  /**
46
21
  * Layered on top of any user system prompt for the whole goal run. The framing
47
22
  * is the inverse of normal chat: stopping is NOT the signal to end — the model
@@ -73,3 +48,10 @@ export const CONTINUE_NUDGE =
73
48
  export const STALL_NUDGE =
74
49
  `You have produced no tool calls for several turns. Either take a concrete next action toward the goal, ` +
75
50
  `or call \`${GOAL_COMPLETE_TOOL}\` (if done) / \`${GOAL_ABANDON_TOOL}\` (if blocked). Do not reply with only text again.`;
51
+
52
+ /** Volatile steer when the stuck-loop detector notices a repetitive pattern.
53
+ * Goal mode never aborts on repetition (unattended runs must not be killed by
54
+ * a heuristic) — it steers instead. */
55
+ export const STUCK_NUDGE_SUFFIX =
56
+ `If you are genuinely blocked and no different approach exists, call \`${GOAL_ABANDON_TOOL}\` ` +
57
+ `with the reason instead of retrying.`;