@morscherlab/mint-sdk 1.4.0-beta.9 → 1.4.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 (198) hide show
  1. package/README.md +14 -3
  2. package/dist/{AlertBox-B2Bgr3ei.js → AlertBox-DwgNTEqf.js} +3 -3
  3. package/dist/{AlertBox-B2Bgr3ei.js.map → AlertBox-DwgNTEqf.js.map} +1 -1
  4. package/dist/{AppSidebar-Dq9W1jE2.js → AppSidebar-CZZaxni0.js} +1103 -144
  5. package/dist/AppSidebar-CZZaxni0.js.map +1 -0
  6. package/dist/{ConfirmDialog-nbJj51is.js → ConfirmDialog-CjWoxAD1.js} +2 -2
  7. package/dist/{ConfirmDialog-nbJj51is.js.map → ConfirmDialog-CjWoxAD1.js.map} +1 -1
  8. package/dist/{ExperimentPopover-5T1fAq2L.js → ExperimentPopover-DujiuQIO.js} +5 -5
  9. package/dist/{ExperimentPopover-5T1fAq2L.js.map → ExperimentPopover-DujiuQIO.js.map} +1 -1
  10. package/dist/{ExperimentSelectorModal-65peG4Up.js → ExperimentSelectorModal-B4j4eUOJ.js} +114 -98
  11. package/dist/ExperimentSelectorModal-B4j4eUOJ.js.map +1 -0
  12. package/dist/{SegmentedControl-BtnnjWzs.js → SegmentedControl-DyUPH3I5.js} +2 -2
  13. package/dist/{SegmentedControl-BtnnjWzs.js.map → SegmentedControl-DyUPH3I5.js.map} +1 -1
  14. package/dist/{SettingsModal-483nyI6b.js → SettingsModal-D2MOOtuO.js} +26 -25
  15. package/dist/SettingsModal-D2MOOtuO.js.map +1 -0
  16. package/dist/__stories__/experiment-helpers.d.ts +10 -0
  17. package/dist/__tests__/components/AppTopBarOnboarding.test.d.ts +1 -0
  18. package/dist/__tests__/components/FloatingPanelsInModal.test.d.ts +1 -0
  19. package/dist/__tests__/composables/useFloatingPanel.test.d.ts +1 -0
  20. package/dist/__tests__/composables/useOnboarding.test.d.ts +1 -0
  21. package/dist/__tests__/styles/paletteTokens.test.d.ts +1 -0
  22. package/dist/__tests__/styles/v2AuditRules.test.d.ts +1 -0
  23. package/dist/components/AppTopBar.vue.d.ts +20 -5
  24. package/dist/components/BaseButton.vue.d.ts +4 -2
  25. package/dist/components/ExperimentSelectorModal.vue.d.ts +15 -1
  26. package/dist/components/JobsStatusTray.vue.d.ts +15 -4
  27. package/dist/components/PluginWorkspaceView.props.d.ts +3 -0
  28. package/dist/components/PluginWorkspaceView.vue.d.ts +3 -0
  29. package/dist/components/SmartGroupFieldRecipe.vue.d.ts +3 -3
  30. package/dist/components/internal/AppTopBarOnboardingInternal.vue.d.ts +7 -0
  31. package/dist/components/internal/AppTopBarPageSelectorInternal.vue.d.ts +2 -1
  32. package/dist/components/internal/AutoGroupModalInternal.vue.d.ts +2 -2
  33. package/dist/components/internal/OnboardingLayerInternal.vue.d.ts +7 -0
  34. package/dist/components/internal/WorkspaceShellInternal.vue.d.ts +8 -0
  35. package/dist/composables/pluginWorkspaceModel.d.ts +2 -2
  36. package/dist/composables/useFileImport.d.ts +7 -0
  37. package/dist/composables/useFloatingPanel.d.ts +29 -0
  38. package/dist/composables/useJobCenter.d.ts +41 -3
  39. package/dist/composables/useOnboarding.d.ts +119 -0
  40. package/dist/{controlSchemaModel-B8CTXagP.js → controlSchemaModel-Bsg0t5Ab.js} +2 -2
  41. package/dist/{controlSchemaModel-B8CTXagP.js.map → controlSchemaModel-Bsg0t5Ab.js.map} +1 -1
  42. package/dist/{data-CgILxDLW.js → data-Boeh4uPI.js} +13 -12
  43. package/dist/{data-CgILxDLW.js.map → data-Boeh4uPI.js.map} +1 -1
  44. package/dist/data.d.ts +1 -1
  45. package/dist/data.js +9 -9
  46. package/dist/{experiment-43OJtH7R.js → experiment-DyO54FQB.js} +25 -61
  47. package/dist/experiment-DyO54FQB.js.map +1 -0
  48. package/dist/{experimentStatus-Cqp6qNrR.js → experimentStatus-DCn2QKG7.js} +2 -2
  49. package/dist/{experimentStatus-Cqp6qNrR.js.map → experimentStatus-DCn2QKG7.js.map} +1 -1
  50. package/dist/index.js +20 -20
  51. package/dist/{install-BtLWTk6H.js → install-BEHp7Mo-.js} +15 -15
  52. package/dist/{install-BtLWTk6H.js.map → install-BEHp7Mo-.js.map} +1 -1
  53. package/dist/install.js +1 -1
  54. package/dist/{lab-MHzp-_J8.js → lab-D61eaX6f.js} +68 -61
  55. package/dist/{lab-MHzp-_J8.js.map → lab-D61eaX6f.js.map} +1 -1
  56. package/dist/lab.js +4 -4
  57. package/dist/{records-B6gpM_3e.js → records-D4aQXyZu.js} +193 -133
  58. package/dist/records-D4aQXyZu.js.map +1 -0
  59. package/dist/{runtime-7vfl_bI3.js → runtime-q-R0CNLh.js} +400 -33
  60. package/dist/runtime-q-R0CNLh.js.map +1 -0
  61. package/dist/runtime.d.ts +1 -1
  62. package/dist/runtime.js +7 -7
  63. package/dist/{shell-Cs9OJMnm.js → shell-6CGFvUUw.js} +10 -5
  64. package/dist/{shell-Cs9OJMnm.js.map → shell-6CGFvUUw.js.map} +1 -1
  65. package/dist/shell.d.ts +1 -0
  66. package/dist/shell.js +6 -6
  67. package/dist/stores/index.d.ts +1 -1
  68. package/dist/stores/index.js +2 -2
  69. package/dist/stores/settings.d.ts +4 -12
  70. package/dist/styles.css +1191 -479
  71. package/dist/types/components.d.ts +2 -0
  72. package/dist/types/index.d.ts +1 -1
  73. package/dist/types/jobs.d.ts +9 -0
  74. package/dist/types/platform.d.ts +1 -1
  75. package/dist/{useDropdownState-8yWMu-7_.js → useDropdownState-uFIz6Yv8.js} +16 -4
  76. package/dist/useDropdownState-uFIz6Yv8.js.map +1 -0
  77. package/dist/{useExperimentSamples-DHnxKFAF.js → useExperimentSamples-QEFoq4tf.js} +48 -6
  78. package/dist/useExperimentSamples-QEFoq4tf.js.map +1 -0
  79. package/dist/{useListReorder-BitdUhxn.js → useListReorder-DsuzwWGS.js} +122 -172
  80. package/dist/useListReorder-DsuzwWGS.js.map +1 -0
  81. package/dist/{useRackEditor-DiwCt77M.js → useRackEditor-KpZ4iJ6o.js} +22 -32
  82. package/dist/useRackEditor-KpZ4iJ6o.js.map +1 -0
  83. package/dist/useRealtime-B58Lo-Tm.js +508 -0
  84. package/dist/useRealtime-B58Lo-Tm.js.map +1 -0
  85. package/dist/{useRequest-D506eHi8.js → useRequest-BuDmW8Jc.js} +8 -37
  86. package/dist/useRequest-BuDmW8Jc.js.map +1 -0
  87. package/package.json +3 -2
  88. package/src/__stories__/experiment-helpers.ts +3 -3
  89. package/src/__tests__/components/ActionMenu.test.ts +2 -2
  90. package/src/__tests__/components/AppTopBar.test.ts +206 -1
  91. package/src/__tests__/components/AppTopBarOnboarding.test.ts +160 -0
  92. package/src/__tests__/components/AppTopBarPageSelector.test.ts +125 -9
  93. package/src/__tests__/components/BaseButton.test.ts +19 -0
  94. package/src/__tests__/components/BaseModal.test.ts +13 -0
  95. package/src/__tests__/components/ExperimentSelectorModal.test.ts +34 -1
  96. package/src/__tests__/components/FloatingPanelsInModal.test.ts +94 -0
  97. package/src/__tests__/components/GeneratedPluginView.test.ts +1 -1
  98. package/src/__tests__/components/JobsStatusTray.test.ts +373 -71
  99. package/src/__tests__/components/PluginWorkspaceView.test.ts +63 -1
  100. package/src/__tests__/components/SampleSelector.test.ts +20 -0
  101. package/src/__tests__/components/SettingsModal.test.ts +9 -2
  102. package/src/__tests__/composables/useFileImport.test.ts +36 -0
  103. package/src/__tests__/composables/useFloatingPanel.test.ts +68 -0
  104. package/src/__tests__/composables/useJobCenter.test.ts +262 -3
  105. package/src/__tests__/composables/useOnboarding.test.ts +317 -0
  106. package/src/__tests__/docs/frontendDocsCatalog.test.ts +4 -3
  107. package/src/__tests__/fixtures/table-import/cells.xlsx +0 -0
  108. package/src/__tests__/fixtures/table-import/samples.xlsx +0 -0
  109. package/src/__tests__/stores/settings.test.ts +21 -21
  110. package/src/__tests__/styles/cssTokens.test.ts +4 -1
  111. package/src/__tests__/styles/menusShellRefresh.test.ts +8 -2
  112. package/src/__tests__/styles/paletteTokens.test.ts +44 -0
  113. package/src/__tests__/styles/v2AuditRules.test.ts +104 -0
  114. package/src/components/ActionMenu.vue +6 -37
  115. package/src/components/AppTopBar.onboarding.story.vue +69 -0
  116. package/src/components/AppTopBar.story.vue +59 -4
  117. package/src/components/AppTopBar.vue +132 -10
  118. package/src/components/BaseButton.vue +16 -2
  119. package/src/components/BaseModal.vue +2 -1
  120. package/src/components/ExperimentSelectorModal.story.vue +38 -0
  121. package/src/components/ExperimentSelectorModal.vue +20 -1
  122. package/src/components/GeneratedPluginView.vue +4 -9
  123. package/src/components/GeneratedResultRenderer.vue +3 -4
  124. package/src/components/JobsStatusTray.story.vue +97 -43
  125. package/src/components/JobsStatusTray.vue +287 -290
  126. package/src/components/LayoutResizeHandle.story.vue +65 -4
  127. package/src/components/PluginWorkspaceView.props.ts +3 -0
  128. package/src/components/PluginWorkspaceView.vue +17 -0
  129. package/src/components/SampleSelector.story.vue +21 -6
  130. package/src/components/SampleSelector.vue +10 -3
  131. package/src/components/SectionCard.story.vue +33 -0
  132. package/src/components/SettingsModal.vue +7 -12
  133. package/src/components/Tooltip.vue +9 -32
  134. package/src/components/internal/AppTopBarOnboardingInternal.vue +172 -0
  135. package/src/components/internal/AppTopBarPageSelectorInternal.vue +140 -72
  136. package/src/components/internal/DatePickerDateInternal.vue +7 -45
  137. package/src/components/internal/DatePickerDateTimeInternal.vue +7 -1
  138. package/src/components/internal/DatePickerTimeInternal.vue +8 -1
  139. package/src/components/internal/NumberUnitInputInternal.vue +4 -18
  140. package/src/components/internal/OnboardingLayerInternal.vue +173 -0
  141. package/src/components/internal/SelectMultipleInternal.vue +6 -1
  142. package/src/components/internal/SelectSearchableInternal.vue +6 -1
  143. package/src/components/internal/WellEditPopupInternal.vue +11 -22
  144. package/src/components/internal/WorkspaceShellInternal.vue +12 -0
  145. package/src/composables/pluginWorkspaceModel.ts +2 -2
  146. package/src/composables/useFileImport.ts +51 -1
  147. package/src/composables/useFloatingPanel.ts +107 -0
  148. package/src/composables/useJobCenter.ts +188 -6
  149. package/src/composables/useOnboarding.ts +465 -0
  150. package/src/composables/usePluginWorkspace.ts +1 -1
  151. package/src/data.ts +1 -0
  152. package/src/runtime.ts +2 -1
  153. package/src/shell.ts +17 -0
  154. package/src/stores/index.ts +0 -2
  155. package/src/stores/settings.ts +20 -50
  156. package/src/styles/components/action-menu.css +1 -1
  157. package/src/styles/components/app-layout.css +6 -3
  158. package/src/styles/components/app-page-selector.css +120 -45
  159. package/src/styles/components/app-top-bar.css +165 -3
  160. package/src/styles/components/button.css +8 -0
  161. package/src/styles/components/dataframe.css +1 -1
  162. package/src/styles/components/date-picker.css +4 -2
  163. package/src/styles/components/datetime-picker.css +4 -4
  164. package/src/styles/components/experiment-selector-modal.css +13 -0
  165. package/src/styles/components/jobs-status-tray.css +134 -296
  166. package/src/styles/components/layout-resize-handle.css +59 -16
  167. package/src/styles/components/modal.css +3 -3
  168. package/src/styles/components/number-input.css +1 -1
  169. package/src/styles/components/onboarding.css +368 -0
  170. package/src/styles/components/progress-bar.css +3 -3
  171. package/src/styles/components/sample-selector.css +43 -0
  172. package/src/styles/components/searchable-select.css +3 -7
  173. package/src/styles/components/section-card.css +30 -6
  174. package/src/styles/components/settings-modal.css +7 -2
  175. package/src/styles/components/time-picker.css +3 -6
  176. package/src/styles/components/toast.css +1 -1
  177. package/src/styles/components/tooltip.css +2 -2
  178. package/src/styles/components/unit-input.css +1 -1
  179. package/src/styles/components/well-edit-popup.css +2 -2
  180. package/src/styles/index.css +1 -0
  181. package/src/styles/variables.css +153 -15
  182. package/src/types/components.ts +2 -0
  183. package/src/types/index.ts +1 -0
  184. package/src/types/jobs.ts +10 -0
  185. package/src/types/platform.ts +1 -1
  186. package/dist/AppSidebar-Dq9W1jE2.js.map +0 -1
  187. package/dist/ExperimentSelectorModal-65peG4Up.js.map +0 -1
  188. package/dist/SettingsModal-483nyI6b.js.map +0 -1
  189. package/dist/experiment-43OJtH7R.js.map +0 -1
  190. package/dist/records-B6gpM_3e.js.map +0 -1
  191. package/dist/runtime-7vfl_bI3.js.map +0 -1
  192. package/dist/useDropdownState-8yWMu-7_.js.map +0 -1
  193. package/dist/useExperimentSamples-DHnxKFAF.js.map +0 -1
  194. package/dist/useListReorder-BitdUhxn.js.map +0 -1
  195. package/dist/useRackEditor-DiwCt77M.js.map +0 -1
  196. package/dist/useRealtime-C3iy9QkU.js +0 -699
  197. package/dist/useRealtime-C3iy9QkU.js.map +0 -1
  198. package/dist/useRequest-D506eHi8.js.map +0 -1
