@synap-core/workspace-templates 0.6.3 → 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 +146 -1
- package/dist/index.js +3389 -1617
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/business-developer.template.test.ts +280 -0
- package/src/business-developer.yaml +644 -0
- package/src/catalog.test.ts +99 -1
- package/src/catalog.ts +93 -0
- package/src/crm.yaml +38 -58
- package/src/define.flow-automations.test.ts +65 -0
- package/src/define.ts +95 -7
- package/src/ecosystem.yaml +24 -17
- package/src/index.ts +11 -1
- package/src/meetings-knowledge.yaml +204 -0
- package/src/outreach-comms.yaml +282 -0
- package/src/templates.ts +2999 -1288
- package/src/types.ts +106 -3
package/src/types.ts
CHANGED
|
@@ -259,9 +259,9 @@ export interface TemplateOnboarding {
|
|
|
259
259
|
// ============================================================================
|
|
260
260
|
// Playbooks — session templates seeded with the workspace
|
|
261
261
|
//
|
|
262
|
-
// Mirrors `PackagePlaybook` in synap-backend `package-definition.ts`.
|
|
263
|
-
//
|
|
264
|
-
//
|
|
262
|
+
// Mirrors `PackagePlaybook` in synap-backend `package-definition.ts`. The
|
|
263
|
+
// workspace converter normalizes these to the compact createFromDefinition
|
|
264
|
+
// input contract; package apply retains the richer authored representation.
|
|
265
265
|
// ============================================================================
|
|
266
266
|
|
|
267
267
|
export interface TemplatePlaybookParam {
|
|
@@ -297,6 +297,97 @@ export interface TemplatePlaybook {
|
|
|
297
297
|
status?: 'draft' | 'active' | 'paused';
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
+
// ============================================================================
|
|
301
|
+
// Automations — flow-based WHEN→THEN triggers seeded with the workspace
|
|
302
|
+
//
|
|
303
|
+
// Mirrors the backend's `PackagePostWorkspaceBody['automations'][number]`
|
|
304
|
+
// (synap-backend `package-apply-post-workspace.ts`) — the wire shape the
|
|
305
|
+
// SHARED `applyPackagePostWorkspace` door (Hub `POST /packages/apply` AND the
|
|
306
|
+
// proposals approve-executor) actually accepts. Distinct from the LOOP-style
|
|
307
|
+
// `{trigger, action: {playbookSlug}}` automations `workspaces.createFromDefinition`
|
|
308
|
+
// takes. Flow automations travel through the separate `flowAutomations` field on
|
|
309
|
+
// that door, then enter the same generic post-workspace applier as the Hub path.
|
|
310
|
+
//
|
|
311
|
+
// Example (a capability-node automation gating a facet update behind a governed
|
|
312
|
+
// tool call — see the CRM handoff doc):
|
|
313
|
+
// { name: "Enrich new lead", triggerType: "event",
|
|
314
|
+
// triggerConfig: { eventPattern: "entity.created:lead" },
|
|
315
|
+
// flow: { nodes: [
|
|
316
|
+
// { id: "trigger", type: "trigger" },
|
|
317
|
+
// { id: "enrich", type: "capability", capabilityKey: "enrichment.lookup" },
|
|
318
|
+
// { id: "update", type: "entity_facet_update", profileSlug: "lead" },
|
|
319
|
+
// ], edges: [{ from: "trigger", to: "enrich" }, { from: "enrich", to: "update" }] } }
|
|
320
|
+
// ============================================================================
|
|
321
|
+
|
|
322
|
+
export interface TemplateAutomation {
|
|
323
|
+
/** Stable local key (unused on the wire today — reserved for dedup/refs). */
|
|
324
|
+
key?: string;
|
|
325
|
+
name: string;
|
|
326
|
+
description?: string;
|
|
327
|
+
triggerType: 'event' | 'cron' | 'webhook' | 'manual';
|
|
328
|
+
triggerConfig?: Record<string, unknown>;
|
|
329
|
+
flow: { nodes: unknown[]; edges: unknown[]; precondition?: string };
|
|
330
|
+
status?: 'draft' | 'active' | 'paused';
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// ============================================================================
|
|
334
|
+
// Action placements — template-declarable actions on an entity-detail surface
|
|
335
|
+
//
|
|
336
|
+
// A template says "on the `deal` detail page, show a 'Qualify lead' action that
|
|
337
|
+
// launches playbook X / runs capability Y / triggers automation Z" — with NO
|
|
338
|
+
// per-domain code change. Persisted (by `applyPackagePostWorkspace`) into
|
|
339
|
+
// `workspace.settings.actionPlacements`, which `workspaces.update` merges via
|
|
340
|
+
// `z.record` (no migration, no new table). The browser entity-detail cell reads
|
|
341
|
+
// them for the entity's `profileSlug` and renders a small action row.
|
|
342
|
+
//
|
|
343
|
+
// `ref` is authored as a NAME (playbook/automation name) or a stable capability
|
|
344
|
+
// verb key. The apply door resolves playbook/automation names → row ids so the
|
|
345
|
+
// browser can launch them directly (capability refs pass through). See
|
|
346
|
+
// `PackagePostWorkspaceBody['actionPlacements']` in synap-backend
|
|
347
|
+
// `package-apply-post-workspace.ts` — same shape.
|
|
348
|
+
//
|
|
349
|
+
// Example:
|
|
350
|
+
// actionPlacements:
|
|
351
|
+
// - profileSlug: deal
|
|
352
|
+
// surface: entity-detail
|
|
353
|
+
// kind: playbook
|
|
354
|
+
// ref: "Qualify lead"
|
|
355
|
+
// label: "Qualify lead"
|
|
356
|
+
// ============================================================================
|
|
357
|
+
|
|
358
|
+
export interface TemplateActionPlacement {
|
|
359
|
+
/** Entity kind whose detail surface this action appears on. */
|
|
360
|
+
profileSlug: string;
|
|
361
|
+
/** Where the action renders. Only "entity-detail" is consumed today. */
|
|
362
|
+
surface: 'entity-detail' | string;
|
|
363
|
+
/** What the action does when clicked. */
|
|
364
|
+
kind: 'capability' | 'playbook' | 'automation';
|
|
365
|
+
/**
|
|
366
|
+
* Reference to the thing to run: a capability verb key, or a playbook /
|
|
367
|
+
* automation NAME (resolved to a row id at apply time).
|
|
368
|
+
*/
|
|
369
|
+
ref: string;
|
|
370
|
+
/** Human label shown on the action button. */
|
|
371
|
+
label: string;
|
|
372
|
+
/** Additional entity-state requirements, evaluated by the rendering surface. */
|
|
373
|
+
when?: {
|
|
374
|
+
/** All listed workspace facets must be present on the entity. */
|
|
375
|
+
requiredFacetSlugs?: string[];
|
|
376
|
+
/** Entity property values that must equal their configured literal values. */
|
|
377
|
+
propertyEquals?: Record<string, unknown>;
|
|
378
|
+
/** Any configured property/value match makes the action applicable. */
|
|
379
|
+
propertyAnyEquals?: Record<string, unknown[]>;
|
|
380
|
+
/** Entity property values that must not equal their configured literal values. */
|
|
381
|
+
propertyNotEquals?: Record<string, unknown>;
|
|
382
|
+
};
|
|
383
|
+
/** Explicit intent required before a consequential action is launched. */
|
|
384
|
+
confirmation?: {
|
|
385
|
+
title: string;
|
|
386
|
+
description?: string;
|
|
387
|
+
confirmLabel?: string;
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
|
|
300
391
|
// ============================================================================
|
|
301
392
|
// Integrations — capability templates (tools/connectors) to install
|
|
302
393
|
//
|
|
@@ -506,6 +597,18 @@ export interface WorkspaceYaml {
|
|
|
506
597
|
/** Playbooks (session templates) seeded with the workspace */
|
|
507
598
|
playbooks?: TemplatePlaybook[];
|
|
508
599
|
|
|
600
|
+
/**
|
|
601
|
+
* Flow-based automations (WHEN→THEN triggers) seeded with the workspace.
|
|
602
|
+
* Applier-only — see {@link TemplateAutomation}.
|
|
603
|
+
*/
|
|
604
|
+
automations?: TemplateAutomation[];
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Entity-detail action placements seeded into `settings.actionPlacements`.
|
|
608
|
+
* See {@link TemplateActionPlacement}.
|
|
609
|
+
*/
|
|
610
|
+
actionPlacements?: TemplateActionPlacement[];
|
|
611
|
+
|
|
509
612
|
/** Capability templates (tools/connectors) to install on provisioning */
|
|
510
613
|
integrations?: TemplateIntegration[];
|
|
511
614
|
|