smithers-orchestrator 0.20.1 → 0.20.4

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.20.1",
3
+ "version": "0.20.4",
4
4
  "description": "Public Smithers facade and workflow authoring convenience package",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -43,9 +43,6 @@
43
43
  "smithers": "./src/bin/smithers.js"
44
44
  },
45
45
  "dependencies": {
46
- "@modelcontextprotocol/sdk": "^1.29.0",
47
- "@mariozechner/pi-tui": "^0.70.2",
48
- "@sinclair/typebox": "^0.34.49",
49
46
  "@mdx-js/esbuild": "^3.1.1",
50
47
  "ai": "^6.0.168",
51
48
  "diff": "^9.0.0",
@@ -54,26 +51,26 @@
54
51
  "incur": "^0.4.1",
55
52
  "react": "^19.2.5",
56
53
  "zod": "^4.3.6",
57
- "@smithers-orchestrator/cli": "0.20.1",
58
- "@smithers-orchestrator/agents": "0.20.1",
59
- "@smithers-orchestrator/db": "0.20.1",
60
- "@smithers-orchestrator/components": "0.20.1",
61
- "@smithers-orchestrator/engine": "0.20.1",
62
- "@smithers-orchestrator/driver": "0.20.1",
63
- "@smithers-orchestrator/errors": "0.20.1",
64
- "@smithers-orchestrator/graph": "0.20.1",
65
- "@smithers-orchestrator/gateway-react": "0.20.1",
66
- "@smithers-orchestrator/gateway-client": "0.20.1",
67
- "@smithers-orchestrator/memory": "0.20.1",
68
- "@smithers-orchestrator/observability": "0.20.1",
69
- "@smithers-orchestrator/openapi": "0.20.1",
70
- "@smithers-orchestrator/react-reconciler": "0.20.1",
71
- "@smithers-orchestrator/sandbox": "0.20.1",
72
- "@smithers-orchestrator/scheduler": "0.20.1",
73
- "@smithers-orchestrator/scorers": "0.20.1",
74
- "@smithers-orchestrator/time-travel": "0.20.1",
75
- "@smithers-orchestrator/server": "0.20.1",
76
- "@smithers-orchestrator/vcs": "0.20.1"
54
+ "@smithers-orchestrator/cli": "0.20.4",
55
+ "@smithers-orchestrator/components": "0.20.4",
56
+ "@smithers-orchestrator/engine": "0.20.4",
57
+ "@smithers-orchestrator/db": "0.20.4",
58
+ "@smithers-orchestrator/errors": "0.20.4",
59
+ "@smithers-orchestrator/gateway-client": "0.20.4",
60
+ "@smithers-orchestrator/memory": "0.20.4",
61
+ "@smithers-orchestrator/agents": "0.20.4",
62
+ "@smithers-orchestrator/observability": "0.20.4",
63
+ "@smithers-orchestrator/openapi": "0.20.4",
64
+ "@smithers-orchestrator/sandbox": "0.20.4",
65
+ "@smithers-orchestrator/react-reconciler": "0.20.4",
66
+ "@smithers-orchestrator/gateway-react": "0.20.4",
67
+ "@smithers-orchestrator/scorers": "0.20.4",
68
+ "@smithers-orchestrator/scheduler": "0.20.4",
69
+ "@smithers-orchestrator/time-travel": "0.20.4",
70
+ "@smithers-orchestrator/server": "0.20.4",
71
+ "@smithers-orchestrator/vcs": "0.20.4",
72
+ "@smithers-orchestrator/graph": "0.20.4",
73
+ "@smithers-orchestrator/driver": "0.20.4"
77
74
  },
