@osolmaz/pi-workflows 0.15.3 → 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.
Files changed (118) hide show
  1. package/README.md +6 -6
  2. package/dist/client/activity.d.ts +2 -0
  3. package/dist/client/activity.js +6 -0
  4. package/dist/client/activity.js.map +1 -0
  5. package/dist/client/client.d.ts +101 -0
  6. package/dist/client/client.js +733 -0
  7. package/dist/client/client.js.map +1 -0
  8. package/dist/client/index.d.ts +3 -0
  9. package/dist/client/index.js +3 -0
  10. package/dist/client/index.js.map +1 -0
  11. package/dist/client/materialize.d.ts +7 -0
  12. package/dist/client/materialize.js +177 -0
  13. package/dist/client/materialize.js.map +1 -0
  14. package/dist/client/protocol.d.ts +60 -0
  15. package/dist/client/protocol.js +269 -0
  16. package/dist/client/protocol.js.map +1 -0
  17. package/dist/client/resolver.d.ts +23 -0
  18. package/dist/client/resolver.js +2 -0
  19. package/dist/client/resolver.js.map +1 -0
  20. package/dist/client/view.d.ts +118 -0
  21. package/dist/client/view.js +3 -0
  22. package/dist/client/view.js.map +1 -0
  23. package/dist/controllers/sqlite.d.ts +43 -0
  24. package/dist/controllers/sqlite.js +137 -2
  25. package/dist/controllers/sqlite.js.map +1 -1
  26. package/dist/extension/index.d.ts +1 -0
  27. package/dist/extension/index.js +278 -183
  28. package/dist/extension/index.js.map +1 -1
  29. package/dist/extension/session-view.d.ts +7 -2
  30. package/dist/extension/session-view.js +60 -52
  31. package/dist/extension/session-view.js.map +1 -1
  32. package/dist/extension/widget.d.ts +2 -1
  33. package/dist/extension/widget.js +14 -7
  34. package/dist/extension/widget.js.map +1 -1
  35. package/dist/host/child-worker-supervisor.js +1 -1
  36. package/dist/host/child-worker-supervisor.js.map +1 -1
  37. package/dist/host/resolver-entry.d.ts +2 -23
  38. package/dist/host/resolver-entry.js +1 -1
  39. package/dist/host/resolver-entry.js.map +1 -1
  40. package/dist/host/runner.d.ts +11 -0
  41. package/dist/host/runner.js +473 -17
  42. package/dist/host/runner.js.map +1 -1
  43. package/dist/host/state.d.ts +6 -3
  44. package/dist/host/state.js +52 -26
  45. package/dist/host/state.js.map +1 -1
  46. package/dist/host/view.d.ts +73 -0
  47. package/dist/host/view.js +871 -0
  48. package/dist/host/view.js.map +1 -0
  49. package/dist/host/worker-protocol.js +1 -1
  50. package/dist/host/worker-protocol.js.map +1 -1
  51. package/dist/state/database.d.ts +1 -0
  52. package/dist/state/database.js +15 -0
  53. package/dist/state/database.js.map +1 -1
  54. package/dist/state/prune.d.ts +3 -1
  55. package/dist/state/prune.js +6 -8
  56. package/dist/state/prune.js.map +1 -1
  57. package/dist/state/schema.js +12 -1
  58. package/dist/state/schema.js.map +1 -1
  59. package/dist/viewer/backup.d.ts +2 -0
  60. package/dist/viewer/backup.js +28 -0
  61. package/dist/viewer/backup.js.map +1 -0
  62. package/dist/viewer/cli.d.ts +4 -0
  63. package/dist/viewer/cli.js +150 -170
  64. package/dist/viewer/cli.js.map +1 -1
  65. package/dist/viewer/tui.d.ts +5 -7
  66. package/dist/viewer/tui.js +188 -108
  67. package/dist/viewer/tui.js.map +1 -1
  68. package/dist/workflows/store.d.ts +62 -1
  69. package/dist/workflows/store.js +350 -44
  70. package/dist/workflows/store.js.map +1 -1
  71. package/docs/2026-09-01-unified-workflow-client-plan.md +381 -0
  72. package/docs/2026-09-02-installed-live-e2e-plan.md +225 -0
  73. package/docs/SQLITE_STATE.md +13 -11
  74. package/docs/WORKFLOW_HOST.md +74 -61
  75. package/docs/development.md +2 -1
  76. package/docs/live-replay-protocol.md +70 -132
  77. package/docs/tui-viewer.md +10 -14
  78. package/docs/workflows.md +44 -1
  79. package/herdr-plugin.toml +1 -1
  80. package/package.json +9 -3
  81. package/protocol/client.v1.schema.json +137 -0
  82. package/protocol/fixtures/client-v1.json +23 -0
  83. package/src/client/activity.ts +6 -0
  84. package/src/client/client.ts +935 -0
  85. package/src/client/index.ts +24 -0
  86. package/src/client/materialize.ts +228 -0
  87. package/src/client/protocol.ts +327 -0
  88. package/src/client/resolver.ts +26 -0
  89. package/src/client/view.ts +138 -0
  90. package/src/controllers/sqlite.ts +213 -2
  91. package/src/extension/index.ts +349 -208
  92. package/src/extension/session-view.ts +73 -50
  93. package/src/extension/widget.ts +16 -8
  94. package/src/host/child-worker-supervisor.ts +1 -1
  95. package/src/host/resolver-entry.ts +11 -26
  96. package/src/host/runner.ts +648 -48
  97. package/src/host/state.ts +71 -43
  98. package/src/host/view.ts +1084 -0
  99. package/src/host/worker-protocol.ts +1 -1
  100. package/src/state/database.ts +13 -0
  101. package/src/state/prune.ts +11 -11
  102. package/src/state/schema.ts +12 -1
  103. package/src/viewer/backup.ts +29 -0
  104. package/src/viewer/cli.ts +171 -185
  105. package/src/viewer/tui.ts +196 -124
  106. package/src/workflows/store.ts +500 -45
  107. package/dist/host/client.d.ts +0 -48
  108. package/dist/host/client.js +0 -216
  109. package/dist/host/client.js.map +0 -1
  110. package/dist/host/protocol.d.ts +0 -38
  111. package/dist/host/protocol.js +0 -156
  112. package/dist/host/protocol.js.map +0 -1
  113. package/dist/viewer/watch.d.ts +0 -6
  114. package/dist/viewer/watch.js +0 -46
  115. package/dist/viewer/watch.js.map +0 -1
  116. package/src/host/client.ts +0 -293
  117. package/src/host/protocol.ts +0 -196
  118. package/src/viewer/watch.ts +0 -51
