@typeonce/effect-machine-devtools 0.38.1 → 0.40.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 +2 -2
- package/dist/bin.js +2 -2
- package/dist/bin.js.map +1 -1
- package/dist/client/assets/index-CVtleuI-.js +37 -0
- package/dist/client/index.html +1 -1
- package/dist/internal/evaluationWorker.js +1 -1
- package/dist/internal/evaluationWorker.js.map +1 -1
- package/dist/internal/projectInspector.js +1 -1
- package/dist/internal/projectInspector.js.map +1 -1
- package/package.json +7 -7
- package/src/bin.ts +2 -2
- package/src/internal/browser/example-machine.ts +8 -9
- package/src/internal/browser/hierarchy-routing-example.ts +8 -9
- package/src/internal/browser/invoke-outcomes-example.ts +21 -23
- package/src/internal/browser/layout-resilience-example.ts +14 -15
- package/src/internal/browser/parallel-completion-example.ts +16 -17
- package/src/internal/browser/parallel-owner-routing-example.ts +6 -7
- package/src/internal/browser/planner-example.ts +6 -7
- package/src/internal/browser/protocol-events-example.ts +19 -22
- package/src/internal/browser/shared-terminal-routing-example.ts +41 -42
- package/src/internal/browser/transition-semantics-example.ts +21 -22
- package/src/internal/browser/visualizer-model.ts +4 -5
- package/src/internal/evaluationWorker.ts +1 -1
- package/src/internal/projectInspector.ts +1 -1
- package/dist/client/assets/index-De9zZEnz.js +0 -37
|
@@ -128,19 +128,18 @@ const defaultWorkspaceSnapshot = () => ({
|
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
})
|
|
131
|
-
const targets1 = Machine.targets(TransitionStates)
|
|
132
131
|
export const transitionSemanticsMachine = Machine.make({
|
|
133
132
|
branches: {
|
|
134
133
|
transition4: {
|
|
135
|
-
draft: { target:
|
|
136
|
-
review: { target:
|
|
134
|
+
draft: { target: "Workspace.Draft", title: "Preferred route is draft" },
|
|
135
|
+
review: { target: "Workspace.Review", title: "Preferred route is review" }
|
|
137
136
|
},
|
|
138
137
|
transition7: {
|
|
139
|
-
review: { target:
|
|
140
|
-
publish: { target:
|
|
138
|
+
review: { target: "Workspace.Review", title: "Enter the review flow" },
|
|
139
|
+
publish: { target: "Workspace.Finished", title: "Publish without review" }
|
|
141
140
|
},
|
|
142
|
-
transition14: { destination: { history:
|
|
143
|
-
transition15: { destination: { history:
|
|
141
|
+
transition14: { destination: { history: "Workspace.recent" } },
|
|
142
|
+
transition15: { destination: { history: "Workspace.exact" } }
|
|
144
143
|
},
|
|
145
144
|
id: "transition-semantics",
|
|
146
145
|
root: TransitionStates,
|
|
@@ -164,14 +163,14 @@ export const transitionSemanticsMachine = Machine.make({
|
|
|
164
163
|
)
|
|
165
164
|
}).handle({
|
|
166
165
|
initial: {
|
|
167
|
-
target:
|
|
166
|
+
target: "Paused",
|
|
168
167
|
decoded: true,
|
|
169
168
|
data: new Paused({ reason: "not started" })
|
|
170
169
|
},
|
|
171
170
|
states: {
|
|
172
171
|
Workspace: {
|
|
173
172
|
initial: {
|
|
174
|
-
target:
|
|
173
|
+
target: "Workspace.Routing"
|
|
175
174
|
},
|
|
176
175
|
history: {
|
|
177
176
|
recent: { default: defaultWorkspaceSnapshot },
|
|
@@ -179,12 +178,12 @@ export const transitionSemanticsMachine = Machine.make({
|
|
|
179
178
|
},
|
|
180
179
|
on: {
|
|
181
180
|
Pause: {
|
|
182
|
-
target:
|
|
181
|
+
target: "Paused",
|
|
183
182
|
decoded: true,
|
|
184
183
|
data: ({ event }) => (new Paused({ reason: event.reason }))
|
|
185
184
|
},
|
|
186
185
|
BumpWorkspace: {
|
|
187
|
-
update:
|
|
186
|
+
update: "Workspace",
|
|
188
187
|
decoded: true,
|
|
189
188
|
data: ({ state: current }) => (new Workspace({
|
|
190
189
|
revision: current.revision + 1,
|
|
@@ -193,7 +192,7 @@ export const transitionSemanticsMachine = Machine.make({
|
|
|
193
192
|
}
|
|
194
193
|
},
|
|
195
194
|
onDone: {
|
|
196
|
-
target:
|
|
195
|
+
target: "Published",
|
|
197
196
|
decoded: true,
|
|
198
197
|
data: () => (new Published({ result: "workspace published" }))
|
|
199
198
|
},
|
|
@@ -210,11 +209,11 @@ export const transitionSemanticsMachine = Machine.make({
|
|
|
210
209
|
Draft: {
|
|
211
210
|
on: {
|
|
212
211
|
Edit: {
|
|
213
|
-
target:
|
|
212
|
+
target: "Workspace.Draft",
|
|
214
213
|
decoded: true,
|
|
215
214
|
data: ({ event, state }) => (new Draft({ text: event.text, autosaves: state.autosaves }))
|
|
216
215
|
},
|
|
217
|
-
Save: { target:
|
|
216
|
+
Save: { target: "Workspace.AutoSaving", decoded: true, data: () => (new AutoSaving({})) },
|
|
218
217
|
Submit: {
|
|
219
218
|
branches: "transition7",
|
|
220
219
|
resolve: ({ event, select }) =>
|
|
@@ -233,19 +232,19 @@ export const transitionSemanticsMachine = Machine.make({
|
|
|
233
232
|
},
|
|
234
233
|
AutoSaving: {
|
|
235
234
|
always: {
|
|
236
|
-
target:
|
|
235
|
+
target: "Workspace.Draft",
|
|
237
236
|
decoded: true,
|
|
238
237
|
data: () => (new Draft({ text: "Autosaved draft", autosaves: 1 }))
|
|
239
238
|
}
|
|
240
239
|
},
|
|
241
240
|
Review: {
|
|
242
241
|
initial: {
|
|
243
|
-
target:
|
|
242
|
+
target: "Workspace.Review.Checking",
|
|
244
243
|
decoded: true,
|
|
245
244
|
data: ({}) => new Checking({ checks: ["types", "tests"] })
|
|
246
245
|
},
|
|
247
246
|
onDone: {
|
|
248
|
-
target:
|
|
247
|
+
target: "Workspace.Finished",
|
|
249
248
|
decoded: true,
|
|
250
249
|
data: () => (new WorkspaceFinished({ result: "approved review" }))
|
|
251
250
|
},
|
|
@@ -253,12 +252,12 @@ export const transitionSemanticsMachine = Machine.make({
|
|
|
253
252
|
Checking: {
|
|
254
253
|
on: {
|
|
255
254
|
Approve: {
|
|
256
|
-
target:
|
|
255
|
+
target: "Workspace.Review.Approved",
|
|
257
256
|
decoded: true,
|
|
258
257
|
data: ({ event }) => (new Approved({ reviewer: event.reviewer }))
|
|
259
258
|
},
|
|
260
259
|
Reject: {
|
|
261
|
-
target:
|
|
260
|
+
target: "Workspace.Review.ChangesRequested",
|
|
262
261
|
decoded: true,
|
|
263
262
|
data: ({ event }) => (new ChangesRequested({ reason: event.reason }))
|
|
264
263
|
}
|
|
@@ -267,7 +266,7 @@ export const transitionSemanticsMachine = Machine.make({
|
|
|
267
266
|
ChangesRequested: {
|
|
268
267
|
on: {
|
|
269
268
|
Revise: {
|
|
270
|
-
target:
|
|
269
|
+
target: "Workspace.Draft",
|
|
271
270
|
decoded: true,
|
|
272
271
|
data: () => (new Draft({ text: "Revised draft", autosaves: 0 }))
|
|
273
272
|
}
|
|
@@ -282,14 +281,14 @@ export const transitionSemanticsMachine = Machine.make({
|
|
|
282
281
|
Paused: {
|
|
283
282
|
on: {
|
|
284
283
|
Create: {
|
|
285
|
-
target:
|
|
284
|
+
target: "Workspace",
|
|
286
285
|
decoded: true,
|
|
287
286
|
data: ({ event }) => (new Workspace({ revision: 0, preferredRoute: event.route }))
|
|
288
287
|
},
|
|
289
288
|
ResumeShallow: { branches: "transition14", resolve: ({ select: { destination: target } }) => target() },
|
|
290
289
|
ResumeDeep: { branches: "transition15", resolve: ({ select: { destination: target } }) => target() },
|
|
291
290
|
Restart: {
|
|
292
|
-
target:
|
|
291
|
+
target: "Workspace",
|
|
293
292
|
decoded: true,
|
|
294
293
|
data: () => (new Workspace({ revision: 0, preferredRoute: "draft" }))
|
|
295
294
|
}
|
|
@@ -72,9 +72,7 @@ export const triggerLabel = (transition: VisualizationTransition): string => {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
const pathAccess = (path: string): string => path === "" ? "" : path.split(".").map(propertyAccess).join("")
|
|
75
|
+
const pathName = (path: string): string => JSON.stringify(path === "" ? "root" : path)
|
|
78
76
|
|
|
79
77
|
/** Public declaration represented by a retained transition branch. */
|
|
80
78
|
export const branchTargetApi = (branch: VisualizationBranch): string | undefined => {
|
|
@@ -84,9 +82,10 @@ export const branchTargetApi = (branch: VisualizationBranch): string | undefined
|
|
|
84
82
|
if (path === null) return undefined
|
|
85
83
|
if (selection.scope === "initial") return "initialConfiguration"
|
|
86
84
|
const operation = selection.kind === "state" || selection.kind === "choice" ? "target" : selection.kind
|
|
87
|
-
|
|
85
|
+
if (operation === "target" && path === "") return "{ initialize: … }"
|
|
86
|
+
const fields = [`${operation}: ${pathName(path)}`]
|
|
88
87
|
if (operation !== "update") {
|
|
89
|
-
for (const owner of branch.updates) fields.push(`update:
|
|
88
|
+
for (const owner of branch.updates) fields.push(`update: ${pathName(owner)}`)
|
|
90
89
|
}
|
|
91
90
|
return `{ ${fields.join(", ")} }`
|
|
92
91
|
}
|
|
@@ -2,7 +2,7 @@ import * as NodeWorkerRunner from "@effect/platform-node/NodeWorkerRunner"
|
|
|
2
2
|
import { Machine } from "@typeonce/effect-machine"
|
|
3
3
|
import * as Effect from "effect/Effect"
|
|
4
4
|
import * as Schema from "effect/Schema"
|
|
5
|
-
import * as WorkerRunner from "effect/
|
|
5
|
+
import * as WorkerRunner from "effect/workers/WorkerRunner"
|
|
6
6
|
import { resolve } from "node:path"
|
|
7
7
|
import { pathToFileURL } from "node:url"
|
|
8
8
|
import type { ViteDevServer } from "vite"
|
|
@@ -8,7 +8,7 @@ import * as FileSystem from "effect/FileSystem"
|
|
|
8
8
|
import * as Layer from "effect/Layer"
|
|
9
9
|
import * as Path from "effect/Path"
|
|
10
10
|
import * as Schema from "effect/Schema"
|
|
11
|
-
import * as Worker from "effect/
|
|
11
|
+
import * as Worker from "effect/workers/Worker"
|
|
12
12
|
import { Worker as NodeWorkerThread } from "node:worker_threads"
|
|
13
13
|
import ts from "typescript"
|
|
14
14
|
import * as DevToolsProtocol from "../DevToolsProtocol.js"
|