@@ -1,13 +1,13 @@
1
- import { i as useEventListener, o as __exportAll, t as useDropdownState } from "./useDropdownState-8yWMu-7_.js";
2
- import { i as AuthenticationRequiredError, o as useApi } from "./experiment-43OJtH7R.js";
3
- import { L as EmptyState_default, c as isTerminalJobStatus, d as normalizeJobState, f as resolveJobCapabilities, l as jobStatusLabel, o as resolveCurrentPluginId, s as isActiveJobStatus, t as isRecord, u as normalizeJobPercent, v as useAppExperiment } from "./records-B6gpM_3e.js";
4
- import { A as createGeneratedAnalysisTransport, D as GeneratedPathInput_default, O as _plugin_vue_export_helper_default, R as definePluginWorkspaceView, _ as getFieldRegistryEntry, g as replaceRecord, j as useJobsEndpoint, k as GENERATED_JOBS_API_KEY, v as getTypeDefault } from "./useListReorder-BitdUhxn.js";
5
- import { r as LoadingSpinner_default, t as AlertBox_default } from "./AlertBox-B2Bgr3ei.js";
6
- import { D as DataFrame_default, T as WellPlate_default, a as GeneratedPlotlyResult_default, b as PlateEditor_default, c as downloadEndpoint, d as useEventStream, f as useSettingsEndpoint, i as GeneratedResultRenderer_default, l as pluginFormDataFromPayload, m as resolvePluginBaseUrl, n as ScheduleCalendar_default, o as createClient, p as buildEndpointUrl, t as useRackEditor, u as uploadEndpoint, v as DoseCalculator_default } from "./useRackEditor-DiwCt77M.js";
7
- import { A as getDefaultControlView, C as controlBindings, D as controlsTo, E as controlValuesToComponentProps, S as useControlSchema, T as controlValuesToComponentBindingsById, _ as AppLayout_default, b as defineControls, d as useForm, f as AppTopBar_default, l as useFormBuilder, p as providePluginIdentity, t as AppSidebar_default, u as evaluateCondition, v as usePluginWorkspace, w as controlValuesToComponentBindings, x as getControlDefaults, y as defineControlComponentBindings } from "./AppSidebar-Dq9W1jE2.js";
8
- import { n as isControlModelBinding } from "./controlSchemaModel-B8CTXagP.js";
9
- import { a as combinePluginJobSources, i as JobsStatusTray_default, n as subscribeRealtime, o as useJobCenter, r as useRealtime, t as currentPresence } from "./useRealtime-C3iy9QkU.js";
10
- import { Fragment, Teleport, TransitionGroup, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, getCurrentScope, guardReactiveProps, mergeProps, normalizeClass, normalizeProps, normalizeStyle, onMounted, onScopeDispose, openBlock, provide, reactive, readonly, ref, renderList, renderSlot, resolveDynamicComponent, toDisplayString, toHandlers, toValue, unref, useId, useSlots, useTemplateRef, watch, withCtx, withModifiers } from "vue";
1
+ import { i as useEventListener, o as __exportAll, t as useDropdownState } from "./useDropdownState-uFIz6Yv8.js";
2
+ import { i as AuthenticationRequiredError, o as useApi } from "./experiment-DyO54FQB.js";
3
+ import { L as EmptyState_default, d as isActiveJobStatus, f as isTerminalJobStatus, g as resolveJobCapabilities, h as normalizeJobState, m as normalizeJobPercent, o as resolveCurrentPluginId, p as jobStatusLabel, t as isRecord, v as useAppExperiment } from "./records-D4aQXyZu.js";
4
+ import { A as useJobsEndpoint, D as _plugin_vue_export_helper_default, E as GeneratedPathInput_default, M as usePlatform, O as GENERATED_JOBS_API_KEY, R as definePluginWorkspaceView, _ as getTypeDefault, g as getFieldRegistryEntry, h as replaceRecord, k as createGeneratedAnalysisTransport } from "./useListReorder-DsuzwWGS.js";
5
+ import { r as LoadingSpinner_default, t as AlertBox_default } from "./AlertBox-DwgNTEqf.js";
6
+ import { D as DataFrame_default, T as WellPlate_default, a as GeneratedPlotlyResult_default, b as PlateEditor_default, c as downloadEndpoint, d as useEventStream, f as useSettingsEndpoint, i as GeneratedResultRenderer_default, l as pluginFormDataFromPayload, m as resolvePluginBaseUrl, n as ScheduleCalendar_default, o as createClient, p as buildEndpointUrl, t as useRackEditor, u as uploadEndpoint, v as DoseCalculator_default } from "./useRackEditor-KpZ4iJ6o.js";
7
+ import { A as controlValuesToComponentBindingsById, C as usePluginWorkspace, D as useControlSchema, E as getControlDefaults, F as getDefaultControlView, M as controlsTo, O as controlBindings, S as AppLayout_default, T as defineControls, d as useForm, f as AppTopBar_default, j as controlValuesToComponentProps, k as controlValuesToComponentBindings, l as useFormBuilder, p as providePluginIdentity, t as AppSidebar_default, u as evaluateCondition, w as defineControlComponentBindings } from "./AppSidebar-CZZaxni0.js";
8
+ import { n as isControlModelBinding } from "./controlSchemaModel-Bsg0t5Ab.js";
9
+ import { i as JobsStatusTray_default, n as subscribeRealtime, r as useRealtime, t as currentPresence } from "./useRealtime-B58Lo-Tm.js";
10
+ import { Fragment, Teleport, TransitionGroup, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, getCurrentScope, guardReactiveProps, mergeProps, normalizeClass, normalizeProps, normalizeStyle, onMounted, onScopeDispose, onUnmounted, openBlock, provide, reactive, readonly, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toHandlers, toValue, unref, useId, useSlots, useTemplateRef, watch, withCtx, withModifiers } from "vue";
11
11
  import { ChartColumn, Eye, FlaskConical, Pencil, RefreshCw } from "lucide-vue-next";