@@ -9,11 +9,11 @@ a recorded Pi conversation, themes, and remote viewing.
9
9
 
10
10
  The viewer uses the [incremental and virtualized viewer design](plans/2026-08-28-piw-incremental-viewer-plan.md).
11
11
 
12
- The run browser reads small metadata rows. It does not load trace, step, session, settings, or follow-up payloads. The local viewer checks SQLite `data_version` on its timer. When the value is unchanged, the timer does not scan runs or read payloads.
12
+ The run browser subscribes to small host-owned metadata views. It does not load trace, step, session, settings, or follow-up payloads. The host publishes a new bounded view only when its content changes.
13
13
 
14
- The selected run contains bounded pages. Step, trace, session-entry, and session-event pages contain at most 256 rows. Replay can jump to any position. The viewer loads the page that contains that position and keeps only the current windows. A compact graph projection keeps the latest attempt for each node and the taken transitions up to the replay point.
14
+ The selected run contains bounded pages. Step, trace, session-entry, session-event, settings, follow-up, and update pages have both a row limit and a byte budget. Replay can jump to any position. The viewer loads the page that contains that position and keeps only the current windows. A session-event page includes the replay checkpoint immediately before its first event. A compact graph projection keeps the latest attempt for each node and the taken transitions up to the replay point.
15
15
 
