@contractspec/bundle.library 3.8.2 → 3.8.5
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/.turbo/turbo-build.log +130 -116
- package/CHANGELOG.md +80 -0
- package/dist/application/index.js +806 -131
- package/dist/application/mcp/cliMcp.js +21 -2
- package/dist/application/mcp/common.js +21 -2
- package/dist/application/mcp/common.test.d.ts +1 -0
- package/dist/application/mcp/contractsMcp.js +21 -2
- package/dist/application/mcp/docsMcp.catalog.d.ts +2 -0
- package/dist/application/mcp/docsMcp.catalog.js +382 -0
- package/dist/application/mcp/docsMcp.d.ts +5 -1
- package/dist/application/mcp/docsMcp.data.d.ts +85 -0
- package/dist/application/mcp/docsMcp.data.js +148 -0
- package/dist/application/mcp/docsMcp.js +776 -101
- package/dist/application/mcp/docsMcp.prompts.d.ts +3 -0
- package/dist/application/mcp/docsMcp.prompts.js +522 -0
- package/dist/application/mcp/docsMcp.reference.d.ts +24 -0
- package/dist/application/mcp/docsMcp.reference.js +236 -0
- package/dist/application/mcp/docsMcp.resources.d.ts +3 -0
- package/dist/application/mcp/docsMcp.resources.js +520 -0
- package/dist/application/mcp/docsMcp.test.d.ts +1 -0
- package/dist/application/mcp/docsMcp.tools.d.ts +3 -0
- package/dist/application/mcp/docsMcp.tools.js +519 -0
- package/dist/application/mcp/index.js +806 -131
- package/dist/application/mcp/internalMcp.js +21 -2
- package/dist/application/mcp/normalizeMcpRequest.d.ts +1 -0
- package/dist/application/mcp/normalizeMcpRequest.js +22 -0
- package/dist/application/mcp/providerRankingMcp.js +21 -2
- package/dist/components/docs/generated/docs-index.generated.d.ts +6 -6
- package/dist/components/docs/index.js +23 -24
- package/dist/components/docs/libraries/LibrariesAiAgentPage.js +22 -22
- package/dist/components/docs/libraries/LibrariesSupportBotPage.js +1 -2
- package/dist/components/docs/libraries/index.js +23 -24
- package/dist/components/templates/engine/index.d.ts +1 -1
- package/dist/components/templates/engine/index.js +1 -1
- package/dist/features/index.js +15 -15
- package/dist/index.js +194 -195
- package/dist/node/application/index.js +806 -131
- package/dist/node/application/mcp/cliMcp.js +21 -2
- package/dist/node/application/mcp/common.js +21 -2
- package/dist/node/application/mcp/contractsMcp.js +21 -2
- package/dist/node/application/mcp/docsMcp.catalog.js +381 -0
- package/dist/node/application/mcp/docsMcp.data.js +147 -0
- package/dist/node/application/mcp/docsMcp.js +776 -101
- package/dist/node/application/mcp/docsMcp.prompts.js +521 -0
- package/dist/node/application/mcp/docsMcp.reference.js +235 -0
- package/dist/node/application/mcp/docsMcp.resources.js +519 -0
- package/dist/node/application/mcp/docsMcp.tools.js +518 -0
- package/dist/node/application/mcp/index.js +806 -131
- package/dist/node/application/mcp/internalMcp.js +21 -2
- package/dist/node/application/mcp/normalizeMcpRequest.js +21 -0
- package/dist/node/application/mcp/providerRankingMcp.js +21 -2
- package/dist/node/components/docs/index.js +23 -24
- package/dist/node/components/docs/libraries/LibrariesAiAgentPage.js +22 -22
- package/dist/node/components/docs/libraries/LibrariesSupportBotPage.js +1 -2
- package/dist/node/components/docs/libraries/index.js +23 -24
- package/dist/node/components/templates/engine/index.js +1 -1
- package/dist/node/features/index.js +15 -15
- package/dist/node/index.js +194 -195
- package/dist/node/presentation/features/hooks/index.js +12 -12
- package/dist/node/presentation/features/hooks/useContractsRegistry.js +12 -12
- package/dist/node/presentation/features/index.js +12 -12
- package/dist/node/presentation/features/organisms/FeatureDataViewsList.js +12 -12
- package/dist/node/presentation/features/organisms/FeatureEventsList.js +12 -12
- package/dist/node/presentation/features/organisms/FeatureFormsList.js +12 -12
- package/dist/node/presentation/features/organisms/FeaturePresentationsList.js +12 -12
- package/dist/node/presentation/features/organisms/index.js +12 -12
- package/dist/node/presentation/features/templates/FeatureDataViewsTemplate/FeatureDataViewsTemplate.js +12 -12
- package/dist/node/presentation/features/templates/FeatureDataViewsTemplate/index.js +12 -12
- package/dist/node/presentation/features/templates/FeatureEventsTemplate/FeatureEventsTemplate.js +12 -12
- package/dist/node/presentation/features/templates/FeatureEventsTemplate/index.js +12 -12
- package/dist/node/presentation/features/templates/FeatureFormsTemplate/FeatureFormsTemplate.js +12 -12
- package/dist/node/presentation/features/templates/FeatureFormsTemplate/index.js +12 -12
- package/dist/node/presentation/features/templates/FeaturePresentationsTemplate/FeaturePresentationsTemplate.js +12 -12
- package/dist/node/presentation/features/templates/FeaturePresentationsTemplate/index.js +12 -12
- package/dist/presentation/features/hooks/index.js +12 -12
- package/dist/presentation/features/hooks/useContractsRegistry.js +12 -12
- package/dist/presentation/features/index.js +12 -12
- package/dist/presentation/features/organisms/FeatureDataViewsList.js +12 -12
- package/dist/presentation/features/organisms/FeatureEventsList.js +12 -12
- package/dist/presentation/features/organisms/FeatureFormsList.js +12 -12
- package/dist/presentation/features/organisms/FeaturePresentationsList.js +12 -12
- package/dist/presentation/features/organisms/index.js +12 -12
- package/dist/presentation/features/templates/FeatureDataViewsTemplate/FeatureDataViewsTemplate.js +12 -12
- package/dist/presentation/features/templates/FeatureDataViewsTemplate/index.js +12 -12
- package/dist/presentation/features/templates/FeatureEventsTemplate/FeatureEventsTemplate.js +12 -12
- package/dist/presentation/features/templates/FeatureEventsTemplate/index.js +12 -12
- package/dist/presentation/features/templates/FeatureFormsTemplate/FeatureFormsTemplate.js +12 -12
- package/dist/presentation/features/templates/FeatureFormsTemplate/index.js +12 -12
- package/dist/presentation/features/templates/FeaturePresentationsTemplate/FeaturePresentationsTemplate.js +12 -12
- package/dist/presentation/features/templates/FeaturePresentationsTemplate/index.js +12 -12
- package/package.json +108 -23
- package/src/application/mcp/common.test.ts +64 -0
- package/src/application/mcp/common.ts +5 -2
- package/src/application/mcp/docsMcp.catalog.ts +2 -0
- package/src/application/mcp/docsMcp.data.ts +196 -0
- package/src/application/mcp/docsMcp.prompts.ts +165 -0
- package/src/application/mcp/docsMcp.reference.ts +152 -0
- package/src/application/mcp/docsMcp.resources.ts +194 -0
- package/src/application/mcp/docsMcp.test.ts +148 -0
- package/src/application/mcp/docsMcp.tools.ts +183 -0
- package/src/application/mcp/docsMcp.ts +13 -177
- package/src/application/mcp/normalizeMcpRequest.ts +30 -0
- package/src/components/docs/generated/docs-index._common.json +1 -1
- package/src/components/docs/generated/docs-index.ai-chat-assistant.json +8 -0
- package/src/components/docs/generated/docs-index.artisan-knowledge-product.json +18 -0
- package/src/components/docs/generated/docs-index.artisan-payments-stripe.json +34 -0
- package/src/components/docs/generated/docs-index.data-grid-showcase.json +18 -0
- package/src/components/docs/generated/docs-index.generated.ts +6 -6
- package/src/components/docs/generated/docs-index.harness-lab.json +10 -0
- package/src/components/docs/generated/docs-index.locale-jurisdiction-gate.json +8 -0
- package/src/components/docs/generated/docs-index.manifest.json +50 -5
- package/src/components/docs/generated/docs-index.messaging-agent-actions.json +18 -0
- package/src/components/docs/generated/docs-index.mobile-demo-tasks.json +34 -0
- package/src/components/docs/generated/docs-index.opencode-cli.json +2 -2
- package/src/components/docs/generated/docs-index.platform-control-plane.json +250 -0
- package/src/components/docs/generated/docs-index.platform-harness.json +178 -0
- package/src/components/docs/generated/docs-index.platform-integrations.json +22 -14
- package/src/components/docs/generated/docs-index.visualization-showcase.json +18 -0
- package/src/components/docs/libraries/LibrariesAiAgentPage.tsx +20 -17
- package/src/components/docs/libraries/LibrariesSupportBotPage.tsx +1 -2
- package/src/components/templates/engine/index.ts +2 -2
|
@@ -26,6 +26,25 @@ var authLogger = new Logger({
|
|
|
26
26
|
enableContext: true,
|
|
27
27
|
enableColors: false
|
|
28
28
|
});
|
|
29
|
+
// src/application/mcp/normalizeMcpRequest.ts
|
|
30
|
+
var REQUIRED_ACCEPT_TYPES = ["application/json", "text/event-stream"];
|
|
31
|
+
function canNormalizeAcceptHeader(acceptHeader) {
|
|
32
|
+
return !acceptHeader || acceptHeader.includes("*/*") || acceptHeader.includes("application/*") || REQUIRED_ACCEPT_TYPES.some((value) => acceptHeader.includes(value));
|
|
33
|
+
}
|
|
34
|
+
function normalizeMcpRequest(request) {
|
|
35
|
+
if (request.method !== "POST")
|
|
36
|
+
return request;
|
|
37
|
+
const acceptHeader = request.headers.get("accept");
|
|
38
|
+
if (!canNormalizeAcceptHeader(acceptHeader))
|
|
39
|
+
return request;
|
|
40
|
+
const missingTypes = REQUIRED_ACCEPT_TYPES.filter((value) => !acceptHeader?.includes(value));
|
|
41
|
+
if (missingTypes.length === 0)
|
|
42
|
+
return request;
|
|
43
|
+
const headers = new Headers(request.headers);
|
|
44
|
+
headers.set("accept", [acceptHeader, ...missingTypes].filter(Boolean).join(", "));
|
|
45
|
+
return new Request(request, { headers });
|
|
46
|
+
}
|
|
47
|
+
|
|
29
48
|
// src/application/mcp/common.ts
|
|
30
49
|
import { randomUUID } from "crypto";
|
|
31
50
|
import { createMcpServer } from "@contractspec/lib.contracts-runtime-server-mcp/provider-mcp";
|
|
@@ -121,7 +140,7 @@ function createMcpElysiaHandler({
|
|
|
121
140
|
stateful: false
|
|
122
141
|
});
|
|
123
142
|
try {
|
|
124
|
-
return await state.transport.handleRequest(request);
|
|
143
|
+
return await state.transport.handleRequest(normalizeMcpRequest(request));
|
|
125
144
|
} finally {
|
|
126
145
|
await closeSessionState(state);
|
|
127
146
|
}
|
|
@@ -157,7 +176,7 @@ function createMcpElysiaHandler({
|
|
|
157
176
|
createdState = true;
|
|
158
177
|
}
|
|
159
178
|
try {
|
|
160
|
-
const response = await state.transport.handleRequest(request);
|
|
179
|
+
const response = await state.transport.handleRequest(normalizeMcpRequest(request));
|
|
161
180
|
const activeSessionId = state.transport.sessionId;
|
|
162
181
|
if (activeSessionId && !sessions.has(activeSessionId)) {
|
|
163
182
|
sessions.set(activeSessionId, state);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function normalizeMcpRequest(request: Request): Request;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/application/mcp/normalizeMcpRequest.ts
|
|
3
|
+
var REQUIRED_ACCEPT_TYPES = ["application/json", "text/event-stream"];
|
|
4
|
+
function canNormalizeAcceptHeader(acceptHeader) {
|
|
5
|
+
return !acceptHeader || acceptHeader.includes("*/*") || acceptHeader.includes("application/*") || REQUIRED_ACCEPT_TYPES.some((value) => acceptHeader.includes(value));
|
|
6
|
+
}
|
|
7
|
+
function normalizeMcpRequest(request) {
|
|
8
|
+
if (request.method !== "POST")
|
|
9
|
+
return request;
|
|
10
|
+
const acceptHeader = request.headers.get("accept");
|
|
11
|
+
if (!canNormalizeAcceptHeader(acceptHeader))
|
|
12
|
+
return request;
|
|
13
|
+
const missingTypes = REQUIRED_ACCEPT_TYPES.filter((value) => !acceptHeader?.includes(value));
|
|
14
|
+
if (missingTypes.length === 0)
|
|
15
|
+
return request;
|
|
16
|
+
const headers = new Headers(request.headers);
|
|
17
|
+
headers.set("accept", [acceptHeader, ...missingTypes].filter(Boolean).join(", "));
|
|
18
|
+
return new Request(request, { headers });
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
normalizeMcpRequest
|
|
22
|
+
};
|
|
@@ -26,6 +26,25 @@ var authLogger = new Logger({
|
|
|
26
26
|
enableContext: true,
|
|
27
27
|
enableColors: false
|
|
28
28
|
});
|
|
29
|
+
// src/application/mcp/normalizeMcpRequest.ts
|
|
30
|
+
var REQUIRED_ACCEPT_TYPES = ["application/json", "text/event-stream"];
|
|
31
|
+
function canNormalizeAcceptHeader(acceptHeader) {
|
|
32
|
+
return !acceptHeader || acceptHeader.includes("*/*") || acceptHeader.includes("application/*") || REQUIRED_ACCEPT_TYPES.some((value) => acceptHeader.includes(value));
|
|
33
|
+
}
|
|
34
|
+
function normalizeMcpRequest(request) {
|
|
35
|
+
if (request.method !== "POST")
|
|
36
|
+
return request;
|
|
37
|
+
const acceptHeader = request.headers.get("accept");
|
|
38
|
+
if (!canNormalizeAcceptHeader(acceptHeader))
|
|
39
|
+
return request;
|
|
40
|
+
const missingTypes = REQUIRED_ACCEPT_TYPES.filter((value) => !acceptHeader?.includes(value));
|
|
41
|
+
if (missingTypes.length === 0)
|
|
42
|
+
return request;
|
|
43
|
+
const headers = new Headers(request.headers);
|
|
44
|
+
headers.set("accept", [acceptHeader, ...missingTypes].filter(Boolean).join(", "));
|
|
45
|
+
return new Request(request, { headers });
|
|
46
|
+
}
|
|
47
|
+
|
|
29
48
|
// src/application/mcp/common.ts
|
|
30
49
|
import { randomUUID } from "crypto";
|
|
31
50
|
import { createMcpServer } from "@contractspec/lib.contracts-runtime-server-mcp/provider-mcp";
|
|
@@ -121,7 +140,7 @@ function createMcpElysiaHandler({
|
|
|
121
140
|
stateful: false
|
|
122
141
|
});
|
|
123
142
|
try {
|
|
124
|
-
return await state.transport.handleRequest(request);
|
|
143
|
+
return await state.transport.handleRequest(normalizeMcpRequest(request));
|
|
125
144
|
} finally {
|
|
126
145
|
await closeSessionState(state);
|
|
127
146
|
}
|
|
@@ -157,7 +176,7 @@ function createMcpElysiaHandler({
|
|
|
157
176
|
createdState = true;
|
|
158
177
|
}
|
|
159
178
|
try {
|
|
160
|
-
const response = await state.transport.handleRequest(request);
|
|
179
|
+
const response = await state.transport.handleRequest(normalizeMcpRequest(request));
|
|
161
180
|
const activeSessionId = state.transport.sessionId;
|
|
162
181
|
if (activeSessionId && !sessions.has(activeSessionId)) {
|
|
163
182
|
sessions.set(activeSessionId, state);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type DocsIndexSource = 'generated' | 'docblock';
|
|
2
|
-
export
|
|
2
|
+
export type DocsIndexEntry = {
|
|
3
3
|
id: string;
|
|
4
4
|
title: string;
|
|
5
5
|
summary?: string;
|
|
@@ -11,17 +11,17 @@ export interface DocsIndexEntry {
|
|
|
11
11
|
visibility?: string;
|
|
12
12
|
version?: string;
|
|
13
13
|
owners?: string[];
|
|
14
|
-
}
|
|
15
|
-
export
|
|
14
|
+
};
|
|
15
|
+
export type DocsIndexChunk = {
|
|
16
16
|
key: string;
|
|
17
17
|
file: string;
|
|
18
18
|
total: number;
|
|
19
|
-
}
|
|
20
|
-
export
|
|
19
|
+
};
|
|
20
|
+
export type DocsIndexManifest = {
|
|
21
21
|
generatedAt: string;
|
|
22
22
|
total: number;
|
|
23
23
|
version: string | null;
|
|
24
24
|
contentRoot: string | null;
|
|
25
25
|
chunks: DocsIndexChunk[];
|
|
26
|
-
}
|
|
26
|
+
};
|
|
27
27
|
export declare const DOCS_INDEX_MANIFEST = "docs-index.manifest.json";
|
|
@@ -19320,10 +19320,17 @@ function LibrariesAiAgentPage() {
|
|
|
19320
19320
|
}),
|
|
19321
19321
|
/* @__PURE__ */ jsx76(CodeBlock35, {
|
|
19322
19322
|
language: "typescript",
|
|
19323
|
-
code: `import { defineAgent, AgentRegistry } from '@contractspec/lib.
|
|
19323
|
+
code: `import { defineAgent, AgentRegistry } from '@contractspec/lib.contracts-spec/agent';
|
|
19324
19324
|
|
|
19325
19325
|
const SupportBot = defineAgent({
|
|
19326
|
-
meta: {
|
|
19326
|
+
meta: {
|
|
19327
|
+
key: 'support.bot',
|
|
19328
|
+
version: '1.0.0',
|
|
19329
|
+
description: 'Resolve tickets and escalate low-confidence decisions.',
|
|
19330
|
+
owners: ['support'],
|
|
19331
|
+
tags: ['support'],
|
|
19332
|
+
stability: 'experimental',
|
|
19333
|
+
},
|
|
19327
19334
|
instructions: 'Resolve tickets. Escalate when confidence < 0.75.',
|
|
19328
19335
|
tools: [{ name: 'support_resolve_ticket' }],
|
|
19329
19336
|
policy: {
|
|
@@ -19345,19 +19352,17 @@ const registry = new AgentRegistry().register(SupportBot);`
|
|
|
19345
19352
|
}),
|
|
19346
19353
|
/* @__PURE__ */ jsx76(CodeBlock35, {
|
|
19347
19354
|
language: "typescript",
|
|
19348
|
-
code: `import {
|
|
19355
|
+
code: `import { createUnifiedAgent, ApprovalWorkflow } from '@contractspec/lib.ai-agent';
|
|
19349
19356
|
|
|
19350
|
-
const
|
|
19351
|
-
|
|
19352
|
-
|
|
19353
|
-
|
|
19354
|
-
approvalWorkflow: new ApprovalWorkflow(),
|
|
19357
|
+
const approvals = new ApprovalWorkflow();
|
|
19358
|
+
const agent = createUnifiedAgent(SupportBot, {
|
|
19359
|
+
backend: 'ai-sdk',
|
|
19360
|
+
tools: new Map([['support_resolve_ticket', async (input) => resolveTicket(input)]]),
|
|
19355
19361
|
});
|
|
19356
19362
|
|
|
19357
|
-
const result = await
|
|
19358
|
-
|
|
19359
|
-
|
|
19360
|
-
}`
|
|
19363
|
+
const result = await agent.run(ticket.body);
|
|
19364
|
+
// Route low-confidence or manual-review flows through approvals when needed.
|
|
19365
|
+
`
|
|
19361
19366
|
})
|
|
19362
19367
|
]
|
|
19363
19368
|
}),
|
|
@@ -19374,26 +19379,21 @@ if (result.approvalRequestId) {
|
|
|
19374
19379
|
/* @__PURE__ */ jsxs76("li", {
|
|
19375
19380
|
children: [
|
|
19376
19381
|
/* @__PURE__ */ jsx76("code", {
|
|
19377
|
-
children: "
|
|
19382
|
+
children: "createUnifiedAgent"
|
|
19378
19383
|
}),
|
|
19379
19384
|
", ",
|
|
19380
19385
|
/* @__PURE__ */ jsx76("code", {
|
|
19381
|
-
children: "
|
|
19386
|
+
children: "ContractSpecAgent"
|
|
19382
19387
|
}),
|
|
19383
19388
|
",",
|
|
19384
19389
|
" ",
|
|
19385
19390
|
/* @__PURE__ */ jsx76("code", {
|
|
19386
|
-
children: "
|
|
19391
|
+
children: "UnifiedAgent"
|
|
19387
19392
|
})
|
|
19388
19393
|
]
|
|
19389
19394
|
}),
|
|
19390
|
-
/* @__PURE__ */
|
|
19391
|
-
children:
|
|
19392
|
-
/* @__PURE__ */ jsx76("code", {
|
|
19393
|
-
children: "ToolExecutor"
|
|
19394
|
-
}),
|
|
19395
|
-
" with schema-enforced tool definitions"
|
|
19396
|
-
]
|
|
19395
|
+
/* @__PURE__ */ jsx76("li", {
|
|
19396
|
+
children: "MCP, operation-backed, memory, and subagent tool adapters"
|
|
19397
19397
|
}),
|
|
19398
19398
|
/* @__PURE__ */ jsxs76("li", {
|
|
19399
19399
|
children: [
|
|
@@ -22935,10 +22935,9 @@ const draft = await responder.draft(ticket, resolution, classification);`
|
|
|
22935
22935
|
/* @__PURE__ */ jsx97(CodeBlock55, {
|
|
22936
22936
|
language: "typescript",
|
|
22937
22937
|
code: `import { createSupportTools } from '@contractspec/lib.support-bot/bot';
|
|
22938
|
-
import { ToolExecutor } from '@contractspec/lib.ai-agent';
|
|
22939
22938
|
|
|
22940
22939
|
const tools = createSupportTools({ resolver, classifier, responder });
|
|
22941
|
-
|
|
22940
|
+
// Pass these tools into your host runtime or agent adapter.`
|
|
22942
22941
|
})
|
|
22943
22942
|
]
|
|
22944
22943
|
}),
|
|
@@ -42,10 +42,17 @@ function LibrariesAiAgentPage() {
|
|
|
42
42
|
}),
|
|
43
43
|
/* @__PURE__ */ jsx(CodeBlock, {
|
|
44
44
|
language: "typescript",
|
|
45
|
-
code: `import { defineAgent, AgentRegistry } from '@contractspec/lib.
|
|
45
|
+
code: `import { defineAgent, AgentRegistry } from '@contractspec/lib.contracts-spec/agent';
|
|
46
46
|
|
|
47
47
|
const SupportBot = defineAgent({
|
|
48
|
-
meta: {
|
|
48
|
+
meta: {
|
|
49
|
+
key: 'support.bot',
|
|
50
|
+
version: '1.0.0',
|
|
51
|
+
description: 'Resolve tickets and escalate low-confidence decisions.',
|
|
52
|
+
owners: ['support'],
|
|
53
|
+
tags: ['support'],
|
|
54
|
+
stability: 'experimental',
|
|
55
|
+
},
|
|
49
56
|
instructions: 'Resolve tickets. Escalate when confidence < 0.75.',
|
|
50
57
|
tools: [{ name: 'support_resolve_ticket' }],
|
|
51
58
|
policy: {
|
|
@@ -67,19 +74,17 @@ const registry = new AgentRegistry().register(SupportBot);`
|
|
|
67
74
|
}),
|
|
68
75
|
/* @__PURE__ */ jsx(CodeBlock, {
|
|
69
76
|
language: "typescript",
|
|
70
|
-
code: `import {
|
|
77
|
+
code: `import { createUnifiedAgent, ApprovalWorkflow } from '@contractspec/lib.ai-agent';
|
|
71
78
|
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
approvalWorkflow: new ApprovalWorkflow(),
|
|
79
|
+
const approvals = new ApprovalWorkflow();
|
|
80
|
+
const agent = createUnifiedAgent(SupportBot, {
|
|
81
|
+
backend: 'ai-sdk',
|
|
82
|
+
tools: new Map([['support_resolve_ticket', async (input) => resolveTicket(input)]]),
|
|
77
83
|
});
|
|
78
84
|
|
|
79
|
-
const result = await
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}`
|
|
85
|
+
const result = await agent.run(ticket.body);
|
|
86
|
+
// Route low-confidence or manual-review flows through approvals when needed.
|
|
87
|
+
`
|
|
83
88
|
})
|
|
84
89
|
]
|
|
85
90
|
}),
|
|
@@ -96,26 +101,21 @@ if (result.approvalRequestId) {
|
|
|
96
101
|
/* @__PURE__ */ jsxs("li", {
|
|
97
102
|
children: [
|
|
98
103
|
/* @__PURE__ */ jsx("code", {
|
|
99
|
-
children: "
|
|
104
|
+
children: "createUnifiedAgent"
|
|
100
105
|
}),
|
|
101
106
|
", ",
|
|
102
107
|
/* @__PURE__ */ jsx("code", {
|
|
103
|
-
children: "
|
|
108
|
+
children: "ContractSpecAgent"
|
|
104
109
|
}),
|
|
105
110
|
",",
|
|
106
111
|
" ",
|
|
107
112
|
/* @__PURE__ */ jsx("code", {
|
|
108
|
-
children: "
|
|
113
|
+
children: "UnifiedAgent"
|
|
109
114
|
})
|
|
110
115
|
]
|
|
111
116
|
}),
|
|
112
|
-
/* @__PURE__ */
|
|
113
|
-
children:
|
|
114
|
-
/* @__PURE__ */ jsx("code", {
|
|
115
|
-
children: "ToolExecutor"
|
|
116
|
-
}),
|
|
117
|
-
" with schema-enforced tool definitions"
|
|
118
|
-
]
|
|
117
|
+
/* @__PURE__ */ jsx("li", {
|
|
118
|
+
children: "MCP, operation-backed, memory, and subagent tool adapters"
|
|
119
119
|
}),
|
|
120
120
|
/* @__PURE__ */ jsxs("li", {
|
|
121
121
|
children: [
|
|
@@ -64,10 +64,9 @@ const draft = await responder.draft(ticket, resolution, classification);`
|
|
|
64
64
|
/* @__PURE__ */ jsx(CodeBlock, {
|
|
65
65
|
language: "typescript",
|
|
66
66
|
code: `import { createSupportTools } from '@contractspec/lib.support-bot/bot';
|
|
67
|
-
import { ToolExecutor } from '@contractspec/lib.ai-agent';
|
|
68
67
|
|
|
69
68
|
const tools = createSupportTools({ resolver, classifier, responder });
|
|
70
|
-
|
|
69
|
+
// Pass these tools into your host runtime or agent adapter.`
|
|
71
70
|
})
|
|
72
71
|
]
|
|
73
72
|
}),
|
|
@@ -267,10 +267,17 @@ function LibrariesAiAgentPage() {
|
|
|
267
267
|
}),
|
|
268
268
|
/* @__PURE__ */ jsx2(CodeBlock2, {
|
|
269
269
|
language: "typescript",
|
|
270
|
-
code: `import { defineAgent, AgentRegistry } from '@contractspec/lib.
|
|
270
|
+
code: `import { defineAgent, AgentRegistry } from '@contractspec/lib.contracts-spec/agent';
|
|
271
271
|
|
|
272
272
|
const SupportBot = defineAgent({
|
|
273
|
-
meta: {
|
|
273
|
+
meta: {
|
|
274
|
+
key: 'support.bot',
|
|
275
|
+
version: '1.0.0',
|
|
276
|
+
description: 'Resolve tickets and escalate low-confidence decisions.',
|
|
277
|
+
owners: ['support'],
|
|
278
|
+
tags: ['support'],
|
|
279
|
+
stability: 'experimental',
|
|
280
|
+
},
|
|
274
281
|
instructions: 'Resolve tickets. Escalate when confidence < 0.75.',
|
|
275
282
|
tools: [{ name: 'support_resolve_ticket' }],
|
|
276
283
|
policy: {
|
|
@@ -292,19 +299,17 @@ const registry = new AgentRegistry().register(SupportBot);`
|
|
|
292
299
|
}),
|
|
293
300
|
/* @__PURE__ */ jsx2(CodeBlock2, {
|
|
294
301
|
language: "typescript",
|
|
295
|
-
code: `import {
|
|
302
|
+
code: `import { createUnifiedAgent, ApprovalWorkflow } from '@contractspec/lib.ai-agent';
|
|
296
303
|
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
approvalWorkflow: new ApprovalWorkflow(),
|
|
304
|
+
const approvals = new ApprovalWorkflow();
|
|
305
|
+
const agent = createUnifiedAgent(SupportBot, {
|
|
306
|
+
backend: 'ai-sdk',
|
|
307
|
+
tools: new Map([['support_resolve_ticket', async (input) => resolveTicket(input)]]),
|
|
302
308
|
});
|
|
303
309
|
|
|
304
|
-
const result = await
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
}`
|
|
310
|
+
const result = await agent.run(ticket.body);
|
|
311
|
+
// Route low-confidence or manual-review flows through approvals when needed.
|
|
312
|
+
`
|
|
308
313
|
})
|
|
309
314
|
]
|
|
310
315
|
}),
|
|
@@ -321,26 +326,21 @@ if (result.approvalRequestId) {
|
|
|
321
326
|
/* @__PURE__ */ jsxs2("li", {
|
|
322
327
|
children: [
|
|
323
328
|
/* @__PURE__ */ jsx2("code", {
|
|
324
|
-
children: "
|
|
329
|
+
children: "createUnifiedAgent"
|
|
325
330
|
}),
|
|
326
331
|
", ",
|
|
327
332
|
/* @__PURE__ */ jsx2("code", {
|
|
328
|
-
children: "
|
|
333
|
+
children: "ContractSpecAgent"
|
|
329
334
|
}),
|
|
330
335
|
",",
|
|
331
336
|
" ",
|
|
332
337
|
/* @__PURE__ */ jsx2("code", {
|
|
333
|
-
children: "
|
|
338
|
+
children: "UnifiedAgent"
|
|
334
339
|
})
|
|
335
340
|
]
|
|
336
341
|
}),
|
|
337
|
-
/* @__PURE__ */
|
|
338
|
-
children:
|
|
339
|
-
/* @__PURE__ */ jsx2("code", {
|
|
340
|
-
children: "ToolExecutor"
|
|
341
|
-
}),
|
|
342
|
-
" with schema-enforced tool definitions"
|
|
343
|
-
]
|
|
342
|
+
/* @__PURE__ */ jsx2("li", {
|
|
343
|
+
children: "MCP, operation-backed, memory, and subagent tool adapters"
|
|
344
344
|
}),
|
|
345
345
|
/* @__PURE__ */ jsxs2("li", {
|
|
346
346
|
children: [
|
|
@@ -3882,10 +3882,9 @@ const draft = await responder.draft(ticket, resolution, classification);`
|
|
|
3882
3882
|
/* @__PURE__ */ jsx23(CodeBlock22, {
|
|
3883
3883
|
language: "typescript",
|
|
3884
3884
|
code: `import { createSupportTools } from '@contractspec/lib.support-bot/bot';
|
|
3885
|
-
import { ToolExecutor } from '@contractspec/lib.ai-agent';
|
|
3886
3885
|
|
|
3887
3886
|
const tools = createSupportTools({ resolver, classifier, responder });
|
|
3888
|
-
|
|
3887
|
+
// Pass these tools into your host runtime or agent adapter.`
|
|
3889
3888
|
})
|
|
3890
3889
|
]
|
|
3891
3890
|
}),
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* Import presentations dynamically or use the main templates/engine.ts
|
|
10
10
|
* which handles the build order correctly.
|
|
11
11
|
*/
|
|
12
|
+
import { TransformEngine } from '@contractspec/lib.contracts-runtime-client-react/transform-engine';
|
|
12
13
|
import type { PresentationSpec } from '@contractspec/lib.contracts-spec/presentations';
|
|
13
|
-
import { TransformEngine } from '@contractspec/lib.contracts-spec/presentations/transform-engine';
|
|
14
14
|
/**
|
|
15
15
|
* Create a configured TransformEngine for template rendering
|
|
16
16
|
*/
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
createDefaultTransformEngine,
|
|
5
5
|
registerBasicValidation,
|
|
6
6
|
registerDefaultReactRenderer
|
|
7
|
-
} from "@contractspec/lib.contracts-
|
|
7
|
+
} from "@contractspec/lib.contracts-runtime-client-react/transform-engine";
|
|
8
8
|
function createTemplateTransformEngine() {
|
|
9
9
|
const engine = createDefaultTransformEngine();
|
|
10
10
|
registerDefaultReactRenderer(engine);
|
package/dist/features/index.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// src/features/docs/docs.contracts.ts
|
|
3
|
-
import {
|
|
4
|
-
ContractReferenceQuery,
|
|
5
|
-
DocSummaryModel,
|
|
6
|
-
DocsIndexInput,
|
|
7
|
-
DocsIndexOutput,
|
|
8
|
-
DocsIndexQuery,
|
|
9
|
-
DocsIndexQuery as DocsIndexQuery2
|
|
10
|
-
} from "@contractspec/lib.contracts-spec/docs";
|
|
11
2
|
// src/features/contracts-registry.ts
|
|
12
3
|
import {
|
|
13
4
|
EventRegistry,
|
|
@@ -18,11 +9,11 @@ import {
|
|
|
18
9
|
} from "@contractspec/lib.contracts-spec/data-views";
|
|
19
10
|
import {
|
|
20
11
|
ContractReferenceDataView,
|
|
21
|
-
ContractReferenceQuery
|
|
12
|
+
ContractReferenceQuery,
|
|
22
13
|
DocsGenerateCommand,
|
|
23
14
|
DocsGeneratedEvent,
|
|
24
15
|
DocsIndexDataView,
|
|
25
|
-
DocsIndexQuery
|
|
16
|
+
DocsIndexQuery,
|
|
26
17
|
DocsLayoutPresentation,
|
|
27
18
|
DocsPublishCommand,
|
|
28
19
|
DocsPublishedEvent,
|
|
@@ -44,7 +35,7 @@ import {
|
|
|
44
35
|
var operationRegistry = null;
|
|
45
36
|
function createContractSpecOperationRegistry() {
|
|
46
37
|
const registry = new OperationSpecRegistry;
|
|
47
|
-
registry.register(
|
|
38
|
+
registry.register(DocsIndexQuery).register(ContractReferenceQuery).register(DocsGenerateCommand).register(DocsPublishCommand);
|
|
48
39
|
return registry;
|
|
49
40
|
}
|
|
50
41
|
function getContractSpecOperationRegistry() {
|
|
@@ -190,6 +181,15 @@ var DocsFeature = {
|
|
|
190
181
|
}
|
|
191
182
|
};
|
|
192
183
|
|
|
184
|
+
// src/features/docs/docs.contracts.ts
|
|
185
|
+
import {
|
|
186
|
+
ContractReferenceQuery as ContractReferenceQuery2,
|
|
187
|
+
DocSummaryModel,
|
|
188
|
+
DocsIndexInput,
|
|
189
|
+
DocsIndexOutput,
|
|
190
|
+
DocsIndexQuery as DocsIndexQuery2,
|
|
191
|
+
DocsIndexQuery as DocsIndexQuery3
|
|
192
|
+
} from "@contractspec/lib.contracts-spec/docs";
|
|
193
193
|
// src/features/mcp.feature.ts
|
|
194
194
|
var MCPFeature = {
|
|
195
195
|
meta: {
|
|
@@ -297,7 +297,7 @@ export {
|
|
|
297
297
|
getContractSpecFeatureRegistry,
|
|
298
298
|
getContractSpecEventRegistry,
|
|
299
299
|
getContractSpecDataViewRegistry,
|
|
300
|
-
|
|
300
|
+
DocsIndexQuery2 as docsSearchSpec,
|
|
301
301
|
createContractSpecPresentationRegistry,
|
|
302
302
|
createContractSpecOperationRegistry,
|
|
303
303
|
createContractSpecFormRegistry,
|
|
@@ -307,10 +307,10 @@ export {
|
|
|
307
307
|
PresentationsFeature,
|
|
308
308
|
MCPFeature,
|
|
309
309
|
FeatureRegistry2 as FeatureRegistry,
|
|
310
|
-
|
|
310
|
+
DocsIndexQuery3 as DocsIndexQuery,
|
|
311
311
|
DocsFeature,
|
|
312
312
|
DocSummaryModel,
|
|
313
313
|
DocsIndexOutput as DocSearchOutput,
|
|
314
314
|
DocsIndexInput as DocSearchInput,
|
|
315
|
-
ContractReferenceQuery
|
|
315
|
+
ContractReferenceQuery2 as ContractReferenceQuery
|
|
316
316
|
};
|