12
12
  //#region src/composables/useToast.ts
13
13
  var toasts = ref([]);
@@ -232,6 +232,333 @@ var AppToastContainer_default = /* @__PURE__ */ defineComponent({
232
232
  }
233
233
  });
234
234
  //#endregion
235
+ //#region src/composables/useJobCenter.ts
236
+ /** How long a job that just completed stays in the top-bar run slot. */
237
+ var FINISHED_HOLD_MS = 6e3;
238
+ /**
239
+ * Combines independent job runtimes without copying their reactive state.
240
+ *
241
+ * Job ids must be globally unique across the sources. A duplicate id throws
242
+ * when jobs are read or an id-routed action is requested, rather than silently
243
+ * dispatching a mutation to the wrong owner.
244
+ */
245
+ function combinePluginJobSources(sources) {
246
+ const jobs = computed(() => {
247
+ const combined = [];
248
+ const owners = /* @__PURE__ */ new Set();
249
+ for (const source of sources) for (const job of toValue(source.jobs)) {
250
+ if (owners.has(job.job_id)) throw duplicatePluginJobId(job.job_id);
251
+ owners.add(job.job_id);
252
+ combined.push(job);
253
+ }
254
+ return combined;
255
+ });
256
+ function ownerFor(jobId) {
257
+ let owner;
258
+ for (const source of sources) {
259
+ if (!toValue(source.jobs).some((job) => job.job_id === jobId)) continue;
260
+ if (owner) throw duplicatePluginJobId(jobId);
261
+ owner = source;
262
+ }
263
+ if (!owner) throw new Error(`Unknown plugin job id: ${jobId}`);
264
+ return owner;
265
+ }
266
+ const combined = { jobs };
267
+ if (sources.some((source) => source.refresh)) combined.refresh = async () => {
268
+ await Promise.all(sources.map((source) => source.refresh?.()));
269
+ return jobs.value;
270
+ };
271
+ if (sources.some((source) => source.cancel)) combined.cancel = async (jobId) => {
272
+ const owner = ownerFor(jobId);
273
+ if (!owner.cancel) throw new Error(`Job ${jobId} cannot be cancelled by its source`);
274
+ return owner.cancel(jobId);
275
+ };
276
+ if (sources.length > 0 && sources.every((source) => source.delete)) combined.delete = async (jobId) => {
277
+ const owner = ownerFor(jobId);
278
+ if (!owner.delete) throw new Error(`Job ${jobId} cannot be deleted by its source`);
279
+ return owner.delete(jobId);
280
+ };
281
+ if (sources.length > 0 && sources.every((source) => source.clear)) combined.clear = async () => {
282
+ const results = await Promise.all(sources.map((source) => source.clear()));
283
+ return results.every((result) => typeof result === "number") ? results.reduce((total, result) => total + result, 0) : void 0;
284
+ };
285
+ if (sources.some((source) => source.dispose)) combined.dispose = () => {
286
+ const errors = [];
287
+ for (const source of sources) try {
288
+ source.dispose?.();
289
+ } catch (cause) {
290
+ errors.push(cause);
291
+ }
292
+ if (errors.length === 1) throw errors[0];
293
+ if (errors.length > 1) throw new PluginJobSourceDisposeError(errors);
294
+ };
295
+ return combined;
296
+ }
297
+ var PluginJobSourceDisposeError = class extends Error {
298
+ cause;
299
+ errors;
300
+ constructor(errors) {
301
+ super("Failed to dispose plugin job sources");
302
+ this.name = "PluginJobSourceDisposeError";
303
+ this.cause = errors[0];
304
+ this.errors = Object.freeze([...errors]);
305
+ }
306
+ };
307
+ function duplicatePluginJobId(jobId) {
308
+ return /* @__PURE__ */ new Error(`Duplicate plugin job id across combined sources: ${jobId}`);
309
+ }
310
+ /** The stored seen failures, or null when nothing is stored or storage is blocked. */
311
+ function readSeenFailed(key) {
312
+ try {
313
+ const parsed = JSON.parse(globalThis.localStorage?.getItem(key) ?? "null");
314
+ return Array.isArray(parsed) ? new Set(parsed.filter((id) => typeof id === "string")) : null;
315
+ } catch {
316
+ return null;
317
+ }
318
+ }
319
+ function writeSeenFailed(key, seen) {
320
+ try {
321
+ globalThis.localStorage?.setItem(key, JSON.stringify([...seen]));
322
+ } catch {}
323
+ }
324
+ function jobMessage(job) {
325
+ if (job.error) return job.error;
326
+ if (job.status === "awaiting_input") return job.progress.message || "Waiting for external input";
327
+ if (job.status === "queued" && job.queue_position > 0) return `Queue position ${job.queue_position}`;
328
+ return job.progress.message || job.progress.stage || jobStatusLabel(job.status);
329
+ }
330
+ function errorMessage(error, fallback) {
331
+ return error instanceof Error ? error.message : fallback;
332
+ }
333
+ /**
334
+ * Headless controller for plugin job presentation and actions.
335
+ *
336
+ * Every job list is derived directly from the source. The controller never
337
+ * mirrors source jobs into another ref.
338
+ */
339
+ function useJobCenter(options = {}) {
340
+ const isOpen = ref(false);
341
+ const isLoading = ref(false);
342
+ const error = shallowRef(null);
343
+ const pendingJobIds = ref(/* @__PURE__ */ new Set());
344
+ let requestGeneration = 0;
345
+ let active = true;
346
+ const source = computed(() => toValue(options.source));
347
+ const jobs = computed(() => {
348
+ const currentSource = source.value;
349
+ return currentSource ? [...toValue(currentSource.jobs)].map(normalizeJobState) : [];
350
+ });
351
+ const activeJobs = computed(() => jobs.value.filter((job) => isActiveJobStatus(job.status)));
352
+ const historyJobs = computed(() => jobs.value.filter((job) => !isActiveJobStatus(job.status)));
353
+ const deletableJobs = computed(() => historyJobs.value.filter((job) => job.can_delete));
354
+ const featuredJob = computed(() => activeJobs.value[0] ?? historyJobs.value[0] ?? null);
355
+ const completedCount = computed(() => jobs.value.filter((job) => job.status === "completed").length);
356
+ const { integrated, user, plugin, isAdmin } = usePlatform();
357
+ const isOwnJob = (job) => {
358
+ if (!integrated.value) return true;
359
+ if (user.value == null) return isAdmin.value;
360
+ return (job.owner_user_id ?? job.user_id) === String(user.value.id);
361
+ };
362
+ const ownActiveJobs = computed(() => activeJobs.value.filter(isOwnJob));
363
+ const justFinished = shallowRef(null);
364
+ const heldJob = computed(() => {
365
+ const held = justFinished.value;
366
+ return held ? jobs.value.find((job) => job.job_id === held.job_id) ?? null : null;
367
+ });
368
+ let finishedTimer;
369
+ watch([source, ownActiveJobs], ([currentSource, now], [previousSource, before]) => {
370
+ if (currentSource !== previousSource) {
371
+ justFinished.value = null;
372
+ return;
373
+ }
374
+ const nowIds = new Set(now.map((job) => job.job_id));
375
+ const left = new Set(before.filter((job) => !nowIds.has(job.job_id)).map((job) => job.job_id));
376
+ const finished = jobs.value.find((job) => left.has(job.job_id) && job.status === "completed");
377
+ if (!finished) return;
378
+ justFinished.value = finished;
379
+ clearTimeout(finishedTimer);
380
+ finishedTimer = setTimeout(() => {
381
+ justFinished.value = null;
382
+ }, FINISHED_HOLD_MS);
383
+ });
384
+ const seenFailedKey = `mint.jobs.${plugin.value?.id ?? "standalone"}.seen-failed`;
385
+ const storedSeenFailed = readSeenFailed(seenFailedKey);
386
+ const seenFailed = shallowRef(storedSeenFailed ?? /* @__PURE__ */ new Set());
387
+ const unseenFailedJobs = computed(() => historyJobs.value.filter((job) => job.status === "failed" && isOwnJob(job) && !seenFailed.value.has(job.job_id)));
388
+ function markFailedSeen() {
389
+ seenFailed.value = /* @__PURE__ */ new Set([...seenFailed.value, ...unseenFailedJobs.value.map((job) => job.job_id)]);
390
+ writeSeenFailed(seenFailedKey, seenFailed.value);
391
+ }
392
+ let hasBaseline = storedSeenFailed !== null;
393
+ let awaitingLoad = options.loadOnMount !== false && Boolean(source.value?.refresh);
394
+ function takeBaseline() {
395
+ if (hasBaseline || !active) return;
396
+ hasBaseline = true;
397
+ markFailedSeen();
398
+ }
399
+ watch(jobs, (list) => {
400
+ if (!awaitingLoad && list.length > 0) takeBaseline();
401
+ }, { immediate: true });
402
+ watch([isOpen, unseenFailedJobs], ([open, unseen]) => {
403
+ if (open && unseen.length > 0) markFailedSeen();
404
+ });
405
+ const topBarJob = computed(() => {
406
+ const own = ownActiveJobs.value;
407
+ const shown = own.find((job) => job.status === "awaiting_input") ?? own[0];
408
+ if (shown) return options.topBarJob?.(shown) ?? {
409
+ status: shown.status,
410
+ label: shown.progress.message || `${shown.name} ${jobStatusLabel(shown.status).toLowerCase()}`,
411
+ percent: shown.status === "running" ? normalizeJobPercent(shown.progress.percent) : null
412
+ };
413
+ const held = heldJob.value;
414
+ if (held) return options.topBarJob?.(held) ?? {
415
+ status: "completed",
416
+ label: `${held.name} completed`
417
+ };
418
+ const failed = unseenFailedJobs.value.length;
419
+ return failed > 0 ? {
420
+ status: "failed",
421
+ label: `${failed} failed`
422
+ } : null;
423
+ });
424
+ function rowView(job) {
425
+ const override = options.rowJob?.(job) ?? {};
426
+ const status = override.status ?? job.status;
427
+ const percent = override.percent !== void 0 ? override.percent : job.status === "running" ? job.progress.percent : null;
428
+ return {
429
+ status,
430
+ percent: percent == null ? null : Math.round(normalizeJobPercent(percent)),
431
+ message: override.message ?? jobMessage(job)
432
+ };
433
+ }
434
+ function handleTopBarClick(onSelect) {
435
+ const finished = heldJob.value;
436
+ if (!isOpen.value && ownActiveJobs.value.length === 0 && finished) onSelect(finished);
437
+ else isOpen.value = !isOpen.value;
438
+ }
439
+ const canRefresh = computed(() => Boolean(source.value?.refresh));
440
+ const canCancel = computed(() => Boolean(source.value?.cancel));
441
+ const canDelete = computed(() => Boolean(source.value?.delete));
442
+ const canClearFinished = computed(() => Boolean(source.value?.clear || source.value?.delete));
443
+ function setPending(jobId, pending) {
444
+ const next = new Set(pendingJobIds.value);
445
+ if (pending) next.add(jobId);
446
+ else next.delete(jobId);
447
+ pendingJobIds.value = next;
448
+ }
449
+ async function refresh() {
450
+ const listJobs = source.value?.refresh;
451
+ if (!listJobs) return false;
452
+ const generation = ++requestGeneration;
453
+ isLoading.value = true;
454
+ error.value = null;
455
+ try {
456
+ await listJobs();
457
+ return active && generation === requestGeneration;
458
+ } catch (cause) {
459
+ if (active && generation === requestGeneration) error.value = errorMessage(cause, "Failed to load jobs");
460
+ return false;
461
+ } finally {
462
+ if (active && generation === requestGeneration) isLoading.value = false;
463
+ }
464
+ }
465
+ async function cancelJob(job) {
466
+ const sourceCancel = source.value?.cancel;
467
+ if (!job.can_cancel || !sourceCancel || pendingJobIds.value.has(job.job_id)) return false;
468
+ setPending(job.job_id, true);
469
+ error.value = null;
470
+ try {
471
+ await sourceCancel(job.job_id);
472
+ return active;
473
+ } catch (cause) {
474
+ if (active) error.value = errorMessage(cause, "Failed to cancel job");
475
+ return false;
476
+ } finally {
477
+ if (active) setPending(job.job_id, false);
478
+ }
479
+ }
480
+ async function deleteJob(job) {
481
+ const sourceDelete = source.value?.delete;
482
+ if (!job.can_delete || !sourceDelete || pendingJobIds.value.has(job.job_id)) return false;
483
+ setPending(job.job_id, true);
484
+ error.value = null;
485
+ try {
486
+ const deleted = await sourceDelete(job.job_id);
487
+ return active && deleted !== false;
488
+ } catch (cause) {
489
+ if (active) error.value = errorMessage(cause, "Failed to delete job");
490
+ return false;
491
+ } finally {
492
+ if (active) setPending(job.job_id, false);
493
+ }
494
+ }
495
+ async function clearFinished() {
496
+ const targets = deletableJobs.value;
497
+ if (targets.length === 0) return false;
498
+ error.value = null;
499
+ try {
500
+ const currentSource = source.value;
501
+ if (currentSource?.clear) {
502
+ const deleted = await currentSource.clear();
503
+ if (!active) return false;
504
+ return typeof deleted !== "number" || deleted === targets.length;
505
+ }
506
+ if (!currentSource?.delete) return false;
507
+ return (await Promise.all(targets.map((job) => deleteJob(job)))).every(Boolean);
508
+ } catch (cause) {
509
+ if (active) error.value = errorMessage(cause, "Failed to clear jobs");
510
+ return false;
511
+ }
512
+ }
513
+ onMounted(() => {
514
+ if (options.loadOnMount === false) return;
515
+ refresh().then((loaded) => {
516
+ awaitingLoad = false;
517
+ if (loaded || jobs.value.length > 0) takeBaseline();
518
+ });
519
+ });
520
+ onUnmounted(() => {
521
+ active = false;
522
+ requestGeneration += 1;
523
+ clearTimeout(finishedTimer);
524
+ });
525
+ return {
526
+ source,
527
+ jobs,
528
+ activeJobs,
529
+ historyJobs,
530
+ deletableJobs,
531
+ featuredJob,
532
+ canRefresh,
533
+ canCancel,
534
+ canDelete,
535
+ canClearFinished,
536
+ panelId: `mint-jobs-tray-${useId()}`,
537
+ rowView,
538
+ topBarJob,
539
+ completedCount,
540
+ isOpen,
541
+ isLoading,
542
+ error,
543
+ pendingJobIds,
544
+ open: () => {
545
+ isOpen.value = true;
546
+ },
547
+ close: () => {
548
+ isOpen.value = false;
549
+ },
550
+ toggle: () => {
551
+ isOpen.value = !isOpen.value;
552
+ },
553
+ handleTopBarClick,
554
+ refresh,
555
+ cancelJob,
556
+ deleteJob,
557
+ clearFinished,
558
+ isPending: (job) => pendingJobIds.value.has(job.job_id)
559
+ };
560
+ }
561
+ //#endregion
235
562
  //#region src/composables/controlWorkspaceOptions.ts
