@contractspec/module.examples 3.7.6 → 3.8.2
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/README.md +58 -10
- package/dist/builtins.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +211 -113
- package/dist/node/index.js +211 -113
- package/dist/runtime/context.d.ts +6 -6
- package/dist/runtime/installer.d.ts +2 -2
- package/dist/runtime/presentations.d.ts +2 -0
- package/dist/runtime/registry.d.ts +1 -1
- package/package.json +61 -56
package/dist/node/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import AnalyticsDashboard from "@contractspec/example.analytics-dashboard/exampl
|
|
|
9
9
|
import CalendarGoogle from "@contractspec/example.calendar-google/example";
|
|
10
10
|
import ContentGeneration from "@contractspec/example.content-generation/example";
|
|
11
11
|
import CrmPipeline from "@contractspec/example.crm-pipeline/example";
|
|
12
|
+
import DataGridShowcase from "@contractspec/example.data-grid-showcase/example";
|
|
12
13
|
import EmailGmail from "@contractspec/example.email-gmail/example";
|
|
13
14
|
import InAppDocs from "@contractspec/example.in-app-docs/example";
|
|
14
15
|
import IntegrationHub from "@contractspec/example.integration-hub/example";
|
|
@@ -34,7 +35,10 @@ import LifecycleDashboard from "@contractspec/example.lifecycle-dashboard/exampl
|
|
|
34
35
|
import LocaleJurisdictionGate from "@contractspec/example.locale-jurisdiction-gate/example";
|
|
35
36
|
import Marketplace from "@contractspec/example.marketplace/example";
|
|
36
37
|
import MeetingRecorderProviders from "@contractspec/example.meeting-recorder-providers/example";
|
|
38
|
+
import MessagingAgentActions from "@contractspec/example.messaging-agent-actions/example";
|
|
39
|
+
import Minimal from "@contractspec/example.minimal/example";
|
|
37
40
|
import OpenbankingPowens from "@contractspec/example.openbanking-powens/example";
|
|
41
|
+
import OpencodeCli from "@contractspec/example.opencode-cli/example";
|
|
38
42
|
import Personalization from "@contractspec/example.personalization/example";
|
|
39
43
|
import PocketFamilyOffice from "@contractspec/example.pocket-family-office/example";
|
|
40
44
|
import PolicySafeKnowledgeAssistant from "@contractspec/example.policy-safe-knowledge-assistant/example";
|
|
@@ -47,6 +51,7 @@ import VersionedKnowledgeBase from "@contractspec/example.versioned-knowledge-ba
|
|
|
47
51
|
import VideoApiShowcase from "@contractspec/example.video-api-showcase/example";
|
|
48
52
|
import VideoDocsTerminal from "@contractspec/example.video-docs-terminal/example";
|
|
49
53
|
import VideoMarketingClip from "@contractspec/example.video-marketing-clip/example";
|
|
54
|
+
import VisualizationShowcase from "@contractspec/example.visualization-showcase/example";
|
|
50
55
|
import VoiceProviders from "@contractspec/example.voice-providers/example";
|
|
51
56
|
import WealthSnapshot from "@contractspec/example.wealth-snapshot/example";
|
|
52
57
|
import WorkflowSystem from "@contractspec/example.workflow-system/example";
|
|
@@ -58,6 +63,7 @@ var EXAMPLE_REGISTRY = [
|
|
|
58
63
|
CalendarGoogle,
|
|
59
64
|
ContentGeneration,
|
|
60
65
|
CrmPipeline,
|
|
66
|
+
DataGridShowcase,
|
|
61
67
|
EmailGmail,
|
|
62
68
|
InAppDocs,
|
|
63
69
|
IntegrationHub,
|
|
@@ -83,7 +89,10 @@ var EXAMPLE_REGISTRY = [
|
|
|
83
89
|
LocaleJurisdictionGate,
|
|
84
90
|
Marketplace,
|
|
85
91
|
MeetingRecorderProviders,
|
|
92
|
+
MessagingAgentActions,
|
|
93
|
+
Minimal,
|
|
86
94
|
OpenbankingPowens,
|
|
95
|
+
OpencodeCli,
|
|
87
96
|
Personalization,
|
|
88
97
|
PocketFamilyOffice,
|
|
89
98
|
PolicySafeKnowledgeAssistant,
|
|
@@ -96,6 +105,7 @@ var EXAMPLE_REGISTRY = [
|
|
|
96
105
|
VideoApiShowcase,
|
|
97
106
|
VideoDocsTerminal,
|
|
98
107
|
VideoMarketingClip,
|
|
108
|
+
VisualizationShowcase,
|
|
99
109
|
VoiceProviders,
|
|
100
110
|
WealthSnapshot,
|
|
101
111
|
WorkflowSystem
|
|
@@ -117,12 +127,43 @@ function getExample(key) {
|
|
|
117
127
|
function searchExamples(query) {
|
|
118
128
|
return globalRegistry.search(query);
|
|
119
129
|
}
|
|
120
|
-
// src/runtime/
|
|
130
|
+
// src/runtime/context.tsx
|
|
131
|
+
import { ApolloProvider } from "@apollo/client/react";
|
|
132
|
+
import { web as web2 } from "@contractspec/lib.runtime-sandbox";
|
|
133
|
+
import { useEffect, useMemo, useState } from "react";
|
|
121
134
|
import {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
} from "@contractspec/
|
|
135
|
+
AGENT_CONSOLE_DEMO_ORGANIZATION_ID,
|
|
136
|
+
createAgentConsoleDemoHandlers,
|
|
137
|
+
getAgentConsoleDashboardData
|
|
138
|
+
} from "@contractspec/example.agent-console";
|
|
139
|
+
import {
|
|
140
|
+
createAnalyticsHandlers
|
|
141
|
+
} from "@contractspec/example.analytics-dashboard";
|
|
142
|
+
import {
|
|
143
|
+
createCrmHandlers
|
|
144
|
+
} from "@contractspec/example.crm-pipeline";
|
|
145
|
+
import {
|
|
146
|
+
createIntegrationHandlers
|
|
147
|
+
} from "@contractspec/example.integration-hub";
|
|
148
|
+
import {
|
|
149
|
+
createMarketplaceHandlers
|
|
150
|
+
} from "@contractspec/example.marketplace";
|
|
151
|
+
import {
|
|
152
|
+
createPolicySafeKnowledgeAssistantHandlers
|
|
153
|
+
} from "@contractspec/example.policy-safe-knowledge-assistant";
|
|
154
|
+
import {
|
|
155
|
+
createSaasHandlers
|
|
156
|
+
} from "@contractspec/example.saas-boilerplate";
|
|
157
|
+
import {
|
|
158
|
+
createWorkflowHandlers
|
|
159
|
+
} from "@contractspec/example.workflow-system";
|
|
160
|
+
import {
|
|
161
|
+
TemplateRuntimeContext,
|
|
162
|
+
useTemplateComponents,
|
|
163
|
+
useTemplateRuntime
|
|
164
|
+
} from "@contractspec/lib.example-shared-ui";
|
|
165
|
+
|
|
166
|
+
// src/runtime/engine.ts
|
|
126
167
|
import {
|
|
127
168
|
agentDashboardMarkdownRenderer,
|
|
128
169
|
agentListMarkdownRenderer,
|
|
@@ -131,36 +172,42 @@ import {
|
|
|
131
172
|
toolRegistryMarkdownRenderer
|
|
132
173
|
} from "@contractspec/example.agent-console";
|
|
133
174
|
import {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
} from "@contractspec/example.saas-boilerplate";
|
|
175
|
+
analyticsDashboardMarkdownRenderer,
|
|
176
|
+
dashboardListMarkdownRenderer,
|
|
177
|
+
queryBuilderMarkdownRenderer
|
|
178
|
+
} from "@contractspec/example.analytics-dashboard";
|
|
139
179
|
import {
|
|
140
180
|
crmDashboardMarkdownRenderer,
|
|
141
181
|
crmPipelineMarkdownRenderer,
|
|
142
182
|
crmPipelineReactRenderer
|
|
143
183
|
} from "@contractspec/example.crm-pipeline";
|
|
144
184
|
import {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
} from "@contractspec/example.
|
|
185
|
+
connectionListMarkdownRenderer,
|
|
186
|
+
integrationDashboardMarkdownRenderer,
|
|
187
|
+
syncConfigMarkdownRenderer
|
|
188
|
+
} from "@contractspec/example.integration-hub";
|
|
149
189
|
import {
|
|
150
190
|
marketplaceDashboardMarkdownRenderer,
|
|
151
191
|
orderListMarkdownRenderer,
|
|
152
192
|
productCatalogMarkdownRenderer
|
|
153
193
|
} from "@contractspec/example.marketplace";
|
|
154
194
|
import {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
195
|
+
projectListMarkdownRenderer,
|
|
196
|
+
projectListReactRenderer,
|
|
197
|
+
saasBillingMarkdownRenderer,
|
|
198
|
+
saasDashboardMarkdownRenderer
|
|
199
|
+
} from "@contractspec/example.saas-boilerplate";
|
|
200
|
+
import { visualizationShowcaseMarkdownRenderer } from "@contractspec/example.visualization-showcase/ui/renderers";
|
|
159
201
|
import {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
} from "@contractspec/example.
|
|
202
|
+
workflowDashboardMarkdownRenderer,
|
|
203
|
+
workflowDefinitionListMarkdownRenderer,
|
|
204
|
+
workflowInstanceDetailMarkdownRenderer
|
|
205
|
+
} from "@contractspec/example.workflow-system";
|
|
206
|
+
import {
|
|
207
|
+
createDefaultTransformEngine,
|
|
208
|
+
registerBasicValidation,
|
|
209
|
+
registerDefaultReactRenderer
|
|
210
|
+
} from "@contractspec/lib.contracts-spec/presentations/transform-engine";
|
|
164
211
|
function createTemplateTransformEngine() {
|
|
165
212
|
const engine = createDefaultTransformEngine();
|
|
166
213
|
registerDefaultReactRenderer(engine);
|
|
@@ -193,6 +240,7 @@ function registerTemplateRenderers(engine) {
|
|
|
193
240
|
engine.register(analyticsDashboardMarkdownRenderer);
|
|
194
241
|
engine.register(dashboardListMarkdownRenderer);
|
|
195
242
|
engine.register(queryBuilderMarkdownRenderer);
|
|
243
|
+
engine.register(visualizationShowcaseMarkdownRenderer);
|
|
196
244
|
}
|
|
197
245
|
var templateEngine = null;
|
|
198
246
|
function getTemplateEngine() {
|
|
@@ -204,6 +252,10 @@ function getTemplateEngine() {
|
|
|
204
252
|
function resetTemplateEngine() {
|
|
205
253
|
templateEngine = null;
|
|
206
254
|
}
|
|
255
|
+
|
|
256
|
+
// src/runtime/installer.ts
|
|
257
|
+
import { web } from "@contractspec/lib.runtime-sandbox";
|
|
258
|
+
|
|
207
259
|
// src/runtime/registry.ts
|
|
208
260
|
var PRESENTATIONS_BY_TEMPLATE = {
|
|
209
261
|
"saas-boilerplate": [
|
|
@@ -214,9 +266,9 @@ var PRESENTATIONS_BY_TEMPLATE = {
|
|
|
214
266
|
"crm-pipeline": ["crm-pipeline.dashboard", "crm-pipeline.deal.pipeline"],
|
|
215
267
|
"agent-console": [
|
|
216
268
|
"agent-console.dashboard",
|
|
217
|
-
"agent-console.agent.
|
|
269
|
+
"agent-console.agent.viewList",
|
|
218
270
|
"agent-console.run.list",
|
|
219
|
-
"agent-console.tool.
|
|
271
|
+
"agent-console.tool.list"
|
|
220
272
|
],
|
|
221
273
|
"workflow-system": [
|
|
222
274
|
"workflow-system.dashboard",
|
|
@@ -226,8 +278,7 @@ var PRESENTATIONS_BY_TEMPLATE = {
|
|
|
226
278
|
marketplace: [
|
|
227
279
|
"marketplace.dashboard",
|
|
228
280
|
"marketplace.product.catalog",
|
|
229
|
-
"marketplace.order.list"
|
|
230
|
-
"marketplace.store.manage"
|
|
281
|
+
"marketplace.order.list"
|
|
231
282
|
],
|
|
232
283
|
"integration-hub": [
|
|
233
284
|
"integration-hub.dashboard",
|
|
@@ -239,6 +290,7 @@ var PRESENTATIONS_BY_TEMPLATE = {
|
|
|
239
290
|
"analytics-dashboard.list",
|
|
240
291
|
"analytics-dashboard.query.builder"
|
|
241
292
|
],
|
|
293
|
+
"visualization-showcase": ["visualization-showcase.gallery"],
|
|
242
294
|
"learning-journey-studio-onboarding": [
|
|
243
295
|
"learning.journey.track_list",
|
|
244
296
|
"learning.journey.track_detail",
|
|
@@ -270,6 +322,28 @@ var PRESENTATIONS_BY_TEMPLATE = {
|
|
|
270
322
|
"learning.journey.progress_widget"
|
|
271
323
|
]
|
|
272
324
|
};
|
|
325
|
+
var GENERATED_TEMPLATE_REGISTRY = listExamples().filter((example) => example.meta.key !== "agent-console").map((example) => {
|
|
326
|
+
const tags = [...example.meta.tags ?? []];
|
|
327
|
+
const category = tags.some((tag) => tag.toLowerCase() === "ai") || tags.some((tag) => tag.toLowerCase() === "assistant") ? "ai" : "business";
|
|
328
|
+
return {
|
|
329
|
+
id: example.meta.key,
|
|
330
|
+
name: example.meta.title ?? example.meta.key,
|
|
331
|
+
description: example.meta.description ?? "",
|
|
332
|
+
category,
|
|
333
|
+
complexity: "beginner",
|
|
334
|
+
icon: "\uD83D\uDCE6",
|
|
335
|
+
features: [],
|
|
336
|
+
tags,
|
|
337
|
+
schema: { models: [], contracts: [] },
|
|
338
|
+
components: { list: "ExampleList", detail: "ExampleDetail" },
|
|
339
|
+
preview: {
|
|
340
|
+
demoUrl: `/sandbox?template=${encodeURIComponent(example.meta.key)}`
|
|
341
|
+
},
|
|
342
|
+
package: example.entrypoints.packageName,
|
|
343
|
+
presentations: PRESENTATIONS_BY_TEMPLATE[example.meta.key] ?? [],
|
|
344
|
+
renderTargets: ["react", "markdown"]
|
|
345
|
+
};
|
|
346
|
+
});
|
|
273
347
|
var TEMPLATE_REGISTRY = [
|
|
274
348
|
{
|
|
275
349
|
id: "todos-app",
|
|
@@ -356,30 +430,42 @@ var TEMPLATE_REGISTRY = [
|
|
|
356
430
|
quickstart: "/docs/templates/recipe-app-i18n"
|
|
357
431
|
}
|
|
358
432
|
},
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
}
|
|
382
|
-
|
|
433
|
+
{
|
|
434
|
+
id: "agent-console",
|
|
435
|
+
name: "Agent Console",
|
|
436
|
+
description: "Deterministic autonomous-agent walkthrough with seeded agents, tool registry, runs, metrics, and replayable proof.",
|
|
437
|
+
category: "ai",
|
|
438
|
+
complexity: "intermediate",
|
|
439
|
+
icon: "\uD83E\uDD16",
|
|
440
|
+
features: [
|
|
441
|
+
"Seeded autonomous agents",
|
|
442
|
+
"Tool registry",
|
|
443
|
+
"Run execution history",
|
|
444
|
+
"Metrics",
|
|
445
|
+
"Markdown and React views"
|
|
446
|
+
],
|
|
447
|
+
tags: ["ai", "agents", "autonomous", "meetup", "sandbox"],
|
|
448
|
+
schema: {
|
|
449
|
+
models: ["Agent", "Tool", "Run"],
|
|
450
|
+
contracts: [
|
|
451
|
+
"agent-console.agent.list",
|
|
452
|
+
"agent-console.agent.create",
|
|
453
|
+
"agent-console.run.execute"
|
|
454
|
+
]
|
|
455
|
+
},
|
|
456
|
+
components: {
|
|
457
|
+
list: "AgentListView",
|
|
458
|
+
detail: "RunListView",
|
|
459
|
+
form: "CreateAgentModal"
|
|
460
|
+
},
|
|
461
|
+
preview: {
|
|
462
|
+
demoUrl: "/sandbox?template=agent-console"
|
|
463
|
+
},
|
|
464
|
+
package: "@contractspec/example.agent-console",
|
|
465
|
+
presentations: PRESENTATIONS_BY_TEMPLATE["agent-console"] ?? [],
|
|
466
|
+
renderTargets: ["react", "markdown"]
|
|
467
|
+
},
|
|
468
|
+
...GENERATED_TEMPLATE_REGISTRY
|
|
383
469
|
];
|
|
384
470
|
function listTemplates(filter) {
|
|
385
471
|
if (!filter)
|
|
@@ -453,7 +539,6 @@ class ContractSpecRegistryClient {
|
|
|
453
539
|
}
|
|
454
540
|
|
|
455
541
|
// src/runtime/installer.ts
|
|
456
|
-
import { web } from "@contractspec/lib.runtime-sandbox";
|
|
457
542
|
"use client";
|
|
458
543
|
var { LocalRuntimeServices } = web;
|
|
459
544
|
var SAVE_TEMPLATE_MUTATION = `
|
|
@@ -559,39 +644,60 @@ function toBase64(bytes) {
|
|
|
559
644
|
});
|
|
560
645
|
return btoa(binary);
|
|
561
646
|
}
|
|
647
|
+
|
|
648
|
+
// src/runtime/presentations.ts
|
|
649
|
+
function createComponentPresentation(key, title, description, goal, context, componentKey) {
|
|
650
|
+
return {
|
|
651
|
+
meta: {
|
|
652
|
+
key,
|
|
653
|
+
version: "1.0.0",
|
|
654
|
+
title,
|
|
655
|
+
description,
|
|
656
|
+
stability: "experimental",
|
|
657
|
+
goal,
|
|
658
|
+
context,
|
|
659
|
+
owners: ["@contractspec/examples"],
|
|
660
|
+
tags: ["template", "sandbox"]
|
|
661
|
+
},
|
|
662
|
+
source: {
|
|
663
|
+
type: "component",
|
|
664
|
+
framework: "react",
|
|
665
|
+
componentKey
|
|
666
|
+
},
|
|
667
|
+
targets: ["react", "markdown"]
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
var TEMPLATE_PRESENTATIONS = {
|
|
671
|
+
"agent-console.dashboard": createComponentPresentation("agent-console.dashboard", "Agent Console Dashboard", "Operational dashboard for the agent console example.", "Review agent activity, throughput, and execution health.", "Sandbox presentation used for markdown previews.", "AgentConsoleDashboard"),
|
|
672
|
+
"agent-console.agent.list": createComponentPresentation("agent-console.agent.list", "Agent List", "List of seeded agents in the agent console example.", "Browse configured agents and their current capabilities.", "Sandbox presentation used for markdown previews.", "AgentListView"),
|
|
673
|
+
"agent-console.agent.viewList": createComponentPresentation("agent-console.agent.viewList", "Agent List", "List of seeded agents in the agent console example.", "Browse configured agents and their current capabilities.", "Sandbox presentation used for markdown previews.", "AgentListView"),
|
|
674
|
+
"agent-console.run.list": createComponentPresentation("agent-console.run.list", "Run List", "Execution history for the agent console example.", "Inspect recent runs and their outcomes.", "Sandbox presentation used for markdown previews.", "RunListView"),
|
|
675
|
+
"agent-console.tool.list": createComponentPresentation("agent-console.tool.list", "Tool Registry", "Available tools for the agent console example.", "Inspect the tool registry exposed to the seeded agents.", "Sandbox presentation used for markdown previews.", "ToolRegistryView"),
|
|
676
|
+
"agent-console.tool.registry": createComponentPresentation("agent-console.tool.registry", "Tool Registry", "Available tools for the agent console example.", "Inspect the tool registry exposed to the seeded agents.", "Sandbox presentation used for markdown previews.", "ToolRegistryView"),
|
|
677
|
+
"analytics-dashboard.dashboard": createComponentPresentation("analytics-dashboard.dashboard", "Analytics Dashboard", "Dashboard view for the analytics example.", "Review saved widgets and query-backed dashboards.", "Sandbox presentation used for markdown previews.", "AnalyticsDashboard"),
|
|
678
|
+
"analytics-dashboard.list": createComponentPresentation("analytics-dashboard.list", "Dashboard List", "List view for analytics dashboards.", "Browse dashboards available in the analytics example.", "Sandbox presentation used for markdown previews.", "DashboardList"),
|
|
679
|
+
"analytics-dashboard.query.builder": createComponentPresentation("analytics-dashboard.query.builder", "Query Builder", "Query authoring surface for the analytics example.", "Inspect reusable queries that power dashboards.", "Sandbox presentation used for markdown previews.", "QueryBuilder"),
|
|
680
|
+
"crm-pipeline.dashboard": createComponentPresentation("crm-pipeline.dashboard", "CRM Dashboard", "Dashboard for the CRM pipeline example.", "Track pipeline health and revenue progress.", "Sandbox presentation used for markdown previews.", "CrmDashboard"),
|
|
681
|
+
"crm-pipeline.deal.pipeline": createComponentPresentation("crm-pipeline.deal.pipeline", "Pipeline Kanban", "Pipeline board for the CRM pipeline example.", "Review deal flow across pipeline stages.", "Sandbox presentation used for markdown previews.", "PipelineKanbanView"),
|
|
682
|
+
"integration-hub.connection.list": createComponentPresentation("integration-hub.connection.list", "Connection List", "Connected systems in the integration hub example.", "Review connected systems and connection health.", "Sandbox presentation used for markdown previews.", "ConnectionList"),
|
|
683
|
+
"integration-hub.dashboard": createComponentPresentation("integration-hub.dashboard", "Integration Dashboard", "Operational dashboard for the integration hub example.", "Monitor integration mix, connection health, and sync issues.", "Sandbox presentation used for markdown previews.", "IntegrationDashboard"),
|
|
684
|
+
"integration-hub.sync.config": createComponentPresentation("integration-hub.sync.config", "Sync Configuration", "Sync configuration surface for the integration hub example.", "Inspect sync configuration and field mapping defaults.", "Sandbox presentation used for markdown previews.", "SyncConfigEditor"),
|
|
685
|
+
"marketplace.dashboard": createComponentPresentation("marketplace.dashboard", "Marketplace Dashboard", "Dashboard for the marketplace example.", "Review order flow, category mix, and revenue summaries.", "Sandbox presentation used for markdown previews.", "MarketplaceDashboard"),
|
|
686
|
+
"marketplace.order.list": createComponentPresentation("marketplace.order.list", "Order List", "Order list for the marketplace example.", "Inspect order activity and fulfillment state.", "Sandbox presentation used for markdown previews.", "OrderList"),
|
|
687
|
+
"marketplace.product.catalog": createComponentPresentation("marketplace.product.catalog", "Product Catalog", "Product catalog for the marketplace example.", "Browse the available products and merchandising data.", "Sandbox presentation used for markdown previews.", "ProductCatalog"),
|
|
688
|
+
"saas-boilerplate.billing.settings": createComponentPresentation("saas-boilerplate.billing.settings", "Billing Settings", "Subscription and usage settings for the SaaS example.", "Review billing configuration and current subscription data.", "Sandbox presentation used for markdown previews.", "SubscriptionView"),
|
|
689
|
+
"saas-boilerplate.dashboard": createComponentPresentation("saas-boilerplate.dashboard", "SaaS Dashboard", "Dashboard for the SaaS boilerplate example.", "Review account, project, and billing summaries.", "Sandbox presentation used for markdown previews.", "SaasDashboard"),
|
|
690
|
+
"saas-boilerplate.project.list": createComponentPresentation("saas-boilerplate.project.list", "Project List", "Project list for the SaaS boilerplate example.", "Browse projects and their current lifecycle state.", "Sandbox presentation used for markdown previews.", "ProjectListView"),
|
|
691
|
+
"visualization-showcase.gallery": createComponentPresentation("visualization-showcase.gallery", "Visualization Showcase", "Focused showcase of ContractSpec visualization primitives.", "Review the canonical visualization catalog and design-system wrappers.", "Sandbox presentation used for markdown previews.", "VisualizationShowcase"),
|
|
692
|
+
"workflow-system.dashboard": createComponentPresentation("workflow-system.dashboard", "Workflow Dashboard", "Dashboard for the workflow system example.", "Review workflow instance health and workload metrics.", "Sandbox presentation used for markdown previews.", "WorkflowDashboard"),
|
|
693
|
+
"workflow-system.definition.list": createComponentPresentation("workflow-system.definition.list", "Workflow Definition List", "Workflow definitions in the workflow system example.", "Browse available workflow definitions.", "Sandbox presentation used for markdown previews.", "WorkflowDefinitionList"),
|
|
694
|
+
"workflow-system.instance.detail": createComponentPresentation("workflow-system.instance.detail", "Workflow Instance Detail", "Workflow instance details in the workflow system example.", "Inspect the state and approvals for a workflow instance.", "Sandbox presentation used for markdown previews.", "WorkflowInstanceDetail")
|
|
695
|
+
};
|
|
696
|
+
function resolveTemplatePresentation(presentationName) {
|
|
697
|
+
return TEMPLATE_PRESENTATIONS[presentationName];
|
|
698
|
+
}
|
|
699
|
+
|
|
562
700
|
// src/runtime/context.tsx
|
|
563
|
-
import { useEffect, useMemo, useState } from "react";
|
|
564
|
-
import { ApolloProvider } from "@apollo/client/react";
|
|
565
|
-
import { web as web2 } from "@contractspec/lib.runtime-sandbox";
|
|
566
|
-
import {
|
|
567
|
-
createCrmHandlers
|
|
568
|
-
} from "@contractspec/example.crm-pipeline";
|
|
569
|
-
import {
|
|
570
|
-
createSaasHandlers
|
|
571
|
-
} from "@contractspec/example.saas-boilerplate";
|
|
572
|
-
import {
|
|
573
|
-
createAgentHandlers
|
|
574
|
-
} from "@contractspec/example.agent-console";
|
|
575
|
-
import {
|
|
576
|
-
createWorkflowHandlers
|
|
577
|
-
} from "@contractspec/example.workflow-system";
|
|
578
|
-
import {
|
|
579
|
-
createMarketplaceHandlers
|
|
580
|
-
} from "@contractspec/example.marketplace";
|
|
581
|
-
import {
|
|
582
|
-
createIntegrationHandlers
|
|
583
|
-
} from "@contractspec/example.integration-hub";
|
|
584
|
-
import {
|
|
585
|
-
createAnalyticsHandlers
|
|
586
|
-
} from "@contractspec/example.analytics-dashboard";
|
|
587
|
-
import {
|
|
588
|
-
createPolicySafeKnowledgeAssistantHandlers
|
|
589
|
-
} from "@contractspec/example.policy-safe-knowledge-assistant";
|
|
590
|
-
import {
|
|
591
|
-
TemplateRuntimeContext,
|
|
592
|
-
useTemplateRuntime,
|
|
593
|
-
useTemplateComponents
|
|
594
|
-
} from "@contractspec/lib.example-shared-ui";
|
|
595
701
|
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
596
702
|
"use client";
|
|
597
703
|
var { LocalRuntimeServices: LocalRuntimeServices2 } = web2;
|
|
@@ -621,7 +727,7 @@ class TemplateHandlers {
|
|
|
621
727
|
}
|
|
622
728
|
function TemplateRuntimeProvider({
|
|
623
729
|
templateId,
|
|
624
|
-
projectId = "
|
|
730
|
+
projectId = "local-project",
|
|
625
731
|
lazy = false,
|
|
626
732
|
children
|
|
627
733
|
}) {
|
|
@@ -646,7 +752,7 @@ function TemplateRuntimeProvider({
|
|
|
646
752
|
const handlers = new TemplateHandlers;
|
|
647
753
|
handlers.crm = createCrmHandlers(runtime.db);
|
|
648
754
|
handlers.saas = createSaasHandlers(runtime.db);
|
|
649
|
-
handlers.agent =
|
|
755
|
+
handlers.agent = createAgentConsoleDemoHandlers({ projectId });
|
|
650
756
|
handlers.workflow = createWorkflowHandlers(runtime.db);
|
|
651
757
|
handlers.marketplace = createMarketplaceHandlers(runtime.db);
|
|
652
758
|
handlers.integration = createIntegrationHandlers(runtime.db);
|
|
@@ -743,37 +849,19 @@ function TemplateRuntimeProvider({
|
|
|
743
849
|
};
|
|
744
850
|
}
|
|
745
851
|
if (presentationName === "agent-console.dashboard") {
|
|
746
|
-
const
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
limit: 10
|
|
751
|
-
}),
|
|
752
|
-
handlers.agent.listRuns({ projectId, limit: 10 }),
|
|
753
|
-
handlers.agent.listTools({
|
|
754
|
-
projectId,
|
|
755
|
-
organizationId: "demo-org",
|
|
756
|
-
limit: 10
|
|
757
|
-
})
|
|
758
|
-
]);
|
|
852
|
+
const data = await getAgentConsoleDashboardData(handlers.agent, {
|
|
853
|
+
projectId,
|
|
854
|
+
organizationId: AGENT_CONSOLE_DEMO_ORGANIZATION_ID
|
|
855
|
+
});
|
|
759
856
|
return {
|
|
760
|
-
data
|
|
761
|
-
agents: agentsResult.items,
|
|
762
|
-
runs: runsResult.items,
|
|
763
|
-
tools: toolsResult.items,
|
|
764
|
-
summary: {
|
|
765
|
-
totalAgents: agentsResult.total,
|
|
766
|
-
totalRuns: runsResult.total,
|
|
767
|
-
totalTools: toolsResult.total
|
|
768
|
-
}
|
|
769
|
-
},
|
|
857
|
+
data,
|
|
770
858
|
metadata: { timestamp: new Date, source: "agent-console" }
|
|
771
859
|
};
|
|
772
860
|
}
|
|
773
|
-
if (presentationName === "agent-console.agent.list") {
|
|
861
|
+
if (presentationName === "agent-console.agent.viewList" || presentationName === "agent-console.agent.list") {
|
|
774
862
|
const result = await handlers.agent.listAgents({
|
|
775
863
|
projectId,
|
|
776
|
-
organizationId:
|
|
864
|
+
organizationId: AGENT_CONSOLE_DEMO_ORGANIZATION_ID,
|
|
777
865
|
limit: 50
|
|
778
866
|
});
|
|
779
867
|
return {
|
|
@@ -799,10 +887,10 @@ function TemplateRuntimeProvider({
|
|
|
799
887
|
}
|
|
800
888
|
};
|
|
801
889
|
}
|
|
802
|
-
if (presentationName === "agent-console.tool.registry") {
|
|
890
|
+
if (presentationName === "agent-console.tool.list" || presentationName === "agent-console.tool.registry") {
|
|
803
891
|
const result = await handlers.agent.listTools({
|
|
804
892
|
projectId,
|
|
805
|
-
organizationId:
|
|
893
|
+
organizationId: AGENT_CONSOLE_DEMO_ORGANIZATION_ID,
|
|
806
894
|
limit: 50
|
|
807
895
|
});
|
|
808
896
|
return {
|
|
@@ -814,6 +902,15 @@ function TemplateRuntimeProvider({
|
|
|
814
902
|
}
|
|
815
903
|
};
|
|
816
904
|
}
|
|
905
|
+
if (presentationName === "visualization-showcase.gallery") {
|
|
906
|
+
return {
|
|
907
|
+
data: null,
|
|
908
|
+
metadata: {
|
|
909
|
+
timestamp: new Date,
|
|
910
|
+
source: "visualization-showcase"
|
|
911
|
+
}
|
|
912
|
+
};
|
|
913
|
+
}
|
|
817
914
|
console.warn(`No data fetcher found for presentation: ${presentationName}`);
|
|
818
915
|
return {
|
|
819
916
|
data: null,
|
|
@@ -830,7 +927,8 @@ function TemplateRuntimeProvider({
|
|
|
830
927
|
projectId,
|
|
831
928
|
engine,
|
|
832
929
|
handlers,
|
|
833
|
-
fetchData
|
|
930
|
+
fetchData,
|
|
931
|
+
resolvePresentation: resolveTemplatePresentation
|
|
834
932
|
});
|
|
835
933
|
}
|
|
836
934
|
} catch (err) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { type PropsWithChildren } from 'react';
|
|
2
|
-
import type { TransformEngine } from '@contractspec/lib.contracts-spec/presentations/transform-engine';
|
|
3
|
-
import { type CrmHandlers } from '@contractspec/example.crm-pipeline';
|
|
4
|
-
import { type SaasHandlers } from '@contractspec/example.saas-boilerplate';
|
|
5
2
|
import { type AgentHandlers } from '@contractspec/example.agent-console';
|
|
6
|
-
import { type WorkflowHandlers } from '@contractspec/example.workflow-system';
|
|
7
|
-
import { type MarketplaceHandlers } from '@contractspec/example.marketplace';
|
|
8
|
-
import { type IntegrationHandlers } from '@contractspec/example.integration-hub';
|
|
9
3
|
import { type AnalyticsHandlers } from '@contractspec/example.analytics-dashboard';
|
|
4
|
+
import { type CrmHandlers } from '@contractspec/example.crm-pipeline';
|
|
5
|
+
import { type IntegrationHandlers } from '@contractspec/example.integration-hub';
|
|
6
|
+
import { type MarketplaceHandlers } from '@contractspec/example.marketplace';
|
|
10
7
|
import { type PolicySafeKnowledgeAssistantHandlers } from '@contractspec/example.policy-safe-knowledge-assistant';
|
|
8
|
+
import { type SaasHandlers } from '@contractspec/example.saas-boilerplate';
|
|
9
|
+
import { type WorkflowHandlers } from '@contractspec/example.workflow-system';
|
|
10
|
+
import type { TransformEngine } from '@contractspec/lib.contracts-spec/presentations/transform-engine';
|
|
11
11
|
import { type TemplateRuntimeProviderProps } from '@contractspec/lib.example-shared-ui';
|
|
12
12
|
/**
|
|
13
13
|
* Template-specific handlers created from the runtime database
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { type RegistryTemplateSummary } from './registry-client';
|
|
1
|
+
import type { InstallTemplateOptions, SaveTemplateOptions, SaveTemplateResult, TemplateDefinition, TemplateFilter, TemplateId } from '@contractspec/lib.example-shared-ui';
|
|
3
2
|
import { web } from '@contractspec/lib.runtime-sandbox';
|
|
3
|
+
import { type RegistryTemplateSummary } from './registry-client';
|
|
4
4
|
declare const LocalRuntimeServices: typeof web.LocalRuntimeServices;
|
|
5
5
|
type LocalRuntimeServices = InstanceType<typeof LocalRuntimeServices>;
|
|
6
6
|
export interface TemplateInstallerOptions {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TemplateDefinition,
|
|
1
|
+
import type { TemplateDefinition, TemplateFilter, TemplateId } from '@contractspec/lib.example-shared-ui';
|
|
2
2
|
export declare const TEMPLATE_REGISTRY: TemplateDefinition[];
|
|
3
3
|
export declare function listTemplates(filter?: TemplateFilter): TemplateDefinition[];
|
|
4
4
|
export declare function getTemplate(id: TemplateId): TemplateDefinition | undefined;
|