78
75
  "devDependencies": {
79
76
  "@types/bun": "latest",
@@ -1,9 +1,105 @@
1
1
  #!/usr/bin/env bun
2
2
  import { spawn } from "node:child_process";
3
- import { existsSync, realpathSync } from "node:fs";
4
- import { resolve } from "node:path";
3
+ import { existsSync, readFileSync, realpathSync } from "node:fs";
4
+ import { dirname, parse, resolve } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
6
 
7
+ const WORKFLOW_PATH_COMMANDS = new Set([
8
+ "up",
9
+ "graph",
10
+ "fork",
11
+ "replay",
12
+ "revert",
13
+ "timetravel",
14
+ ]);
15
+ const WORKFLOW_EXTENSIONS = new Set([".js", ".jsx", ".ts", ".tsx", ".mjs", ".mts"]);
16
+
17
+ /**
18
+ * @param {string} value
19
+ */
20
+ function isOptionLike(value) {
21
+ return value.startsWith("-");
22
+ }
23
+
24
+ /**
25
+ * @param {string} value
26
+ */
27
+ function looksLikeWorkflowPath(value) {
28
+ if (isOptionLike(value))
29
+ return false;
30
+ return WORKFLOW_EXTENSIONS.has(parse(value).ext);
31
+ }
32
+
33
+ /**
34
+ * @param {string[]} args
35
+ */
36
+ function getExplicitWorkflowPath(args) {
37
+ if (args.length === 0)
38
+ return null;
39
+ if (looksLikeWorkflowPath(args[0]))
40
+ return args[0];
41
+ for (let index = 0; index < args.length; index++) {
42
+ const arg = args[index];
43
+ if (!WORKFLOW_PATH_COMMANDS.has(arg))
44
+ continue;
45
+ for (let nextIndex = index + 1; nextIndex < args.length; nextIndex++) {
46
+ const candidate = args[nextIndex];
47
+ if (looksLikeWorkflowPath(candidate))
48
+ return candidate;
49
+ }
50
+ return null;
51
+ }
52
+ for (const arg of args) {
53
+ if (looksLikeWorkflowPath(arg))
54
+ return arg;
55
+ }
56
+ return null;
57
+ }
58
+
59
+ /**
60
+ * Resolve the local `smithers-orchestrator` package's bin JS file under
61
+ * `<directory>/node_modules/`. Going through `package.json` (instead of the
62
+ * `.bin/smithers` shell shim npm/pnpm generate) is the whole point: the shim
63
+ * is `#!/bin/sh` and re-execing it with `process.execPath` (bun) makes bun
64
+ * parse shell as JavaScript, which crashes with `Expected ")" but found
65
+ * "$(echo "`.
66
+ *
67
+ * @param {string} directory
68
+ */
69
+ function resolveLocalSmithersBinJs(directory) {
70
+ const pkgJsonPath = resolve(directory, "node_modules/smithers-orchestrator/package.json");
71
+ if (!existsSync(pkgJsonPath))
72
+ return null;
73
+ let pkg;
74
+ try {
75
+ pkg = JSON.parse(readFileSync(pkgJsonPath, "utf8"));
76
+ } catch {
77
+ return null;
78
+ }
79
+ const binEntry = typeof pkg?.bin === "string" ? pkg.bin : pkg?.bin?.smithers;
80
+ if (typeof binEntry !== "string" || binEntry.length === 0)
81
+ return null;
82
+ const binPath = resolve(dirname(pkgJsonPath), binEntry);
83
+ return existsSync(binPath) ? binPath : null;
84
+ }
85
+
86
+ /**
87
+ * @param {string} cwd
88
+ * @param {string} workflowPath
89
+ */
90
+ function findNearestWorkflowLocalCli(cwd, workflowPath) {
91
+ let current = dirname(resolve(cwd, workflowPath));
92
+ while (true) {
93
+ const localBin = resolveLocalSmithersBinJs(current);
94
+ if (localBin)
95
+ return localBin;
96
+ const parent = dirname(current);
97
+ if (parent === current)
98
+ return null;
99
+ current = parent;
100
+ }
101
+ }
102
+
7
103
  /**
8
104
  * When a workflow directory (`.smithers/`) exists in the user's cwd and it's
9
105
  * installed a local `smithers` bin, re-exec against that instead of this
@@ -16,11 +112,17 @@ import { fileURLToPath } from "node:url";
16
112
  */
17
113
  function delegateToLocalCliIfPresent() {
18
114
  const cwd = process.cwd();
19
- const localBin = resolve(cwd, ".smithers/node_modules/.bin/smithers");
20
- if (!existsSync(localBin)) return false;
115
+ const workflowPath = getExplicitWorkflowPath(process.argv.slice(2));
116
+ const workflowLocalBin = workflowPath
117
+ ? findNearestWorkflowLocalCli(cwd, workflowPath)
118
+ : null;
119
+ const localBin = workflowLocalBin ?? resolveLocalSmithersBinJs(resolve(cwd, ".smithers"));
120
+ if (!localBin)
121
+ return false;
21
122
  const selfPath = realpathSync(fileURLToPath(import.meta.url));
22
123
  const localTarget = realpathSync(localBin);
23
- if (localTarget === selfPath) return false;
124
+ if (localTarget === selfPath)
125
+ return false;
24
126
  const proc = spawn(process.execPath, [localTarget, ...process.argv.slice(2)], {
25
127
  stdio: "inherit",
26
128
  cwd,
package/src/index.d.ts CHANGED
@@ -46,7 +46,7 @@ import React from 'react';
46
46
  import { BunSQLiteDatabase } from 'drizzle-orm/bun-sqlite';
47
47
  import * as _smithers_components from '@smithers-orchestrator/components';
48
48
  import { Sequence, Parallel, MergeQueue, Branch, Loop, Ralph, ContinueAsNew, continueAsNew, Worktree, Timer } from '@smithers-orchestrator/components';
49
- export { Approval, Branch, ContinueAsNew, Kanban, Loop, MergeQueue, Parallel, Poller, Ralph, Saga, Sandbox, Sequence, Signal, Task, Timer, TryCatchFinally, WaitForEvent, Workflow, Worktree, approvalDecisionSchema, approvalRankingSchema, approvalSelectionSchema, continueAsNew } from '@smithers-orchestrator/components';
49
+ export { Approval, ApprovalGate, ApprovalGateProps, Aspects, AspectsProps, Branch, CheckSuite, CheckSuiteProps, ClassifyAndRoute, ClassifyAndRouteProps, ContentPipeline, ContentPipelineProps, ContentPipelineStage, ContinueAsNew, Debate, DebateProps, DecisionTable, DecisionTableProps, DriftDetector, DriftDetectorProps, EscalationChain, EscalationChainProps, EscalationLevel, GatherAndSynthesize, GatherAndSynthesizeProps, HumanTask, HumanTaskProps, Kanban, Loop, MergeQueue, Optimizer, OptimizerProps, Panel, PanelProps, PanelistConfig, Parallel, Poller, Ralph, ReviewLoop, ReviewLoopProps, Runbook, RunbookProps, RunbookStep, Saga, Sandbox, ScanFixVerify, ScanFixVerifyProps, Sequence, Signal, Subflow, SubflowProps, SuperSmithers, SuperSmithersProps, Supervisor, SupervisorProps, Task, Timer, TryCatchFinally, WaitForEvent, Workflow, Worktree, approvalDecisionSchema, approvalRankingSchema, approvalSelectionSchema, continueAsNew } from '@smithers-orchestrator/components';
50
50
  import { ApprovalProps as ApprovalProps$1 } from '@smithers-orchestrator/components/components/ApprovalProps';
51
51
  import { DepsSpec as DepsSpec$1 } from '@smithers-orchestrator/components/components/DepsSpec';
52
52
  import { SandboxProps as SandboxProps$1 } from '@smithers-orchestrator/components/components/SandboxProps';
@@ -56,7 +56,7 @@ import { WorkflowProps } from '@smithers-orchestrator/components/components/Work
56
56
  import * as _smithers_server_gateway from '@smithers-orchestrator/server/gateway';
57
57
  export { Gateway } from '@smithers-orchestrator/server/gateway';
58
58
  import * as _smithers_agents from '@smithers-orchestrator/agents';
59
- export { AmpAgent, AnthropicAgent, ClaudeCodeAgent, CodexAgent, ForgeAgent, GeminiAgent, KimiAgent, OpenAIAgent, PiAgent } from '@smithers-orchestrator/agents';
59
+ export { AmpAgent, AnthropicAgent, ClaudeCodeAgent, CodexAgent, ForgeAgent, GeminiAgent, KimiAgent, OpenAIAgent, OpenCodeAgent, PiAgent } from '@smithers-orchestrator/agents';
60
60
  import * as _smithers_scorers from '@smithers-orchestrator/scorers';
61
61
  export { aggregateScores, createScorer, faithfulnessScorer, latencyScorer, llmJudge, relevancyScorer, runScorersAsync, runScorersBatch, schemaAdherenceScorer, smithersScorers, toxicityScorer } from '@smithers-orchestrator/scorers';
62
62
  import * as _smithers_agents_capability_registry from '@smithers-orchestrator/agents/capability-registry';
@@ -331,6 +331,7 @@ type MemoryStore = _smithers_memory.MemoryStore;
331
331
  type MemoryThread = _smithers_memory.MemoryThread;
332
332
  type MessageHistoryConfig = _smithers_memory.MessageHistoryConfig;
333
333
  type OpenAIAgentOptions<CALL_OPTIONS = never, TOOLS = ai.ToolSet> = _smithers_agents.OpenAIAgentOptions<CALL_OPTIONS, TOOLS>;
334
+ type OpenCodeAgentOptions = _smithers_agents.OpenCodeAgentOptions;
334
335
  type OpenApiAuth = _smithers_openapi.OpenApiAuth;
335
336
  type OpenApiSpec = _smithers_openapi.OpenApiSpec;
336
337
  type OpenApiToolsOptions = _smithers_openapi.OpenApiToolsOptions;
@@ -406,4 +407,4 @@ type XmlElement = _smithers_graph_XmlNode.XmlElement;
406
407
  type XmlNode = _smithers_graph_XmlNode.XmlNode;
407
408
  type XmlText = _smithers_graph_XmlNode.XmlText;
408
409
 
409
- export { type AgentCapabilityRegistry, type AgentLike, type AgentToolDescriptor, type AggregateOptions, type AggregateScore, type AnthropicAgentOptions, type ApprovalAutoApprove, type ApprovalDecision, type ApprovalMode, type ApprovalOption, type ApprovalProps, type ApprovalRanking, type ApprovalRequest, type ApprovalSelection, type ColumnDef, type ConnectRequest, type ContinueAsNewProps, type CreateScorerConfig, type CreateSmithersApi, type DepsSpec, type EventFrame, type ExternalSmithersConfig, type GatewayAuthConfig, type GatewayDefaults, type GatewayOptions, type GatewayTokenGrant, type GraphSnapshot, type HelloResponse, type HostContainer, type HostNodeJson, type InferDeps, type InferOutputEntry, type InferRow, type JjRevertResult, type KanbanProps, type KnownSmithersErrorCode, type LlmJudgeConfig, type MemoryFact, type MemoryLayerConfig, type MemoryMessage, type MemoryNamespace, type MemoryNamespaceKind, type MemoryProcessor, type MemoryProcessorConfig, type MemoryServiceApi, type MemoryStore, type MemoryThread, type MessageHistoryConfig, type OpenAIAgentOptions, type OpenApiAuth, type OpenApiSpec, type OpenApiToolsOptions, type OutputAccessor, type OutputKey, type OutputTarget, type PiAgentOptions, type PiExtensionUiRequest, type PiExtensionUiResponse, type PollerProps, type RequestFrame, type ResolvedSmithersObservabilityOptions, type ResponseFrame, type RevertOptions, type RevertResult, type RunJjOptions, type RunJjResult, type RunOptions, type RunResult, type RunStatus, type SagaProps, type SagaStepDef, type SagaStepProps, type SamplingConfig, type SandboxProps, type SandboxRuntime, type SandboxVolumeMount, type SandboxWorkspaceSpec, type SchemaRegistryEntry, type ScoreResult, type ScoreRow, type Scorer, type ScorerBinding, type ScorerContext, type ScorerFn, type ScorerInput, type ScorersMap, type SemanticRecallConfig, type SerializedCtx, type ServeOptions, type ServerOptions, type SignalProps, type SmithersAlertLabels, type SmithersAlertPolicy, type SmithersAlertPolicyDefaults, type SmithersAlertPolicyRule, type SmithersAlertReaction, type SmithersAlertReactionKind, type SmithersAlertReactionRef, type SmithersAlertSeverity, type SmithersCtx, type SmithersError, type SmithersErrorCode, type SmithersEvent, type SmithersLogFormat, type SmithersObservabilityOptions, type SmithersObservabilityService, type SmithersWorkflow, type SmithersWorkflowOptions, type TaskDescriptor, type TaskMemoryConfig, type TaskProps, type TimeTravelOptions, type TimeTravelResult, type TimerProps, type TryCatchFinallyProps, type WaitForEventProps, type WorkingMemoryConfig, type WorkspaceAddOptions, type WorkspaceInfo, type WorkspaceResult, type XmlElement, type XmlNode, type XmlText, bash, createExternalSmithers, createSmithers, defineTool, edit, getDefinedToolMetadata, grep, mdxPlugin, read, tools, write };
410
+ export { type AgentCapabilityRegistry, type AgentLike, type AgentToolDescriptor, type AggregateOptions, type AggregateScore, type AnthropicAgentOptions, type ApprovalAutoApprove, type ApprovalDecision, type ApprovalMode, type ApprovalOption, type ApprovalProps, type ApprovalRanking, type ApprovalRequest, type ApprovalSelection, type ColumnDef, type ConnectRequest, type ContinueAsNewProps, type CreateScorerConfig, type CreateSmithersApi, type DepsSpec, type EventFrame, type ExternalSmithersConfig, type GatewayAuthConfig, type GatewayDefaults, type GatewayOptions, type GatewayTokenGrant, type GraphSnapshot, type HelloResponse, type HostContainer, type HostNodeJson, type InferDeps, type InferOutputEntry, type InferRow, type JjRevertResult, type KanbanProps, type KnownSmithersErrorCode, type LlmJudgeConfig, type MemoryFact, type MemoryLayerConfig, type MemoryMessage, type MemoryNamespace, type MemoryNamespaceKind, type MemoryProcessor, type MemoryProcessorConfig, type MemoryServiceApi, type MemoryStore, type MemoryThread, type MessageHistoryConfig, type OpenAIAgentOptions, type OpenApiAuth, type OpenApiSpec, type OpenApiToolsOptions, type OpenCodeAgentOptions, type OutputAccessor, type OutputKey, type OutputTarget, type PiAgentOptions, type PiExtensionUiRequest, type PiExtensionUiResponse, type PollerProps, type RequestFrame, type ResolvedSmithersObservabilityOptions, type ResponseFrame, type RevertOptions, type RevertResult, type RunJjOptions, type RunJjResult, type RunOptions, type RunResult, type RunStatus, type SagaProps, type SagaStepDef, type SagaStepProps, type SamplingConfig, type SandboxProps, type SandboxRuntime, type SandboxVolumeMount, type SandboxWorkspaceSpec, type SchemaRegistryEntry, type ScoreResult, type ScoreRow, type Scorer, type ScorerBinding, type ScorerContext, type ScorerFn, type ScorerInput, type ScorersMap, type SemanticRecallConfig, type SerializedCtx, type ServeOptions, type ServerOptions, type SignalProps, type SmithersAlertLabels, type SmithersAlertPolicy, type SmithersAlertPolicyDefaults, type SmithersAlertPolicyRule, type SmithersAlertReaction, type SmithersAlertReactionKind, type SmithersAlertReactionRef, type SmithersAlertSeverity, type SmithersCtx, type SmithersError, type SmithersErrorCode, type SmithersEvent, type SmithersLogFormat, type SmithersObservabilityOptions, type SmithersObservabilityService, type SmithersWorkflow, type SmithersWorkflowOptions, type TaskDescriptor, type TaskMemoryConfig, type TaskProps, type TimeTravelOptions, type TimeTravelResult, type TimerProps, type TryCatchFinallyProps, type WaitForEventProps, type WorkingMemoryConfig, type WorkspaceAddOptions, type WorkspaceInfo, type WorkspaceResult, type XmlElement, type XmlNode, type XmlText, bash, createExternalSmithers, createSmithers, defineTool, edit, getDefinedToolMetadata, grep, mdxPlugin, read, tools, write };
package/src/index.js CHANGED
@@ -80,6 +80,7 @@
80
80
  /** @typedef {import("@smithers-orchestrator/agents").PiAgentOptions} PiAgentOptions */
81
81
  /** @typedef {import("@smithers-orchestrator/agents").PiExtensionUiRequest} PiExtensionUiRequest */
82
82
  /** @typedef {import("@smithers-orchestrator/agents").PiExtensionUiResponse} PiExtensionUiResponse */
83
+ /** @typedef {import("@smithers-orchestrator/agents").OpenCodeAgentOptions} OpenCodeAgentOptions */
83
84
  /** @typedef {import("@smithers-orchestrator/components").PollerProps} PollerProps */
84
85
  /** @typedef {import("@smithers-orchestrator/server/gateway").RequestFrame} RequestFrame */
85
86
  /** @typedef {import("@smithers-orchestrator/observability").ResolvedSmithersObservabilityOptions} ResolvedSmithersObservabilityOptions */
@@ -163,9 +164,9 @@ export { isKnownSmithersErrorCode } from "@smithers-orchestrator/errors/isKnownS
163
164
  export { isSmithersError } from "@smithers-orchestrator/errors/isSmithersError";
164
165
  export { knownSmithersErrorCodes } from "@smithers-orchestrator/errors/knownSmithersErrorCodes";
165
166
  // Components
166
- export { Approval, approvalDecisionSchema, approvalRankingSchema, approvalSelectionSchema, Workflow, Task, Sequence, Parallel, MergeQueue, Branch, Loop, Ralph, ContinueAsNew, continueAsNew, Worktree, Sandbox, Kanban, Poller, Saga, TryCatchFinally, Signal, Timer, WaitForEvent, } from "@smithers-orchestrator/components";
167
+ export { Approval, ApprovalGate, Aspects, Branch, CheckSuite, ClassifyAndRoute, ContentPipeline, ContinueAsNew, Debate, DecisionTable, DriftDetector, EscalationChain, GatherAndSynthesize, HumanTask, Kanban, Loop, MergeQueue, Optimizer, Panel, Parallel, Poller, Ralph, ReviewLoop, Runbook, Saga, Sandbox, ScanFixVerify, Sequence, Signal, Subflow, SuperSmithers, Supervisor, Task, Timer, TryCatchFinally, WaitForEvent, Workflow, Worktree, approvalDecisionSchema, approvalRankingSchema, approvalSelectionSchema, continueAsNew, } from "@smithers-orchestrator/components";
167
168
  // Agents
168
- export { AnthropicAgent, OpenAIAgent, AmpAgent, ClaudeCodeAgent, CodexAgent, GeminiAgent, PiAgent, KimiAgent, ForgeAgent, } from "@smithers-orchestrator/agents";
169
+ export { AnthropicAgent, OpenAIAgent, AmpAgent, ClaudeCodeAgent, CodexAgent, GeminiAgent, PiAgent, KimiAgent, ForgeAgent, OpenCodeAgent, } from "@smithers-orchestrator/agents";
169
170
  // VCS
170
171
  export { runJj, getJjPointer, revertToJjPointer, isJjRepo, workspaceAdd, workspaceList, workspaceClose, } from "@smithers-orchestrator/vcs/jj";
171
172
  // Core API
@@ -167,14 +167,7 @@ export function captureProcess(
167
167
  });
168
168
  child.on("close", (exitCode, signal) => {
169
169
  finish(() => {
170
- resolve({
171
- exitCode: exitCode ?? (signal ? 1 : 0),
172
- signal,
173
- stdout: Buffer.concat(stdoutChunks).toString("utf8"),
174
- stderr: Buffer.concat(stderrChunks).toString("utf8"),
175
- truncated: state.truncated,
176
- totalBytes: state.totalBytes,
177
- });
170
+ resolve({ exitCode: exitCode ?? (signal ? 1 : 0), signal, stdout: Buffer.concat(stdoutChunks).toString("utf8"), stderr: Buffer.concat(stderrChunks).toString("utf8"), truncated: state.truncated, totalBytes: state.totalBytes });
178
171
  });
179
172
  });
180
173
  });