236
563
  function mergeControlWorkspaceOptions(base, override) {
237
564
  return {
@@ -396,11 +723,18 @@ var WorkspaceControlsInternal_default = /* @__PURE__ */ defineComponent({
396
723
  //#region src/components/internal/WorkspaceShellInternal.vue
397
724
  var WorkspaceShellInternal_default = /* @__PURE__ */ defineComponent({
398
725
  __name: "WorkspaceShellInternal",
399
- props: { shell: {} },
726
+ props: {
727
+ shell: {},
728
+ job: {},
729
+ jobsDone: {},
730
+ jobsOpen: { type: Boolean },
731
+ jobsPanelId: {}
732
+ },
400
733
  emits: [
401
734
  "pill-select",
402
735
  "pill-option-select",
403
- "settings-values-change"
736
+ "settings-values-change",
737
+ "job-click"
404
738
  ],
405
739
  setup(__props, { emit: __emit }) {
406
740
  /**
@@ -429,9 +763,14 @@ var WorkspaceShellInternal_default = /* @__PURE__ */ defineComponent({
429
763
  subtitle: __props.shell.subtitle,
430
764
  spec: __props.shell.topBar,
431
765
  pill: __props.shell.pill,
432
- onPillSelect: _cache[0] || (_cache[0] = ($event) => emit("pill-select", $event)),
766
+ job: __props.job,
767
+ "jobs-done": __props.jobsDone,
768
+ "jobs-open": __props.jobsOpen,
769
+ "jobs-panel-id": __props.jobsPanelId,
770
+ onJobClick: _cache[0] || (_cache[0] = ($event) => emit("job-click")),
771
+ onPillSelect: _cache[1] || (_cache[1] = ($event) => emit("pill-select", $event)),
433
772
  onPillOptionSelect: handlePillOptionSelect,
434
- onSettingsValuesChange: _cache[1] || (_cache[1] = ($event) => emit("settings-values-change", $event))
773
+ onSettingsValuesChange: _cache[2] || (_cache[2] = ($event) => emit("settings-values-change", $event))
435
774
  }, createSlots({ _: 2 }, [renderList(__props.shell.topBarSlotNames, (slotName) => {
436
775
  return {
437
776
  name: slotName,
@@ -441,7 +780,11 @@ var WorkspaceShellInternal_default = /* @__PURE__ */ defineComponent({
441
780
  "title",
442
781
  "subtitle",
443
782
  "spec",
444
- "pill"
783
+ "pill",
784
+ "job",
785
+ "jobs-done",
786
+ "jobs-open",
787
+ "jobs-panel-id"
445
788
  ])) : createCommentVNode("", true)])]),
446
789
  default: withCtx(() => [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(__props.shell.controls)))]),
447
790
  _: 2
@@ -551,7 +894,8 @@ var PluginWorkspaceView_default = /* @__PURE__ */ defineComponent({
551
894
  "update:toggle",
552
895
  "section-action",
553
896
  "form-submit",
554
- "form-cancel"
897
+ "form-cancel",
898
+ "job-select"
555
899
  ],
556
900
  setup(__props, { emit: __emit }) {
557
901
  /**
@@ -583,6 +927,11 @@ var PluginWorkspaceView_default = /* @__PURE__ */ defineComponent({
583
927
  saveDisabledMessage: computed(() => toValue(save?.reason))
584
928
  });
585
929
  }
930
+ const jobs = props.spec.jobs;
931
+ const jobCenter = jobs ? useJobCenter({ source: jobs }) : null;
932
+ function handleJobSelect(job) {
933
+ emit("job-select", job);
934
+ }
586
935
  const { shell, sidebar, controls, handleControlValuesUpdate, handlePillSelect } = usePluginWorkspace({
587
936
  props,
588
937
  slots,
@@ -600,14 +949,27 @@ var PluginWorkspaceView_default = /* @__PURE__ */ defineComponent({
600
949
  return (_ctx, _cache) => {
601
950
  return openBlock(), createBlock(WorkspaceShellInternal_default, {
602
951
  shell: unref(shell),
952
+ job: unref(jobCenter) ? unref(jobCenter).topBarJob.value : void 0,
953
+ "jobs-done": unref(jobCenter)?.completedCount.value,
954
+ "jobs-open": unref(jobCenter)?.isOpen.value,
955
+ "jobs-panel-id": unref(jobCenter)?.panelId,
956
+ onJobClick: _cache[2] || (_cache[2] = ($event) => unref(jobCenter)?.handleTopBarClick(handleJobSelect)),
603
957
  onPillSelect: unref(handlePillSelect),
604
- onPillOptionSelect: _cache[2] || (_cache[2] = (option, item) => emit("pill-option-select", option, item)),
605
- onSettingsValuesChange: _cache[3] || (_cache[3] = ($event) => emit("settings-values-change", $event))
958
+ onPillOptionSelect: _cache[3] || (_cache[3] = (option, item) => emit("pill-option-select", option, item)),
959
+ onSettingsValuesChange: _cache[4] || (_cache[4] = ($event) => emit("settings-values-change", $event))
606
960
  }, createSlots({
607
- default: withCtx(() => [createVNode(WorkspaceControlsInternal_default, { controls: unref(controls) }, {
608
- default: withCtx((controlsScope) => [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(controlsScope)))]),
609
- _: 3
610
- }, 8, ["controls"]), __props.spec.toasts !== false ? (openBlock(), createBlock(AppToastContainer_default, { key: 0 })) : createCommentVNode("", true)]),
961
+ default: withCtx(() => [
962
+ createVNode(WorkspaceControlsInternal_default, { controls: unref(controls) }, {
963
+ default: withCtx((controlsScope) => [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(controlsScope)))]),
964
+ _: 3
965
+ }, 8, ["controls"]),
966
+ __props.spec.toasts !== false ? (openBlock(), createBlock(AppToastContainer_default, { key: 0 })) : createCommentVNode("", true),
967
+ unref(jobCenter) ? (openBlock(), createBlock(JobsStatusTray_default, {
968
+ key: 1,
969
+ center: unref(jobCenter),
970
+ onSelect: handleJobSelect
971
+ }, null, 8, ["center"])) : createCommentVNode("", true)
972
+ ]),
611
973
  _: 2
612
974
  }, [
613
975
  unref(slots).topbar ? {
@@ -639,7 +1001,14 @@ var PluginWorkspaceView_default = /* @__PURE__ */ defineComponent({
639
1001
  })]), 1032, ["sidebar", "onUpdate:values"])])]),
640
1002
  key: "1"
641
1003
  } : void 0
642
- ]), 1032, ["shell", "onPillSelect"]);
1004
+ ]), 1032, [
1005
+ "shell",
1006
+ "job",
1007
+ "jobs-done",
1008
+ "jobs-open",
1009
+ "jobs-panel-id",
1010
+ "onPillSelect"
1011
+ ]);
643
1012
  };
