smithers-orchestrator 0.16.8 → 0.17.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smithers-orchestrator",
3
- "version": "0.16.8",
3
+ "version": "0.17.0",
4
4
  "description": "Public Smithers facade and workflow authoring convenience package",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -33,28 +33,35 @@
33
33
  "smithers": "./src/bin/smithers.js"
34
34
  },
35
35
  "dependencies": {
36
+ "@modelcontextprotocol/sdk": "^1.29.0",
37
+ "@mariozechner/pi-tui": "^0.70.2",
38
+ "@sinclair/typebox": "^0.34.49",
36
39
  "@mdx-js/esbuild": "^3.1.1",
37
40
  "ai": "^6.0.168",
38
41
  "diff": "^9.0.0",
42
+ "drizzle-orm": "^0.45.2",
43
+ "effect": "^3.21.1",
44
+ "incur": "^0.4.1",
45
+ "react": "^19.2.5",
39
46
  "zod": "^4.3.6",
40
- "@smithers-orchestrator/agents": "0.16.8",
41
- "@smithers-orchestrator/cli": "0.16.8",
42
- "@smithers-orchestrator/components": "0.16.8",
43
- "@smithers-orchestrator/errors": "0.16.8",
44
- "@smithers-orchestrator/engine": "0.16.8",
45
- "@smithers-orchestrator/driver": "0.16.8",
46
- "@smithers-orchestrator/memory": "0.16.8",
47
- "@smithers-orchestrator/db": "0.16.8",
48
- "@smithers-orchestrator/observability": "0.16.8",
49
- "@smithers-orchestrator/graph": "0.16.8",
50
- "@smithers-orchestrator/openapi": "0.16.8",
51
- "@smithers-orchestrator/react-reconciler": "0.16.8",
52
- "@smithers-orchestrator/scheduler": "0.16.8",
53
- "@smithers-orchestrator/scorers": "0.16.8",
54
- "@smithers-orchestrator/sandbox": "0.16.8",
55
- "@smithers-orchestrator/server": "0.16.8",
56
- "@smithers-orchestrator/time-travel": "0.16.8",
57
- "@smithers-orchestrator/vcs": "0.16.8"
47
+ "@smithers-orchestrator/cli": "0.17.0",
48
+ "@smithers-orchestrator/agents": "0.17.0",
49
+ "@smithers-orchestrator/driver": "0.17.0",
50
+ "@smithers-orchestrator/db": "0.17.0",
51
+ "@smithers-orchestrator/engine": "0.17.0",
52
+ "@smithers-orchestrator/components": "0.17.0",
53
+ "@smithers-orchestrator/errors": "0.17.0",
54
+ "@smithers-orchestrator/memory": "0.17.0",
55
+ "@smithers-orchestrator/graph": "0.17.0",
56
+ "@smithers-orchestrator/observability": "0.17.0",
57
+ "@smithers-orchestrator/openapi": "0.17.0",
58
+ "@smithers-orchestrator/react-reconciler": "0.17.0",
59
+ "@smithers-orchestrator/sandbox": "0.17.0",
60
+ "@smithers-orchestrator/scheduler": "0.17.0",
61
+ "@smithers-orchestrator/scorers": "0.17.0",
62
+ "@smithers-orchestrator/server": "0.17.0",
63
+ "@smithers-orchestrator/time-travel": "0.17.0",
64
+ "@smithers-orchestrator/vcs": "0.17.0"
58
65
  },
