@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
|
@@ -25,6 +25,25 @@ var authLogger = new Logger({
|
|
|
25
25
|
enableContext: true,
|
|
26
26
|
enableColors: false
|
|
27
27
|
});
|
|
28
|
+
// src/application/mcp/normalizeMcpRequest.ts
|
|
29
|
+
var REQUIRED_ACCEPT_TYPES = ["application/json", "text/event-stream"];
|
|
30
|
+
function canNormalizeAcceptHeader(acceptHeader) {
|
|
31
|
+
return !acceptHeader || acceptHeader.includes("*/*") || acceptHeader.includes("application/*") || REQUIRED_ACCEPT_TYPES.some((value) => acceptHeader.includes(value));
|
|
32
|
+
}
|
|
33
|
+
function normalizeMcpRequest(request) {
|
|
34
|
+
if (request.method !== "POST")
|
|
35
|
+
return request;
|
|
36
|
+
const acceptHeader = request.headers.get("accept");
|
|
37
|
+
if (!canNormalizeAcceptHeader(acceptHeader))
|
|
38
|
+
return request;
|
|
39
|
+
const missingTypes = REQUIRED_ACCEPT_TYPES.filter((value) => !acceptHeader?.includes(value));
|
|
40
|
+
if (missingTypes.length === 0)
|
|
41
|
+
return request;
|
|
42
|
+
const headers = new Headers(request.headers);
|
|
43
|
+
headers.set("accept", [acceptHeader, ...missingTypes].filter(Boolean).join(", "));
|
|
44
|
+
return new Request(request, { headers });
|
|
45
|
+
}
|
|
46
|
+
|
|
28
47
|
// src/application/mcp/common.ts
|
|
29
48
|
import { randomUUID } from "node:crypto";
|
|
30
49
|
import { createMcpServer } from "@contractspec/lib.contracts-runtime-server-mcp/provider-mcp";
|
|
@@ -120,7 +139,7 @@ function createMcpElysiaHandler({
|
|
|
120
139
|
stateful: false
|
|
121
140
|
});
|
|
122
141
|
try {
|
|
123
|
-
return await state.transport.handleRequest(request);
|
|
142
|
+
return await state.transport.handleRequest(normalizeMcpRequest(request));
|
|
124
143
|
} finally {
|
|
125
144
|
await closeSessionState(state);
|
|
126
145
|
}
|
|
@@ -156,7 +175,7 @@ function createMcpElysiaHandler({
|
|
|
156
175
|
createdState = true;
|
|
157
176
|
}
|
|
158
177
|
try {
|
|
159
|
-
const response = await state.transport.handleRequest(request);
|
|
178
|
+
const response = await state.transport.handleRequest(normalizeMcpRequest(request));
|
|
160
179
|
const activeSessionId = state.transport.sessionId;
|
|
161
180
|
if (activeSessionId && !sessions.has(activeSessionId)) {
|
|
162
181
|
sessions.set(activeSessionId, state);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/application/mcp/normalizeMcpRequest.ts
|
|
2
|
+
var REQUIRED_ACCEPT_TYPES = ["application/json", "text/event-stream"];
|
|
3
|
+
function canNormalizeAcceptHeader(acceptHeader) {
|
|
4
|
+
return !acceptHeader || acceptHeader.includes("*/*") || acceptHeader.includes("application/*") || REQUIRED_ACCEPT_TYPES.some((value) => acceptHeader.includes(value));
|
|
5
|
+
}
|
|
6
|
+
function normalizeMcpRequest(request) {
|
|
7
|
+
if (request.method !== "POST")
|
|
8
|
+
return request;
|
|
9
|
+
const acceptHeader = request.headers.get("accept");
|
|
10
|
+
if (!canNormalizeAcceptHeader(acceptHeader))
|
|
11
|
+
return request;
|
|
12
|
+
const missingTypes = REQUIRED_ACCEPT_TYPES.filter((value) => !acceptHeader?.includes(value));
|
|
13
|
+
if (missingTypes.length === 0)
|
|
14
|
+
return request;
|
|
15
|
+
const headers = new Headers(request.headers);
|
|
16
|
+
headers.set("accept", [acceptHeader, ...missingTypes].filter(Boolean).join(", "));
|
|
17
|
+
return new Request(request, { headers });
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
normalizeMcpRequest
|
|
21
|
+
};
|
|
@@ -25,6 +25,25 @@ var authLogger = new Logger({
|
|
|
25
25
|
enableContext: true,
|
|
26
26
|
enableColors: false
|
|
27
27
|
});
|
|
28
|
+
// src/application/mcp/normalizeMcpRequest.ts
|
|
29
|
+
var REQUIRED_ACCEPT_TYPES = ["application/json", "text/event-stream"];
|
|
30
|
+
function canNormalizeAcceptHeader(acceptHeader) {
|
|
31
|
+
return !acceptHeader || acceptHeader.includes("*/*") || acceptHeader.includes("application/*") || REQUIRED_ACCEPT_TYPES.some((value) => acceptHeader.includes(value));
|
|
32
|
+
}
|
|
33
|
+
function normalizeMcpRequest(request) {
|
|
34
|
+
if (request.method !== "POST")
|
|
35
|
+
return request;
|
|
36
|
+
const acceptHeader = request.headers.get("accept");
|
|
37
|
+
if (!canNormalizeAcceptHeader(acceptHeader))
|
|
38
|
+
return request;
|
|
39
|
+
const missingTypes = REQUIRED_ACCEPT_TYPES.filter((value) => !acceptHeader?.includes(value));
|
|
40
|
+
if (missingTypes.length === 0)
|
|
41
|
+
return request;
|
|
42
|
+
const headers = new Headers(request.headers);
|
|
43
|
+
headers.set("accept", [acceptHeader, ...missingTypes].filter(Boolean).join(", "));
|
|
44
|
+
return new Request(request, { headers });
|
|
45
|
+
}
|
|
46
|
+
|
|
28
47
|
// src/application/mcp/common.ts
|
|
29
48
|
import { randomUUID } from "node:crypto";
|
|
30
49
|
import { createMcpServer } from "@contractspec/lib.contracts-runtime-server-mcp/provider-mcp";
|
|
@@ -120,7 +139,7 @@ function createMcpElysiaHandler({
|
|
|
120
139
|
stateful: false
|
|
121
140
|
});
|
|
122
141
|
try {
|
|
123
|
-
return await state.transport.handleRequest(request);
|
|
142
|
+
return await state.transport.handleRequest(normalizeMcpRequest(request));
|
|
124
143
|
} finally {
|
|
125
144
|
await closeSessionState(state);
|
|
126
145
|
}
|
|
@@ -156,7 +175,7 @@ function createMcpElysiaHandler({
|
|
|
156
175
|
createdState = true;
|
|
157
176
|
}
|
|
158
177
|
try {
|
|
159
|
-
const response = await state.transport.handleRequest(request);
|
|
178
|
+
const response = await state.transport.handleRequest(normalizeMcpRequest(request));
|
|
160
179
|
const activeSessionId = state.transport.sessionId;
|
|
161
180
|
if (activeSessionId && !sessions.has(activeSessionId)) {
|
|
162
181
|
sessions.set(activeSessionId, state);
|
|
@@ -19319,10 +19319,17 @@ function LibrariesAiAgentPage() {
|
|
|
19319
19319
|
}),
|
|
19320
19320
|
/* @__PURE__ */ jsx76(CodeBlock35, {
|
|
19321
19321
|
language: "typescript",
|
|
19322
|
-
code: `import { defineAgent, AgentRegistry } from '@contractspec/lib.
|
|
19322
|
+
code: `import { defineAgent, AgentRegistry } from '@contractspec/lib.contracts-spec/agent';
|
|
19323
19323
|
|
|
19324
19324
|
const SupportBot = defineAgent({
|
|
19325
|
-
meta: {
|
|
19325
|
+
meta: {
|
|
19326
|
+
key: 'support.bot',
|
|
19327
|
+
version: '1.0.0',
|
|
19328
|
+
description: 'Resolve tickets and escalate low-confidence decisions.',
|
|
19329
|
+
owners: ['support'],
|
|
19330
|
+
tags: ['support'],
|
|
19331
|
+
stability: 'experimental',
|
|
19332
|
+
},
|
|
19326
19333
|
instructions: 'Resolve tickets. Escalate when confidence < 0.75.',
|
|
19327
19334
|
tools: [{ name: 'support_resolve_ticket' }],
|
|
19328
19335
|
policy: {
|
|
@@ -19344,19 +19351,17 @@ const registry = new AgentRegistry().register(SupportBot);`
|
|
|
19344
19351
|
}),
|
|
19345
19352
|
/* @__PURE__ */ jsx76(CodeBlock35, {
|
|
19346
19353
|
language: "typescript",
|
|
19347
|
-
code: `import {
|
|
19354
|
+
code: `import { createUnifiedAgent, ApprovalWorkflow } from '@contractspec/lib.ai-agent';
|
|
19348
19355
|
|
|
19349
|
-
const
|
|
19350
|
-
|
|
19351
|
-
|
|
19352
|
-
|
|
19353
|
-
approvalWorkflow: new ApprovalWorkflow(),
|
|
19356
|
+
const approvals = new ApprovalWorkflow();
|
|
19357
|
+
const agent = createUnifiedAgent(SupportBot, {
|
|
19358
|
+
backend: 'ai-sdk',
|
|
19359
|
+
tools: new Map([['support_resolve_ticket', async (input) => resolveTicket(input)]]),
|
|
19354
19360
|
});
|
|
19355
19361
|
|
|
19356
|
-
const result = await
|
|
19357
|
-
|
|
19358
|
-
|
|
19359
|
-
}`
|
|
19362
|
+
const result = await agent.run(ticket.body);
|
|
19363
|
+
// Route low-confidence or manual-review flows through approvals when needed.
|
|
19364
|
+
`
|
|
19360
19365
|
})
|
|
19361
19366
|
]
|
|
19362
19367
|
}),
|
|
@@ -19373,26 +19378,21 @@ if (result.approvalRequestId) {
|
|
|
19373
19378
|
/* @__PURE__ */ jsxs76("li", {
|
|
19374
19379
|
children: [
|
|
19375
19380
|
/* @__PURE__ */ jsx76("code", {
|
|
19376
|
-
children: "
|
|
19381
|
+
children: "createUnifiedAgent"
|
|
19377
19382
|
}),
|
|
19378
19383
|
", ",
|
|
19379
19384
|
/* @__PURE__ */ jsx76("code", {
|
|
19380
|
-
children: "
|
|
19385
|
+
children: "ContractSpecAgent"
|
|
19381
19386
|
}),
|
|
19382
19387
|
",",
|
|
19383
19388
|
" ",
|
|
19384
19389
|
/* @__PURE__ */ jsx76("code", {
|
|
19385
|
-
children: "
|
|
19390
|
+
children: "UnifiedAgent"
|
|
19386
19391
|
})
|
|
19387
19392
|
]
|
|
19388
19393
|
}),
|
|
19389
|
-
/* @__PURE__ */
|
|
19390
|
-
children:
|
|
19391
|
-
/* @__PURE__ */ jsx76("code", {
|
|
19392
|
-
children: "ToolExecutor"
|
|
19393
|
-
}),
|
|
19394
|
-
" with schema-enforced tool definitions"
|
|
19395
|
-
]
|
|
19394
|
+
/* @__PURE__ */ jsx76("li", {
|
|
19395
|
+
children: "MCP, operation-backed, memory, and subagent tool adapters"
|
|
19396
19396
|
}),
|
|
19397
19397
|
/* @__PURE__ */ jsxs76("li", {
|
|
19398
19398
|
children: [
|
|
@@ -22934,10 +22934,9 @@ const draft = await responder.draft(ticket, resolution, classification);`
|
|
|
22934
22934
|
/* @__PURE__ */ jsx97(CodeBlock55, {
|
|
22935
22935
|
language: "typescript",
|
|
22936
22936
|
code: `import { createSupportTools } from '@contractspec/lib.support-bot/bot';
|
|
22937
|
-
import { ToolExecutor } from '@contractspec/lib.ai-agent';
|
|
22938
22937
|
|
|
22939
22938
|
const tools = createSupportTools({ resolver, classifier, responder });
|
|
22940
|
-
|
|
22939
|
+
// Pass these tools into your host runtime or agent adapter.`
|
|
22941
22940
|
})
|
|
22942
22941
|
]
|
|
22943
22942
|
}),
|
|
@@ -41,10 +41,17 @@ function LibrariesAiAgentPage() {
|
|
|
41
41
|
}),
|
|
42
42
|
/* @__PURE__ */ jsx(CodeBlock, {
|
|
43
43
|
language: "typescript",
|
|
44
|
-
code: `import { defineAgent, AgentRegistry } from '@contractspec/lib.
|
|
44
|
+
code: `import { defineAgent, AgentRegistry } from '@contractspec/lib.contracts-spec/agent';
|
|
45
45
|
|
|
46
46
|
const SupportBot = defineAgent({
|
|
47
|
-
meta: {
|
|
47
|
+
meta: {
|
|
48
|
+
key: 'support.bot',
|
|
49
|
+
version: '1.0.0',
|
|
50
|
+
description: 'Resolve tickets and escalate low-confidence decisions.',
|
|
51
|
+
owners: ['support'],
|
|
52
|
+
tags: ['support'],
|
|
53
|
+
stability: 'experimental',
|
|
54
|
+
},
|
|
48
55
|
instructions: 'Resolve tickets. Escalate when confidence < 0.75.',
|
|
49
56
|
tools: [{ name: 'support_resolve_ticket' }],
|
|
50
57
|
policy: {
|
|
@@ -66,19 +73,17 @@ const registry = new AgentRegistry().register(SupportBot);`
|
|
|
66
73
|
}),
|
|
67
74
|
/* @__PURE__ */ jsx(CodeBlock, {
|
|
68
75
|
language: "typescript",
|
|
69
|
-
code: `import {
|
|
76
|
+
code: `import { createUnifiedAgent, ApprovalWorkflow } from '@contractspec/lib.ai-agent';
|
|
70
77
|
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
approvalWorkflow: new ApprovalWorkflow(),
|
|
78
|
+
const approvals = new ApprovalWorkflow();
|
|
79
|
+
const agent = createUnifiedAgent(SupportBot, {
|
|
80
|
+
backend: 'ai-sdk',
|
|
81
|
+
tools: new Map([['support_resolve_ticket', async (input) => resolveTicket(input)]]),
|
|
76
82
|
});
|
|
77
83
|
|
|
78
|
-
const result = await
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}`
|
|
84
|
+
const result = await agent.run(ticket.body);
|
|
85
|
+
// Route low-confidence or manual-review flows through approvals when needed.
|
|
86
|
+
`
|
|
82
87
|
})
|
|
83
88
|
]
|
|
84
89
|
}),
|
|
@@ -95,26 +100,21 @@ if (result.approvalRequestId) {
|
|
|
95
100
|
/* @__PURE__ */ jsxs("li", {
|
|
96
101
|
children: [
|
|
97
102
|
/* @__PURE__ */ jsx("code", {
|
|
98
|
-
children: "
|
|
103
|
+
children: "createUnifiedAgent"
|
|
99
104
|
}),
|
|
100
105
|
", ",
|
|
101
106
|
/* @__PURE__ */ jsx("code", {
|
|
102
|
-
children: "
|
|
107
|
+
children: "ContractSpecAgent"
|
|
103
108
|
}),
|
|
104
109
|
",",
|
|
105
110
|
" ",
|
|
106
111
|
/* @__PURE__ */ jsx("code", {
|
|
107
|
-
children: "
|
|
112
|
+
children: "UnifiedAgent"
|
|
108
113
|
})
|
|
109
114
|
]
|
|
110
115
|
}),
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
-
children:
|
|
113
|
-
/* @__PURE__ */ jsx("code", {
|
|
114
|
-
children: "ToolExecutor"
|
|
115
|
-
}),
|
|
116
|
-
" with schema-enforced tool definitions"
|
|
117
|
-
]
|
|
116
|
+
/* @__PURE__ */ jsx("li", {
|
|
117
|
+
children: "MCP, operation-backed, memory, and subagent tool adapters"
|
|
118
118
|
}),
|
|
119
119
|
/* @__PURE__ */ jsxs("li", {
|
|
120
120
|
children: [
|
|
@@ -63,10 +63,9 @@ const draft = await responder.draft(ticket, resolution, classification);`
|
|
|
63
63
|
/* @__PURE__ */ jsx(CodeBlock, {
|
|
64
64
|
language: "typescript",
|
|
65
65
|
code: `import { createSupportTools } from '@contractspec/lib.support-bot/bot';
|
|
66
|
-
import { ToolExecutor } from '@contractspec/lib.ai-agent';
|
|
67
66
|
|
|
68
67
|
const tools = createSupportTools({ resolver, classifier, responder });
|
|
69
|
-
|
|
68
|
+
// Pass these tools into your host runtime or agent adapter.`
|
|
70
69
|
})
|
|
71
70
|
]
|
|
72
71
|
}),
|
|
@@ -266,10 +266,17 @@ function LibrariesAiAgentPage() {
|
|
|
266
266
|
}),
|
|
267
267
|
/* @__PURE__ */ jsx2(CodeBlock2, {
|
|
268
268
|
language: "typescript",
|
|
269
|
-
code: `import { defineAgent, AgentRegistry } from '@contractspec/lib.
|
|
269
|
+
code: `import { defineAgent, AgentRegistry } from '@contractspec/lib.contracts-spec/agent';
|
|
270
270
|
|
|
271
271
|
const SupportBot = defineAgent({
|
|
272
|
-
meta: {
|
|
272
|
+
meta: {
|
|
273
|
+
key: 'support.bot',
|
|
274
|
+
version: '1.0.0',
|
|
275
|
+
description: 'Resolve tickets and escalate low-confidence decisions.',
|
|
276
|
+
owners: ['support'],
|
|
277
|
+
tags: ['support'],
|
|
278
|
+
stability: 'experimental',
|
|
279
|
+
},
|
|
273
280
|
instructions: 'Resolve tickets. Escalate when confidence < 0.75.',
|
|
274
281
|
tools: [{ name: 'support_resolve_ticket' }],
|
|
275
282
|
policy: {
|
|
@@ -291,19 +298,17 @@ const registry = new AgentRegistry().register(SupportBot);`
|
|
|
291
298
|
}),
|
|
292
299
|
/* @__PURE__ */ jsx2(CodeBlock2, {
|
|
293
300
|
language: "typescript",
|
|
294
|
-
code: `import {
|
|
301
|
+
code: `import { createUnifiedAgent, ApprovalWorkflow } from '@contractspec/lib.ai-agent';
|
|
295
302
|
|
|
296
|
-
const
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
approvalWorkflow: new ApprovalWorkflow(),
|
|
303
|
+
const approvals = new ApprovalWorkflow();
|
|
304
|
+
const agent = createUnifiedAgent(SupportBot, {
|
|
305
|
+
backend: 'ai-sdk',
|
|
306
|
+
tools: new Map([['support_resolve_ticket', async (input) => resolveTicket(input)]]),
|
|
301
307
|
});
|
|
302
308
|
|
|
303
|
-
const result = await
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}`
|
|
309
|
+
const result = await agent.run(ticket.body);
|
|
310
|
+
// Route low-confidence or manual-review flows through approvals when needed.
|
|
311
|
+
`
|
|
307
312
|
})
|
|
308
313
|
]
|
|
309
314
|
}),
|
|
@@ -320,26 +325,21 @@ if (result.approvalRequestId) {
|
|
|
320
325
|
/* @__PURE__ */ jsxs2("li", {
|
|
321
326
|
children: [
|
|
322
327
|
/* @__PURE__ */ jsx2("code", {
|
|
323
|
-
children: "
|
|
328
|
+
children: "createUnifiedAgent"
|
|
324
329
|
}),
|
|
325
330
|
", ",
|
|
326
331
|
/* @__PURE__ */ jsx2("code", {
|
|
327
|
-
children: "
|
|
332
|
+
children: "ContractSpecAgent"
|
|
328
333
|
}),
|
|
329
334
|
",",
|
|
330
335
|
" ",
|
|
331
336
|
/* @__PURE__ */ jsx2("code", {
|
|
332
|
-
children: "
|
|
337
|
+
children: "UnifiedAgent"
|
|
333
338
|
})
|
|
334
339
|
]
|
|
335
340
|
}),
|
|
336
|
-
/* @__PURE__ */
|
|
337
|
-
children:
|
|
338
|
-
/* @__PURE__ */ jsx2("code", {
|
|
339
|
-
children: "ToolExecutor"
|
|
340
|
-
}),
|
|
341
|
-
" with schema-enforced tool definitions"
|
|
342
|
-
]
|
|
341
|
+
/* @__PURE__ */ jsx2("li", {
|
|
342
|
+
children: "MCP, operation-backed, memory, and subagent tool adapters"
|
|
343
343
|
}),
|
|
344
344
|
/* @__PURE__ */ jsxs2("li", {
|
|
345
345
|
children: [
|
|
@@ -3881,10 +3881,9 @@ const draft = await responder.draft(ticket, resolution, classification);`
|
|
|
3881
3881
|
/* @__PURE__ */ jsx23(CodeBlock22, {
|
|
3882
3882
|
language: "typescript",
|
|
3883
3883
|
code: `import { createSupportTools } from '@contractspec/lib.support-bot/bot';
|
|
3884
|
-
import { ToolExecutor } from '@contractspec/lib.ai-agent';
|
|
3885
3884
|
|
|
3886
3885
|
const tools = createSupportTools({ resolver, classifier, responder });
|
|
3887
|
-
|
|
3886
|
+
// Pass these tools into your host runtime or agent adapter.`
|
|
3888
3887
|
})
|
|
3889
3888
|
]
|
|
3890
3889
|
}),
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
createDefaultTransformEngine,
|
|
4
4
|
registerBasicValidation,
|
|
5
5
|
registerDefaultReactRenderer
|
|
6
|
-
} from "@contractspec/lib.contracts-
|
|
6
|
+
} from "@contractspec/lib.contracts-runtime-client-react/transform-engine";
|
|
7
7
|
function createTemplateTransformEngine() {
|
|
8
8
|
const engine = createDefaultTransformEngine();
|
|
9
9
|
registerDefaultReactRenderer(engine);
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
// src/features/docs/docs.contracts.ts
|
|
2
|
-
import {
|
|
3
|
-
ContractReferenceQuery,
|
|
4
|
-
DocSummaryModel,
|
|
5
|
-
DocsIndexInput,
|
|
6
|
-
DocsIndexOutput,
|
|
7
|
-
DocsIndexQuery,
|
|
8
|
-
DocsIndexQuery as DocsIndexQuery2
|
|
9
|
-
} from "@contractspec/lib.contracts-spec/docs";
|
|
10
1
|
// src/features/contracts-registry.ts
|
|
11
2
|
import {
|
|
12
3
|
EventRegistry,
|
|
@@ -17,11 +8,11 @@ import {
|
|
|
17
8
|
} from "@contractspec/lib.contracts-spec/data-views";
|
|
18
9
|
import {
|
|
19
10
|
ContractReferenceDataView,
|
|
20
|
-
ContractReferenceQuery
|
|
11
|
+
ContractReferenceQuery,
|
|
21
12
|
DocsGenerateCommand,
|
|
22
13
|
DocsGeneratedEvent,
|
|
23
14
|
DocsIndexDataView,
|
|
24
|
-
DocsIndexQuery
|
|
15
|
+
DocsIndexQuery,
|
|
25
16
|
DocsLayoutPresentation,
|
|
26
17
|
DocsPublishCommand,
|
|
27
18
|
DocsPublishedEvent,
|
|
@@ -43,7 +34,7 @@ import {
|
|
|
43
34
|
var operationRegistry = null;
|
|
44
35
|
function createContractSpecOperationRegistry() {
|
|
45
36
|
const registry = new OperationSpecRegistry;
|
|
46
|
-
registry.register(
|
|
37
|
+
registry.register(DocsIndexQuery).register(ContractReferenceQuery).register(DocsGenerateCommand).register(DocsPublishCommand);
|
|
47
38
|
return registry;
|
|
48
39
|
}
|
|
49
40
|
function getContractSpecOperationRegistry() {
|
|
@@ -189,6 +180,15 @@ var DocsFeature = {
|
|
|
189
180
|
}
|
|
190
181
|
};
|
|
191
182
|
|
|
183
|
+
// src/features/docs/docs.contracts.ts
|
|
184
|
+
import {
|
|
185
|
+
ContractReferenceQuery as ContractReferenceQuery2,
|
|
186
|
+
DocSummaryModel,
|
|
187
|
+
DocsIndexInput,
|
|
188
|
+
DocsIndexOutput,
|
|
189
|
+
DocsIndexQuery as DocsIndexQuery2,
|
|
190
|
+
DocsIndexQuery as DocsIndexQuery3
|
|
191
|
+
} from "@contractspec/lib.contracts-spec/docs";
|
|
192
192
|
// src/features/mcp.feature.ts
|
|
193
193
|
var MCPFeature = {
|
|
194
194
|
meta: {
|
|
@@ -296,7 +296,7 @@ export {
|
|
|
296
296
|
getContractSpecFeatureRegistry,
|
|
297
297
|
getContractSpecEventRegistry,
|
|
298
298
|
getContractSpecDataViewRegistry,
|
|
299
|
-
|
|
299
|
+
DocsIndexQuery2 as docsSearchSpec,
|
|
300
300
|
createContractSpecPresentationRegistry,
|
|
301
301
|
createContractSpecOperationRegistry,
|
|
302
302
|
createContractSpecFormRegistry,
|
|
@@ -306,10 +306,10 @@ export {
|
|
|
306
306
|
PresentationsFeature,
|
|
307
307
|
MCPFeature,
|
|
308
308
|
FeatureRegistry2 as FeatureRegistry,
|
|
309
|
-
|
|
309
|
+
DocsIndexQuery3 as DocsIndexQuery,
|
|
310
310
|
DocsFeature,
|
|
311
311
|
DocSummaryModel,
|
|
312
312
|
DocsIndexOutput as DocSearchOutput,
|
|
313
313
|
DocsIndexInput as DocSearchInput,
|
|
314
|
-
ContractReferenceQuery
|
|
314
|
+
ContractReferenceQuery2 as ContractReferenceQuery
|
|
315
315
|
};
|