@dxos/plugin-routine 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import * as Schema from 'effect/Schema';
|
|
2
|
-
import { Instructions, Runnable, Trigger } from '@dxos/compute';
|
|
3
|
-
import { Operation } from '@dxos/compute';
|
|
4
|
-
import { Obj, Ref, Type } from '@dxos/echo';
|
|
5
|
-
declare const Kinds: readonly ['runnable', 'instructions'];
|
|
6
|
-
export declare const Kind: Schema.Literal<["runnable", "instructions"]>;
|
|
7
|
-
export type Kind = (typeof Kinds)[number];
|
|
8
|
-
declare const Routine_base: Type.ObjClass<Routine, {
|
|
9
|
-
readonly name?: string | undefined;
|
|
10
|
-
readonly description?: string | undefined;
|
|
11
|
-
readonly spec?: {
|
|
12
|
-
readonly kind: "runnable";
|
|
13
|
-
readonly runnable: import("@dxos/echo/internal").Ref<Operation.PersistentOperation & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>;
|
|
14
|
-
} | {
|
|
15
|
-
readonly kind: "instructions";
|
|
16
|
-
readonly instructions: import("@dxos/echo/internal").Ref<Instructions.Instructions & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>;
|
|
17
|
-
} | undefined;
|
|
18
|
-
readonly triggers: readonly import("@dxos/echo/internal").Ref<Trigger.Trigger & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>[];
|
|
19
|
-
}, {}>;
|
|
20
|
-
/**
|
|
21
|
-
* User-facing routine: a thin aggregate of an action (`runnable`) and the triggers that fire it.
|
|
22
|
-
* App-level only — EDGE stays unaware of it (triggers point directly at the runnable).
|
|
23
|
-
*/
|
|
24
|
-
export declare class Routine extends Routine_base {
|
|
25
|
-
}
|
|
26
|
-
/** Returns true when value is a Routine object. */
|
|
27
|
-
export declare const instanceOf: (value: unknown) => value is Routine;
|
|
28
|
-
/**
|
|
29
|
-
* The owned Instructions ref of an instructions-action routine, or undefined for an operation action.
|
|
30
|
-
* Classification is explicit in `spec.kind`, so this needs no `.target` dereference; callers resolve the ref
|
|
31
|
-
* reactively (`useObject`) or asynchronously (`Database.load`) as appropriate.
|
|
32
|
-
*/
|
|
33
|
-
export declare const instructionsRef: (routine: Pick<Routine, 'spec'>) => Ref.Ref<Instructions.Instructions> | undefined;
|
|
34
|
-
/** The Operation (runnable) ref of an operation-action routine, or undefined for an instructions action. */
|
|
35
|
-
export declare const runnableRef: (routine: Pick<Routine, 'spec'>) => Ref.Ref<Runnable.Runnable> | undefined;
|
|
36
|
-
/**
|
|
37
|
-
* Wire the routine's owned triggers to dispatch its current action (`spec`): an instructions action sets each
|
|
38
|
-
* trigger's `runnable` to RunInstructions with the owned instructions bound into `input`; an operation action
|
|
39
|
-
* binds the operation directly and drops any stale instructions binding. Call after the action (`spec`) changes
|
|
40
|
-
* so a trigger never keeps a binding for the previous action.
|
|
41
|
-
*/
|
|
42
|
-
export declare const wireTriggers: (routine: Routine) => void;
|
|
43
|
-
/**
|
|
44
|
-
* Creates a fully-wired in-memory routine graph. `instructions` and `trigger` are optional extras beyond the
|
|
45
|
-
* schema fields: when provided they are parented under the routine and wired together (runnable, trigger
|
|
46
|
-
* runnable, the trigger's instructions input binding, and the `triggers` ref) so that a single `Database.add`
|
|
47
|
-
* cascades the whole graph. `triggers` defaults to `[]` so callers that supply a `trigger` need not provide it.
|
|
48
|
-
*/
|
|
49
|
-
export declare const make: ({ instructions, trigger, triggers, ...props }: Omit<Obj.MakeProps<typeof Routine>, 'triggers'> & {
|
|
50
|
-
triggers?: ReadonlyArray<Ref.Ref<Trigger.Trigger>>;
|
|
51
|
-
instructions?: Instructions.Instructions;
|
|
52
|
-
trigger?: Trigger.Trigger;
|
|
53
|
-
}) => Routine;
|
|
54
|
-
export {};
|
|
55
|
-
//# sourceMappingURL=Routine.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Routine.d.ts","sourceRoot":"","sources":["../../../../src/types/Routine.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAIhE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAmB,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAK7D,QAAA,MAAM,KAAK,YAAI,UAAU,EAAE,cAAc,CAAU,CAAC;AACpD,eAAO,MAAM,IAAI,8CAA2B,CAAC;AAC7C,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;;;;;;;;;;;;;AAc1C;;;GAGG;AACH,qBAAa,OAAQ,SAAQ,YAyB5B;CAAG;AAEJ,mDAAmD;AACnD,eAAO,MAAM,UAAU,UAAW,OAAO,KAAG,KAAK,IAAI,OAAyC,CAAC;AAE/F;;;;GAIG;AACH,eAAO,MAAM,eAAe,YAAa,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,KAAG,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,YAAY,CAAC,GAAG,SACvB,CAAC;AAEhF,4GAA4G;AAC5G,eAAO,MAAM,WAAW,YAAa,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,KAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,SACnB,CAAC;AAWxE;;;;;GAKG;AACH,eAAO,MAAM,YAAY,YAAa,OAAO,KAAG,IAc/C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,IAAI,kDAKd,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,OAAO,CAAC,EAAE,UAAU,CAAC,GAAG;IACnD,QAAQ,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACnD,YAAY,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC;IACzC,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC;CAC3B,KAAG,OAiBH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Routine.test.d.ts","sourceRoot":"","sources":["../../../../src/types/Routine.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2026 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
|
|
7
|
-
import { Capability } from '@dxos/app-framework';
|
|
8
|
-
import { AppCapabilities, Paths, TypeSection } from '@dxos/app-toolkit';
|
|
9
|
-
|
|
10
|
-
import { Routine } from '#types';
|
|
11
|
-
|
|
12
|
-
export default Capability.makeModule(
|
|
13
|
-
Effect.fnUntraced(function* () {
|
|
14
|
-
return [
|
|
15
|
-
Capability.contributes(
|
|
16
|
-
AppCapabilities.NavigationPathResolver,
|
|
17
|
-
TypeSection.createTypeSectionPathResolver(Routine.Routine, { groupId: Paths.GroupSegments.ai }),
|
|
18
|
-
),
|
|
19
|
-
];
|
|
20
|
-
}),
|
|
21
|
-
);
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2026 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Atom } from '@effect-atom/atom-react';
|
|
6
|
-
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
|
-
import * as Schema from 'effect/Schema';
|
|
8
|
-
import React, { useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import { Panel, ScrollArea } from '@dxos/react-ui';
|
|
11
|
-
import { Form } from '@dxos/react-ui-form';
|
|
12
|
-
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
13
|
-
|
|
14
|
-
import { translations } from '#translations';
|
|
15
|
-
|
|
16
|
-
import { MasterDetail, type MasterDetailIcon } from './MasterDetail';
|
|
17
|
-
|
|
18
|
-
type Row = { id: string; label: string };
|
|
19
|
-
|
|
20
|
-
const ROWS: Row[] = [
|
|
21
|
-
{ id: '1', label: 'Daily digest' },
|
|
22
|
-
{ id: '2', label: 'Sync inbox' },
|
|
23
|
-
{ id: '3', label: 'Weekly report' },
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
const DetailSchema = Schema.Struct({
|
|
27
|
-
name: Schema.String.annotations({ title: 'Name' }),
|
|
28
|
-
description: Schema.optional(Schema.String).annotations({ title: 'Description' }),
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
// Mirrors RoutineForm's gutter (Form.Viewport owns a `Column.Root` gutter); used to check list/detail alignment.
|
|
32
|
-
const MockDetail = ({ row }: { row: Row }) => (
|
|
33
|
-
<Form.Root schema={DetailSchema} values={{ name: row.label, description: '' }}>
|
|
34
|
-
<Form.Viewport>
|
|
35
|
-
<Form.Content>
|
|
36
|
-
<Form.FieldSet />
|
|
37
|
-
</Form.Content>
|
|
38
|
-
</Form.Viewport>
|
|
39
|
-
</Form.Root>
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
const getIcon = (_get: Atom.Context): MasterDetailIcon => ({ icon: 'ph--lightning--regular' });
|
|
43
|
-
|
|
44
|
-
const DefaultStory = () => {
|
|
45
|
-
const [selectedId, setSelectedId] = useState<string | undefined>('1');
|
|
46
|
-
const selected = ROWS.find((row) => row.id === selectedId);
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<Panel.Root>
|
|
50
|
-
<Panel.Content asChild className='pt-trim-md'>
|
|
51
|
-
<ScrollArea.Root orientation='vertical'>
|
|
52
|
-
<ScrollArea.Viewport>
|
|
53
|
-
<MasterDetail<Row>
|
|
54
|
-
classNames='dx-document'
|
|
55
|
-
items={ROWS}
|
|
56
|
-
selectedId={selectedId}
|
|
57
|
-
onSelect={setSelectedId}
|
|
58
|
-
getLabel={(_get, row) => row.label}
|
|
59
|
-
getIcon={getIcon}
|
|
60
|
-
detail={selected ? <MockDetail row={selected} /> : null}
|
|
61
|
-
emptyLabel='No items'
|
|
62
|
-
/>
|
|
63
|
-
</ScrollArea.Viewport>
|
|
64
|
-
</ScrollArea.Root>
|
|
65
|
-
</Panel.Content>
|
|
66
|
-
</Panel.Root>
|
|
67
|
-
);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const meta = {
|
|
71
|
-
title: 'plugins/plugin-routine/components/MasterDetail',
|
|
72
|
-
render: DefaultStory,
|
|
73
|
-
decorators: [withTheme(), withLayout({ layout: 'column' })],
|
|
74
|
-
parameters: { layout: 'fullscreen', translations },
|
|
75
|
-
} satisfies Meta<typeof DefaultStory>;
|
|
76
|
-
|
|
77
|
-
export default meta;
|
|
78
|
-
|
|
79
|
-
type Story = StoryObj<typeof meta>;
|
|
80
|
-
|
|
81
|
-
export const Default: Story = {};
|
|
82
|
-
|
|
83
|
-
export const Empty: Story = {
|
|
84
|
-
render: () => (
|
|
85
|
-
<Panel.Root>
|
|
86
|
-
<Panel.Content asChild className='pt-trim-md'>
|
|
87
|
-
<ScrollArea.Root orientation='vertical'>
|
|
88
|
-
<ScrollArea.Viewport>
|
|
89
|
-
<MasterDetail<Row>
|
|
90
|
-
classNames='dx-document'
|
|
91
|
-
items={[]}
|
|
92
|
-
getLabel={(_get, row) => row.label}
|
|
93
|
-
emptyLabel='No items'
|
|
94
|
-
/>
|
|
95
|
-
</ScrollArea.Viewport>
|
|
96
|
-
</ScrollArea.Root>
|
|
97
|
-
</Panel.Content>
|
|
98
|
-
</Panel.Root>
|
|
99
|
-
),
|
|
100
|
-
};
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2026 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Atom, useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
-
import React, { type ReactNode, useMemo } from 'react';
|
|
7
|
-
|
|
8
|
-
import { Column, Icon, IconBlock, IconButton, type ThemedClassName, Tooltip, useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import { Empty, OrderedList } from '@dxos/react-ui-list';
|
|
10
|
-
import { type ActionGraphProps, Menu, useMenuBuilder } from '@dxos/react-ui-menu';
|
|
11
|
-
import { getStyles } from '@dxos/ui-theme';
|
|
12
|
-
|
|
13
|
-
import { meta } from '#meta';
|
|
14
|
-
|
|
15
|
-
// Prototype master-detail layout, candidate to push down into @dxos/react-ui-list as a reusable
|
|
16
|
-
// component. Presentation-only: a selectable list (master) on top of a single detail pane, with an
|
|
17
|
-
// optional empty state. The parent owns the detail content (the selected item's form, a draft form,
|
|
18
|
-
// etc.) and the selection state.
|
|
19
|
-
|
|
20
|
-
export type MasterDetailRecord = { id: string };
|
|
21
|
-
|
|
22
|
-
/** A row's leading icon: same shape as {@link Obj.getIcon} — a Phosphor icon name and an optional hue. */
|
|
23
|
-
export type MasterDetailIcon = { icon: string; hue?: string };
|
|
24
|
-
|
|
25
|
-
/** A row's trailing adornment: a status icon with a tooltip label (e.g. a 'detached' warning badge). */
|
|
26
|
-
export type MasterDetailAdornment = { icon: string; label: string };
|
|
27
|
-
|
|
28
|
-
const EMPTY_MENU: ActionGraphProps = { nodes: [], edges: [] };
|
|
29
|
-
|
|
30
|
-
export type MasterDetailProps<T extends MasterDetailRecord> = ThemedClassName<{
|
|
31
|
-
items: readonly T[];
|
|
32
|
-
/** Currently highlighted row; `undefined` clears the selection (e.g. while a draft is active). */
|
|
33
|
-
selectedId?: string;
|
|
34
|
-
onSelect?: (id: string | undefined) => void;
|
|
35
|
-
/**
|
|
36
|
-
* Build the row's label reactively. Run inside an atom so it can subscribe to the item's state via `get`
|
|
37
|
-
* (e.g. the object's name) and update live when it changes.
|
|
38
|
-
*/
|
|
39
|
-
getLabel: (get: Atom.Context, item: T) => string;
|
|
40
|
-
/**
|
|
41
|
-
* Build the row's leading icon reactively. Run inside an atom so it can subscribe to the item's state via
|
|
42
|
-
* `get` (e.g. colour the icon by an `enabled` flag); returns the icon name and optional colour classes.
|
|
43
|
-
*/
|
|
44
|
-
getIcon?: (get: Atom.Context, item: T) => MasterDetailIcon | undefined;
|
|
45
|
-
/**
|
|
46
|
-
* Build the row's trailing adornment reactively (e.g. a status badge). Run inside an atom so it can subscribe
|
|
47
|
-
* to the item's state via `get`; returns a Phosphor icon name and a tooltip label, or `undefined` for none.
|
|
48
|
-
*/
|
|
49
|
-
getAdornment?: (get: Atom.Context, item: T) => MasterDetailAdornment | undefined;
|
|
50
|
-
/**
|
|
51
|
-
* Build the per-row overflow (three-dots) menu. Run inside each row's `useMenuBuilder`, so it should
|
|
52
|
-
* subscribe to that item's reactive state via `get` (e.g. an `enabled` flag) — the menu then updates live
|
|
53
|
-
* without re-rendering the whole list.
|
|
54
|
-
*/
|
|
55
|
-
getMenu?: (get: Atom.Context, item: T) => ActionGraphProps;
|
|
56
|
-
/** Message shown when there are no items. */
|
|
57
|
-
emptyLabel?: string;
|
|
58
|
-
/** Detail pane content (selected item's form, draft form, …); rendered below the list. */
|
|
59
|
-
detail?: ReactNode;
|
|
60
|
-
}>;
|
|
61
|
-
|
|
62
|
-
/** Selectable master list (with an optional per-row overflow menu) above a parent-supplied detail pane. */
|
|
63
|
-
export const MasterDetail = <T extends MasterDetailRecord>({
|
|
64
|
-
classNames,
|
|
65
|
-
items,
|
|
66
|
-
selectedId,
|
|
67
|
-
onSelect,
|
|
68
|
-
getLabel,
|
|
69
|
-
getIcon,
|
|
70
|
-
getAdornment,
|
|
71
|
-
getMenu,
|
|
72
|
-
emptyLabel,
|
|
73
|
-
detail,
|
|
74
|
-
}: MasterDetailProps<T>) => {
|
|
75
|
-
// The gutter is owned by a `Column.Root` (not an ad-hoc wrapper) so the list aligns to the surface's
|
|
76
|
-
// column system: rows and their selection highlight sit in the centre track (`Column.Center`), matching
|
|
77
|
-
// the inset of the detail's form. The detail bleeds the full width since its own `Form` owns its gutter.
|
|
78
|
-
return (
|
|
79
|
-
<Column.Root gutter='sm' classNames={classNames}>
|
|
80
|
-
<Column.Center>
|
|
81
|
-
{(items.length === 0 && <Empty label={emptyLabel} />) || (
|
|
82
|
-
<OrderedList.Root<T> items={items}>
|
|
83
|
-
{({ items }) => (
|
|
84
|
-
<OrderedList.Content>
|
|
85
|
-
{items.map((item) => (
|
|
86
|
-
<MasterDetailRow
|
|
87
|
-
key={item.id}
|
|
88
|
-
item={item}
|
|
89
|
-
selected={item.id === selectedId}
|
|
90
|
-
getLabel={getLabel}
|
|
91
|
-
getIcon={getIcon}
|
|
92
|
-
getAdornment={getAdornment}
|
|
93
|
-
getMenu={getMenu}
|
|
94
|
-
onSelect={onSelect}
|
|
95
|
-
/>
|
|
96
|
-
))}
|
|
97
|
-
</OrderedList.Content>
|
|
98
|
-
)}
|
|
99
|
-
</OrderedList.Root>
|
|
100
|
-
)}
|
|
101
|
-
</Column.Center>
|
|
102
|
-
|
|
103
|
-
<div className='col-span-full pt-trim-md'>{detail}</div>
|
|
104
|
-
</Column.Root>
|
|
105
|
-
);
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
type MasterDetailRowProps<T extends MasterDetailRecord> = {
|
|
109
|
-
item: T;
|
|
110
|
-
selected: boolean;
|
|
111
|
-
getLabel: (get: Atom.Context, item: T) => string;
|
|
112
|
-
getIcon?: (get: Atom.Context, item: T) => MasterDetailIcon | undefined;
|
|
113
|
-
getAdornment?: (get: Atom.Context, item: T) => MasterDetailAdornment | undefined;
|
|
114
|
-
getMenu?: (get: Atom.Context, item: T) => ActionGraphProps;
|
|
115
|
-
onSelect?: (id: string | undefined) => void;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const MasterDetailRow = <T extends MasterDetailRecord>({
|
|
119
|
-
item,
|
|
120
|
-
selected,
|
|
121
|
-
getLabel,
|
|
122
|
-
getIcon,
|
|
123
|
-
getAdornment,
|
|
124
|
-
getMenu,
|
|
125
|
-
onSelect,
|
|
126
|
-
}: MasterDetailRowProps<T>) => {
|
|
127
|
-
const { t } = useTranslation(meta.profile.key);
|
|
128
|
-
// Resolve the label, icon, adornment, and actions reactively per row — each subscribes (via `get`) only to
|
|
129
|
-
// this item's state, so a change (rename, toggling enabled) updates just this row.
|
|
130
|
-
const label = useAtomValue(useMemo(() => Atom.make((get) => getLabel(get, item)), [getLabel, item]));
|
|
131
|
-
const icon = useAtomValue(useMemo(() => Atom.make((get) => getIcon?.(get, item)), [getIcon, item]));
|
|
132
|
-
const adornment = useAtomValue(useMemo(() => Atom.make((get) => getAdornment?.(get, item)), [getAdornment, item]));
|
|
133
|
-
const menu = useMenuBuilder((get) => getMenu?.(get, item) ?? EMPTY_MENU, [getMenu, item]);
|
|
134
|
-
|
|
135
|
-
return (
|
|
136
|
-
<OrderedList.Item
|
|
137
|
-
id={item.id}
|
|
138
|
-
item={item}
|
|
139
|
-
canDrag={false}
|
|
140
|
-
hover
|
|
141
|
-
selected={selected}
|
|
142
|
-
classNames='flex items-center cursor-pointer p-1'
|
|
143
|
-
onClick={() => onSelect?.(selected ? undefined : item.id)}
|
|
144
|
-
>
|
|
145
|
-
{icon && (
|
|
146
|
-
<IconBlock>
|
|
147
|
-
<Icon icon={icon.icon} classNames={icon.hue ? getStyles(icon.hue).text : undefined} />
|
|
148
|
-
</IconBlock>
|
|
149
|
-
)}
|
|
150
|
-
<span className='grow truncate'>{label}</span>
|
|
151
|
-
{adornment && (
|
|
152
|
-
<Tooltip.Provider>
|
|
153
|
-
<Tooltip.Trigger asChild side='bottom' content={adornment.label}>
|
|
154
|
-
<Icon icon={adornment.icon} />
|
|
155
|
-
</Tooltip.Trigger>
|
|
156
|
-
</Tooltip.Provider>
|
|
157
|
-
)}
|
|
158
|
-
{getMenu && (
|
|
159
|
-
<Menu.Root {...menu}>
|
|
160
|
-
<Menu.Trigger asChild>
|
|
161
|
-
<IconButton
|
|
162
|
-
iconOnly
|
|
163
|
-
variant='ghost'
|
|
164
|
-
icon='ph--dots-three-vertical--regular'
|
|
165
|
-
label={t('routine-actions.label')}
|
|
166
|
-
// Open the menu without toggling row selection.
|
|
167
|
-
onClick={(event) => event.stopPropagation()}
|
|
168
|
-
/>
|
|
169
|
-
</Menu.Trigger>
|
|
170
|
-
<Menu.Content />
|
|
171
|
-
</Menu.Root>
|
|
172
|
-
)}
|
|
173
|
-
</OrderedList.Item>
|
|
174
|
-
);
|
|
175
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2026 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { describe, test } from 'vitest';
|
|
6
|
-
|
|
7
|
-
import { Instructions, Operation, Runnable, Trigger } from '@dxos/compute';
|
|
8
|
-
import { Obj, Ref, Type } from '@dxos/echo';
|
|
9
|
-
|
|
10
|
-
import { blank } from '../templates';
|
|
11
|
-
import { isRunInstructions } from '../util';
|
|
12
|
-
import * as Routine from './Routine';
|
|
13
|
-
|
|
14
|
-
describe('Routine', () => {
|
|
15
|
-
test('make produces a typed Routine', ({ expect }) => {
|
|
16
|
-
const routine = Routine.make({ name: 'Test', triggers: [] });
|
|
17
|
-
expect(Routine.instanceOf(routine)).toBe(true);
|
|
18
|
-
expect(Obj.instanceOf(Routine.Routine, routine)).toBe(true);
|
|
19
|
-
expect(Type.getTypename(Routine.Routine)).toBe('org.dxos.type.routine');
|
|
20
|
-
expect(Obj.getLabel(routine)).toBe('Test');
|
|
21
|
-
expect(routine.triggers).toEqual([]);
|
|
22
|
-
expect(routine.spec).toBeUndefined();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
test('Runnable seam is currently the Operation type', ({ expect }) => {
|
|
26
|
-
// MVP: Runnable === Operation. Widening this to a union is the documented next step.
|
|
27
|
-
expect(Runnable.Runnable).toBe(Operation.PersistentOperation);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test('make wires an instructions action so a single add yields a runnable routine', ({ expect }) => {
|
|
31
|
-
const instructions = Instructions.make({ name: 'Body', text: 'do something' });
|
|
32
|
-
const trigger = Trigger.make({ spec: Trigger.specTimer('0 9 * * *') });
|
|
33
|
-
const routine = Routine.make({ name: 'R', instructions, trigger });
|
|
34
|
-
|
|
35
|
-
// The routine owns the instructions, and the trigger dispatches RunInstructions with those instructions
|
|
36
|
-
// bound into the trigger input so no separate persistence step is needed.
|
|
37
|
-
expect(Routine.instructionsRef(routine)?.target?.id).toBe(instructions.id);
|
|
38
|
-
expect(routine.triggers[0]?.target?.id).toBe(trigger.id);
|
|
39
|
-
expect(isRunInstructions(trigger.runnable)).toBe(true);
|
|
40
|
-
const bound = trigger.input?.instructions;
|
|
41
|
-
expect(Ref.isRef(bound) ? bound.target?.id : undefined).toBe(instructions.id);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
describe('blank template', () => {
|
|
45
|
-
test('is the default no-op template', ({ expect }) => {
|
|
46
|
-
expect(blank.id).toBe('org.dxos.routine.blank');
|
|
47
|
-
expect(blank.label).toBe('Blank');
|
|
48
|
-
expect(typeof blank.scaffold).toBe('function');
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
});
|
package/src/types/Routine.ts
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2026 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
// @import-as-namespace
|
|
6
|
-
|
|
7
|
-
import * as Schema from 'effect/Schema';
|
|
8
|
-
|
|
9
|
-
import { Instructions, Runnable, Trigger } from '@dxos/compute';
|
|
10
|
-
// Operation is imported so TypeScript can name Operation.PersistentOperation in the emitted .d.ts
|
|
11
|
-
// (Runnable is an alias for Operation.PersistentOperation, so Routine's class type references it).
|
|
12
|
-
// eslint-disable-next-line unused-imports/no-unused-imports
|
|
13
|
-
import { Operation } from '@dxos/compute';
|
|
14
|
-
import { Annotation, DXN, Obj, Ref, Type } from '@dxos/echo';
|
|
15
|
-
import { LabelAnnotation } from '@dxos/echo/internal';
|
|
16
|
-
|
|
17
|
-
import { runInstructionsRef } from '../util/run-instructions';
|
|
18
|
-
|
|
19
|
-
const Kinds = ['runnable', 'instructions'] as const;
|
|
20
|
-
export const Kind = Schema.Literal(...Kinds);
|
|
21
|
-
export type Kind = (typeof Kinds)[number];
|
|
22
|
-
|
|
23
|
-
const RunnableSpec = Schema.Struct({
|
|
24
|
-
kind: Schema.Literal('runnable'),
|
|
25
|
-
runnable: Ref.Ref(Runnable.Runnable),
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const InstructionsSpec = Schema.Struct({
|
|
29
|
-
kind: Schema.Literal('instructions'),
|
|
30
|
-
instructions: Ref.Ref(Instructions.Instructions),
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const RoutineSpec = Schema.Union(RunnableSpec, InstructionsSpec);
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* User-facing routine: a thin aggregate of an action (`runnable`) and the triggers that fire it.
|
|
37
|
-
* App-level only — EDGE stays unaware of it (triggers point directly at the runnable).
|
|
38
|
-
*/
|
|
39
|
-
export class Routine extends Type.makeObject<Routine>(DXN.make('org.dxos.type.routine', '0.2.0'))(
|
|
40
|
-
Schema.Struct({
|
|
41
|
-
name: Schema.String.pipe(Schema.optional),
|
|
42
|
-
description: Schema.String.pipe(Schema.optional),
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* The action to run: either an Operation (`spec.runnable`, bound directly) or the routine's own owned
|
|
46
|
-
* Instructions (`spec.instructions`). For an Operation action the trigger's `runnable` points at this
|
|
47
|
-
* Operation. For an Instructions action `spec.instructions` is the owned Instructions object (the operation
|
|
48
|
-
* is implicitly the static RunInstructions, so no separate operation ref is stored), and the trigger's
|
|
49
|
-
* `runnable` is RunInstructions with this instructions bound as its input.
|
|
50
|
-
*/
|
|
51
|
-
// TODO(burdon): Change to Array? Or handle that case with a ComputeGraph runnable.
|
|
52
|
-
spec: RoutineSpec.pipe(Schema.optional),
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Explicit membership, bi-directional with `trigger.runnable → runnable`. Required (not derived by query)
|
|
56
|
-
* because the runnable may be a shared registry operation referenced by multiple automations, which would
|
|
57
|
-
* conflate triggers. MVP enforces length <= 1.
|
|
58
|
-
*/
|
|
59
|
-
triggers: Schema.Array(Ref.Ref(Trigger.Trigger)),
|
|
60
|
-
}).pipe(
|
|
61
|
-
LabelAnnotation.set(['name']),
|
|
62
|
-
Annotation.IconAnnotation.set({ icon: 'ph--lightning--regular', hue: 'amber' }),
|
|
63
|
-
),
|
|
64
|
-
) {}
|
|
65
|
-
|
|
66
|
-
/** Returns true when value is a Routine object. */
|
|
67
|
-
export const instanceOf = (value: unknown): value is Routine => Obj.instanceOf(Routine, value);
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* The owned Instructions ref of an instructions-action routine, or undefined for an operation action.
|
|
71
|
-
* Classification is explicit in `spec.kind`, so this needs no `.target` dereference; callers resolve the ref
|
|
72
|
-
* reactively (`useObject`) or asynchronously (`Database.load`) as appropriate.
|
|
73
|
-
*/
|
|
74
|
-
export const instructionsRef = (routine: Pick<Routine, 'spec'>): Ref.Ref<Instructions.Instructions> | undefined =>
|
|
75
|
-
routine.spec?.kind === 'instructions' ? routine.spec.instructions : undefined;
|
|
76
|
-
|
|
77
|
-
/** The Operation (runnable) ref of an operation-action routine, or undefined for an instructions action. */
|
|
78
|
-
export const runnableRef = (routine: Pick<Routine, 'spec'>): Ref.Ref<Runnable.Runnable> | undefined =>
|
|
79
|
-
routine.spec?.kind === 'runnable' ? routine.spec.runnable : undefined;
|
|
80
|
-
|
|
81
|
-
/** Strip a stale `instructions` binding from a trigger input. */
|
|
82
|
-
const withoutInstructions = (input: Record<string, unknown> | undefined): Record<string, unknown> | undefined => {
|
|
83
|
-
if (!input || !('instructions' in input)) {
|
|
84
|
-
return input;
|
|
85
|
-
}
|
|
86
|
-
const { instructions: _drop, ...rest } = input;
|
|
87
|
-
return rest;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Wire the routine's owned triggers to dispatch its current action (`spec`): an instructions action sets each
|
|
92
|
-
* trigger's `runnable` to RunInstructions with the owned instructions bound into `input`; an operation action
|
|
93
|
-
* binds the operation directly and drops any stale instructions binding. Call after the action (`spec`) changes
|
|
94
|
-
* so a trigger never keeps a binding for the previous action.
|
|
95
|
-
*/
|
|
96
|
-
export const wireTriggers = (routine: Routine): void => {
|
|
97
|
-
const instructions = instructionsRef(routine);
|
|
98
|
-
const fn = instructions ? runInstructionsRef() : runnableRef(routine);
|
|
99
|
-
for (const ref of routine.triggers) {
|
|
100
|
-
const trigger = ref.target;
|
|
101
|
-
if (!trigger) {
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
Obj.update(trigger, (trigger) => {
|
|
105
|
-
trigger.runnable = fn;
|
|
106
|
-
const base = withoutInstructions(trigger.input);
|
|
107
|
-
trigger.input = instructions ? { input: {}, ...base, instructions } : base;
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Creates a fully-wired in-memory routine graph. `instructions` and `trigger` are optional extras beyond the
|
|
114
|
-
* schema fields: when provided they are parented under the routine and wired together (runnable, trigger
|
|
115
|
-
* runnable, the trigger's instructions input binding, and the `triggers` ref) so that a single `Database.add`
|
|
116
|
-
* cascades the whole graph. `triggers` defaults to `[]` so callers that supply a `trigger` need not provide it.
|
|
117
|
-
*/
|
|
118
|
-
export const make = ({
|
|
119
|
-
instructions,
|
|
120
|
-
trigger,
|
|
121
|
-
triggers = [],
|
|
122
|
-
...props
|
|
123
|
-
}: Omit<Obj.MakeProps<typeof Routine>, 'triggers'> & {
|
|
124
|
-
triggers?: ReadonlyArray<Ref.Ref<Trigger.Trigger>>;
|
|
125
|
-
instructions?: Instructions.Instructions;
|
|
126
|
-
trigger?: Trigger.Trigger;
|
|
127
|
-
}): Routine => {
|
|
128
|
-
const routine = Obj.make(Routine, { ...props, triggers });
|
|
129
|
-
if (instructions) {
|
|
130
|
-
Obj.setParent(instructions, routine);
|
|
131
|
-
Obj.update(routine, (routine) => {
|
|
132
|
-
routine.spec = { kind: 'instructions', instructions: Ref.make(instructions) };
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
if (trigger) {
|
|
136
|
-
Obj.setParent(trigger, routine);
|
|
137
|
-
Obj.update(routine, (routine) => {
|
|
138
|
-
routine.triggers.push(Ref.make(trigger));
|
|
139
|
-
});
|
|
140
|
-
// Wire the trigger's `runnable`/`input` from the action (`spec`); preserves any template-provided input.
|
|
141
|
-
wireTriggers(routine);
|
|
142
|
-
}
|
|
143
|
-
return routine;
|
|
144
|
-
};
|