@osolmaz/pi-workflows 0.16.0 → 0.16.2
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 +18 -2
- package/dist/channels/adapter-entry.d.ts +3 -0
- package/dist/channels/adapter-entry.js +203 -0
- package/dist/channels/adapter-entry.js.map +1 -0
- package/dist/channels/config.d.ts +43 -0
- package/dist/channels/config.js +234 -0
- package/dist/channels/config.js.map +1 -0
- package/dist/channels/protocol.d.ts +94 -0
- package/dist/channels/protocol.js +219 -0
- package/dist/channels/protocol.js.map +1 -0
- package/dist/channels/telegram.d.ts +46 -0
- package/dist/channels/telegram.js +285 -0
- package/dist/channels/telegram.js.map +1 -0
- package/dist/client/client.d.ts +1 -0
- package/dist/client/client.js +5 -1
- package/dist/client/client.js.map +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/protocol.d.ts +1 -1
- package/dist/client/protocol.js +11 -5
- package/dist/client/protocol.js.map +1 -1
- package/dist/client/view.d.ts +48 -16
- package/dist/client/view.js +1 -0
- package/dist/client/view.js.map +1 -1
- package/dist/controllers/index.d.ts +1 -1
- package/dist/controllers/index.js.map +1 -1
- package/dist/controllers/sqlite.d.ts +20 -165
- package/dist/controllers/sqlite.js +178 -436
- package/dist/controllers/sqlite.js.map +1 -1
- package/dist/extension/index.d.ts +23 -2
- package/dist/extension/index.js +637 -534
- package/dist/extension/index.js.map +1 -1
- package/dist/extension/recorder.d.ts +95 -0
- package/dist/extension/recorder.js +530 -0
- package/dist/extension/recorder.js.map +1 -0
- package/dist/extension/remote-recorder-store.d.ts +25 -0
- package/dist/extension/remote-recorder-store.js +81 -0
- package/dist/extension/remote-recorder-store.js.map +1 -0
- package/dist/extension/session-events.d.ts +134 -0
- package/dist/extension/session-events.js +60 -0
- package/dist/extension/session-events.js.map +1 -0
- package/dist/extension/session-view.d.ts +2 -0
- package/dist/extension/session-view.js +60 -2
- package/dist/extension/session-view.js.map +1 -1
- package/dist/extension/step-message.d.ts +6 -4
- package/dist/extension/step-message.js +12 -6
- package/dist/extension/step-message.js.map +1 -1
- package/dist/extension/widget.d.ts +2 -2
- package/dist/extension/widget.js +28 -18
- package/dist/extension/widget.js.map +1 -1
- package/dist/extension/workflow-message-coordinator.d.ts +28 -0
- package/dist/extension/workflow-message-coordinator.js +346 -0
- package/dist/extension/workflow-message-coordinator.js.map +1 -0
- package/dist/host/channel-effects.d.ts +72 -0
- package/dist/host/channel-effects.js +271 -0
- package/dist/host/channel-effects.js.map +1 -0
- package/dist/host/channel-supervisor.d.ts +21 -0
- package/dist/host/channel-supervisor.js +54 -0
- package/dist/host/channel-supervisor.js.map +1 -0
- package/dist/host/runner.d.ts +50 -8
- package/dist/host/runner.js +1632 -341
- package/dist/host/runner.js.map +1 -1
- package/dist/host/state.d.ts +19 -16
- package/dist/host/state.js +251 -63
- package/dist/host/state.js.map +1 -1
- package/dist/host/view.d.ts +19 -9
- package/dist/host/view.js +227 -119
- package/dist/host/view.js.map +1 -1
- package/dist/host/worker-entry.d.ts +4 -1
- package/dist/host/worker-entry.js +23 -24
- package/dist/host/worker-entry.js.map +1 -1
- package/dist/host/worker-protocol.d.ts +15 -0
- package/dist/host/worker-protocol.js.map +1 -1
- package/dist/state/prune.js +3 -25
- package/dist/state/prune.js.map +1 -1
- package/dist/state/schema.js +76 -97
- package/dist/state/schema.js.map +1 -1
- package/dist/state/workflow-messages.d.ts +98 -0
- package/dist/state/workflow-messages.js +366 -0
- package/dist/state/workflow-messages.js.map +1 -0
- package/dist/viewer/render.js +1 -1
- package/dist/viewer/render.js.map +1 -1
- package/dist/viewer/tui.d.ts +1 -1
- package/dist/viewer/tui.js +65 -8
- package/dist/viewer/tui.js.map +1 -1
- package/dist/workflows/composition.js +0 -4
- package/dist/workflows/composition.js.map +1 -1
- package/dist/workflows/definition.js +0 -8
- package/dist/workflows/definition.js.map +1 -1
- package/dist/workflows/engine.js +4 -5
- package/dist/workflows/engine.js.map +1 -1
- package/dist/workflows/human-decision.d.ts +2 -0
- package/dist/workflows/human-decision.js +8 -2
- package/dist/workflows/human-decision.js.map +1 -1
- package/dist/workflows/index.d.ts +1 -1
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/schema.js +0 -4
- package/dist/workflows/schema.js.map +1 -1
- package/dist/workflows/settings.d.ts +1 -8
- package/dist/workflows/settings.js.map +1 -1
- package/dist/workflows/store.d.ts +20 -19
- package/dist/workflows/store.js +163 -354
- package/dist/workflows/store.js.map +1 -1
- package/dist/workflows/tool-input.d.ts +21 -0
- package/dist/workflows/tool-input.js +23 -1
- package/dist/workflows/tool-input.js.map +1 -1
- package/dist/workflows/types.d.ts +6 -8
- package/dist/workflows/workflow-message-content.d.ts +38 -0
- package/dist/workflows/workflow-message-content.js +157 -0
- package/dist/workflows/workflow-message-content.js.map +1 -0
- package/docs/2026-08-18-herdr-piw-plan.md +2 -1
- package/docs/2026-08-20-durable-workflow-launch-plan.md +1 -1
- package/docs/2026-08-25-workflow-follow-ups.md +26 -50
- package/docs/2026-08-30-out-of-process-workflow-host-plan.md +3 -3
- package/docs/2026-09-01-restore-session-delivery-controls-plan.md +4 -0
- package/docs/2026-09-01-unified-workflow-client-plan.md +5 -1
- package/docs/2026-09-02-installed-live-e2e-plan.md +15 -1
- package/docs/2026-09-02-unify-workflow-messages-plan.md +562 -0
- package/docs/2026-09-04-workflow-run-state-plan.md +363 -0
- package/docs/DEFERRED_TURNS.md +66 -294
- package/docs/HUMAN_DECISIONS.md +29 -30
- package/docs/HUMAN_DECISION_PRESENTATIONS.md +4 -11
- package/docs/SQLITE_STATE.md +25 -17
- package/docs/WORKFLOW_HOST.md +105 -31
- package/docs/WORKFLOW_STEP_MESSAGES.md +166 -75
- package/docs/live-replay-protocol.md +8 -4
- package/docs/tui-viewer.md +3 -1
- package/docs/workflows.md +44 -28
- package/herdr-plugin.toml +1 -1
- package/package.json +1 -1
- package/plugins/herdr/viewer.mjs +14 -5
- package/src/channels/adapter-entry.ts +220 -0
- package/src/channels/config.ts +296 -0
- package/src/channels/protocol.ts +333 -0
- package/src/channels/telegram.ts +335 -0
- package/src/client/client.ts +6 -2
- package/src/client/index.ts +2 -1
- package/src/client/protocol.ts +11 -5
- package/src/client/view.ts +51 -18
- package/src/controllers/index.ts +0 -1
- package/src/controllers/sqlite.ts +247 -845
- package/src/extension/index.ts +712 -647
- package/src/extension/recorder.ts +687 -0
- package/src/extension/remote-recorder-store.ts +126 -0
- package/src/extension/session-events.ts +119 -0
- package/src/extension/session-view.ts +86 -3
- package/src/extension/step-message.ts +19 -9
- package/src/extension/widget.ts +37 -17
- package/src/extension/workflow-message-coordinator.ts +398 -0
- package/src/host/channel-effects.ts +465 -0
- package/src/host/channel-supervisor.ts +73 -0
- package/src/host/runner.ts +2163 -525
- package/src/host/state.ts +333 -94
- package/src/host/view.ts +254 -122
- package/src/host/worker-entry.ts +38 -30
- package/src/host/worker-protocol.ts +11 -0
- package/src/state/prune.ts +3 -31
- package/src/state/schema.ts +76 -97
- package/src/state/workflow-messages.ts +599 -0
- package/src/viewer/render.ts +1 -5
- package/src/viewer/tui.ts +71 -6
- package/src/workflows/composition.ts +0 -5
- package/src/workflows/definition.ts +0 -8
- package/src/workflows/engine.ts +4 -6
- package/src/workflows/human-decision.ts +18 -2
- package/src/workflows/index.ts +0 -1
- package/src/workflows/schema.ts +0 -6
- package/src/workflows/settings.ts +1 -20
- package/src/workflows/store.ts +237 -489
- package/src/workflows/tool-input.ts +36 -1
- package/src/workflows/types.ts +6 -8
- package/src/workflows/workflow-message-content.ts +197 -0
- package/dist/extension/decision-channels.d.ts +0 -134
- package/dist/extension/decision-channels.js +0 -1307
- package/dist/extension/decision-channels.js.map +0 -1
- package/src/extension/decision-channels.ts +0 -1826
package/src/client/protocol.ts
CHANGED
|
@@ -11,16 +11,23 @@ export const CLIENT_OPERATIONS = [
|
|
|
11
11
|
"run.pause",
|
|
12
12
|
"run.resume",
|
|
13
13
|
"run.cancel",
|
|
14
|
+
"run.restart",
|
|
15
|
+
"run.changeSettings",
|
|
14
16
|
"run.status",
|
|
15
17
|
"run.list",
|
|
16
18
|
"checkpoint.answer",
|
|
17
19
|
"decision.answer",
|
|
18
20
|
"interaction.submit",
|
|
19
21
|
"interaction.update",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
22
|
+
"workflowMessage.reportBranch",
|
|
23
|
+
"workflowTurn.report",
|
|
24
|
+
"sessionView.clearTerminal",
|
|
25
|
+
"followUp.queue",
|
|
26
|
+
"followUp.remove",
|
|
27
|
+
"session.record",
|
|
28
|
+
"channel.status",
|
|
29
|
+
"channel.reload",
|
|
30
|
+
"channel.recover",
|
|
24
31
|
"controller.list",
|
|
25
32
|
"controller.get",
|
|
26
33
|
"controller.apply",
|
|
@@ -36,7 +43,6 @@ export const CLIENT_OPERATIONS = [
|
|
|
36
43
|
"view.page",
|
|
37
44
|
"view.content",
|
|
38
45
|
"view.session.watch",
|
|
39
|
-
"activity.report",
|
|
40
46
|
"state.status",
|
|
41
47
|
"state.verify",
|
|
42
48
|
"state.backup",
|
package/src/client/view.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { JsonValue } from "../state/json.js";
|
|
2
|
+
import type { WorkflowMessage, WorkflowTurn } from "../state/workflow-messages.js";
|
|
2
3
|
|
|
3
4
|
export const RUN_VIEW_SCHEMA = "pi-workflows.run-view.v1" as const;
|
|
4
5
|
export const SESSION_VIEW_SCHEMA = "pi-workflows.session-view.v1" as const;
|
|
6
|
+
export const WORKFLOW_TURN_REPORT_RECEIPT_SCHEMA =
|
|
7
|
+
"pi-workflows.workflow-turn-report-receipt.v1" as const;
|
|
5
8
|
|
|
6
9
|
export type WorkflowDisplayStatus =
|
|
7
10
|
| "queued"
|
|
@@ -32,6 +35,10 @@ export type WorkflowRunQueueView = {
|
|
|
32
35
|
originSessionId: string | null;
|
|
33
36
|
executionMode: "interactive" | "headless";
|
|
34
37
|
parentRunId: string | null;
|
|
38
|
+
rootRunId: string;
|
|
39
|
+
lineageKind: "continuation" | "restart" | null;
|
|
40
|
+
restartNumber: number;
|
|
41
|
+
parentTerminalFingerprint: string | null;
|
|
35
42
|
errorCode: string | null;
|
|
36
43
|
createdAt: string;
|
|
37
44
|
updatedAt: string;
|
|
@@ -101,10 +108,8 @@ export type ClientInteractiveRequest = {
|
|
|
101
108
|
kind: "agent" | "assistant" | "decision";
|
|
102
109
|
contract: JsonValue;
|
|
103
110
|
revision: number;
|
|
104
|
-
status: "pending" | "
|
|
105
|
-
|
|
106
|
-
presentationClaimExpiresAt: string | null;
|
|
107
|
-
presentationSessionEntryId: string | null;
|
|
111
|
+
status: "pending" | "settled" | "cancelled";
|
|
112
|
+
unproductiveTurnEnds: number;
|
|
108
113
|
acceptedSubmissionId: string | null;
|
|
109
114
|
createdAt: string;
|
|
110
115
|
updatedAt: string;
|
|
@@ -112,11 +117,6 @@ export type ClientInteractiveRequest = {
|
|
|
112
117
|
consumedAt: string | null;
|
|
113
118
|
};
|
|
114
119
|
|
|
115
|
-
export type WorkflowDeliveryAvailability = {
|
|
116
|
-
notification: boolean;
|
|
117
|
-
turn: boolean;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
120
|
export type WorkflowSessionView = {
|
|
121
121
|
schema: typeof SESSION_VIEW_SCHEMA;
|
|
122
122
|
sessionId: string;
|
|
@@ -124,15 +124,48 @@ export type WorkflowSessionView = {
|
|
|
124
124
|
pendingInteractions: JsonValue[];
|
|
125
125
|
pendingInteractionStart: number;
|
|
126
126
|
pendingInteractionTotal: number;
|
|
127
|
-
|
|
127
|
+
workflowMessages: WorkflowMessage[];
|
|
128
|
+
workflowMessageStart: number;
|
|
129
|
+
workflowMessageTotal: number;
|
|
130
|
+
workflowMessageWindowComplete: boolean;
|
|
131
|
+
nextWorkflowMessageId: string | null;
|
|
132
|
+
openWorkflowMessageId: string | null;
|
|
133
|
+
openWorkflowTurn: WorkflowTurn | null;
|
|
134
|
+
coordinatorEpoch: string | null;
|
|
135
|
+
coordinatorActive: boolean;
|
|
136
|
+
branchReportRequired: boolean;
|
|
128
137
|
};
|
|
129
138
|
|
|
130
|
-
export type
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
139
|
+
export type WorkflowBranchReport = {
|
|
140
|
+
targetSessionId: string;
|
|
141
|
+
coordinatorEpoch: string;
|
|
142
|
+
entries: Array<{ workflowMessageId: string; piSessionEntryId: string }>;
|
|
143
|
+
isIdle: boolean;
|
|
144
|
+
hasPendingMessages: boolean;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export type WorkflowTurnReportReceipt = {
|
|
148
|
+
schema: typeof WORKFLOW_TURN_REPORT_RECEIPT_SCHEMA;
|
|
149
|
+
ownership: "active" | "settled" | "absent";
|
|
150
|
+
turn: WorkflowTurn | null;
|
|
138
151
|
};
|
|
152
|
+
|
|
153
|
+
export type WorkflowTurnReport =
|
|
154
|
+
| {
|
|
155
|
+
state: "started";
|
|
156
|
+
workflowMessageId: string;
|
|
157
|
+
workflowTurnId: string;
|
|
158
|
+
runId: string;
|
|
159
|
+
targetSessionId: string;
|
|
160
|
+
coordinatorEpoch: string;
|
|
161
|
+
}
|
|
162
|
+
| {
|
|
163
|
+
state: "ended";
|
|
164
|
+
workflowMessageId: string;
|
|
165
|
+
workflowTurnId: string;
|
|
166
|
+
runId: string;
|
|
167
|
+
targetSessionId: string;
|
|
168
|
+
coordinatorEpoch: string;
|
|
169
|
+
stopReason: "completed" | "aborted" | "error" | "lost";
|
|
170
|
+
responseSessionEntryId: string | null;
|
|
171
|
+
};
|
package/src/controllers/index.ts
CHANGED
|
@@ -23,7 +23,6 @@ export { createResultHelpers, requeue, requeueAfter, settled } from "./results.j
|
|
|
23
23
|
export {
|
|
24
24
|
SqliteControllerStore,
|
|
25
25
|
type RunEventRecord,
|
|
26
|
-
type WorkflowNotificationRecord,
|
|
27
26
|
type WorkflowRunClaimOptions,
|
|
28
27
|
type WorkflowRunPreparationResult,
|
|
29
28
|
type WorkflowRunQueueRecord,
|