@osolmaz/pi-workflows 0.15.2 → 0.16.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/README.md +6 -6
- package/dist/client/activity.d.ts +2 -0
- package/dist/client/activity.js +6 -0
- package/dist/client/activity.js.map +1 -0
- package/dist/client/client.d.ts +101 -0
- package/dist/client/client.js +733 -0
- package/dist/client/client.js.map +1 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.js +3 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/materialize.d.ts +7 -0
- package/dist/client/materialize.js +177 -0
- package/dist/client/materialize.js.map +1 -0
- package/dist/client/protocol.d.ts +60 -0
- package/dist/client/protocol.js +269 -0
- package/dist/client/protocol.js.map +1 -0
- package/dist/client/resolver.d.ts +23 -0
- package/dist/client/resolver.js +2 -0
- package/dist/client/resolver.js.map +1 -0
- package/dist/client/view.d.ts +118 -0
- package/dist/client/view.js +3 -0
- package/dist/client/view.js.map +1 -0
- package/dist/controllers/sqlite.d.ts +64 -0
- package/dist/controllers/sqlite.js +219 -3
- package/dist/controllers/sqlite.js.map +1 -1
- package/dist/extension/index.d.ts +1 -0
- package/dist/extension/index.js +384 -156
- package/dist/extension/index.js.map +1 -1
- package/dist/extension/session-delivery.d.ts +6 -0
- package/dist/extension/session-delivery.js +80 -25
- package/dist/extension/session-delivery.js.map +1 -1
- package/dist/extension/session-view.d.ts +21 -0
- package/dist/extension/session-view.js +127 -0
- package/dist/extension/session-view.js.map +1 -0
- package/dist/extension/widget.d.ts +2 -1
- package/dist/extension/widget.js +15 -7
- package/dist/extension/widget.js.map +1 -1
- package/dist/host/child-worker-supervisor.js +1 -1
- package/dist/host/child-worker-supervisor.js.map +1 -1
- package/dist/host/resolver-entry.d.ts +2 -23
- package/dist/host/resolver-entry.js +1 -1
- package/dist/host/resolver-entry.js.map +1 -1
- package/dist/host/runner.d.ts +12 -0
- package/dist/host/runner.js +565 -43
- package/dist/host/runner.js.map +1 -1
- package/dist/host/state.d.ts +8 -3
- package/dist/host/state.js +59 -27
- package/dist/host/state.js.map +1 -1
- package/dist/host/view.d.ts +73 -0
- package/dist/host/view.js +871 -0
- package/dist/host/view.js.map +1 -0
- package/dist/host/worker-protocol.js +1 -1
- package/dist/host/worker-protocol.js.map +1 -1
- package/dist/state/database.d.ts +1 -0
- package/dist/state/database.js +15 -0
- package/dist/state/database.js.map +1 -1
- package/dist/state/prune.d.ts +3 -1
- package/dist/state/prune.js +6 -8
- package/dist/state/prune.js.map +1 -1
- package/dist/state/schema.js +12 -1
- package/dist/state/schema.js.map +1 -1
- package/dist/viewer/backup.d.ts +2 -0
- package/dist/viewer/backup.js +28 -0
- package/dist/viewer/backup.js.map +1 -0
- package/dist/viewer/cli.d.ts +4 -0
- package/dist/viewer/cli.js +150 -170
- package/dist/viewer/cli.js.map +1 -1
- package/dist/viewer/tui.d.ts +5 -7
- package/dist/viewer/tui.js +188 -108
- package/dist/viewer/tui.js.map +1 -1
- package/dist/workflows/store.d.ts +62 -1
- package/dist/workflows/store.js +350 -44
- package/dist/workflows/store.js.map +1 -1
- package/docs/2026-09-01-restore-session-delivery-controls-plan.md +139 -0
- package/docs/2026-09-01-unified-workflow-client-plan.md +381 -0
- package/docs/2026-09-02-installed-live-e2e-plan.md +225 -0
- package/docs/SQLITE_STATE.md +13 -11
- package/docs/WORKFLOW_HOST.md +81 -64
- package/docs/WORKFLOW_STEP_MESSAGES.md +4 -4
- package/docs/development.md +2 -1
- package/docs/live-replay-protocol.md +70 -132
- package/docs/tui-viewer.md +10 -14
- package/docs/workflows.md +56 -3
- package/herdr-plugin.toml +1 -1
- package/package.json +9 -3
- package/protocol/client.v1.schema.json +137 -0
- package/protocol/fixtures/client-v1.json +23 -0
- package/src/client/activity.ts +6 -0
- package/src/client/client.ts +935 -0
- package/src/client/index.ts +24 -0
- package/src/client/materialize.ts +228 -0
- package/src/client/protocol.ts +327 -0
- package/src/client/resolver.ts +26 -0
- package/src/client/view.ts +138 -0
- package/src/controllers/sqlite.ts +342 -3
- package/src/extension/index.ts +482 -171
- package/src/extension/session-delivery.ts +88 -25
- package/src/extension/session-view.ts +154 -0
- package/src/extension/widget.ts +18 -9
- package/src/host/child-worker-supervisor.ts +1 -1
- package/src/host/resolver-entry.ts +11 -26
- package/src/host/runner.ts +749 -75
- package/src/host/state.ts +82 -44
- package/src/host/view.ts +1084 -0
- package/src/host/worker-protocol.ts +1 -1
- package/src/state/database.ts +13 -0
- package/src/state/prune.ts +11 -11
- package/src/state/schema.ts +12 -1
- package/src/viewer/backup.ts +29 -0
- package/src/viewer/cli.ts +171 -185
- package/src/viewer/tui.ts +196 -124
- package/src/workflows/store.ts +500 -45
- package/dist/host/client.d.ts +0 -48
- package/dist/host/client.js +0 -216
- package/dist/host/client.js.map +0 -1
- package/dist/host/protocol.d.ts +0 -38
- package/dist/host/protocol.js +0 -156
- package/dist/host/protocol.js.map +0 -1
- package/dist/viewer/watch.d.ts +0 -6
- package/dist/viewer/watch.js +0 -46
- package/dist/viewer/watch.js.map +0 -1
- package/src/host/client.ts +0 -293
- package/src/host/protocol.ts +0 -196
- package/src/viewer/watch.ts +0 -51
package/README.md
CHANGED
|
@@ -80,10 +80,10 @@ All live workflow and controller state uses one local database:
|
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
Runs, decisions, queues, claims, controllers, session capture, notifications,
|
|
83
|
-
channel transport state, effects, and large text values all live there.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
[SQLite state](docs/SQLITE_STATE.md).
|
|
83
|
+
channel transport state, effects, and large text values all live there. The
|
|
84
|
+
package-owned host is the only production process that opens the active
|
|
85
|
+
database. The extension, CLI, Herdr adapter, and `piw` use the same versioned
|
|
86
|
+
local client protocol. See [SQLite state](docs/SQLITE_STATE.md).
|
|
87
87
|
|
|
88
88
|
## Quick start
|
|
89
89
|
|
|
@@ -254,8 +254,8 @@ Run the same command after a pi-workflows update. `pi-workflows herdr setup`
|
|
|
254
254
|
remains an alias for existing installations.
|
|
255
255
|
|
|
256
256
|
When Pi runs inside Herdr, the workflow widget shows a `Ctrl+Shift+R piw`
|
|
257
|
-
shortcut. The shortcut opens the exact
|
|
258
|
-
split, tab, or new workspace. `/piw` opens the same menu, and `/piw right`,
|
|
257
|
+
shortcut. The shortcut opens the exact host-owned run view and lets you choose
|
|
258
|
+
a split, tab, or new workspace. `/piw` opens the same menu, and `/piw right`,
|
|
259
259
|
`/piw below`, `/piw left`, `/piw above`, `/piw tab`, or `/piw workspace`
|
|
260
260
|
selects a placement directly. If a viewer for that run already exists,
|
|
261
261
|
pi-workflows focuses it instead of opening a duplicate.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const ORIGIN_ACTIVITY_REFRESH_MS = 1_000;
|
|
2
|
+
export const ORIGIN_ACTIVITY_LEASE_MS = 4_000;
|
|
3
|
+
if (ORIGIN_ACTIVITY_REFRESH_MS >= ORIGIN_ACTIVITY_LEASE_MS) {
|
|
4
|
+
throw new Error("Origin activity refresh period must be shorter than its lease");
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=activity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity.js","sourceRoot":"","sources":["../../src/client/activity.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,CAAC;AAChD,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,CAAC;AAE9C,IAAI,0BAA0B,IAAI,wBAAwB,EAAE,CAAC;IAC3D,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;AACnF,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { type JsonValue } from "../state/json.js";
|
|
2
|
+
import { type ClientEvent, type ClientHello, type ClientOperation, type ClientResponse } from "./protocol.js";
|
|
3
|
+
import type { ResolvedControllerInitialization, ResolvedSettingsChange, ResolvedWorkflowLaunch } from "./resolver.js";
|
|
4
|
+
import type { WorkflowRunView } from "./view.js";
|
|
5
|
+
export declare class WorkflowClientVersionError extends Error {
|
|
6
|
+
constructor(message: string);
|
|
7
|
+
}
|
|
8
|
+
export type WorkflowClientOptions = {
|
|
9
|
+
clientId?: string;
|
|
10
|
+
databasePath?: string;
|
|
11
|
+
hostEntryPath?: string;
|
|
12
|
+
env?: Record<string, string>;
|
|
13
|
+
};
|
|
14
|
+
export declare class WorkflowClient {
|
|
15
|
+
readonly clientId: string;
|
|
16
|
+
readonly databasePath: string;
|
|
17
|
+
readonly endpoint: string;
|
|
18
|
+
private readonly hostEntryPath;
|
|
19
|
+
private readonly env;
|
|
20
|
+
private socket;
|
|
21
|
+
private connectTask;
|
|
22
|
+
private hello;
|
|
23
|
+
private closed;
|
|
24
|
+
private reconnectTimer;
|
|
25
|
+
private readonly pending;
|
|
26
|
+
private readonly subscriptions;
|
|
27
|
+
constructor(options?: WorkflowClientOptions);
|
|
28
|
+
get connectionId(): string | undefined;
|
|
29
|
+
get packageVersion(): string | undefined;
|
|
30
|
+
connect(): Promise<ClientHello>;
|
|
31
|
+
request(options: {
|
|
32
|
+
operation: ClientOperation;
|
|
33
|
+
requestId?: string;
|
|
34
|
+
idempotencyKey?: string;
|
|
35
|
+
runId?: string;
|
|
36
|
+
expectedRevision?: number;
|
|
37
|
+
payload?: JsonValue;
|
|
38
|
+
signal?: AbortSignal;
|
|
39
|
+
}): Promise<ClientResponse>;
|
|
40
|
+
requestDurable(options: {
|
|
41
|
+
operation: ClientOperation;
|
|
42
|
+
requestId?: string;
|
|
43
|
+
idempotencyKey: string;
|
|
44
|
+
runId?: string;
|
|
45
|
+
expectedRevision?: number;
|
|
46
|
+
payload?: JsonValue;
|
|
47
|
+
signal?: AbortSignal;
|
|
48
|
+
}): Promise<ClientResponse>;
|
|
49
|
+
getRun(runId: string): Promise<WorkflowRunView | null>;
|
|
50
|
+
watchRuns(listener: (event: ClientEvent) => void, options?: {
|
|
51
|
+
subscriptionId?: string;
|
|
52
|
+
limit?: number;
|
|
53
|
+
}): Promise<() => Promise<void>>;
|
|
54
|
+
watchRun(runId: string, listener: (event: ClientEvent) => void, options?: {
|
|
55
|
+
subscriptionId?: string;
|
|
56
|
+
revision?: number;
|
|
57
|
+
}): Promise<() => Promise<void>>;
|
|
58
|
+
watchSession(sessionId: string, listener: (event: ClientEvent) => void, options?: {
|
|
59
|
+
subscriptionId?: string;
|
|
60
|
+
}): Promise<() => Promise<void>>;
|
|
61
|
+
ensureAvailable(): Promise<ClientHello>;
|
|
62
|
+
ensureRunning(): Promise<ClientResponse>;
|
|
63
|
+
readContent(runId: string, contentPath: string): Promise<{
|
|
64
|
+
mediaType: string;
|
|
65
|
+
content: Buffer;
|
|
66
|
+
}>;
|
|
67
|
+
hydrateContent(runId: string, value: JsonValue): Promise<JsonValue>;
|
|
68
|
+
private hydrateContentValue;
|
|
69
|
+
resolveWorkflow(options: {
|
|
70
|
+
cwd: string;
|
|
71
|
+
workflowRef: string;
|
|
72
|
+
timeoutMs?: number;
|
|
73
|
+
}): Promise<ResolvedWorkflowLaunch>;
|
|
74
|
+
resolveControllerInitialization(options: {
|
|
75
|
+
cwd: string;
|
|
76
|
+
controllerName: string;
|
|
77
|
+
spec: JsonValue;
|
|
78
|
+
timeoutMs?: number;
|
|
79
|
+
}): Promise<ResolvedControllerInitialization>;
|
|
80
|
+
resolveSettingsChange(options: {
|
|
81
|
+
cwd: string;
|
|
82
|
+
workflowRef: string;
|
|
83
|
+
definitionDigest: string;
|
|
84
|
+
mountPath: string;
|
|
85
|
+
current: JsonValue;
|
|
86
|
+
patch: JsonValue;
|
|
87
|
+
actorId: string;
|
|
88
|
+
timeoutMs?: number;
|
|
89
|
+
}): Promise<ResolvedSettingsChange>;
|
|
90
|
+
close(): Promise<void>;
|
|
91
|
+
private subscribe;
|
|
92
|
+
private requestConnected;
|
|
93
|
+
private send;
|
|
94
|
+
private openConnection;
|
|
95
|
+
private deliverSubscriptionEvent;
|
|
96
|
+
private restoreSubscriptions;
|
|
97
|
+
private resetConnection;
|
|
98
|
+
private scheduleReconnect;
|
|
99
|
+
private runResolver;
|
|
100
|
+
private startDetached;
|
|
101
|
+
}
|