@oh-my-matrix/autopilot 2.1.1

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 (80) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +36 -0
  3. package/dist/index.d.ts +28 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +1034 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/src/audit-persister.d.ts +25 -0
  8. package/dist/src/audit-persister.d.ts.map +1 -0
  9. package/dist/src/audit-persister.js +162 -0
  10. package/dist/src/audit-persister.js.map +1 -0
  11. package/dist/src/autopilot-state.d.ts +35 -0
  12. package/dist/src/autopilot-state.d.ts.map +1 -0
  13. package/dist/src/autopilot-state.js +121 -0
  14. package/dist/src/autopilot-state.js.map +1 -0
  15. package/dist/src/command-runner.d.ts +13 -0
  16. package/dist/src/command-runner.d.ts.map +1 -0
  17. package/dist/src/command-runner.js +148 -0
  18. package/dist/src/command-runner.js.map +1 -0
  19. package/dist/src/completion-detector.d.ts +21 -0
  20. package/dist/src/completion-detector.d.ts.map +1 -0
  21. package/dist/src/completion-detector.js +104 -0
  22. package/dist/src/completion-detector.js.map +1 -0
  23. package/dist/src/continuation-engine.d.ts +9 -0
  24. package/dist/src/continuation-engine.d.ts.map +1 -0
  25. package/dist/src/continuation-engine.js +76 -0
  26. package/dist/src/continuation-engine.js.map +1 -0
  27. package/dist/src/effort-injection.d.ts +9 -0
  28. package/dist/src/effort-injection.d.ts.map +1 -0
  29. package/dist/src/effort-injection.js +17 -0
  30. package/dist/src/effort-injection.js.map +1 -0
  31. package/dist/src/evidence-gate.d.ts +24 -0
  32. package/dist/src/evidence-gate.d.ts.map +1 -0
  33. package/dist/src/evidence-gate.js +86 -0
  34. package/dist/src/evidence-gate.js.map +1 -0
  35. package/dist/src/goal-manager.d.ts +5 -0
  36. package/dist/src/goal-manager.d.ts.map +1 -0
  37. package/dist/src/goal-manager.js +22 -0
  38. package/dist/src/goal-manager.js.map +1 -0
  39. package/dist/src/logger.d.ts +27 -0
  40. package/dist/src/logger.d.ts.map +1 -0
  41. package/dist/src/logger.js +90 -0
  42. package/dist/src/logger.js.map +1 -0
  43. package/dist/src/orchestrator.d.ts +16 -0
  44. package/dist/src/orchestrator.d.ts.map +1 -0
  45. package/dist/src/orchestrator.js +252 -0
  46. package/dist/src/orchestrator.js.map +1 -0
  47. package/dist/src/permission-policy.d.ts +36 -0
  48. package/dist/src/permission-policy.d.ts.map +1 -0
  49. package/dist/src/permission-policy.js +265 -0
  50. package/dist/src/permission-policy.js.map +1 -0
  51. package/dist/src/project-detector.d.ts +8 -0
  52. package/dist/src/project-detector.d.ts.map +1 -0
  53. package/dist/src/project-detector.js +130 -0
  54. package/dist/src/project-detector.js.map +1 -0
  55. package/dist/src/projection.d.ts +47 -0
  56. package/dist/src/projection.d.ts.map +1 -0
  57. package/dist/src/projection.js +58 -0
  58. package/dist/src/projection.js.map +1 -0
  59. package/dist/src/retry-queue.d.ts +25 -0
  60. package/dist/src/retry-queue.d.ts.map +1 -0
  61. package/dist/src/retry-queue.js +77 -0
  62. package/dist/src/retry-queue.js.map +1 -0
  63. package/dist/src/stall-detector.d.ts +22 -0
  64. package/dist/src/stall-detector.d.ts.map +1 -0
  65. package/dist/src/stall-detector.js +26 -0
  66. package/dist/src/stall-detector.js.map +1 -0
  67. package/dist/src/tool-error-tracker.d.ts +4 -0
  68. package/dist/src/tool-error-tracker.d.ts.map +1 -0
  69. package/dist/src/tool-error-tracker.js +18 -0
  70. package/dist/src/tool-error-tracker.js.map +1 -0
  71. package/dist/src/types.d.ts +223 -0
  72. package/dist/src/types.d.ts.map +1 -0
  73. package/dist/src/types.js +55 -0
  74. package/dist/src/types.js.map +1 -0
  75. package/dist/src/workflow-config.d.ts +13 -0
  76. package/dist/src/workflow-config.d.ts.map +1 -0
  77. package/dist/src/workflow-config.js +422 -0
  78. package/dist/src/workflow-config.js.map +1 -0
  79. package/openclaw.plugin.json +62 -0
  80. package/package.json +56 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 oh-my-matrix contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # @oh-my-matrix/autopilot
