@soleri/forge 5.13.1 → 5.14.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 (102) hide show
  1. package/dist/index.js +0 -0
  2. package/dist/lib.d.ts +1 -0
  3. package/dist/lib.js +1 -0
  4. package/dist/lib.js.map +1 -1
  5. package/dist/skills/brain-debrief.md +47 -19
  6. package/dist/skills/brainstorming.md +19 -9
  7. package/dist/skills/code-patrol.md +21 -19
  8. package/dist/skills/context-resume.md +14 -11
  9. package/dist/skills/executing-plans.md +30 -15
  10. package/dist/skills/fix-and-learn.md +17 -14
  11. package/dist/skills/health-check.md +29 -23
  12. package/dist/skills/knowledge-harvest.md +27 -20
  13. package/dist/skills/onboard-me.md +16 -15
  14. package/dist/skills/retrospective.md +34 -18
  15. package/dist/skills/second-opinion.md +16 -9
  16. package/dist/skills/systematic-debugging.md +40 -29
  17. package/dist/skills/test-driven-development.md +45 -30
  18. package/dist/skills/vault-capture.md +31 -15
  19. package/dist/skills/vault-navigator.md +24 -13
  20. package/dist/skills/verification-before-completion.md +38 -26
  21. package/dist/skills/writing-plans.md +21 -13
  22. package/dist/templates/claude-md-template.d.ts +9 -8
  23. package/dist/templates/claude-md-template.js +36 -32
  24. package/dist/templates/claude-md-template.js.map +1 -1
  25. package/dist/templates/inject-claude-md.js +65 -25
  26. package/dist/templates/inject-claude-md.js.map +1 -1
  27. package/dist/templates/shared-rules.d.ts +10 -11
  28. package/dist/templates/shared-rules.js +242 -114
  29. package/dist/templates/shared-rules.js.map +1 -1
  30. package/package.json +1 -1
  31. package/src/lib.ts +1 -0
  32. package/src/templates/claude-md-template.ts +49 -77
  33. package/src/templates/inject-claude-md.ts +65 -25
  34. package/src/templates/shared-rules.ts +259 -121
  35. package/dist/skills/skills/brain-debrief.md +0 -214
  36. package/dist/skills/skills/brainstorming.md +0 -180
  37. package/dist/skills/skills/code-patrol.md +0 -178
  38. package/dist/skills/skills/context-resume.md +0 -146
  39. package/dist/skills/skills/executing-plans.md +0 -216
  40. package/dist/skills/skills/fix-and-learn.md +0 -167
  41. package/dist/skills/skills/health-check.md +0 -231
  42. package/dist/skills/skills/knowledge-harvest.md +0 -185
  43. package/dist/skills/skills/onboard-me.md +0 -198
  44. package/dist/skills/skills/retrospective.md +0 -205
  45. package/dist/skills/skills/second-opinion.md +0 -149
  46. package/dist/skills/skills/systematic-debugging.md +0 -241
  47. package/dist/skills/skills/test-driven-development.md +0 -281
  48. package/dist/skills/skills/vault-capture.md +0 -170
  49. package/dist/skills/skills/vault-navigator.md +0 -140
  50. package/dist/skills/skills/verification-before-completion.md +0 -182
  51. package/dist/skills/skills/writing-plans.md +0 -215
  52. package/dist/templates/brain.d.ts +0 -6
  53. package/dist/templates/brain.js +0 -478
  54. package/dist/templates/brain.js.map +0 -1
  55. package/dist/templates/core-facade.d.ts +0 -6
  56. package/dist/templates/core-facade.js +0 -564
  57. package/dist/templates/core-facade.js.map +0 -1
  58. package/dist/templates/facade-factory.d.ts +0 -1
  59. package/dist/templates/facade-factory.js +0 -63
  60. package/dist/templates/facade-factory.js.map +0 -1
  61. package/dist/templates/facade-types.d.ts +0 -1
  62. package/dist/templates/facade-types.js +0 -46
  63. package/dist/templates/facade-types.js.map +0 -1
  64. package/dist/templates/intelligence-loader.d.ts +0 -1
  65. package/dist/templates/intelligence-loader.js +0 -43
  66. package/dist/templates/intelligence-loader.js.map +0 -1
  67. package/dist/templates/intelligence-types.d.ts +0 -1
  68. package/dist/templates/intelligence-types.js +0 -24
  69. package/dist/templates/intelligence-types.js.map +0 -1
  70. package/dist/templates/llm-client.d.ts +0 -7
  71. package/dist/templates/llm-client.js +0 -300
  72. package/dist/templates/llm-client.js.map +0 -1
  73. package/dist/templates/llm-key-pool.d.ts +0 -7
  74. package/dist/templates/llm-key-pool.js +0 -211
  75. package/dist/templates/llm-key-pool.js.map +0 -1
  76. package/dist/templates/llm-types.d.ts +0 -5
  77. package/dist/templates/llm-types.js +0 -161
  78. package/dist/templates/llm-types.js.map +0 -1
  79. package/dist/templates/llm-utils.d.ts +0 -5
  80. package/dist/templates/llm-utils.js +0 -260
  81. package/dist/templates/llm-utils.js.map +0 -1
  82. package/dist/templates/planner.d.ts +0 -5
  83. package/dist/templates/planner.js +0 -150
  84. package/dist/templates/planner.js.map +0 -1
  85. package/dist/templates/test-brain.d.ts +0 -6
  86. package/dist/templates/test-brain.js +0 -474
  87. package/dist/templates/test-brain.js.map +0 -1
  88. package/dist/templates/test-llm.d.ts +0 -7
  89. package/dist/templates/test-llm.js +0 -574
  90. package/dist/templates/test-llm.js.map +0 -1
  91. package/dist/templates/test-loader.d.ts +0 -5
  92. package/dist/templates/test-loader.js +0 -146
  93. package/dist/templates/test-loader.js.map +0 -1
  94. package/dist/templates/test-planner.d.ts +0 -5
  95. package/dist/templates/test-planner.js +0 -271
  96. package/dist/templates/test-planner.js.map +0 -1
  97. package/dist/templates/test-vault.d.ts +0 -5
  98. package/dist/templates/test-vault.js +0 -380
  99. package/dist/templates/test-vault.js.map +0 -1
  100. package/dist/templates/vault.d.ts +0 -5
  101. package/dist/templates/vault.js +0 -263
  102. package/dist/templates/vault.js.map +0 -1