644
1013
  }
645
1014
  });
@@ -901,7 +1270,8 @@ var GeneratedPluginView_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
901
1270
  title: "Parameters",
902
1271
  panels: panels.value,
903
1272
  forms: forms.value
904
- }
1273
+ },
1274
+ jobs: generated
905
1275
  }));
906
1276
  watch(() => generated.manifest.value?.ui, (ui) => {
907
1277
  if (ui) providePluginIdentity({ plugin: {
@@ -956,7 +1326,8 @@ var GeneratedPluginView_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
956
1326
  "form-loading": unref(generated).isSubmitting.value,
957
1327
  "form-disabled": unref(generated).isSubmitting.value,
958
1328
  "onUpdate:values": updateValues,
959
- onFormSubmit: submitJob
1329
+ onFormSubmit: submitJob,
1330
+ onJobSelect: selectJob
960
1331
  }, {
961
1332
  default: withCtx(() => [createElementVNode("main", _hoisted_1$3, [unref(generated).isLoading.value ? (openBlock(), createElementBlock("div", _hoisted_2$2, [createVNode(LoadingSpinner_default, { size: "lg" }), _cache[1] || (_cache[1] = createElementVNode("span", null, "Loading analysis workspace", -1))])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
962
1333
  unref(generated).error.value ? (openBlock(), createBlock(AlertBox_default, {
@@ -980,11 +1351,7 @@ var GeneratedPluginView_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
980
1351
  description: "Set the parameters and run the analysis. Jobs continue independently if you switch tabs.",
981
1352
  size: "md"
982
1353
  }))])
983
- ], 64)), createVNode(JobsStatusTray_default, {
984
- source: unref(generated),
985
- "teleport-to": false,
986
- onSelect: selectJob
987
- }, null, 8, ["source"])])]),
1354
+ ], 64))])]),
988
1355
  _: 1
