@synap-core/workspace-templates 0.35.0 → 0.36.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/{define-DHDi8C33.d.ts → define-YL-hIPcn.d.ts} +10 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +75 -0
- package/dist/index.js.map +1 -1
- package/dist/wire.d.ts +1 -1
- package/package.json +1 -1
- package/src/crm-health.template.test.ts +82 -0
- package/src/crm.yaml +102 -0
- package/src/templates.ts +75 -0
- package/src/types.ts +5 -0
package/dist/wire.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as PackageDefinitionOutput, X as WorkspaceDefinitionInput } from './define-
|
|
1
|
+
import { g as PackageDefinitionOutput, X as WorkspaceDefinitionInput } from './define-YL-hIPcn.js';
|
|
2
2
|
import '@synap-core/types/presentation';
|
|
3
3
|
import '@synap-core/types/space-brief';
|
|
4
4
|
import '@synap-core/types/capability-intents';
|
package/package.json
CHANGED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CRM's Health dashboard (design b199a3a4 Question 2, slice 5), pinned
|
|
3
|
+
* against the REAL YAML corpus, the real validator and the published cell
|
|
4
|
+
* bridge. The CRM app (site-crm, slice 6) codes against these names:
|
|
5
|
+
*
|
|
6
|
+
* - the view is the bento "Health" (slug health) of the CRM space, with no
|
|
7
|
+
* profile and no tile shipped: every tile is a cell a person approved;
|
|
8
|
+
* - the playbook is "Propose a Health cell", one param `question` (text,
|
|
9
|
+
* required); its run files ONE cell/define proposal through
|
|
10
|
+
* synap_create_cell with contentKind widget and placeOn the Health view.
|
|
11
|
+
*
|
|
12
|
+
* The bridge ops the goal teaches are the ones `@synap-core/types/cell-bridge`
|
|
13
|
+
* answers, derived from its table: a op added or removed there turns this red
|
|
14
|
+
* until the goal says the same.
|
|
15
|
+
*
|
|
16
|
+
* Does NOT cover what an agent does at run time (the goal is prose), nor the
|
|
17
|
+
* install itself (the pod creates the view; a template update does not add a
|
|
18
|
+
* bento view to an existing space).
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { CELL_BRIDGE_READ_OP_NAMES } from "@synap-core/types/cell-bridge";
|
|
22
|
+
import { describe, expect, it } from "vitest";
|
|
23
|
+
import { readYamlTemplates } from "./generate.mjs";
|
|
24
|
+
import type { WorkspaceYaml } from "./types.js";
|
|
25
|
+
import { validateTemplate } from "./validate.js";
|
|
26
|
+
|
|
27
|
+
const NAME = "Propose a Health cell";
|
|
28
|
+
|
|
29
|
+
const corpus = readYamlTemplates().map((t) => t.data as WorkspaceYaml);
|
|
30
|
+
const crm = corpus.find((x) => x.meta.slug === "crm")!;
|
|
31
|
+
const pb = () => {
|
|
32
|
+
const found = crm.playbooks?.find((p) => p.name === NAME);
|
|
33
|
+
if (!found) throw new Error(`playbook "${NAME}" not in crm`);
|
|
34
|
+
return found;
|
|
35
|
+
};
|
|
36
|
+
const goal = () => String(pb().goalTemplate ?? "").replace(/\s+/g, " ");
|
|
37
|
+
|
|
38
|
+
describe("CRM — Health", () => {
|
|
39
|
+
it("crm validates against the corpus", () => {
|
|
40
|
+
expect(validateTemplate(crm, { corpus }).errors).toEqual([]);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("ships one Health bento, scoped to no profile, with no tile", () => {
|
|
44
|
+
const health = (crm.views ?? []).filter((v) => v.name === "Health");
|
|
45
|
+
expect(health).toHaveLength(1);
|
|
46
|
+
const view = health[0] as unknown as Record<string, unknown>;
|
|
47
|
+
expect(view).toMatchObject({ slug: "health", type: "bento", config: { layout: "bento", blocks: [] } });
|
|
48
|
+
// A profile would make it a profile dashboard (metadata.isProfileBento).
|
|
49
|
+
expect(view.scopeProfileSlug).toBeUndefined();
|
|
50
|
+
expect(view.scopeProfileSlugs).toBeUndefined();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("the playbook asks one question and has no subject, activator or extra grant", () => {
|
|
54
|
+
const p = pb() as unknown as Record<string, unknown>;
|
|
55
|
+
expect(p.params).toEqual([{ name: "question", type: "text", label: "What should the tile answer?", required: true }]);
|
|
56
|
+
expect(goal()).toContain("{question}");
|
|
57
|
+
expect(p.subjectProfile).toBeUndefined();
|
|
58
|
+
expect(p.activators).toBeUndefined();
|
|
59
|
+
expect(p.grants).toBeUndefined();
|
|
60
|
+
// MCP synap_create_cell carries placeOn and contentKind; Synap AI's create_cell does not yet.
|
|
61
|
+
expect(p.executor).toBe("external-agent");
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("the run files one placed widget cell in the CRM space, and a person approves it", () => {
|
|
65
|
+
const g = goal();
|
|
66
|
+
expect(g).toContain("synap_create_cell");
|
|
67
|
+
expect(g).toContain("contentKind widget");
|
|
68
|
+
expect(g).toContain("placeOn = {viewId: the Health view's id}");
|
|
69
|
+
expect(g).toContain("workspaceId = the CRM space (never pod-wide");
|
|
70
|
+
const stages = (pb().stages ?? []) as Array<Record<string, unknown>>;
|
|
71
|
+
expect(stages.map((s) => s.key)).toEqual(["draft", "approve"]);
|
|
72
|
+
expect(stages[1]).toMatchObject({ gate: { kind: "human" }, onFail: { toStage: "draft" } });
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("teaches exactly the read ops the cell bridge answers", () => {
|
|
76
|
+
expect(CELL_BRIDGE_READ_OP_NAMES.length).toBeGreaterThan(5);
|
|
77
|
+
const listed = /op of the bridge table \(([^)]*)\)/.exec(goal());
|
|
78
|
+
expect(listed, "the goal lists the bridge ops in parentheses").not.toBeNull();
|
|
79
|
+
const ops = listed![1].split(",").map((s) => s.trim());
|
|
80
|
+
expect([...ops].sort()).toEqual([...CELL_BRIDGE_READ_OP_NAMES].sort());
|
|
81
|
+
});
|
|
82
|
+
});
|
package/src/crm.yaml
CHANGED
|
@@ -834,6 +834,21 @@ views:
|
|
|
834
834
|
config:
|
|
835
835
|
groupByField: status
|
|
836
836
|
cardFields: [channel, touchType, sentDate]
|
|
837
|
+
# Health: the sales dashboard of the CRM space, a bento whose tiles are HTML
|
|
838
|
+
# cells an AI proposes and a person approves (design b199a3a4 Question 2,
|
|
839
|
+
# option A). It starts empty: each tile lands through "Propose a Health
|
|
840
|
+
# cell" (cell/define with placeOn = this view, backend#926), and the CRM
|
|
841
|
+
# app and the desktop draw the same view. A bento without a profile is not a
|
|
842
|
+
# profile dashboard. Note: a template update does not add a bento view to a
|
|
843
|
+
# space that already exists (the reconcile defers bento views); a fresh
|
|
844
|
+
# install gets it.
|
|
845
|
+
- name: Health
|
|
846
|
+
slug: health
|
|
847
|
+
type: bento
|
|
848
|
+
description: The health of your sales at a glance, one tile per question you asked, each one approved by you.
|
|
849
|
+
config:
|
|
850
|
+
layout: bento
|
|
851
|
+
blocks: []
|
|
837
852
|
|
|
838
853
|
onboarding:
|
|
839
854
|
goal: >
|
|
@@ -2117,6 +2132,93 @@ playbooks:
|
|
|
2117
2132
|
statement: The lead records the date and the channel the estimate was sent on.
|
|
2118
2133
|
check: { kind: judge }
|
|
2119
2134
|
|
|
2135
|
+
# ── Propose a Health cell — one tile of the Health view ─────────────────
|
|
2136
|
+
# Design b199a3a4 Question 2, slice 5. The person asks a question of their
|
|
2137
|
+
# sales ("reply rate by audience, weekly"); the AI writes ONE HTML cell that
|
|
2138
|
+
# answers it and files it with synap_create_cell, contentKind widget and
|
|
2139
|
+
# placeOn = the Health view: approving the proposal defines the cell and
|
|
2140
|
+
# puts its tile on Health in one act (backend#926). Governed: an agent's
|
|
2141
|
+
# cell/define is always a proposal, and the person approves it in the CRM
|
|
2142
|
+
# ("Add to Health") or in the pod.
|
|
2143
|
+
# The cell reads pod data only through the cell bridge (window.synap.query
|
|
2144
|
+
# with the ops of @synap-core/types/cell-bridge read-ops.ts); the host stamps
|
|
2145
|
+
# the space. The bridge has no message op yet (design slice 7), so a number
|
|
2146
|
+
# it cannot read is baked into the page as a snapshot with its date.
|
|
2147
|
+
# executor external-agent: the run needs synap_create_cell with placeOn and
|
|
2148
|
+
# contentKind, which only the MCP door carries today; Synap AI's own
|
|
2149
|
+
# create_cell (synap-intelligence-service creative-loop-tools.ts) sends
|
|
2150
|
+
# neither, so its cell would land nowhere. Switch to is-agent once it does.
|
|
2151
|
+
# No grants: the run uses pod reads and the cells door, no tool or skill.
|
|
2152
|
+
- name: Propose a Health cell
|
|
2153
|
+
description: Answer one question about your sales with a tile on the Health dashboard; the AI writes the tile and you approve it before it shows. Run by one of your agents for now (Synap AI cannot place a tile yet).
|
|
2154
|
+
goalTemplate: >-
|
|
2155
|
+
Propose one Health tile that answers: {question}. FIND THE VIEW: in the
|
|
2156
|
+
CRM space, the bento view named Health (synap_list_views with the
|
|
2157
|
+
space's workspaceId, type bento). When the space has none, stop and say
|
|
2158
|
+
so: never create another dashboard. READ FIRST: what already sits on
|
|
2159
|
+
Health (its config.blocks: each widget tile names a cell by widgetType)
|
|
2160
|
+
and the space's cells (synap_list_widgets); when a tile already answers
|
|
2161
|
+
the question, say which one and stop. DATA: decide where each number
|
|
2162
|
+
comes from. A cell reads the pod ONLY through the cell bridge, at
|
|
2163
|
+
render time: window.synap.query(op, params), with an op of the bridge
|
|
2164
|
+
table (entities.list, entities.get, views.list, profiles.list,
|
|
2165
|
+
lifecycle.board, lifecycle.throughput, attention.needsYou,
|
|
2166
|
+
attention.count, sessions.list, lifecycle.home, lifecycle.moving,
|
|
2167
|
+
documents.get, lens.page) and only that op's params; the host stamps
|
|
2168
|
+
the space, so never put a workspaceId, a token, a pod URL or a fetch in
|
|
2169
|
+
the page. What the bridge reads stays live: query it in the page, never
|
|
2170
|
+
paste its rows. What it cannot read yet (messages, replies, sends: the
|
|
2171
|
+
bridge has no message op) you read now with your own tools
|
|
2172
|
+
(synap_get_channel, synap_get_entities) and write into the page as a
|
|
2173
|
+
snapshot, with the date it was taken shown on the tile (for example "au 8 novembre")
|
|
2174
|
+
and how it was counted. Never invent a number: a figure you cannot
|
|
2175
|
+
source is left out and the tile says what is missing. THE PAGE: one
|
|
2176
|
+
self-contained HTML page, inline script and style only (no CDN, no
|
|
2177
|
+
remote font or image: the frame's CSP refuses them), that answers the
|
|
2178
|
+
question in one glance (a number, a short table or a small chart), in
|
|
2179
|
+
the person's language (French by default), readable in light and dark,
|
|
2180
|
+
and that shows an error, never an empty tile, when a query fails. FILE
|
|
2181
|
+
IT: synap_create_cell with name = a short title of the question,
|
|
2182
|
+
rendererSource = the page, workspaceId = the CRM space (never pod-wide:
|
|
2183
|
+
the CRM app reads only its space's cells), contentKind widget, placeOn
|
|
2184
|
+
= {viewId: the Health view's id}, and reasoning = the question in the
|
|
2185
|
+
person's words. It comes back proposed: that is success, never retry
|
|
2186
|
+
it; the person approves it in the CRM or the pod, which defines the
|
|
2187
|
+
cell and puts its tile on Health in one act. One cell per run.
|
|
2188
|
+
# No activator: a run is started by the person (the CRM's "Ask for a
|
|
2189
|
+
# tile"), and an activator fires on a subject this process has none of.
|
|
2190
|
+
params:
|
|
2191
|
+
- { name: question, type: text, label: What should the tile answer?, required: true }
|
|
2192
|
+
executor: external-agent
|
|
2193
|
+
status: active
|
|
2194
|
+
stages:
|
|
2195
|
+
- key: draft
|
|
2196
|
+
name: Write the tile
|
|
2197
|
+
category: started
|
|
2198
|
+
goal: Find the Health view, check no tile already answers the question, write one self-contained HTML page that answers it (live through the cell bridge, a dated snapshot for what the bridge cannot read), and file it with synap_create_cell, contentKind widget, workspaceId the CRM space and placeOn the Health view.
|
|
2199
|
+
expectedOutputs:
|
|
2200
|
+
# The proposed cell: a `cell/define` proposal carrying the page and
|
|
2201
|
+
# its placement. It writes no edge to a subject (the run has none).
|
|
2202
|
+
- { kind: cell, label: Proposed Health tile, relationToSubject: none }
|
|
2203
|
+
criteria:
|
|
2204
|
+
# Judges: no core or catalog verb reads a session's proposals and
|
|
2205
|
+
# answers {passed}, so the pod has no exact check for these yet.
|
|
2206
|
+
- key: health-cell-placed
|
|
2207
|
+
statement: One cell/define proposal was filed through synap_create_cell with contentKind widget, workspaceId the CRM space and placeOn the Health view's id, and no other dashboard or view was created.
|
|
2208
|
+
check: { kind: judge }
|
|
2209
|
+
- key: health-cell-bridge-only
|
|
2210
|
+
statement: The page reads pod data only through window.synap.query with ops of the cell bridge table, and holds no token, pod URL, workspaceId, fetch or remote script, style, font or image.
|
|
2211
|
+
check: { kind: judge }
|
|
2212
|
+
- key: health-cell-sourced
|
|
2213
|
+
statement: Every number the page shows is either queried live through the bridge or a snapshot shown with the date it was taken and how it was counted; no number is invented.
|
|
2214
|
+
check: { kind: judge }
|
|
2215
|
+
- key: approve
|
|
2216
|
+
name: You approve the tile
|
|
2217
|
+
category: completed
|
|
2218
|
+
goal: The person previews the proposed tile and approves it (the cell is defined and its tile placed on Health) or rejects it.
|
|
2219
|
+
gate: { kind: human }
|
|
2220
|
+
onFail: { toStage: draft }
|
|
2221
|
+
|
|
2120
2222
|
# The lead requirement keeps "Qualify a lead" out of plain person/company
|
|
2121
2223
|
# records (rendered by CRM and Browser through the shared entity-action runner).
|
|
2122
2224
|
actionPlacements:
|
package/src/templates.ts
CHANGED
|
@@ -14366,6 +14366,16 @@ const DATA = {
|
|
|
14366
14366
|
"sentDate"
|
|
14367
14367
|
]
|
|
14368
14368
|
}
|
|
14369
|
+
},
|
|
14370
|
+
{
|
|
14371
|
+
"name": "Health",
|
|
14372
|
+
"slug": "health",
|
|
14373
|
+
"type": "bento",
|
|
14374
|
+
"description": "The health of your sales at a glance, one tile per question you asked, each one approved by you.",
|
|
14375
|
+
"config": {
|
|
14376
|
+
"layout": "bento",
|
|
14377
|
+
"blocks": []
|
|
14378
|
+
}
|
|
14369
14379
|
}
|
|
14370
14380
|
],
|
|
14371
14381
|
"onboarding": {
|
|
@@ -15664,6 +15674,71 @@ const DATA = {
|
|
|
15664
15674
|
]
|
|
15665
15675
|
}
|
|
15666
15676
|
]
|
|
15677
|
+
},
|
|
15678
|
+
{
|
|
15679
|
+
"name": "Propose a Health cell",
|
|
15680
|
+
"description": "Answer one question about your sales with a tile on the Health dashboard; the AI writes the tile and you approve it before it shows. Run by one of your agents for now (Synap AI cannot place a tile yet).",
|
|
15681
|
+
"goalTemplate": "Propose one Health tile that answers: {question}. FIND THE VIEW: in the CRM space, the bento view named Health (synap_list_views with the space's workspaceId, type bento). When the space has none, stop and say so: never create another dashboard. READ FIRST: what already sits on Health (its config.blocks: each widget tile names a cell by widgetType) and the space's cells (synap_list_widgets); when a tile already answers the question, say which one and stop. DATA: decide where each number comes from. A cell reads the pod ONLY through the cell bridge, at render time: window.synap.query(op, params), with an op of the bridge table (entities.list, entities.get, views.list, profiles.list, lifecycle.board, lifecycle.throughput, attention.needsYou, attention.count, sessions.list, lifecycle.home, lifecycle.moving, documents.get, lens.page) and only that op's params; the host stamps the space, so never put a workspaceId, a token, a pod URL or a fetch in the page. What the bridge reads stays live: query it in the page, never paste its rows. What it cannot read yet (messages, replies, sends: the bridge has no message op) you read now with your own tools (synap_get_channel, synap_get_entities) and write into the page as a snapshot, with the date it was taken shown on the tile (for example \"au 8 novembre\") and how it was counted. Never invent a number: a figure you cannot source is left out and the tile says what is missing. THE PAGE: one self-contained HTML page, inline script and style only (no CDN, no remote font or image: the frame's CSP refuses them), that answers the question in one glance (a number, a short table or a small chart), in the person's language (French by default), readable in light and dark, and that shows an error, never an empty tile, when a query fails. FILE IT: synap_create_cell with name = a short title of the question, rendererSource = the page, workspaceId = the CRM space (never pod-wide: the CRM app reads only its space's cells), contentKind widget, placeOn = {viewId: the Health view's id}, and reasoning = the question in the person's words. It comes back proposed: that is success, never retry it; the person approves it in the CRM or the pod, which defines the cell and puts its tile on Health in one act. One cell per run.",
|
|
15682
|
+
"params": [
|
|
15683
|
+
{
|
|
15684
|
+
"name": "question",
|
|
15685
|
+
"type": "text",
|
|
15686
|
+
"label": "What should the tile answer?",
|
|
15687
|
+
"required": true
|
|
15688
|
+
}
|
|
15689
|
+
],
|
|
15690
|
+
"executor": "external-agent",
|
|
15691
|
+
"status": "active",
|
|
15692
|
+
"stages": [
|
|
15693
|
+
{
|
|
15694
|
+
"key": "draft",
|
|
15695
|
+
"name": "Write the tile",
|
|
15696
|
+
"category": "started",
|
|
15697
|
+
"goal": "Find the Health view, check no tile already answers the question, write one self-contained HTML page that answers it (live through the cell bridge, a dated snapshot for what the bridge cannot read), and file it with synap_create_cell, contentKind widget, workspaceId the CRM space and placeOn the Health view.",
|
|
15698
|
+
"expectedOutputs": [
|
|
15699
|
+
{
|
|
15700
|
+
"kind": "cell",
|
|
15701
|
+
"label": "Proposed Health tile",
|
|
15702
|
+
"relationToSubject": "none"
|
|
15703
|
+
}
|
|
15704
|
+
],
|
|
15705
|
+
"criteria": [
|
|
15706
|
+
{
|
|
15707
|
+
"key": "health-cell-placed",
|
|
15708
|
+
"statement": "One cell/define proposal was filed through synap_create_cell with contentKind widget, workspaceId the CRM space and placeOn the Health view's id, and no other dashboard or view was created.",
|
|
15709
|
+
"check": {
|
|
15710
|
+
"kind": "judge"
|
|
15711
|
+
}
|
|
15712
|
+
},
|
|
15713
|
+
{
|
|
15714
|
+
"key": "health-cell-bridge-only",
|
|
15715
|
+
"statement": "The page reads pod data only through window.synap.query with ops of the cell bridge table, and holds no token, pod URL, workspaceId, fetch or remote script, style, font or image.",
|
|
15716
|
+
"check": {
|
|
15717
|
+
"kind": "judge"
|
|
15718
|
+
}
|
|
15719
|
+
},
|
|
15720
|
+
{
|
|
15721
|
+
"key": "health-cell-sourced",
|
|
15722
|
+
"statement": "Every number the page shows is either queried live through the bridge or a snapshot shown with the date it was taken and how it was counted; no number is invented.",
|
|
15723
|
+
"check": {
|
|
15724
|
+
"kind": "judge"
|
|
15725
|
+
}
|
|
15726
|
+
}
|
|
15727
|
+
]
|
|
15728
|
+
},
|
|
15729
|
+
{
|
|
15730
|
+
"key": "approve",
|
|
15731
|
+
"name": "You approve the tile",
|
|
15732
|
+
"category": "completed",
|
|
15733
|
+
"goal": "The person previews the proposed tile and approves it (the cell is defined and its tile placed on Health) or rejects it.",
|
|
15734
|
+
"gate": {
|
|
15735
|
+
"kind": "human"
|
|
15736
|
+
},
|
|
15737
|
+
"onFail": {
|
|
15738
|
+
"toStage": "draft"
|
|
15739
|
+
}
|
|
15740
|
+
}
|
|
15741
|
+
]
|
|
15667
15742
|
}
|
|
15668
15743
|
],
|
|
15669
15744
|
"actionPlacements": [
|
package/src/types.ts
CHANGED
|
@@ -584,6 +584,11 @@ export interface TemplatePlaybook {
|
|
|
584
584
|
* closed `capability_intents` vocabulary (`@synap-core/types/capability-intents`).
|
|
585
585
|
*/
|
|
586
586
|
requiredIntents?: string[];
|
|
587
|
+
/**
|
|
588
|
+
* The rules the process follows, in order (pod `playbookGuidanceSchema`,
|
|
589
|
+
* backend#924): `{ ref: "kind:<slug>" | "skill:<slug>", label?, when?, where? }`.
|
|
590
|
+
*/
|
|
591
|
+
guidance?: Array<{ ref: string; label?: string; when?: string; where?: Record<string, string[]> }>;
|
|
587
592
|
/**
|
|
588
593
|
* DECLARATIONS of when the process starts. Compiled at install/apply into
|
|
589
594
|
* governed rules through the pod's ONE rule door and linked in
|