smithers-orchestrator 0.1.8 → 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/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 +1 -1
|
@@ -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;QAC5B,oBAAoB,GAAG,IAAI,C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AAC,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"}
|
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":"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