@synap-core/workspace-templates 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/dist/index.d.ts CHANGED
@@ -455,43 +455,37 @@ interface TemplateExtendsRef {
455
455
  * PACKAGE_DEPENDENCY_KINDS — the dependency-kind vocabulary, declared ONCE.
456
456
  *
457
457
  * This tuple exists so consumers can IMPORT the vocabulary instead of
458
- * hand-copying it. `TemplateDependency` is currently mirrored by hand in six
459
- * other places, four of which carry a comment promising they match "VERBATIM so
460
- * the wire shape never drifts" — a comment doing a type's job. A comment cannot
461
- * fail a build; an import can. Those mirrors live in repos this package does not
462
- * own, so this tuple does not fix them by existing — it makes the fix possible:
458
+ * hand-copying it. `TemplateDependency` is mirrored by hand in several other
459
+ * places — a comment cannot fail a build, an import can, but these mirrors live
460
+ * in repos this package does not own, so they must match this list EXACTLY:
463
461
  *
464
- * - marketplace `types.ts:102`
465
- * - onboarding `workspace-templates.ts:27`
466
- * - synap-backend `package-definition.ts:204` (exports its own
467
- * `PackageDependencyKind` — the closest peer)
468
- * - hub-protocol REST `rest/packages.ts:140` (zod enum)
469
- * - browser `InstallPackageDialog.tsx:262`
470
- * - control-plane-api `routes/packages.ts:436` (zod enum)
462
+ * - marketplace `features/marketplace/src/types.ts`
463
+ * - onboarding `features/onboarding/src/{templates/workspace-templates,components/WorkspacePreview}.ts(x)`
464
+ * - browser `InstallPackageDialog.tsx`
465
+ * - synap-backend `package-definition.ts` (`PackageDependencyKind`)
466
+ * - hub-protocol REST `rest/packages.ts` (zod enum)
467
+ * - control-plane-api `db/schema/packages.ts` (`TemplateDependency` type)
468
+ * + `routes/packages.ts` (`DEPENDENCY_KINDS` zod enum)
471
469
  *
472
- * ⚠️ `'automation'` IS RETIRED VOCABULARY, deliberately still listed here.
473
- * CP migration `0049_package_vocabulary` retired the `automation` package
474
- * category in favour of `workflow` ("workflow — a triggered/sequenced run
475
- * (absorbs 'automation' + 'playbook')", `PACKAGE_TYPES` in CP
476
- * `db/schema/packages.ts`). A dependency's `kind` names the TYPE of package it
477
- * points at, so this vocabulary should track `PACKAGE_TYPES` — meaning the live
478
- * spelling is `workflow`, not `automation`.
470
+ * These are the 7 literals the wire accepts, in lockstep with the CP publish
471
+ * enum (`DEPENDENCY_KINDS = [...PACKAGE_TYPES, "automation"]`, CP
472
+ * `routes/packages.ts`), the hub install enum (`rest/packages.ts`), and the
473
+ * backend resolver's `PackageDependencyKind` (`@synap/database`).
479
474
  *
480
- * It is NOT renamed here, on purpose. This is latent, not live: 0/21 templates
481
- * declare any `kind` other than the default `'workspace'`. And all four wire
482
- * enums (CP + hub zod, above) still accept `'automation'` and do NOT accept
483
- * `'workflow'` — so emitting `'workflow'` today would be rejected with a 400 at
484
- * both doors, and dropping `'automation'` from this tuple would make any
485
- * consumer that derives a zod enum from it start rejecting a value the wire
486
- * still legally accepts (a published third-party package may carry it; CP's own
487
- * schema permits it). Narrowing must therefore follow the wire, not lead it.
475
+ * Resolver behaviour (backend `package-dependency-resolver.ts`):
476
+ * - `workspace` → resolve+install; the ONLY kind that may `compose`.
477
+ * - `capability` / `cell` → resolve+install, always `require`d (presence).
478
+ * - `skill` / `workflow` / `view` / `automation` → ACCEPTED and `require`d
479
+ * present, surfaced as `required-absent` (non-fatal) — no standalone by-slug
480
+ * applier on the pod yet; when one grows, give the kind its own branch.
488
481
  *
489
- * ORDERED FIX (each step deployable alone, no flag day):
490
- * 1. Widen the CP + hub zod enums to accept BOTH `'automation'` and `'workflow'`.
491
- * 2. Add `'workflow'` here; mark `'automation'` deprecated; migrate any authored use.
492
- * 3. Once no payload carries `'automation'`, drop it from the wire enums and this tuple.
482
+ * `'automation'` is legacy vocabulary: CP migration `0049_package_vocabulary`
483
+ * renamed the `automation` package category → `workflow` (which absorbs
484
+ * automation + playbook, `PACKAGE_TYPES` in CP `db/schema/packages.ts`). It
485
+ * stays accepted on the wire — and therefore in this tuple — for back-compat
486
+ * with dependencies published before the rename.
493
487
  */
494
- declare const PACKAGE_DEPENDENCY_KINDS: readonly ["workspace", "capability", "automation"];
488
+ declare const PACKAGE_DEPENDENCY_KINDS: readonly ["workspace", "capability", "skill", "workflow", "view", "cell", "automation"];
495
489
  /** What a `TemplateDependency` points at. Derived — never re-declare the list. */
496
490
  type PackageDependencyKind = (typeof PACKAGE_DEPENDENCY_KINDS)[number];
497
491
  interface TemplateDependency {
@@ -499,8 +493,8 @@ interface TemplateDependency {
499
493
  slug: string;
500
494
  /**
501
495
  * What the dependency is. Default `'workspace'`. Only `'workspace'`
502
- * dependencies can be `compose`d; `'capability'`/`'automation'` are always
503
- * `require`d present without merging.
496
+ * dependencies can be `compose`d; every other kind is always `require`d
497
+ * present without merging.
504
498
  */
505
499
  kind?: PackageDependencyKind;
506
500
  /**
@@ -681,6 +675,19 @@ declare function listPublicTemplates(): WorkspaceYaml[];
681
675
  * in the consumers; this door only merges arrays they already fetched.
682
676
  */
683
677
 
678
+ /**
679
+ * A lightweight, QUERY-TIME summary of one sub-object a package carries (a cell
680
+ * today; the shape generalizes to views/automations without change). Rides the
681
+ * catalog LIST projection so a surface can match/surface a sub-item WITHOUT the
682
+ * full `definition` — it carries `key + name` only, never the sub-object's code.
683
+ * `kind` is DERIVED (in the CP SELECT, from which sub-array the row came from),
684
+ * never a stored taxonomy.
685
+ */
686
+ interface PackageItemSummary {
687
+ kind: string;
688
+ key: string;
689
+ name: string;
690
+ }
684
691
  /**
685
692
  * A bundled template — the canonical `WorkspaceYaml` this package ships. Callers
686
693
  * pass `listPublicTemplates()` (18) or `listWorkspaceTemplates()` (21); the door
@@ -716,6 +723,13 @@ interface RemoteEntry {
716
723
  * never "unknown-so-hide".
717
724
  */
718
725
  isPrivate?: boolean;
726
+ /**
727
+ * Lightweight computed summary of the row's sub-objects (cells), carried on the
728
+ * LIST projection so a surface can surface a matching sub-item without the full
729
+ * `definition`. `undefined` on sources that don't compute it (bundled) — treated
730
+ * as "no known sub-items". See `PackageItemSummary`.
731
+ */
732
+ items?: PackageItemSummary[];
719
733
  /**
720
734
  * The CP `definition` jsonb — opaque install payload. The door reads only
721
735
  * `definition.sourcePackage.version` (the winner signal). Absent on browse rows
@@ -775,6 +789,11 @@ interface CpPackageRow {
775
789
  icon?: string | null;
776
790
  /** Present only on `/mine` rows. `false` ⇒ private. Browse rows omit it. */
777
791
  isPublic?: boolean;
792
+ /**
793
+ * Computed sub-object summary from `GET /api/packages` / `/mine` (query-time,
794
+ * not a stored column). Carries `key + name` per cell; never the cell code.
795
+ */
796
+ items?: PackageItemSummary[];
778
797
  }
779
798
  /**
780
799
  * Map a CP list row into the merge door's `RemoteEntry`. THE canonical mapping —
@@ -800,6 +819,12 @@ interface CatalogEntryBase {
800
819
  icon?: string | null;
801
820
  /** `true` ⇒ not publicly listed (internal bundled template, or private CP row). */
802
821
  isPrivate: boolean;
822
+ /**
823
+ * The entry's sub-object summary (cells). Always present (defaults to `[]`) so a
824
+ * consumer can match sub-items uniformly. Bundled workspace templates carry no
825
+ * cells → `[]` (honest); a remote row carries its CP-computed `items`.
826
+ */
827
+ items: PackageItemSummary[];
803
828
  }
804
829
  /** A catalog entry backed by a bundled template. Install via `toWorkspaceDefinition()` / `toPackageDefinition()` on `template`. */
805
830
  interface BundledCatalogEntry extends CatalogEntryBase {