substrate-ai 0.9.0 → 0.11.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.
Files changed (35) hide show
  1. package/dist/adapter-registry-DXLMTmfD.js +0 -0
  2. package/dist/adapter-registry-neBZrkr3.js +4 -0
  3. package/dist/cli/index.js +5594 -5951
  4. package/dist/decisions-C0pz9Clx.js +0 -0
  5. package/dist/{decisions-BDLp3tJB.js → decisions-DQZW0h9X.js} +2 -1
  6. package/dist/dist-eNB_v7Iy.js +10205 -0
  7. package/dist/errors-BvyMlvCX.js +74 -0
  8. package/dist/experimenter-Dos3NsCg.js +3 -0
  9. package/dist/health-BvYILeQQ.js +6 -0
  10. package/dist/{health-C-VRJruD.js → health-CiDi90gC.js} +57 -1850
  11. package/dist/{helpers-CpMs8VZX.js → helpers-DTp3VJ2-.js} +31 -121
  12. package/dist/index.d.ts +709 -266
  13. package/dist/index.js +5 -3
  14. package/dist/{logger-D2fS2ccL.js → logger-KeHncl-f.js} +2 -42
  15. package/dist/routing-CcBOCuC9.js +0 -0
  16. package/dist/{routing-CD8bIci_.js → routing-HaYsjEIS.js} +2 -2
  17. package/dist/{run-ClxNDHbr.js → run-CAUhTR7Y.js} +594 -4249
  18. package/dist/run-DPZOQOvB.js +9 -0
  19. package/dist/{upgrade-B1S61VXJ.js → upgrade-DFGrqjGI.js} +3 -3
  20. package/dist/{upgrade-BK0HrKA6.js → upgrade-DYdYuuJK.js} +3 -3
  21. package/dist/version-manager-impl-BmOWu8ml.js +0 -0
  22. package/dist/version-manager-impl-CKv6I1S0.js +4 -0
  23. package/package.json +5 -2
  24. package/dist/adapter-registry-D2zdMwVu.js +0 -840
  25. package/dist/adapter-registry-WAyFydN5.js +0 -4
  26. package/dist/config-migrator-CtGelIsG.js +0 -250
  27. package/dist/decisions-DhAA2HG2.js +0 -397
  28. package/dist/experimenter-D_N_7ZF3.js +0 -503
  29. package/dist/git-utils-DxPx6erV.js +0 -365
  30. package/dist/health-DMbNP9bw.js +0 -5
  31. package/dist/operational-BdcdmDqS.js +0 -374
  32. package/dist/routing-BVrxrM6v.js +0 -832
  33. package/dist/run-MAQ3Wuju.js +0 -10
  34. package/dist/version-manager-impl-BIxOe7gZ.js +0 -372
  35. package/dist/version-manager-impl-RrWs-CI6.js +0 -4
@@ -1,112 +1,33 @@
1
- import * as readline from "node:readline";
2
1
  import { EventEmitter } from "node:events";
2
+ import * as readline from "node:readline";
3
3
  import { randomUUID } from "crypto";
4
4
 
5
- //#region src/core/errors.ts
5
+ //#region packages/core/dist/events/event-bus.js
6
6
  /**
7
- * Error definitions for Substrate
8
- * Provides structured error hierarchy for all toolkit operations
7
+ * Concrete implementation of TypedEventBus backed by Node.js EventEmitter.
8
+ *
9
+ * Dispatch is SYNCHRONOUS — all handlers run before emit() returns (per ADR-004).
10
+ * maxListeners is set to 100 to avoid spurious warnings in large systems.
11
+ *
12
+ * @example
13
+ * const bus = new TypedEventBusImpl<CoreEvents & SdlcEvents>()
14
+ * bus.on('orchestrator:story-complete', ({ storyKey }) => { ... })
15
+ * bus.emit('orchestrator:story-complete', { storyKey: '1-1', reviewCycles: 1 })
9
16
  */