16
- Local page reads run outside input and drawing through one overwrite-only request slot. A newer selection replaces pending work. A failed first read leaves the run browser usable. A failed refresh keeps the last good view and marks it stale.
16
+ Large values use host content references. `piw` fetches them in bounded chunks when the user opens the related detail, verifies the byte count and SHA-256 digest, and then shows the complete text or JSON value. Page and content requests run outside input and drawing through the shared client protocol. A newer page selection replaces the previous request, including when the user returns to an earlier page. A failed first read leaves the run browser usable. A failed refresh keeps the last good view and marks it stale.
17
17
 
18
18
  ## Install
19
19
 
@@ -26,17 +26,15 @@ cargo install pi-workflows
26
26
 
27
27
  ## Modes
28
28
 
29
- - `piw` browses `~/.pi/agent/workflows/state.sqlite` through a read-only SQLite connection.
30
- - `piw <runId>` opens one run from that database.
31
- - `piw serve [--bind 127.0.0.1:9377]` exposes database-backed run views over the
32
- [live replay protocol](live-replay-protocol.md). Only
33
- loopback addresses are accepted; use an SSH tunnel for remote viewing.
29
+ - `piw` connects to the local package-owned workflow host. If the socket is absent, it runs the installed `pi-workflows host start` command.
30
+ - `piw <runId>` opens one host-owned run view.
31
+ - `piw <runId> --once` waits for that run, renders one complete 120 × 40 plain-text frame, and exits. It returns a nonzero status for host, protocol, missing-run, or snapshot-timeout failures.
32
+ - `piw serve [--bind 127.0.0.1:9377]` relays each WebSocket connection to one host socket over the [live client protocol](live-replay-protocol.md). Only loopback addresses are accepted; use an SSH tunnel for remote viewing.
34
33
  - `piw --connect ws://…` reads from another `piw serve` process.
35
34
  - `piw --theme <name>` selects a theme for this invocation.
36
35
  - `piw --list-themes` prints the built-in theme names.
37
36
 
38
- Direct database mode and connected mode use the same semantic run view.
39
- The protocol is the network form of that view.
37
+ Local and remote modes use the same semantic run view and the same protocol. `piw` has no SQLite mode or database schema copy.
40
38
 
41
39
  ## Herdr
42
40
 
@@ -211,11 +209,9 @@ listing and selected-run subscription after the server returns. Cached content
211
209
  stays visible but is labeled reconnecting or disconnected, never current.
212
210
  Revision gaps force a bounded snapshot.
213
211
 
214
- `piw serve` keeps one loaded projection and one graph scene for each watched run. The first watcher loads it. Later watchers reuse it. The last unwatch or disconnect releases it. Clients keep separate revision and page cursors, so one client's replay jump does not move another client. A lagged client gets a bounded snapshot instead of an unbounded patch backlog.
212
+ `piw serve` is a frame relay. It keeps no run projection or client activity after either side closes. Clients keep separate revision and page cursors, so one client's replay jump does not move another client. A lagged client gets a bounded snapshot instead of an unbounded patch backlog.
215
213
 
216
- Expanded prompt and output fields come from content-addressed SQLite blobs.
217
- The local reader uses query-only mode. Remote snapshots carry the same bounded
218
- semantic view and do not expose a filesystem path.
214
+ The host resolves expanded prompt and output fields from durable content. Local and remote snapshots carry the same bounded semantic view and do not expose a database path.
219
215
 
220
216
  ## Interaction
221
217
 
package/docs/workflows.md CHANGED
@@ -126,6 +126,8 @@ pi-workflows host run
126
126
  `host run` stays attached. The other commands start, inspect, or stop the
