@bolt-foundry/gambit 0.8.6-rc.3 → 0.8.6-rc.4
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/CHANGELOG.md +20 -1
- package/esm/gambit/simulator-ui/dist/bundle.js +2435 -620
- package/esm/gambit/simulator-ui/dist/bundle.js.map +4 -4
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/entrypoint.d.ts +7 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/entrypoint.d.ts.map +1 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/entrypoint.js +22 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/normalization_ast.d.ts +4 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/normalization_ast.d.ts.map +1 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/normalization_ast.js +456 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/output_type.d.ts +3 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/output_type.d.ts.map +1 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/output_type.js +1 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/param_type.d.ts +110 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/param_type.d.ts.map +1 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/param_type.js +1 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/parameters_type.d.ts +10 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/parameters_type.d.ts.map +1 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/parameters_type.js +1 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/query_text.d.ts +3 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/query_text.d.ts.map +1 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/query_text.js +96 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/raw_response_type.d.ts +91 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/raw_response_type.d.ts.map +1 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/raw_response_type.js +1 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/resolver_reader.d.ts +6 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/resolver_reader.d.ts.map +1 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/resolver_reader.js +610 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunSend/normalization_ast.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunSend/normalization_ast.js +86 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunSend/param_type.d.ts +18 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunSend/param_type.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunSend/query_text.d.ts +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunSend/query_text.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunSend/query_text.js +18 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunSend/raw_response_type.d.ts +18 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunSend/raw_response_type.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunSend/resolver_reader.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunSend/resolver_reader.js +120 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunStart/normalization_ast.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunStart/normalization_ast.js +43 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunStart/param_type.d.ts +9 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunStart/param_type.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunStart/query_text.d.ts +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunStart/query_text.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunStart/query_text.js +9 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunStart/raw_response_type.d.ts +9 -0
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunStart/raw_response_type.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunStart/resolver_reader.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunStart/resolver_reader.js +60 -0
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/normalization_ast.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/normalization_ast.js +43 -0
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/query_text.d.ts +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/query_text.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/query_text.js +9 -0
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/raw_response_type.d.ts +9 -0
- package/esm/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/raw_response_type.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Workspace/TestTab/param_type.d.ts +9 -0
- package/esm/simulator-ui/__generated__/__isograph/Workspace/TestTab/param_type.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Workspace/TestTab/resolver_reader.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/Workspace/TestTab/resolver_reader.js +60 -0
- package/esm/simulator-ui/__generated__/__isograph/iso.d.ts +4 -0
- package/esm/simulator-ui/__generated__/__isograph/iso.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/__isograph/iso.js +3 -0
- package/esm/simulator-ui/__generated__/builtRoutes.d.ts +2 -0
- package/esm/simulator-ui/__generated__/builtRoutes.d.ts.map +1 -1
- package/esm/simulator-ui/__generated__/builtRoutes.js +3 -0
- package/esm/simulator-ui/isograph/components/Query/SimulatorTestPage.d.ts.map +1 -1
- package/esm/simulator-ui/isograph/components/Query/SimulatorTestPage.js +141 -4
- package/esm/simulator-ui/isograph/entrypoints/EntrypointSimulatorWorkspaceShell.d.ts.map +1 -1
- package/esm/simulator-ui/isograph/entrypoints/EntrypointSimulatorWorkspaceShell.js +3 -1
- package/esm/simulator-ui/mutations/GambitWorkspaceFeedbackSave.d.ts +93 -0
- package/esm/simulator-ui/mutations/GambitWorkspaceFeedbackSave.d.ts.map +1 -0
- package/esm/simulator-ui/mutations/GambitWorkspaceFeedbackSave.js +101 -0
- package/esm/simulator-ui/mutations/GambitWorkspaceFeedbackSaveMutation.d.ts +93 -0
- package/esm/simulator-ui/mutations/GambitWorkspaceFeedbackSaveMutation.d.ts.map +1 -0
- package/esm/simulator-ui/mutations/GambitWorkspaceFeedbackSaveMutation.js +7 -0
- package/esm/simulator-ui/mutations/GambitWorkspaceScenarioRunSend.d.ts +18 -0
- package/esm/simulator-ui/mutations/GambitWorkspaceScenarioRunSend.d.ts.map +1 -1
- package/esm/simulator-ui/mutations/GambitWorkspaceScenarioRunSend.js +18 -0
- package/esm/simulator-ui/mutations/GambitWorkspaceScenarioRunSendMutation.d.ts +18 -0
- package/esm/simulator-ui/mutations/GambitWorkspaceScenarioRunSendMutation.d.ts.map +1 -1
- package/esm/simulator-ui/mutations/GambitWorkspaceScenarioRunStart.d.ts +9 -0
- package/esm/simulator-ui/mutations/GambitWorkspaceScenarioRunStart.d.ts.map +1 -1
- package/esm/simulator-ui/mutations/GambitWorkspaceScenarioRunStart.js +9 -0
- package/esm/simulator-ui/mutations/GambitWorkspaceScenarioRunStartMutation.d.ts +9 -0
- package/esm/simulator-ui/mutations/GambitWorkspaceScenarioRunStartMutation.d.ts.map +1 -1
- package/esm/simulator-ui/src/AppIsoMinimal.d.ts +3 -0
- package/esm/simulator-ui/src/AppIsoMinimal.d.ts.map +1 -1
- package/esm/simulator-ui/src/AppIsoMinimal.js +7 -4
- package/esm/simulator-ui/src/AppShell.d.ts.map +1 -1
- package/esm/simulator-ui/src/AppShell.js +2 -2
- package/esm/simulator-ui/src/MinimalRouterRoot.js +4 -2
- package/esm/simulator-ui/src/RouterContext.d.ts.map +1 -1
- package/esm/simulator-ui/src/RouterContext.js +7 -3
- package/esm/simulator-ui/src/shared.d.ts.map +1 -1
- package/esm/simulator-ui/src/shared.js +3 -3
- package/esm/src/server/request_handler.d.ts +210 -0
- package/esm/src/server/request_handler.d.ts.map +1 -0
- package/esm/src/server/request_handler.js +416 -0
- package/esm/src/server/workspace/build.d.ts +57 -0
- package/esm/src/server/workspace/build.d.ts.map +1 -0
- package/esm/src/server/workspace/build.js +377 -0
- package/esm/src/server/workspace/conversation_sessions.d.ts +83 -0
- package/esm/src/server/workspace/conversation_sessions.d.ts.map +1 -0
- package/esm/src/server/workspace/conversation_sessions.js +163 -0
- package/esm/src/server/workspace/grading.d.ts +52 -0
- package/esm/src/server/workspace/grading.d.ts.map +1 -0
- package/esm/src/server/workspace/grading.js +488 -0
- package/esm/src/server/workspace/helpers.d.ts +46 -0
- package/esm/src/server/workspace/helpers.d.ts.map +1 -0
- package/esm/src/server/workspace/helpers.js +340 -0
- package/esm/src/server/workspace/read_model.d.ts +35 -0
- package/esm/src/server/workspace/read_model.d.ts.map +1 -0
- package/esm/src/server/workspace/read_model.js +121 -0
- package/esm/src/server/workspace/response_events.d.ts +28 -0
- package/esm/src/server/workspace/response_events.d.ts.map +1 -0
- package/esm/src/server/workspace/response_events.js +178 -0
- package/esm/src/server/workspace/run_deck.d.ts +23 -0
- package/esm/src/server/workspace/run_deck.d.ts.map +1 -0
- package/esm/src/server/workspace/run_deck.js +79 -0
- package/esm/src/server/workspace/scenario_history.d.ts +8 -0
- package/esm/src/server/workspace/scenario_history.d.ts.map +1 -0
- package/esm/src/server/workspace/scenario_history.js +269 -0
- package/esm/src/server/workspace/scenarios.d.ts +93 -0
- package/esm/src/server/workspace/scenarios.d.ts.map +1 -0
- package/esm/src/server/workspace/scenarios.js +1052 -0
- package/esm/src/server/workspace/schema.d.ts +35 -0
- package/esm/src/server/workspace/schema.d.ts.map +1 -0
- package/esm/src/server/workspace/schema.js +427 -0
- package/esm/src/server/workspace/sessions.d.ts +38 -0
- package/esm/src/server/workspace/sessions.d.ts.map +1 -0
- package/esm/src/server/workspace/sessions.js +232 -0
- package/esm/src/server/workspace/types.d.ts +128 -0
- package/esm/src/server/workspace/types.d.ts.map +1 -0
- package/esm/src/server/workspace/types.js +1 -0
- package/esm/src/server/workspace/verify.d.ts +52 -0
- package/esm/src/server/workspace/verify.d.ts.map +1 -0
- package/esm/src/server/workspace/verify.js +449 -0
- package/esm/src/server.d.ts +0 -3
- package/esm/src/server.d.ts.map +1 -1
- package/esm/src/server.js +324 -6732
- package/esm/src/server_isograph_environment.d.ts +12 -1
- package/esm/src/server_isograph_environment.d.ts.map +1 -1
- package/esm/src/server_legacy_api_routes.d.ts +137 -0
- package/esm/src/server_legacy_api_routes.d.ts.map +1 -0
- package/esm/src/server_legacy_api_routes.js +629 -0
- package/esm/src/server_openresponses.d.ts +6 -0
- package/esm/src/server_openresponses.d.ts.map +1 -0
- package/esm/src/server_openresponses.js +687 -0
- package/esm/src/server_session_store.d.ts +4 -0
- package/esm/src/server_session_store.d.ts.map +1 -1
- package/esm/src/server_session_store.js +196 -1
- package/esm/src/server_simulator_ui.d.ts +27 -0
- package/esm/src/server_simulator_ui.d.ts.map +1 -0
- package/esm/src/server_simulator_ui.js +501 -0
- package/esm/src/server_types.d.ts +22 -0
- package/esm/src/server_types.d.ts.map +1 -1
- package/esm/src/server_workspace_decks.d.ts +31 -0
- package/esm/src/server_workspace_decks.d.ts.map +1 -0
- package/esm/src/server_workspace_decks.js +98 -0
- package/esm/src/server_workspace_graphql.d.ts +17 -0
- package/esm/src/server_workspace_graphql.d.ts.map +1 -0
- package/esm/src/server_workspace_graphql.js +52 -0
- package/esm/src/server_workspace_runtime.d.ts +55 -0
- package/esm/src/server_workspace_runtime.d.ts.map +1 -0
- package/esm/src/server_workspace_runtime.js +358 -0
- package/esm/src/simulator_graphql.d.ts +14 -1
- package/esm/src/simulator_graphql.d.ts.map +1 -1
- package/esm/src/simulator_graphql.js +77 -0
- package/package.json +1 -1
- package/script/gambit/simulator-ui/dist/bundle.js +2435 -620
- package/script/gambit/simulator-ui/dist/bundle.js.map +4 -4
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/entrypoint.d.ts +7 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/entrypoint.d.ts.map +1 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/entrypoint.js +27 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/normalization_ast.d.ts +4 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/normalization_ast.d.ts.map +1 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/normalization_ast.js +458 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/output_type.d.ts +3 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/output_type.d.ts.map +1 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/output_type.js +2 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/param_type.d.ts +110 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/param_type.d.ts.map +1 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/param_type.js +2 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/parameters_type.d.ts +10 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/parameters_type.d.ts.map +1 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/parameters_type.js +2 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/query_text.d.ts +3 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/query_text.d.ts.map +1 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/query_text.js +98 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/raw_response_type.d.ts +91 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/raw_response_type.d.ts.map +1 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/raw_response_type.js +2 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/resolver_reader.d.ts +6 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/resolver_reader.d.ts.map +1 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceFeedbackSave/resolver_reader.js +615 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunSend/normalization_ast.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunSend/normalization_ast.js +86 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunSend/param_type.d.ts +18 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunSend/param_type.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunSend/query_text.d.ts +1 -1
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunSend/query_text.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunSend/query_text.js +18 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunSend/raw_response_type.d.ts +18 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunSend/raw_response_type.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunSend/resolver_reader.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunSend/resolver_reader.js +120 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunStart/normalization_ast.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunStart/normalization_ast.js +43 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunStart/param_type.d.ts +9 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunStart/param_type.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunStart/query_text.d.ts +1 -1
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunStart/query_text.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunStart/query_text.js +9 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunStart/raw_response_type.d.ts +9 -0
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunStart/raw_response_type.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunStart/resolver_reader.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Mutation/GambitWorkspaceScenarioRunStart/resolver_reader.js +60 -0
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/normalization_ast.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/normalization_ast.js +43 -0
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/query_text.d.ts +1 -1
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/query_text.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/query_text.js +9 -0
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/raw_response_type.d.ts +9 -0
- package/script/simulator-ui/__generated__/__isograph/Query/EntrypointSimulatorTestPage/raw_response_type.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Workspace/TestTab/param_type.d.ts +9 -0
- package/script/simulator-ui/__generated__/__isograph/Workspace/TestTab/param_type.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Workspace/TestTab/resolver_reader.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/Workspace/TestTab/resolver_reader.js +60 -0
- package/script/simulator-ui/__generated__/__isograph/iso.d.ts +4 -0
- package/script/simulator-ui/__generated__/__isograph/iso.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/__isograph/iso.js +45 -42
- package/script/simulator-ui/__generated__/builtRoutes.d.ts +2 -0
- package/script/simulator-ui/__generated__/builtRoutes.d.ts.map +1 -1
- package/script/simulator-ui/__generated__/builtRoutes.js +18 -15
- package/script/simulator-ui/isograph/components/Query/SimulatorTestPage.d.ts.map +1 -1
- package/script/simulator-ui/isograph/components/Query/SimulatorTestPage.js +141 -4
- package/script/simulator-ui/isograph/entrypoints/EntrypointSimulatorWorkspaceShell.d.ts.map +1 -1
- package/script/simulator-ui/isograph/entrypoints/EntrypointSimulatorWorkspaceShell.js +3 -1
- package/script/simulator-ui/mutations/GambitWorkspaceFeedbackSave.d.ts +93 -0
- package/script/simulator-ui/mutations/GambitWorkspaceFeedbackSave.d.ts.map +1 -0
- package/script/simulator-ui/mutations/GambitWorkspaceFeedbackSave.js +104 -0
- package/script/simulator-ui/mutations/GambitWorkspaceFeedbackSaveMutation.d.ts +93 -0
- package/script/simulator-ui/mutations/GambitWorkspaceFeedbackSaveMutation.d.ts.map +1 -0
- package/script/simulator-ui/mutations/GambitWorkspaceFeedbackSaveMutation.js +13 -0
- package/script/simulator-ui/mutations/GambitWorkspaceScenarioRunSend.d.ts +18 -0
- package/script/simulator-ui/mutations/GambitWorkspaceScenarioRunSend.d.ts.map +1 -1
- package/script/simulator-ui/mutations/GambitWorkspaceScenarioRunSend.js +18 -0
- package/script/simulator-ui/mutations/GambitWorkspaceScenarioRunSendMutation.d.ts +18 -0
- package/script/simulator-ui/mutations/GambitWorkspaceScenarioRunSendMutation.d.ts.map +1 -1
- package/script/simulator-ui/mutations/GambitWorkspaceScenarioRunStart.d.ts +9 -0
- package/script/simulator-ui/mutations/GambitWorkspaceScenarioRunStart.d.ts.map +1 -1
- package/script/simulator-ui/mutations/GambitWorkspaceScenarioRunStart.js +9 -0
- package/script/simulator-ui/mutations/GambitWorkspaceScenarioRunStartMutation.d.ts +9 -0
- package/script/simulator-ui/mutations/GambitWorkspaceScenarioRunStartMutation.d.ts.map +1 -1
- package/script/simulator-ui/src/AppIsoMinimal.d.ts +3 -0
- package/script/simulator-ui/src/AppIsoMinimal.d.ts.map +1 -1
- package/script/simulator-ui/src/AppIsoMinimal.js +7 -4
- package/script/simulator-ui/src/AppShell.d.ts.map +1 -1
- package/script/simulator-ui/src/AppShell.js +1 -1
- package/script/simulator-ui/src/MinimalRouterRoot.js +4 -2
- package/script/simulator-ui/src/RouterContext.d.ts.map +1 -1
- package/script/simulator-ui/src/RouterContext.js +6 -2
- package/script/simulator-ui/src/shared.d.ts.map +1 -1
- package/script/simulator-ui/src/shared.js +3 -3
- package/script/src/server/request_handler.d.ts +210 -0
- package/script/src/server/request_handler.d.ts.map +1 -0
- package/script/src/server/request_handler.js +453 -0
- package/script/src/server/workspace/build.d.ts +57 -0
- package/script/src/server/workspace/build.d.ts.map +1 -0
- package/script/src/server/workspace/build.js +381 -0
- package/script/src/server/workspace/conversation_sessions.d.ts +83 -0
- package/script/src/server/workspace/conversation_sessions.d.ts.map +1 -0
- package/script/src/server/workspace/conversation_sessions.js +167 -0
- package/script/src/server/workspace/grading.d.ts +52 -0
- package/script/src/server/workspace/grading.d.ts.map +1 -0
- package/script/src/server/workspace/grading.js +492 -0
- package/script/src/server/workspace/helpers.d.ts +46 -0
- package/script/src/server/workspace/helpers.d.ts.map +1 -0
- package/script/src/server/workspace/helpers.js +353 -0
- package/script/src/server/workspace/read_model.d.ts +35 -0
- package/script/src/server/workspace/read_model.d.ts.map +1 -0
- package/script/src/server/workspace/read_model.js +125 -0
- package/script/src/server/workspace/response_events.d.ts +28 -0
- package/script/src/server/workspace/response_events.d.ts.map +1 -0
- package/script/src/server/workspace/response_events.js +182 -0
- package/script/src/server/workspace/run_deck.d.ts +23 -0
- package/script/src/server/workspace/run_deck.d.ts.map +1 -0
- package/script/src/server/workspace/run_deck.js +84 -0
- package/script/src/server/workspace/scenario_history.d.ts +8 -0
- package/script/src/server/workspace/scenario_history.d.ts.map +1 -0
- package/script/src/server/workspace/scenario_history.js +310 -0
- package/script/src/server/workspace/scenarios.d.ts +93 -0
- package/script/src/server/workspace/scenarios.d.ts.map +1 -0
- package/script/src/server/workspace/scenarios.js +1089 -0
- package/script/src/server/workspace/schema.d.ts +35 -0
- package/script/src/server/workspace/schema.d.ts.map +1 -0
- package/script/src/server/workspace/schema.js +478 -0
- package/script/src/server/workspace/sessions.d.ts +38 -0
- package/script/src/server/workspace/sessions.d.ts.map +1 -0
- package/script/src/server/workspace/sessions.js +269 -0
- package/script/src/server/workspace/types.d.ts +128 -0
- package/script/src/server/workspace/types.d.ts.map +1 -0
- package/script/src/server/workspace/types.js +2 -0
- package/script/src/server/workspace/verify.d.ts +52 -0
- package/script/src/server/workspace/verify.d.ts.map +1 -0
- package/script/src/server/workspace/verify.js +453 -0
- package/script/src/server.d.ts +0 -3
- package/script/src/server.d.ts.map +1 -1
- package/script/src/server.js +391 -6799
- package/script/src/server_isograph_environment.d.ts +12 -1
- package/script/src/server_isograph_environment.d.ts.map +1 -1
- package/script/src/server_legacy_api_routes.d.ts +137 -0
- package/script/src/server_legacy_api_routes.d.ts.map +1 -0
- package/script/src/server_legacy_api_routes.js +666 -0
- package/script/src/server_openresponses.d.ts +6 -0
- package/script/src/server_openresponses.d.ts.map +1 -0
- package/script/src/server_openresponses.js +690 -0
- package/script/src/server_session_store.d.ts +4 -0
- package/script/src/server_session_store.d.ts.map +1 -1
- package/script/src/server_session_store.js +196 -1
- package/script/src/server_simulator_ui.d.ts +27 -0
- package/script/src/server_simulator_ui.d.ts.map +1 -0
- package/script/src/server_simulator_ui.js +544 -0
- package/script/src/server_types.d.ts +22 -0
- package/script/src/server_types.d.ts.map +1 -1
- package/script/src/server_workspace_decks.d.ts +31 -0
- package/script/src/server_workspace_decks.d.ts.map +1 -0
- package/script/src/server_workspace_decks.js +142 -0
- package/script/src/server_workspace_graphql.d.ts +17 -0
- package/script/src/server_workspace_graphql.d.ts.map +1 -0
- package/script/src/server_workspace_graphql.js +56 -0
- package/script/src/server_workspace_runtime.d.ts +55 -0
- package/script/src/server_workspace_runtime.d.ts.map +1 -0
- package/script/src/server_workspace_runtime.js +395 -0
- package/script/src/simulator_graphql.d.ts +14 -1
- package/script/src/simulator_graphql.d.ts.map +1 -1
- package/script/src/simulator_graphql.js +77 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.resolveGraderDeckFromState = exports.resolveScenarioDeckFromState = exports.buildRootScenarioFallback = exports.buildWorkspaceDeckStateFromLoadedDeck = exports.summarizeDeckState = exports.toAvailableGraderDeck = exports.toAvailableTestDeck = exports.toDeckLabel = void 0;
|
|
37
|
+
const path = __importStar(require("../deps/jsr.io/@std/path/1.1.4/mod.js"));
|
|
38
|
+
const slugify = (label) => {
|
|
39
|
+
return label.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)+/g, "");
|
|
40
|
+
};
|
|
41
|
+
const parseDeckMaxTurns = (value) => {
|
|
42
|
+
if (typeof value !== "number" || !Number.isFinite(value))
|
|
43
|
+
return undefined;
|
|
44
|
+
const rounded = Math.round(value);
|
|
45
|
+
if (rounded < 1)
|
|
46
|
+
return 1;
|
|
47
|
+
if (rounded > 200)
|
|
48
|
+
return 200;
|
|
49
|
+
return rounded;
|
|
50
|
+
};
|
|
51
|
+
const toDeckLabel = (filePath) => {
|
|
52
|
+
const base = path.basename(filePath);
|
|
53
|
+
return base
|
|
54
|
+
.replace(/\.deck\.(md|ts)$/i, "")
|
|
55
|
+
.replace(/[-_]+/g, " ")
|
|
56
|
+
.trim() || base;
|
|
57
|
+
};
|
|
58
|
+
exports.toDeckLabel = toDeckLabel;
|
|
59
|
+
const toAvailableTestDeck = (deck, index) => {
|
|
60
|
+
const label = deck.label && typeof deck.label === "string"
|
|
61
|
+
? deck.label
|
|
62
|
+
: (0, exports.toDeckLabel)(deck.path);
|
|
63
|
+
const id = deck.id && typeof deck.id === "string"
|
|
64
|
+
? deck.id
|
|
65
|
+
: slugify(`${label || "test-deck"}-${index}`);
|
|
66
|
+
const maxTurns = parseDeckMaxTurns(deck.maxTurns);
|
|
67
|
+
return {
|
|
68
|
+
id,
|
|
69
|
+
label: label || id,
|
|
70
|
+
description: typeof deck.description === "string"
|
|
71
|
+
? deck.description
|
|
72
|
+
: undefined,
|
|
73
|
+
path: deck.path,
|
|
74
|
+
...(maxTurns !== undefined ? { maxTurns } : {}),
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
exports.toAvailableTestDeck = toAvailableTestDeck;
|
|
78
|
+
const toAvailableGraderDeck = (deck, index) => {
|
|
79
|
+
const label = deck.label && typeof deck.label === "string"
|
|
80
|
+
? deck.label
|
|
81
|
+
: (0, exports.toDeckLabel)(deck.path);
|
|
82
|
+
const id = deck.id && typeof deck.id === "string"
|
|
83
|
+
? deck.id
|
|
84
|
+
: slugify(`${label || "grader-deck"}-${index}`);
|
|
85
|
+
return {
|
|
86
|
+
id,
|
|
87
|
+
label: label || id,
|
|
88
|
+
description: typeof deck.description === "string"
|
|
89
|
+
? deck.description
|
|
90
|
+
: undefined,
|
|
91
|
+
path: deck.path,
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
exports.toAvailableGraderDeck = toAvailableGraderDeck;
|
|
95
|
+
const summarizeDeckState = (deckState) => ({
|
|
96
|
+
scenarioDeckCount: deckState?.scenarioDecks.length ?? 0,
|
|
97
|
+
scenarioDeckPaths: (deckState?.scenarioDecks ?? []).slice(0, 12).map((deck) => deck.path),
|
|
98
|
+
graderDeckCount: deckState?.graderDecks.length ?? 0,
|
|
99
|
+
});
|
|
100
|
+
exports.summarizeDeckState = summarizeDeckState;
|
|
101
|
+
const buildWorkspaceDeckStateFromLoadedDeck = async (args) => {
|
|
102
|
+
const scenarioDecks = await Promise.all((args.deck.testDecks ?? []).map(async (scenarioDeck, index) => {
|
|
103
|
+
const availableDeck = (0, exports.toAvailableTestDeck)(scenarioDeck, index);
|
|
104
|
+
const desc = await args.describeDeckInputSchemaFromPath(availableDeck.path);
|
|
105
|
+
return {
|
|
106
|
+
...availableDeck,
|
|
107
|
+
inputSchema: desc.schema,
|
|
108
|
+
defaults: desc.defaults,
|
|
109
|
+
inputSchemaError: desc.error,
|
|
110
|
+
};
|
|
111
|
+
}));
|
|
112
|
+
return {
|
|
113
|
+
workspaceId: args.workspaceId,
|
|
114
|
+
rootDeckPath: args.deck.path,
|
|
115
|
+
assistantDeck: args.buildPersistedAssistantDeck(args.deck),
|
|
116
|
+
scenarioDecks,
|
|
117
|
+
graderDecks: (args.deck.graderDecks ?? []).map(exports.toAvailableGraderDeck),
|
|
118
|
+
updatedAt: new Date().toISOString(),
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
exports.buildWorkspaceDeckStateFromLoadedDeck = buildWorkspaceDeckStateFromLoadedDeck;
|
|
122
|
+
const buildRootScenarioFallback = (deckState) => ({
|
|
123
|
+
id: "root",
|
|
124
|
+
label: (0, exports.toDeckLabel)(deckState.assistantDeck.deck),
|
|
125
|
+
description: "Root simulator deck",
|
|
126
|
+
path: deckState.assistantDeck.deck,
|
|
127
|
+
});
|
|
128
|
+
exports.buildRootScenarioFallback = buildRootScenarioFallback;
|
|
129
|
+
const resolveScenarioDeckFromState = (deckState, identifier) => {
|
|
130
|
+
if (!identifier)
|
|
131
|
+
return undefined;
|
|
132
|
+
const normalizedIdentifier = path.resolve(identifier);
|
|
133
|
+
return deckState.scenarioDecks.find((deck) => deck.id === identifier || path.resolve(deck.path) === normalizedIdentifier);
|
|
134
|
+
};
|
|
135
|
+
exports.resolveScenarioDeckFromState = resolveScenarioDeckFromState;
|
|
136
|
+
const resolveGraderDeckFromState = (deckState, identifier) => {
|
|
137
|
+
if (!identifier)
|
|
138
|
+
return undefined;
|
|
139
|
+
const normalizedIdentifier = path.resolve(identifier);
|
|
140
|
+
return deckState.graderDecks.find((deck) => deck.id === identifier || path.resolve(deck.path) === normalizedIdentifier);
|
|
141
|
+
};
|
|
142
|
+
exports.resolveGraderDeckFromState = resolveGraderDeckFromState;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SimulatorGraphqlOperations } from "./server_isograph_environment.js";
|
|
2
|
+
import type { WorkspaceDeckState } from "./server_types.js";
|
|
3
|
+
type WorkspaceDeckGraphqlOperations = Pick<SimulatorGraphqlOperations, "listWorkspaceGraderDecks" | "listWorkspaceScenarioDecks" | "readWorkspaceAssistantDeck">;
|
|
4
|
+
type WorkspaceDeckGraphqlDeps = {
|
|
5
|
+
activateWorkspaceDeck: (workspaceId?: string | null, options?: {
|
|
6
|
+
forceReload?: boolean;
|
|
7
|
+
source?: string;
|
|
8
|
+
reloadAttemptId?: string;
|
|
9
|
+
}) => Promise<void>;
|
|
10
|
+
readWorkspaceDeckStateStrict: (workspaceId: string) => WorkspaceDeckState;
|
|
11
|
+
getResolvedDeckPath: () => string;
|
|
12
|
+
summarizeWorkspaceDeckState: (workspaceId?: string | null) => Record<string, unknown>;
|
|
13
|
+
logWorkspaceRefreshDebug: (event: string, payload: Record<string, unknown>) => void;
|
|
14
|
+
};
|
|
15
|
+
export declare const createWorkspaceDeckGraphqlOperations: (deps: WorkspaceDeckGraphqlDeps) => WorkspaceDeckGraphqlOperations;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=server_workspace_graphql.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server_workspace_graphql.d.ts","sourceRoot":"","sources":["../../src/src/server_workspace_graphql.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,KAAK,8BAA8B,GAAG,IAAI,CACxC,0BAA0B,EACxB,0BAA0B,GAC1B,4BAA4B,GAC5B,4BAA4B,CAC/B,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC9B,qBAAqB,EAAE,CACrB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,EAC3B,OAAO,CAAC,EAAE;QACR,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,KACE,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,4BAA4B,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,kBAAkB,CAAC;IAC1E,mBAAmB,EAAE,MAAM,MAAM,CAAC;IAClC,2BAA2B,EAAE,CAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,KACxB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,wBAAwB,EAAE,CACxB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC7B,IAAI,CAAC;CACX,CAAC;AAEF,eAAO,MAAM,oCAAoC,GAC/C,MAAM,wBAAwB,KAC7B,8BAmDD,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createWorkspaceDeckGraphqlOperations = void 0;
|
|
4
|
+
const createWorkspaceDeckGraphqlOperations = (deps) => ({
|
|
5
|
+
listWorkspaceGraderDecks: async (workspaceId) => {
|
|
6
|
+
await deps.activateWorkspaceDeck(workspaceId, {
|
|
7
|
+
source: "graphql:listWorkspaceGraderDecks",
|
|
8
|
+
});
|
|
9
|
+
const deckState = deps.readWorkspaceDeckStateStrict(workspaceId);
|
|
10
|
+
return deckState.graderDecks.map((deck) => ({
|
|
11
|
+
id: deck.id,
|
|
12
|
+
label: deck.label,
|
|
13
|
+
description: deck.description,
|
|
14
|
+
path: deck.path,
|
|
15
|
+
}));
|
|
16
|
+
},
|
|
17
|
+
listWorkspaceScenarioDecks: async (workspaceId) => {
|
|
18
|
+
deps.logWorkspaceRefreshDebug("graphql.scenarioDecks.list.begin", {
|
|
19
|
+
workspaceId,
|
|
20
|
+
resolvedDeckPath: deps.getResolvedDeckPath(),
|
|
21
|
+
...deps.summarizeWorkspaceDeckState(workspaceId),
|
|
22
|
+
});
|
|
23
|
+
await deps.activateWorkspaceDeck(workspaceId, {
|
|
24
|
+
source: "graphql:listWorkspaceScenarioDecks",
|
|
25
|
+
});
|
|
26
|
+
deps.logWorkspaceRefreshDebug("graphql.scenarioDecks.list.afterActivate", {
|
|
27
|
+
workspaceId,
|
|
28
|
+
resolvedDeckPath: deps.getResolvedDeckPath(),
|
|
29
|
+
...deps.summarizeWorkspaceDeckState(workspaceId),
|
|
30
|
+
});
|
|
31
|
+
const deckState = deps.readWorkspaceDeckStateStrict(workspaceId);
|
|
32
|
+
const result = deckState.scenarioDecks.map((deck) => ({
|
|
33
|
+
id: deck.id,
|
|
34
|
+
label: deck.label,
|
|
35
|
+
description: deck.description,
|
|
36
|
+
path: deck.path,
|
|
37
|
+
maxTurns: deck.maxTurns,
|
|
38
|
+
inputSchema: deck.inputSchema,
|
|
39
|
+
defaults: deck.defaults,
|
|
40
|
+
inputSchemaError: deck.inputSchemaError,
|
|
41
|
+
}));
|
|
42
|
+
deps.logWorkspaceRefreshDebug("graphql.scenarioDecks.list.return", {
|
|
43
|
+
workspaceId,
|
|
44
|
+
returnedDeckCount: result.length,
|
|
45
|
+
returnedDeckPaths: result.slice(0, 12).map((deck) => deck.path),
|
|
46
|
+
});
|
|
47
|
+
return result;
|
|
48
|
+
},
|
|
49
|
+
readWorkspaceAssistantDeck: async (workspaceId) => {
|
|
50
|
+
await deps.activateWorkspaceDeck(workspaceId, {
|
|
51
|
+
source: "graphql:readWorkspaceAssistantDeck",
|
|
52
|
+
});
|
|
53
|
+
return deps.readWorkspaceDeckStateStrict(workspaceId).assistantDeck;
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
exports.createWorkspaceDeckGraphqlOperations = createWorkspaceDeckGraphqlOperations;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { LoadedDeck, SavedState } from "@bolt-foundry/gambit-core";
|
|
2
|
+
import type { WorkspaceDeckState } from "./server_types.js";
|
|
3
|
+
export type WorkspaceRecord = {
|
|
4
|
+
id: string;
|
|
5
|
+
rootDir: string;
|
|
6
|
+
rootDeckPath: string;
|
|
7
|
+
createdAt: string;
|
|
8
|
+
};
|
|
9
|
+
type WorkspaceRuntimeDeps = {
|
|
10
|
+
verbose: boolean;
|
|
11
|
+
logger: {
|
|
12
|
+
info?: (...args: Array<unknown>) => void;
|
|
13
|
+
warn: (...args: Array<unknown>) => void;
|
|
14
|
+
};
|
|
15
|
+
randomId: (prefix: string) => string;
|
|
16
|
+
resolveDeckPath: (deckPath: string) => string;
|
|
17
|
+
readSessionState: (workspaceId: string) => SavedState | undefined;
|
|
18
|
+
readWorkspaceDeckState: (workspaceId: string) => WorkspaceDeckState | null;
|
|
19
|
+
writeWorkspaceDeckState: (state: WorkspaceDeckState) => Promise<WorkspaceDeckState>;
|
|
20
|
+
buildWorkspaceDeckStateFromLoadedDeck: (args: {
|
|
21
|
+
workspaceId: string;
|
|
22
|
+
deck: LoadedDeck;
|
|
23
|
+
}) => Promise<WorkspaceDeckState>;
|
|
24
|
+
reloadPrimaryDeck: () => void;
|
|
25
|
+
getDeckLoadPromise: () => Promise<LoadedDeck | null>;
|
|
26
|
+
getResolvedDeckPath: () => string;
|
|
27
|
+
setResolvedDeckPath: (deckPath: string) => void;
|
|
28
|
+
clearDefaultBuildBotRoot: () => void;
|
|
29
|
+
logWorkspaceRefreshDebug: (event: string, payload: Record<string, unknown>) => void;
|
|
30
|
+
extractMissingReadfilePath: (message: string) => string | null;
|
|
31
|
+
emitWorkspaceGraphRefresh: (args: {
|
|
32
|
+
workspaceId: string;
|
|
33
|
+
reason: "fs-change";
|
|
34
|
+
paths: Array<string>;
|
|
35
|
+
kinds: Array<string>;
|
|
36
|
+
}) => void;
|
|
37
|
+
};
|
|
38
|
+
export declare const createWorkspaceRuntime: (deps: WorkspaceRuntimeDeps) => {
|
|
39
|
+
activateWorkspaceDeck: (workspaceId?: string | null, options?: {
|
|
40
|
+
forceReload?: boolean;
|
|
41
|
+
source?: string;
|
|
42
|
+
reloadAttemptId?: string;
|
|
43
|
+
}) => Promise<void>;
|
|
44
|
+
registerWorkspace: (record: WorkspaceRecord) => WorkspaceRecord;
|
|
45
|
+
removeWorkspace: (workspaceId: string) => void;
|
|
46
|
+
resolveWorkspaceRecord: (workspaceId?: string | null) => WorkspaceRecord | null;
|
|
47
|
+
stopAllWorkspaceFsWatchers: () => void;
|
|
48
|
+
summarizeWorkspaceDeckState: (workspaceId?: string | null) => {
|
|
49
|
+
scenarioDeckCount: number;
|
|
50
|
+
scenarioDeckPaths: string[];
|
|
51
|
+
graderDeckCount: number;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=server_workspace_runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server_workspace_runtime.d.ts","sourceRoot":"","sources":["../../src/src/server_workspace_runtime.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAExE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAUF,KAAK,oBAAoB,GAAG;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE;QACN,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;QACzC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;KACzC,CAAC;IACF,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACrC,eAAe,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9C,gBAAgB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,UAAU,GAAG,SAAS,CAAC;IAClE,sBAAsB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,kBAAkB,GAAG,IAAI,CAAC;IAC3E,uBAAuB,EAAE,CACvB,KAAK,EAAE,kBAAkB,KACtB,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACjC,qCAAqC,EAAE,CAAC,IAAI,EAAE;QAC5C,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,UAAU,CAAC;KAClB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAClC,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,kBAAkB,EAAE,MAAM,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IACrD,mBAAmB,EAAE,MAAM,MAAM,CAAC;IAClC,mBAAmB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,wBAAwB,EAAE,MAAM,IAAI,CAAC;IACrC,wBAAwB,EAAE,CACxB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC7B,IAAI,CAAC;IACV,0BAA0B,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IAC/D,yBAAyB,EAAE,CAAC,IAAI,EAAE;QAChC,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,WAAW,CAAC;QACpB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACrB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;KACtB,KAAK,IAAI,CAAC;CACZ,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,MAAM,oBAAoB;0CAyS/C,MAAM,GAAG,IAAI,YACjB;QACR,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B;gCAjDgC,eAAe,KAAG,eAAe;mCAsH9B,MAAM;2CA/G5B,MAAM,GAAG,IAAI,KAC1B,eAAe,GAAG,IAAI;;gDArO0B,MAAM,GAAG,IAAI;;;;;CAsWjE,CAAC"}
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.createWorkspaceRuntime = void 0;
|
|
37
|
+
const dntShim = __importStar(require("../_dnt.shims.js"));
|
|
38
|
+
const path = __importStar(require("../deps/jsr.io/@std/path/1.1.4/mod.js"));
|
|
39
|
+
const server_workspace_decks_js_1 = require("./server_workspace_decks.js");
|
|
40
|
+
const createWorkspaceRuntime = (deps) => {
|
|
41
|
+
const workspaceById = new Map();
|
|
42
|
+
const workspaceFsWatchers = new Map();
|
|
43
|
+
const normalizeWorkspaceFsPath = (value) => value.split(/\\|\//g).filter(Boolean).join("/");
|
|
44
|
+
const isInternalWorkspacePath = (value) => {
|
|
45
|
+
const normalized = normalizeWorkspaceFsPath(value);
|
|
46
|
+
return normalized === ".gambit" || normalized.startsWith(".gambit/");
|
|
47
|
+
};
|
|
48
|
+
const isWorkspaceGraphRelevantPath = (value) => {
|
|
49
|
+
const normalized = normalizeWorkspaceFsPath(value);
|
|
50
|
+
if (normalized.length === 0)
|
|
51
|
+
return false;
|
|
52
|
+
if (isInternalWorkspacePath(normalized))
|
|
53
|
+
return false;
|
|
54
|
+
return true;
|
|
55
|
+
};
|
|
56
|
+
const toWorkspaceRelativePath = (rootDir, absoluteOrRelativePath) => {
|
|
57
|
+
const resolvedRoot = path.resolve(rootDir);
|
|
58
|
+
const resolvedCandidate = path.resolve(absoluteOrRelativePath);
|
|
59
|
+
const relative = normalizeWorkspaceFsPath(path.relative(resolvedRoot, resolvedCandidate));
|
|
60
|
+
if (!relative || relative.startsWith(".."))
|
|
61
|
+
return null;
|
|
62
|
+
return relative;
|
|
63
|
+
};
|
|
64
|
+
const summarizeWorkspaceDeckState = (workspaceId) => (0, server_workspace_decks_js_1.summarizeDeckState)(workspaceId ? deps.readWorkspaceDeckState(workspaceId) : null);
|
|
65
|
+
const buildDeckSourcePaths = (deckState) => {
|
|
66
|
+
const candidates = [
|
|
67
|
+
deckState.rootDeckPath,
|
|
68
|
+
deckState.assistantDeck.deck,
|
|
69
|
+
...deckState.scenarioDecks.map((deck) => deck.path),
|
|
70
|
+
...deckState.graderDecks.map((deck) => deck.path),
|
|
71
|
+
];
|
|
72
|
+
const resolved = new Set();
|
|
73
|
+
for (const candidate of candidates) {
|
|
74
|
+
const trimmed = candidate.trim();
|
|
75
|
+
if (!trimmed)
|
|
76
|
+
continue;
|
|
77
|
+
resolved.add(path.resolve(trimmed));
|
|
78
|
+
}
|
|
79
|
+
return [...resolved];
|
|
80
|
+
};
|
|
81
|
+
const isWorkspaceDeckStateStale = async (args) => {
|
|
82
|
+
const expectedRootDeckPath = path.resolve(args.nextPath);
|
|
83
|
+
const persistedRootDeckPath = path.resolve(args.deckState.rootDeckPath);
|
|
84
|
+
if (persistedRootDeckPath !== expectedRootDeckPath) {
|
|
85
|
+
return { stale: true, reason: "root-deck-path-changed" };
|
|
86
|
+
}
|
|
87
|
+
const updatedAtMs = Date.parse(args.deckState.updatedAt);
|
|
88
|
+
if (!Number.isFinite(updatedAtMs)) {
|
|
89
|
+
return { stale: true, reason: "invalid-updated-at" };
|
|
90
|
+
}
|
|
91
|
+
for (const sourcePath of buildDeckSourcePaths(args.deckState)) {
|
|
92
|
+
try {
|
|
93
|
+
const info = await dntShim.Deno.stat(sourcePath);
|
|
94
|
+
if (!info.isFile) {
|
|
95
|
+
return { stale: true, reason: "deck-source-not-file" };
|
|
96
|
+
}
|
|
97
|
+
const mtimeMs = info.mtime?.getTime();
|
|
98
|
+
if (typeof mtimeMs === "number" && mtimeMs > updatedAtMs) {
|
|
99
|
+
return { stale: true, reason: "deck-source-newer-than-state" };
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
if (error instanceof dntShim.Deno.errors.NotFound) {
|
|
104
|
+
return { stale: true, reason: "deck-source-missing" };
|
|
105
|
+
}
|
|
106
|
+
return { stale: true, reason: "deck-source-stat-failed" };
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return { stale: false, reason: null };
|
|
110
|
+
};
|
|
111
|
+
const flushWorkspaceFsWatcher = (workspaceId) => {
|
|
112
|
+
const watcher = workspaceFsWatchers.get(workspaceId);
|
|
113
|
+
if (!watcher || watcher.pendingPaths.size === 0)
|
|
114
|
+
return;
|
|
115
|
+
const changedPaths = [...watcher.pendingPaths].sort();
|
|
116
|
+
const kinds = [...watcher.pendingKinds].sort();
|
|
117
|
+
deps.logWorkspaceRefreshDebug("fs.flush", {
|
|
118
|
+
workspaceId,
|
|
119
|
+
kinds,
|
|
120
|
+
paths: changedPaths,
|
|
121
|
+
pathCount: changedPaths.length,
|
|
122
|
+
});
|
|
123
|
+
watcher.pendingPaths.clear();
|
|
124
|
+
watcher.pendingKinds.clear();
|
|
125
|
+
watcher.debounceTimer = null;
|
|
126
|
+
if (deps.verbose) {
|
|
127
|
+
deps.logger.info?.(`[sim] workspace fs change detected workspaceId=${workspaceId} kinds=${kinds.join(",")} paths=${changedPaths.join(",")}`);
|
|
128
|
+
}
|
|
129
|
+
const reloadAttemptId = deps.randomId("wsrefresh");
|
|
130
|
+
deps.logWorkspaceRefreshDebug("fs.reload.start", {
|
|
131
|
+
workspaceId,
|
|
132
|
+
reloadAttemptId,
|
|
133
|
+
changedPaths,
|
|
134
|
+
kinds,
|
|
135
|
+
resolvedDeckPath: deps.getResolvedDeckPath(),
|
|
136
|
+
...summarizeWorkspaceDeckState(workspaceId),
|
|
137
|
+
});
|
|
138
|
+
void activateWorkspaceDeck(workspaceId, {
|
|
139
|
+
forceReload: true,
|
|
140
|
+
source: "fs-watcher",
|
|
141
|
+
reloadAttemptId,
|
|
142
|
+
})
|
|
143
|
+
.then(() => {
|
|
144
|
+
deps.logWorkspaceRefreshDebug("fs.reload.success", {
|
|
145
|
+
workspaceId,
|
|
146
|
+
reloadAttemptId,
|
|
147
|
+
changedPaths,
|
|
148
|
+
kinds,
|
|
149
|
+
resolvedDeckPath: deps.getResolvedDeckPath(),
|
|
150
|
+
...summarizeWorkspaceDeckState(workspaceId),
|
|
151
|
+
});
|
|
152
|
+
deps.emitWorkspaceGraphRefresh({
|
|
153
|
+
workspaceId,
|
|
154
|
+
reason: "fs-change",
|
|
155
|
+
paths: changedPaths,
|
|
156
|
+
kinds,
|
|
157
|
+
});
|
|
158
|
+
deps.logWorkspaceRefreshDebug("fs.graphRefresh.emit", {
|
|
159
|
+
workspaceId,
|
|
160
|
+
reloadAttemptId,
|
|
161
|
+
reason: "fs-change",
|
|
162
|
+
pathCount: changedPaths.length,
|
|
163
|
+
kindCount: kinds.length,
|
|
164
|
+
});
|
|
165
|
+
})
|
|
166
|
+
.catch((error) => {
|
|
167
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
168
|
+
deps.logWorkspaceRefreshDebug("fs.reload.fail", {
|
|
169
|
+
workspaceId,
|
|
170
|
+
reloadAttemptId,
|
|
171
|
+
resolvedDeckPath: deps.getResolvedDeckPath(),
|
|
172
|
+
error: message,
|
|
173
|
+
missingPath: deps.extractMissingReadfilePath(message),
|
|
174
|
+
...summarizeWorkspaceDeckState(workspaceId),
|
|
175
|
+
});
|
|
176
|
+
deps.logger.warn(`[sim] workspace deck reload failed after fs change workspaceId=${workspaceId} error=${message}`);
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
const stopWorkspaceFsWatcher = (workspaceId) => {
|
|
180
|
+
const watcher = workspaceFsWatchers.get(workspaceId);
|
|
181
|
+
if (!watcher)
|
|
182
|
+
return;
|
|
183
|
+
deps.logWorkspaceRefreshDebug("fs.stop", { workspaceId });
|
|
184
|
+
if (watcher.debounceTimer !== null) {
|
|
185
|
+
clearTimeout(watcher.debounceTimer);
|
|
186
|
+
watcher.debounceTimer = null;
|
|
187
|
+
}
|
|
188
|
+
watcher.abortController.abort();
|
|
189
|
+
workspaceFsWatchers.delete(workspaceId);
|
|
190
|
+
};
|
|
191
|
+
const startWorkspaceFsWatcher = (record) => {
|
|
192
|
+
if (workspaceFsWatchers.has(record.id))
|
|
193
|
+
return;
|
|
194
|
+
deps.logWorkspaceRefreshDebug("fs.start", {
|
|
195
|
+
workspaceId: record.id,
|
|
196
|
+
rootDir: record.rootDir,
|
|
197
|
+
});
|
|
198
|
+
const abortController = new AbortController();
|
|
199
|
+
const pendingPaths = new Set();
|
|
200
|
+
const pendingKinds = new Set();
|
|
201
|
+
let debounceTimer = null;
|
|
202
|
+
const watcher = dntShim.Deno.watchFs(record.rootDir, { recursive: true });
|
|
203
|
+
abortController.signal.addEventListener("abort", () => {
|
|
204
|
+
try {
|
|
205
|
+
watcher.close();
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
// ignore close errors while shutting down
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
const task = (async () => {
|
|
212
|
+
try {
|
|
213
|
+
for await (const event of watcher) {
|
|
214
|
+
if (abortController.signal.aborted)
|
|
215
|
+
break;
|
|
216
|
+
const kind = typeof event.kind === "string" ? event.kind : "unknown";
|
|
217
|
+
let sawRelevantPath = false;
|
|
218
|
+
for (const candidatePath of event.paths) {
|
|
219
|
+
const relativePath = toWorkspaceRelativePath(record.rootDir, candidatePath);
|
|
220
|
+
if (!relativePath || !isWorkspaceGraphRelevantPath(relativePath)) {
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
pendingPaths.add(relativePath);
|
|
224
|
+
sawRelevantPath = true;
|
|
225
|
+
}
|
|
226
|
+
if (!sawRelevantPath)
|
|
227
|
+
continue;
|
|
228
|
+
pendingKinds.add(kind);
|
|
229
|
+
if (debounceTimer !== null)
|
|
230
|
+
continue;
|
|
231
|
+
debounceTimer = setTimeout(() => {
|
|
232
|
+
const existing = workspaceFsWatchers.get(record.id);
|
|
233
|
+
if (!existing)
|
|
234
|
+
return;
|
|
235
|
+
existing.debounceTimer = null;
|
|
236
|
+
flushWorkspaceFsWatcher(record.id);
|
|
237
|
+
}, 120);
|
|
238
|
+
const existing = workspaceFsWatchers.get(record.id);
|
|
239
|
+
if (existing) {
|
|
240
|
+
existing.debounceTimer = debounceTimer;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
if (!abortController.signal.aborted) {
|
|
246
|
+
deps.logger.warn(`[sim] workspace fs watcher stopped for ${record.id}: ${error instanceof Error ? error.message : String(error)}`);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
finally {
|
|
250
|
+
if (abortController.signal.aborted) {
|
|
251
|
+
const existing = workspaceFsWatchers.get(record.id);
|
|
252
|
+
if (existing && existing.debounceTimer !== null) {
|
|
253
|
+
clearTimeout(existing.debounceTimer);
|
|
254
|
+
existing.debounceTimer = null;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
})();
|
|
259
|
+
workspaceFsWatchers.set(record.id, {
|
|
260
|
+
abortController,
|
|
261
|
+
pendingPaths,
|
|
262
|
+
pendingKinds,
|
|
263
|
+
debounceTimer,
|
|
264
|
+
task,
|
|
265
|
+
});
|
|
266
|
+
};
|
|
267
|
+
const registerWorkspace = (record) => {
|
|
268
|
+
workspaceById.set(record.id, record);
|
|
269
|
+
startWorkspaceFsWatcher(record);
|
|
270
|
+
return record;
|
|
271
|
+
};
|
|
272
|
+
const resolveWorkspaceRecord = (workspaceId) => {
|
|
273
|
+
if (!workspaceId)
|
|
274
|
+
return null;
|
|
275
|
+
const cached = workspaceById.get(workspaceId);
|
|
276
|
+
if (cached)
|
|
277
|
+
return cached;
|
|
278
|
+
const state = deps.readSessionState(workspaceId);
|
|
279
|
+
const meta = state?.meta ?? {};
|
|
280
|
+
const deckPath = typeof meta
|
|
281
|
+
.workspaceRootDeckPath === "string"
|
|
282
|
+
? meta.workspaceRootDeckPath
|
|
283
|
+
: typeof meta.deck === "string"
|
|
284
|
+
? meta.deck
|
|
285
|
+
: undefined;
|
|
286
|
+
const rootDir = typeof meta.workspaceRootDir ===
|
|
287
|
+
"string"
|
|
288
|
+
? meta.workspaceRootDir
|
|
289
|
+
: deckPath
|
|
290
|
+
? path.dirname(deckPath)
|
|
291
|
+
: undefined;
|
|
292
|
+
if (!deckPath || !rootDir)
|
|
293
|
+
return null;
|
|
294
|
+
const createdAt = typeof meta.workspaceCreatedAt ===
|
|
295
|
+
"string"
|
|
296
|
+
? meta.workspaceCreatedAt
|
|
297
|
+
: typeof meta.sessionCreatedAt === "string"
|
|
298
|
+
? meta.sessionCreatedAt
|
|
299
|
+
: new Date().toISOString();
|
|
300
|
+
return registerWorkspace({
|
|
301
|
+
id: workspaceId,
|
|
302
|
+
rootDir,
|
|
303
|
+
rootDeckPath: deckPath,
|
|
304
|
+
createdAt,
|
|
305
|
+
});
|
|
306
|
+
};
|
|
307
|
+
const activateWorkspaceDeck = async (workspaceId, options) => {
|
|
308
|
+
if (!workspaceId)
|
|
309
|
+
return;
|
|
310
|
+
const record = resolveWorkspaceRecord(workspaceId);
|
|
311
|
+
if (!record)
|
|
312
|
+
return;
|
|
313
|
+
const existingDeckState = deps.readWorkspaceDeckState(workspaceId);
|
|
314
|
+
const source = options?.source ?? "unspecified";
|
|
315
|
+
const reloadAttemptId = options?.reloadAttemptId ?? null;
|
|
316
|
+
const nextPath = deps.resolveDeckPath(record.rootDeckPath);
|
|
317
|
+
const resolvedDeckPath = deps.getResolvedDeckPath();
|
|
318
|
+
const shouldSwitch = nextPath !== resolvedDeckPath;
|
|
319
|
+
deps.logWorkspaceRefreshDebug("deck.activate.begin", {
|
|
320
|
+
workspaceId,
|
|
321
|
+
source,
|
|
322
|
+
reloadAttemptId,
|
|
323
|
+
forceReload: Boolean(options?.forceReload),
|
|
324
|
+
nextPath,
|
|
325
|
+
resolvedDeckPath,
|
|
326
|
+
...(0, server_workspace_decks_js_1.summarizeDeckState)(existingDeckState),
|
|
327
|
+
});
|
|
328
|
+
if (shouldSwitch) {
|
|
329
|
+
deps.setResolvedDeckPath(nextPath);
|
|
330
|
+
deps.clearDefaultBuildBotRoot();
|
|
331
|
+
}
|
|
332
|
+
else if (!options?.forceReload && existingDeckState) {
|
|
333
|
+
const freshness = await isWorkspaceDeckStateStale({
|
|
334
|
+
deckState: existingDeckState,
|
|
335
|
+
nextPath,
|
|
336
|
+
});
|
|
337
|
+
if (!freshness.stale) {
|
|
338
|
+
deps.logWorkspaceRefreshDebug("deck.activate.skip", {
|
|
339
|
+
workspaceId,
|
|
340
|
+
source,
|
|
341
|
+
reloadAttemptId,
|
|
342
|
+
reason: "already-active-and-fresh",
|
|
343
|
+
resolvedDeckPath,
|
|
344
|
+
...(0, server_workspace_decks_js_1.summarizeDeckState)(existingDeckState),
|
|
345
|
+
});
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
deps.logWorkspaceRefreshDebug("deck.activate.reload", {
|
|
349
|
+
workspaceId,
|
|
350
|
+
source,
|
|
351
|
+
reloadAttemptId,
|
|
352
|
+
reason: freshness.reason ?? "deck-state-stale",
|
|
353
|
+
resolvedDeckPath,
|
|
354
|
+
...(0, server_workspace_decks_js_1.summarizeDeckState)(existingDeckState),
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
deps.reloadPrimaryDeck();
|
|
358
|
+
const loadedDeck = await deps.getDeckLoadPromise().catch(() => null);
|
|
359
|
+
let nextDeckState = existingDeckState;
|
|
360
|
+
if (loadedDeck) {
|
|
361
|
+
nextDeckState = await deps.buildWorkspaceDeckStateFromLoadedDeck({
|
|
362
|
+
workspaceId,
|
|
363
|
+
deck: loadedDeck,
|
|
364
|
+
});
|
|
365
|
+
await deps.writeWorkspaceDeckState(nextDeckState);
|
|
366
|
+
}
|
|
367
|
+
deps.logWorkspaceRefreshDebug("deck.activate.done", {
|
|
368
|
+
workspaceId,
|
|
369
|
+
source,
|
|
370
|
+
reloadAttemptId,
|
|
371
|
+
loaded: Boolean(loadedDeck),
|
|
372
|
+
loadedDeckPath: loadedDeck?.path ?? null,
|
|
373
|
+
resolvedDeckPath: deps.getResolvedDeckPath(),
|
|
374
|
+
...(0, server_workspace_decks_js_1.summarizeDeckState)(nextDeckState),
|
|
375
|
+
});
|
|
376
|
+
};
|
|
377
|
+
const removeWorkspace = (workspaceId) => {
|
|
378
|
+
stopWorkspaceFsWatcher(workspaceId);
|
|
379
|
+
workspaceById.delete(workspaceId);
|
|
380
|
+
};
|
|
381
|
+
const stopAllWorkspaceFsWatchers = () => {
|
|
382
|
+
for (const workspaceId of workspaceFsWatchers.keys()) {
|
|
383
|
+
stopWorkspaceFsWatcher(workspaceId);
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
return {
|
|
387
|
+
activateWorkspaceDeck,
|
|
388
|
+
registerWorkspace,
|
|
389
|
+
removeWorkspace,
|
|
390
|
+
resolveWorkspaceRecord,
|
|
391
|
+
stopAllWorkspaceFsWatchers,
|
|
392
|
+
summarizeWorkspaceDeckState,
|
|
393
|
+
};
|
|
394
|
+
};
|
|
395
|
+
exports.createWorkspaceRuntime = createWorkspaceRuntime;
|