10
- /** Base error class for all Substrate errors */
11
- var AdtError = class AdtError extends Error {
12
- code;
13
- context;
14
- constructor(message, code, context = {}) {
15
- super(message);
16
- this.name = "AdtError";
17
- this.code = code;
18
- this.context = context;
19
- if (Error.captureStackTrace) Error.captureStackTrace(this, AdtError);
20
- }
21
- toJSON() {
22
- return {
23
- name: this.name,
24
- message: this.message,
25
- code: this.code,
26
- context: this.context,
27
- stack: this.stack
28
- };
29
- }
30
- };
31
- /** Error thrown when task configuration is invalid */
32
- var TaskConfigError = class extends AdtError {
33
- constructor(message, context = {}) {
34
- super(message, "TASK_CONFIG_ERROR", context);
35
- this.name = "TaskConfigError";
36
- }
37
- };
38
- /** Error thrown when a worker/agent operation fails */
39
- var WorkerError = class extends AdtError {
40
- constructor(message, context = {}) {
41
- super(message, "WORKER_ERROR", context);
42
- this.name = "WorkerError";
43
- }
44
- };
45
- /** Error thrown when a worker/agent cannot be found */
46
- var WorkerNotFoundError = class extends AdtError {
47
- constructor(agentId) {
48
- super(`Worker agent not found: ${agentId}`, "WORKER_NOT_FOUND", { agentId });
49
- this.name = "WorkerNotFoundError";
50
- }
51
- };
52
- /** Error thrown when a task graph is invalid */
53
- var TaskGraphError = class extends AdtError {
54
- constructor(message, context = {}) {
55
- super(message, "TASK_GRAPH_ERROR", context);
56
- this.name = "TaskGraphError";
57
- }
58
- };
59
- /** Error thrown when a task graph has cycles (deadlock) */
60
- var TaskGraphCycleError = class extends TaskGraphError {
61
- constructor(cycle) {
62
- super(`Circular dependency detected in task graph: ${cycle.join(" -> ")}`, { cycle });
63
- this.name = "TaskGraphCycleError";
64
- }
65
- };
66
- /** Error thrown when a budget limit is exceeded */
67
- var BudgetExceededError = class extends AdtError {
68
- constructor(limit, current, context = {}) {
69
- super(`Budget cap exceeded: current=${String(current)}, limit=${String(limit)}`, "BUDGET_EXCEEDED", {
70
- limit,
71
- current,
72
- ...context
73
- });
74
- this.name = "BudgetExceededError";
75
- }
76
- };
77
- /** Error thrown when git operations fail */
78
- var GitError = class extends AdtError {
79
- constructor(message, context = {}) {
80
- super(message, "GIT_ERROR", context);
81
- this.name = "GitError";
82
- }
83
- };
84
- /** Error thrown when configuration is invalid or missing */
85
- var ConfigError = class extends AdtError {
86
- constructor(message, context = {}) {
87
- super(message, "CONFIG_ERROR", context);
88
- this.name = "ConfigError";
17
+ var TypedEventBusImpl$1 = class {
18
+ _emitter;
19
+ constructor() {
20
+ this._emitter = new EventEmitter();
21
+ this._emitter.setMaxListeners(100);
89
22
  }
90
- };
91
- /** Error thrown when state recovery fails */
92
- var RecoveryError = class extends AdtError {
93
- constructor(message, context = {}) {
94
- super(message, "RECOVERY_ERROR", context);
95
- this.name = "RecoveryError";
23
+ emit(event, payload) {
24
+ this._emitter.emit(event, payload);
96
25
  }
97
- };
98
- /** Error thrown when a config file uses an incompatible format version */
99
- var ConfigIncompatibleFormatError = class extends AdtError {
100
- constructor(message, context = {}) {
101
- super(message, "CONFIG_INCOMPATIBLE_FORMAT", context);
102
- this.name = "ConfigIncompatibleFormatError";
26
+ on(event, handler) {
27
+ this._emitter.on(event, handler);
103
28
  }
104
- };
105
- /** Error thrown when a task graph file uses an incompatible format version */
106
- var TaskGraphIncompatibleFormatError = class extends AdtError {
107
- constructor(message, context = {}) {
108
- super(message, "TASK_GRAPH_INCOMPATIBLE_FORMAT", context);
109
- this.name = "TaskGraphIncompatibleFormatError";
29
+ off(event, handler) {
30
+ this._emitter.off(event, handler);
110
31
  }
111
32
  };
112
33
 
@@ -804,7 +725,11 @@ function printNonTtyWarning() {
804
725
  //#endregion
805
726
  //#region src/core/event-bus.ts
806
727
  /**
807
- * Concrete implementation of TypedEventBus backed by Node.js EventEmitter.
728
+ * Concrete implementation specialized to OrchestratorEvents.
729
+ *
730
+ * Sub-classing the generic impl preserves the non-generic surface that
731
+ * existing tests and callers rely on:
732
+ * bus = new TypedEventBusImpl() // no type param needed
808
733
  *
809
734
  * @example
810
735
  * const bus = new TypedEventBusImpl()
@@ -813,24 +738,9 @@ function printNonTtyWarning() {
813
738
  * })
814
739
  * bus.emit('task:complete', { taskId: 'abc', result: { exitCode: 0 } })
815
740
  */
816
- var TypedEventBusImpl = class {
817
- _emitter;
818
- constructor() {
819
- this._emitter = new EventEmitter();
820
- this._emitter.setMaxListeners(100);
821
- }
822
- emit(event, payload) {
823
- this._emitter.emit(event, payload);
824
- }
825
- on(event, handler) {
826
- this._emitter.on(event, handler);
827
- }
828
- off(event, handler) {
829
- this._emitter.off(event, handler);
830
- }
831
- };
741
+ var TypedEventBusImpl = class extends TypedEventBusImpl$1 {};
832
742
  /**
833
- * Create a new TypedEventBus instance.
743
+ * Create a new TypedEventBus instance specialized to OrchestratorEvents.
834
744
  *
835
745
  * @example
836
746
  * const bus = createEventBus()
@@ -916,5 +826,5 @@ async function withRetry(fn, maxRetries = 3, baseDelayMs = 100) {
916
826
  }
917
827
 
918
828
  //#endregion
919
- export { AdtError, BudgetExceededError, ConfigError, ConfigIncompatibleFormatError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError, assertDefined, createEventBus, createTuiApp, deepClone, formatDuration, generateId, isPlainObject, isTuiCapable, printNonTtyWarning, sleep, withRetry };
920
- //# sourceMappingURL=helpers-CpMs8VZX.js.map
829
+ export { assertDefined, createEventBus, createTuiApp, deepClone, formatDuration, generateId, isPlainObject, isTuiCapable, printNonTtyWarning, sleep, withRetry };
830
+ //# sourceMappingURL=helpers-DTp3VJ2-.js.map