@synap-core/workspace-templates 0.6.4 → 0.7.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/dist/index.d.ts CHANGED
@@ -243,6 +243,52 @@ interface TemplatePlaybook {
243
243
  };
244
244
  status?: 'draft' | 'active' | 'paused';
245
245
  }
246
+ interface TemplateAutomation {
247
+ /** Stable local key (unused on the wire today — reserved for dedup/refs). */
248
+ key?: string;
249
+ name: string;
250
+ description?: string;
251
+ triggerType: 'event' | 'cron' | 'webhook' | 'manual';
252
+ triggerConfig?: Record<string, unknown>;
253
+ flow: {
254
+ nodes: unknown[];
255
+ edges: unknown[];
256
+ precondition?: string;
257
+ };
258
+ status?: 'draft' | 'active' | 'paused';
259
+ }
260
+ interface TemplateActionPlacement {
261
+ /** Entity kind whose detail surface this action appears on. */
262
+ profileSlug: string;
263
+ /** Where the action renders. Only "entity-detail" is consumed today. */
264
+ surface: 'entity-detail' | string;
265
+ /** What the action does when clicked. */
266
+ kind: 'capability' | 'playbook' | 'automation';
267
+ /**
268
+ * Reference to the thing to run: a capability verb key, or a playbook /
269
+ * automation NAME (resolved to a row id at apply time).
270
+ */
271
+ ref: string;
272
+ /** Human label shown on the action button. */
273
+ label: string;
274
+ /** Additional entity-state requirements, evaluated by the rendering surface. */
275
+ when?: {
276
+ /** All listed workspace facets must be present on the entity. */
277
+ requiredFacetSlugs?: string[];
278
+ /** Entity property values that must equal their configured literal values. */
279
+ propertyEquals?: Record<string, unknown>;
280
+ /** Any configured property/value match makes the action applicable. */
281
+ propertyAnyEquals?: Record<string, unknown[]>;
282
+ /** Entity property values that must not equal their configured literal values. */
283
+ propertyNotEquals?: Record<string, unknown>;
284
+ };
285
+ /** Explicit intent required before a consequential action is launched. */
286
+ confirmation?: {
287
+ title: string;
288
+ description?: string;
289
+ confirmLabel?: string;
290
+ };
291
+ }
246
292
  interface TemplateIntegration {
247
293
  /** Capability template key to install (matches a capability template). */
248
294
  templateKey: string;
@@ -406,6 +452,16 @@ interface WorkspaceYaml {
406
452
  profileEntityBentoTemplates?: TemplateProfileEntityBentoTemplates;
407
453
  /** Playbooks (session templates) seeded with the workspace */
408
454
  playbooks?: TemplatePlaybook[];
455
+ /**
456
+ * Flow-based automations (WHEN→THEN triggers) seeded with the workspace.
457
+ * Applier-only — see {@link TemplateAutomation}.
458
+ */
459
+ automations?: TemplateAutomation[];
460
+ /**
461
+ * Entity-detail action placements seeded into `settings.actionPlacements`.
462
+ * See {@link TemplateActionPlacement}.
463
+ */
464
+ actionPlacements?: TemplateActionPlacement[];
409
465
  /** Capability templates (tools/connectors) to install on provisioning */
410
466
  integrations?: TemplateIntegration[];
411
467
  /**
@@ -707,6 +763,25 @@ declare function computeTemplateUpdates(installed: InstalledTemplate[], catalog:
707
763
  * shape never drifts per call-site.
708
764
  */
709
765
 
766
+ /**
767
+ * A `TemplateAutomation` as the apply door expects it: `flowDefinition`, not
768
+ * the authored `flow` (mirrors `PackagePostWorkspaceBody['automations'][number]`
769
+ * / the Hub `POST /packages/apply` `AutomationSchema`).
770
+ */
771
+ interface PackageAutomationWire {
772
+ /** Stable template identity; names may be edited without orphaning the flow. */
773
+ key?: string;
774
+ name: string;
775
+ description?: string;
776
+ triggerType: TemplateAutomation['triggerType'];
777
+ triggerConfig?: Record<string, unknown>;
778
+ flowDefinition?: {
779
+ nodes: unknown[];
780
+ edges: unknown[];
781
+ precondition?: string;
782
+ };
783
+ status?: TemplateAutomation['status'];
784
+ }
710
785
  /** A widget block as the wire expects it: `bentoLayout[]`, keyed by `widgetType`. */
711
786
  interface BentoWidgetBlockWire {
712
787
  widgetType: string;
@@ -761,6 +836,21 @@ interface WorkspaceDefinitionInput {
761
836
  * tools/skills/automations silently dropped on that door.
762
837
  */
763
838
  capabilities?: WorkspaceYaml['integrations'];
839
+ /** Playbooks normalized to the workspace-create input contract. */
840
+ playbooks?: Array<Record<string, unknown>>;
841
+ /**
842
+ * Entity-detail action placements — forwarded verbatim to
843
+ * `applyPackagePostWorkspace`, which merges them into
844
+ * `settings.actionPlacements`. The tRPC door (`createFromDefinition`)
845
+ * declares `actionPlacements` in its zod input and carries them through the
846
+ * shared apply door. No shape transform: the authored form IS the wire form.
847
+ */
848
+ actionPlacements?: WorkspaceYaml['actionPlacements'];
849
+ /**
850
+ * Graph-based automations. Deliberately distinct from the legacy
851
+ * `automations` loop/playbook-trigger wire shape accepted by this door.
852
+ */
853
+ flowAutomations?: PackageAutomationWire[];
764
854
  workspaceSubtype?: string;
765
855
  workspaceType?: NonNullable<WorkspaceYaml['workspace']>['workspaceType'];
766
856
  workspaceVisibility?: string;
@@ -840,6 +930,19 @@ interface PackageDefinitionOutput {
840
930
  layoutConfig?: WorkspaceYaml['layout'];
841
931
  capabilities?: WorkspaceYaml['integrations'];
842
932
  playbooks?: WorkspaceYaml['playbooks'];
933
+ /** Flow-based automations — mapped to the apply door's `flowDefinition` field. */
934
+ automations?: PackageAutomationWire[];
935
+ /**
936
+ * Entity-detail action placements — carried verbatim (authored form IS the
937
+ * wire form). NOTE: the Hub `PackageApplySchema` (synap-backend
938
+ * `hub-protocol/rest/packages.ts`) is a plain `z.object` and does not yet
939
+ * declare `actionPlacements`, so on the CLI/Hub install path this field is
940
+ * STRIPPED before `applyPackagePostWorkspace` sees it. The tRPC
941
+ * `createFromDefinition` door DOES carry it. Named follow-up: add an
942
+ * `ActionPlacementSchema` field to `PackageApplySchema` to close the Hub half
943
+ * (out of the T2 fence — flagged in the handoff).
944
+ */
945
+ actionPlacements?: WorkspaceYaml['actionPlacements'];
843
946
  onboarding?: WorkspaceYaml['onboarding'];
844
947
  /** Template-composition dependencies — resolved by the apply endpoint. */
845
948
  dependencies?: WorkspaceYaml['dependencies'];
@@ -852,4 +955,4 @@ interface PackageDefinitionOutput {
852
955
  */
853
956
  declare function toPackageDefinition(slugOrYaml: string | WorkspaceYaml): PackageDefinitionOutput;
854
957
 
855
- export { type AssembleCatalogInput, type BentoViewBlockWire, type BentoWidgetBlockWire, type BundledCatalogEntry, type BundledEntry, type CatalogEntry, type CpPackageRow, type InstalledTemplate, type MergeCatalogInput, type MergeCatalogResult, PACKAGE_DEPENDENCY_KINDS, type PackageDefinitionOutput, type PackageDependencyKind, type RemoteCatalogEntry, type RemoteEntry, type RemoteSourceStatus, type SplitBentoBlocks, type TemplateAppKind, type TemplateAppRef, type TemplateBentoBlock, type TemplateDefaultSource, type TemplateDependency, type TemplateDisplayTemplate, type TemplateEntityLink, type TemplateExtendsRef, type TemplateIntegration, type TemplateLayoutConfig, type TemplateMeta, type TemplateOnboarding, type TemplateOnboardingCollectTarget, type TemplatePlaybook, type TemplatePlaybookParam, type TemplateProfile, type TemplateProfileEntityBentoTemplates, type TemplateProperty, type TemplateSeedEntity, type TemplateSidebarItem, type TemplateSidebarSurface, type TemplateSourceRole, type TemplateSuggestedRelation, type TemplateUpdateCheck, type TemplateView, type ToDefinitionResult, WORKSPACE_TEMPLATES, type WorkspaceDefinitionInput, type WorkspaceTemplateSlug, type WorkspaceYaml, assembleCatalog, computeTemplateUpdates, getWorkspaceTemplate, isHashVersion, listPublicTemplates, listWorkspaceTemplates, mergeCatalog, rowToRemoteEntry, splitBentoBlocks, toPackageDefinition, toWorkspaceDefinition };
958
+ export { type AssembleCatalogInput, type BentoViewBlockWire, type BentoWidgetBlockWire, type BundledCatalogEntry, type BundledEntry, type CatalogEntry, type CpPackageRow, type InstalledTemplate, type MergeCatalogInput, type MergeCatalogResult, PACKAGE_DEPENDENCY_KINDS, type PackageDefinitionOutput, type PackageDependencyKind, type RemoteCatalogEntry, type RemoteEntry, type RemoteSourceStatus, type SplitBentoBlocks, type TemplateActionPlacement, type TemplateAppKind, type TemplateAppRef, type TemplateAutomation, type TemplateBentoBlock, type TemplateDefaultSource, type TemplateDependency, type TemplateDisplayTemplate, type TemplateEntityLink, type TemplateExtendsRef, type TemplateIntegration, type TemplateLayoutConfig, type TemplateMeta, type TemplateOnboarding, type TemplateOnboardingCollectTarget, type TemplatePlaybook, type TemplatePlaybookParam, type TemplateProfile, type TemplateProfileEntityBentoTemplates, type TemplateProperty, type TemplateSeedEntity, type TemplateSidebarItem, type TemplateSidebarSurface, type TemplateSourceRole, type TemplateSuggestedRelation, type TemplateUpdateCheck, type TemplateView, type ToDefinitionResult, WORKSPACE_TEMPLATES, type WorkspaceDefinitionInput, type WorkspaceTemplateSlug, type WorkspaceYaml, assembleCatalog, computeTemplateUpdates, getWorkspaceTemplate, isHashVersion, listPublicTemplates, listWorkspaceTemplates, mergeCatalog, rowToRemoteEntry, splitBentoBlocks, toPackageDefinition, toWorkspaceDefinition };