2
+
3
+ OpenClaw-native plugin for **continuous, long-running task execution**. Keeps a task
4
+ running across turns and enters explainable states on tool errors, stalls, missing
5
+ evidence, permission denials, or token-budget exhaustion — instead of silently drifting.
6
+
7
+ Part of the [oh-my-matrix](https://github.com/TeFuirnever/oh-my-matrix) runtime stack.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install @oh-my-matrix/autopilot
13
+ # peer dependencies
14
+ npm install openclaw@">=2026.5.28" @oh-my-matrix/permission-policy
15
+ ```
16
+
17
+ ## Use
18
+
19
+ Registers as an OpenClaw plugin (`openclaw.plugin.json`) with hooks including
20
+ `before_tool_call`, `after_tool_call`, `before_compaction`, `agent_turn_prepare`,
21
+ `before_agent_run`, and `llm_output`. Enable it in your OpenClaw runtime and configure
22
+ behaviour via `WORKFLOW.md` (destructive-git policy, retry, evidence gates).
23
+
24
+ ## What it does
25
+
26
+ - **Continuation engine** — resumes long tasks across turns with a retry queue.
27
+ - **Stall / completion detection** — surfaces when a run is stuck or genuinely done.
28
+ - **Evidence gate** — blocks completion until success criteria are verified.
29
+ - **Projection + goal manager** — preserves run state and goal across compaction.
30
+ - **Permission-policy integration** — coordinates the run-scoped policy with
31
+ [`@oh-my-matrix/permission-policy`](../permission-policy).
32
+
33
+ ## Status
34
+
35
+ v2.1.1. Tested with `vitest` (500+ tests). See the project
36
+ [changelog](https://github.com/TeFuirnever/oh-my-matrix/blob/master/CHANGELOG.md).
@@ -0,0 +1,28 @@
1
+ import type { AutopilotState } from './src/types';
2
+ import type { OpenClawPluginApi } from 'openclaw/dist/plugin-sdk/plugin-runtime';
3
+ export declare const id = "autopilot";
4
+ export declare const name = "Autopilot Continuous Mode";
5
+ export declare const version = "2.0.0";
6
+ export declare function _resetForTest(): void;
7
+ /** Test-only: inject a mock audit_setMode so the closed-over _auditSetMode reference is replaceable. */
8
+ export declare function _setAuditSetModeForTest(fn: ((mode: 'active' | 'monitor' | 'passive') => void) | null): void;
9
+ export declare function _getInternalStateForTest(): {
10
+ stateByRunSize: number;
11
+ sessionIdToKeySize: number;
12
+ sessionKeyToRunIdSize: number;
13
+ canaryFiredSize: number;
14
+ };
15
+ /**
16
+ * Test helper: inject a partial state for a session and immediately run the
17
+ * retry_due check logic, returning the resulting state.
18
+ * Only available in test environments — do NOT call from production code.
19
+ */
20
+ export declare function _triggerRetryCheckForTest(overrides: {
21
+ sessionKey: string;
22
+ orchestrationState: AutopilotState['orchestrationState'];
23
+ retry?: AutopilotState['retry'];
24
+ }): AutopilotState | undefined;
25
+ /** Generate a unique run ID using crypto.randomUUID (exported for testing). */
26
+ export declare function _generateRunIdForTest(): string;
27
+ export declare function register(api: OpenClawPluginApi): void;
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,cAAc,EAA+B,MAAM,aAAa,CAAC;AAC/E,OAAO,KAAK,EAAE,iBAAiB,EAAmB,MAAM,yCAAyC,CAAC;AA+BlG,eAAO,MAAM,EAAE,cAAc,CAAC;AAC9B,eAAO,MAAM,IAAI,8BAA8B,CAAC;AAChD,eAAO,MAAM,OAAO,UAAU,CAAC;AAgD/B,wBAAgB,aAAa,IAAI,IAAI,CASpC;AAED,wGAAwG;AACxG,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAK3G;AAED,wBAAgB,wBAAwB;;;;;EAOvC;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,cAAc,CAAC,oBAAoB,CAAC,CAAC;IACzD,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;CACjC,GAAG,cAAc,GAAG,SAAS,CAiD7B;AAyDD,+EAA+E;AAC/E,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAMD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,iBAAiB,GAAG,IAAI,CAwyBrD"}