@dxos/plugin-routine 0.10.0 → 0.11.1
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/PLUGIN.mdl +18 -13
- package/dist/lib/RoutinePlugin.mjs +2 -0
- package/dist/lib/RoutinePlugin.node.mjs +894 -0
- package/dist/lib/RoutinePlugin.node.mjs.map +1 -0
- package/dist/lib/RoutinePlugin.workerd.mjs +20 -0
- package/dist/lib/RoutinePlugin.workerd.mjs.map +1 -0
- package/dist/lib/capabilities/node.mjs +12 -0
- package/dist/lib/capabilities/node.mjs.map +1 -0
- package/dist/lib/capabilities.mjs +14 -0
- package/dist/lib/capabilities.mjs.map +1 -0
- package/dist/lib/chunk-RoutineArticle.mjs +79 -0
- package/dist/lib/chunk-RoutineArticle.mjs.map +1 -0
- package/dist/lib/chunk-RoutineCompanion.mjs +192 -0
- package/dist/lib/chunk-RoutineCompanion.mjs.map +1 -0
- package/dist/lib/chunk-RoutinePlugin.mjs +38 -0
- package/dist/lib/chunk-RoutinePlugin.mjs.map +1 -0
- package/dist/lib/chunk-RoutineSettings.mjs +50 -0
- package/dist/lib/chunk-RoutineSettings.mjs.map +1 -0
- package/dist/lib/chunk-RoutineTraceCompanion.mjs +208 -0
- package/dist/lib/chunk-RoutineTraceCompanion.mjs.map +1 -0
- package/dist/lib/chunk-SkillArticle.mjs +28 -0
- package/dist/lib/chunk-SkillArticle.mjs.map +1 -0
- package/dist/lib/chunk-app-graph-builder.mjs +71 -0
- package/dist/lib/chunk-app-graph-builder.mjs.map +1 -0
- package/dist/lib/chunk-create-object.mjs +23 -0
- package/dist/lib/chunk-create-object.mjs.map +1 -0
- package/dist/lib/chunk-create-routine.mjs +34 -0
- package/dist/lib/chunk-create-routine.mjs.map +1 -0
- package/dist/lib/chunk-create-trigger-from-template.mjs +48 -0
- package/dist/lib/chunk-create-trigger-from-template.mjs.map +1 -0
- package/dist/lib/chunk-layer-specs.mjs +179 -0
- package/dist/lib/chunk-layer-specs.mjs.map +1 -0
- package/dist/lib/{neutral/chunk-HLO4LYXT.mjs → chunk-meta.mjs} +19 -27
- package/dist/lib/chunk-meta.mjs.map +1 -0
- package/dist/lib/chunk-operation-handler.mjs +11 -0
- package/dist/lib/chunk-operation-handler.mjs.map +1 -0
- package/dist/lib/chunk-paths.mjs +11 -0
- package/dist/lib/chunk-paths.mjs.map +1 -0
- package/dist/lib/chunk-react-surface.mjs +64 -0
- package/dist/lib/chunk-react-surface.mjs.map +1 -0
- package/dist/lib/chunk-registry-sync.mjs +104 -0
- package/dist/lib/chunk-registry-sync.mjs.map +1 -0
- package/dist/lib/chunk-run-routine.mjs +57 -0
- package/dist/lib/chunk-run-routine.mjs.map +1 -0
- package/dist/lib/chunk-templates.mjs +37 -0
- package/dist/lib/chunk-templates.mjs.map +1 -0
- package/dist/lib/chunk-trigger-runtime-controller.mjs +73 -0
- package/dist/lib/chunk-trigger-runtime-controller.mjs.map +1 -0
- package/dist/lib/chunk-types.mjs +149 -0
- package/dist/lib/chunk-types.mjs.map +1 -0
- package/dist/lib/chunk-util.mjs +142 -0
- package/dist/lib/chunk-util.mjs.map +1 -0
- package/dist/lib/components.mjs +1645 -0
- package/dist/lib/components.mjs.map +1 -0
- package/dist/lib/containers.mjs +11 -0
- package/dist/lib/containers.mjs.map +1 -0
- package/dist/lib/hooks.mjs +37 -0
- package/dist/lib/hooks.mjs.map +1 -0
- package/dist/lib/index.mjs +5 -0
- package/dist/lib/meta.mjs +2 -0
- package/dist/lib/operations.mjs +7 -0
- package/dist/lib/operations.mjs.map +1 -0
- package/dist/lib/plugin.mjs +9 -0
- package/dist/lib/plugin.mjs.map +1 -0
- package/dist/lib/testing.mjs +2 -0
- package/dist/lib/translations.mjs +110 -0
- package/dist/lib/translations.mjs.map +1 -0
- package/dist/lib/types.mjs +2 -0
- package/dist/types/src/RoutinePlugin.d.ts.map +1 -1
- package/dist/types/src/RoutinePlugin.node.d.ts.map +1 -1
- package/dist/types/src/RoutinePlugin.workerd.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/create-object.d.ts +1 -1
- package/dist/types/src/capabilities/index.d.ts +0 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/layer-specs.d.ts +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/registry-sync.d.ts +1 -1
- package/dist/types/src/capabilities/templates.d.ts +1 -1
- package/dist/types/src/capabilities/trigger-runtime-controller.d.ts +1 -1
- package/dist/types/src/commands/trigger/create/{queue.d.ts → feed.d.ts} +2 -2
- package/dist/types/src/commands/trigger/create/feed.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/update/{queue.d.ts → feed.d.ts} +2 -2
- package/dist/types/src/commands/trigger/update/feed.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/util.d.ts +1 -1
- package/dist/types/src/commands/trigger/util.d.ts.map +1 -1
- package/dist/types/src/components/InstructionsEditor/InstructionsEditor.d.ts +7 -5
- package/dist/types/src/components/InstructionsEditor/InstructionsEditor.d.ts.map +1 -1
- package/dist/types/src/components/InstructionsEditor/InstructionsEditor.stories.d.ts +3 -3
- package/dist/types/src/components/InstructionsEditor/InstructionsEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/RoutineCard/RoutineCard.d.ts +9 -0
- package/dist/types/src/components/RoutineCard/RoutineCard.d.ts.map +1 -0
- package/dist/types/src/components/RoutineCard/RoutineCard.stories.d.ts +21 -0
- package/dist/types/src/components/RoutineCard/RoutineCard.stories.d.ts.map +1 -0
- package/dist/types/src/components/RoutineCard/index.d.ts +2 -0
- package/dist/types/src/components/RoutineCard/index.d.ts.map +1 -0
- package/dist/types/src/components/RoutineForm/RoutineForm.d.ts +7 -2
- package/dist/types/src/components/RoutineForm/RoutineForm.d.ts.map +1 -1
- package/dist/types/src/components/Schedule/Schedule.d.ts +2 -26
- package/dist/types/src/components/Schedule/Schedule.d.ts.map +1 -1
- package/dist/types/src/components/Schedule/days.d.ts +24 -0
- package/dist/types/src/components/Schedule/days.d.ts.map +1 -0
- package/dist/types/src/components/Schedule/describe-schedule.d.ts +3 -0
- package/dist/types/src/components/Schedule/describe-schedule.d.ts.map +1 -0
- package/dist/types/src/components/Schedule/index.d.ts +2 -0
- package/dist/types/src/components/Schedule/index.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +1 -2
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerKindSelector.d.ts +5 -2
- package/dist/types/src/components/TriggerEditor/TriggerKindSelector.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/trigger-kind-icon.d.ts +5 -0
- package/dist/types/src/components/TriggerEditor/trigger-kind-icon.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.d.ts +5 -10
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.d.ts.map +1 -1
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.stories.d.ts +6 -2
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.stories.d.ts.map +1 -1
- package/dist/types/src/containers/RoutineCompanion/RoutineCompanion.d.ts +4 -12
- package/dist/types/src/containers/RoutineCompanion/RoutineCompanion.d.ts.map +1 -1
- package/dist/types/src/containers/RoutineCompanion/RoutineCompanion.stories.d.ts.map +1 -1
- package/dist/types/src/containers/RoutineSettings/RoutineSettings.d.ts +4 -8
- package/dist/types/src/containers/RoutineSettings/RoutineSettings.d.ts.map +1 -1
- package/dist/types/src/containers/RoutineTraceCompanion/RoutineTraceCompanion.d.ts +5 -3
- package/dist/types/src/containers/RoutineTraceCompanion/RoutineTraceCompanion.d.ts.map +1 -1
- package/dist/types/src/containers/RoutineTraceCompanion/RoutineTraceCompanion.stories.d.ts.map +1 -1
- package/dist/types/src/containers/RoutineTraceCompanion/useRoutineRuns.d.ts +1 -1
- package/dist/types/src/containers/RoutineTraceCompanion/useRoutineRuns.d.ts.map +1 -1
- package/dist/types/src/containers/SkillArticle/SkillArticle.d.ts +4 -1
- package/dist/types/src/containers/SkillArticle/SkillArticle.d.ts.map +1 -1
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +1 -1
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/operations/run-routine.d.ts.map +1 -1
- package/dist/types/src/operations/run-routine.test.d.ts +2 -0
- package/dist/types/src/operations/run-routine.test.d.ts.map +1 -0
- package/dist/types/src/paths.d.ts.map +1 -1
- package/dist/types/src/templates/index.d.ts +1 -1
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-functions.d.ts +30 -6
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/RoutineCapabilities.d.ts +9 -3
- package/dist/types/src/types/RoutineCapabilities.d.ts.map +1 -1
- package/dist/types/src/types/RoutineOperation.d.ts +2 -3
- package/dist/types/src/types/RoutineOperation.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +0 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +1 -0
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/routines-for-object.d.ts +6 -3
- package/dist/types/src/util/routines-for-object.d.ts.map +1 -1
- package/dist/types/src/util/wire.d.ts +21 -0
- package/dist/types/src/util/wire.d.ts.map +1 -0
- package/dist/types/src/util/wire.test.d.ts +2 -0
- package/dist/types/src/util/wire.test.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dx.config.ts +3 -2
- package/package.json +73 -71
- package/src/RoutinePlugin.node.ts +1 -2
- package/src/RoutinePlugin.tsx +2 -4
- package/src/RoutinePlugin.workerd.ts +1 -2
- package/src/capabilities/app-graph-builder.ts +9 -7
- package/src/capabilities/create-object.ts +2 -2
- package/src/capabilities/index.ts +0 -1
- package/src/capabilities/layer-specs.ts +78 -12
- package/src/capabilities/{react-surface.tsx → react-surface.ts} +18 -22
- package/src/capabilities/trigger-runtime-controller.test.ts +12 -18
- package/src/capabilities/trigger-runtime-controller.ts +22 -25
- package/src/commands/trigger/create/{queue.ts → feed.ts} +1 -1
- package/src/commands/trigger/create/index.ts +2 -2
- package/src/commands/trigger/update/{queue.ts → feed.ts} +1 -1
- package/src/commands/trigger/update/index.ts +2 -2
- package/src/commands/trigger/util.ts +1 -2
- package/src/components/InstructionsEditor/InstructionsEditor.stories.tsx +7 -6
- package/src/components/InstructionsEditor/InstructionsEditor.tsx +31 -19
- package/src/components/RoutineCard/RoutineCard.stories.tsx +95 -0
- package/src/components/RoutineCard/RoutineCard.tsx +60 -0
- package/src/components/{MasterDetail → RoutineCard}/index.ts +1 -1
- package/src/components/RoutineForm/RoutineForm.tsx +60 -52
- package/src/components/Schedule/Schedule.stories.tsx +1 -1
- package/src/components/Schedule/Schedule.tsx +4 -73
- package/src/components/Schedule/days.ts +18 -0
- package/src/components/Schedule/describe-schedule.ts +64 -0
- package/src/components/Schedule/index.ts +2 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +1 -1
- package/src/components/TemplateEditor/TemplateForm.tsx +1 -1
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +3 -3
- package/src/components/TriggerEditor/TriggerEditor.tsx +79 -66
- package/src/components/TriggerEditor/TriggerKindSelector.tsx +4 -30
- package/src/components/TriggerEditor/trigger-kind-icon.ts +38 -0
- package/src/components/index.ts +1 -1
- package/src/containers/RoutineArticle/RoutineArticle.stories.tsx +78 -19
- package/src/containers/RoutineArticle/RoutineArticle.tsx +8 -4
- package/src/containers/RoutineCompanion/RoutineCompanion.stories.tsx +5 -4
- package/src/containers/RoutineCompanion/RoutineCompanion.tsx +11 -7
- package/src/containers/RoutineSettings/RoutineSettings.tsx +22 -33
- package/src/containers/RoutineTraceCompanion/RoutineTraceCompanion.stories.tsx +6 -5
- package/src/containers/RoutineTraceCompanion/RoutineTraceCompanion.tsx +3 -1
- package/src/containers/RoutineTraceCompanion/useRoutineRuns.ts +3 -5
- package/src/containers/SkillArticle/SkillArticle.tsx +2 -0
- package/src/hooks/useTriggerRuntimeControls.ts +2 -2
- package/src/index.ts +1 -0
- package/src/operations/create-routine.ts +1 -1
- package/src/operations/create-trigger-from-template.ts +2 -2
- package/src/operations/run-routine.test.ts +150 -0
- package/src/operations/run-routine.ts +18 -2
- package/src/paths.ts +5 -5
- package/src/templates/index.ts +5 -3
- package/src/translations.ts +5 -6
- package/src/types/RoutineCapabilities.ts +10 -4
- package/src/types/RoutineOperation.ts +7 -6
- package/src/types/index.ts +0 -1
- package/src/util/index.ts +1 -0
- package/src/util/routines-for-object.test.ts +37 -5
- package/src/util/routines-for-object.ts +33 -8
- package/src/util/wire.test.ts +77 -0
- package/src/util/wire.ts +76 -0
- package/dist/lib/neutral/RoutineArticle-UNTMV4CC.mjs +0 -95
- package/dist/lib/neutral/RoutineArticle-UNTMV4CC.mjs.map +0 -7
- package/dist/lib/neutral/RoutineCompanion-ZZ6WMY7I.mjs +0 -249
- package/dist/lib/neutral/RoutineCompanion-ZZ6WMY7I.mjs.map +0 -7
- package/dist/lib/neutral/RoutinePlugin.mjs +0 -10
- package/dist/lib/neutral/RoutinePlugin.mjs.map +0 -7
- package/dist/lib/neutral/RoutinePlugin.node.mjs +0 -1133
- package/dist/lib/neutral/RoutinePlugin.node.mjs.map +0 -7
- package/dist/lib/neutral/RoutinePlugin.workerd.mjs +0 -36
- package/dist/lib/neutral/RoutinePlugin.workerd.mjs.map +0 -7
- package/dist/lib/neutral/RoutineSettings-ZJOM4F3S.mjs +0 -48
- package/dist/lib/neutral/RoutineSettings-ZJOM4F3S.mjs.map +0 -7
- package/dist/lib/neutral/RoutineTraceCompanion-5U6R7LJE.mjs +0 -236
- package/dist/lib/neutral/RoutineTraceCompanion-5U6R7LJE.mjs.map +0 -7
- package/dist/lib/neutral/SkillArticle-WWDNKW2Z.mjs +0 -27
- package/dist/lib/neutral/SkillArticle-WWDNKW2Z.mjs.map +0 -7
- package/dist/lib/neutral/app-graph-builder-FALWLZTI.mjs +0 -90
- package/dist/lib/neutral/app-graph-builder-FALWLZTI.mjs.map +0 -7
- package/dist/lib/neutral/capabilities/index.mjs +0 -25
- package/dist/lib/neutral/capabilities/index.mjs.map +0 -7
- package/dist/lib/neutral/capabilities/node.mjs +0 -19
- package/dist/lib/neutral/capabilities/node.mjs.map +0 -7
- package/dist/lib/neutral/chunk-674LDIUJ.mjs +0 -9
- package/dist/lib/neutral/chunk-674LDIUJ.mjs.map +0 -7
- package/dist/lib/neutral/chunk-HLO4LYXT.mjs.map +0 -7
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +0 -10
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +0 -7
- package/dist/lib/neutral/chunk-P3TDQKOO.mjs +0 -8
- package/dist/lib/neutral/chunk-P3TDQKOO.mjs.map +0 -7
- package/dist/lib/neutral/chunk-R7J2MU2M.mjs +0 -263
- package/dist/lib/neutral/chunk-R7J2MU2M.mjs.map +0 -7
- package/dist/lib/neutral/chunk-WLNL77C7.mjs +0 -14
- package/dist/lib/neutral/chunk-WLNL77C7.mjs.map +0 -7
- package/dist/lib/neutral/chunk-YGWSAKLD.mjs +0 -65
- package/dist/lib/neutral/chunk-YGWSAKLD.mjs.map +0 -7
- package/dist/lib/neutral/components/index.mjs +0 -1921
- package/dist/lib/neutral/components/index.mjs.map +0 -7
- package/dist/lib/neutral/containers/index.mjs +0 -17
- package/dist/lib/neutral/containers/index.mjs.map +0 -7
- package/dist/lib/neutral/create-object-V23KVDMJ.mjs +0 -25
- package/dist/lib/neutral/create-object-V23KVDMJ.mjs.map +0 -7
- package/dist/lib/neutral/create-routine-6QBY6TWF.mjs +0 -38
- package/dist/lib/neutral/create-routine-6QBY6TWF.mjs.map +0 -7
- package/dist/lib/neutral/create-trigger-from-template-U3KNS77V.mjs +0 -70
- package/dist/lib/neutral/create-trigger-from-template-U3KNS77V.mjs.map +0 -7
- package/dist/lib/neutral/hooks/index.mjs +0 -47
- package/dist/lib/neutral/hooks/index.mjs.map +0 -7
- package/dist/lib/neutral/index.mjs +0 -27
- package/dist/lib/neutral/index.mjs.map +0 -7
- package/dist/lib/neutral/layer-specs-2TWJU5HI.mjs +0 -135
- package/dist/lib/neutral/layer-specs-2TWJU5HI.mjs.map +0 -7
- package/dist/lib/neutral/meta.json +0 -1
- package/dist/lib/neutral/meta.mjs +0 -8
- package/dist/lib/neutral/meta.mjs.map +0 -7
- package/dist/lib/neutral/navigation-resolver-KQIWUH6F.mjs +0 -18
- package/dist/lib/neutral/navigation-resolver-KQIWUH6F.mjs.map +0 -7
- package/dist/lib/neutral/operation-handler-QKLJSDCQ.mjs +0 -13
- package/dist/lib/neutral/operation-handler-QKLJSDCQ.mjs.map +0 -7
- package/dist/lib/neutral/operations/index.mjs +0 -8
- package/dist/lib/neutral/operations/index.mjs.map +0 -7
- package/dist/lib/neutral/plugin.mjs +0 -16
- package/dist/lib/neutral/plugin.mjs.map +0 -7
- package/dist/lib/neutral/react-surface-GMO7I7YE.mjs +0 -67
- package/dist/lib/neutral/react-surface-GMO7I7YE.mjs.map +0 -7
- package/dist/lib/neutral/registry-sync-DYPOC7ZG.mjs +0 -86
- package/dist/lib/neutral/registry-sync-DYPOC7ZG.mjs.map +0 -7
- package/dist/lib/neutral/run-routine-AEWO6SYD.mjs +0 -37
- package/dist/lib/neutral/run-routine-AEWO6SYD.mjs.map +0 -7
- package/dist/lib/neutral/templates-IIUCEBAX.mjs +0 -49
- package/dist/lib/neutral/templates-IIUCEBAX.mjs.map +0 -7
- package/dist/lib/neutral/testing.mjs +0 -8
- package/dist/lib/neutral/testing.mjs.map +0 -7
- package/dist/lib/neutral/translations.mjs +0 -115
- package/dist/lib/neutral/translations.mjs.map +0 -7
- package/dist/lib/neutral/trigger-runtime-controller-WIDDFGQT.mjs +0 -77
- package/dist/lib/neutral/trigger-runtime-controller-WIDDFGQT.mjs.map +0 -7
- package/dist/lib/neutral/types/index.mjs +0 -17
- package/dist/lib/neutral/types/index.mjs.map +0 -7
- package/dist/types/src/capabilities/navigation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/navigation-resolver.d.ts.map +0 -1
- package/dist/types/src/commands/trigger/create/queue.d.ts.map +0 -1
- package/dist/types/src/commands/trigger/update/queue.d.ts.map +0 -1
- package/dist/types/src/components/MasterDetail/MasterDetail.d.ts +0 -51
- package/dist/types/src/components/MasterDetail/MasterDetail.d.ts.map +0 -1
- package/dist/types/src/components/MasterDetail/MasterDetail.stories.d.ts +0 -16
- package/dist/types/src/components/MasterDetail/MasterDetail.stories.d.ts.map +0 -1
- package/dist/types/src/components/MasterDetail/index.d.ts +0 -2
- package/dist/types/src/components/MasterDetail/index.d.ts.map +0 -1
- package/dist/types/src/types/Routine.d.ts +0 -55
- package/dist/types/src/types/Routine.d.ts.map +0 -1
- package/dist/types/src/types/Routine.test.d.ts +0 -2
- package/dist/types/src/types/Routine.test.d.ts.map +0 -1
- package/src/capabilities/navigation-resolver.ts +0 -21
- package/src/components/MasterDetail/MasterDetail.stories.tsx +0 -100
- package/src/components/MasterDetail/MasterDetail.tsx +0 -175
- package/src/types/Routine.test.ts +0 -51
- package/src/types/Routine.ts +0 -144
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
2
|
+
import { AppCapabilities } from "@dxos/app-toolkit";
|
|
3
|
+
import { LayerSpec, Operation, OperationHandlerSet, Trigger } from "@dxos/compute";
|
|
4
|
+
import { Database, Registry } from "@dxos/echo";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
|
+
import { ClientService } from "@dxos/client";
|
|
7
|
+
import { invariant } from "@dxos/invariant";
|
|
8
|
+
import { FeedTraceSink, ProcessManager, RemoteOperationInvoker, RemoteProcessManager, RemoteTriggerManager, TriggerDispatcher, TriggerMonitor, TriggerStateStore } from "@dxos/compute-runtime";
|
|
9
|
+
import { Registry as Registry$1 } from "@effect-atom/atom";
|
|
10
|
+
import * as Layer from "effect/Layer";
|
|
11
|
+
import { OpaqueToolkit } from "@dxos/ai";
|
|
12
|
+
import { EdgeOperationInvoker, EdgeProcessManager, EdgeTriggerManager } from "@dxos/edge-compute";
|
|
13
|
+
//#region src/capabilities/layer-specs.ts
|
|
14
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-routine/src/capabilities/layer-specs.ts";
|
|
15
|
+
/**
|
|
16
|
+
* Gathers contributed {@link Capabilities.OperationHandler} sets from the
|
|
17
|
+
* {@link Capability.Service} and exposes them through the
|
|
18
|
+
* {@link OperationHandlerSet.OperationHandlerProvider} tag so space-affinity
|
|
19
|
+
* specs (e.g. {@link OperationsToRegistrySpec}) can consume them through the
|
|
20
|
+
* normal LayerStack resolution path.
|
|
21
|
+
*/
|
|
22
|
+
var OperationHandlerProviderSpec = LayerSpec.make({
|
|
23
|
+
affinity: "application",
|
|
24
|
+
requires: [Capability.Service],
|
|
25
|
+
provides: [OperationHandlerSet.OperationHandlerProvider]
|
|
26
|
+
}, () => Layer.unwrapEffect(Effect.gen(function* () {
|
|
27
|
+
const operationHandlerSets = yield* Capability.getAll(Capabilities.OperationHandler);
|
|
28
|
+
const mergedOperationHandlers = operationHandlerSets.length === 0 ? OperationHandlerSet.empty : OperationHandlerSet.merge(...operationHandlerSets);
|
|
29
|
+
return OperationHandlerSet.provide(mergedOperationHandlers);
|
|
30
|
+
})));
|
|
31
|
+
var RegistrySpec = LayerSpec.make({
|
|
32
|
+
affinity: "application",
|
|
33
|
+
requires: [ClientService],
|
|
34
|
+
provides: [Registry.Service]
|
|
35
|
+
}, () => Layer.unwrapEffect(Effect.gen(function* () {
|
|
36
|
+
const client = yield* ClientService;
|
|
37
|
+
return Layer.succeed(Registry.Service, client.graph.registry);
|
|
38
|
+
})));
|
|
39
|
+
var OpaqueToolkitSpec = LayerSpec.make({
|
|
40
|
+
affinity: "application",
|
|
41
|
+
requires: [Capability.Service],
|
|
42
|
+
provides: [OpaqueToolkit.OpaqueToolkitProvider]
|
|
43
|
+
}, () => Layer.unwrapEffect(Effect.gen(function* () {
|
|
44
|
+
const capabilities = yield* Capability.Service;
|
|
45
|
+
return Layer.succeed(OpaqueToolkit.OpaqueToolkitProvider, { getToolkit: () => {
|
|
46
|
+
const toolkits = capabilities.getAll(AppCapabilities.Toolkit);
|
|
47
|
+
return OpaqueToolkit.merge(...toolkits);
|
|
48
|
+
} });
|
|
49
|
+
})));
|
|
50
|
+
var OperationsToRegistrySpec = LayerSpec.make({
|
|
51
|
+
affinity: "space",
|
|
52
|
+
requires: [Registry.Service, OperationHandlerSet.OperationHandlerProvider],
|
|
53
|
+
provides: [Registry.Service]
|
|
54
|
+
}, () => Layer.effect(Registry.Service, Effect.gen(function* () {
|
|
55
|
+
const handlerSet = yield* OperationHandlerSet.OperationHandlerProvider;
|
|
56
|
+
const registry = yield* Registry.Service;
|
|
57
|
+
const handlers = yield* handlerSet.handlers;
|
|
58
|
+
registry.add(handlers.map(Operation.serialize));
|
|
59
|
+
return registry;
|
|
60
|
+
})));
|
|
61
|
+
/**
|
|
62
|
+
* In-memory trigger state. Loses state across restarts but works in both
|
|
63
|
+
* browser and CLI/Node contexts. Hosts that need durable storage should
|
|
64
|
+
* contribute a replacement LayerSpec that provides {@link TriggerStateStore}
|
|
65
|
+
* backed by a persistent `KeyValueStore` (e.g. `BrowserKeyValueStore` or
|
|
66
|
+
* `BunKeyValueStore`).
|
|
67
|
+
*/
|
|
68
|
+
var TriggerStateStoreSpec = LayerSpec.make({
|
|
69
|
+
affinity: "application",
|
|
70
|
+
requires: [],
|
|
71
|
+
provides: [TriggerStateStore]
|
|
72
|
+
}, () => TriggerStateStore.layerMemory);
|
|
73
|
+
var FeedTraceSinkSpec = LayerSpec.make({
|
|
74
|
+
affinity: "space",
|
|
75
|
+
requires: [Database.Service],
|
|
76
|
+
provides: [FeedTraceSink.FeedTraceSink]
|
|
77
|
+
}, () => FeedTraceSink.layerLive);
|
|
78
|
+
/**
|
|
79
|
+
* Space-scoped remote operation invoker (EDGE). When edge agents are enabled
|
|
80
|
+
* (`runtime.client.edgeFeatures.agents`) operations are invoked without a space
|
|
81
|
+
* binding (the edge routes them); otherwise they are scoped to the space. The
|
|
82
|
+
* config is read inside the factory — at slice-materialisation time, once
|
|
83
|
+
* `ClientService` is available — so the owning module does not need the client
|
|
84
|
+
* at activation time and can activate on `SetupProcessManager`.
|
|
85
|
+
*/
|
|
86
|
+
var RemoteOperationInvokerSpec = LayerSpec.make({
|
|
87
|
+
affinity: "space",
|
|
88
|
+
requires: [ClientService],
|
|
89
|
+
provides: [RemoteOperationInvoker.Service]
|
|
90
|
+
}, (context) => Layer.unwrapEffect(Effect.gen(function* () {
|
|
91
|
+
invariant(context.space, "space context required for RemoteOperationInvoker", {
|
|
92
|
+
"~LogMeta": "~LogMeta",
|
|
93
|
+
F: __dxlog_file,
|
|
94
|
+
L: 165,
|
|
95
|
+
S: this,
|
|
96
|
+
A: ["context.space", "'space context required for RemoteOperationInvoker'"]
|
|
97
|
+
});
|
|
98
|
+
const client = yield* ClientService;
|
|
99
|
+
const edgeAgents = client.config.get("runtime.client.edgeFeatures.agents");
|
|
100
|
+
return EdgeOperationInvoker.fromClient(client, edgeAgents ? void 0 : context.space);
|
|
101
|
+
})));
|
|
102
|
+
/**
|
|
103
|
+
* Space-scoped remote (EDGE) trigger manager, consumed by the aggregate
|
|
104
|
+
* {@link TriggerMonitor}. Uses the EDGE implementation whenever an edge service
|
|
105
|
+
* is configured (a trigger is routed here by its own `remote` flag, so the
|
|
106
|
+
* manager should exist wherever edge is reachable), otherwise a no-op.
|
|
107
|
+
*/
|
|
108
|
+
var RemoteTriggerManagerSpec = LayerSpec.make({
|
|
109
|
+
affinity: "space",
|
|
110
|
+
requires: [ClientService, Registry$1.AtomRegistry],
|
|
111
|
+
provides: [RemoteTriggerManager.Service]
|
|
112
|
+
}, (context) => Layer.unwrapEffect(Effect.gen(function* () {
|
|
113
|
+
invariant(context.space, "space context required for RemoteTriggerManager", {
|
|
114
|
+
"~LogMeta": "~LogMeta",
|
|
115
|
+
F: __dxlog_file,
|
|
116
|
+
L: 188,
|
|
117
|
+
S: this,
|
|
118
|
+
A: ["context.space", "'space context required for RemoteTriggerManager'"]
|
|
119
|
+
});
|
|
120
|
+
const client = yield* ClientService;
|
|
121
|
+
return client.config.values.runtime?.services?.edge?.url ? EdgeTriggerManager.fromClient(client, context.space) : RemoteTriggerManager.layerNoop;
|
|
122
|
+
})));
|
|
123
|
+
/**
|
|
124
|
+
* Application-scoped remote (EDGE) process manager, providing the progress meter's cancel control.
|
|
125
|
+
* Uses the EDGE implementation whenever an edge service is configured — cancel is addressed by trigger
|
|
126
|
+
* id + space, so it is not space-scoped — otherwise a read-only no-op. Resolved by the progress trace
|
|
127
|
+
* sink to route an edge-run trigger's cancel; the aggregate {@link TriggerMonitor} view is unaffected.
|
|
128
|
+
*/
|
|
129
|
+
var RemoteProcessManagerSpec = LayerSpec.make({
|
|
130
|
+
affinity: "application",
|
|
131
|
+
requires: [ClientService, Registry$1.AtomRegistry],
|
|
132
|
+
provides: [RemoteProcessManager.Service]
|
|
133
|
+
}, () => Layer.unwrapEffect(Effect.gen(function* () {
|
|
134
|
+
const client = yield* ClientService;
|
|
135
|
+
return client.config.values.runtime?.services?.edge?.url ? EdgeProcessManager.fromClient(client) : RemoteProcessManager.layerNoop;
|
|
136
|
+
})));
|
|
137
|
+
var TriggerDispatcherSpec = LayerSpec.make({
|
|
138
|
+
affinity: "space",
|
|
139
|
+
requires: [
|
|
140
|
+
Database.Service,
|
|
141
|
+
TriggerStateStore,
|
|
142
|
+
ProcessManager.ProcessManagerService,
|
|
143
|
+
Registry$1.AtomRegistry
|
|
144
|
+
],
|
|
145
|
+
provides: [TriggerDispatcher]
|
|
146
|
+
}, () => TriggerDispatcher.layer({ timeControl: "natural" }));
|
|
147
|
+
/**
|
|
148
|
+
* Aggregate {@link Trigger.TriggerMonitorService} over the local
|
|
149
|
+
* {@link TriggerDispatcher} and the remote {@link RemoteTriggerManager.Service}.
|
|
150
|
+
* Provides a unified view of trigger state across local and edge environments.
|
|
151
|
+
*/
|
|
152
|
+
var TriggerMonitorSpec = LayerSpec.make({
|
|
153
|
+
affinity: "space",
|
|
154
|
+
requires: [
|
|
155
|
+
TriggerDispatcher,
|
|
156
|
+
Database.Service,
|
|
157
|
+
Registry$1.AtomRegistry,
|
|
158
|
+
RemoteTriggerManager.Service
|
|
159
|
+
],
|
|
160
|
+
provides: [Trigger.TriggerMonitorService]
|
|
161
|
+
}, () => TriggerMonitor.layer);
|
|
162
|
+
var layer_specs_default = Capability.makeModule(() => Effect.succeed([
|
|
163
|
+
Capability.contributes(Capabilities.LayerSpec, OperationHandlerProviderSpec),
|
|
164
|
+
Capability.contributes(Capabilities.LayerSpec, RegistrySpec),
|
|
165
|
+
Capability.contributes(Capabilities.LayerSpec, OpaqueToolkitSpec),
|
|
166
|
+
Capability.contributes(Capabilities.LayerSpec, OperationsToRegistrySpec),
|
|
167
|
+
Capability.contributes(Capabilities.LayerSpec, TriggerStateStoreSpec),
|
|
168
|
+
Capability.contributes(Capabilities.LayerSpec, FeedTraceSinkSpec),
|
|
169
|
+
Capability.contributes(Capabilities.LayerSpec, TriggerDispatcherSpec),
|
|
170
|
+
Capability.contributes(Capabilities.LayerSpec, RemoteTriggerManagerSpec),
|
|
171
|
+
Capability.contributes(Capabilities.LayerSpec, TriggerMonitorSpec),
|
|
172
|
+
Capability.contributes(Capabilities.LayerSpec, RemoteOperationInvokerSpec),
|
|
173
|
+
Capability.contributes(Capabilities.LayerSpec, RemoteProcessManagerSpec),
|
|
174
|
+
Capability.contributes(Capabilities.TraceSink, ({ resolver }) => FeedTraceSink.makeRoutingSink({ resolver }))
|
|
175
|
+
]));
|
|
176
|
+
//#endregion
|
|
177
|
+
export { layer_specs_default as default };
|
|
178
|
+
|
|
179
|
+
//# sourceMappingURL=chunk-layer-specs.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-layer-specs.mjs","names":[],"sources":["../../src/capabilities/layer-specs.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport { Registry as AtomRegistry } from '@effect-atom/atom';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\n\nimport { OpaqueToolkit } from '@dxos/ai';\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\nimport { ClientService } from '@dxos/client';\nimport { LayerSpec, Operation, OperationHandlerSet, Trigger } from '@dxos/compute';\nimport {\n FeedTraceSink,\n ProcessManager,\n RemoteOperationInvoker,\n RemoteProcessManager,\n RemoteTriggerManager,\n TriggerDispatcher,\n TriggerMonitor,\n TriggerStateStore,\n} from '@dxos/compute-runtime';\nimport { Database, Registry } from '@dxos/echo';\nimport { EdgeOperationInvoker, EdgeProcessManager, EdgeTriggerManager } from '@dxos/edge-compute';\nimport { invariant } from '@dxos/invariant';\n\n//\n// Capability Module\n//\n// Contributes application- and space-affinity `Capabilities.LayerSpec` entries\n// that together replace the former monolithic `RoutineCapabilities.ComputeRuntime`.\n//\n// Specs are declared at module level; runtime state (the `Client`, contributed\n// capability lists, etc.) is resolved via Effect-level requirements rather\n// than captured from an outer scope.\n//\n\n/**\n * Gathers contributed {@link Capabilities.OperationHandler} sets from the\n * {@link Capability.Service} and exposes them through the\n * {@link OperationHandlerSet.OperationHandlerProvider} tag so space-affinity\n * specs (e.g. {@link OperationsToRegistrySpec}) can consume them through the\n * normal LayerStack resolution path.\n */\nconst OperationHandlerProviderSpec = LayerSpec.make(\n {\n affinity: 'application',\n requires: [Capability.Service],\n provides: [OperationHandlerSet.OperationHandlerProvider],\n },\n () =>\n Layer.unwrapEffect(\n Effect.gen(function* () {\n const operationHandlerSets = yield* Capability.getAll(Capabilities.OperationHandler);\n const mergedOperationHandlers =\n operationHandlerSets.length === 0\n ? OperationHandlerSet.empty\n : OperationHandlerSet.merge(...operationHandlerSets);\n return OperationHandlerSet.provide(mergedOperationHandlers);\n }),\n ),\n);\n\nconst RegistrySpec = LayerSpec.make(\n {\n affinity: 'application',\n requires: [ClientService],\n provides: [Registry.Service],\n },\n () =>\n Layer.unwrapEffect(\n Effect.gen(function* () {\n const client = yield* ClientService;\n return Layer.succeed(Registry.Service, client.graph.registry);\n }),\n ),\n);\n\nconst OpaqueToolkitSpec = LayerSpec.make(\n {\n affinity: 'application',\n requires: [Capability.Service],\n provides: [OpaqueToolkit.OpaqueToolkitProvider],\n },\n () =>\n Layer.unwrapEffect(\n Effect.gen(function* () {\n const capabilities = yield* Capability.Service;\n return Layer.succeed(OpaqueToolkit.OpaqueToolkitProvider, {\n getToolkit: () => {\n const toolkits = capabilities.getAll(AppCapabilities.Toolkit);\n return OpaqueToolkit.merge(...toolkits);\n },\n });\n }),\n ),\n);\n\nconst OperationsToRegistrySpec = LayerSpec.make(\n {\n affinity: 'space',\n requires: [Registry.Service, OperationHandlerSet.OperationHandlerProvider],\n provides: [Registry.Service],\n },\n () =>\n Layer.effect(\n Registry.Service,\n Effect.gen(function* () {\n const handlerSet = yield* OperationHandlerSet.OperationHandlerProvider;\n const registry = yield* Registry.Service;\n const handlers = yield* handlerSet.handlers;\n registry.add(handlers.map(Operation.serialize));\n return registry;\n }),\n ),\n);\n\n/**\n * In-memory trigger state. Loses state across restarts but works in both\n * browser and CLI/Node contexts. Hosts that need durable storage should\n * contribute a replacement LayerSpec that provides {@link TriggerStateStore}\n * backed by a persistent `KeyValueStore` (e.g. `BrowserKeyValueStore` or\n * `BunKeyValueStore`).\n */\nconst TriggerStateStoreSpec = LayerSpec.make(\n {\n affinity: 'application',\n requires: [],\n provides: [TriggerStateStore],\n },\n () => TriggerStateStore.layerMemory,\n);\n\n//\n// Space-affinity specs.\n//\n\nconst FeedTraceSinkSpec = LayerSpec.make(\n {\n affinity: 'space',\n requires: [Database.Service],\n provides: [FeedTraceSink.FeedTraceSink],\n },\n () => FeedTraceSink.layerLive,\n);\n\n/**\n * Space-scoped remote operation invoker (EDGE). When edge agents are enabled\n * (`runtime.client.edgeFeatures.agents`) operations are invoked without a space\n * binding (the edge routes them); otherwise they are scoped to the space. The\n * config is read inside the factory — at slice-materialisation time, once\n * `ClientService` is available — so the owning module does not need the client\n * at activation time and can activate on `SetupProcessManager`.\n */\nconst RemoteOperationInvokerSpec = LayerSpec.make(\n {\n affinity: 'space',\n requires: [ClientService],\n provides: [RemoteOperationInvoker.Service],\n },\n (context) =>\n Layer.unwrapEffect(\n Effect.gen(function* () {\n invariant(context.space, 'space context required for RemoteOperationInvoker');\n const client = yield* ClientService;\n const edgeAgents = client.config.get('runtime.client.edgeFeatures.agents');\n return EdgeOperationInvoker.fromClient(client, edgeAgents ? undefined : context.space);\n }),\n ),\n);\n\n/**\n * Space-scoped remote (EDGE) trigger manager, consumed by the aggregate\n * {@link TriggerMonitor}. Uses the EDGE implementation whenever an edge service\n * is configured (a trigger is routed here by its own `remote` flag, so the\n * manager should exist wherever edge is reachable), otherwise a no-op.\n */\nconst RemoteTriggerManagerSpec = LayerSpec.make(\n {\n affinity: 'space',\n requires: [ClientService, AtomRegistry.AtomRegistry],\n provides: [RemoteTriggerManager.Service],\n },\n (context) =>\n Layer.unwrapEffect(\n Effect.gen(function* () {\n invariant(context.space, 'space context required for RemoteTriggerManager');\n const client = yield* ClientService;\n const edgeUrl = client.config.values.runtime?.services?.edge?.url;\n return edgeUrl ? EdgeTriggerManager.fromClient(client, context.space) : RemoteTriggerManager.layerNoop;\n }),\n ),\n);\n\n/**\n * Application-scoped remote (EDGE) process manager, providing the progress meter's cancel control.\n * Uses the EDGE implementation whenever an edge service is configured — cancel is addressed by trigger\n * id + space, so it is not space-scoped — otherwise a read-only no-op. Resolved by the progress trace\n * sink to route an edge-run trigger's cancel; the aggregate {@link TriggerMonitor} view is unaffected.\n */\nconst RemoteProcessManagerSpec = LayerSpec.make(\n {\n affinity: 'application',\n requires: [ClientService, AtomRegistry.AtomRegistry],\n provides: [RemoteProcessManager.Service],\n },\n () =>\n Layer.unwrapEffect(\n Effect.gen(function* () {\n const client = yield* ClientService;\n const edgeUrl = client.config.values.runtime?.services?.edge?.url;\n return edgeUrl ? EdgeProcessManager.fromClient(client) : RemoteProcessManager.layerNoop;\n }),\n ),\n);\n\nconst TriggerDispatcherSpec = LayerSpec.make(\n {\n affinity: 'space',\n requires: [Database.Service, TriggerStateStore, ProcessManager.ProcessManagerService, AtomRegistry.AtomRegistry],\n provides: [TriggerDispatcher],\n },\n () => TriggerDispatcher.layer({ timeControl: 'natural' }),\n);\n\n/**\n * Aggregate {@link Trigger.TriggerMonitorService} over the local\n * {@link TriggerDispatcher} and the remote {@link RemoteTriggerManager.Service}.\n * Provides a unified view of trigger state across local and edge environments.\n */\nconst TriggerMonitorSpec = LayerSpec.make(\n {\n affinity: 'space',\n requires: [TriggerDispatcher, Database.Service, AtomRegistry.AtomRegistry, RemoteTriggerManager.Service],\n provides: [Trigger.TriggerMonitorService],\n },\n () => TriggerMonitor.layer,\n);\n\nexport default Capability.makeModule(() =>\n Effect.succeed([\n Capability.contributes(Capabilities.LayerSpec, OperationHandlerProviderSpec),\n Capability.contributes(Capabilities.LayerSpec, RegistrySpec),\n Capability.contributes(Capabilities.LayerSpec, OpaqueToolkitSpec),\n Capability.contributes(Capabilities.LayerSpec, OperationsToRegistrySpec),\n Capability.contributes(Capabilities.LayerSpec, TriggerStateStoreSpec),\n Capability.contributes(Capabilities.LayerSpec, FeedTraceSinkSpec),\n Capability.contributes(Capabilities.LayerSpec, TriggerDispatcherSpec),\n Capability.contributes(Capabilities.LayerSpec, RemoteTriggerManagerSpec),\n Capability.contributes(Capabilities.LayerSpec, TriggerMonitorSpec),\n Capability.contributes(Capabilities.LayerSpec, RemoteOperationInvokerSpec),\n Capability.contributes(Capabilities.LayerSpec, RemoteProcessManagerSpec),\n Capability.contributes(Capabilities.TraceSink, ({ resolver }) => FeedTraceSink.makeRoutingSink({ resolver })),\n ]),\n);\n"],"mappings":"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"}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
// src/meta.ts
|
|
2
1
|
import { Plugin } from "@dxos/app-framework";
|
|
3
|
-
|
|
4
|
-
// dx.config.ts
|
|
5
2
|
import { Config2 } from "@dxos/app-framework/config";
|
|
6
3
|
import { trim } from "@dxos/util";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
//#region dx.config.ts
|
|
5
|
+
var dx_config_default = Config2.make({ plugin: {
|
|
6
|
+
key: "org.dxos.plugin.routine",
|
|
7
|
+
name: "Routine",
|
|
8
|
+
author: "DXOS",
|
|
9
|
+
description: trim`
|
|
13
10
|
Event-driven workflow automation engine for DXOS Composer.
|
|
14
11
|
A Routine pairs a trigger ("when" — a timer schedule or an incoming feed) with an action
|
|
15
12
|
("then" — a persistent compute operation and instructions), enabling automated pipelines that
|
|
@@ -17,28 +14,23 @@ var dx_config_default = Config2.make({
|
|
|
17
14
|
|
|
18
15
|
Routines are configured in their own article and surfaced on a per-object "Routines" companion
|
|
19
16
|
that lists the routines connected to each object. A per-space TriggerDispatcher manages
|
|
20
|
-
execution: running locally in the browser
|
|
21
|
-
the
|
|
17
|
+
execution: running each trigger locally in the browser, or delegating it to the DXOS edge for
|
|
18
|
+
server-side reliability when the trigger's "remote" flag is set; the space settings page toggles
|
|
19
|
+
trigger execution for the whole space.
|
|
22
20
|
|
|
23
21
|
Operation handlers and skills contributed by any plugin in the application are
|
|
24
22
|
automatically merged and made available to every space's OperationRegistry, so new
|
|
25
23
|
capabilities registered by other plugins become instantly invocable from routines.
|
|
26
24
|
`,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
// src/meta.ts
|
|
25
|
+
icon: { key: "ph--atom--regular" },
|
|
26
|
+
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-routine",
|
|
27
|
+
spec: "PLUGIN.mdl",
|
|
28
|
+
tags: ["system"]
|
|
29
|
+
} });
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/meta.ts
|
|
39
32
|
var meta = Plugin.getMetaFromConfig(dx_config_default);
|
|
33
|
+
//#endregion
|
|
34
|
+
export { meta as t };
|
|
40
35
|
|
|
41
|
-
|
|
42
|
-
meta
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=chunk-HLO4LYXT.mjs.map
|
|
36
|
+
//# sourceMappingURL=chunk-meta.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-meta.mjs","names":[],"sources":["../../dx.config.ts","../../src/meta.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Config2 } from '@dxos/app-framework/config';\nimport { trim } from '@dxos/util';\n\nexport default Config2.make({\n plugin: {\n key: 'org.dxos.plugin.routine',\n name: 'Routine',\n author: 'DXOS',\n description: trim`\n Event-driven workflow automation engine for DXOS Composer.\n A Routine pairs a trigger (\"when\" — a timer schedule or an incoming feed) with an action\n (\"then\" — a persistent compute operation and instructions), enabling automated pipelines that\n react to changes in real time without manual intervention.\n\n Routines are configured in their own article and surfaced on a per-object \"Routines\" companion\n that lists the routines connected to each object. A per-space TriggerDispatcher manages\n execution: running each trigger locally in the browser, or delegating it to the DXOS edge for\n server-side reliability when the trigger's \"remote\" flag is set; the space settings page toggles\n trigger execution for the whole space.\n\n Operation handlers and skills contributed by any plugin in the application are\n automatically merged and made available to every space's OperationRegistry, so new\n capabilities registered by other plugins become instantly invocable from routines.\n `,\n icon: { key: 'ph--atom--regular' },\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-routine',\n spec: 'PLUGIN.mdl',\n tags: ['system'],\n },\n});\n","//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\n\nimport config from '../dx.config';\n\nexport const meta = Plugin.getMetaFromConfig(config);\n"],"mappings":";;;;AAOA,IAAA,oBAAe,QAAQ,KAAK,EAC1B,QAAQ;CACN,KAAK;CACL,MAAM;CACN,QAAQ;CACR,aAAa,IAAI;;;;;;;;;;;;;;;;CAgBjB,MAAM,EAAE,KAAK,oBAAoB;CACjC,QAAQ;CACR,MAAM;CACN,MAAM,CAAC,QAAQ;AACjB,EACF,CAAC;;;ACzBD,IAAa,OAAO,OAAO,kBAAkB,iBAAM"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { RoutineOperationHandlerSet } from "#operations";
|
|
4
|
+
//#region src/capabilities/operation-handler.ts
|
|
5
|
+
var operation_handler_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
6
|
+
return Capability.contributes(Capabilities.OperationHandler, RoutineOperationHandlerSet);
|
|
7
|
+
}));
|
|
8
|
+
//#endregion
|
|
9
|
+
export { operation_handler_default as default };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=chunk-operation-handler.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-operation-handler.mjs","names":[],"sources":["../../src/capabilities/operation-handler.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport type { OperationHandlerSet } from '@dxos/compute';\n\nimport { RoutineOperationHandlerSet } from '#operations';\n\nexport default Capability.makeModule<OperationHandlerSet.OperationHandlerSet>(\n Effect.fnUntraced(function* () {\n return Capability.contributes(Capabilities.OperationHandler, RoutineOperationHandlerSet);\n }),\n);\n"],"mappings":";;;;AAWA,IAAA,4BAAe,WAAW,WACxB,OAAO,WAAW,aAAa;CAC7B,OAAO,WAAW,YAAY,aAAa,kBAAkB,0BAA0B;AACzF,CAAC,CACH"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GraphPath } from "@dxos/app-toolkit";
|
|
2
|
+
import { Routine } from "@dxos/compute";
|
|
3
|
+
import { meta } from "#meta";
|
|
4
|
+
//#region src/paths.ts
|
|
5
|
+
var { getSectionPath: getRoutinesPath } = GraphPath.createTypeSectionPaths(Routine.Routine, { groupId: GraphPath.GroupSegments.ai });
|
|
6
|
+
/** Path to the routines settings section for a given space. */
|
|
7
|
+
var getRoutinesSettingsPath = (spaceId) => GraphPath.getSpacePath(spaceId, "settings", `${meta.profile.key}.routines`);
|
|
8
|
+
//#endregion
|
|
9
|
+
export { getRoutinesSettingsPath as n, getRoutinesPath as t };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=chunk-paths.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-paths.mjs","names":[],"sources":["../../src/paths.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport { GraphPath } from '@dxos/app-toolkit';\nimport { Routine } from '@dxos/compute';\n\nimport { meta } from '#meta';\n\nconst { getSectionPath: getRoutinesPath } = GraphPath.createTypeSectionPaths(Routine.Routine, {\n groupId: GraphPath.GroupSegments.ai,\n});\n\n/** Path to the routines settings section for a given space. */\nexport const getRoutinesSettingsPath = (spaceId: string): string =>\n GraphPath.getSpacePath(spaceId, 'settings', `${meta.profile.key}.routines`);\n\nexport { getRoutinesPath };\n"],"mappings":";;;;AASA,IAAM,EAAE,gBAAgB,oBAAoB,UAAU,uBAAuB,QAAQ,SAAS,EAC5F,SAAS,UAAU,cAAc,GACnC,CAAC;;AAGD,IAAa,2BAA2B,YACtC,UAAU,aAAa,SAAS,YAAY,GAAG,KAAK,QAAQ,IAAI,UAAU"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
2
|
+
import { Routine, Skill } from "@dxos/compute";
|
|
3
|
+
import { meta } from "#meta";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import { Surface } from "@dxos/app-framework/ui";
|
|
6
|
+
import { RoutineCard } from "#components";
|
|
7
|
+
import { AppSurface } from "@dxos/app-toolkit/ui";
|
|
8
|
+
import { RoutineArticle, RoutineCompanion, RoutineSettings, RoutineTraceCompanion, SkillArticle } from "#containers";
|
|
9
|
+
//#region src/capabilities/react-surface.ts
|
|
10
|
+
var react_surface_default = Capability.makeModule(() => Effect.succeed(Capability.contributes(Capabilities.ReactSurface, [
|
|
11
|
+
Surface.create({
|
|
12
|
+
id: "spaceSettingsAutomation",
|
|
13
|
+
filter: AppSurface.literal(AppSurface.Article, `${meta.profile.key}.space-settings-automation`),
|
|
14
|
+
component: RoutineSettings
|
|
15
|
+
}),
|
|
16
|
+
Surface.create({
|
|
17
|
+
id: "automation.article",
|
|
18
|
+
filter: AppSurface.object(AppSurface.Article, Routine.Routine),
|
|
19
|
+
component: RoutineArticle,
|
|
20
|
+
props: ({ role, data: { subject, attendableId } }) => ({
|
|
21
|
+
role,
|
|
22
|
+
subject,
|
|
23
|
+
attendableId
|
|
24
|
+
})
|
|
25
|
+
}),
|
|
26
|
+
Surface.create({
|
|
27
|
+
id: "routine.card",
|
|
28
|
+
filter: AppSurface.object(AppSurface.CardContent, Routine.Routine),
|
|
29
|
+
component: RoutineCard,
|
|
30
|
+
props: ({ data: { subject } }) => ({ subject })
|
|
31
|
+
}),
|
|
32
|
+
Surface.create({
|
|
33
|
+
id: "companion.automation",
|
|
34
|
+
filter: AppSurface.allOf(AppSurface.literal(AppSurface.Article, "automation"), AppSurface.companion(AppSurface.Article)),
|
|
35
|
+
component: RoutineCompanion,
|
|
36
|
+
props: ({ data: { attendableId, companionTo } }) => ({
|
|
37
|
+
attendableId,
|
|
38
|
+
subject: companionTo
|
|
39
|
+
})
|
|
40
|
+
}),
|
|
41
|
+
Surface.create({
|
|
42
|
+
id: "routine.runs",
|
|
43
|
+
filter: AppSurface.allOf(AppSurface.literal(AppSurface.Article, "runs"), AppSurface.companion(AppSurface.Article, Routine.Routine)),
|
|
44
|
+
component: RoutineTraceCompanion,
|
|
45
|
+
props: ({ role, data: { companionTo } }) => ({
|
|
46
|
+
role,
|
|
47
|
+
subject: companionTo
|
|
48
|
+
})
|
|
49
|
+
}),
|
|
50
|
+
Surface.create({
|
|
51
|
+
id: "skill",
|
|
52
|
+
filter: AppSurface.object(AppSurface.Article, Skill.Skill),
|
|
53
|
+
component: SkillArticle,
|
|
54
|
+
props: ({ role, data: { subject, attendableId } }) => ({
|
|
55
|
+
role,
|
|
56
|
+
subject,
|
|
57
|
+
attendableId
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
])));
|
|
61
|
+
//#endregion
|
|
62
|
+
export { react_surface_default as default };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=chunk-react-surface.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-react-surface.mjs","names":[],"sources":["../../src/capabilities/react-surface.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { Surface } from '@dxos/app-framework/ui';\nimport { AppSurface } from '@dxos/app-toolkit/ui';\nimport { Routine, Skill } from '@dxos/compute';\n\nimport { RoutineCard } from '#components';\nimport { RoutineArticle, RoutineCompanion, RoutineSettings, RoutineTraceCompanion, SkillArticle } from '#containers';\nimport { meta } from '#meta';\n\nexport default Capability.makeModule(() =>\n Effect.succeed(\n Capability.contributes(Capabilities.ReactSurface, [\n Surface.create({\n id: 'spaceSettingsAutomation',\n filter: AppSurface.literal(AppSurface.Article, `${meta.profile.key}.space-settings-automation`),\n component: RoutineSettings,\n }),\n Surface.create({\n id: 'automation.article',\n filter: AppSurface.object(AppSurface.Article, Routine.Routine),\n component: RoutineArticle,\n props: ({ role, data: { subject, attendableId } }) => ({ role, subject, attendableId }),\n }),\n Surface.create({\n id: 'routine.card',\n filter: AppSurface.object(AppSurface.CardContent, Routine.Routine),\n component: RoutineCard,\n props: ({ data: { subject } }) => ({ subject }),\n }),\n Surface.create({\n id: 'companion.automation',\n filter: AppSurface.allOf(\n AppSurface.literal(AppSurface.Article, 'automation'),\n AppSurface.companion(AppSurface.Article),\n ),\n component: RoutineCompanion,\n props: ({ data: { attendableId, companionTo } }) => ({ attendableId, subject: companionTo }),\n }),\n Surface.create({\n id: 'routine.runs',\n filter: AppSurface.allOf(\n AppSurface.literal(AppSurface.Article, 'runs'),\n AppSurface.companion(AppSurface.Article, Routine.Routine),\n ),\n component: RoutineTraceCompanion,\n props: ({ role, data: { companionTo } }) => ({ role, subject: companionTo }),\n }),\n Surface.create({\n id: 'skill',\n filter: AppSurface.object(AppSurface.Article, Skill.Skill),\n component: SkillArticle,\n props: ({ role, data: { subject, attendableId } }) => ({ role, subject, attendableId }),\n }),\n ]),\n ),\n);\n"],"mappings":";;;;;;;;;AAeA,IAAA,wBAAe,WAAW,iBACxB,OAAO,QACL,WAAW,YAAY,aAAa,cAAc;CAChD,QAAQ,OAAO;EACb,IAAI;EACJ,QAAQ,WAAW,QAAQ,WAAW,SAAS,GAAG,KAAK,QAAQ,IAAI,2BAA2B;EAC9F,WAAW;CACb,CAAC;CACD,QAAQ,OAAO;EACb,IAAI;EACJ,QAAQ,WAAW,OAAO,WAAW,SAAS,QAAQ,OAAO;EAC7D,WAAW;EACX,QAAQ,EAAE,MAAM,MAAM,EAAE,SAAS,sBAAsB;GAAE;GAAM;GAAS;EAAa;CACvF,CAAC;CACD,QAAQ,OAAO;EACb,IAAI;EACJ,QAAQ,WAAW,OAAO,WAAW,aAAa,QAAQ,OAAO;EACjE,WAAW;EACX,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,QAAQ;CAC/C,CAAC;CACD,QAAQ,OAAO;EACb,IAAI;EACJ,QAAQ,WAAW,MACjB,WAAW,QAAQ,WAAW,SAAS,YAAY,GACnD,WAAW,UAAU,WAAW,OAAO,CACzC;EACA,WAAW;EACX,QAAQ,EAAE,MAAM,EAAE,cAAc,qBAAqB;GAAE;GAAc,SAAS;EAAY;CAC5F,CAAC;CACD,QAAQ,OAAO;EACb,IAAI;EACJ,QAAQ,WAAW,MACjB,WAAW,QAAQ,WAAW,SAAS,MAAM,GAC7C,WAAW,UAAU,WAAW,SAAS,QAAQ,OAAO,CAC1D;EACA,WAAW;EACX,QAAQ,EAAE,MAAM,MAAM,EAAE,qBAAqB;GAAE;GAAM,SAAS;EAAY;CAC5E,CAAC;CACD,QAAQ,OAAO;EACb,IAAI;EACJ,QAAQ,WAAW,OAAO,WAAW,SAAS,MAAM,KAAK;EACzD,WAAW;EACX,QAAQ,EAAE,MAAM,MAAM,EAAE,SAAS,sBAAsB;GAAE;GAAM;GAAS;EAAa;CACvF,CAAC;AACH,CAAC,CACH,CACF"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
2
|
+
import { AppCapabilities } from "@dxos/app-toolkit";
|
|
3
|
+
import { Operation } from "@dxos/compute";
|
|
4
|
+
import { ClientCapabilities } from "@dxos/plugin-client";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
|
+
import { log } from "@dxos/log";
|
|
7
|
+
//#region src/capabilities/registry-sync.ts
|
|
8
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-routine/src/capabilities/registry-sync.ts";
|
|
9
|
+
/**
|
|
10
|
+
* Syncs plugin capability contributions into `client.graph.registry`.
|
|
11
|
+
*
|
|
12
|
+
* Watches two capability atoms and imperatively adds entities to the
|
|
13
|
+
* hypergraph registry when they change:
|
|
14
|
+
* - {@link AppCapabilities.SkillDefinition} → instantiates each skill via `def.make()`.
|
|
15
|
+
* - {@link Capabilities.OperationHandler} → serializes each handler via `Operation.serialize`.
|
|
16
|
+
*
|
|
17
|
+
* Skill DB copies (stored in a space when a skill is "enabled") are treated as
|
|
18
|
+
* user forks and are not overwritten. The registry is always used as the source of truth
|
|
19
|
+
* for skill instructions at request time — see `formatSystemPrompt` in `@dxos/assistant`.
|
|
20
|
+
*
|
|
21
|
+
* Note: the plugin framework does not yet expose a teardown hook for capability
|
|
22
|
+
* modules (see the TODO in process-manager-capability.ts), so the subscriptions
|
|
23
|
+
* are not explicitly cancelled. They are effectively scoped to the client's lifetime.
|
|
24
|
+
*/
|
|
25
|
+
var registry_sync_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
26
|
+
const client = yield* Capability.get(ClientCapabilities.Client);
|
|
27
|
+
const atomRegistry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
28
|
+
const capabilityManager = yield* Capability.Service;
|
|
29
|
+
const skillDefinitionsAtom = capabilityManager.atom(AppCapabilities.SkillDefinition);
|
|
30
|
+
const prevSkillKeys = /* @__PURE__ */ new Set();
|
|
31
|
+
atomRegistry.subscribe(skillDefinitionsAtom, (definitions) => {
|
|
32
|
+
const fresh = [];
|
|
33
|
+
for (const def of definitions) if (!prevSkillKeys.has(def.key)) {
|
|
34
|
+
prevSkillKeys.add(def.key);
|
|
35
|
+
fresh.push(def.make());
|
|
36
|
+
}
|
|
37
|
+
if (fresh.length > 0) client.graph.registry.add(fresh);
|
|
38
|
+
}, { immediate: true });
|
|
39
|
+
const operationHandlersAtom = capabilityManager.atom(Capabilities.OperationHandler);
|
|
40
|
+
const prevOperationKeys = /* @__PURE__ */ new Set();
|
|
41
|
+
atomRegistry.subscribe(operationHandlersAtom, async (handlerSets) => {
|
|
42
|
+
try {
|
|
43
|
+
const handlers = (await Promise.all(handlerSets.map((set) => set.getHandlers()))).flat();
|
|
44
|
+
const seenKeys = /* @__PURE__ */ new Set();
|
|
45
|
+
const batch = [];
|
|
46
|
+
for (const handler of handlers) {
|
|
47
|
+
const key = handler.meta.key;
|
|
48
|
+
if (!key) {
|
|
49
|
+
log.warn("skipping operation handler without key", void 0, {
|
|
50
|
+
"~LogMeta": "~LogMeta",
|
|
51
|
+
F: __dxlog_file,
|
|
52
|
+
L: 76,
|
|
53
|
+
S: this
|
|
54
|
+
});
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (seenKeys.has(key)) {
|
|
58
|
+
log("skipping duplicate operation", { key }, {
|
|
59
|
+
"~LogMeta": "~LogMeta",
|
|
60
|
+
F: __dxlog_file,
|
|
61
|
+
L: 80,
|
|
62
|
+
S: this
|
|
63
|
+
});
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
seenKeys.add(key);
|
|
67
|
+
if (prevOperationKeys.has(key)) continue;
|
|
68
|
+
if (handler.meta.skipRegistry) {
|
|
69
|
+
prevOperationKeys.add(key);
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
batch.push(Operation.serialize(handler));
|
|
74
|
+
} catch {
|
|
75
|
+
log.verbose("skipping operation with unserializable schema", { key }, {
|
|
76
|
+
"~LogMeta": "~LogMeta",
|
|
77
|
+
F: __dxlog_file,
|
|
78
|
+
L: 94,
|
|
79
|
+
S: this
|
|
80
|
+
});
|
|
81
|
+
prevOperationKeys.add(key);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (batch.length > 0) {
|
|
85
|
+
client.graph.registry.add(batch);
|
|
86
|
+
for (const operation of batch) {
|
|
87
|
+
const operationKey = Operation.getKey(operation);
|
|
88
|
+
if (operationKey) prevOperationKeys.add(operationKey);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
} catch (error) {
|
|
92
|
+
log.catch(error, void 0, {
|
|
93
|
+
"~LogMeta": "~LogMeta",
|
|
94
|
+
F: __dxlog_file,
|
|
95
|
+
L: 108,
|
|
96
|
+
S: this
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}, { immediate: true });
|
|
100
|
+
}));
|
|
101
|
+
//#endregion
|
|
102
|
+
export { registry_sync_default as default };
|
|
103
|
+
|
|
104
|
+
//# sourceMappingURL=chunk-registry-sync.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-registry-sync.mjs","names":[],"sources":["../../src/capabilities/registry-sync.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\nimport { Operation, Skill } from '@dxos/compute';\nimport { log } from '@dxos/log';\nimport { ClientCapabilities } from '@dxos/plugin-client';\n\n/**\n * Syncs plugin capability contributions into `client.graph.registry`.\n *\n * Watches two capability atoms and imperatively adds entities to the\n * hypergraph registry when they change:\n * - {@link AppCapabilities.SkillDefinition} → instantiates each skill via `def.make()`.\n * - {@link Capabilities.OperationHandler} → serializes each handler via `Operation.serialize`.\n *\n * Skill DB copies (stored in a space when a skill is \"enabled\") are treated as\n * user forks and are not overwritten. The registry is always used as the source of truth\n * for skill instructions at request time — see `formatSystemPrompt` in `@dxos/assistant`.\n *\n * Note: the plugin framework does not yet expose a teardown hook for capability\n * modules (see the TODO in process-manager-capability.ts), so the subscriptions\n * are not explicitly cancelled. They are effectively scoped to the client's lifetime.\n */\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const client = yield* Capability.get(ClientCapabilities.Client);\n const atomRegistry = yield* Capability.get(Capabilities.AtomRegistry);\n const capabilityManager = yield* Capability.Service;\n\n //\n // Skill registration.\n //\n\n const skillDefinitionsAtom = capabilityManager.atom(AppCapabilities.SkillDefinition);\n const prevSkillKeys = new Set<string>();\n\n atomRegistry.subscribe(\n skillDefinitionsAtom,\n (definitions) => {\n const fresh: Skill.Skill[] = [];\n for (const def of definitions) {\n if (!prevSkillKeys.has(def.key)) {\n prevSkillKeys.add(def.key);\n fresh.push(def.make());\n }\n }\n if (fresh.length > 0) {\n client.graph.registry.add(fresh);\n }\n },\n { immediate: true },\n );\n\n //\n // Operation registration.\n //\n\n const operationHandlersAtom = capabilityManager.atom(Capabilities.OperationHandler);\n const prevOperationKeys = new Set<string>();\n\n atomRegistry.subscribe(\n operationHandlersAtom,\n async (handlerSets) => {\n try {\n const handlers = (await Promise.all(handlerSets.map((set) => set.getHandlers()))).flat();\n const seenKeys = new Set<string>();\n const batch: Operation.PersistentOperation[] = [];\n for (const handler of handlers) {\n const key = handler.meta.key;\n if (!key) {\n log.warn('skipping operation handler without key');\n continue;\n }\n if (seenKeys.has(key)) {\n log('skipping duplicate operation', { key });\n continue;\n }\n seenKeys.add(key);\n if (prevOperationKeys.has(key)) {\n continue;\n }\n if (handler.meta.skipRegistry) {\n prevOperationKeys.add(key);\n continue;\n }\n try {\n batch.push(Operation.serialize(handler));\n } catch {\n log.verbose('skipping operation with unserializable schema', { key });\n prevOperationKeys.add(key);\n }\n }\n if (batch.length > 0) {\n client.graph.registry.add(batch);\n for (const operation of batch) {\n const operationKey = Operation.getKey(operation);\n if (operationKey) {\n prevOperationKeys.add(operationKey);\n }\n }\n }\n } catch (error) {\n log.catch(error);\n }\n },\n { immediate: true },\n );\n }),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAA,wBAAe,WAAW,WACxB,OAAO,WAAW,aAAa;CAC7B,MAAM,SAAS,OAAO,WAAW,IAAI,mBAAmB,MAAM;CAC9D,MAAM,eAAe,OAAO,WAAW,IAAI,aAAa,YAAY;CACpE,MAAM,oBAAoB,OAAO,WAAW;CAM5C,MAAM,uBAAuB,kBAAkB,KAAK,gBAAgB,eAAe;CACnF,MAAM,gCAAgB,IAAI,IAAY;CAEtC,aAAa,UACX,uBACC,gBAAgB;EACf,MAAM,QAAuB,CAAC;EAC9B,KAAK,MAAM,OAAO,aAChB,IAAI,CAAC,cAAc,IAAI,IAAI,GAAG,GAAG;GAC/B,cAAc,IAAI,IAAI,GAAG;GACzB,MAAM,KAAK,IAAI,KAAK,CAAC;EACvB;EAEF,IAAI,MAAM,SAAS,GACjB,OAAO,MAAM,SAAS,IAAI,KAAK;CAEnC,GACA,EAAE,WAAW,KAAK,CACpB;CAMA,MAAM,wBAAwB,kBAAkB,KAAK,aAAa,gBAAgB;CAClF,MAAM,oCAAoB,IAAI,IAAY;CAE1C,aAAa,UACX,uBACA,OAAO,gBAAgB;EACrB,IAAI;GACF,MAAM,YAAY,MAAM,QAAQ,IAAI,YAAY,KAAK,QAAQ,IAAI,YAAY,CAAC,CAAC,EAAA,CAAG,KAAK;GACvF,MAAM,2BAAW,IAAI,IAAY;GACjC,MAAM,QAAyC,CAAC;GAChD,KAAK,MAAM,WAAW,UAAU;IAC9B,MAAM,MAAM,QAAQ,KAAK;IACzB,IAAI,CAAC,KAAK;KACR,IAAI,KAAK,0CAAuC,KAAA,GAAA;MAAA,YAAA;MAAA,GAAA;MAAA,GAAA;MAAA,GAAA;KAAA,CAAC;KACjD;IACF;IACA,IAAI,SAAS,IAAI,GAAG,GAAG;KACrB,IAAI,gCAAgC,EAAE,IAAI,GAAA;MAAA,YAAA;MAAA,GAAA;MAAA,GAAA;MAAA,GAAA;KAAA,CAAC;KAC3C;IACF;IACA,SAAS,IAAI,GAAG;IAChB,IAAI,kBAAkB,IAAI,GAAG,GAC3B;IAEF,IAAI,QAAQ,KAAK,cAAc;KAC7B,kBAAkB,IAAI,GAAG;KACzB;IACF;IACA,IAAI;KACF,MAAM,KAAK,UAAU,UAAU,OAAO,CAAC;IACzC,QAAQ;KACN,IAAI,QAAQ,iDAAiD,EAAE,IAAI,GAAA;MAAA,YAAA;MAAA,GAAA;MAAA,GAAA;MAAA,GAAA;KAAA,CAAC;KACpE,kBAAkB,IAAI,GAAG;IAC3B;GACF;GACA,IAAI,MAAM,SAAS,GAAG;IACpB,OAAO,MAAM,SAAS,IAAI,KAAK;IAC/B,KAAK,MAAM,aAAa,OAAO;KAC7B,MAAM,eAAe,UAAU,OAAO,SAAS;KAC/C,IAAI,cACF,kBAAkB,IAAI,YAAY;IAEtC;GACF;EACF,SAAS,OAAO;GACd,IAAI,MAAM,OAAI,KAAA,GAAA;IAAA,YAAA;IAAA,GAAA;IAAA,GAAA;IAAA,GAAA;GAAA,CAAC;EACjB;CACF,GACA,EAAE,WAAW,KAAK,CACpB;AACF,CAAC,CACH"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { i as RunRoutine } from "./chunk-types.mjs";
|
|
2
|
+
import { Operation, Trigger } from "@dxos/compute";
|
|
3
|
+
import { Database, Obj } from "@dxos/echo";
|
|
4
|
+
import { RunInstructions } from "@dxos/assistant-toolkit";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
|
+
import { invariant } from "@dxos/invariant";
|
|
7
|
+
import { createInvocationPayload } from "@dxos/compute-runtime";
|
|
8
|
+
//#region src/operations/run-routine.ts
|
|
9
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-routine/src/operations/run-routine.ts";
|
|
10
|
+
var handler = RunRoutine.pipe(Operation.withHandler(Effect.fnUntraced(function* ({ routine }) {
|
|
11
|
+
const routineObj = yield* Database.load(routine);
|
|
12
|
+
const db = Obj.getDatabase(routineObj);
|
|
13
|
+
invariant(db, "Routine is not attached to a database.", {
|
|
14
|
+
"~LogMeta": "~LogMeta",
|
|
15
|
+
F: __dxlog_file,
|
|
16
|
+
L: 23,
|
|
17
|
+
S: this,
|
|
18
|
+
A: ["db", "'Routine is not attached to a database.'"]
|
|
19
|
+
});
|
|
20
|
+
const trigger = routineObj.triggers[0] ? yield* Database.load(routineObj.triggers[0]) : void 0;
|
|
21
|
+
if (trigger?.remote === true) {
|
|
22
|
+
yield* (yield* Trigger.TriggerMonitorService).invokeTrigger({
|
|
23
|
+
trigger,
|
|
24
|
+
event: { tick: Date.now() }
|
|
25
|
+
});
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const spec = routineObj.spec;
|
|
29
|
+
if (spec?.kind === "instructions") {
|
|
30
|
+
yield* Operation.schedule(RunInstructions, {
|
|
31
|
+
instructions: spec.instructions,
|
|
32
|
+
input: {}
|
|
33
|
+
}, { spaceId: db.spaceId });
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
invariant(spec?.kind === "runnable", "Routine has no action to run.", {
|
|
37
|
+
"~LogMeta": "~LogMeta",
|
|
38
|
+
F: __dxlog_file,
|
|
39
|
+
L: 50,
|
|
40
|
+
S: this,
|
|
41
|
+
A: ["spec?.kind === 'runnable'", "'Routine has no action to run.'"]
|
|
42
|
+
});
|
|
43
|
+
const operation = yield* Database.load(spec.runnable);
|
|
44
|
+
invariant(Obj.instanceOf(Operation.PersistentOperation, operation), "Routine has no action to run.", {
|
|
45
|
+
"~LogMeta": "~LogMeta",
|
|
46
|
+
F: __dxlog_file,
|
|
47
|
+
L: 52,
|
|
48
|
+
S: this,
|
|
49
|
+
A: ["Obj.instanceOf(Operation.PersistentOperation, operation)", "'Routine has no action to run.'"]
|
|
50
|
+
});
|
|
51
|
+
const input = trigger ? createInvocationPayload(trigger, { tick: Date.now() }) : void 0;
|
|
52
|
+
yield* Operation.invoke(Operation.deserialize(operation), input);
|
|
53
|
+
})));
|
|
54
|
+
//#endregion
|
|
55
|
+
export { handler as default };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=chunk-run-routine.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-run-routine.mjs","names":[],"sources":["../../src/operations/run-routine.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { RunInstructions } from '@dxos/assistant-toolkit';\nimport { Operation, Trigger } from '@dxos/compute';\nimport { createInvocationPayload } from '@dxos/compute-runtime';\nimport { Database, Obj } from '@dxos/echo';\nimport { invariant } from '@dxos/invariant';\n\nimport { RoutineOperation } from '../types';\n\n// A routine's action is its `runnable`: either an Operation (invoked directly) or the routine's owned\n// Instructions object (run as a background process — the same path triggers use — without creating a new\n// Chat session object).\nconst handler: Operation.WithHandler<typeof RoutineOperation.RunRoutine> = RoutineOperation.RunRoutine.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* ({ routine }) {\n const routineObj = yield* Database.load(routine);\n const db = Obj.getDatabase(routineObj);\n invariant(db, 'Routine is not attached to a database.');\n // Triggers, not routines, carry the runnable's input binding (e.g. a sync routine's `binding`\n // cursor) and the `remote` flag, so a manual run goes through the first trigger — the one it is\n // also attributed to.\n const trigger = routineObj.triggers[0] ? yield* Database.load(routineObj.triggers[0]) : undefined;\n\n // An edge routine is registered only on the EDGE dispatcher, so running it means force-running that\n // trigger over HTTP; invoking the runnable here would silently run it on the client instead.\n if (trigger?.remote === true) {\n const monitor = yield* Trigger.TriggerMonitorService;\n yield* monitor.invokeTrigger({ trigger, event: { tick: Date.now() } });\n return;\n }\n\n // The action kind is explicit in `spec`; dispatch by kind rather than dereferencing to classify.\n const spec = routineObj.spec;\n if (spec?.kind === 'instructions') {\n // The instructions carry their own context objects and skills; RunInstructions binds them when it\n // executes. No Chat session object is created — the run appears in the process monitor only.\n yield* Operation.schedule(\n RunInstructions,\n { instructions: spec.instructions, input: {} },\n { spaceId: db.spaceId },\n );\n return;\n }\n\n invariant(spec?.kind === 'runnable', 'Routine has no action to run.');\n const operation = yield* Database.load(spec.runnable);\n invariant(Obj.instanceOf(Operation.PersistentOperation, operation), 'Routine has no action to run.');\n // Built by the dispatcher's own payload builder against a synthetic tick, so a manual run resolves\n // `{{event.*}}`/`{{trigger.*}}` templates exactly as a scheduled fire would.\n const input = trigger ? createInvocationPayload(trigger, { tick: Date.now() }) : undefined;\n yield* Operation.invoke(Operation.deserialize(operation), input);\n }),\n ),\n);\n\nexport default handler;\n"],"mappings":";;;;;;;;;AAiBA,IAAM,UAAA,WAAiG,KACrG,UAAU,YACR,OAAO,WAAW,WAAW,EAAE,WAAW;CACxC,MAAM,aAAa,OAAO,SAAS,KAAK,OAAO;CAC/C,MAAM,KAAK,IAAI,YAAY,UAAU;CACrC,UAAU,IAAI,0CAAuC;EAAA,YAAA;EAAA,GAAA;EAAA,GAAA;EAAA,GAAA;EAAA,GAAA,CAAA,MAAA,0CAAA;CAAA,CAAC;CAItD,MAAM,UAAU,WAAW,SAAS,KAAK,OAAO,SAAS,KAAK,WAAW,SAAS,EAAE,IAAI,KAAA;CAIxF,IAAI,SAAS,WAAW,MAAM;EAE5B,QAAO,OADgB,QAAQ,sBAAA,CAChB,cAAc;GAAE;GAAS,OAAO,EAAE,MAAM,KAAK,IAAI,EAAE;EAAE,CAAC;EACrE;CACF;CAGA,MAAM,OAAO,WAAW;CACxB,IAAI,MAAM,SAAS,gBAAgB;EAGjC,OAAO,UAAU,SACf,iBACA;GAAE,cAAc,KAAK;GAAc,OAAO,CAAC;EAAE,GAC7C,EAAE,SAAS,GAAG,QAAQ,CACxB;EACA;CACF;CAEA,UAAU,MAAM,SAAS,YAAY,iCAA8B;EAAA,YAAA;EAAA,GAAA;EAAA,GAAA;EAAA,GAAA;EAAA,GAAA,CAAA,6BAAA,iCAAA;CAAA,CAAC;CACpE,MAAM,YAAY,OAAO,SAAS,KAAK,KAAK,QAAQ;CACpD,UAAU,IAAI,WAAW,UAAU,qBAAqB,SAAS,GAAG,iCAA8B;EAAA,YAAA;EAAA,GAAA;EAAA,GAAA;EAAA,GAAA;EAAA,GAAA,CAAA,4DAAA,iCAAA;CAAA,CAAC;CAGnG,MAAM,QAAQ,UAAU,wBAAwB,SAAS,EAAE,MAAM,KAAK,IAAI,EAAE,CAAC,IAAI,KAAA;CACjF,OAAO,UAAU,OAAO,UAAU,YAAY,SAAS,GAAG,KAAK;AACjE,CAAC,CACH,CACF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { t as makeRoutine } from "./chunk-util.mjs";
|
|
2
|
+
import { Capability } from "@dxos/app-framework";
|
|
3
|
+
import { AppAnnotation } from "@dxos/app-toolkit";
|
|
4
|
+
import { Instructions, Skill, Trigger } from "@dxos/compute";
|
|
5
|
+
import { Obj, Ref, Type } from "@dxos/echo";
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
|
+
import * as Option from "effect/Option";
|
|
8
|
+
import { RoutineCapabilities } from "#types";
|
|
9
|
+
/** Templates contributed by plugin-routine itself. */
|
|
10
|
+
var defaultTemplates = [{
|
|
11
|
+
id: RoutineCapabilities.BlankTemplateId,
|
|
12
|
+
label: "Blank",
|
|
13
|
+
icon: "ph--lightning--regular",
|
|
14
|
+
scaffold: ({ name, subject }) => Effect.succeed(makeRoutine({
|
|
15
|
+
name,
|
|
16
|
+
instructions: Instructions.make({
|
|
17
|
+
skills: subject ? skillRefsForObject(subject) : [],
|
|
18
|
+
objects: subject ? [Ref.make(subject)] : void 0
|
|
19
|
+
}),
|
|
20
|
+
trigger: Trigger.make({})
|
|
21
|
+
}))
|
|
22
|
+
}];
|
|
23
|
+
/** Registry skill refs declared by the object type's {@link AppAnnotation.SkillsAnnotation}. */
|
|
24
|
+
var skillRefsForObject = (object) => {
|
|
25
|
+
const type = Obj.getType(object);
|
|
26
|
+
if (!type) return [];
|
|
27
|
+
return Option.getOrElse(() => [])(AppAnnotation.SkillsAnnotation.get(Type.getSchema(type))).map((key) => Ref.fromURI(Skill.registryURI(key)));
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/capabilities/templates.ts
|
|
31
|
+
var templates_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
32
|
+
return defaultTemplates.map((template) => Capability.contributes(RoutineCapabilities.Template, template));
|
|
33
|
+
}));
|
|
34
|
+
//#endregion
|
|
35
|
+
export { templates_default as default };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=chunk-templates.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-templates.mjs","names":[],"sources":["../../src/templates/index.ts","../../src/capabilities/templates.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\n\nimport { AppAnnotation } from '@dxos/app-toolkit';\nimport { Instructions, Skill, Trigger } from '@dxos/compute';\nimport { Obj, Ref, Type } from '@dxos/echo';\n\nimport { RoutineCapabilities } from '#types';\n\nimport { makeRoutine } from '../util';\n\n/**\n * Blank template: an instructions-action routine draft with an empty trigger; the action kind, schedule, and\n * body are configured in the form. In an object companion the instructions are seeded with the subject (in\n * `objects`) and its type's skills so the draft starts associated with the subject; the global create dialog\n * (no subject) starts with bare instructions.\n */\nexport const blank: RoutineCapabilities.Template = {\n id: RoutineCapabilities.BlankTemplateId,\n label: 'Blank',\n icon: 'ph--lightning--regular',\n scaffold: ({ name, subject }) =>\n Effect.succeed(\n makeRoutine({\n name,\n instructions: Instructions.make({\n skills: subject ? skillRefsForObject(subject) : [],\n objects: subject ? [Ref.make(subject)] : undefined,\n }),\n trigger: Trigger.make({}),\n }),\n ),\n};\n\n/** Templates contributed by plugin-routine itself. */\nexport const defaultTemplates: RoutineCapabilities.Template[] = [blank];\n\n/** Registry skill refs declared by the object type's {@link AppAnnotation.SkillsAnnotation}. */\nconst skillRefsForObject = (object: Obj.Unknown): Ref.Ref<Skill.Skill>[] => {\n const type = Obj.getType(object);\n if (!type) {\n return [];\n }\n const keys = Option.getOrElse(() => [] as string[])(AppAnnotation.SkillsAnnotation.get(Type.getSchema(type)));\n return keys.map((key) => Ref.fromURI(Skill.registryURI(key)));\n};\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\n\nimport { RoutineCapabilities } from '#types';\n\nimport { defaultTemplates } from '../templates';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n return defaultTemplates.map((template) => Capability.contributes(RoutineCapabilities.Template, template));\n }),\n);\n"],"mappings":";;;;;;;;;AAuCA,IAAa,mBAAmD,CAAC;CAjB/D,IAAI,oBAAoB;CACxB,OAAO;CACP,MAAM;CACN,WAAW,EAAE,MAAM,cACjB,OAAO,QACL,YAAY;EACV;EACA,cAAc,aAAa,KAAK;GAC9B,QAAQ,UAAU,mBAAmB,OAAO,IAAI,CAAC;GACjD,SAAS,UAAU,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,KAAA;EAC3C,CAAC;EACD,SAAS,QAAQ,KAAK,CAAC,CAAC;CAC1B,CAAC,CACH;AAI6D,CAAK;;AAGtE,IAAM,sBAAsB,WAAgD;CAC1E,MAAM,OAAO,IAAI,QAAQ,MAAM;CAC/B,IAAI,CAAC,MACH,OAAO,CAAC;CAGV,OADa,OAAO,gBAAgB,CAAC,CAAa,CAAC,CAAC,cAAc,iBAAiB,IAAI,KAAK,UAAU,IAAI,CAAC,CACpG,CAAA,CAAK,KAAK,QAAQ,IAAI,QAAQ,MAAM,YAAY,GAAG,CAAC,CAAC;AAC9D;;;ACrCA,IAAA,oBAAe,WAAW,WACxB,OAAO,WAAW,aAAa;CAC7B,OAAO,iBAAiB,KAAK,aAAa,WAAW,YAAY,oBAAoB,UAAU,QAAQ,CAAC;AAC1G,CAAC,CACH"}
|