smithers-orchestrator 0.17.0 → 0.18.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.
- package/package.json +31 -19
- package/src/create.js +40 -8
- package/src/external/create-external-smithers.js +29 -6
- package/src/gateway-client.d.ts +1 -0
- package/src/gateway-client.js +1 -0
- package/src/gateway-react.d.ts +1 -0
- package/src/gateway-react.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smithers-orchestrator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Public Smithers facade and workflow authoring convenience package",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -15,6 +15,16 @@
|
|
|
15
15
|
"import": "./src/tools.js",
|
|
16
16
|
"default": "./src/tools.js"
|
|
17
17
|
},
|
|
18
|
+
"./gateway-client": {
|
|
19
|
+
"types": "./src/gateway-client.d.ts",
|
|
20
|
+
"import": "./src/gateway-client.js",
|
|
21
|
+
"default": "./src/gateway-client.js"
|
|
22
|
+
},
|
|
23
|
+
"./gateway-react": {
|
|
24
|
+
"types": "./src/gateway-react.d.ts",
|
|
25
|
+
"import": "./src/gateway-react.js",
|
|
26
|
+
"default": "./src/gateway-react.js"
|
|
27
|
+
},
|
|
18
28
|
"./*": {
|
|
19
29
|
"types": "./src/index.d.ts",
|
|
20
30
|
"import": "./src/*.js",
|
|
@@ -44,24 +54,26 @@
|
|
|
44
54
|
"incur": "^0.4.1",
|
|
45
55
|
"react": "^19.2.5",
|
|
46
56
|
"zod": "^4.3.6",
|
|
47
|
-
"@smithers-orchestrator/
|
|
48
|
-
"@smithers-orchestrator/
|
|
49
|
-
"@smithers-orchestrator/
|
|
50
|
-
"@smithers-orchestrator/db": "0.
|
|
51
|
-
"@smithers-orchestrator/engine": "0.
|
|
52
|
-
"@smithers-orchestrator/
|
|
53
|
-
"@smithers-orchestrator/errors": "0.
|
|
54
|
-
"@smithers-orchestrator/
|
|
55
|
-
"@smithers-orchestrator/graph": "0.
|
|
56
|
-
"@smithers-orchestrator/
|
|
57
|
-
"@smithers-orchestrator/
|
|
58
|
-
"@smithers-orchestrator/
|
|
59
|
-
"@smithers-orchestrator/
|
|
60
|
-
"@smithers-orchestrator/
|
|
61
|
-
"@smithers-orchestrator/
|
|
62
|
-
"@smithers-orchestrator/server": "0.
|
|
63
|
-
"@smithers-orchestrator/time-travel": "0.
|
|
64
|
-
"@smithers-orchestrator/
|
|
57
|
+
"@smithers-orchestrator/agents": "0.18.0",
|
|
58
|
+
"@smithers-orchestrator/driver": "0.18.0",
|
|
59
|
+
"@smithers-orchestrator/components": "0.18.0",
|
|
60
|
+
"@smithers-orchestrator/db": "0.18.0",
|
|
61
|
+
"@smithers-orchestrator/engine": "0.18.0",
|
|
62
|
+
"@smithers-orchestrator/gateway-client": "0.18.0",
|
|
63
|
+
"@smithers-orchestrator/errors": "0.18.0",
|
|
64
|
+
"@smithers-orchestrator/gateway-react": "0.18.0",
|
|
65
|
+
"@smithers-orchestrator/graph": "0.18.0",
|
|
66
|
+
"@smithers-orchestrator/openapi": "0.18.0",
|
|
67
|
+
"@smithers-orchestrator/react-reconciler": "0.18.0",
|
|
68
|
+
"@smithers-orchestrator/sandbox": "0.18.0",
|
|
69
|
+
"@smithers-orchestrator/observability": "0.18.0",
|
|
70
|
+
"@smithers-orchestrator/scorers": "0.18.0",
|
|
71
|
+
"@smithers-orchestrator/scheduler": "0.18.0",
|
|
72
|
+
"@smithers-orchestrator/server": "0.18.0",
|
|
73
|
+
"@smithers-orchestrator/time-travel": "0.18.0",
|
|
74
|
+
"@smithers-orchestrator/cli": "0.18.0",
|
|
75
|
+
"@smithers-orchestrator/vcs": "0.18.0",
|
|
76
|
+
"@smithers-orchestrator/memory": "0.18.0"
|
|
65
77
|
},
|
|
66
78
|
"devDependencies": {
|
|
67
79
|
"@types/bun": "latest",
|
package/src/create.js
CHANGED
|
@@ -49,6 +49,41 @@ function computeSchemaSig(schemas, dbPath) {
|
|
|
49
49
|
}
|
|
50
50
|
return parts.join("\n");
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Duplicate schema objects need distinct output refs so Task `output={outputs.foo}`
|
|
54
|
+
* can still resolve the intended table by identity.
|
|
55
|
+
* @param {Record<string, any>} schemas
|
|
56
|
+
*/
|
|
57
|
+
function prepareOutputSchemas(schemas) {
|
|
58
|
+
const counts = new Map();
|
|
59
|
+
for (const [name, zodSchema] of Object.entries(schemas)) {
|
|
60
|
+
if (name === "input")
|
|
61
|
+
continue;
|
|
62
|
+
counts.set(zodSchema, (counts.get(zodSchema) ?? 0) + 1);
|
|
63
|
+
}
|
|
64
|
+
const outputs = {
|
|
65
|
+
...schemas,
|
|
66
|
+
};
|
|
67
|
+
const zodToKeyName = new Map();
|
|
68
|
+
const ambiguousZodSchemas = new Set();
|
|
69
|
+
for (const [name, zodSchema] of Object.entries(schemas)) {
|
|
70
|
+
if (name === "input")
|
|
71
|
+
continue;
|
|
72
|
+
if ((counts.get(zodSchema) ?? 0) > 1) {
|
|
73
|
+
ambiguousZodSchemas.add(zodSchema);
|
|
74
|
+
const aliasSchema = zodSchema.clone();
|
|
75
|
+
outputs[name] = aliasSchema;
|
|
76
|
+
zodToKeyName.set(aliasSchema, name);
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
zodToKeyName.set(zodSchema, name);
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
outputs,
|
|
83
|
+
zodToKeyName,
|
|
84
|
+
ambiguousZodSchemas,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
52
87
|
/**
|
|
53
88
|
* @param {Record<string, string>} [base]
|
|
54
89
|
* @param {Record<string, string>} [override]
|
|
@@ -254,13 +289,8 @@ export function createSmithers(schemas, opts) {
|
|
|
254
289
|
continue;
|
|
255
290
|
schemaRegistry.set(name, { table: tables[name], zodSchema });
|
|
256
291
|
}
|
|
257
|
-
// 6. Build reverse lookup: ZodObject reference → schema key name
|
|
258
|
-
const zodToKeyName =
|
|
259
|
-
for (const [name, zodSchema] of Object.entries(schemas)) {
|
|
260
|
-
if (name === "input")
|
|
261
|
-
continue;
|
|
262
|
-
zodToKeyName.set(zodSchema, name);
|
|
263
|
-
}
|
|
292
|
+
// 6. Build output refs and reverse lookup: ZodObject reference → schema key name
|
|
293
|
+
const { outputs, zodToKeyName, ambiguousZodSchemas } = prepareOutputSchemas(schemas);
|
|
264
294
|
// 7. Context + hooks
|
|
265
295
|
const { SmithersContext: RuntimeSmithersContext, useCtx, } = createSmithersContext();
|
|
266
296
|
const ctxRef = { current: null };
|
|
@@ -302,6 +332,7 @@ export function createSmithers(schemas, opts) {
|
|
|
302
332
|
opts: {},
|
|
303
333
|
schemaRegistry,
|
|
304
334
|
zodToKeyName,
|
|
335
|
+
ambiguousZodSchemas,
|
|
305
336
|
};
|
|
306
337
|
return React.createElement(BaseSandbox, {
|
|
307
338
|
...props,
|
|
@@ -342,6 +373,7 @@ export function createSmithers(schemas, opts) {
|
|
|
342
373
|
opts: workflowOpts,
|
|
343
374
|
schemaRegistry,
|
|
344
375
|
zodToKeyName,
|
|
376
|
+
ambiguousZodSchemas,
|
|
345
377
|
};
|
|
346
378
|
}
|
|
347
379
|
/**
|
|
@@ -370,7 +402,7 @@ export function createSmithers(schemas, opts) {
|
|
|
370
402
|
smithers: boundSmithers,
|
|
371
403
|
db,
|
|
372
404
|
tables: tables,
|
|
373
|
-
outputs
|
|
405
|
+
outputs,
|
|
374
406
|
};
|
|
375
407
|
if (process.env.SMITHERS_HOT === "1") {
|
|
376
408
|
const sig = computeSchemaSig(schemas, absDbPath);
|
|
@@ -64,6 +64,33 @@ export function hostNodeToReact(node, agents) {
|
|
|
64
64
|
const children = node.children.map((child) => hostNodeToReact(child, agents));
|
|
65
65
|
return React.createElement(node.tag, rawProps, ...children);
|
|
66
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* @param {Record<string, any>} schemas
|
|
69
|
+
*/
|
|
70
|
+
function prepareOutputSchemas(schemas) {
|
|
71
|
+
const counts = new Map();
|
|
72
|
+
for (const [name, zodSchema] of Object.entries(schemas)) {
|
|
73
|
+
if (name === "input")
|
|
74
|
+
continue;
|
|
75
|
+
counts.set(zodSchema, (counts.get(zodSchema) ?? 0) + 1);
|
|
76
|
+
}
|
|
77
|
+
const zodToKeyName = new Map();
|
|
78
|
+
const ambiguousZodSchemas = new Set();
|
|
79
|
+
for (const [name, zodSchema] of Object.entries(schemas)) {
|
|
80
|
+
if (name === "input")
|
|
81
|
+
continue;
|
|
82
|
+
if ((counts.get(zodSchema) ?? 0) > 1) {
|
|
83
|
+
ambiguousZodSchemas.add(zodSchema);
|
|
84
|
+
zodToKeyName.set(zodSchema.clone(), name);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
zodToKeyName.set(zodSchema, name);
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
zodToKeyName,
|
|
91
|
+
ambiguousZodSchemas,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
67
94
|
/**
|
|
68
95
|
* Create a SmithersWorkflow from an external build function.
|
|
69
96
|
*
|
|
@@ -126,12 +153,7 @@ export function createExternalSmithers(config) {
|
|
|
126
153
|
continue;
|
|
127
154
|
schemaRegistry.set(name, { table: tables[name], zodSchema });
|
|
128
155
|
}
|
|
129
|
-
const zodToKeyName =
|
|
130
|
-
for (const [name, zodSchema] of Object.entries(schemas)) {
|
|
131
|
-
if (name === "input")
|
|
132
|
-
continue;
|
|
133
|
-
zodToKeyName.set(zodSchema, name);
|
|
134
|
-
}
|
|
156
|
+
const { zodToKeyName, ambiguousZodSchemas } = prepareOutputSchemas(schemas);
|
|
135
157
|
return {
|
|
136
158
|
db,
|
|
137
159
|
build: (ctx) => {
|
|
@@ -142,6 +164,7 @@ export function createExternalSmithers(config) {
|
|
|
142
164
|
opts: {},
|
|
143
165
|
schemaRegistry,
|
|
144
166
|
zodToKeyName,
|
|
167
|
+
ambiguousZodSchemas,
|
|
145
168
|
tables,
|
|
146
169
|
cleanup: closeDb,
|
|
147
170
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@smithers-orchestrator/gateway-client";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@smithers-orchestrator/gateway-client";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@smithers-orchestrator/gateway-react";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@smithers-orchestrator/gateway-react";
|