989
1356
  }, 8, [
990
1357
  "view",
@@ -995,7 +1362,7 @@ var GeneratedPluginView_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
995
1362
  ]);
996
1363
  };
997
1364
  }
998
- }), [["__scopeId", "data-v-41f5ec2e"]]);
1365
+ }), [["__scopeId", "data-v-c8ff991b"]]);
999
1366
  //#endregion
1000
1367
  //#region src/components/internal/PlateEditorBindingInternal.vue
1001
1368
  var PlateEditorBindingInternal_default = /* @__PURE__ */ defineComponent({
@@ -1486,6 +1853,6 @@ var runtime_exports = /* @__PURE__ */ __exportAll({
1486
1853
  useSettingsEndpoint: () => useSettingsEndpoint
1487
1854
  });
1488
1855
  //#endregion
1489
- export { ComponentBindingRenderer_default as a, generatedJobFormSchema as c, PluginWorkspaceView_default as d, useControlWorkspace as f, RuntimeUpdateNotice_default as i, normalizeGeneratedJobInput as l, useToast as m, PresenceAvatars_default as n, GeneratedPluginView_default as o, AppToastContainer_default as p, usePresence as r, generatedJobDefaults as s, runtime_exports as t, Avatar_default as u };
1856
+ export { ComponentBindingRenderer_default as a, generatedJobFormSchema as c, PluginWorkspaceView_default as d, useControlWorkspace as f, useToast as g, AppToastContainer_default as h, RuntimeUpdateNotice_default as i, normalizeGeneratedJobInput as l, useJobCenter as m, PresenceAvatars_default as n, GeneratedPluginView_default as o, combinePluginJobSources as p, usePresence as r, generatedJobDefaults as s, runtime_exports as t, Avatar_default as u };
1490
1857
 
1491
- //# sourceMappingURL=runtime-7vfl_bI3.js.map
1858
+ //# sourceMappingURL=runtime-q-R0CNLh.js.map