smithers-orchestrator 0.1.7 → 0.1.9
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/components/Ralph.d.ts +14 -0
- package/dist/components/Ralph.d.ts.map +1 -1
- package/dist/components/Ralph.jsx +75 -10
- package/dist/components/Ralph.jsx.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/orchestrator/db/schema.sql +429 -0
- package/dist/solid/root.d.ts +5 -1
- package/dist/solid/root.d.ts.map +1 -1
- package/dist/solid/root.js +19 -2
- package/dist/solid/root.js.map +1 -1
- package/package.json +2 -2
|
@@ -8,9 +8,23 @@ export interface RalphContextType {
|
|
|
8
8
|
completeTask: () => void;
|
|
9
9
|
}
|
|
10
10
|
export declare const RalphContext: import("solid-js").Context<RalphContextType | undefined>;
|
|
11
|
+
/**
|
|
12
|
+
* Create a promise that resolves when orchestration completes.
|
|
13
|
+
* Called by createSmithersRoot before mounting.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createOrchestrationPromise(): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Signal that orchestration is complete (called internally by Ralph)
|
|
18
|
+
*/
|
|
19
|
+
export declare function signalOrchestrationComplete(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Signal that orchestration failed (called internally by Ralph)
|
|
22
|
+
*/
|
|
23
|
+
export declare function signalOrchestrationError(err: Error): void;
|
|
11
24
|
export interface RalphProps {
|
|
12
25
|
maxIterations?: number;
|
|
13
26
|
onIteration?: (iteration: number) => void;
|
|
27
|
+
onComplete?: () => void;
|
|
14
28
|
children?: JSX.Element;
|
|
15
29
|
}
|
|
16
30
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ralph.d.ts","sourceRoot":"","sources":["../../src/components/Ralph.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,GAAG,EAAE,MAAM,UAAU,CAAA;AAEzE;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,IAAI,CAAA;IACxB,YAAY,EAAE,MAAM,IAAI,CAAA;CACzB;AAED,eAAO,MAAM,YAAY,0DAAyD,CAAA;
|
|
1
|
+
{"version":3,"file":"Ralph.d.ts","sourceRoot":"","sources":["../../src/components/Ralph.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,GAAG,EAAE,MAAM,UAAU,CAAA;AAEzE;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,IAAI,CAAA;IACxB,YAAY,EAAE,MAAM,IAAI,CAAA;CACzB;AAED,eAAO,MAAM,YAAY,0DAAyD,CAAA;AAMlF;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,OAAO,CAAC,IAAI,CAAC,CAK1D;AAED;;GAEG;AACH,wBAAgB,2BAA2B,IAAI,IAAI,CAMlD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI,CAMzD;AAED,MAAM,WAAW,UAAU;IACzB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;IACzC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;IACvB,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CACvB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,GAAG,CAAC,OAAO,CA4FpD"}
|
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
import { createContext, createSignal, onMount } from 'solid-js';
|
|
2
2
|
export const RalphContext = createContext(undefined);
|
|
3
|
+
// Global completion tracking for the root to await
|
|
4
|
+
let _orchestrationResolve = null;
|
|
5
|
+
let _orchestrationReject = null;
|
|
6
|
+
/**
|
|
7
|
+
* Create a promise that resolves when orchestration completes.
|
|
8
|
+
* Called by createSmithersRoot before mounting.
|
|
9
|
+
*/
|
|
10
|
+
export function createOrchestrationPromise() {
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
_orchestrationResolve = resolve;
|
|
13
|
+
_orchestrationReject = reject;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Signal that orchestration is complete (called internally by Ralph)
|
|
18
|
+
*/
|
|
19
|
+
export function signalOrchestrationComplete() {
|
|
20
|
+
if (_orchestrationResolve) {
|
|
21
|
+
_orchestrationResolve();
|
|
22
|
+
_orchestrationResolve = null;
|
|
23
|
+
_orchestrationReject = null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Signal that orchestration failed (called internally by Ralph)
|
|
28
|
+
*/
|
|
29
|
+
export function signalOrchestrationError(err) {
|
|
30
|
+
if (_orchestrationReject) {
|
|
31
|
+
_orchestrationReject(err);
|
|
32
|
+
_orchestrationResolve = null;
|
|
33
|
+
_orchestrationReject = null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
3
36
|
/**
|
|
4
37
|
* Ralph component - manages the remount loop.
|
|
5
38
|
*
|
|
@@ -15,9 +48,11 @@ export function Ralph(props) {
|
|
|
15
48
|
const [iteration, setIteration] = createSignal(0);
|
|
16
49
|
const [pendingTasks, setPendingTasks] = createSignal(0);
|
|
17
50
|
const [key, setKey] = createSignal(0);
|
|
51
|
+
const [hasStartedTasks, setHasStartedTasks] = createSignal(false);
|
|
18
52
|
const maxIterations = props.maxIterations || 100;
|
|
19
53
|
const contextValue = {
|
|
20
54
|
registerTask: () => {
|
|
55
|
+
setHasStartedTasks(true);
|
|
21
56
|
setPendingTasks((p) => p + 1);
|
|
22
57
|
},
|
|
23
58
|
completeTask: () => {
|
|
@@ -27,20 +62,50 @@ export function Ralph(props) {
|
|
|
27
62
|
onMount(() => {
|
|
28
63
|
// Monitor pending tasks and trigger remount when all complete
|
|
29
64
|
let checkInterval = null;
|
|
65
|
+
let stableCount = 0; // Count consecutive stable checks (no tasks running)
|
|
30
66
|
checkInterval = setInterval(() => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
67
|
+
const pending = pendingTasks();
|
|
68
|
+
const currentIteration = iteration();
|
|
69
|
+
// If tasks are running, reset stable counter
|
|
70
|
+
if (pending > 0) {
|
|
71
|
+
stableCount = 0;
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
// If no tasks have ever started and we've waited a bit, complete
|
|
75
|
+
if (!hasStartedTasks()) {
|
|
76
|
+
stableCount++;
|
|
77
|
+
// Wait 500ms (50 checks) before declaring no work to do
|
|
78
|
+
if (stableCount > 50) {
|
|
41
79
|
if (checkInterval)
|
|
42
80
|
clearInterval(checkInterval);
|
|
81
|
+
signalOrchestrationComplete();
|
|
82
|
+
props.onComplete?.();
|
|
43
83
|
}
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
// Tasks have completed - check if we should continue or finish
|
|
87
|
+
stableCount++;
|
|
88
|
+
// Wait at least 100ms (10 checks) for any new tasks to register
|
|
89
|
+
if (stableCount < 10) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
// All tasks complete
|
|
93
|
+
if (currentIteration >= maxIterations - 1) {
|
|
94
|
+
// Max iterations reached
|
|
95
|
+
if (checkInterval)
|
|
96
|
+
clearInterval(checkInterval);
|
|
97
|
+
signalOrchestrationComplete();
|
|
98
|
+
props.onComplete?.();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
// Trigger remount for next iteration
|
|
102
|
+
const nextIteration = currentIteration + 1;
|
|
103
|
+
setIteration(nextIteration);
|
|
104
|
+
setKey((k) => k + 1);
|
|
105
|
+
setHasStartedTasks(false); // Reset for next iteration
|
|
106
|
+
stableCount = 0;
|
|
107
|
+
if (props.onIteration) {
|
|
108
|
+
props.onIteration(nextIteration);
|
|
44
109
|
}
|
|
45
110
|
}, 10); // Check every 10ms
|
|
46
111
|
// Cleanup on unmount
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ralph.jsx","sourceRoot":"","sources":["../../src/components/Ralph.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAY,MAAM,UAAU,CAAA;AAWzE,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAA+B,SAAS,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"Ralph.jsx","sourceRoot":"","sources":["../../src/components/Ralph.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAY,MAAM,UAAU,CAAA;AAWzE,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAA+B,SAAS,CAAC,CAAA;AAElF,mDAAmD;AACnD,IAAI,qBAAqB,GAAwB,IAAI,CAAA;AACrD,IAAI,oBAAoB,GAAkC,IAAI,CAAA;AAE9D;;;GAGG;AACH,MAAM,UAAU,0BAA0B;IACxC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,qBAAqB,GAAG,OAAO,CAAA;QAC/B,oBAAoB,GAAG,MAAM,CAAA;IAC/B,CAAC,CAAC,CAAA;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2BAA2B;IACzC,IAAI,qBAAqB,EAAE,CAAC;QAC1B,qBAAqB,EAAE,CAAA;QACvB,qBAAqB,GAAG,IAAI,CAAA;QAC5B,oBAAoB,GAAG,IAAI,CAAA;IAC7B,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,GAAU;IACjD,IAAI,oBAAoB,EAAE,CAAC;QACzB,oBAAoB,CAAC,GAAG,CAAC,CAAA;QACzB,qBAAqB,GAAG,IAAI,CAAA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AAC,YAAY,CAAC,CACzC;MAAA,CAAC,KAAK,CACJ,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CACX,SAAS,CAAC,CAAC,SAAS,EAAE,CAAC,CACvB,OAAO,CAAC,CAAC,YAAY,EAAE,CAAC,CACxB,aAAa,CAAC,CAAC,aAAa,CAAC,CAE7B;QAAA,CAAC,KAAK,CAAC,QAAQ,CACjB;MAAA,EAAE,KAAK,CACT;IAAA,EAAE,YAAY,CAAC,QAAQ,CAAC,CACzB,CAAA;AACH,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* JSX components for Smithers
|
|
3
3
|
*/
|
|
4
4
|
export { Claude, type ClaudeProps } from './Claude.jsx';
|
|
5
|
-
export { Ralph, type RalphProps, RalphContext, type RalphContextType } from './Ralph.jsx';
|
|
5
|
+
export { Ralph, type RalphProps, RalphContext, type RalphContextType, createOrchestrationPromise, signalOrchestrationComplete, signalOrchestrationError, } from './Ralph.jsx';
|
|
6
6
|
export { Phase, type PhaseProps } from './Phase.jsx';
|
|
7
7
|
export { Step, type StepProps } from './Step.jsx';
|
|
8
8
|
export * from './Git/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AACvD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AACvD,OAAO,EACL,KAAK,EACL,KAAK,UAAU,EACf,YAAY,EACZ,KAAK,gBAAgB,EACrB,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAGjD,cAAc,gBAAgB,CAAA;AAG9B,cAAc,gBAAgB,CAAA;AAG9B,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA"}
|
package/dist/components/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* JSX components for Smithers
|
|
3
3
|
*/
|
|
4
4
|
export { Claude } from './Claude.jsx';
|
|
5
|
-
export { Ralph, RalphContext } from './Ralph.jsx';
|
|
5
|
+
export { Ralph, RalphContext, createOrchestrationPromise, signalOrchestrationComplete, signalOrchestrationError, } from './Ralph.jsx';
|
|
6
6
|
export { Phase } from './Phase.jsx';
|
|
7
7
|
export { Step } from './Step.jsx';
|
|
8
8
|
// Git VCS components
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAoB,MAAM,cAAc,CAAA;AACvD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAoB,MAAM,cAAc,CAAA;AACvD,OAAO,EACL,KAAK,EAEL,YAAY,EAEZ,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,KAAK,EAAmB,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,IAAI,EAAkB,MAAM,YAAY,CAAA;AAEjD,qBAAqB;AACrB,cAAc,gBAAgB,CAAA;AAE9B,sBAAsB;AACtB,cAAc,gBAAgB,CAAA;AAE9B,mBAAmB;AACnB,OAAO,EAAE,MAAM,EAA4E,MAAM,cAAc,CAAA;AAE/G,iCAAiC;AACjC,+DAA+D"}
|
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
-- Smithers Orchestrator Database Schema
|
|
2
|
+
-- PGlite-based state management with full auditability
|
|
3
|
+
|
|
4
|
+
-- Enable extensions
|
|
5
|
+
-- Note: pgvector for embeddings, uuid for ID generation
|
|
6
|
+
|
|
7
|
+
-- ============================================================================
|
|
8
|
+
-- 1. MEMORIES - Long-term Agent Knowledge
|
|
9
|
+
-- ============================================================================
|
|
10
|
+
|
|
11
|
+
CREATE TABLE IF NOT EXISTS memories (
|
|
12
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
13
|
+
|
|
14
|
+
-- Categorization
|
|
15
|
+
category TEXT NOT NULL, -- 'fact', 'learning', 'preference', 'context', 'skill'
|
|
16
|
+
scope TEXT DEFAULT 'global', -- 'global', 'project', 'session'
|
|
17
|
+
|
|
18
|
+
-- Content
|
|
19
|
+
key TEXT NOT NULL, -- Unique identifier within category
|
|
20
|
+
content TEXT NOT NULL, -- The actual memory content
|
|
21
|
+
-- embedding VECTOR(1536), -- Optional: for semantic search (requires pgvector)
|
|
22
|
+
|
|
23
|
+
-- Metadata
|
|
24
|
+
confidence REAL DEFAULT 1.0, -- 0.0-1.0, how certain is this memory
|
|
25
|
+
source TEXT, -- Where did this come from (agent, user, tool)
|
|
26
|
+
source_execution_id UUID, -- Which execution created this
|
|
27
|
+
|
|
28
|
+
-- Timestamps
|
|
29
|
+
created_at TIMESTAMPTZ DEFAULT NOW(),
|
|
30
|
+
updated_at TIMESTAMPTZ DEFAULT NOW(),
|
|
31
|
+
accessed_at TIMESTAMPTZ DEFAULT NOW(),
|
|
32
|
+
expires_at TIMESTAMPTZ, -- Optional TTL
|
|
33
|
+
|
|
34
|
+
-- Constraints
|
|
35
|
+
UNIQUE(category, scope, key)
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
CREATE INDEX IF NOT EXISTS idx_memories_category ON memories(category);
|
|
39
|
+
CREATE INDEX IF NOT EXISTS idx_memories_scope ON memories(scope);
|
|
40
|
+
CREATE INDEX IF NOT EXISTS idx_memories_key ON memories(key);
|
|
41
|
+
CREATE INDEX IF NOT EXISTS idx_memories_created ON memories(created_at DESC);
|
|
42
|
+
|
|
43
|
+
-- ============================================================================
|
|
44
|
+
-- 2. EXECUTIONS - Orchestration Runs
|
|
45
|
+
-- ============================================================================
|
|
46
|
+
|
|
47
|
+
CREATE TABLE IF NOT EXISTS executions (
|
|
48
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
49
|
+
|
|
50
|
+
-- Identity
|
|
51
|
+
name TEXT, -- Human-readable name
|
|
52
|
+
file_path TEXT NOT NULL, -- Path to .smithers/main.tsx
|
|
53
|
+
|
|
54
|
+
-- Status
|
|
55
|
+
status TEXT NOT NULL DEFAULT 'pending', -- 'pending', 'running', 'completed', 'failed', 'cancelled'
|
|
56
|
+
|
|
57
|
+
-- Configuration
|
|
58
|
+
config JSONB DEFAULT '{}', -- Max iterations, model settings, etc.
|
|
59
|
+
|
|
60
|
+
-- Results
|
|
61
|
+
result JSONB, -- Final output/result
|
|
62
|
+
error TEXT, -- Error message if failed
|
|
63
|
+
|
|
64
|
+
-- Timing
|
|
65
|
+
started_at TIMESTAMPTZ,
|
|
66
|
+
completed_at TIMESTAMPTZ,
|
|
67
|
+
created_at TIMESTAMPTZ DEFAULT NOW(),
|
|
68
|
+
|
|
69
|
+
-- Metrics
|
|
70
|
+
total_iterations INTEGER DEFAULT 0,
|
|
71
|
+
total_agents INTEGER DEFAULT 0,
|
|
72
|
+
total_tool_calls INTEGER DEFAULT 0,
|
|
73
|
+
total_tokens_used INTEGER DEFAULT 0
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
CREATE INDEX IF NOT EXISTS idx_executions_status ON executions(status);
|
|
77
|
+
CREATE INDEX IF NOT EXISTS idx_executions_created ON executions(created_at DESC);
|
|
78
|
+
|
|
79
|
+
-- ============================================================================
|
|
80
|
+
-- 3. PHASES - Workflow Stages
|
|
81
|
+
-- ============================================================================
|
|
82
|
+
|
|
83
|
+
CREATE TABLE IF NOT EXISTS phases (
|
|
84
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
85
|
+
execution_id UUID NOT NULL REFERENCES executions(id) ON DELETE CASCADE,
|
|
86
|
+
|
|
87
|
+
-- Identity
|
|
88
|
+
name TEXT NOT NULL,
|
|
89
|
+
iteration INTEGER NOT NULL DEFAULT 0, -- Which Ralph iteration
|
|
90
|
+
|
|
91
|
+
-- Status
|
|
92
|
+
status TEXT NOT NULL DEFAULT 'pending', -- 'pending', 'running', 'completed', 'skipped', 'failed'
|
|
93
|
+
|
|
94
|
+
-- Timing
|
|
95
|
+
started_at TIMESTAMPTZ,
|
|
96
|
+
completed_at TIMESTAMPTZ,
|
|
97
|
+
created_at TIMESTAMPTZ DEFAULT NOW(),
|
|
98
|
+
|
|
99
|
+
-- Metrics
|
|
100
|
+
duration_ms INTEGER,
|
|
101
|
+
agents_count INTEGER DEFAULT 0
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
CREATE INDEX IF NOT EXISTS idx_phases_execution ON phases(execution_id);
|
|
105
|
+
CREATE INDEX IF NOT EXISTS idx_phases_status ON phases(status);
|
|
106
|
+
CREATE INDEX IF NOT EXISTS idx_phases_created ON phases(created_at DESC);
|
|
107
|
+
|
|
108
|
+
-- ============================================================================
|
|
109
|
+
-- 4. AGENTS - Claude Executions
|
|
110
|
+
-- ============================================================================
|
|
111
|
+
|
|
112
|
+
CREATE TABLE IF NOT EXISTS agents (
|
|
113
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
114
|
+
execution_id UUID NOT NULL REFERENCES executions(id) ON DELETE CASCADE,
|
|
115
|
+
phase_id UUID REFERENCES phases(id) ON DELETE SET NULL,
|
|
116
|
+
|
|
117
|
+
-- Configuration
|
|
118
|
+
model TEXT NOT NULL DEFAULT 'sonnet',
|
|
119
|
+
system_prompt TEXT,
|
|
120
|
+
|
|
121
|
+
-- Input
|
|
122
|
+
prompt TEXT NOT NULL, -- The children content
|
|
123
|
+
|
|
124
|
+
-- Status
|
|
125
|
+
status TEXT NOT NULL DEFAULT 'pending', -- 'pending', 'running', 'completed', 'failed', 'cancelled'
|
|
126
|
+
|
|
127
|
+
-- Output
|
|
128
|
+
result TEXT, -- Agent's response
|
|
129
|
+
result_structured JSONB, -- Parsed/structured result if applicable
|
|
130
|
+
error TEXT,
|
|
131
|
+
|
|
132
|
+
-- Timing
|
|
133
|
+
started_at TIMESTAMPTZ,
|
|
134
|
+
completed_at TIMESTAMPTZ,
|
|
135
|
+
created_at TIMESTAMPTZ DEFAULT NOW(),
|
|
136
|
+
|
|
137
|
+
-- Metrics
|
|
138
|
+
duration_ms INTEGER,
|
|
139
|
+
tokens_input INTEGER,
|
|
140
|
+
tokens_output INTEGER,
|
|
141
|
+
tool_calls_count INTEGER DEFAULT 0
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
CREATE INDEX IF NOT EXISTS idx_agents_execution ON agents(execution_id);
|
|
145
|
+
CREATE INDEX IF NOT EXISTS idx_agents_phase ON agents(phase_id);
|
|
146
|
+
CREATE INDEX IF NOT EXISTS idx_agents_status ON agents(status);
|
|
147
|
+
CREATE INDEX IF NOT EXISTS idx_agents_created ON agents(created_at DESC);
|
|
148
|
+
|
|
149
|
+
-- ============================================================================
|
|
150
|
+
-- 5. TOOL_CALLS - Tool Invocations
|
|
151
|
+
-- ============================================================================
|
|
152
|
+
|
|
153
|
+
CREATE TABLE IF NOT EXISTS tool_calls (
|
|
154
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
155
|
+
agent_id UUID NOT NULL REFERENCES agents(id) ON DELETE CASCADE,
|
|
156
|
+
execution_id UUID NOT NULL REFERENCES executions(id) ON DELETE CASCADE,
|
|
157
|
+
|
|
158
|
+
-- Tool info
|
|
159
|
+
tool_name TEXT NOT NULL, -- 'Read', 'Edit', 'Bash', 'Glob', etc.
|
|
160
|
+
|
|
161
|
+
-- Input (always stored - usually small)
|
|
162
|
+
input JSONB NOT NULL, -- Tool input parameters
|
|
163
|
+
|
|
164
|
+
-- Output strategy: inline for small, git reference for large
|
|
165
|
+
output_inline TEXT, -- Small outputs (<1KB) stored directly
|
|
166
|
+
output_path TEXT, -- Path to output file (for large outputs)
|
|
167
|
+
output_git_hash TEXT, -- Git hash of output file
|
|
168
|
+
output_summary TEXT, -- Haiku-generated summary (for large outputs)
|
|
169
|
+
output_size_bytes INTEGER,
|
|
170
|
+
|
|
171
|
+
-- Status
|
|
172
|
+
status TEXT NOT NULL DEFAULT 'pending', -- 'pending', 'running', 'completed', 'failed'
|
|
173
|
+
error TEXT,
|
|
174
|
+
|
|
175
|
+
-- Timing
|
|
176
|
+
started_at TIMESTAMPTZ,
|
|
177
|
+
completed_at TIMESTAMPTZ,
|
|
178
|
+
created_at TIMESTAMPTZ DEFAULT NOW(),
|
|
179
|
+
duration_ms INTEGER
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
CREATE INDEX IF NOT EXISTS idx_tool_calls_agent ON tool_calls(agent_id);
|
|
183
|
+
CREATE INDEX IF NOT EXISTS idx_tool_calls_execution ON tool_calls(execution_id);
|
|
184
|
+
CREATE INDEX IF NOT EXISTS idx_tool_calls_name ON tool_calls(tool_name);
|
|
185
|
+
CREATE INDEX IF NOT EXISTS idx_tool_calls_created ON tool_calls(created_at DESC);
|
|
186
|
+
|
|
187
|
+
-- ============================================================================
|
|
188
|
+
-- 6. STATE - Current State (Replaces Zustand)
|
|
189
|
+
-- ============================================================================
|
|
190
|
+
|
|
191
|
+
CREATE TABLE IF NOT EXISTS state (
|
|
192
|
+
key TEXT PRIMARY KEY,
|
|
193
|
+
value JSONB NOT NULL,
|
|
194
|
+
updated_at TIMESTAMPTZ DEFAULT NOW()
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
-- Initialize default state
|
|
198
|
+
INSERT INTO state (key, value) VALUES
|
|
199
|
+
('phase', '"initial"'),
|
|
200
|
+
('iteration', '0'),
|
|
201
|
+
('data', 'null')
|
|
202
|
+
ON CONFLICT (key) DO NOTHING;
|
|
203
|
+
|
|
204
|
+
-- ============================================================================
|
|
205
|
+
-- 7. TRANSITIONS - State Audit Log (Flux-like)
|
|
206
|
+
-- ============================================================================
|
|
207
|
+
|
|
208
|
+
CREATE TABLE IF NOT EXISTS transitions (
|
|
209
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
210
|
+
execution_id UUID REFERENCES executions(id) ON DELETE CASCADE,
|
|
211
|
+
|
|
212
|
+
-- What changed
|
|
213
|
+
key TEXT NOT NULL,
|
|
214
|
+
old_value JSONB,
|
|
215
|
+
new_value JSONB NOT NULL,
|
|
216
|
+
|
|
217
|
+
-- Context
|
|
218
|
+
trigger TEXT, -- What caused this: 'agent_finished', 'user_action', 'init'
|
|
219
|
+
trigger_agent_id UUID REFERENCES agents(id),
|
|
220
|
+
|
|
221
|
+
-- Timing
|
|
222
|
+
created_at TIMESTAMPTZ DEFAULT NOW()
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
CREATE INDEX IF NOT EXISTS idx_transitions_execution ON transitions(execution_id);
|
|
226
|
+
CREATE INDEX IF NOT EXISTS idx_transitions_key ON transitions(key);
|
|
227
|
+
CREATE INDEX IF NOT EXISTS idx_transitions_created ON transitions(created_at DESC);
|
|
228
|
+
|
|
229
|
+
-- ============================================================================
|
|
230
|
+
-- 8. ARTIFACTS - Generated Files/Outputs (Git References)
|
|
231
|
+
-- ============================================================================
|
|
232
|
+
|
|
233
|
+
CREATE TABLE IF NOT EXISTS artifacts (
|
|
234
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
235
|
+
execution_id UUID NOT NULL REFERENCES executions(id) ON DELETE CASCADE,
|
|
236
|
+
agent_id UUID REFERENCES agents(id) ON DELETE SET NULL,
|
|
237
|
+
|
|
238
|
+
-- Identity
|
|
239
|
+
name TEXT NOT NULL,
|
|
240
|
+
type TEXT NOT NULL, -- 'file', 'code', 'document', 'image', 'data'
|
|
241
|
+
|
|
242
|
+
-- Git reference (PRIMARY - content lives in git)
|
|
243
|
+
file_path TEXT NOT NULL, -- Path relative to repo root
|
|
244
|
+
git_hash TEXT, -- Git blob hash (after commit)
|
|
245
|
+
git_commit TEXT, -- Commit that introduced this artifact
|
|
246
|
+
|
|
247
|
+
-- Summary (for quick reference without git lookup)
|
|
248
|
+
summary TEXT, -- Brief description of content
|
|
249
|
+
line_count INTEGER,
|
|
250
|
+
byte_size INTEGER,
|
|
251
|
+
|
|
252
|
+
-- Metadata
|
|
253
|
+
metadata JSONB DEFAULT '{}', -- Language, mime type, etc.
|
|
254
|
+
|
|
255
|
+
-- Timing
|
|
256
|
+
created_at TIMESTAMPTZ DEFAULT NOW()
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
CREATE INDEX IF NOT EXISTS idx_artifacts_execution ON artifacts(execution_id);
|
|
260
|
+
CREATE INDEX IF NOT EXISTS idx_artifacts_type ON artifacts(type);
|
|
261
|
+
CREATE INDEX IF NOT EXISTS idx_artifacts_path ON artifacts(file_path);
|
|
262
|
+
CREATE INDEX IF NOT EXISTS idx_artifacts_git ON artifacts(git_hash);
|
|
263
|
+
CREATE INDEX IF NOT EXISTS idx_artifacts_created ON artifacts(created_at DESC);
|
|
264
|
+
|
|
265
|
+
-- ============================================================================
|
|
266
|
+
-- 9. REPORTS - Agent-Generated Reports
|
|
267
|
+
-- ============================================================================
|
|
268
|
+
|
|
269
|
+
CREATE TABLE IF NOT EXISTS reports (
|
|
270
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
271
|
+
execution_id UUID NOT NULL REFERENCES executions(id) ON DELETE CASCADE,
|
|
272
|
+
agent_id UUID REFERENCES agents(id) ON DELETE SET NULL,
|
|
273
|
+
|
|
274
|
+
-- Report content
|
|
275
|
+
type TEXT NOT NULL, -- 'progress', 'finding', 'warning', 'error', 'metric', 'decision'
|
|
276
|
+
title TEXT NOT NULL,
|
|
277
|
+
content TEXT NOT NULL,
|
|
278
|
+
data JSONB, -- Structured data (optional)
|
|
279
|
+
severity TEXT DEFAULT 'info', -- 'info', 'warning', 'critical'
|
|
280
|
+
|
|
281
|
+
-- Timing
|
|
282
|
+
created_at TIMESTAMPTZ DEFAULT NOW()
|
|
283
|
+
);
|
|
284
|
+
|
|
285
|
+
CREATE INDEX IF NOT EXISTS idx_reports_execution ON reports(execution_id);
|
|
286
|
+
CREATE INDEX IF NOT EXISTS idx_reports_agent ON reports(agent_id);
|
|
287
|
+
CREATE INDEX IF NOT EXISTS idx_reports_type ON reports(type);
|
|
288
|
+
CREATE INDEX IF NOT EXISTS idx_reports_severity ON reports(severity);
|
|
289
|
+
CREATE INDEX IF NOT EXISTS idx_reports_created ON reports(created_at DESC);
|
|
290
|
+
|
|
291
|
+
-- ============================================================================
|
|
292
|
+
-- 10. COMMITS - Version Control Commits
|
|
293
|
+
-- ============================================================================
|
|
294
|
+
|
|
295
|
+
CREATE TABLE IF NOT EXISTS commits (
|
|
296
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
297
|
+
execution_id UUID NOT NULL REFERENCES executions(id) ON DELETE CASCADE,
|
|
298
|
+
agent_id UUID REFERENCES agents(id) ON DELETE SET NULL,
|
|
299
|
+
|
|
300
|
+
-- VCS info
|
|
301
|
+
vcs_type TEXT NOT NULL, -- 'git', 'jj'
|
|
302
|
+
commit_hash TEXT NOT NULL,
|
|
303
|
+
change_id TEXT, -- JJ change ID (if applicable)
|
|
304
|
+
|
|
305
|
+
-- Commit details
|
|
306
|
+
message TEXT NOT NULL,
|
|
307
|
+
author TEXT,
|
|
308
|
+
|
|
309
|
+
-- Stats
|
|
310
|
+
files_changed TEXT[],
|
|
311
|
+
insertions INTEGER,
|
|
312
|
+
deletions INTEGER,
|
|
313
|
+
|
|
314
|
+
-- Smithers metadata (from git notes)
|
|
315
|
+
smithers_metadata JSONB,
|
|
316
|
+
|
|
317
|
+
-- Timing
|
|
318
|
+
created_at TIMESTAMPTZ DEFAULT NOW(),
|
|
319
|
+
|
|
320
|
+
-- Ensure unique commits per VCS
|
|
321
|
+
UNIQUE(vcs_type, commit_hash)
|
|
322
|
+
);
|
|
323
|
+
|
|
324
|
+
CREATE INDEX IF NOT EXISTS idx_commits_execution ON commits(execution_id);
|
|
325
|
+
CREATE INDEX IF NOT EXISTS idx_commits_agent ON commits(agent_id);
|
|
326
|
+
CREATE INDEX IF NOT EXISTS idx_commits_hash ON commits(commit_hash);
|
|
327
|
+
CREATE INDEX IF NOT EXISTS idx_commits_vcs ON commits(vcs_type);
|
|
328
|
+
CREATE INDEX IF NOT EXISTS idx_commits_created ON commits(created_at DESC);
|
|
329
|
+
|
|
330
|
+
-- ============================================================================
|
|
331
|
+
-- 11. SNAPSHOTS - JJ Working Copy Snapshots
|
|
332
|
+
-- ============================================================================
|
|
333
|
+
|
|
334
|
+
CREATE TABLE IF NOT EXISTS snapshots (
|
|
335
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
336
|
+
execution_id UUID NOT NULL REFERENCES executions(id) ON DELETE CASCADE,
|
|
337
|
+
|
|
338
|
+
-- JJ snapshot info
|
|
339
|
+
change_id TEXT NOT NULL,
|
|
340
|
+
commit_hash TEXT,
|
|
341
|
+
description TEXT,
|
|
342
|
+
|
|
343
|
+
-- File changes
|
|
344
|
+
files_modified TEXT[],
|
|
345
|
+
files_added TEXT[],
|
|
346
|
+
files_deleted TEXT[],
|
|
347
|
+
|
|
348
|
+
-- Status
|
|
349
|
+
has_conflicts BOOLEAN DEFAULT false,
|
|
350
|
+
|
|
351
|
+
-- Timing
|
|
352
|
+
created_at TIMESTAMPTZ DEFAULT NOW()
|
|
353
|
+
);
|
|
354
|
+
|
|
355
|
+
CREATE INDEX IF NOT EXISTS idx_snapshots_execution ON snapshots(execution_id);
|
|
356
|
+
CREATE INDEX IF NOT EXISTS idx_snapshots_change ON snapshots(change_id);
|
|
357
|
+
CREATE INDEX IF NOT EXISTS idx_snapshots_created ON snapshots(created_at DESC);
|
|
358
|
+
|
|
359
|
+
-- ============================================================================
|
|
360
|
+
-- 12. REVIEWS - Code Reviews
|
|
361
|
+
-- ============================================================================
|
|
362
|
+
|
|
363
|
+
CREATE TABLE IF NOT EXISTS reviews (
|
|
364
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
365
|
+
execution_id UUID NOT NULL REFERENCES executions(id) ON DELETE CASCADE,
|
|
366
|
+
agent_id UUID REFERENCES agents(id) ON DELETE SET NULL,
|
|
367
|
+
|
|
368
|
+
-- Review target
|
|
369
|
+
target_type TEXT NOT NULL, -- 'commit', 'diff', 'pr', 'files'
|
|
370
|
+
target_ref TEXT, -- Commit hash, PR number, etc.
|
|
371
|
+
|
|
372
|
+
-- Review result
|
|
373
|
+
approved BOOLEAN NOT NULL,
|
|
374
|
+
summary TEXT NOT NULL,
|
|
375
|
+
issues JSONB NOT NULL, -- Array of {severity, file, line, message, suggestion}
|
|
376
|
+
approvals JSONB, -- Array of {aspect, reason}
|
|
377
|
+
|
|
378
|
+
-- Reviewer info
|
|
379
|
+
reviewer_model TEXT, -- 'claude-sonnet-4', etc.
|
|
380
|
+
|
|
381
|
+
-- Behavior
|
|
382
|
+
blocking BOOLEAN DEFAULT false,
|
|
383
|
+
|
|
384
|
+
-- Post-review actions
|
|
385
|
+
posted_to_github BOOLEAN DEFAULT false,
|
|
386
|
+
posted_to_git_notes BOOLEAN DEFAULT false,
|
|
387
|
+
|
|
388
|
+
-- Timing
|
|
389
|
+
created_at TIMESTAMPTZ DEFAULT NOW()
|
|
390
|
+
);
|
|
391
|
+
|
|
392
|
+
CREATE INDEX IF NOT EXISTS idx_reviews_execution ON reviews(execution_id);
|
|
393
|
+
CREATE INDEX IF NOT EXISTS idx_reviews_agent ON reviews(agent_id);
|
|
394
|
+
CREATE INDEX IF NOT EXISTS idx_reviews_approved ON reviews(approved);
|
|
395
|
+
CREATE INDEX IF NOT EXISTS idx_reviews_target ON reviews(target_type);
|
|
396
|
+
CREATE INDEX IF NOT EXISTS idx_reviews_blocking ON reviews(blocking);
|
|
397
|
+
CREATE INDEX IF NOT EXISTS idx_reviews_created ON reviews(created_at DESC);
|
|
398
|
+
|
|
399
|
+
-- ============================================================================
|
|
400
|
+
-- 13. STEPS - Fine-grained step tracking
|
|
401
|
+
-- ============================================================================
|
|
402
|
+
|
|
403
|
+
CREATE TABLE IF NOT EXISTS steps (
|
|
404
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
405
|
+
execution_id UUID NOT NULL REFERENCES executions(id) ON DELETE CASCADE,
|
|
406
|
+
phase_id UUID REFERENCES phases(id) ON DELETE SET NULL,
|
|
407
|
+
|
|
408
|
+
-- Identity
|
|
409
|
+
name TEXT,
|
|
410
|
+
|
|
411
|
+
-- Status
|
|
412
|
+
status TEXT NOT NULL DEFAULT 'pending', -- 'pending', 'running', 'completed', 'failed', 'skipped'
|
|
413
|
+
|
|
414
|
+
-- Timing
|
|
415
|
+
started_at TIMESTAMPTZ,
|
|
416
|
+
completed_at TIMESTAMPTZ,
|
|
417
|
+
created_at TIMESTAMPTZ DEFAULT NOW(),
|
|
418
|
+
duration_ms INTEGER,
|
|
419
|
+
|
|
420
|
+
-- VCS integration
|
|
421
|
+
snapshot_before TEXT, -- JJ commit ID before step
|
|
422
|
+
snapshot_after TEXT, -- JJ commit ID after step
|
|
423
|
+
commit_created TEXT -- Commit hash if commitAfter was used
|
|
424
|
+
);
|
|
425
|
+
|
|
426
|
+
CREATE INDEX IF NOT EXISTS idx_steps_execution ON steps(execution_id);
|
|
427
|
+
CREATE INDEX IF NOT EXISTS idx_steps_phase ON steps(phase_id);
|
|
428
|
+
CREATE INDEX IF NOT EXISTS idx_steps_status ON steps(status);
|
|
429
|
+
CREATE INDEX IF NOT EXISTS idx_steps_created ON steps(created_at DESC);
|
package/dist/solid/root.d.ts
CHANGED
|
@@ -4,7 +4,11 @@ import type { SmithersNode } from '../core/types.js';
|
|
|
4
4
|
* Smithers root for mounting Solid components.
|
|
5
5
|
*/
|
|
6
6
|
export interface SmithersRoot {
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Mount the app and wait for orchestration to complete.
|
|
9
|
+
* Returns a Promise that resolves when Ralph signals completion.
|
|
10
|
+
*/
|
|
11
|
+
mount(App: () => JSX.Element | Promise<JSX.Element>): Promise<void>;
|
|
8
12
|
getTree(): SmithersNode;
|
|
9
13
|
dispose(): void;
|
|
10
14
|
/**
|
package/dist/solid/root.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/solid/root.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAEnC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/solid/root.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAEnC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAIpD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACnE,OAAO,IAAI,YAAY,CAAA;IACvB,OAAO,IAAI,IAAI,CAAA;IACf;;;OAGG;IACH,KAAK,IAAI,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,YAAY,CAyDjD"}
|
package/dist/solid/root.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { render } from './renderer.js';
|
|
2
2
|
import { serialize } from '../core/serialize.js';
|
|
3
|
+
import { createOrchestrationPromise } from '../components/Ralph.jsx';
|
|
3
4
|
/**
|
|
4
5
|
* Create a Smithers root for rendering Solid components to SmithersNode trees.
|
|
5
6
|
*/
|
|
@@ -12,13 +13,29 @@ export function createSmithersRoot() {
|
|
|
12
13
|
};
|
|
13
14
|
let disposeFunction = null;
|
|
14
15
|
return {
|
|
15
|
-
mount(App) {
|
|
16
|
+
async mount(App) {
|
|
16
17
|
if (disposeFunction) {
|
|
17
18
|
disposeFunction();
|
|
18
19
|
rootNode.children = [];
|
|
19
20
|
}
|
|
21
|
+
// Create a promise that Ralph will resolve when orchestration completes
|
|
22
|
+
const completionPromise = createOrchestrationPromise();
|
|
23
|
+
// Handle async App functions by awaiting them first
|
|
24
|
+
const result = App();
|
|
25
|
+
let element;
|
|
26
|
+
if (result && typeof result.then === 'function') {
|
|
27
|
+
// App is async - await the promise to get the JSX
|
|
28
|
+
element = await result;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
element = result;
|
|
32
|
+
}
|
|
33
|
+
// Wrap in a sync function for the renderer
|
|
34
|
+
const AppWrapper = () => element;
|
|
20
35
|
// The renderer handles JSX.Element → SmithersNode conversion internally
|
|
21
|
-
disposeFunction = render(
|
|
36
|
+
disposeFunction = render(AppWrapper, rootNode);
|
|
37
|
+
// Wait for orchestration to complete (Ralph will signal this)
|
|
38
|
+
await completionPromise;
|
|
22
39
|
},
|
|
23
40
|
getTree() {
|
|
24
41
|
return rootNode;
|
package/dist/solid/root.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root.js","sourceRoot":"","sources":["../../src/solid/root.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"root.js","sourceRoot":"","sources":["../../src/solid/root.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EA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,CAAA;QACxB,CAAC;QAED,KAAK;YACH,OAAO,SAAS,CAAC,QAAQ,CAAC,CAAA;QAC5B,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smithers-orchestrator",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Build AI agents with Solid.js - Declarative JSX for Claude orchestration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"README.md"
|
|
104
104
|
],
|
|
105
105
|
"scripts": {
|
|
106
|
-
"build": "tsc && bun build bin/cli.ts --outdir bin --target node",
|
|
106
|
+
"build": "tsc && cp src/orchestrator/db/schema.sql dist/orchestrator/db/ && bun build bin/cli.ts --outdir bin --target node",
|
|
107
107
|
"build:cli": "bun build bin/cli.ts --outdir bin --target node",
|
|
108
108
|
"dev": "tsc --watch",
|
|
109
109
|
"typecheck": "tsc --noEmit",
|