@rubytech/create-maxy-code 0.1.125 → 0.1.126

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.
Files changed (53) hide show
  1. package/dist/index.js +11 -1
  2. package/package.json +2 -2
  3. package/payload/platform/lib/graph-style/dist/index.d.ts +78 -0
  4. package/payload/platform/lib/graph-style/dist/index.d.ts.map +1 -0
  5. package/payload/platform/lib/graph-style/dist/index.js +296 -0
  6. package/payload/platform/lib/graph-style/dist/index.js.map +1 -0
  7. package/payload/platform/lib/graph-style/src/__tests__/parity.test.ts +114 -0
  8. package/payload/platform/lib/graph-style/src/index.ts +307 -0
  9. package/payload/platform/lib/graph-style/tsconfig.json +9 -0
  10. package/payload/platform/lib/graph-style/vitest.config.ts +9 -0
  11. package/payload/platform/package-lock.json +318 -0
  12. package/payload/platform/package.json +3 -2
  13. package/payload/platform/plugins/.claude-plugin/marketplace.json +5 -0
  14. package/payload/platform/plugins/docs/references/visitor-graph.md +4 -3
  15. package/payload/platform/plugins/graph-viewer/.claude-plugin/plugin.json +8 -0
  16. package/payload/platform/plugins/graph-viewer/PLUGIN.md +56 -0
  17. package/payload/platform/plugins/graph-viewer/mcp/dist/index.d.ts +7 -0
  18. package/payload/platform/plugins/graph-viewer/mcp/dist/index.d.ts.map +1 -0
  19. package/payload/platform/plugins/graph-viewer/mcp/dist/index.js +74 -0
  20. package/payload/platform/plugins/graph-viewer/mcp/dist/index.js.map +1 -0
  21. package/payload/platform/plugins/graph-viewer/mcp/dist/lib/neo4j.d.ts +5 -0
  22. package/payload/platform/plugins/graph-viewer/mcp/dist/lib/neo4j.d.ts.map +1 -0
  23. package/payload/platform/plugins/graph-viewer/mcp/dist/lib/neo4j.js +43 -0
  24. package/payload/platform/plugins/graph-viewer/mcp/dist/lib/neo4j.js.map +1 -0
  25. package/payload/platform/plugins/graph-viewer/mcp/dist/render/draw.d.ts +28 -0
  26. package/payload/platform/plugins/graph-viewer/mcp/dist/render/draw.d.ts.map +1 -0
  27. package/payload/platform/plugins/graph-viewer/mcp/dist/render/draw.js +73 -0
  28. package/payload/platform/plugins/graph-viewer/mcp/dist/render/draw.js.map +1 -0
  29. package/payload/platform/plugins/graph-viewer/mcp/dist/render/layout.d.ts +40 -0
  30. package/payload/platform/plugins/graph-viewer/mcp/dist/render/layout.d.ts.map +1 -0
  31. package/payload/platform/plugins/graph-viewer/mcp/dist/render/layout.js +77 -0
  32. package/payload/platform/plugins/graph-viewer/mcp/dist/render/layout.js.map +1 -0
  33. package/payload/platform/plugins/graph-viewer/mcp/dist/tools/graph-render.d.ts +45 -0
  34. package/payload/platform/plugins/graph-viewer/mcp/dist/tools/graph-render.d.ts.map +1 -0
  35. package/payload/platform/plugins/graph-viewer/mcp/dist/tools/graph-render.js +170 -0
  36. package/payload/platform/plugins/graph-viewer/mcp/dist/tools/graph-render.js.map +1 -0
  37. package/payload/platform/plugins/graph-viewer/mcp/package.json +25 -0
  38. package/payload/platform/plugins/graph-viewer/mcp/vitest.config.ts +8 -0
  39. package/payload/platform/plugins/graph-viewer/skills/render-graph/SKILL.md +35 -0
  40. package/payload/platform/scripts/check-plugin-tools-mcp-consistency.mjs +136 -0
  41. package/payload/server/public/assets/{admin-D6IfAzYY.js → admin-FcRHAL-3.js} +7 -7
  42. package/payload/server/public/assets/{data-BGbQyufe.js → data-Ds37mflX.js} +1 -1
  43. package/payload/server/public/assets/{graph-D-1lRTeL.js → graph-CmWRhaiS.js} +1 -1
  44. package/payload/server/public/assets/graph-labels-Ch2r00Gt.js +1 -0
  45. package/payload/server/public/assets/page-BOtNny_4.js +51 -0
  46. package/payload/server/public/assets/page-BcHhJXUt.js +1 -0
  47. package/payload/server/public/data.html +3 -3
  48. package/payload/server/public/graph.html +3 -3
  49. package/payload/server/public/index.html +4 -4
  50. package/payload/server/server.js +236 -92
  51. package/payload/server/public/assets/graph-labels-BRXJHNYE.js +0 -1
  52. package/payload/server/public/assets/page-B4oirCvn.js +0 -1
  53. package/payload/server/public/assets/page-FmJ7PIYx.js +0 -51
