@rome-os/app-runtime 0.3.0 → 0.3.1
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/browser.d.ts.map +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/index.d.ts +225 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +55 -1
- package/dist/index.js.map +1 -1
- package/dist/ipc.d.ts +116 -0
- package/dist/ipc.d.ts.map +1 -0
- package/dist/ipc.js +402 -0
- package/dist/ipc.js.map +1 -0
- package/dist/proxies.d.ts +63 -0
- package/dist/proxies.d.ts.map +1 -0
- package/dist/proxies.js +92 -0
- package/dist/proxies.js.map +1 -0
- package/dist/worker-rpc.d.ts +35 -0
- package/dist/worker-rpc.d.ts.map +1 -0
- package/dist/worker-rpc.js +149 -0
- package/dist/worker-rpc.js.map +1 -0
- package/dist/workflow.d.ts +61 -0
- package/dist/workflow.d.ts.map +1 -0
- package/dist/workflow.js +88 -0
- package/dist/workflow.js.map +1 -0
- package/package.json +10 -7
package/dist/proxies.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// Worker-side typed proxies for main-process services.
|
|
2
|
+
//
|
|
3
|
+
// An action worker is a forked subprocess that holds no live reference to the
|
|
4
|
+
// main-process singletons (RoutineEngine, EventBus, EventCatalog, AppManager) —
|
|
5
|
+
// those own in-memory state (trigger timers, subscriber sets, child-process
|
|
6
|
+
// handles) that cannot be duplicated across processes. Each proxy below
|
|
7
|
+
// presents the action-facing surface of one service but forwards every call to
|
|
8
|
+
// the main process over the WorkerRPC IPC channel (see `getWorkerRpc`), where
|
|
9
|
+
// the real service does the work.
|
|
10
|
+
//
|
|
11
|
+
// They are one half of a pair: in the main process an action receives the real
|
|
12
|
+
// service; in a worker it receives the matching `*Proxy`. The naming mirrors
|
|
13
|
+
// the original (`FooEngine` -> `FooEngineProxy`) so the pair is obvious at a
|
|
14
|
+
// callsite. Each proxy owns the RPC method string (and timeout) for its calls,
|
|
15
|
+
// keeping that stringly-typed seam in one typed place instead of scattered
|
|
16
|
+
// across action bodies.
|
|
17
|
+
import { getWorkerRpc } from "./worker-rpc.js";
|
|
18
|
+
/** apps.* operations install/pack on the main process — minutes, not seconds. */
|
|
19
|
+
const APP_INSTALL_RPC_TIMEOUT_MS = 3 * 60 * 1000;
|
|
20
|
+
/** A flag flip with no filesystem work. */
|
|
21
|
+
const SHORT_RPC_TIMEOUT_MS = 30 * 1000;
|
|
22
|
+
/**
|
|
23
|
+
* Worker-side stand-in for the main-process `RoutineEngine`. Implements the
|
|
24
|
+
* `RoutineEngine` surface an action depends on, so the same `deps.routineEngine`
|
|
25
|
+
* works whether the action runs in the main process (real engine) or a worker
|
|
26
|
+
* (this proxy).
|
|
27
|
+
*/
|
|
28
|
+
export class RoutineEngineProxy {
|
|
29
|
+
/** Bring a persisted routine live. The main process re-reads the row by id
|
|
30
|
+
* and activates it, so only the id needs to cross the wire. */
|
|
31
|
+
async activate(routine) {
|
|
32
|
+
await getWorkerRpc().call("routines.schedule", { routineId: routine.id });
|
|
33
|
+
}
|
|
34
|
+
/** Tear down a routine's triggers in the main process. */
|
|
35
|
+
async deactivate(routineId) {
|
|
36
|
+
await getWorkerRpc().call("routines.cancel", { routineId });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Worker-side stand-in for the main-process `EventBus`. Publishing a domain
|
|
41
|
+
* event also declares its type to the event catalog (RFC 020) — both happen in
|
|
42
|
+
* the main process's `events.publish` handler.
|
|
43
|
+
*/
|
|
44
|
+
export class EventBusProxy {
|
|
45
|
+
async publish(event) {
|
|
46
|
+
// No `?? {}` here: the `events.publish` Zod schema defaults a missing
|
|
47
|
+
// payload to `{}` at the (validated) wire boundary, so defaulting again on
|
|
48
|
+
// the way in is redundant.
|
|
49
|
+
return await getWorkerRpc().call("events.publish", {
|
|
50
|
+
name: event.name,
|
|
51
|
+
source: event.source,
|
|
52
|
+
payload: event.payload,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** Worker-side stand-in for the main-process `EventCatalog` (read side). */
|
|
57
|
+
export class EventCatalogProxy {
|
|
58
|
+
/** Find emittable event types matching `query`, best matches first, capped at
|
|
59
|
+
* `limit`. `total` is the full match count before truncation. */
|
|
60
|
+
async search(query, limit) {
|
|
61
|
+
return await getWorkerRpc().call("events.searchCatalog", { query, limit });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Worker-side stand-in for the main-process app lifecycle authority. Each method
|
|
66
|
+
* owns its RPC method string and timeout. Results are app-local shapes the
|
|
67
|
+
* action knows, so they return as `unknown` and the caller narrows them —
|
|
68
|
+
* keeping those result types out of this SDK.
|
|
69
|
+
*/
|
|
70
|
+
export class AppManagerProxy {
|
|
71
|
+
async create(params) {
|
|
72
|
+
return await getWorkerRpc().call("apps.create", params, {
|
|
73
|
+
timeoutMs: APP_INSTALL_RPC_TIMEOUT_MS,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
async install(params) {
|
|
77
|
+
return await getWorkerRpc().call("apps.install", params, {
|
|
78
|
+
timeoutMs: APP_INSTALL_RPC_TIMEOUT_MS,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
async uninstall(params) {
|
|
82
|
+
return await getWorkerRpc().call("apps.uninstall", params, {
|
|
83
|
+
timeoutMs: APP_INSTALL_RPC_TIMEOUT_MS,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
async setEnabled(params) {
|
|
87
|
+
return await getWorkerRpc().call("apps.setEnabled", params, {
|
|
88
|
+
timeoutMs: SHORT_RPC_TIMEOUT_MS,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=proxies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxies.js","sourceRoot":"","sources":["../src/proxies.ts"],"names":[],"mappings":"AAAA,uDAAuD;A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AAM,YAAY,EAAE,CAAC,IAAI,CAC9B,sBAAsB,EACtB,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAC;IACJ,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IAC1B,KAAK,CAAC,MAAM,CAAC,MAA2C;QACtD,OAAO,MAAM,YAAY,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE;YACtD,SAAS,EAAE,0BAA0B;SACtC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,MAA6D;QACzE,OAAO,MAAM,YAAY,EAAE,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,EAAE;YACvD,SAAS,EAAE,0BAA0B;SACtC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,MAA0C;QACxD,OAAO,MAAM,YAAY,EAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,MAAM,EAAE;YACzD,SAAS,EAAE,0BAA0B;SACtC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,MAA2C;QAC1D,OAAO,MAAM,YAAY,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,EAAE;YAC1D,SAAS,EAAE,oBAAoB;SAChC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface RpcResponseMessage {
|
|
2
|
+
type: "rpc_response";
|
|
3
|
+
clientId: string;
|
|
4
|
+
id: number;
|
|
5
|
+
result?: unknown;
|
|
6
|
+
error?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class WorkerRpcTimeoutError extends Error {
|
|
9
|
+
constructor(method: string, timeoutMs: number);
|
|
10
|
+
}
|
|
11
|
+
export declare class WorkerRpcDisconnectError extends Error {
|
|
12
|
+
constructor();
|
|
13
|
+
}
|
|
14
|
+
declare class WorkerRpcClient {
|
|
15
|
+
private readonly clientId;
|
|
16
|
+
private pending;
|
|
17
|
+
private nextId;
|
|
18
|
+
private processHandlersInstalled;
|
|
19
|
+
call<T = unknown>(method: string, params?: unknown, options?: {
|
|
20
|
+
timeoutMs?: number;
|
|
21
|
+
}): Promise<T>;
|
|
22
|
+
handleResponse(message: RpcResponseMessage): void;
|
|
23
|
+
private ensureProcessHandlers;
|
|
24
|
+
}
|
|
25
|
+
export declare function getWorkerRpc(): WorkerRpcClient;
|
|
26
|
+
export type WorkerRpcInProcessDispatcher = (method: string, params: unknown) => Promise<unknown>;
|
|
27
|
+
/**
|
|
28
|
+
* Register (or clear, with `null`) the main-process dispatcher used as a
|
|
29
|
+
* fallback when there is no parent IPC channel. Called once during main-process
|
|
30
|
+
* wiring with a handler backed by the live WorkerRpcServer.
|
|
31
|
+
*/
|
|
32
|
+
export declare function setWorkerRpcInProcessDispatcher(dispatcher: WorkerRpcInProcessDispatcher | null): void;
|
|
33
|
+
export declare function isWorkerRpcResponse(message: unknown): message is RpcResponseMessage;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=worker-rpc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-rpc.d.ts","sourceRoot":"","sources":["../src/worker-rpc.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAI9C;AAED,qBAAa,wBAAyB,SAAQ,KAAK;;CAKlD;AAoBD,cAAM,eAAe;IACnB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwB;IACjD,OAAO,CAAC,OAAO,CAAkC;IACjD,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,wBAAwB,CAAS;IAEnC,IAAI,CAAC,CAAC,GAAG,OAAO,EACpB,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAC/B,OAAO,CAAC,CAAC,CAAC;IAgEb,cAAc,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAYjD,OAAO,CAAC,qBAAqB;CAkB9B;AAID,wBAAgB,YAAY,IAAI,eAAe,CAK9C;AAWD,MAAM,MAAM,4BAA4B,GAAG,CACzC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,KACZ,OAAO,CAAC,OAAO,CAAC,CAAC;AAItB;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,4BAA4B,GAAG,IAAI,GAC9C,IAAI,CAEN;AAQD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,kBAAkB,CAOnF"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// Worker-side RPC client for calling main-process services.
|
|
2
|
+
//
|
|
3
|
+
// The main process owns live references to ChannelManager, RoutineEngine,
|
|
4
|
+
// and related services. Worker processes reach them over Node's child-process
|
|
5
|
+
// IPC channel via this client — a replacement for the former HTTP callbacks
|
|
6
|
+
// to the internal API.
|
|
7
|
+
import { randomUUID } from "node:crypto";
|
|
8
|
+
export class WorkerRpcTimeoutError extends Error {
|
|
9
|
+
constructor(method, timeoutMs) {
|
|
10
|
+
super(`WorkerRPC timeout: ${method} (${timeoutMs}ms)`);
|
|
11
|
+
this.name = "WorkerRpcTimeoutError";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export class WorkerRpcDisconnectError extends Error {
|
|
15
|
+
constructor() {
|
|
16
|
+
super("WorkerRPC main process disconnected");
|
|
17
|
+
this.name = "WorkerRpcDisconnectError";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
21
|
+
// There may be more than one copy of this module loaded in the same process
|
|
22
|
+
// (e.g. when an installed app ships its own physical copy of @rome-os/app-runtime
|
|
23
|
+
// under node_modules/, producing a distinct ESM URL from the monorepo source).
|
|
24
|
+
// Each copy constructs its own WorkerRpcClient with a distinct `clientId`.
|
|
25
|
+
// Every instance installs its own process.on("message") listener; the main
|
|
26
|
+
// process echoes `clientId` back on responses, so each listener only resolves
|
|
27
|
+
// responses originating from its own pending map. This keeps pending maps
|
|
28
|
+
// fully isolated across copies and avoids id-space collisions (nextId starts
|
|
29
|
+
// from 1 independently in each copy).
|
|
30
|
+
class WorkerRpcClient {
|
|
31
|
+
clientId = randomUUID();
|
|
32
|
+
pending = new Map();
|
|
33
|
+
nextId = 1;
|
|
34
|
+
processHandlersInstalled = false;
|
|
35
|
+
async call(method, params, options) {
|
|
36
|
+
if (!process.send) {
|
|
37
|
+
// Main process: no parent IPC channel, but it directly holds the real
|
|
38
|
+
// services. If a dispatcher is registered, run the call in-process
|
|
39
|
+
// instead of failing. Worker processes always have `process.send` and
|
|
40
|
+
// take the IPC path below — the two paths are mutually exclusive.
|
|
41
|
+
const dispatcher = getInProcessDispatcher();
|
|
42
|
+
if (dispatcher) {
|
|
43
|
+
// Enforce the same deadline as the IPC path so both transports share
|
|
44
|
+
// identical timeout semantics. Without this, callers like
|
|
45
|
+
// AppManagerProxy (which set multi-minute deadlines for
|
|
46
|
+
// apps.install/create/uninstall) would hang forever if an in-process
|
|
47
|
+
// service operation stalls.
|
|
48
|
+
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
49
|
+
let timer;
|
|
50
|
+
const timeout = new Promise((_, reject) => {
|
|
51
|
+
timer = setTimeout(() => reject(new WorkerRpcTimeoutError(method, timeoutMs)), timeoutMs);
|
|
52
|
+
});
|
|
53
|
+
try {
|
|
54
|
+
return (await Promise.race([dispatcher(method, params), timeout]));
|
|
55
|
+
}
|
|
56
|
+
finally {
|
|
57
|
+
if (timer)
|
|
58
|
+
clearTimeout(timer);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
throw new Error(`WorkerRPC: not running in a Node.js child process (method=${method})`);
|
|
62
|
+
}
|
|
63
|
+
this.ensureProcessHandlers();
|
|
64
|
+
const id = this.nextId++;
|
|
65
|
+
const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
66
|
+
return await new Promise((resolve, reject) => {
|
|
67
|
+
const timeout = setTimeout(() => {
|
|
68
|
+
this.pending.delete(id);
|
|
69
|
+
reject(new WorkerRpcTimeoutError(method, timeoutMs));
|
|
70
|
+
}, timeoutMs);
|
|
71
|
+
this.pending.set(id, {
|
|
72
|
+
resolve: (value) => resolve(value),
|
|
73
|
+
reject,
|
|
74
|
+
timeout,
|
|
75
|
+
method,
|
|
76
|
+
});
|
|
77
|
+
const request = {
|
|
78
|
+
type: "rpc_request",
|
|
79
|
+
clientId: this.clientId,
|
|
80
|
+
id,
|
|
81
|
+
method,
|
|
82
|
+
params,
|
|
83
|
+
};
|
|
84
|
+
process.send(request, (err) => {
|
|
85
|
+
if (err) {
|
|
86
|
+
clearTimeout(timeout);
|
|
87
|
+
this.pending.delete(id);
|
|
88
|
+
reject(err);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
handleResponse(message) {
|
|
94
|
+
const pending = this.pending.get(message.id);
|
|
95
|
+
if (!pending)
|
|
96
|
+
return;
|
|
97
|
+
clearTimeout(pending.timeout);
|
|
98
|
+
this.pending.delete(message.id);
|
|
99
|
+
if (message.error !== undefined) {
|
|
100
|
+
pending.reject(new Error(message.error));
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
pending.resolve(message.result);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
ensureProcessHandlers() {
|
|
107
|
+
if (this.processHandlersInstalled)
|
|
108
|
+
return;
|
|
109
|
+
this.processHandlersInstalled = true;
|
|
110
|
+
process.on("message", (message) => {
|
|
111
|
+
if (isWorkerRpcResponse(message) && message.clientId === this.clientId) {
|
|
112
|
+
this.handleResponse(message);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
process.on("disconnect", () => {
|
|
116
|
+
for (const pending of this.pending.values()) {
|
|
117
|
+
clearTimeout(pending.timeout);
|
|
118
|
+
pending.reject(new WorkerRpcDisconnectError());
|
|
119
|
+
}
|
|
120
|
+
this.pending.clear();
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
let singleton = null;
|
|
125
|
+
export function getWorkerRpc() {
|
|
126
|
+
if (!singleton) {
|
|
127
|
+
singleton = new WorkerRpcClient();
|
|
128
|
+
}
|
|
129
|
+
return singleton;
|
|
130
|
+
}
|
|
131
|
+
const IN_PROCESS_DISPATCHER_KEY = Symbol.for("rome.workerRpc.inProcessDispatcher");
|
|
132
|
+
/**
|
|
133
|
+
* Register (or clear, with `null`) the main-process dispatcher used as a
|
|
134
|
+
* fallback when there is no parent IPC channel. Called once during main-process
|
|
135
|
+
* wiring with a handler backed by the live WorkerRpcServer.
|
|
136
|
+
*/
|
|
137
|
+
export function setWorkerRpcInProcessDispatcher(dispatcher) {
|
|
138
|
+
globalThis[IN_PROCESS_DISPATCHER_KEY] = dispatcher ?? undefined;
|
|
139
|
+
}
|
|
140
|
+
function getInProcessDispatcher() {
|
|
141
|
+
return globalThis[IN_PROCESS_DISPATCHER_KEY];
|
|
142
|
+
}
|
|
143
|
+
export function isWorkerRpcResponse(message) {
|
|
144
|
+
return (typeof message === "object" &&
|
|
145
|
+
message !== null &&
|
|
146
|
+
message.type === "rpc_response" &&
|
|
147
|
+
typeof message.clientId === "string");
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=worker-rpc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-rpc.js","sourceRoot":"","sources":["../src/worker-rpc.ts"],"names":[],"mappings":"AAAA,4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AAC,CAAC;YAC/B,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,GAAG,EAAE;YAC5B,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;gBAC5C,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBAC9B,OAAO,CAAC,MAAM,CAAC,IAAI,wBAAwB,EAAE,CAAC,CAAC;YACjD,CAAC;YACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,IAAI,SAAS,GAA2B,IAAI,CAAC;AAE7C,MAAM,UAAU,YAAY;IAC1B,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,SAAS,GAAG,IAAI,eAAe,EAAE,CAAC;IACpC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAgBD,MAAM,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;AAEnF;;;;GAIG;AACH,MAAM,UAAU,+BAA+B,CAC7C,UAA+C;IAE9C,UAAsC,CAAC,yBAAyB,CAAC,GAAG,UAAU,IAAI,SAAS,CAAC;AAC/F,CAAC;AAED,SAAS,sBAAsB;IAC7B,OAAQ,UAAsC,CAAC,yBAAyB,CAE3D,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,OAAO,CACL,OAAO,OAAO,KAAK,QAAQ;QAC3B,OAAO,KAAK,IAAI;QACf,OAA6B,CAAC,IAAI,KAAK,cAAc;QACtD,OAAQ,OAAkC,CAAC,QAAQ,KAAK,QAAQ,CACjE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type Json = unknown;
|
|
2
|
+
/** What a step's body can reach: the action runner (to invoke any registered
|
|
3
|
+
* action, including `summon`) and a logger. */
|
|
4
|
+
export interface StepContext {
|
|
5
|
+
runAction(name: string, args: Record<string, unknown>): Promise<Json>;
|
|
6
|
+
log: {
|
|
7
|
+
info(message: string, data?: Record<string, unknown>): void;
|
|
8
|
+
warn(message: string, data?: Record<string, unknown>): void;
|
|
9
|
+
};
|
|
10
|
+
/** True on a verification/preview run. A step that writes to the outside world
|
|
11
|
+
* (sends a message, posts to a SaaS API) must short-circuit when this is set,
|
|
12
|
+
* so building or testing a workflow never performs a real external write. The
|
|
13
|
+
* interpreter threads it unchanged to every leaf. */
|
|
14
|
+
dryRun: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** A leaf body: transform the input, optionally calling actions via `ctx`. */
|
|
17
|
+
export type StepFn = (input: Json, ctx: StepContext) => Json | Promise<Json>;
|
|
18
|
+
export type Workflow = {
|
|
19
|
+
kind: "step";
|
|
20
|
+
label: string;
|
|
21
|
+
run: StepFn;
|
|
22
|
+
} | {
|
|
23
|
+
kind: "pipeline";
|
|
24
|
+
steps: Workflow[];
|
|
25
|
+
} | {
|
|
26
|
+
kind: "parallel";
|
|
27
|
+
branches: Workflow[];
|
|
28
|
+
} | {
|
|
29
|
+
kind: "branch";
|
|
30
|
+
label: string;
|
|
31
|
+
predicate: (input: Json) => boolean;
|
|
32
|
+
then: Workflow;
|
|
33
|
+
otherwise?: Workflow;
|
|
34
|
+
} | {
|
|
35
|
+
kind: "map";
|
|
36
|
+
label: string;
|
|
37
|
+
items?: (input: Json) => Json[];
|
|
38
|
+
each: Workflow;
|
|
39
|
+
};
|
|
40
|
+
/** A leaf: author-written code. Transform the input and/or call actions via
|
|
41
|
+
* `ctx.runAction(name, args)` — including `ctx.runAction("summon", …)` to hand
|
|
42
|
+
* the step to an LLM agent when it needs judgment. Keep `summon` to a single
|
|
43
|
+
* step; don't fan it across a `map`/`parallel` (see issue #639). */
|
|
44
|
+
export declare function step(label: string, run: StepFn): Workflow;
|
|
45
|
+
/** Run steps in order, threading each step's output into the next step's input. */
|
|
46
|
+
export declare function pipeline(...steps: Workflow[]): Workflow;
|
|
47
|
+
/** Run branches concurrently on the same input; resolve to the array of outputs. */
|
|
48
|
+
export declare function parallel(...branches: Workflow[]): Workflow;
|
|
49
|
+
/** Run `then` when the predicate holds; otherwise run `otherwise` (or pass the
|
|
50
|
+
* input through unchanged when there is no else arm). */
|
|
51
|
+
export declare function branch(label: string, predicate: (input: Json) => boolean, then: Workflow, otherwise?: Workflow): Workflow;
|
|
52
|
+
/** A one-armed branch: run `then` only when the predicate holds. */
|
|
53
|
+
export declare function when(label: string, predicate: (input: Json) => boolean, then: Workflow): Workflow;
|
|
54
|
+
/** Fan `each` out over a runtime list, concurrently; resolve to the per-item
|
|
55
|
+
* outputs. Keep `each` deterministic — don't fan a `summon` step across a map
|
|
56
|
+
* (see issue #639). */
|
|
57
|
+
export declare function map(label: string, each: Workflow, items?: (input: Json) => Json[]): Workflow;
|
|
58
|
+
/** Walk the workflow, running each leaf through its `run` function and threading
|
|
59
|
+
* values according to the combinators. Returns the workflow's final output. */
|
|
60
|
+
export declare function execute(wf: Workflow, input: Json, ctx: StepContext): Promise<Json>;
|
|
61
|
+
//# sourceMappingURL=workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../src/workflow.ts"],"names":[],"mappings":"AAeA,MAAM,MAAM,IAAI,GAAG,OAAO,CAAC;AAE3B;+CAC+C;AAC/C,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtE,GAAG,EAAE;QACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;QAC5D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OA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B,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,OAAO,EACnC,IAAI,EAAE,QAAQ,EACd,SAAS,CAAC,EAAE,QAAQ,GACnB,QAAQ,CAEV;AAED,oEAAoE;AACpE,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,OAAO,EAAE,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAEjG;AAED;;uBAEuB;AACvB,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,IAAI,EAAE,GAAG,QAAQ,CAE5F;AA4BD;+EAC+E;AAC/E,wBAAsB,OAAO,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBxF"}
|
package/dist/workflow.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// The workflow combinator eDSL and its interpreter.
|
|
2
|
+
//
|
|
3
|
+
// A workflow is a *description* — a tree of combinators — not a procedure.
|
|
4
|
+
// `execute` walks the tree, running each leaf and threading values between them.
|
|
5
|
+
//
|
|
6
|
+
// A leaf is a `step`: plain author-written code. A step transforms the value
|
|
7
|
+
// flowing in and may reach any registered action — `send_message`, a connector
|
|
8
|
+
// call, or `summon` (hand off to an LLM agent) — through `ctx.runAction`.
|
|
9
|
+
// Control flow — sequencing, concurrency, conditionals, fan-out — lives in the
|
|
10
|
+
// combinators, never in host `if`/`for`, so the structure stays explicit.
|
|
11
|
+
//
|
|
12
|
+
// This engine ships in the published SDK so every workflow app shares one copy:
|
|
13
|
+
// a generated app contributes only its `buildWorkflow()` definition and imports
|
|
14
|
+
// these combinators, rather than carrying its own interpreter.
|
|
15
|
+
// --- constructors -----------------------------------------------------------
|
|
16
|
+
/** A leaf: author-written code. Transform the input and/or call actions via
|
|
17
|
+
* `ctx.runAction(name, args)` — including `ctx.runAction("summon", …)` to hand
|
|
18
|
+
* the step to an LLM agent when it needs judgment. Keep `summon` to a single
|
|
19
|
+
* step; don't fan it across a `map`/`parallel` (see issue #639). */
|
|
20
|
+
export function step(label, run) {
|
|
21
|
+
return { kind: "step", label, run };
|
|
22
|
+
}
|
|
23
|
+
/** Run steps in order, threading each step's output into the next step's input. */
|
|
24
|
+
export function pipeline(...steps) {
|
|
25
|
+
return { kind: "pipeline", steps };
|
|
26
|
+
}
|
|
27
|
+
/** Run branches concurrently on the same input; resolve to the array of outputs. */
|
|
28
|
+
export function parallel(...branches) {
|
|
29
|
+
return { kind: "parallel", branches };
|
|
30
|
+
}
|
|
31
|
+
/** Run `then` when the predicate holds; otherwise run `otherwise` (or pass the
|
|
32
|
+
* input through unchanged when there is no else arm). */
|
|
33
|
+
export function branch(label, predicate, then, otherwise) {
|
|
34
|
+
return { kind: "branch", label, predicate, then, otherwise };
|
|
35
|
+
}
|
|
36
|
+
/** A one-armed branch: run `then` only when the predicate holds. */
|
|
37
|
+
export function when(label, predicate, then) {
|
|
38
|
+
return branch(label, predicate, then);
|
|
39
|
+
}
|
|
40
|
+
/** Fan `each` out over a runtime list, concurrently; resolve to the per-item
|
|
41
|
+
* outputs. Keep `each` deterministic — don't fan a `summon` step across a map
|
|
42
|
+
* (see issue #639). */
|
|
43
|
+
export function map(label, each, items) {
|
|
44
|
+
return { kind: "map", label, each, items };
|
|
45
|
+
}
|
|
46
|
+
// --- interpreter ------------------------------------------------------------
|
|
47
|
+
const asArray = (v) => (Array.isArray(v) ? v : []);
|
|
48
|
+
/** Run concurrent branches like `Promise.all`, but wait for *every* branch to
|
|
49
|
+
* settle before reporting failure. `Promise.all` rejects on the first failure
|
|
50
|
+
* while the other branches keep running — and because steps may call
|
|
51
|
+
* side-effecting actions (`send_message`, connector writes), that would let a
|
|
52
|
+
* failed run resolve while siblings are still mutating the world in the
|
|
53
|
+
* background, making a retry unsafe. Waiting for all branches keeps the
|
|
54
|
+
* workflow's outcome honest: on success it resolves to the per-branch outputs
|
|
55
|
+
* in order; on any failure it throws once nothing is still in flight. */
|
|
56
|
+
async function runConcurrent(branches, context) {
|
|
57
|
+
const settled = await Promise.allSettled(branches);
|
|
58
|
+
const failures = settled.filter((r) => r.status === "rejected");
|
|
59
|
+
if (failures.length > 0) {
|
|
60
|
+
throw new AggregateError(failures.map((f) => f.reason), `${context}: ${failures.length}/${settled.length} branch(es) failed`);
|
|
61
|
+
}
|
|
62
|
+
return settled.map((r) => r.value);
|
|
63
|
+
}
|
|
64
|
+
/** Walk the workflow, running each leaf through its `run` function and threading
|
|
65
|
+
* values according to the combinators. Returns the workflow's final output. */
|
|
66
|
+
export async function execute(wf, input, ctx) {
|
|
67
|
+
switch (wf.kind) {
|
|
68
|
+
case "step":
|
|
69
|
+
return await wf.run(input, ctx);
|
|
70
|
+
case "pipeline": {
|
|
71
|
+
let value = input;
|
|
72
|
+
for (const s of wf.steps)
|
|
73
|
+
value = await execute(s, value, ctx);
|
|
74
|
+
return value;
|
|
75
|
+
}
|
|
76
|
+
case "parallel":
|
|
77
|
+
return runConcurrent(wf.branches.map((b) => execute(b, input, ctx)), "parallel");
|
|
78
|
+
case "branch":
|
|
79
|
+
if (wf.predicate(input))
|
|
80
|
+
return execute(wf.then, input, ctx);
|
|
81
|
+
return wf.otherwise ? execute(wf.otherwise, input, ctx) : input;
|
|
82
|
+
case "map": {
|
|
83
|
+
const items = wf.items ? wf.items(input) : asArray(input);
|
|
84
|
+
return runConcurrent(items.map((it) => execute(wf.each, it, ctx)), `map "${wf.label}"`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.js","sourceRoot":"","sources":["../src/workflow.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,EA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,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,EAC9C,UAAU,CACX,CAAC;QACJ,KAAK,QAAQ;YACX,IAAI,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC;gBAAE,OAAO,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;YAC7D,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAClE,KAAK,KAAK,CAAC,CAAC,CAAC;YACX,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC1D,OAAO,aAAa,CAClB,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,EAC5C,QAAQ,EAAE,CAAC,KAAK,GAAG,CACpB,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rome-os/app-runtime",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"default": "./dist/index.js"
|
|
11
11
|
},
|
|
12
|
+
"./browser": {
|
|
13
|
+
"types": "./dist/browser.d.ts",
|
|
14
|
+
"default": "./dist/browser.js"
|
|
15
|
+
},
|
|
12
16
|
"./tsconfig.app.json": "./tsconfig.app.json"
|
|
13
17
|
},
|
|
14
18
|
"files": [
|
|
@@ -18,11 +22,6 @@
|
|
|
18
22
|
"publishConfig": {
|
|
19
23
|
"access": "public"
|
|
20
24
|
},
|
|
21
|
-
"scripts": {
|
|
22
|
-
"build": "tsc",
|
|
23
|
-
"prepare": "tsc",
|
|
24
|
-
"typecheck": "tsc --noEmit"
|
|
25
|
-
},
|
|
26
25
|
"dependencies": {
|
|
27
26
|
"drizzle-orm": "^0.45.1",
|
|
28
27
|
"ws": "^8.18.0",
|
|
@@ -33,5 +32,9 @@
|
|
|
33
32
|
"@opentelemetry/sdk-trace-base": "^2.5.1",
|
|
34
33
|
"@types/ws": "^8.18.0",
|
|
35
34
|
"typescript": "^5.9.3"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsc",
|
|
38
|
+
"typecheck": "tsc --noEmit"
|
|
36
39
|
}
|
|
37
|
-
}
|
|
40
|
+
}
|