59
66
  "devDependencies": {
60
67
  "@types/bun": "latest",
@@ -0,0 +1,19 @@
1
+ import type { z } from "zod";
2
+ import type { CreateSmithersApi } from "../CreateSmithersApi";
3
+
4
+ type Equal<A, B> =
5
+ (<T>() => T extends A ? 1 : 2) extends
6
+ (<T>() => T extends B ? 1 : 2)
7
+ ? true
8
+ : false;
9
+ type Assert<T extends true> = T;
10
+
11
+ type Api = CreateSmithersApi<{
12
+ input: z.ZodObject<{ prompt: z.ZodString }>;
13
+ }>;
14
+ type Ctx = Parameters<Parameters<Api["smithers"]>[0]>[0];
15
+
16
+ type _PromptIsString = Assert<Equal<Ctx["input"]["prompt"], string>>;
17
+
18
+ // @ts-expect-error input.foo is not declared by the workflow input schema.
19
+ type _MissingFoo = Ctx["input"]["foo"];
package/src/create.js CHANGED
@@ -12,7 +12,7 @@ import React from "react";
12
12
  import { createSmithersContext, SmithersContext as GlobalSmithersContext } from "@smithers-orchestrator/react-reconciler/context";
13
13
  import { Approval as BaseApproval, Workflow as BaseWorkflow, Task as BaseTask, Sequence as BaseSequence, Parallel as BaseParallel, MergeQueue as BaseMergeQueue, Branch as BaseBranch, Loop as BaseLoop, Ralph as BaseRalph, ContinueAsNew as BaseContinueAsNew, continueAsNew as baseContinueAsNew, Worktree as BaseWorktree, Sandbox as BaseSandbox, Signal as BaseSignal, Timer as BaseTimer, } from "@smithers-orchestrator/components";
14
14
  import { zodToTable } from "@smithers-orchestrator/db/zodToTable";
15
- import { zodToCreateTableSQL } from "@smithers-orchestrator/db/zodToCreateTableSQL";
15
+ import { zodToCreateTableSQL, syncZodTableSchema } from "@smithers-orchestrator/db/zodToCreateTableSQL";
16
16
  import { camelToSnake } from "@smithers-orchestrator/db/utils/camelToSnake";
17
17
  import { resolve } from "node:path";
18
18
  import { SmithersError } from "@smithers-orchestrator/errors/SmithersError";
@@ -216,10 +216,11 @@ export function createSmithers(schemas, opts) {
216
216
  catch { }
217
217
  };
218
218
  process.on("exit", closeDb);
219
- // 3. Auto-create tables using CREATE TABLE IF NOT EXISTS
219
+ // 3. Auto-create tables, and ALTER any existing tables to add columns the
220
+ // current schema introduced (CREATE TABLE IF NOT EXISTS would silently
221
+ // skip the columns and a later upsert would fail with "no column named X").
220
222
  if (schemas.input) {
221
- const inputDdl = zodToCreateTableSQL("input", schemas.input, { isInput: true });
222
- sqlite.run(inputDdl);
223
+ syncZodTableSchema(sqlite, "input", schemas.input, { isInput: true });
223
224
  }
224
225
  else {
225
226
  sqlite.exec(`CREATE TABLE IF NOT EXISTS "input" (run_id TEXT PRIMARY KEY, payload TEXT)`);
@@ -238,8 +239,7 @@ export function createSmithers(schemas, opts) {
238
239
  if (name === "input")
239
240
  continue;
240
241
  const tableName = camelToSnake(name);
241
- const ddl = zodToCreateTableSQL(tableName, zodSchema);
242
- sqlite.run(ddl);
242
+ syncZodTableSchema(sqlite, tableName, zodSchema);
243
243
  }
244
244
  // 4. Create Drizzle instance with all tables in the schema
245
245
  const drizzleSchema = { input: inputTable };
@@ -12,7 +12,7 @@ import { Database } from "bun:sqlite";
12
12
  import { drizzle } from "drizzle-orm/bun-sqlite";
13
13
  import { sqliteTable, text } from "drizzle-orm/sqlite-core";
14
14
  import { zodToTable } from "@smithers-orchestrator/db/zodToTable";
15
- import { zodToCreateTableSQL } from "@smithers-orchestrator/db/zodToCreateTableSQL";
15
+ import { syncZodTableSchema } from "@smithers-orchestrator/db/zodToCreateTableSQL";
16
16
  import { camelToSnake } from "@smithers-orchestrator/db/utils/camelToSnake";
17
17
  import { SmithersError } from "@smithers-orchestrator/errors/SmithersError";
18
18
  import { mkdtempSync } from "node:fs";
@@ -113,7 +113,7 @@ export function createExternalSmithers(config) {
113
113
  continue;
114
114
  const tableName = camelToSnake(name);
115
115
  tables[name] = zodToTable(tableName, zodSchema);
116
- sqlite.run(zodToCreateTableSQL(tableName, zodSchema));
116
+ syncZodTableSchema(sqlite, tableName, zodSchema);
117
117
  }
118
118
  const drizzleSchema = { input: inputTable };
119
119
  for (const [key, table] of Object.entries(tables)) {
package/src/index.d.ts CHANGED
@@ -72,7 +72,7 @@ export { ensureSmithersTables } from '@smithers-orchestrator/db/ensure';
72
72
  export { markdownComponents } from '@smithers-orchestrator/components/markdownComponents';
73
73
  export { renderMdx } from '@smithers-orchestrator/components/renderMdx';
74
74
  export { zodToTable } from '@smithers-orchestrator/db/zodToTable';
75
- export { zodToCreateTableSQL } from '@smithers-orchestrator/db/zodToCreateTableSQL';
75
+ export { syncZodTableSchema, zodSchemaColumns, zodToCreateTableSQL } from '@smithers-orchestrator/db/zodToCreateTableSQL';
76
76
  export { camelToSnake } from '@smithers-orchestrator/db/utils/camelToSnake';
77
77
  export { unwrapZodType } from '@smithers-orchestrator/db/unwrapZodType';
78
78
  export { zodSchemaToJsonExample } from '@smithers-orchestrator/components/zod-to-example';
package/src/index.js CHANGED
@@ -212,7 +212,7 @@ export { mdxPlugin } from "./mdx-plugin.js";
212
212
  export { markdownComponents } from "@smithers-orchestrator/components/markdownComponents";
213
213
  export { renderMdx } from "@smithers-orchestrator/components/renderMdx";
214
214
  export { zodToTable } from "@smithers-orchestrator/db/zodToTable";
215
- export { zodToCreateTableSQL } from "@smithers-orchestrator/db/zodToCreateTableSQL";
215
+ export { syncZodTableSchema, zodSchemaColumns, zodToCreateTableSQL } from "@smithers-orchestrator/db/zodToCreateTableSQL";
216
216
  export { camelToSnake } from "@smithers-orchestrator/db/utils/camelToSnake";
217
217
  export { unwrapZodType } from "@smithers-orchestrator/db/unwrapZodType";
218
218
  export { zodSchemaToJsonExample } from "@smithers-orchestrator/components/zod-to-example";
@@ -1 +0,0 @@
1
- export * from "./pi-plugin/extension.js";
@@ -1,7 +0,0 @@
1
- export type SmithersPiRunContext = {
2
- runId: string;
3
- workflowName: string;
4
- status: string;
5
- nodeStates: Array<{ nodeId: string; state: string }>;
6
- errors: string[];
7
- };