instar 0.28.83 → 0.28.84

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 (83) hide show
  1. package/dashboard/index.html +239 -0
  2. package/dist/cli.js +10 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/memoryBackfillEvidence.d.ts +69 -0
  5. package/dist/commands/memoryBackfillEvidence.d.ts.map +1 -0
  6. package/dist/commands/memoryBackfillEvidence.js +220 -0
  7. package/dist/commands/memoryBackfillEvidence.js.map +1 -0
  8. package/dist/commands/server.d.ts.map +1 -1
  9. package/dist/commands/server.js +72 -1
  10. package/dist/commands/server.js.map +1 -1
  11. package/dist/core/EvolutionManager.d.ts +73 -0
  12. package/dist/core/EvolutionManager.d.ts.map +1 -1
  13. package/dist/core/EvolutionManager.js +376 -0
  14. package/dist/core/EvolutionManager.js.map +1 -1
  15. package/dist/core/SharedStateLedger.d.ts.map +1 -1
  16. package/dist/core/SharedStateLedger.js +4 -0
  17. package/dist/core/SharedStateLedger.js.map +1 -1
  18. package/dist/core/types.d.ts +90 -1
  19. package/dist/core/types.d.ts.map +1 -1
  20. package/dist/core/types.js +8 -0
  21. package/dist/core/types.js.map +1 -1
  22. package/dist/memory/EvidenceRenderer.d.ts +64 -0
  23. package/dist/memory/EvidenceRenderer.d.ts.map +1 -0
  24. package/dist/memory/EvidenceRenderer.js +119 -0
  25. package/dist/memory/EvidenceRenderer.js.map +1 -0
  26. package/dist/memory/SemanticMemory.d.ts +61 -1
  27. package/dist/memory/SemanticMemory.d.ts.map +1 -1
  28. package/dist/memory/SemanticMemory.js +381 -11
  29. package/dist/memory/SemanticMemory.js.map +1 -1
  30. package/dist/server/AgentServer.d.ts +4 -0
  31. package/dist/server/AgentServer.d.ts.map +1 -1
  32. package/dist/server/AgentServer.js +2 -0
  33. package/dist/server/AgentServer.js.map +1 -1
  34. package/dist/server/routes.d.ts +8 -0
  35. package/dist/server/routes.d.ts.map +1 -1
  36. package/dist/server/routes.js +369 -0
  37. package/dist/server/routes.js.map +1 -1
  38. package/dist/tasks/DivergenceChecker.d.ts +89 -0
  39. package/dist/tasks/DivergenceChecker.d.ts.map +1 -0
  40. package/dist/tasks/DivergenceChecker.js +255 -0
  41. package/dist/tasks/DivergenceChecker.js.map +1 -0
  42. package/dist/tasks/LruCache.d.ts +33 -0
  43. package/dist/tasks/LruCache.d.ts.map +1 -0
  44. package/dist/tasks/LruCache.js +88 -0
  45. package/dist/tasks/LruCache.js.map +1 -0
  46. package/dist/tasks/RateLimiter.d.ts +61 -0
  47. package/dist/tasks/RateLimiter.d.ts.map +1 -0
  48. package/dist/tasks/RateLimiter.js +108 -0
  49. package/dist/tasks/RateLimiter.js.map +1 -0
  50. package/dist/tasks/TaskFlowDueWaker.d.ts +29 -0
  51. package/dist/tasks/TaskFlowDueWaker.d.ts.map +1 -0
  52. package/dist/tasks/TaskFlowDueWaker.js +73 -0
  53. package/dist/tasks/TaskFlowDueWaker.js.map +1 -0
  54. package/dist/tasks/TaskFlowMaintenanceSweeper.d.ts +40 -0
  55. package/dist/tasks/TaskFlowMaintenanceSweeper.d.ts.map +1 -0
  56. package/dist/tasks/TaskFlowMaintenanceSweeper.js +131 -0
  57. package/dist/tasks/TaskFlowMaintenanceSweeper.js.map +1 -0
  58. package/dist/tasks/TaskFlowRegistry.d.ts +180 -0
  59. package/dist/tasks/TaskFlowRegistry.d.ts.map +1 -0
  60. package/dist/tasks/TaskFlowRegistry.js +791 -0
  61. package/dist/tasks/TaskFlowRegistry.js.map +1 -0
  62. package/dist/tasks/ThreadlineFlowBridge.d.ts +54 -0
  63. package/dist/tasks/ThreadlineFlowBridge.d.ts.map +1 -0
  64. package/dist/tasks/ThreadlineFlowBridge.js +129 -0
  65. package/dist/tasks/ThreadlineFlowBridge.js.map +1 -0
  66. package/dist/tasks/task-flow-registry.store.sqlite.d.ts +77 -0
  67. package/dist/tasks/task-flow-registry.store.sqlite.d.ts.map +1 -0
  68. package/dist/tasks/task-flow-registry.store.sqlite.js +350 -0
  69. package/dist/tasks/task-flow-registry.store.sqlite.js.map +1 -0
  70. package/dist/tasks/task-flow-types.d.ts +229 -0
  71. package/dist/tasks/task-flow-types.d.ts.map +1 -0
  72. package/dist/tasks/task-flow-types.js +128 -0
  73. package/dist/tasks/task-flow-types.js.map +1 -0
  74. package/package.json +1 -1
  75. package/src/data/builtin-manifest.json +78 -78
  76. package/upgrades/0.28.84.md +89 -0
  77. package/upgrades/side-effects/taskflow-phase1.md +130 -0
  78. package/upgrades/side-effects/taskflow-phase2.md +110 -0
  79. package/upgrades/side-effects/taskflow-phase3a.md +138 -0
  80. package/upgrades/side-effects/taskflow-phase5.md +234 -0
  81. package/upgrades/side-effects/wikiclaim-evidence-phase1.md +138 -0
  82. package/upgrades/side-effects/wikiclaim-evidence-phase4.md +129 -0
  83. package/upgrades/side-effects/wikiclaim-evidence-phase5.md +285 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RateLimiter.js","sourceRoot":"","sources":["../../src/tasks/RateLimiter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,WAAW,GAAG,MAAM,CAAC;AAmB3B,MAAM,OAAO,WAAW;IACL,QAAQ,CAAS;IACjB,KAAK,CAAS;IACd,GAAG,CAAe;IAClB,OAAO,GAAG,IAAI,GAAG,EAAoB,CAAC;IAC/C,YAAY,GAAG,CAAC,CAAC;IAEzB,YAAY,IAAwB;QAClC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;;;OAOG;IACH,UAAU,CAAC,GAAW;QACpB,IAA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C,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,WAAW;gBAAE,CAAC,CAAC,KAAK,EAAE,CAAC;YACtD,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC;gBAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * TaskFlowDueWaker — minute-tick poll that resumes `scheduled-tick` waits
