MCPcopy Create free account
hub / github.com/coderoad/coderoad-vscode / createMachine

Function createMachine

web-app/src/services/state/machine.ts:14–260  ·  view source on GitHub ↗
(options: any)

Source from the content-addressed store, hash-verified

12})
13
14export const createMachine = (options: any) => {
15 return Machine<CR.MachineContext, CR.MachineStateSchema, CR.MachineEvent>(
16 {
17 id: 'root',
18 initial: 'Setup',
19 context: {
20 error: null,
21 env: { machineId: '', sessionId: '', token: '' },
22 tutorial: null,
23 position: { levelId: '', stepId: null, complete: false },
24 processes: [],
25 testStatus: null,
26 },
27 on: {
28 // track commands
29 COMMAND_START: {
30 actions: ['commandStart'],
31 },
32 COMMAND_SUCCESS: {
33 actions: ['commandSuccess'],
34 },
35 COMMAND_FAIL: {
36 actions: ['commandFail'],
37 },
38 ERROR: {
39 // TODO: missing clearError
40 actions: ['setError'],
41 },
42 },
43 states: {
44 Setup: {
45 initial: 'Startup',
46 states: {
47 Startup: {
48 onEntry: ['startup'],
49 onExit: ['clearError'],
50 on: {
51 EDITOR_STARTUP_FAILED: {
52 actions: ['setError'],
53 },
54 NO_WORKSPACE: {
55 actions: ['setError'],
56 },
57 REQUEST_WORKSPACE: {
58 actions: 'requestWorkspaceSelect',
59 },
60 LOAD_STORED_TUTORIAL: {
61 target: '#tutorial',
62 actions: ['loadContinuedTutorial', 'continueConfig'],
63 },
64 START_NEW_TUTORIAL: {
65 target: 'Start',
66 actions: ['setStart'],
67 },
68 START_TUTORIAL_FROM_URL: {
69 target: 'SetupNewTutorial',
70 actions: ['setTutorialContext'],
71 },

Callers 1

useStateMachineFunction · 0.90

Calls 1

createOptionsFunction · 0.85

Tested by

no test coverage detected