@mclawnet/swarm 0.1.13 → 0.1.14
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.
- package/dist/__tests__/always-on-activity-reader.test.d.ts +2 -0
- package/dist/__tests__/always-on-activity-reader.test.d.ts.map +1 -0
- package/dist/__tests__/always-on-activity-reader.test.js +193 -0
- package/dist/__tests__/always-on-activity-reader.test.js.map +1 -0
- package/dist/__tests__/always-on-config.test.d.ts +2 -0
- package/dist/__tests__/always-on-config.test.d.ts.map +1 -0
- package/dist/__tests__/always-on-config.test.js +285 -0
- package/dist/__tests__/always-on-config.test.js.map +1 -0
- package/dist/__tests__/always-on-manager.test.d.ts +2 -0
- package/dist/__tests__/always-on-manager.test.d.ts.map +1 -0
- package/dist/__tests__/always-on-manager.test.js +797 -0
- package/dist/__tests__/always-on-manager.test.js.map +1 -0
- package/dist/__tests__/always-on-parity.test.d.ts +2 -0
- package/dist/__tests__/always-on-parity.test.d.ts.map +1 -0
- package/dist/__tests__/always-on-parity.test.js +20 -0
- package/dist/__tests__/always-on-parity.test.js.map +1 -0
- package/dist/__tests__/cascade-picker.test.d.ts +2 -0
- package/dist/__tests__/cascade-picker.test.d.ts.map +1 -0
- package/dist/__tests__/cascade-picker.test.js +122 -0
- package/dist/__tests__/cascade-picker.test.js.map +1 -0
- package/dist/__tests__/coordinator-shipment.test.d.ts +2 -0
- package/dist/__tests__/coordinator-shipment.test.d.ts.map +1 -0
- package/dist/__tests__/coordinator-shipment.test.js +280 -0
- package/dist/__tests__/coordinator-shipment.test.js.map +1 -0
- package/dist/__tests__/coordinator-workspace-recover.test.d.ts +2 -0
- package/dist/__tests__/coordinator-workspace-recover.test.d.ts.map +1 -0
- package/dist/__tests__/coordinator-workspace-recover.test.js +140 -0
- package/dist/__tests__/coordinator-workspace-recover.test.js.map +1 -0
- package/dist/__tests__/coordinator-workspace.test.d.ts +2 -0
- package/dist/__tests__/coordinator-workspace.test.d.ts.map +1 -0
- package/dist/__tests__/coordinator-workspace.test.js +135 -0
- package/dist/__tests__/coordinator-workspace.test.js.map +1 -0
- package/dist/__tests__/default-runner-epipe.test.d.ts +2 -0
- package/dist/__tests__/default-runner-epipe.test.d.ts.map +1 -0
- package/dist/__tests__/default-runner-epipe.test.js +43 -0
- package/dist/__tests__/default-runner-epipe.test.js.map +1 -0
- package/dist/__tests__/discovery-scheduler.test.d.ts +2 -0
- package/dist/__tests__/discovery-scheduler.test.d.ts.map +1 -0
- package/dist/__tests__/discovery-scheduler.test.js +367 -0
- package/dist/__tests__/discovery-scheduler.test.js.map +1 -0
- package/dist/__tests__/env-forward-e2e.test.d.ts +2 -0
- package/dist/__tests__/env-forward-e2e.test.d.ts.map +1 -0
- package/dist/__tests__/env-forward-e2e.test.js +57 -0
- package/dist/__tests__/env-forward-e2e.test.js.map +1 -0
- package/dist/__tests__/gh-pr-creator.test.d.ts +2 -0
- package/dist/__tests__/gh-pr-creator.test.d.ts.map +1 -0
- package/dist/__tests__/gh-pr-creator.test.js +107 -0
- package/dist/__tests__/gh-pr-creator.test.js.map +1 -0
- package/dist/__tests__/git-worktree-provider.test.d.ts +2 -0
- package/dist/__tests__/git-worktree-provider.test.d.ts.map +1 -0
- package/dist/__tests__/git-worktree-provider.test.js +98 -0
- package/dist/__tests__/git-worktree-provider.test.js.map +1 -0
- package/dist/__tests__/gitignore-check.test.d.ts +2 -0
- package/dist/__tests__/gitignore-check.test.d.ts.map +1 -0
- package/dist/__tests__/gitignore-check.test.js +39 -0
- package/dist/__tests__/gitignore-check.test.js.map +1 -0
- package/dist/__tests__/idea-research-source.test.d.ts +2 -0
- package/dist/__tests__/idea-research-source.test.d.ts.map +1 -0
- package/dist/__tests__/idea-research-source.test.js +425 -0
- package/dist/__tests__/idea-research-source.test.js.map +1 -0
- package/dist/__tests__/idea-todo-source.test.d.ts +2 -0
- package/dist/__tests__/idea-todo-source.test.d.ts.map +1 -0
- package/dist/__tests__/idea-todo-source.test.js +258 -0
- package/dist/__tests__/idea-todo-source.test.js.map +1 -0
- package/dist/__tests__/introspection-dedupe.test.d.ts +2 -0
- package/dist/__tests__/introspection-dedupe.test.d.ts.map +1 -0
- package/dist/__tests__/introspection-dedupe.test.js +484 -0
- package/dist/__tests__/introspection-dedupe.test.js.map +1 -0
- package/dist/__tests__/introspection-source.test.d.ts +2 -0
- package/dist/__tests__/introspection-source.test.d.ts.map +1 -0
- package/dist/__tests__/introspection-source.test.js +1051 -0
- package/dist/__tests__/introspection-source.test.js.map +1 -0
- package/dist/__tests__/migration-roles.test.js +1 -22
- package/dist/__tests__/migration-roles.test.js.map +1 -1
- package/dist/__tests__/reconcile-researching.test.d.ts +2 -0
- package/dist/__tests__/reconcile-researching.test.d.ts.map +1 -0
- package/dist/__tests__/reconcile-researching.test.js +224 -0
- package/dist/__tests__/reconcile-researching.test.js.map +1 -0
- package/dist/__tests__/role-loader-preamble-all.test.js +3 -1
- package/dist/__tests__/role-loader-preamble-all.test.js.map +1 -1
- package/dist/__tests__/role-loader.test.js +95 -0
- package/dist/__tests__/role-loader.test.js.map +1 -1
- package/dist/__tests__/role-prompt-no-legacy-protocol.test.js +3 -1
- package/dist/__tests__/role-prompt-no-legacy-protocol.test.js.map +1 -1
- package/dist/__tests__/secret-scrub.test.d.ts +2 -0
- package/dist/__tests__/secret-scrub.test.d.ts.map +1 -0
- package/dist/__tests__/secret-scrub.test.js +55 -0
- package/dist/__tests__/secret-scrub.test.js.map +1 -0
- package/dist/__tests__/shipment-actions.test.d.ts +2 -0
- package/dist/__tests__/shipment-actions.test.d.ts.map +1 -0
- package/dist/__tests__/shipment-actions.test.js +378 -0
- package/dist/__tests__/shipment-actions.test.js.map +1 -0
- package/dist/__tests__/shipment-persistence.test.d.ts +2 -0
- package/dist/__tests__/shipment-persistence.test.d.ts.map +1 -0
- package/dist/__tests__/shipment-persistence.test.js +120 -0
- package/dist/__tests__/shipment-persistence.test.js.map +1 -0
- package/dist/__tests__/shipment-pipeline.test.d.ts +2 -0
- package/dist/__tests__/shipment-pipeline.test.d.ts.map +1 -0
- package/dist/__tests__/shipment-pipeline.test.js +392 -0
- package/dist/__tests__/shipment-pipeline.test.js.map +1 -0
- package/dist/__tests__/shipment-report.test.d.ts +2 -0
- package/dist/__tests__/shipment-report.test.d.ts.map +1 -0
- package/dist/__tests__/shipment-report.test.js +78 -0
- package/dist/__tests__/shipment-report.test.js.map +1 -0
- package/dist/__tests__/shipment-stdin-integration.test.d.ts +2 -0
- package/dist/__tests__/shipment-stdin-integration.test.d.ts.map +1 -0
- package/dist/__tests__/shipment-stdin-integration.test.js +49 -0
- package/dist/__tests__/shipment-stdin-integration.test.js.map +1 -0
- package/dist/__tests__/shipment-type-parity.test.d.ts +2 -0
- package/dist/__tests__/shipment-type-parity.test.d.ts.map +1 -0
- package/dist/__tests__/shipment-type-parity.test.js +10 -0
- package/dist/__tests__/shipment-type-parity.test.js.map +1 -0
- package/dist/__tests__/snapshot-copy-provider.test.d.ts +2 -0
- package/dist/__tests__/snapshot-copy-provider.test.d.ts.map +1 -0
- package/dist/__tests__/snapshot-copy-provider.test.js +88 -0
- package/dist/__tests__/snapshot-copy-provider.test.js.map +1 -0
- package/dist/__tests__/swarm-coordinator-backend.test.js +153 -0
- package/dist/__tests__/swarm-coordinator-backend.test.js.map +1 -1
- package/dist/__tests__/swarm-coordinator-complete-intercept.test.d.ts +2 -0
- package/dist/__tests__/swarm-coordinator-complete-intercept.test.d.ts.map +1 -0
- package/dist/__tests__/swarm-coordinator-complete-intercept.test.js +111 -0
- package/dist/__tests__/swarm-coordinator-complete-intercept.test.js.map +1 -0
- package/dist/__tests__/task-store-source.test.d.ts +2 -0
- package/dist/__tests__/task-store-source.test.d.ts.map +1 -0
- package/dist/__tests__/task-store-source.test.js +56 -0
- package/dist/__tests__/task-store-source.test.js.map +1 -0
- package/dist/__tests__/transport-detect.test.d.ts +2 -0
- package/dist/__tests__/transport-detect.test.d.ts.map +1 -0
- package/dist/__tests__/transport-detect.test.js +92 -0
- package/dist/__tests__/transport-detect.test.js.map +1 -0
- package/dist/__tests__/workcycle-runner-cascade.test.d.ts +2 -0
- package/dist/__tests__/workcycle-runner-cascade.test.d.ts.map +1 -0
- package/dist/__tests__/workcycle-runner-cascade.test.js +203 -0
- package/dist/__tests__/workcycle-runner-cascade.test.js.map +1 -0
- package/dist/__tests__/workcycle-runner.test.d.ts +2 -0
- package/dist/__tests__/workcycle-runner.test.d.ts.map +1 -0
- package/dist/__tests__/workcycle-runner.test.js +369 -0
- package/dist/__tests__/workcycle-runner.test.js.map +1 -0
- package/dist/__tests__/workspace-diff.test.d.ts +2 -0
- package/dist/__tests__/workspace-diff.test.d.ts.map +1 -0
- package/dist/__tests__/workspace-diff.test.js +62 -0
- package/dist/__tests__/workspace-diff.test.js.map +1 -0
- package/dist/__tests__/workspace-manager.test.d.ts +2 -0
- package/dist/__tests__/workspace-manager.test.d.ts.map +1 -0
- package/dist/__tests__/workspace-manager.test.js +120 -0
- package/dist/__tests__/workspace-manager.test.js.map +1 -0
- package/dist/__tests__/workspace-types.test.d.ts +2 -0
- package/dist/__tests__/workspace-types.test.d.ts.map +1 -0
- package/dist/__tests__/workspace-types.test.js +37 -0
- package/dist/__tests__/workspace-types.test.js.map +1 -0
- package/dist/__tests__/worktree-gc.test.d.ts +2 -0
- package/dist/__tests__/worktree-gc.test.d.ts.map +1 -0
- package/dist/__tests__/worktree-gc.test.js +183 -0
- package/dist/__tests__/worktree-gc.test.js.map +1 -0
- package/dist/always-on/activity-reader.d.ts +27 -0
- package/dist/always-on/activity-reader.d.ts.map +1 -0
- package/dist/always-on/activity-reader.js +95 -0
- package/dist/always-on/activity-reader.js.map +1 -0
- package/dist/always-on/always-on-manager.d.ts +170 -0
- package/dist/always-on/always-on-manager.d.ts.map +1 -0
- package/dist/always-on/always-on-manager.js +538 -0
- package/dist/always-on/always-on-manager.js.map +1 -0
- package/dist/always-on/config.d.ts +141 -0
- package/dist/always-on/config.d.ts.map +1 -0
- package/dist/always-on/config.js +324 -0
- package/dist/always-on/config.js.map +1 -0
- package/dist/always-on/discovery-scheduler.d.ts +60 -0
- package/dist/always-on/discovery-scheduler.d.ts.map +1 -0
- package/dist/always-on/discovery-scheduler.js +287 -0
- package/dist/always-on/discovery-scheduler.js.map +1 -0
- package/dist/always-on/ideas-client.d.ts +23 -0
- package/dist/always-on/ideas-client.d.ts.map +1 -0
- package/dist/always-on/ideas-client.js +13 -0
- package/dist/always-on/ideas-client.js.map +1 -0
- package/dist/always-on/reconcile-researching.d.ts +42 -0
- package/dist/always-on/reconcile-researching.d.ts.map +1 -0
- package/dist/always-on/reconcile-researching.js +133 -0
- package/dist/always-on/reconcile-researching.js.map +1 -0
- package/dist/always-on/task-sources/cascade-picker.d.ts +42 -0
- package/dist/always-on/task-sources/cascade-picker.d.ts.map +1 -0
- package/dist/always-on/task-sources/cascade-picker.js +65 -0
- package/dist/always-on/task-sources/cascade-picker.js.map +1 -0
- package/dist/always-on/task-sources/idea-dedupe.d.ts +62 -0
- package/dist/always-on/task-sources/idea-dedupe.d.ts.map +1 -0
- package/dist/always-on/task-sources/idea-dedupe.js +130 -0
- package/dist/always-on/task-sources/idea-dedupe.js.map +1 -0
- package/dist/always-on/task-sources/idea-research-source.d.ts +46 -0
- package/dist/always-on/task-sources/idea-research-source.d.ts.map +1 -0
- package/dist/always-on/task-sources/idea-research-source.js +308 -0
- package/dist/always-on/task-sources/idea-research-source.js.map +1 -0
- package/dist/always-on/task-sources/idea-sort.d.ts +3 -0
- package/dist/always-on/task-sources/idea-sort.d.ts.map +1 -0
- package/dist/always-on/task-sources/idea-sort.js +25 -0
- package/dist/always-on/task-sources/idea-sort.js.map +1 -0
- package/dist/always-on/task-sources/idea-todo-source.d.ts +48 -0
- package/dist/always-on/task-sources/idea-todo-source.d.ts.map +1 -0
- package/dist/always-on/task-sources/idea-todo-source.js +226 -0
- package/dist/always-on/task-sources/idea-todo-source.js.map +1 -0
- package/dist/always-on/task-sources/introspection-source.d.ts +101 -0
- package/dist/always-on/task-sources/introspection-source.d.ts.map +1 -0
- package/dist/always-on/task-sources/introspection-source.js +695 -0
- package/dist/always-on/task-sources/introspection-source.js.map +1 -0
- package/dist/always-on/task-sources/task-store-source.d.ts +15 -0
- package/dist/always-on/task-sources/task-store-source.d.ts.map +1 -0
- package/dist/always-on/task-sources/task-store-source.js +59 -0
- package/dist/always-on/task-sources/task-store-source.js.map +1 -0
- package/dist/always-on/task-sources/types.d.ts +108 -0
- package/dist/always-on/task-sources/types.d.ts.map +1 -0
- package/dist/always-on/task-sources/types.js +13 -0
- package/dist/always-on/task-sources/types.js.map +1 -0
- package/dist/always-on/types.d.ts +76 -0
- package/dist/always-on/types.d.ts.map +1 -0
- package/dist/always-on/types.js +17 -0
- package/dist/always-on/types.js.map +1 -0
- package/dist/always-on/workcycle-runner.d.ts +115 -0
- package/dist/always-on/workcycle-runner.d.ts.map +1 -0
- package/dist/always-on/workcycle-runner.js +285 -0
- package/dist/always-on/workcycle-runner.js.map +1 -0
- package/dist/always-on/worktree-gc.d.ts +41 -0
- package/dist/always-on/worktree-gc.d.ts.map +1 -0
- package/dist/always-on/worktree-gc.js +167 -0
- package/dist/always-on/worktree-gc.js.map +1 -0
- package/dist/index.d.ts +26 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -1
- package/dist/index.js.map +1 -1
- package/dist/persistence.d.ts +37 -1
- package/dist/persistence.d.ts.map +1 -1
- package/dist/persistence.js +48 -0
- package/dist/persistence.js.map +1 -1
- package/dist/retrospective.d.ts.map +1 -1
- package/dist/retrospective.js +6 -0
- package/dist/retrospective.js.map +1 -1
- package/dist/roles/role-loader.d.ts +1 -1
- package/dist/roles/role-loader.d.ts.map +1 -1
- package/dist/roles/role-loader.js +18 -0
- package/dist/roles/role-loader.js.map +1 -1
- package/dist/roles/types.d.ts +12 -0
- package/dist/roles/types.d.ts.map +1 -1
- package/dist/shipment/gh-pr-creator.d.ts +28 -0
- package/dist/shipment/gh-pr-creator.d.ts.map +1 -0
- package/dist/shipment/gh-pr-creator.js +80 -0
- package/dist/shipment/gh-pr-creator.js.map +1 -0
- package/dist/shipment/report.d.ts +27 -0
- package/dist/shipment/report.d.ts.map +1 -0
- package/dist/shipment/report.js +41 -0
- package/dist/shipment/report.js.map +1 -0
- package/dist/shipment/secret-scrub.d.ts +12 -0
- package/dist/shipment/secret-scrub.d.ts.map +1 -0
- package/dist/shipment/secret-scrub.js +30 -0
- package/dist/shipment/secret-scrub.js.map +1 -0
- package/dist/shipment/shipment-actions.d.ts +85 -0
- package/dist/shipment/shipment-actions.d.ts.map +1 -0
- package/dist/shipment/shipment-actions.js +190 -0
- package/dist/shipment/shipment-actions.js.map +1 -0
- package/dist/shipment/shipment-pipeline.d.ts +48 -0
- package/dist/shipment/shipment-pipeline.d.ts.map +1 -0
- package/dist/shipment/shipment-pipeline.js +256 -0
- package/dist/shipment/shipment-pipeline.js.map +1 -0
- package/dist/shipment/transport-detect.d.ts +16 -0
- package/dist/shipment/transport-detect.d.ts.map +1 -0
- package/dist/shipment/transport-detect.js +54 -0
- package/dist/shipment/transport-detect.js.map +1 -0
- package/dist/shipment/workspace-diff.d.ts +39 -0
- package/dist/shipment/workspace-diff.d.ts.map +1 -0
- package/dist/shipment/workspace-diff.js +64 -0
- package/dist/shipment/workspace-diff.js.map +1 -0
- package/dist/swarm-coordinator.d.ts +20 -1
- package/dist/swarm-coordinator.d.ts.map +1 -1
- package/dist/swarm-coordinator.js +193 -10
- package/dist/swarm-coordinator.js.map +1 -1
- package/dist/types.d.ts +62 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/workspace/git-worktree-provider.d.ts +11 -0
- package/dist/workspace/git-worktree-provider.d.ts.map +1 -0
- package/dist/workspace/git-worktree-provider.js +123 -0
- package/dist/workspace/git-worktree-provider.js.map +1 -0
- package/dist/workspace/gitignore-check.d.ts +10 -0
- package/dist/workspace/gitignore-check.d.ts.map +1 -0
- package/dist/workspace/gitignore-check.js +25 -0
- package/dist/workspace/gitignore-check.js.map +1 -0
- package/dist/workspace/index.d.ts +5 -0
- package/dist/workspace/index.d.ts.map +1 -0
- package/dist/workspace/index.js +5 -0
- package/dist/workspace/index.js.map +1 -0
- package/dist/workspace/snapshot-copy-provider.d.ts +11 -0
- package/dist/workspace/snapshot-copy-provider.d.ts.map +1 -0
- package/dist/workspace/snapshot-copy-provider.js +66 -0
- package/dist/workspace/snapshot-copy-provider.js.map +1 -0
- package/dist/workspace/types.d.ts +36 -0
- package/dist/workspace/types.d.ts.map +1 -0
- package/dist/workspace/types.js +2 -0
- package/dist/workspace/types.js.map +1 -0
- package/dist/workspace/workspace-manager.d.ts +30 -0
- package/dist/workspace/workspace-manager.d.ts.map +1 -0
- package/dist/workspace/workspace-manager.js +104 -0
- package/dist/workspace/workspace-manager.js.map +1 -0
- package/package.json +4 -4
- package/roles/queen.md +1 -0
- package/templates/introspection.md +64 -0
- package/templates/research-only.md +58 -0
- package/roles/preset-analyst-simons.md +0 -39
- package/roles/preset-architect-knuth.md +0 -39
- package/roles/preset-designer-norman.md +0 -39
- package/roles/preset-designer.md +0 -39
- package/roles/preset-dev-carmack.md +0 -39
- package/roles/preset-dev-gosling.md +0 -39
- package/roles/preset-developer.md +0 -52
- package/roles/preset-manager-grove.md +0 -39
- package/roles/preset-manager-musk.md +0 -39
- package/roles/preset-pm.md +0 -78
- package/roles/preset-researcher-feynman.md +0 -39
- package/roles/preset-reviewer.md +0 -46
- package/roles/preset-strategist-buffett.md +0 -39
- package/roles/preset-strategist-munger.md +0 -39
- package/roles/preset-strategist-sunzi.md +0 -39
- package/roles/preset-tester-beck.md +0 -40
- package/roles/preset-tester.md +0 -47
- package/roles/preset-writer-orwell.md +0 -39
- package/roles/preset-writer.md +0 -39
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import type { AlwaysOnSnapshot, AlwaysOnTickRecord } from "@mclawnet/shared";
|
|
2
|
+
import { WorkCycleRunner, type TaskRef } from "./workcycle-runner.js";
|
|
3
|
+
import type { TaskSource } from "./task-sources/types.js";
|
|
4
|
+
import type { TaskStore } from "@mclawnet/task";
|
|
5
|
+
import { type AlwaysOnConfig, type AlwaysOnPersistedConfig } from "./config.js";
|
|
6
|
+
import type { SwarmCoordinator } from "../swarm-coordinator.js";
|
|
7
|
+
export interface AlwaysOnManagerOptions {
|
|
8
|
+
home: string;
|
|
9
|
+
swarmCoordinator: SwarmCoordinator;
|
|
10
|
+
/**
|
|
11
|
+
* Picks the next task for a given project; null = nothing actionable.
|
|
12
|
+
* Backwards-compat (M7) single-source DI. When `taskSources` is also
|
|
13
|
+
* provided the cascade picker takes precedence — `pickNextTask` is then
|
|
14
|
+
* ignored, but kept in the type for callers that still pass it.
|
|
15
|
+
*/
|
|
16
|
+
pickNextTask?: (projectRoot: string) => Promise<TaskRef | null>;
|
|
17
|
+
/**
|
|
18
|
+
* M8.0 cascade source list. When provided the manager builds a
|
|
19
|
+
* CascadePicker over these sources and wires it into the runner with the
|
|
20
|
+
* source lifecycle hooks active. When omitted, falls back to the M7
|
|
21
|
+
* single-source `pickNextTask` DI above (or a TaskStore-backed source
|
|
22
|
+
* when `taskStore` is provided).
|
|
23
|
+
*/
|
|
24
|
+
taskSources?: TaskSource[];
|
|
25
|
+
/**
|
|
26
|
+
* Convenience: when neither `pickNextTask` nor `taskSources` is provided
|
|
27
|
+
* but a TaskStore factory is, the manager auto-wraps it into a default
|
|
28
|
+
* single-source cascade. Lets the agent pass just the store factory and
|
|
29
|
+
* get the same picking behaviour as M7.
|
|
30
|
+
*/
|
|
31
|
+
taskStore?: (projectRoot: string) => TaskStore | undefined;
|
|
32
|
+
/** Optional clock injection for tests. */
|
|
33
|
+
now?: () => Date;
|
|
34
|
+
/** Override the user-active window (tests). */
|
|
35
|
+
userActiveWindowMs?: number;
|
|
36
|
+
/** Override the log rotation byte cap (tests). */
|
|
37
|
+
logRotateBytes?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Construct a WorkCycleRunner. Defaults to a real runner bound to the
|
|
40
|
+
* shared SwarmCoordinator + provided pickNextTask. Test-only override.
|
|
41
|
+
*/
|
|
42
|
+
runnerFactory?: (workDir: string) => WorkCycleRunner;
|
|
43
|
+
}
|
|
44
|
+
export declare class AlwaysOnManager {
|
|
45
|
+
private readonly home;
|
|
46
|
+
private readonly swarmCoordinator;
|
|
47
|
+
private readonly pickNextTask;
|
|
48
|
+
private readonly cascadePicker;
|
|
49
|
+
/**
|
|
50
|
+
* R3 I-B — kept around so `drainPending(workDir)` can iterate sources
|
|
51
|
+
* BEFORE the cascade runs each tick. The cascade picker itself only
|
|
52
|
+
* exposes filtered-pick semantics; the drain must bypass the filter so
|
|
53
|
+
* a source whose toggle was flipped off mid-flight still gets to reap
|
|
54
|
+
* its in-flight work.
|
|
55
|
+
*/
|
|
56
|
+
private readonly taskSources;
|
|
57
|
+
private readonly now;
|
|
58
|
+
private readonly userActiveWindowMs;
|
|
59
|
+
private readonly logRotateBytes;
|
|
60
|
+
private readonly runnerFactory?;
|
|
61
|
+
private readonly entries;
|
|
62
|
+
constructor(opts: AlwaysOnManagerOptions);
|
|
63
|
+
/**
|
|
64
|
+
* Boot (or rebuild) the scheduler for one project. Loads config from disk;
|
|
65
|
+
* restores ticksToday/lastFireAt when the persisted date matches today; if
|
|
66
|
+
* mode === "off", the scheduler is created but left stopped (cheap, lets
|
|
67
|
+
* `applyConfig` flip the switch later without re-instantiating).
|
|
68
|
+
*
|
|
69
|
+
* Idempotent: calling start() twice for the same project rebuilds; the old
|
|
70
|
+
* scheduler is stopped first to avoid duplicate timers.
|
|
71
|
+
*/
|
|
72
|
+
start(workDir: string): Promise<void>;
|
|
73
|
+
/** Stop the scheduler for a project and drop the entry. Idempotent. */
|
|
74
|
+
stop(workDir: string): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Returns the live snapshot serialised to the wire format (Date → ISO),
|
|
77
|
+
* or null when no scheduler is booted for the project.
|
|
78
|
+
*/
|
|
79
|
+
snapshot(workDir: string): AlwaysOnSnapshot | null;
|
|
80
|
+
/**
|
|
81
|
+
* Re-sync the live scheduler with whatever's on disk right now (M7.3).
|
|
82
|
+
* The M7.2 projects-handler already does load→merge→save, then calls our
|
|
83
|
+
* hook with the new config. Rather than re-doing the persistence here we
|
|
84
|
+
* just pull the canonical state off disk and push it into the scheduler.
|
|
85
|
+
* Auto-boots if the project never started; idempotent otherwise.
|
|
86
|
+
*/
|
|
87
|
+
refreshFromDisk(workDir: string): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Apply a config patch: merges over the persisted baseline, writes it back,
|
|
90
|
+
* updates the live scheduler in place. Auto-boots the scheduler when the
|
|
91
|
+
* project has never been started (UI may flip a mode on a fresh project).
|
|
92
|
+
*
|
|
93
|
+
* Returns the merged config and the post-update snapshot so callers can
|
|
94
|
+
* hand both back to the UI in one round trip.
|
|
95
|
+
*/
|
|
96
|
+
applyConfig(workDir: string, patch: Omit<Partial<AlwaysOnConfig>, "pausedUntil"> & {
|
|
97
|
+
pausedUntil?: string | null;
|
|
98
|
+
lastIntrospectionAt?: string | null;
|
|
99
|
+
lastIntrospectionRejected?: boolean | null;
|
|
100
|
+
pendingIntrospectionSwarmId?: string | null;
|
|
101
|
+
pendingIntrospectionWorkspaceCwd?: string | null;
|
|
102
|
+
}): Promise<{
|
|
103
|
+
config: AlwaysOnPersistedConfig;
|
|
104
|
+
snapshot: AlwaysOnSnapshot;
|
|
105
|
+
}>;
|
|
106
|
+
/**
|
|
107
|
+
* Record agent activity for the userActive gate. S1 hotfix: scoped per
|
|
108
|
+
* project. Pass `workDir` to update one project only; omit (or pass null)
|
|
109
|
+
* to broadcast to every entry — preserves the old global behaviour for
|
|
110
|
+
* callers that can't resolve a workDir from an inbound hub frame.
|
|
111
|
+
*/
|
|
112
|
+
recordActivity(workDir?: string | null): void;
|
|
113
|
+
/**
|
|
114
|
+
* B6 — force a tick immediately, clearing the per-project userActive
|
|
115
|
+
* timestamp first so the gate cascade doesn't skip on "user active <30min
|
|
116
|
+
* ago". Dev-only entrypoint: the hub gates the corresponding HTTP route on
|
|
117
|
+
* `NODE_ENV !== "production"` so this never reaches the agent in prod.
|
|
118
|
+
*
|
|
119
|
+
* Returns the TickRecord (decision + gateBreakdown + durationMs) and the
|
|
120
|
+
* post-tick snapshot in one call so the caller can show in dev tooling
|
|
121
|
+
* whether the force-tick fired or still skipped (e.g. on a real
|
|
122
|
+
* pausedUntil that genuinely should block).
|
|
123
|
+
*
|
|
124
|
+
* Note: only `lastActivityAt` is cleared. Other gates (pausedUntil,
|
|
125
|
+
* dailyBudget) intentionally still apply — force-tick is for bypassing
|
|
126
|
+
* the "I'm typing, don't fire" UX gate, not the user's explicit pause or
|
|
127
|
+
* the daily budget. Throws when no scheduler is booted for the project.
|
|
128
|
+
*/
|
|
129
|
+
forceTick(workDir: string): Promise<{
|
|
130
|
+
record: AlwaysOnTickRecord;
|
|
131
|
+
snapshot: AlwaysOnSnapshot;
|
|
132
|
+
}>;
|
|
133
|
+
/** Stop every per-project scheduler. Called on agent shutdown. */
|
|
134
|
+
disposeAll(): Promise<void>;
|
|
135
|
+
/**
|
|
136
|
+
* R3 I-B — public test/ops hook. Invokes `drainPending(workDir)` on every
|
|
137
|
+
* TaskSource that defines it, regardless of whether its toggle is on. This
|
|
138
|
+
* is the same drain that runs automatically inside `onFire` before each
|
|
139
|
+
* tick; exposed publicly so:
|
|
140
|
+
* - tests can simulate "user toggled off mid-flight → next tick reaps
|
|
141
|
+
* cleanly" without driving the scheduler timer, and
|
|
142
|
+
* - future ops surfaces (admin reseed, manual reconcile) can request a
|
|
143
|
+
* drain pass without firing a work cycle.
|
|
144
|
+
* Failures inside a single source are logged and swallowed — one source's
|
|
145
|
+
* drain must not break the manager's tick loop.
|
|
146
|
+
*/
|
|
147
|
+
drainAllSources(workDir: string): Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* Hotfix C1 — map a TaskSource onto its taskSources toggle flag and
|
|
150
|
+
* resolve against the project's persisted config. Unknown source names
|
|
151
|
+
* default to enabled so non-standard sources (e.g. tests, future M9
|
|
152
|
+
* sources not yet listed in `AlwaysOnTaskSourcesConfig`) aren't silently
|
|
153
|
+
* dropped. Called fresh per pick by the cascade picker filter, so toggling
|
|
154
|
+
* a source on/off in the UI takes effect on the very next tick — no
|
|
155
|
+
* scheduler/picker rebuild required (the JSON read is cheap compared to a
|
|
156
|
+
* swarm spawn).
|
|
157
|
+
*/
|
|
158
|
+
private isSourceEnabledForProject;
|
|
159
|
+
/** User-facing gates: pausedUntil + userActive. */
|
|
160
|
+
private buildGates;
|
|
161
|
+
/**
|
|
162
|
+
* Persist ticksToday/lastFireAt AND append a jsonl line to always-on.log.
|
|
163
|
+
* Hooked into DiscoveryScheduler.onTick so every fired / skipped / halted
|
|
164
|
+
* decision is captured. Best-effort — write failures are logged but never
|
|
165
|
+
* thrown back into the scheduler tick loop.
|
|
166
|
+
*/
|
|
167
|
+
private onTick;
|
|
168
|
+
private appendLog;
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=always-on-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"always-on-manager.d.ts","sourceRoot":"","sources":["../../src/always-on/always-on-manager.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE7E,OAAO,EAAE,eAAe,EAAE,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,UAAU,EAA8C,MAAM,yBAAyB,CAAC;AAGtG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAOL,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC7B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAWhE,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,gBAAgB,CAAC;IACnC;;;;;OAKG;IACH,YAAY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