127
127
  on-demand process. No command installs an operating-system service.
128
128
 
129
+ The extension, CLI, and `piw` use the same version-1 client protocol over a Unix socket or Windows named pipe. The host sends byte-bounded run-list and run-view pages. Clients collect a complete run list for one revision and reject stale run pages whose cursor or revision no longer matches. The host reads only the selected history ranges and reuses an unchanged subscribed view after a lightweight revision check. It waits for a slow socket to drain and removes every subscription when its client unsubscribes. Large values stay available through verified content chunks. Host-generated aggregate values are saved and linked to the run before the host advertises them.
130
+
129
131
  A worker verifies the root and all mounted source identities before it loads
130
132
  workflow modules. It then checks the resolved mounted-source map and executes
131
133
  from committed state through a host-backed store. A source mismatch parks the
@@ -193,7 +195,10 @@ For submitted output, the engine appends the existing workflow-tool contract.
193
195
  The host checks the durable transport identifiers, stores a `validating`
194
196
  submission, and starts a supervised worker. In that worker, the output passes
195
197
  through tolerant JSON normalization and then `validate`. The tool reports
196
- success only after this check accepts the output. Rejected submissions return
198
+ success only after this check accepts the output. If the tool turn is aborted,
199
+ the client stops waiting but does not cancel the durable host command. A retry
200
+ uses a new transport request ID with the same durable submission identity and
201
+ adopts the stored result. Rejected submissions return
197
202
  the validation error and can retry in the same step. If the model settles
198
203
  without submitting, the durable request stays pending until it receives valid
199
204
  output, times out, or is cancelled. For assistant-message output, the engine appends a normal-response contract,
@@ -795,3 +800,41 @@ const engine = new WorkflowEngine({
795
800
  });
796
801
  const { state } = await engine.run(workflow, { task: "..." });