package/dist/index.js CHANGED
@@ -1171,7 +1171,17 @@ function installNeo4j() {
1171
1171
  const neo4jDataDir = resolve(process.env.HOME ?? "/root", BRAND.configDir, "neo4j-data");
1172
1172
  mkdirSync(neo4jDataDir, { recursive: true });
1173
1173
  shell("neo4j-admin", ["dbms", "set-initial-password", "--", password], { redact: true });
1174
- console.log(" Neo4j installed via Homebrew. Password stored securely.");
1174
+ // Start Neo4j under brew's launchd supervision. Linux path starts the
1175
+ // service via systemd a few lines below; without this start the darwin
1176
+ // brand server binds successfully but every Cypher write fails with
1177
+ // "Failed to connect to server" because nothing is listening on 7687.
1178
+ // `brew services start` is idempotent — if already running it no-ops,
1179
+ // and the LaunchAgent persists across reboots.
1180
+ const brewStart = spawnSync("brew", ["services", "start", "neo4j"], { stdio: "inherit" });
1181
+ if (brewStart.status !== 0) {
1182
+ throw new Error(`brew services start neo4j failed (exit ${brewStart.status}) — Neo4j must be running before the brand server starts or all graph writes will fail`);
1183
+ }
1184
+ console.log(" Neo4j installed and started via Homebrew launchd. Password stored securely.");
1175
1185
  return;
1176
1186
  }
1177
1187
  // Neo4j 5.x supports Java 17 and 21. Debian Bookworm ships 17, Trixie ships 21.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubytech/create-maxy-code",
3
- "version": "0.1.125",
3
+ "version": "0.1.126",
4
4
  "description": "Install Maxy — AI for Productive People",
5
5
  "bin": {
6
6
  "create-maxy-code": "./dist/index.js"
@@ -13,7 +13,7 @@
13
13
  "build": "tsc",
14
14
  "bundle": "node scripts/bundle.js",
15
15
  "test": "npm run build && node --test 'dist/__tests__/*.test.js'",
16
- "prepublishOnly": "bash ../../platform/scripts/verify-skill-tool-surface.sh && node ../../platform/scripts/check-no-task-id-leaks.mjs && node ../../platform/scripts/check-no-esm-require.mjs && node ../../platform/scripts/check-skill-load-coverage.mjs && node ../../platform/ui/scripts/check-route-wiring.mjs && node ../../platform/ui/scripts/check-edge-admin-routes.mjs && npm run build && node --test 'dist/__tests__/*.test.js' && chmod +x dist/index.js && npm run bundle && bash ../../platform/scripts/smoke-boot-services.sh && node ../../platform/ui/scripts/check-bundle-node-imports.mjs --dir=./payload/server/public/assets"
16
+ "prepublishOnly": "bash ../../platform/scripts/verify-skill-tool-surface.sh && node ../../platform/scripts/check-plugin-tools-mcp-consistency.mjs && node ../../platform/scripts/check-no-task-id-leaks.mjs && node ../../platform/scripts/check-no-esm-require.mjs && node ../../platform/scripts/check-skill-load-coverage.mjs && node ../../platform/ui/scripts/check-route-wiring.mjs && node ../../platform/ui/scripts/check-edge-admin-routes.mjs && npm run build && node --test 'dist/__tests__/*.test.js' && chmod +x dist/index.js && npm run bundle && bash ../../platform/scripts/smoke-boot-services.sh && node ../../platform/ui/scripts/check-bundle-node-imports.mjs --dir=./payload/server/public/assets"
17
17
  },
