@synap-core/workspace-templates 0.38.0 → 0.39.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/automations/lead-reply-engaged.automation.json +62 -0
- package/automations/lead-reply-engaged.catalog.json +13 -0
- package/automations/lead-sent-outreach.automation.json +60 -0
- package/automations/lead-sent-outreach.catalog.json +13 -0
- package/dist/{define-YL-hIPcn.d.ts → define-C0Iizc2r.d.ts} +36 -0
- package/dist/index.d.ts +17 -4
- package/dist/index.js +232 -64
- package/dist/index.js.map +1 -1
- package/dist/wire.d.ts +1 -1
- package/package.json +1 -1
- package/src/content-os.template.test.ts +8 -7
- package/src/content-os.yaml +10 -11
- package/src/crm-messages-cadence.template.test.ts +13 -1
- package/src/crm.yaml +34 -40
- package/src/foundation.yaml +53 -8
- package/src/index.ts +1 -0
- package/src/lead-automations.test.ts +104 -0
- package/src/lifecycle-declarations.test.ts +109 -0
- package/src/lifecycle-waits.parity.test.ts +91 -0
- package/src/templates.ts +167 -63
- package/src/types.ts +23 -0
- package/src/validate.ts +87 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "A lead replies: outreach moves to engaged",
|
|
3
|
+
"description": "When an inbound message is a reply, the sender's lead moves from outreach to engaged through the one status door (the person's own lead first, else their company's single lead; several leads move nothing). A person who is not in outreach is left where they are. Governance decides whether the move goes straight through or becomes a proposal.",
|
|
4
|
+
"triggerType": "event",
|
|
5
|
+
"status": "active",
|
|
6
|
+
"triggerConfig": {
|
|
7
|
+
"eventPattern": "external_message.received.completed",
|
|
8
|
+
"filters": { "isReply": true }
|
|
9
|
+
},
|
|
10
|
+
"flowDefinition": {
|
|
11
|
+
"nodes": [
|
|
12
|
+
{
|
|
13
|
+
"id": "t",
|
|
14
|
+
"type": "trigger",
|
|
15
|
+
"position": { "x": 0, "y": 0 },
|
|
16
|
+
"data": {
|
|
17
|
+
"label": "An inbound reply",
|
|
18
|
+
"triggerType": "event",
|
|
19
|
+
"config": {
|
|
20
|
+
"eventPattern": "external_message.received.completed",
|
|
21
|
+
"filters": { "isReply": true }
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"id": "has-person",
|
|
27
|
+
"type": "guard",
|
|
28
|
+
"position": { "x": 0, "y": 120 },
|
|
29
|
+
"data": {
|
|
30
|
+
"label": "The reply names the person it came from",
|
|
31
|
+
"checks": [
|
|
32
|
+
{
|
|
33
|
+
"path": "trigger.payload.data.entityId",
|
|
34
|
+
"minLength": 36,
|
|
35
|
+
"message": "The inbound message is not tied to a person or company: there is no lead to move."
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"id": "engage",
|
|
42
|
+
"type": "output",
|
|
43
|
+
"position": { "x": 0, "y": 240 },
|
|
44
|
+
"data": {
|
|
45
|
+
"label": "Move the lead from outreach to engaged",
|
|
46
|
+
"outputType": "facet_update",
|
|
47
|
+
"config": {
|
|
48
|
+
"entityId": "{{trigger.payload.data.entityId}}",
|
|
49
|
+
"facetSlug": "lead",
|
|
50
|
+
"viaRelation": "works_at",
|
|
51
|
+
"expectedStatus": "outreach",
|
|
52
|
+
"status": "engaged"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"edges": [
|
|
58
|
+
{ "id": "e1", "source": "t", "target": "has-person" },
|
|
59
|
+
{ "id": "e2", "source": "has-person", "target": "engage" }
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"apiVersion": "synap/v1",
|
|
3
|
+
"kind": "automation",
|
|
4
|
+
"meta": {
|
|
5
|
+
"slug": "lead-reply-engaged",
|
|
6
|
+
"name": "A lead replies: outreach moves to engaged",
|
|
7
|
+
"description": "When an inbound message is a reply, the sender's lead moves from outreach to engaged through the one status door. Needs the lead role (foundation); the move is governed like any other.",
|
|
8
|
+
"tags": ["automation", "crm", "outreach", "lead"],
|
|
9
|
+
"isPublic": false,
|
|
10
|
+
"owner": "template-owner"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": []
|
|
13
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "A first message goes out: a qualified lead moves to outreach",
|
|
3
|
+
"description": "When a message is sent to a person (from the pod's send door, or from their own devices), that person's lead moves from qualified to outreach through the one status door (the person's own lead first, else their company's single lead; several leads move nothing). We qualify before we contact: a lead that is not qualified, or already in outreach or beyond, is left where it is. Governance decides whether the move goes straight through or becomes a proposal.",
|
|
4
|
+
"triggerType": "event",
|
|
5
|
+
"status": "active",
|
|
6
|
+
"triggerConfig": {
|
|
7
|
+
"eventPattern": "external_message.sent.completed"
|
|
8
|
+
},
|
|
9
|
+
"flowDefinition": {
|
|
10
|
+
"nodes": [
|
|
11
|
+
{
|
|
12
|
+
"id": "t",
|
|
13
|
+
"type": "trigger",
|
|
14
|
+
"position": { "x": 0, "y": 0 },
|
|
15
|
+
"data": {
|
|
16
|
+
"label": "A message was sent to a person",
|
|
17
|
+
"triggerType": "event",
|
|
18
|
+
"config": {
|
|
19
|
+
"eventPattern": "external_message.sent.completed"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": "has-person",
|
|
25
|
+
"type": "guard",
|
|
26
|
+
"position": { "x": 0, "y": 120 },
|
|
27
|
+
"data": {
|
|
28
|
+
"label": "The message names the person it went to",
|
|
29
|
+
"checks": [
|
|
30
|
+
{
|
|
31
|
+
"path": "trigger.payload.data.entityId",
|
|
32
|
+
"minLength": 36,
|
|
33
|
+
"message": "The sent message is not tied to a person or company: there is no lead to move."
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": "reach",
|
|
40
|
+
"type": "output",
|
|
41
|
+
"position": { "x": 0, "y": 240 },
|
|
42
|
+
"data": {
|
|
43
|
+
"label": "Move the lead from qualified to outreach",
|
|
44
|
+
"outputType": "facet_update",
|
|
45
|
+
"config": {
|
|
46
|
+
"entityId": "{{trigger.payload.data.entityId}}",
|
|
47
|
+
"facetSlug": "lead",
|
|
48
|
+
"viaRelation": "works_at",
|
|
49
|
+
"expectedStatus": "qualified",
|
|
50
|
+
"status": "outreach"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
"edges": [
|
|
56
|
+
{ "id": "e1", "source": "t", "target": "has-person" },
|
|
57
|
+
{ "id": "e2", "source": "has-person", "target": "reach" }
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"apiVersion": "synap/v1",
|
|
3
|
+
"kind": "automation",
|
|
4
|
+
"meta": {
|
|
5
|
+
"slug": "lead-sent-outreach",
|
|
6
|
+
"name": "A first message goes out: a qualified lead moves to outreach",
|
|
7
|
+
"description": "When a message is sent to a person, their lead moves from qualified to outreach through the one status door. Needs the lead role (foundation); the move is governed like any other.",
|
|
8
|
+
"tags": ["automation", "crm", "outreach", "lead"],
|
|
9
|
+
"isPublic": false,
|
|
10
|
+
"owner": "template-owner"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": []
|
|
13
|
+
}
|
|
@@ -186,7 +186,43 @@ interface TemplateLifecycleOption {
|
|
|
186
186
|
* someone without being a pause. Open/active/paused only.
|
|
187
187
|
*/
|
|
188
188
|
waits?: TemplateLifecycleOptionWaits;
|
|
189
|
+
/**
|
|
190
|
+
* What a thing standing here must HAVE before it can move on (a lead in
|
|
191
|
+
* `outreach` needs a contact). Each unmet one is a derived blocker on the
|
|
192
|
+
* thing, never a stored flag. The pod's `LifecycleOptionRequirement`.
|
|
193
|
+
* Open/active/paused only.
|
|
194
|
+
*/
|
|
195
|
+
requires?: TemplateLifecycleRequirement[];
|
|
189
196
|
}
|
|
197
|
+
/** One requirement of a step (the pod's `LifecycleOptionRequirement`): typed and closed. */
|
|
198
|
+
type TemplateLifecycleRequirement = {
|
|
199
|
+
/** The blocker's domain name (`no_contact`); unique in its option. */
|
|
200
|
+
blockerKey: string;
|
|
201
|
+
label?: string;
|
|
202
|
+
/** Exactly one of `{answer: true}`, `{intent}`, `{playbookId}`, `{capability}`. */
|
|
203
|
+
clearedBy?: {
|
|
204
|
+
answer: true;
|
|
205
|
+
} | {
|
|
206
|
+
intent: string;
|
|
207
|
+
} | {
|
|
208
|
+
playbookId: string;
|
|
209
|
+
} | {
|
|
210
|
+
capability: string;
|
|
211
|
+
};
|
|
212
|
+
/** Whose move it is; absent ⇒ `you`. */
|
|
213
|
+
owner?: "you" | "agent";
|
|
214
|
+
/** Only things of these kinds (profile slugs) are held to it. */
|
|
215
|
+
forKinds?: string[];
|
|
216
|
+
} & ({
|
|
217
|
+
kind: "link";
|
|
218
|
+
relation: string;
|
|
219
|
+
direction: "out" | "in";
|
|
220
|
+
min?: number;
|
|
221
|
+
} | {
|
|
222
|
+
kind: "property";
|
|
223
|
+
property: string;
|
|
224
|
+
in?: string[];
|
|
225
|
+
});
|
|
190
226
|
/** A step's declared wait (the pod's `LifecycleOptionWaits`). */
|
|
191
227
|
interface TemplateLifecycleOptionWaits {
|
|
192
228
|
/** A hold's `on`, never `unspecified`: person · agent · external · thing · decision · date · nobody. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as WorkspaceYaml, T as TemplateDependency, a as TemplateLifecycleOption, b as TemplateLifecycleOptionWaits } from './define-
|
|
2
|
-
export { B as BentoViewBlockWire, c as BentoWidgetBlockWire, d as BuiltSpacePackage, e as BuiltSpacePackageCell, I as INTENT_LABEL_MAX, P as PACKAGE_DEPENDENCY_KINDS, f as PackageAutomationWire, g as PackageDefinitionOutput, h as PackageDependencyKind, S as START_EXAMPLE_RANGE, i as START_STARTERS_RANGE, j as START_VIEWS_MAX, k as SpacePackageCellWire, l as SplitBentoBlocks, m as TemplateActionPlacement, n as TemplateAppKind, o as TemplateAppRef, p as TemplateAutomation, q as TemplateBentoBlock, r as TemplateDefaultSource, s as TemplateDisplayTemplate, t as TemplateEntityLink, u as TemplateExtendsRef, v as TemplateIntegration, w as TemplateIntent, x as TemplateLayoutConfig, y as TemplateMeta, z as TemplateOnboarding, A as TemplateOnboardingCollectTarget, C as TemplatePlaybook, D as TemplatePlaybookParam, E as TemplatePrimarySurface, F as TemplateProfile, G as TemplateProfileEntityBentoTemplates, H as TemplateProperty, J as TemplateSeedEntity, K as TemplateSidebarItem, L as TemplateSidebarSurface, M as TemplateSourceRole, N as TemplateSpacePackage, O as TemplateSpacePackageCell, Q as TemplateStart, R as TemplateSuggestedRelation, U as TemplateView, V as ToDefinitionResult, X as WorkspaceDefinitionInput, Y as WorkspaceJsonValue, Z as WorkspacePrimarySurface, _ as WorkspacePrimarySurfaceViewReference, $ as normalizeTemplateLayout, a0 as spacePackageCells, a1 as splitBentoBlocks, a2 as toAutomationWire, a3 as toPackageDefinition, a4 as toWorkspaceDefinition } from './define-
|
|
1
|
+
import { W as WorkspaceYaml, T as TemplateDependency, a as TemplateLifecycleOption, b as TemplateLifecycleOptionWaits } from './define-C0Iizc2r.js';
|
|
2
|
+
export { B as BentoViewBlockWire, c as BentoWidgetBlockWire, d as BuiltSpacePackage, e as BuiltSpacePackageCell, I as INTENT_LABEL_MAX, P as PACKAGE_DEPENDENCY_KINDS, f as PackageAutomationWire, g as PackageDefinitionOutput, h as PackageDependencyKind, S as START_EXAMPLE_RANGE, i as START_STARTERS_RANGE, j as START_VIEWS_MAX, k as SpacePackageCellWire, l as SplitBentoBlocks, m as TemplateActionPlacement, n as TemplateAppKind, o as TemplateAppRef, p as TemplateAutomation, q as TemplateBentoBlock, r as TemplateDefaultSource, s as TemplateDisplayTemplate, t as TemplateEntityLink, u as TemplateExtendsRef, v as TemplateIntegration, w as TemplateIntent, x as TemplateLayoutConfig, y as TemplateMeta, z as TemplateOnboarding, A as TemplateOnboardingCollectTarget, C as TemplatePlaybook, D as TemplatePlaybookParam, E as TemplatePrimarySurface, F as TemplateProfile, G as TemplateProfileEntityBentoTemplates, H as TemplateProperty, J as TemplateSeedEntity, K as TemplateSidebarItem, L as TemplateSidebarSurface, M as TemplateSourceRole, N as TemplateSpacePackage, O as TemplateSpacePackageCell, Q as TemplateStart, R as TemplateSuggestedRelation, U as TemplateView, V as ToDefinitionResult, X as WorkspaceDefinitionInput, Y as WorkspaceJsonValue, Z as WorkspacePrimarySurface, _ as WorkspacePrimarySurfaceViewReference, $ as normalizeTemplateLayout, a0 as spacePackageCells, a1 as splitBentoBlocks, a2 as toAutomationWire, a3 as toPackageDefinition, a4 as toWorkspaceDefinition } from './define-C0Iizc2r.js';
|
|
3
3
|
import '@synap-core/types/presentation';
|
|
4
4
|
import '@synap-core/types/space-brief';
|
|
5
5
|
import '@synap-core/types/capability-intents';
|
|
@@ -731,7 +731,7 @@ declare function collectBaseProfileSlugs(data: WorkspaceYaml, resolveDep: (slug:
|
|
|
731
731
|
* `option.ts`), same reason as above; `lifecycle-waits.parity.test.ts` pins
|
|
732
732
|
* them to that source and to the pod's parser.
|
|
733
733
|
*/
|
|
734
|
-
declare const LIFECYCLE_OPTION_FIELDS: readonly ["key", "label", "category", "tone", "humanOnly", "stuckAfterDays", "dateBinding", "waits"];
|
|
734
|
+
declare const LIFECYCLE_OPTION_FIELDS: readonly ["key", "label", "category", "tone", "humanOnly", "stuckAfterDays", "dateBinding", "waits", "requires"];
|
|
735
735
|
declare const LIFECYCLE_OPTION_WAITS_FIELDS: readonly ["on", "waitKind", "refFrom", "dateBinding"];
|
|
736
736
|
/**
|
|
737
737
|
* What a step may say it waits on: MIRROR of the pod's `HOLD_ON` without
|
|
@@ -758,6 +758,19 @@ declare function lifecycleOptionWaitsProblems(option: {
|
|
|
758
758
|
field: "dateBinding" | "waits";
|
|
759
759
|
message: string;
|
|
760
760
|
}>;
|
|
761
|
+
/**
|
|
762
|
+
* The problem (words) with one option's `requires`, or null: a MIRROR of the
|
|
763
|
+
* pod's `parseOptionRequires` (`packages/database/src/utils/lifecycle-model.ts`),
|
|
764
|
+
* same rules in the same order, so the catalog accepts a `requires` exactly when
|
|
765
|
+
* the pod does. Names are checked for SHAPE only (the pod does not check that a
|
|
766
|
+
* relation type or a property exists: a role may name the property of the kind
|
|
767
|
+
* wearing it). Pinned to the pod by `lifecycle-requires.parity.test.ts`.
|
|
768
|
+
*/
|
|
769
|
+
declare function lifecycleOptionRequiresProblem(option: {
|
|
770
|
+
key?: unknown;
|
|
771
|
+
category?: unknown;
|
|
772
|
+
requires?: unknown;
|
|
773
|
+
}): string | null;
|
|
761
774
|
/**
|
|
762
775
|
* Validate ONE template. Pure: returns `{ ok, errors }`, never exits. Covers the
|
|
763
776
|
* per-template rules formerly split across build.mjs `validate()` (required
|
|
@@ -931,4 +944,4 @@ declare function validateFlowDefinition(flow: unknown, resolvers?: FlowValidatio
|
|
|
931
944
|
*/
|
|
932
945
|
declare function flowValidationErrorMessage(flow: unknown, resolvers?: FlowValidationResolvers): string | null;
|
|
933
946
|
|
|
934
|
-
export { type AssembleCatalogInput, BASE_LIFECYCLES, type BaseLifecycleName, type BundledCatalogEntry, type BundledEntry, CHANNEL_MESSAGE_CHANNEL_TYPES, type CatalogEntry, type CompositionEdge, type CompositionGraph, type CompositionInstalledEntry, type CompositionNode, type CompositionOverlay, type ConceptViolation, type CpPackageRow, DECLARED_DIVERGENCES, type DomainGroup, FLOW_NODE_TYPES, FLOW_OUTPUT_TYPES, type FlowValidationError, type FlowValidationResolvers, type FlowValidationResult, type InstalledTemplate, LIFECYCLE_OPTION_FIELDS, LIFECYCLE_OPTION_WAITS_FIELDS, LIFECYCLE_WAITS_ON, LIFECYCLE_WAIT_KINDS, type LayerTemplateGraphInput, type LifecyclePresetProblem, type LifecyclePresetResolution, type MergeCatalogInput, type MergeCatalogResult, OTHER_DOMAIN_ID, OTHER_DOMAIN_LABEL, REQUIRED_META_FIELDS, REQUIRED_WORKSPACE_FIELDS, type RemoteCatalogEntry, type RemoteEntry, type RemoteSourceStatus, SYSTEM_PROFILES, TEMPLATE_DOMAINS, TRACK_TEMPLATE_ITEM_KIND, type TemplateConverters, TemplateDependency, type TemplateDomain, type TemplateLifecycleAdoption, type TemplateLifecycleStepAdd, type TemplateUpdateCheck, type ValidateOptions, type ValidateResult, type ValidationError, WORKSPACE_TEMPLATES, WORK_TEMPLATE_ITEM_KIND, type WorkspaceTemplateSlug, WorkspaceYaml, assembleCatalog, bundledEdgesOf, collectBaseProfileSlugs, computeTemplateUpdates, conceptTerm, derivePlaybookItems, domainLabel, findConceptViolations, flowValidationErrorMessage, formatConceptViolations, getWorkspaceTemplate, groupByDomain, isHashVersion, isKnownDomain, layerTemplateGraph, lifecycleOptionWaitsProblems, listPublicTemplates, listWorkspaceTemplates, mergeCatalog, resolveLifecyclePresets, rowToRemoteEntry, validateFlowDefinition, validateTemplate };
|
|
947
|
+
export { type AssembleCatalogInput, BASE_LIFECYCLES, type BaseLifecycleName, type BundledCatalogEntry, type BundledEntry, CHANNEL_MESSAGE_CHANNEL_TYPES, type CatalogEntry, type CompositionEdge, type CompositionGraph, type CompositionInstalledEntry, type CompositionNode, type CompositionOverlay, type ConceptViolation, type CpPackageRow, DECLARED_DIVERGENCES, type DomainGroup, FLOW_NODE_TYPES, FLOW_OUTPUT_TYPES, type FlowValidationError, type FlowValidationResolvers, type FlowValidationResult, type InstalledTemplate, LIFECYCLE_OPTION_FIELDS, LIFECYCLE_OPTION_WAITS_FIELDS, LIFECYCLE_WAITS_ON, LIFECYCLE_WAIT_KINDS, type LayerTemplateGraphInput, type LifecyclePresetProblem, type LifecyclePresetResolution, type MergeCatalogInput, type MergeCatalogResult, OTHER_DOMAIN_ID, OTHER_DOMAIN_LABEL, REQUIRED_META_FIELDS, REQUIRED_WORKSPACE_FIELDS, type RemoteCatalogEntry, type RemoteEntry, type RemoteSourceStatus, SYSTEM_PROFILES, TEMPLATE_DOMAINS, TRACK_TEMPLATE_ITEM_KIND, type TemplateConverters, TemplateDependency, type TemplateDomain, type TemplateLifecycleAdoption, type TemplateLifecycleStepAdd, type TemplateUpdateCheck, type ValidateOptions, type ValidateResult, type ValidationError, WORKSPACE_TEMPLATES, WORK_TEMPLATE_ITEM_KIND, type WorkspaceTemplateSlug, WorkspaceYaml, assembleCatalog, bundledEdgesOf, collectBaseProfileSlugs, computeTemplateUpdates, conceptTerm, derivePlaybookItems, domainLabel, findConceptViolations, flowValidationErrorMessage, formatConceptViolations, getWorkspaceTemplate, groupByDomain, isHashVersion, isKnownDomain, layerTemplateGraph, lifecycleOptionRequiresProblem, lifecycleOptionWaitsProblems, listPublicTemplates, listWorkspaceTemplates, mergeCatalog, resolveLifecyclePresets, rowToRemoteEntry, validateFlowDefinition, validateTemplate };
|