@@ -1,161 +0,0 @@
1
- /**
2
- * Generate the LLM types file for a new agent.
3
- * Contains all types, LLMError class, and SecretString class.
4
- */
5
- export function generateLLMTypes() {
6
- return `/**
7
- * LLM Module Types
8
- * Generated by Soleri — do not edit manually.
9
- */
10
-
11
- // =============================================================================
12
- // SECRET STRING
13
- // =============================================================================
14
-
15
- const REDACTED = '[REDACTED]';
16
-
17
- export class SecretString {
18
- #value: string;
19
-
20
- constructor(value: string) {
21
- this.#value = value;
22
- }
23
-
24
- expose(): string {
25
- return this.#value;
26
- }
27
-
28
- get isSet(): boolean {
29
- return this.#value.length > 0;
30
- }
31
-
32
- toString(): string {
33
- return REDACTED;
34
- }
35
- toJSON(): string {
36
- return REDACTED;
37
- }
38
- [Symbol.toPrimitive](): string {
39
- return REDACTED;
40
- }
41
- [Symbol.for('nodejs.util.inspect.custom')](): string {
42
- return REDACTED;
43
- }
44
- }
45
-
46
- // =============================================================================
47
- // LLM ERROR
48
- // =============================================================================
49
-
50
- export class LLMError extends Error {
51
- retryable: boolean;
52
- statusCode?: number;
53
-
54
- constructor(message: string, options?: { retryable?: boolean; statusCode?: number }) {
55
- super(message);
56
- this.name = 'LLMError';
57
- this.retryable = options?.retryable ?? false;
58
- this.statusCode = options?.statusCode;
59
- Object.setPrototypeOf(this, LLMError.prototype);
60
- }
61
- }
62
-
63
- // =============================================================================
64
- // LLM CALL TYPES
65
- // =============================================================================
66
-
67
- export interface LLMCallOptions {
68
- provider: 'openai' | 'anthropic';
69
- model: string;
70
- systemPrompt: string;
71
- userPrompt: string;
72
- temperature?: number;
73
- maxTokens?: number;
74
- caller: string;
75
- task?: string;
76
- }
77
-
78
- export interface LLMCallResult {
79
- text: string;
80
- model: string;
81
- provider: 'openai' | 'anthropic';
82
- inputTokens?: number;
83
- outputTokens?: number;
84
- durationMs: number;
85
- }
86
-
87
- // =============================================================================
88
- // CIRCUIT BREAKER TYPES
89
- // =============================================================================
90
-
91
- export type CircuitState = 'closed' | 'open' | 'half-open';
92
-
93
- export interface CircuitBreakerConfig {
94
- failureThreshold: number;
95
- resetTimeoutMs: number;
96
- name: string;
97
- }
98
-
99
- export interface CircuitBreakerSnapshot {
100
- state: CircuitState;
101
- failureCount: number;
102
- lastFailureAt: number | null;
103
- }
104
-
105
- // =============================================================================
106
- // KEY POOL TYPES
107
- // =============================================================================
108
-
109
- export interface KeyPoolConfig {
110
- keys: string[];
111
- preemptiveThreshold?: number;
112
- }
113
-
114
- export interface KeyStatus {
115
- index: number;
116
- circuitState: CircuitBreakerSnapshot;
117
- remainingQuota: number | null;
118
- }
119
-
120
- // =============================================================================
121
- // ROUTING TYPES
122
- // =============================================================================
123
-
124
- export interface RouteEntry {
125
- caller: string;
126
- task?: string;
127
- model: string;
128
- provider: 'openai' | 'anthropic';
129
- }
130
-
131
- export interface RoutingConfig {
132
- routes: RouteEntry[];
133
- defaultOpenAIModel: string;
134
- defaultAnthropicModel: string;
135
- }
136
-
137
- // =============================================================================
138
- // RATE LIMIT TYPES
139
- // =============================================================================
140
-
141
- export interface RateLimitInfo {
142
- remaining: number | null;
143
- resetMs: number | null;
144
- retryAfterMs: number | null;
145
- }
146
-
147
- // =============================================================================
148
- // RETRY TYPES
149
- // =============================================================================
150
-
151
- export interface RetryConfig {
152
- maxAttempts: number;
153
- baseDelayMs: number;
154
- maxDelayMs: number;
155
- jitter: number;
156
- shouldRetry?: (error: unknown) => boolean;
157
- onRetry?: (error: unknown, attempt: number, delayMs: number) => void;
158
- }
159
- `;
160
- }
161
- //# sourceMappingURL=llm-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"llm-types.js","sourceRoot":"","sources":["../../src/templates/llm-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyJR,CAAC;AACF,CAAC"}
@@ -1,5 +0,0 @@
1
- /**
2
- * Generate the LLM utils file for a new agent.
3
- * Contains CircuitBreaker, retry with backoff+jitter, and rate limit header parser.
4
- */
5
- export declare function generateLLMUtils(): string;
@@ -1,260 +0,0 @@
1
- /**
2
- * Generate the LLM utils file for a new agent.
3
- * Contains CircuitBreaker, retry with backoff+jitter, and rate limit header parser.
4
- */
5
- export function generateLLMUtils() {
6
- return `/**
7
- * LLM Utilities — Circuit Breaker, Retry, Rate Limit Parser
8
- * Generated by Soleri — do not edit manually.
9
- */
10
-
11
- import type {
12
- CircuitBreakerConfig,
13
- CircuitBreakerSnapshot,
14
- CircuitState,
15
- LLMError,
16
- RateLimitInfo,
17
- RetryConfig,
18
- } from './types.js';
19
-
20
- // =============================================================================
21
- // HELPERS
22
- // =============================================================================
23
-
24
- function isRetryable(error: unknown): boolean {
25
- if (error && typeof error === 'object' && 'retryable' in error) {
26
- return (error as { retryable: boolean }).retryable === true;
27
- }
28
- return false;
29
- }
30
-
31
- function sleep(ms: number): Promise<void> {
32
- return new Promise((resolve) => setTimeout(resolve, ms));
33
- }
34
-
35
- // =============================================================================
36
- // CIRCUIT BREAKER
37
- // =============================================================================
38
-
39
- const DEFAULT_CB_CONFIG: CircuitBreakerConfig = {
40
- failureThreshold: 5,
41
- resetTimeoutMs: 60_000,
42
- name: 'default',
43
- };
44
-
45
- export class CircuitOpenError extends Error {
46
- retryable = false;
47
- constructor(name: string) {
48
- super(\`\${name} circuit breaker is open — calls are being rejected\`);
49
- this.name = 'CircuitOpenError';
50
- Object.setPrototypeOf(this, CircuitOpenError.prototype);
51
- }
52
- }
53
-
54
- export class CircuitBreaker {
55
- private state: CircuitState = 'closed';
56
- private failureCount = 0;
57
- private lastFailureAt: number | null = null;
58
- private readonly config: CircuitBreakerConfig;
59
-
60
- constructor(config?: Partial<CircuitBreakerConfig>) {
61
- this.config = { ...DEFAULT_CB_CONFIG, ...config };
62
- }
63
-
64
- async call<T>(fn: () => Promise<T>): Promise<T> {
65
- if (this.state === 'open') {
66
- if (this.shouldProbe()) {
67
- this.transitionTo('half-open');
68
- } else {
69
- throw new CircuitOpenError(this.config.name);
70
- }
71
- }
72
-
73
- try {
74
- const result = await fn();
75
- this.onSuccess();
76
- return result;
77
- } catch (error) {
78
- this.onFailure(error);
79
- throw error;
80
- }
81
- }
82
-
83
- getState(): CircuitBreakerSnapshot {
84
- if (this.state === 'open' && this.shouldProbe()) {
85
- this.transitionTo('half-open');
86
- }
87
- return {
88
- state: this.state,
89
- failureCount: this.failureCount,
90
- lastFailureAt: this.lastFailureAt,
91
- };
92
- }
93
-
94
- isOpen(): boolean {
95
- return this.state === 'open' && !this.shouldProbe();
96
- }
97
-
98
- reset(): void {
99
- this.transitionTo('closed');
100
- this.failureCount = 0;
101
- this.lastFailureAt = null;
102
- }
103
-
104
- /** Synchronously record a failure (used by KeyPool to trip breaker without async) */
105
- recordFailure(): void {
106
- this.failureCount++;
107
- this.lastFailureAt = Date.now();
108
- if (this.state === 'half-open') {
109
- this.transitionTo('open');
110
- return;
111
- }
112
- if (this.failureCount >= this.config.failureThreshold) {
113
- console.error(\`[LLM] CircuitBreaker:\${this.config.name} threshold reached (\${this.failureCount}/\${this.config.failureThreshold}) — opening\`);
114
- this.transitionTo('open');
115
- }
116
- }
117
-
118
- private onSuccess(): void {
119
- this.failureCount = 0;
120
- this.transitionTo('closed');
121
- }
122
-
123
- private onFailure(error: unknown): void {
124
- if (!isRetryable(error)) {
125
- return;
126
- }
127
-
128
- this.failureCount++;
129
- this.lastFailureAt = Date.now();
130
-
131
- if (this.state === 'half-open') {
132
- this.transitionTo('open');
133
- return;
134
- }
135
-
136
- if (this.failureCount >= this.config.failureThreshold) {
137
- console.error(\`[LLM] CircuitBreaker:\${this.config.name} threshold reached (\${this.failureCount}/\${this.config.failureThreshold}) — opening\`);
138
- this.transitionTo('open');
139
- }
140
- }
141
-
142
- private shouldProbe(): boolean {
143
- if (this.lastFailureAt === null) return false;
144
- return Date.now() - this.lastFailureAt >= this.config.resetTimeoutMs;
145
- }
146
-
147
- private transitionTo(newState: CircuitState): void {
148
- if (this.state !== newState) {
149
- this.state = newState;
150
- }
151
- }
152
- }
153
-
154
- // =============================================================================
155
- // RETRY
156
- // =============================================================================
157
-
158
- const DEFAULT_RETRY_CONFIG: RetryConfig = {
159
- maxAttempts: 3,
160
- baseDelayMs: 1000,
161
- maxDelayMs: 30000,
162
- jitter: 0.1,
163
- };
164
-
165
- export function computeDelay(
166
- error: unknown,
167
- attempt: number,
168
- config: RetryConfig,
169
- ): number {
170
- const retryAfterMs = (error as Partial<LLMError> & { retryAfterMs?: number })?.retryAfterMs;
171
- if (retryAfterMs !== undefined && retryAfterMs > 0) {
172
- return Math.min(retryAfterMs, config.maxDelayMs);
173
- }
174
-
175
- const exponential = config.baseDelayMs * Math.pow(2, attempt);
176
- const capped = Math.min(exponential, config.maxDelayMs);
177
-
178
- const jitterRange = capped * config.jitter;
179
- const jitterOffset = (Math.random() * 2 - 1) * jitterRange;
180
-
181
- return Math.max(0, Math.round(capped + jitterOffset));
182
- }
183
-
184
- export async function retry<T>(
185
- fn: () => Promise<T>,
186
- config?: Partial<RetryConfig>,
187
- ): Promise<T> {
188
- const resolved: RetryConfig = { ...DEFAULT_RETRY_CONFIG, ...config };
189
- const shouldRetry = resolved.shouldRetry ?? isRetryable;
190
-
191
- let lastError: unknown;
192
-
193
- for (let attempt = 0; attempt < resolved.maxAttempts; attempt++) {
194
- try {
195
- return await fn();
196
- } catch (error) {
197
- lastError = error;
198
-
199
- if (attempt >= resolved.maxAttempts - 1 || !shouldRetry(error)) {
200
- throw error;
201
- }
202
-
203
- const delay = computeDelay(error, attempt, resolved);
204
- resolved.onRetry?.(error, attempt + 1, delay);
205
-
206
- await sleep(delay);
207
- }
208
- }
209
-
210
- throw lastError;
211
- }
212
-
213
- // =============================================================================
214
- // RATE LIMIT HEADER PARSER
215
- // =============================================================================
216
-
217
- export function parseRateLimitHeaders(headers: Headers): RateLimitInfo {
218
- const remaining = headers.get('x-ratelimit-remaining-requests');
219
- const reset = headers.get('x-ratelimit-reset-requests');
220
- const retryAfter = headers.get('retry-after');
221
-
222
- return {
223
- remaining: remaining !== null ? parseInt(remaining, 10) : null,
224
- resetMs: reset !== null ? parseResetDuration(reset) : null,
225
- retryAfterMs: retryAfter !== null ? parseRetryAfter(retryAfter) : null,
226
- };
227
- }
228
-
229
- function parseResetDuration(value: string): number | null {
230
- let totalMs = 0;
231
- let matched = false;
232
-
233
- const minMatch = value.match(/(\\d+)m(?!\\s*s)/);
234
- if (minMatch) {
235
- totalMs += parseInt(minMatch[1], 10) * 60_000;
236
- matched = true;
237
- }
238
-
239
- const msMatch = value.match(/(\\d+)ms/);
240
- if (msMatch) {
241
- totalMs += parseInt(msMatch[1], 10);
242
- matched = true;
243
- }
244
-
245
- const secMatch = value.match(/(\\d+)(?<!m)s/);
246
- if (secMatch) {
247
- totalMs += parseInt(secMatch[1], 10) * 1000;
248
- matched = true;
249
- }
250
-
251
- return matched ? totalMs : null;
252
- }
253
-
254
- function parseRetryAfter(value: string): number | null {
255
- const seconds = parseFloat(value);
256
- return isNaN(seconds) ? null : Math.ceil(seconds * 1000);
257
- }
258
- `;
259
- }
260
- //# sourceMappingURL=llm-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"llm-utils.js","sourceRoot":"","sources":["../../src/templates/llm-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4PR,CAAC;AACF,CAAC"}
@@ -1,5 +0,0 @@
1
- /**
2
- * Generates src/planning/planner.ts for a new agent.
3
- * The Planner provides JSON-file-backed plan management with state machine transitions.
4
- */
5
- export declare function generatePlanner(): string;
@@ -1,150 +0,0 @@
1
- /**
2
- * Generates src/planning/planner.ts for a new agent.
3
- * The Planner provides JSON-file-backed plan management with state machine transitions.
4
- */
5
- export function generatePlanner() {
6
- return PLANNER_TEMPLATE;
7
- }
8
- const PLANNER_TEMPLATE = [
9
- "import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';",
10
- "import { dirname } from 'node:path';",
11
- '',
12
- "export type PlanStatus = 'draft' | 'approved' | 'executing' | 'completed';",
13
- "export type TaskStatus = 'pending' | 'in_progress' | 'completed' | 'skipped' | 'failed';",
14
- '',
15
- 'export interface PlanTask {',
16
- ' id: string;',
17
- ' title: string;',
18
- ' description: string;',
19
- ' status: TaskStatus;',
20
- ' updatedAt: number;',
21
- '}',
22
- '',
23
- 'export interface Plan {',
24
- ' id: string;',
25
- ' objective: string;',
26
- ' scope: string;',
27
- ' status: PlanStatus;',
28
- ' decisions: string[];',
29
- ' tasks: PlanTask[];',
30
- ' createdAt: number;',
31
- ' updatedAt: number;',
32
- '}',
33
- '',
34
- 'export interface PlanStore {',
35
- ' version: string;',
36
- ' plans: Plan[];',
37
- '}',
38
- '',
39
- 'export class Planner {',
40
- ' private filePath: string;',
41
- ' private store: PlanStore;',
42
- '',
43
- ' constructor(filePath: string) {',
44
- ' this.filePath = filePath;',
45
- ' this.store = this.load();',
46
- ' }',
47
- '',
48
- ' private load(): PlanStore {',
49
- ' if (!existsSync(this.filePath)) {',
50
- " return { version: '1.0', plans: [] };",
51
- ' }',
52
- ' try {',
53
- " const data = readFileSync(this.filePath, 'utf-8');",
54
- ' return JSON.parse(data) as PlanStore;',
55
- ' } catch {',
56
- " return { version: '1.0', plans: [] };",
57
- ' }',
58
- ' }',
59
- '',
60
- ' private save(): void {',
61
- ' mkdirSync(dirname(this.filePath), { recursive: true });',
62
- " writeFileSync(this.filePath, JSON.stringify(this.store, null, 2), 'utf-8');",
63
- ' }',
64
- '',
65
- ' create(params: { objective: string; scope: string; decisions?: string[]; tasks?: Array<{ title: string; description: string }> }): Plan {',
66
- ' const now = Date.now();',
67
- ' const plan: Plan = {',
68
- ' id: `plan-${now}-${Math.random().toString(36).slice(2, 8)}`,',
69
- ' objective: params.objective,',
70
- ' scope: params.scope,',
71
- " status: 'draft',",
72
- ' decisions: params.decisions ?? [],',
73
- ' tasks: (params.tasks ?? []).map((t, i) => ({',
74
- ' id: `task-${i + 1}`,',
75
- ' title: t.title,',
76
- ' description: t.description,',
77
- " status: 'pending' as TaskStatus,",
78
- ' updatedAt: now,',
79
- ' })),',
80
- ' createdAt: now,',
81
- ' updatedAt: now,',
82
- ' };',
83
- ' this.store.plans.push(plan);',
84
- ' this.save();',
85
- ' return plan;',
86
- ' }',
87
- '',
88
- ' get(planId: string): Plan | null {',
89
- ' return this.store.plans.find((p) => p.id === planId) ?? null;',
90
- ' }',
91
- '',
92
- ' list(): Plan[] {',
93
- ' return [...this.store.plans];',
94
- ' }',
95
- '',
96
- ' approve(planId: string): Plan {',
97
- ' const plan = this.get(planId);',
98
- ' if (!plan) throw new Error(`Plan not found: ${planId}`);',
99
- " if (plan.status !== 'draft') throw new Error(`Cannot approve plan in '${plan.status}' status — must be 'draft'`);",
100
- " plan.status = 'approved';",
101
- ' plan.updatedAt = Date.now();',
102
- ' this.save();',
103
- ' return plan;',
104
- ' }',
105
- '',
106
- ' startExecution(planId: string): Plan {',
107
- ' const plan = this.get(planId);',
108
- ' if (!plan) throw new Error(`Plan not found: ${planId}`);',
109
- " if (plan.status !== 'approved') throw new Error(`Cannot execute plan in '${plan.status}' status — must be 'approved'`);",
110
- " plan.status = 'executing';",
111
- ' plan.updatedAt = Date.now();',
112
- ' this.save();',
113
- ' return plan;',
114
- ' }',
115
- '',
116
- ' updateTask(planId: string, taskId: string, status: TaskStatus): Plan {',
117
- ' const plan = this.get(planId);',
118
- ' if (!plan) throw new Error(`Plan not found: ${planId}`);',
119
- " if (plan.status !== 'executing') throw new Error(`Cannot update tasks on plan in '${plan.status}' status — must be 'executing'`);",
120
- ' const task = plan.tasks.find((t) => t.id === taskId);',
121
- ' if (!task) throw new Error(`Task not found: ${taskId}`);',
122
- ' task.status = status;',
123
- ' task.updatedAt = Date.now();',
124
- ' plan.updatedAt = Date.now();',
125
- " // Auto-transition: if plan is executing and first task starts, that's fine",
126
- ' // Auto-start execution when approving and updating first task',
127
- ' this.save();',
128
- ' return plan;',
129
- ' }',
130
- '',
131
- ' complete(planId: string): Plan {',
132
- ' const plan = this.get(planId);',
133
- ' if (!plan) throw new Error(`Plan not found: ${planId}`);',
134
- " if (plan.status !== 'executing') throw new Error(`Cannot complete plan in '${plan.status}' status — must be 'executing'`);",
135
- " plan.status = 'completed';",
136
- ' plan.updatedAt = Date.now();',
137
- ' this.save();',
138
- ' return plan;',
139
- ' }',
140
- '',
141
- ' getExecuting(): Plan[] {',
142
- " return this.store.plans.filter((p) => p.status === 'executing');",
143
- ' }',
144
- '',
145
- ' getActive(): Plan[] {',
146
- " return this.store.plans.filter((p) => p.status === 'draft' || p.status === 'approved' || p.status === 'executing');",
147
- ' }',
148
- '}',
149
- ].join('\n');
150
- //# sourceMappingURL=planner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"planner.js","sourceRoot":"","sources":["../../src/templates/planner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,MAAM,gBAAgB,GAAG;IACvB,+EAA+E;IAC/E,sCAAsC;IACtC,EAAE;IACF,4EAA4E;IAC5E,0FAA0F;IAC1F,EAAE;IACF,6BAA6B;IAC7B,eAAe;IACf,kBAAkB;IAClB,wBAAwB;IACxB,uBAAuB;IACvB,sBAAsB;IACtB,GAAG;IACH,EAAE;IACF,yBAAyB;IACzB,eAAe;IACf,sBAAsB;IACtB,kBAAkB;IAClB,uBAAuB;IACvB,wBAAwB;IACxB,sBAAsB;IACtB,sBAAsB;IACtB,sBAAsB;IACtB,GAAG;IACH,EAAE;IACF,8BAA8B;IAC9B,oBAAoB;IACpB,kBAAkB;IAClB,GAAG;IACH,EAAE;IACF,wBAAwB;IACxB,6BAA6B;IAC7B,6BAA6B;IAC7B,EAAE;IACF,mCAAmC;IACnC,+BAA+B;IAC/B,+BAA+B;IAC/B,KAAK;IACL,EAAE;IACF,+BAA+B;IAC/B,uCAAuC;IACvC,6CAA6C;IAC7C,OAAO;IACP,WAAW;IACX,0DAA0D;IAC1D,6CAA6C;IAC7C,eAAe;IACf,6CAA6C;IAC7C,OAAO;IACP,KAAK;IACL,EAAE;IACF,0BAA0B;IAC1B,6DAA6D;IAC7D,iFAAiF;IACjF,KAAK;IACL,EAAE;IACF,6IAA6I;IAC7I,6BAA6B;IAC7B,0BAA0B;IAC1B,oEAAoE;IACpE,oCAAoC;IACpC,4BAA4B;IAC5B,wBAAwB;IACxB,0CAA0C;IAC1C,oDAAoD;IACpD,8BAA8B;IAC9B,yBAAyB;IACzB,qCAAqC;IACrC,0CAA0C;IAC1C,yBAAyB;IACzB,YAAY;IACZ,uBAAuB;IACvB,uBAAuB;IACvB,QAAQ;IACR,kCAAkC;IAClC,kBAAkB;IAClB,kBAAkB;IAClB,KAAK;IACL,EAAE;IACF,sCAAsC;IACtC,mEAAmE;IACnE,KAAK;IACL,EAAE;IACF,oBAAoB;IACpB,mCAAmC;IACnC,KAAK;IACL,EAAE;IACF,mCAAmC;IACnC,oCAAoC;IACpC,8DAA8D;IAC9D,uHAAuH;IACvH,+BAA+B;IAC/B,kCAAkC;IAClC,kBAAkB;IAClB,kBAAkB;IAClB,KAAK;IACL,EAAE;IACF,0CAA0C;IAC1C,oCAAoC;IACpC,8DAA8D;IAC9D,6HAA6H;IAC7H,gCAAgC;IAChC,kCAAkC;IAClC,kBAAkB;IAClB,kBAAkB;IAClB,KAAK;IACL,EAAE;IACF,0EAA0E;IAC1E,oCAAoC;IACpC,8DAA8D;IAC9D,uIAAuI;IACvI,2DAA2D;IAC3D,8DAA8D;IAC9D,2BAA2B;IAC3B,kCAAkC;IAClC,kCAAkC;IAClC,iFAAiF;IACjF,oEAAoE;IACpE,kBAAkB;IAClB,kBAAkB;IAClB,KAAK;IACL,EAAE;IACF,oCAAoC;IACpC,oCAAoC;IACpC,8DAA8D;IAC9D,gIAAgI;IAChI,gCAAgC;IAChC,kCAAkC;IAClC,kBAAkB;IAClB,kBAAkB;IAClB,KAAK;IACL,EAAE;IACF,4BAA4B;IAC5B,sEAAsE;IACtE,KAAK;IACL,EAAE;IACF,yBAAyB;IACzB,yHAAyH;IACzH,KAAK;IACL,GAAG;CACJ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Generates brain test file for a new agent.
3
- * Tests cover: TF-IDF scoring, intelligent search, auto-tagging,
4
- * duplicate detection, feedback, adaptive weights, vocabulary.
5
- */
6
- export declare function generateBrainTest(): string;