797
802
  ```
803
+
804
+ ## Test the installed package
805
+
806
+ The installed-package end-to-end test packs this repository and installs the
807
+ archive with production dependencies in a temporary consumer project. It then
808
+ starts the repository-pinned base Pi with only that Pi Workflows installation.
809
+ The test checks command isolation, host startup, widget and status changes,
810
+ pause, resume, completion, and `piw <runId> --once` output.
811
+
812
+ Run the deterministic phase without a model call:
813
+
814
+ ```bash
815
+ npm run test:e2e:live -- --runtime-only
816
+ ```
817
+
818
+ A real-model phase is manual. Supply the exact Pi provider and model as separate
819
+ values. The runner does not select a default or accept model fallback:
820
+
821
+ ```bash
822
+ npm run test:e2e:live -- \
823
+ --provider openai \
824
+ --model gpt-5.6-luna
825
+ ```
826
+
827
+ For subscription authentication, use a dedicated Pi profile that has no other
828
+ extensions or resources:
829
+
830
+ ```bash
831
+ npm run test:e2e:live -- \
832
+ --profile ~/.config/pi-workflows-e2e/openai-codex \
833
+ --provider openai-codex \
834
+ --model gpt-5.6-luna
835
+ ```
836
+
837
+ The profile and normal provider environment remain operator-owned. The runner
838
+ does not read, copy, print, or save credentials. It uses one guarded temporary
839
+ root and removes that root after success or failure. Use `--keep` only when you
840
+ need the isolated files for diagnosis.
package/herdr-plugin.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  id = "osolmaz.pi-workflows"
2
2
  name = "pi-workflows"
3
- version = "0.15.3"
3
+ version = "0.16.0"
4
4
  min_herdr_version = "0.7.0"
5
5
  description = "Open the active pi-workflows run in piw from a managed Herdr pane."
6
6
  platforms = ["linux", "macos"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osolmaz/pi-workflows",
3
- "version": "0.15.3",
3
+ "version": "0.16.0",
4
4
  "description": "Workflow and controller runtime with a live terminal viewer for the pi coding agent",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -24,6 +24,7 @@
24
24
  "examples",
25
25
  "docs",
26
26
  "schemas",
27
+ "protocol",
27
28
  "plugins/herdr",
28
29
  "herdr-plugin.toml",
29
30
  "README.md",
@@ -39,6 +40,10 @@
39
40
  "types": "./dist/extension/index.d.ts",
40
41
  "default": "./dist/extension/index.js"
41
42
  },
43
+ "./client": {
44
+ "types": "./dist/client/index.d.ts",
45
+ "default": "./dist/client/index.js"
46
+ },
42
47
  "./controllers": {
43
48
  "types": "./dist/controllers/index.d.ts",
44
49
  "default": "./dist/controllers/index.js"
@@ -62,11 +67,13 @@
62
67
  "test": "vitest run",
63
68
  "test:coverage": "vitest run --coverage",
64
69
  "test:e2e": "vitest run --config vitest.e2e.config.ts",
70
+ "test:e2e:live": "node scripts/live-e2e.mjs",
65
71
  "typecheck": "tsc -p tsconfig.json --noEmit"
66
72
  },
67
73
  "dependencies": {
68
74
  "better-sqlite3": "^13.0.2",
69
- "jiti": "^2.7.0"
75
+ "jiti": "^2.7.0",
76
+ "tsx": "^4.23.13"
70
77
  },
71
78
  "devDependencies": {
72
79
  "@earendil-works/pi-ai": "0.84.2",
@@ -77,7 +84,6 @@
77
84
  "@vitest/coverage-istanbul": "^4.1.10",
78
85
  "oxfmt": "^0.59.0",
79
86
  "oxlint": "^1.74.0",
80
- "tsx": "^4.23.1",
81
87
  "typebox": "^1.3.6",
82
88
  "typescript": "^7.0.2",
83
89
  "vitest": "^4.1.10"
@@ -0,0 +1,137 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/osolmaz/pi-workflows/blob/main/protocol/client.v1.schema.json",
4
+ "title": "Pi Workflows client protocol version 1",
5
+ "oneOf": [
6
+ {
7
+ "type": "object",
8
+ "additionalProperties": false,
9
+ "required": ["schema", "type", "connectionId", "packageVersion"],
10
+ "properties": {
11
+ "schema": { "const": "pi-workflows.client.v1" },
12
+ "type": { "const": "hello" },
13
+ "connectionId": { "$ref": "#/$defs/opaqueId" },
14
+ "packageVersion": { "type": "string", "minLength": 1 }
15
+ }
16
+ },
17
+ {
18
+ "type": "object",
19
+ "additionalProperties": false,
20
+ "required": [
21
+ "schema",
22
+ "type",
23
+ "requestId",
24
+ "clientId",
25
+ "operation",
26
+ "idempotencyKey",
27
+ "payload"
28
+ ],
29
+ "properties": {
30
+ "schema": { "const": "pi-workflows.client.v1" },
31
+ "type": { "const": "request" },
32
+ "requestId": { "$ref": "#/$defs/opaqueId" },
33
+ "clientId": { "$ref": "#/$defs/opaqueId" },
34
+ "operation": {
35
+ "enum": [
36
+ "run.start",
37
+ "run.pause",
38
+ "run.resume",
39
+ "run.cancel",
40
+ "run.status",
41
+ "run.list",
42
+ "checkpoint.answer",
43
+ "decision.answer",
44
+ "interaction.submit",
45
+ "interaction.update",
46
+ "notification.claim",
47
+ "notification.deliver",
48
+ "turn.claim",
49
+ "turn.resolve",
50
+ "controller.list",
51
+ "controller.get",
52
+ "controller.apply",
53
+ "controller.reconcile",
54
+ "controller.delete",
55
+ "host.status",
56
+ "host.stop",
57
+ "view.runs.watch",
58
+ "view.runs.page",
59
+ "view.run.get",
60
+ "view.run.watch",
61
+ "view.run.unwatch",
62
+ "view.page",
63
+ "view.content",
64
+ "view.session.watch",
65
+ "activity.report",
66
+ "state.status",
67
+ "state.verify",
68
+ "state.backup",
69
+ "state.prune"
70
+ ]
71
+ },
72
+ "idempotencyKey": { "$ref": "#/$defs/opaqueId" },
73
+ "runId": { "$ref": "#/$defs/opaqueId" },
74
+ "expectedRevision": { "$ref": "#/$defs/revision" },
75
+ "payload": {}
76
+ }
77
+ },
78
+ {
79
+ "type": "object",
80
+ "additionalProperties": false,
81
+ "required": ["schema", "type", "requestId", "outcome"],
82
+ "properties": {
83
+ "schema": { "const": "pi-workflows.client.v1" },
84
+ "type": { "const": "response" },
85
+ "requestId": { "$ref": "#/$defs/opaqueId" },
86
+ "outcome": {
87
+ "enum": [
88
+ "accepted",
89
+ "adopted",
90
+ "rejected",
91
+ "conflict",
92
+ "notFound",
93
+ "claimLost",
94
+ "unavailable"
95
+ ]
96
+ },
97
+ "revision": { "$ref": "#/$defs/revision" },
98
+ "receipt": {},
99
+ "error": { "type": "string", "minLength": 1 }
100
+ }
101
+ },
102
+ {
103
+ "type": "object",
104
+ "additionalProperties": false,
105
+ "required": ["schema", "type", "subscriptionId", "event", "payload"],
106
+ "properties": {
107
+ "schema": { "const": "pi-workflows.client.v1" },
108
+ "type": { "const": "event" },
109
+ "subscriptionId": { "$ref": "#/$defs/opaqueId" },
110
+ "event": {
111
+ "enum": [
112
+ "runs",
113
+ "run_snapshot",
114
+ "run_patch",
115
+ "run_page",
116
+ "session_snapshot",
117
+ "unavailable"
118
+ ]
119
+ },
120
+ "revision": { "$ref": "#/$defs/revision" },
121
+ "runId": { "$ref": "#/$defs/opaqueId" },
122
+ "payload": {}
123
+ }
124
+ }
125
+ ],
126
+ "$defs": {
127
+ "opaqueId": {
128
+ "type": "string",
129
+ "minLength": 1,
130
+ "maxLength": 256
131
+ },
132
+ "revision": {
133
+ "type": "integer",
134
+ "minimum": 0
135
+ }
136
+ }
137
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "valid": [
3
+ "{\"connectionId\":\"connection-1\",\"packageVersion\":\"0.15.3\",\"schema\":\"pi-workflows.client.v1\",\"type\":\"hello\"}",
4
+ "{\"clientId\":\"client-1\",\"idempotencyKey\":\"key-1\",\"operation\":\"host.status\",\"payload\":{},\"requestId\":\"request-1\",\"schema\":\"pi-workflows.client.v1\",\"type\":\"request\"}",
5
+ "{\"clientId\":\"client-1\",\"idempotencyKey\":\"key-runs-page\",\"operation\":\"view.runs.page\",\"payload\":{\"cursor\":2,\"revision\":\"3:10:20\"},\"requestId\":\"request-runs-page\",\"schema\":\"pi-workflows.client.v1\",\"type\":\"request\"}",
6
+ "{\"clientId\":\"client-1\",\"idempotencyKey\":\"key-run-get\",\"operation\":\"view.run.get\",\"payload\":{},\"requestId\":\"request-run-get\",\"runId\":\"run-1\",\"schema\":\"pi-workflows.client.v1\",\"type\":\"request\"}",
7
+ "{\"clientId\":\"client-1\",\"expectedRevision\":7,\"idempotencyKey\":\"key-page\",\"operation\":\"view.page\",\"payload\":{\"cursor\":299,\"kind\":\"steps\"},\"requestId\":\"request-page\",\"runId\":\"run-1\",\"schema\":\"pi-workflows.client.v1\",\"type\":\"request\"}",
8
+ "{\"clientId\":\"client-1\",\"idempotencyKey\":\"key-content\",\"operation\":\"view.content\",\"payload\":{\"offset\":0,\"path\":\"artifacts/sha256/abc.json\"},\"requestId\":\"request-content\",\"runId\":\"run-1\",\"schema\":\"pi-workflows.client.v1\",\"type\":\"request\"}",
9
+ "{\"outcome\":\"accepted\",\"receipt\":{\"live\":true},\"requestId\":\"request-1\",\"schema\":\"pi-workflows.client.v1\",\"type\":\"response\"}",
10
+ "{\"outcome\":\"accepted\",\"receipt\":{\"large\":100000000000000000000,\"𐀀\":2,\"\":1},\"requestId\":\"request-canonical\",\"schema\":\"pi-workflows.client.v1\",\"type\":\"response\"}",
11
+ "{\"event\":\"run_snapshot\",\"payload\":{\"revision\":7,\"runId\":\"run-1\",\"schema\":\"pi-workflows.run-view.v1\"},\"revision\":3,\"runId\":\"run-1\",\"schema\":\"pi-workflows.client.v1\",\"subscriptionId\":\"subscription-run\",\"type\":\"event\"}",
12
+ "{\"event\":\"session_snapshot\",\"payload\":{\"run\":null,\"schema\":\"pi-workflows.session-view.v1\",\"sessionId\":\"session-1\"},\"revision\":1,\"schema\":\"pi-workflows.client.v1\",\"subscriptionId\":\"subscription-1\",\"type\":\"event\"}"
13
+ ],
14
+ "invalid": [
15
+ "{\"schema\":\"pi-workflows.client.v1\",\"type\":\"hello\",\"connectionId\":\"connection-1\",\"packageVersion\":\"0.15.3\"}",
16
+ "{\"connectionId\":\"connection-1\",\"extra\":true,\"packageVersion\":\"0.15.3\",\"schema\":\"pi-workflows.client.v1\",\"type\":\"hello\"}",
17
+ "{\"clientId\":\"client-1\",\"idempotencyKey\":\"key-1\",\"operation\":\"unknown\",\"payload\":{},\"requestId\":\"request-1\",\"schema\":\"pi-workflows.client.v1\",\"type\":\"request\"}",
18
+ "{\"extra\":true,\"outcome\":\"accepted\",\"requestId\":\"request-1\",\"schema\":\"pi-workflows.client.v1\",\"type\":\"response\"}",
19
+ "{\"outcome\":\"accepted\",\"receipt\":{\"large\":1e+20},\"requestId\":\"request-canonical\",\"schema\":\"pi-workflows.client.v1\",\"type\":\"response\"}",
20
+ "{\"event\":\"unknown\",\"payload\":{},\"schema\":\"pi-workflows.client.v1\",\"subscriptionId\":\"subscription-1\",\"type\":\"event\"}",
21
+ "{\"outcome\":\"accepted\",\"requestId\":\"request-1\",\"schema\":\"pi-workflows.client.v2\",\"type\":\"response\"}"
22
+ ]
23
+ }
@@ -0,0 +1,6 @@
1
+ export const ORIGIN_ACTIVITY_REFRESH_MS = 1_000;
2
+ export const ORIGIN_ACTIVITY_LEASE_MS = 4_000;
3
+
4
+ if (ORIGIN_ACTIVITY_REFRESH_MS >= ORIGIN_ACTIVITY_LEASE_MS) {
5
+ throw new Error("Origin activity refresh period must be shorter than its lease");
6
+ }