18
18
  "files": [
19
19
  "dist",
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Shared palette + display-string primitives for any surface that renders
3
+ * the Neo4j graph. Both the live `/graph` page in platform/ui and the
4
+ * graph-viewer MCP plugin's PNG renderer import from here so a node looks
5
+ * the same wherever it appears: same colour family per label, same short
6
+ * canvas label per node.
7
+ *
8
+ * UI-only constants (filter-popover sets, zoom-tier wrap helpers,
9
+ * agent-action label sets) stay in platform/ui/app/lib/graph-labels.ts and
10
+ * platform/ui/app/graph/display-helpers.ts — they re-export the symbols
11
+ * defined here. The two parity tests (this lib's __tests__ and the UI's
12
+ * unchanged colour-stability tests) keep the surfaces in lockstep.
13
+ *
14
+ * Sources of truth:
15
+ * - Label list: .docs/neo4j.md "Schema (Phase 0)" + "Standards Compliance"
16
+ * - Brand colour for LocalBusiness: brand.json defaultColors.primary
17
+ * (resolved at runtime; this module supplies the schema-default fallback)
18
+ */
19
+ /**
20
+ * Label → display colour mapping. Closed list of node labels written by
21
+ * the Maxy MCP write paths. A new label without an entry here renders in
22
+ * FALLBACK_LABEL_COLOUR and is omitted from the legend.
23
+ */
24
+ export declare const GRAPH_LABEL_COLOURS: Record<string, string>;
25
+ export declare const FALLBACK_LABEL_COLOUR = "#94A3B8";
26
+ export declare const ALL_GRAPH_LABELS: readonly string[];
27
+ /**
28
+ * Select the sublabel whose colour should drive the node hue. Walks the
29
+ * label array from index 1 (skipping the base label at index 0) and
30
+ * returns the first sublabel that has a registered colour; falls back to
31
+ * labels[0]. Pure — drift-counting lives in resolveNodeColour.
32
+ */
33
+ export declare function pickDisplayLabel(labels: readonly string[]): string | null;
34
+ export declare function colourForLabel(label: string): string;
35
+ export interface ResolvedNodeColour {
36
+ displayLabel: string | null;
37
+ colour: string;
38
+ driftCandidates: number;
39
+ }
40
+ /**
41
+ * Single-source colour resolver. driftCandidates counts registered
42
+ * sublabels in labels[1..]; a node with two registered sublabels has
43
+ * driftCandidates = 2 and its rendered hue is order-dependent.
44
+ */
45
+ export declare function resolveNodeColour(labels: readonly string[]): ResolvedNodeColour;
46
+ /**
47
+ * Structural type used by display-string helpers. Mirrors the shape of
48
+ * GraphNode without coupling to it.
49
+ */
50
+ export interface GraphNodeLike {
51
+ id: string;
52
+ labels: string[];
53
+ properties: Record<string, unknown>;
54
+ }
55
+ /**
56
+ * YYYY-MM-DD HH:mm from an ISO 8601 prefix. Reads the prefix directly so
57
+ * timezone-stored UTC timestamps render identically across operator
58
+ * timezones; parsing to Date + reformatting would flip the day.
59
+ */
60
+ export declare function formatRunTimestamp(iso: string): string | null;
61
+ /** HH:mm:ss from an ISO 8601 prefix. Same tz-stable contract. */
62
+ export declare function formatMessageTimestamp(iso: string): string | null;
63
+ /**
64
+ * 24-char canvas label for a node. Label precedence per label family
65
+ * (ToolCall.toolName, WorkflowRun startedAt formatted, WorkflowStep.label,
66
+ * Person givenName+familyName compose, Agent displayName/slug, Message
67
+ * role+timestamp, ConversationArchive.title), then a generic fallthrough
68
+ * across curated keys (name, title, summary, givenName, subject, text),
69
+ * then a Conversation-specific `Conv <id8>` fallback so unpopulated
70
+ * conversations don't render as the literal label.
71
+ */
72
+ export declare function pickShortLabel(node: GraphNodeLike): string;
73
+ /**
74
+ * Untruncated sibling of pickShortLabel. Used by side-panel headings and
75
+ * tooltips where the 24-char canvas-overlap cap does not apply.
76
+ */
77
+ export declare function pickDisplayName(node: GraphNodeLike): string;
78
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA4EtD,CAAA;AAED,eAAO,MAAM,qBAAqB,YAAY,CAAA;AAE9C,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAE7C,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAOzE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,eAAe,EAAE,MAAM,CAAA;CACxB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,kBAAkB,CAU/E;AASD;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACpC;AAKD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI7D;AAED,iEAAiE;AACjE,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIjE;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAgE1D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAuC3D"}
@@ -0,0 +1,296 @@
1
+ "use strict";
2
+ /**
3
+ * Shared palette + display-string primitives for any surface that renders
4
+ * the Neo4j graph. Both the live `/graph` page in platform/ui and the
5
+ * graph-viewer MCP plugin's PNG renderer import from here so a node looks
6
+ * the same wherever it appears: same colour family per label, same short
7
+ * canvas label per node.
8
+ *
9
+ * UI-only constants (filter-popover sets, zoom-tier wrap helpers,
10
+ * agent-action label sets) stay in platform/ui/app/lib/graph-labels.ts and
11
+ * platform/ui/app/graph/display-helpers.ts — they re-export the symbols
12
+ * defined here. The two parity tests (this lib's __tests__ and the UI's
13
+ * unchanged colour-stability tests) keep the surfaces in lockstep.
14
+ *
15
+ * Sources of truth:
16
+ * - Label list: .docs/neo4j.md "Schema (Phase 0)" + "Standards Compliance"
17
+ * - Brand colour for LocalBusiness: brand.json defaultColors.primary
18
+ * (resolved at runtime; this module supplies the schema-default fallback)
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.ALL_GRAPH_LABELS = exports.FALLBACK_LABEL_COLOUR = exports.GRAPH_LABEL_COLOURS = void 0;
22
+ exports.pickDisplayLabel = pickDisplayLabel;
23
+ exports.colourForLabel = colourForLabel;
24
+ exports.resolveNodeColour = resolveNodeColour;
25
+ exports.formatRunTimestamp = formatRunTimestamp;
26
+ exports.formatMessageTimestamp = formatMessageTimestamp;
27
+ exports.pickShortLabel = pickShortLabel;
28
+ exports.pickDisplayName = pickDisplayName;
29
+ /**
30
+ * Label → display colour mapping. Closed list of node labels written by
31
+ * the Maxy MCP write paths. A new label without an entry here renders in
32
+ * FALLBACK_LABEL_COLOUR and is omitted from the legend.
33
+ */
34
+ exports.GRAPH_LABEL_COLOURS = {
35
+ // Business identity — slate-blue family
36
+ LocalBusiness: '#4F6B8A',
37
+ Service: '#6B85A0',
38
+ PriceSpecification: '#8AA0B8',
39
+ OpeningHoursSpecification: '#A8BACE',
40
+ // Estate-agent ontology. Listing/Property share the business slate-blue
41
+ // family; Viewing/Offer are transactional events placed in a warm amber
42
+ // family distinct from Agent and from the dusty-rose Task/Project/Event
43
+ // hues so the legend reads them as a separate band.
44
+ Listing: '#3F5670',
45
+ Property: '#5C7A99',
46
+ Viewing: '#D4A574',
47
+ Offer: '#B08850',
48
+ // External business entity — schema:Organization, written by memory-write
49
+ // as the Supplier label. Warm tobacco — distinct hue from internal-business
50
+ // slates so external entities are scannable at a glance.
51
+ Organization: '#8A6B47',
52
+ // People — terracotta family (warm, human)
53
+ Person: '#B86E4A',
54
+ UserProfile: '#D08960',
55
+ Preference: '#DFA67A',
56
+ AdminUser: '#8C5230',
57
+ AccessGrant: '#66381F',
58
+ // Knowledge — moss family (organic)
59
+ KnowledgeDocument: '#6E8A5A',
60
+ // chunked WhatsApp/messaging archive parent. Sits in the
61
+ // knowledge moss family because it's structurally a document parent
62
+ // (HAS_SECTION → :Section:Conversation chunks); the conversational
63
+ // plum family is reserved for the live Conversation/Message labels.
64
+ ConversationArchive: '#82A06A',
65
+ Section: '#8AA876',
66
+ Chunk: '#A6C194',
67
+ DigitalDocument: '#5A7548',
68
+ CreativeWork: '#B5C9A2',
69
+ Question: '#C7D6B5',
70
+ FAQPage: '#95B385',
71
+ DefinedTerm: '#76906A',
72
+ Review: '#3F5A2E',
73
+ ImageObject: '#A0BB8C',
74
+ // Conversational — muted plum/lavender family.
75
+ // Pairwise-distinctness invariants enforced by the UI test
76
+ // graph-labels.test.ts; UserMessage matches Preference (Person/family cue,
77
+ // the one intentional duplicate in the registry).
78
+ Conversation: '#6B5A85',
79
+ AdminConversation: '#4F4070',
80
+ PublicConversation: '#8A75A8',
81
+ Message: '#6B7280',
82
+ UserMessage: '#DFA67A',
83
+ AssistantMessage: '#C9A876',
84
+ ToolCall: '#B5ABCB',
85
+ // Tasks / projects / events — dusty rose family
86
+ Task: '#B0617A',
87
+ Project: '#8E4A60',
88
+ Event: '#C68095',
89
+ // Workflows — muted teal
90
+ Workflow: '#3A6F77',
91
+ WorkflowStep: '#5A8E96',
92
+ WorkflowRun: '#7AAAB2',
93
+ StepResult: '#9CC4CB',
94
+ // Email — muted moss, hue-adjacent to Knowledge but lower-saturation
95
+ // and warmer; never co-rendered with KnowledgeDocument.
96
+ Email: '#6F7F4A',
97
+ EmailAccount: '#91A063',
98
+ // Public-agent projection — burnished bronze sits between
99
+ // people-terracotta and email-moss but shares neither hue.
100
+ Agent: '#B8893D',
101
+ };
102
+ exports.FALLBACK_LABEL_COLOUR = '#94A3B8';
103
+ exports.ALL_GRAPH_LABELS = Object.freeze(Object.keys(exports.GRAPH_LABEL_COLOURS));
104
+ /**
105
+ * Select the sublabel whose colour should drive the node hue. Walks the
106
+ * label array from index 1 (skipping the base label at index 0) and
107
+ * returns the first sublabel that has a registered colour; falls back to
108
+ * labels[0]. Pure — drift-counting lives in resolveNodeColour.
109
+ */
110
+ function pickDisplayLabel(labels) {
111
+ for (let i = 1; i < labels.length; i++) {
112
+ if (Object.prototype.hasOwnProperty.call(exports.GRAPH_LABEL_COLOURS, labels[i])) {
113
+ return labels[i];
114
+ }
115
+ }
116
+ return labels[0] ?? null;
117
+ }
118
+ function colourForLabel(label) {
119
+ return exports.GRAPH_LABEL_COLOURS[label] ?? exports.FALLBACK_LABEL_COLOUR;
120
+ }
121
+ /**
122
+ * Single-source colour resolver. driftCandidates counts registered
123
+ * sublabels in labels[1..]; a node with two registered sublabels has
124
+ * driftCandidates = 2 and its rendered hue is order-dependent.
125
+ */
126
+ function resolveNodeColour(labels) {
127
+ const displayLabel = pickDisplayLabel(labels);
128
+ const colour = displayLabel ? colourForLabel(displayLabel) : exports.FALLBACK_LABEL_COLOUR;
129
+ let driftCandidates = 0;
130
+ for (let i = 1; i < labels.length; i++) {
131
+ if (Object.prototype.hasOwnProperty.call(exports.GRAPH_LABEL_COLOURS, labels[i])) {
132
+ driftCandidates++;
133
+ }
134
+ }
135
+ return { displayLabel, colour, driftCandidates };
136
+ }
137
+ const ISO_MINUTE_RE = /^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2})/;
138
+ const ISO_SECOND_RE = /^\d{4}-\d{2}-\d{2}T(\d{2}:\d{2}:\d{2})/;
139
+ /**
140
+ * YYYY-MM-DD HH:mm from an ISO 8601 prefix. Reads the prefix directly so
141
+ * timezone-stored UTC timestamps render identically across operator
142
+ * timezones; parsing to Date + reformatting would flip the day.
143
+ */
144
+ function formatRunTimestamp(iso) {
145
+ const m = iso.match(ISO_MINUTE_RE);
146
+ if (!m)
147
+ return null;
148
+ return `${m[1]} ${m[2]}`;
149
+ }
150
+ /** HH:mm:ss from an ISO 8601 prefix. Same tz-stable contract. */
151
+ function formatMessageTimestamp(iso) {
152
+ const m = iso.match(ISO_SECOND_RE);
153
+ if (!m)
154
+ return null;
155
+ return m[1];
156
+ }
157
+ /**
158
+ * 24-char canvas label for a node. Label precedence per label family
159
+ * (ToolCall.toolName, WorkflowRun startedAt formatted, WorkflowStep.label,
160
+ * Person givenName+familyName compose, Agent displayName/slug, Message
161
+ * role+timestamp, ConversationArchive.title), then a generic fallthrough
162
+ * across curated keys (name, title, summary, givenName, subject, text),
163
+ * then a Conversation-specific `Conv <id8>` fallback so unpopulated
164
+ * conversations don't render as the literal label.
165
+ */
166
+ function pickShortLabel(node) {
167
+ const props = node.properties;
168
+ const primaryLabel = node.labels[0];
169
+ if (primaryLabel === 'ToolCall') {
170
+ const v = props.toolName;
171
+ if (typeof v === 'string' && v.length > 0) {
172
+ return v.length > 24 ? v.slice(0, 24) + '…' : v;
173
+ }
174
+ }
175
+ else if (primaryLabel === 'WorkflowRun') {
176
+ const v = props.startedAt;
177
+ if (typeof v === 'string' && v.length > 0) {
178
+ const ts = formatRunTimestamp(v);
179
+ if (ts)
180
+ return ts;
181
+ }
182
+ }
183
+ else if (primaryLabel === 'WorkflowStep') {
184
+ const v = props.label;
185
+ if (typeof v === 'string' && v.length > 0) {
186
+ return v.length > 24 ? v.slice(0, 24) + '…' : v;
187
+ }
188
+ }
189
+ else if (primaryLabel === 'Person') {
190
+ const given = typeof props.givenName === 'string' ? props.givenName : '';
191
+ const family = typeof props.familyName === 'string' ? props.familyName : '';
192
+ const full = [given, family].filter((s) => s.length > 0).join(' ');
193
+ if (full.length > 0) {
194
+ return full.length > 24 ? full.slice(0, 24) + '…' : full;
195
+ }
196
+ }
197
+ else if (primaryLabel === 'Agent') {
198
+ const dn = typeof props.displayName === 'string' ? props.displayName : '';
199
+ const slug = typeof props.slug === 'string' ? props.slug : '';
200
+ const v = dn.length > 0 ? dn : slug;
201
+ if (v.length > 0) {
202
+ return v.length > 24 ? v.slice(0, 24) + '…' : v;
203
+ }
204
+ }
205
+ else if (primaryLabel === 'Message') {
206
+ const role = typeof props.role === 'string' ? props.role : '';
207
+ const roleShort = role === 'user' ? 'user'
208
+ : role === 'assistant' ? 'asst'
209
+ : role === 'system' ? 'sys'
210
+ : role === 'tool' ? 'tool'
211
+ : null;
212
+ const createdAt = typeof props.createdAt === 'string' ? props.createdAt : '';
213
+ if (roleShort && createdAt) {
214
+ const ts = formatMessageTimestamp(createdAt);
215
+ if (ts)
216
+ return `${roleShort} ${ts}`;
217
+ }
218
+ }
219
+ else if (primaryLabel === 'ConversationArchive') {
220
+ const t = typeof props.title === 'string' ? props.title : '';
221
+ if (t.length > 0) {
222
+ return t.length > 24 ? t.slice(0, 24) + '…' : t;
223
+ }
224
+ return primaryLabel;
225
+ }
226
+ for (const k of ['name', 'title', 'summary', 'givenName', 'subject', 'text']) {
227
+ const v = props[k];
228
+ if (typeof v === 'string' && v.length > 0) {
229
+ return v.length > 24 ? v.slice(0, 24) + '…' : v;
230
+ }
231
+ }
232
+ if (primaryLabel === 'Conversation') {
233
+ const id = typeof props.conversationId === 'string' ? props.conversationId : null;
234
+ if (id)
235
+ return `Conv ${id.slice(0, 8)}`;
236
+ }
237
+ return primaryLabel ?? '…';
238
+ }
239
+ /**
240
+ * Untruncated sibling of pickShortLabel. Used by side-panel headings and
241
+ * tooltips where the 24-char canvas-overlap cap does not apply.
242
+ */
243
+ function pickDisplayName(node) {
244
+ const props = node.properties;
245
+ const primaryLabel = node.labels[0];
246
+ if (primaryLabel === 'ToolCall') {
247
+ const v = props.toolName;
248
+ if (typeof v === 'string' && v.length > 0)
249
+ return v;
250
+ }
251
+ else if (primaryLabel === 'WorkflowRun') {
252
+ const v = props.startedAt;
253
+ if (typeof v === 'string' && v.length > 0) {
254
+ const ts = formatRunTimestamp(v);
255
+ if (ts)
256
+ return ts;
257
+ }
258
+ }
259
+ else if (primaryLabel === 'WorkflowStep') {
260
+ const v = props.label;
261
+ if (typeof v === 'string' && v.length > 0)
262
+ return v;
263
+ }
264
+ else if (primaryLabel === 'Person') {
265
+ const given = typeof props.givenName === 'string' ? props.givenName : '';
266
+ const family = typeof props.familyName === 'string' ? props.familyName : '';
267
+ const full = [given, family].filter((s) => s.length > 0).join(' ');
268
+ if (full.length > 0)
269
+ return full;
270
+ }
271
+ else if (primaryLabel === 'Agent') {
272
+ const dn = typeof props.displayName === 'string' ? props.displayName : '';
273
+ const slug = typeof props.slug === 'string' ? props.slug : '';
274
+ const v = dn.length > 0 ? dn : slug;
275
+ if (v.length > 0)
276
+ return v;
277
+ }
278
+ else if (primaryLabel === 'ConversationArchive') {
279
+ const t = typeof props.title === 'string' ? props.title : '';
280
+ if (t.length > 0)
281
+ return t;
282
+ return primaryLabel;
283
+ }
284
+ for (const k of ['name', 'title', 'summary', 'givenName', 'subject', 'text']) {
285
+ const v = props[k];
286
+ if (typeof v === 'string' && v.length > 0)
287
+ return v;
288
+ }
289
+ if (primaryLabel === 'Conversation') {
290
+ const id = typeof props.conversationId === 'string' ? props.conversationId : null;
291
+ if (id)
292
+ return `Conv ${id.slice(0, 8)}`;
293
+ }
294
+ return primaryLabel ?? '…';
295
+ }
296
+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YAAY,KAAK,qBAAqB,EAAE,CAAC;QAClD,MAAM,CAAC,GAAG,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;QAC5D,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,CAAC,CAAA;QAC1B,OAAO,YAAY,CAAA;IACrB,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC;QAC7E,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QAClB,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,CAAC,CAAA;IACrD,CAAC;IACD,IAAI,YAAY,KAAK,cAAc,EAAE,CAAC;QACpC,MAAM,EAAE,GAAG,OAAO,KAAK,CAAC,cAAc,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAA;QACjF,IAAI,EAAE;YAAE,OAAO,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAA;IACzC,CAAC;IACD,OAAO,YAAY,IAAI,GAAG,CAAA;AAC5B,CAAC"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Parity gate for the shared graph-style lib. Asserts the small set of
3
+ * load-bearing fixtures every UI and plugin caller relies on. Richer
4
+ * coverage lives in the UI's existing tests under
5
+ * platform/ui/app/lib/__tests__/graph-labels.test.ts and
6
+ * platform/ui/app/graph/__tests__/*; those tests now exercise the
7
+ * re-exported symbols and pass unchanged if extraction was faithful.
8
+ */
9
+
10
+ import { describe, it, expect } from "vitest";
11
+ import {
12
+ GRAPH_LABEL_COLOURS,
13
+ FALLBACK_LABEL_COLOUR,
14
+ pickDisplayLabel,
15
+ resolveNodeColour,
16
+ pickShortLabel,
17
+ pickDisplayName,
18
+ } from "../index.js";
19
+
20
+ describe("palette invariants", () => {
21
+ it("registers every label family with a hex colour", () => {
22
+ for (const [label, colour] of Object.entries(GRAPH_LABEL_COLOURS)) {
23
+ expect(colour, `${label} colour`).toMatch(/^#[0-9A-Fa-f]{6}$/);
24
+ }
25
+ });
26
+
27
+ it("FALLBACK_LABEL_COLOUR is a hex", () => {
28
+ expect(FALLBACK_LABEL_COLOUR).toMatch(/^#[0-9A-Fa-f]{6}$/);
29
+ });
30
+
31
+ it("UserMessage and Preference deliberately share a hue (Person-family cue)", () => {
32
+ expect(GRAPH_LABEL_COLOURS.UserMessage).toBe(GRAPH_LABEL_COLOURS.Preference);
33
+ });
34
+ });
35
+
36
+ describe("pickDisplayLabel", () => {
37
+ it("returns the first registered sublabel", () => {
38
+ expect(pickDisplayLabel(["Conversation", "AdminConversation"])).toBe(
39
+ "AdminConversation",
40
+ );
41
+ });
42
+
43
+ it("falls back to labels[0] when no sublabel is registered", () => {
44
+ expect(pickDisplayLabel(["Person", "UnregisteredSublabel"])).toBe("Person");
45
+ });
46
+
47
+ it("returns null on empty labels", () => {
48
+ expect(pickDisplayLabel([])).toBeNull();
49
+ });
50
+ });
51
+
52
+ describe("resolveNodeColour", () => {
53
+ it("counts drift candidates", () => {
54
+ const r = resolveNodeColour(["Conversation", "PublicConversation", "AssistantMessage"]);
55
+ expect(r.driftCandidates).toBe(2);
56
+ expect(r.colour).toBe(GRAPH_LABEL_COLOURS.PublicConversation);
57
+ });
58
+ });
59
+
60
+ describe("pickShortLabel", () => {
61
+ it("Person composes from given+family", () => {
62
+ expect(
63
+ pickShortLabel({
64
+ id: "x",
65
+ labels: ["Person"],
66
+ properties: { givenName: "Dan", familyName: "Brett" },
67
+ }),
68
+ ).toBe("Dan Brett");
69
+ });
70
+
71
+ it("Message renders role + HH:mm:ss", () => {
72
+ expect(
73
+ pickShortLabel({
74
+ id: "x",
75
+ labels: ["Message"],
76
+ properties: { role: "user", createdAt: "2026-05-25T14:33:42Z" },
77
+ }),
78
+ ).toBe("user 14:33:42");
79
+ });
80
+
81
+ it("Conversation falls back to Conv <id8>", () => {
82
+ expect(
83
+ pickShortLabel({
84
+ id: "x",
85
+ labels: ["Conversation"],
86
+ properties: { conversationId: "abcdef0123456789" },
87
+ }),
88
+ ).toBe("Conv abcdef01");
89
+ });
90
+
91
+ it("truncates over-cap labels to 24 chars + ellipsis", () => {
92
+ const longName = "This is a very long string that exceeds twenty-four chars";
93
+ const out = pickShortLabel({
94
+ id: "x",
95
+ labels: ["LocalBusiness"],
96
+ properties: { name: longName },
97
+ });
98
+ expect(out.length).toBeLessThanOrEqual(25); // 24 + '…'
99
+ expect(out.endsWith("…")).toBe(true);
100
+ });
101
+ });
102
+
103
+ describe("pickDisplayName", () => {
104
+ it("untruncated counterpart to pickShortLabel", () => {
105
+ const longName = "This is a very long string that exceeds twenty-four chars";
106
+ expect(
107
+ pickDisplayName({
108
+ id: "x",
109
+ labels: ["LocalBusiness"],
110
+ properties: { name: longName },
111
+ }),
112
+ ).toBe(longName);
113
+ });
114
+ });