3
+ * whose `dueAt` has passed.
4
+ *
5
+ * Acts under the system-waker scope: it does not own the controller of the
6
+ * woken flow. Per spec § Architecture, it transitions waiting → running and
7
+ * leaves step advancement to the owning controller (which subscribes to
8
+ * `taskflow:wait-fired`).
9
+ */
10
+ import { TaskFlowRegistry } from './TaskFlowRegistry.js';
11
+ export interface DueWakerOptions {
12
+ registry: TaskFlowRegistry;
13
+ intervalMs?: number;
14
+ now?: () => number;
15
+ wakerId?: string;
16
+ }
17
+ export declare class TaskFlowDueWaker {
18
+ private timer;
19
+ private readonly registry;
20
+ private readonly intervalMs;
21
+ private readonly now;
22
+ private readonly wakerId;
23
+ constructor(opts: DueWakerOptions);
24
+ start(): void;
25
+ stop(): void;
26
+ /** Wake every scheduled-tick wait with `dueAt <= now`. Returns rows woken. */
27
+ tick(): Promise<number>;
28
+ }
29
+ //# sourceMappingURL=TaskFlowDueWaker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TaskFlowDueWaker.d.ts","sourceRoot":"","sources":["../../src/tasks/TaskFlowDueWaker.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,KAAK,CAA+B;IAC5C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;IAC5C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,IAAI,EAAE,eAAe;IAOjC,KAAK,IAAI,IAAI;IAUb,IAAI,IAAI,IAAI;IAOZ,8EAA8E;IACxE,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;CA2B9B"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * TaskFlowDueWaker — minute-tick poll that resumes `scheduled-tick` waits
3
+ * whose `dueAt` has passed.
4
+ *
5
+ * Acts under the system-waker scope: it does not own the controller of the
6
+ * woken flow. Per spec § Architecture, it transitions waiting → running and
7
+ * leaves step advancement to the owning controller (which subscribes to
8
+ * `taskflow:wait-fired`).
9
+ */
10
+ import { DUE_WAKER_INTERVAL_MS, TaskFlowError } from './task-flow-types.js';
11
+ export class TaskFlowDueWaker {
12
+ timer = null;
13
+ registry;
14
+ intervalMs;
15
+ now;
16
+ wakerId;
17
+ constructor(opts) {
18
+ this.registry = opts.registry;
19
+ this.intervalMs = opts.intervalMs ?? DUE_WAKER_INTERVAL_MS;
20
+ this.now = opts.now ?? (() => Date.now());
21
+ this.wakerId = opts.wakerId ?? 'TaskFlowDueWaker';
22
+ }
23
+ start() {
24
+ if (this.timer)
25
+ return;
26
+ this.timer = setInterval(() => {
27
+ this.tick().catch(() => {
28
+ /* swallow — best-effort */
29
+ });
30
+ }, this.intervalMs);
31
+ if (this.timer.unref)
32
+ this.timer.unref();
33
+ }
34
+ stop() {
35
+ if (this.timer) {
36
+ clearInterval(this.timer);
37
+ this.timer = null;
38
+ }
39
+ }
40
+ /** Wake every scheduled-tick wait with `dueAt <= now`. Returns rows woken. */
41
+ async tick() {
42
+ const matches = this.registry.findWaitingByDueAt(this.now());
43
+ let resumed = 0;
44
+ for (const m of matches) {
45
+ try {
46
+ await this.registry.resumeFlow({
47
+ flowId: m.flowId,
48
+ expectedRevision: m.revision,
49
+ waitInstanceId: m.waitInstanceId,
50
+ principal: { scope: 'system-waker', wakerId: this.wakerId },
51
+ });
52
+ this.registry.emit('taskflow:wait-fired', {
53
+ flowId: m.flowId,
54
+ controllerId: m.controllerId,
55
+ });
56
+ resumed++;
57
+ }
58
+ catch (err) {
59
+ if (err instanceof TaskFlowError) {
60
+ if (err.code === 'revision_conflict')
61
+ continue;
62
+ if (err.code === 'already_terminal')
63
+ continue;
64
+ if (err.code === 'already_consumed')
65
+ continue;
66
+ }
67
+ // Other errors: swallow and continue with the rest.
68
+ }
69
+ }
70
+ return resumed;
71
+ }
72
+ }
73
+ //# sourceMappingURL=TaskFlowDueWaker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TaskFlowDueWaker.js","sourceRoot":"","sources":["../../src/tasks/TaskFlowDueWaker.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAS5E,MAAM,OAAO,gBAAgB;IACnB,KAAK,GAA0B,IAAI,CAAC;IAC3B,QAAQ,CAAmB;IAC3B,UAAU,CAAS;IACnB,GAAG,CAAe;IAClB,OAAO,CAAS;IAEjC,YAAY,IAAqB;QAC/B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,qBAAqB,CAAC;QAC3D,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAC1C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,kBAAkB,CAAC;IACpD,CAAC;IAED,KAAK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G,EAAE,CAAC;gBACb,IAAI,GAAG,YAAY,aAAa,EAAE,CAAC;oBACjC,IAAI,GAAG,CAAC,IAAI,KAAK,mBAAmB;wBAAE,SAAS;oBAC/C,IAAI,GAAG,CAAC,IAAI,KAAK,kBAAkB;wBAAE,SAAS;oBAC9C,IAAI,GAAG,CAAC,IAAI,KAAK,kBAAkB;wBAAE,SAAS;gBAChD,CAAC;gBACD,oDAAoD;YACtD,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * TaskFlowMaintenanceSweeper — hourly scan that marks stranded flows `lost`.
3
+ *
4
+ * Acts as a reserved controller (`TaskFlowMaintenance`); the registry
5
+ * whitelists this id for terminal-from-running and terminal-from-waiting
6
+ * transitions via `markLost`. Every transition emits a SharedStateLedger note
7
+ * for human-visible audit context.
8
+ *
9
+ * Threshold rules per spec § Sweeper threshold policy.
10
+ */
11
+ import { TaskFlowRegistry } from './TaskFlowRegistry.js';
12
+ import { TaskFlowStore } from './task-flow-registry.store.sqlite.js';
13
+ import { SweeperEvalCounts } from './task-flow-types.js';
14
+ import type { SharedStateLedger } from '../core/SharedStateLedger.js';
15
+ export interface SweeperOptions {
16
+ registry: TaskFlowRegistry;
17
+ store: TaskFlowStore;
18
+ ledger?: SharedStateLedger;
19
+ intervalMs?: number;
20
+ now?: () => number;
21
+ }
22
+ export declare class TaskFlowMaintenanceSweeper {
23
+ private timer;
24
+ private readonly registry;
25
+ private readonly store;
26
+ private readonly ledger?;
27
+ private readonly intervalMs;
28
+ private readonly now;
29
+ constructor(opts: SweeperOptions);
30
+ start(): void;
31
+ stop(): void;
32
+ /**
33
+ * Scan candidate flows and mark eligible rows as `lost`. Returns counts.
34
+ * Idempotent — safe to call as often as desired.
35
+ */
36
+ sweep(): Promise<SweeperEvalCounts>;
37
+ private isLostEligible;
38
+ private appendSweeperLedgerNote;
39
+ }
40
+ //# sourceMappingURL=TaskFlowMaintenanceSweeper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TaskFlowMaintenanceSweeper.d.ts","sourceRoot":"","sources":["../../src/tasks/TaskFlowMaintenanceSweeper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAEL,iBAAiB,EAGlB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED,qBAAa,0BAA0B;IACrC,OAAO,CAAC,KAAK,CAA+B;IAC5C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;IAC5C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAoB;IAC5C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;gBAEvB,IAAI,EAAE,cAAc;IAQhC,KAAK,IAAI,IAAI;IAUb,IAAI,IAAI,IAAI;IAOZ;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,iBAAiB,CAAC;IA2BzC,OAAO,CAAC,cAAc;YA6BR,uBAAuB;CA0BtC"}
@@ -0,0 +1,131 @@
1
+ /**
2
+ * TaskFlowMaintenanceSweeper — hourly scan that marks stranded flows `lost`.
3
+ *
4
+ * Acts as a reserved controller (`TaskFlowMaintenance`); the registry
5
+ * whitelists this id for terminal-from-running and terminal-from-waiting
6
+ * transitions via `markLost`. Every transition emits a SharedStateLedger note
7
+ * for human-visible audit context.
8
+ *
9
+ * Threshold rules per spec § Sweeper threshold policy.
10
+ */
11
+ import crypto from 'node:crypto';
12
+ import { SWEEPER_INTERVAL_MS, TaskFlowError, } from './task-flow-types.js';
13
+ export class TaskFlowMaintenanceSweeper {
14
+ timer = null;
15
+ registry;
16
+ store;
17
+ ledger;
18
+ intervalMs;
19
+ now;
20
+ constructor(opts) {
21
+ this.registry = opts.registry;
22
+ this.store = opts.store;
23
+ this.ledger = opts.ledger;
24
+ this.intervalMs = opts.intervalMs ?? SWEEPER_INTERVAL_MS;
25
+ this.now = opts.now ?? (() => Date.now());
26
+ }
27
+ start() {
28
+ if (this.timer)
29
+ return;
30
+ this.timer = setInterval(() => {
31
+ this.sweep().catch(() => {
32
+ /* swallow — best-effort hourly sweep */
33
+ });
34
+ }, this.intervalMs);
35
+ if (this.timer.unref)
36
+ this.timer.unref();
37
+ }
38
+ stop() {
39
+ if (this.timer) {
40
+ clearInterval(this.timer);
41
+ this.timer = null;
42
+ }
43
+ }
44
+ /**
45
+ * Scan candidate flows and mark eligible rows as `lost`. Returns counts.
46
+ * Idempotent — safe to call as often as desired.
47
+ */
48
+ async sweep() {
49
+ const t = this.registry.getThresholds();
50
+ const candidates = this.store.findSweeperCandidates();
51
+ let marked = 0;
52
+ for (const flow of candidates) {
53
+ if (!this.isLostEligible(flow, t))
54
+ continue;
55
+ // Best-effort ledger note BEFORE markLost so we have the explanation
56
+ // even if markLost loses an OCC race.
57
+ const ledgerEntryId = await this.appendSweeperLedgerNote(flow, t);
58
+ try {
59
+ await this.registry.markLost({
60
+ flowId: flow.flowId,
61
+ expectedRevision: flow.revision,
62
+ ledgerEntryId,
63
+ reason: 'lost',
64
+ });
65
+ marked++;
66
+ }
67
+ catch (err) {
68
+ if (err instanceof TaskFlowError && err.code === 'revision_conflict')
69
+ continue;
70
+ if (err instanceof TaskFlowError && err.code === 'already_terminal')
71
+ continue;
72
+ // Anything else: swallow but keep going. The ledger note remains as a
73
+ // hint for human follow-up.
74
+ }
75
+ }
76
+ return { scanned: candidates.length, marked };
77
+ }
78
+ isLostEligible(flow, t) {
79
+ const now = this.now();
80
+ if (flow.status === 'running') {
81
+ return now - flow.controllerHeartbeatAt > t.RUNNING_LOST_MS;
82
+ }
83
+ if (flow.status !== 'waiting')
84
+ return false;
85
+ const startedAt = flow.waitStartedAt ?? 0;
86
+ const kind = flow.waitJson?.kind;
87
+ switch (kind) {
88
+ case 'reply':
89
+ return now - startedAt > t.REPLY_LOST_MS;
90
+ case 'human-review':
91
+ return now - startedAt > t.HUMAN_REVIEW_LOST_MS;
92
+ case 'external-call': {
93
+ const deadline = flow.waitJson?.deadline;
94
+ if (typeof deadline === 'number')
95
+ return now > deadline + t.EXTERNAL_GRACE_MS;
96
+ return now - startedAt > t.EXTERNAL_LOST_MS;
97
+ }
98
+ case 'cross-agent-callback':
99
+ return now - startedAt > t.XAGENT_LOST_MS;
100
+ case 'scheduled-tick':
101
+ default:
102
+ return false;
103
+ }
104
+ }
105
+ async appendSweeperLedgerNote(flow, _t) {
106
+ const id = crypto.randomUUID();
107
+ if (!this.ledger)
108
+ return id;
109
+ try {
110
+ const entry = await this.ledger.append({
111
+ kind: 'note:taskflow-lost',
112
+ provenance: 'TaskFlowMaintenanceSweeper',
113
+ emittedBy: 'TaskFlowMaintenanceSweeper',
114
+ counterparty: 'self',
115
+ subject: 'taskflow-lost',
116
+ dedupKey: `taskflow-lost:${flow.flowId}:${flow.revision}`,
117
+ payload: {
118
+ flowId: flow.flowId,
119
+ revision: flow.revision,
120
+ controllerId: flow.controllerId,
121
+ fromStatus: flow.status,
122
+ },
123
+ });
124
+ return entry?.id ?? id;
125
+ }
126
+ catch {
127
+ return id;
128
+ }
129
+ }
130
+ }
131
+ //# sourceMappingURL=TaskFlowMaintenanceSweeper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TaskFlowMaintenanceSweeper.js","sourceRoot":"","sources":["../../src/tasks/T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AE,eAAe;gBACxB,QAAQ,EAAE,iBAAiB,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE;gBACzD,OAAO,EAAE;oBACP,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;oBACvB,YAAY,EAAE,IAAI,CAAC,YAAY;oBAC/B,UAAU,EAAE,IAAI,CAAC,MAAM;iBACxB;aACK,CAAC,CAAC;YACV,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,180 @@
1
+ /**
2
+ * TaskFlowRegistry — durable, optimistic-concurrency multi-step job records.
3
+ *
4
+ * Imported (trimmed) from OpenClaw's task-flow-registry. See
5
+ * `docs/specs/OPENCLAW-IMPORT-TASKFLOW-SPEC.md` for full design.
6
+ *
7
+ * v1 constraints (deliberate):
8
+ * - Single writer (the instar server process).
9
+ * - `managed` sync mode only.
10
+ * - No `blocked` status (overlapped `waiting`).
11
+ * - Notification dispatch is wired but stubbed at metric-emission only;
12
+ * Phase 5 wires through `TelegramAdapter` send.
13
+ */
14
+ import { EventEmitter } from 'node:events';
15
+ import { TaskFlowStore } from './task-flow-registry.store.sqlite.js';
16
+ import { TaskFlowRecord, TaskFlowStatus, TaskFlowPrincipal, TaskNotifyPolicy, TaskFlowThresholds, CreateFlowInput, WaitJson, RequesterOrigin, ApplyResult, WaitMatch, RateLimitConfig, CacheConfig } from './task-flow-types.js';
17
+ import type { SharedStateLedger } from '../core/SharedStateLedger.js';
18
+ export interface TaskFlowRegistryOptions {
19
+ store: TaskFlowStore;
20
+ ledger?: SharedStateLedger;
21
+ thresholds?: Partial<TaskFlowThresholds>;
22
+ rateLimits?: Partial<RateLimitConfig>;
23
+ cache?: Partial<CacheConfig>;
24
+ now?: () => number;
25
+ }
26
+ interface NotifyMetrics {
27
+ emitted: number;
28
+ byKind: Record<string, number>;
29
+ }
30
+ export declare class TaskFlowRegistry extends EventEmitter {
31
+ private readonly store;
32
+ private readonly ledger?;
33
+ private readonly thresholds;
34
+ private readonly rateLimits;
35
+ private readonly cacheConfig;
36
+ private readonly now;
37
+ private readonly cache;
38
+ private readonly createLimiter;
39
+ private readonly pingLimiter;
40
+ /** Per-controller in-memory active count cache; populated lazily from DB. */
41
+ private readonly activeCountByController;
42
+ /** Set of controllerIds whose count has been loaded from DB at least once. */
43
+ private readonly activeCountLoaded;
44
+ readonly notifyMetrics: NotifyMetrics;
45
+ /** Counter for cache evictions (Prometheus-style metric source). */
46
+ cacheEvictionsTotal: number;
47
+ /** Counter for rate-limit rejections, broken out by kind. */
48
+ rateLimitRejections: Record<string, number>;
49
+ constructor(opts: TaskFlowRegistryOptions);
50
+ getThresholds(): TaskFlowThresholds;
51
+ getRateLimits(): RateLimitConfig;
52
+ getCacheConfig(): CacheConfig;
53
+ /** Test-only: returns the LRU cache size. */
54
+ get cacheSize(): number;
55
+ getFlow(flowId: string, opts?: {
56
+ bypassCache?: boolean;
57
+ }): TaskFlowRecord | null;
58
+ /** Returns the redacted view safe to expose to non-owning callers. */
59
+ getRedactedFlow(flowId: string): Partial<TaskFlowRecord> | null;
60
+ findWaitingByReply(args: {
61
+ channel: string;
62
+ threadId: string;
63
+ peer: string;
64
+ }): WaitMatch[];
65
+ findWaitingByCorrelation(args: {
66
+ waitKind: 'external-call' | 'cross-agent-callback';
67
+ correlationId: string;
68
+ }): WaitMatch[];
69
+ findWaitingByDueAt(nowMs: number): WaitMatch[];
70
+ /**
71
+ * List all flows for a controllerId, optionally filtered by status.
72
+ * Used by DivergenceChecker — read-only, not on the hot mutation path.
73
+ */
74
+ findByControllerId(controllerId: string, opts?: {
75
+ status?: TaskFlowStatus;
76
+ }): TaskFlowRecord[];
77
+ /**
78
+ * Look up a flow by (controllerId, ownerKey, idempotencyKey). Returns null
79
+ * if no matching record. Useful for migrate-existing backfill and for tests.
80
+ */
81
+ findByIdempotency(controllerId: string, ownerKey: string, idempotencyKey: string): TaskFlowRecord | null;
82
+ createFlow(input: CreateFlowInput): Promise<{
83
+ flow: TaskFlowRecord;
84
+ created: boolean;
85
+ }>;
86
+ /**
87
+ * Returns count of non-terminal flows for a controller. Lazy-loaded from DB
88
+ * on first call, then maintained incrementally via createFlow / applyOcc.
89
+ *
90
+ * The bookkeeping is best-effort — if it drifts (e.g. server restart),
91
+ * the next call resets from DB. The hot path never goes to DB twice.
92
+ */
93
+ private getActiveCount;
94
+ /** Hook: invoked after a flow transitions to a terminal status. */
95
+ private onTerminalTransition;
96
+ startStep(args: {
97
+ flowId: string;
98
+ expectedRevision: number;
99
+ principal: TaskFlowPrincipal;
100
+ currentStep: string;
101
+ }): Promise<ApplyResult>;
102
+ setFlowWaiting(args: {
103
+ flowId: string;
104
+ expectedRevision: number;
105
+ principal: TaskFlowPrincipal;
106
+ waitJson: WaitJson;
107
+ currentStep?: string;
108
+ notifyPolicy?: TaskNotifyPolicy;
109
+ statePatch?: unknown;
110
+ }): Promise<ApplyResult>;
111
+ resumeFlow(args: {
112
+ flowId: string;
113
+ expectedRevision: number;
114
+ principal: TaskFlowPrincipal;
115
+ waitInstanceId: string;
116
+ currentStep?: string;
117
+ statePatch?: unknown;
118
+ }): Promise<ApplyResult>;
119
+ finishFlow(args: {
120
+ flowId: string;
121
+ expectedRevision: number;
122
+ principal: TaskFlowPrincipal;
123
+ result?: unknown;
124
+ }): Promise<ApplyResult>;
125
+ failFlow(args: {
126
+ flowId: string;
127
+ expectedRevision: number;
128
+ principal: TaskFlowPrincipal;
129
+ failureReason: string;
130
+ }): Promise<ApplyResult>;
131
+ requestFlowCancel(args: {
132
+ flowId: string;
133
+ expectedRevision: number;
134
+ requesterOrigin: RequesterOrigin;
135
+ }): Promise<ApplyResult>;
136
+ cancelFlow(args: {
137
+ flowId: string;
138
+ expectedRevision: number;
139
+ principal: TaskFlowPrincipal;
140
+ }): Promise<ApplyResult>;
141
+ markLost(args: {
142
+ flowId: string;
143
+ expectedRevision: number;
144
+ ledgerEntryId: string;
145
+ reason: 'lost' | 'stranded';
146
+ }): Promise<ApplyResult>;
147
+ pingFlow(args: {
148
+ flowId: string;
149
+ principal: TaskFlowPrincipal;
150
+ }): Promise<TaskFlowRecord>;
151
+ private applyOcc;
152
+ private cachePut;
153
+ private emitCacheEvictionMetric;
154
+ private assertControllerScope;
155
+ private controllerInstanceFromPrincipal;
156
+ private validateStateJsonSize;
157
+ private toWaitMatch;
158
+ private genId;
159
+ /**
160
+ * Emit a redacted state-transition audit note. Per spec § Threat Model
161
+ * lines 681-682, the audit shape carries only structural metadata:
162
+ * { flowId, revision, currentStep, from_status, to_status, waitJson.kind, controllerId, op }
163
+ *
164
+ * It MUST NOT include `stateJson` (controller-private; spec line 705) and
165
+ * MUST NOT include any field of `waitJson` other than `kind` (spec line 681).
166
+ *
167
+ * Audit emission is fire-and-forget; failures never affect state-machine
168
+ * correctness (tier-2 audit per spec § Storage and Concurrency).
169
+ */
170
+ private emitTransitionLedgerNote;
171
+ private crossesAuditBoundary;
172
+ /**
173
+ * Emit a generic redacted ledger note (used by cancel-requested path).
174
+ * Same redaction discipline as emitTransitionLedgerNote.
175
+ */
176
+ private emitLedgerNote;
177
+ private maybeNotify;
178
+ }
179
+ export {};
180
+ //# sourceMappingURL=TaskFlowRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TaskFlowRegistry.d.ts","sourceRoot":"","sources":["../../src/tasks/TaskFlowRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAGrE,OAAO,EACL,cAAc,EACd,cAAc,EAEd,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,QAAQ,EACR,eAAe,EAEf,WAAW,EACX,SAAS,EACT,eAAe,EAC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