@contractspec/example.ai-support-bot 3.7.16 → 3.7.18
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 +21 -21
- package/CHANGELOG.md +27 -0
- package/dist/ai-support-bot.feature.js +1 -19
- package/dist/browser/ai-support-bot.feature.js +1 -19
- package/dist/browser/docs/ai-support-bot.docblock.js +3 -27
- package/dist/browser/docs/index.js +3 -27
- package/dist/browser/example.js +1 -33
- package/dist/browser/index.js +3 -120
- package/dist/browser/setup.js +1 -43
- package/dist/docs/ai-support-bot.docblock.js +3 -27
- package/dist/docs/index.js +3 -27
- package/dist/example.js +1 -33
- package/dist/index.js +3 -120
- package/dist/node/ai-support-bot.feature.js +1 -19
- package/dist/node/docs/ai-support-bot.docblock.js +3 -27
- package/dist/node/docs/index.js +3 -27
- package/dist/node/example.js +1 -33
- package/dist/node/index.js +3 -120
- package/dist/node/setup.js +1 -43
- package/dist/setup.js +1 -43
- package/package.json +9 -9
package/.turbo/turbo-build.log
CHANGED
|
@@ -2,33 +2,33 @@ $ contractspec-bun-build prebuild
|
|
|
2
2
|
$ bun run build:bundle && bun run build:types
|
|
3
3
|
$ contractspec-bun-build transpile
|
|
4
4
|
[contractspec-bun-build] transpile target=bun root=src entries=6 noBundle=false
|
|
5
|
-
Bundled 6 modules in
|
|
5
|
+
Bundled 6 modules in 45ms
|
|
6
6
|
|
|
7
|
-
./ai-support-bot.feature.js 0.
|
|
8
|
-
./index.js
|
|
9
|
-
docs/index.js 1.
|
|
10
|
-
docs/ai-support-bot.docblock.js 1.
|
|
11
|
-
./example.js 0.
|
|
12
|
-
./setup.js
|
|
7
|
+
./ai-support-bot.feature.js 0.52 KB (entry point)
|
|
8
|
+
./index.js 3.33 KB (entry point)
|
|
9
|
+
docs/index.js 1.17 KB (entry point)
|
|
10
|
+
docs/ai-support-bot.docblock.js 1.17 KB (entry point)
|
|
11
|
+
./example.js 0.72 KB (entry point)
|
|
12
|
+
./setup.js 0.95 KB (entry point)
|
|
13
13
|
|
|
14
14
|
[contractspec-bun-build] transpile target=node root=src entries=6 noBundle=false
|
|
15
|
-
Bundled 6 modules in
|
|
15
|
+
Bundled 6 modules in 25ms
|
|
16
16
|
|
|
17
|
-
./ai-support-bot.feature.js 0.
|
|
18
|
-
./index.js
|
|
19
|
-
docs/index.js 1.
|
|
20
|
-
docs/ai-support-bot.docblock.js 1.
|
|
21
|
-
./example.js 0.
|
|
22
|
-
./setup.js
|
|
17
|
+
./ai-support-bot.feature.js 0.52 KB (entry point)
|
|
18
|
+
./index.js 3.31 KB (entry point)
|
|
19
|
+
docs/index.js 1.16 KB (entry point)
|
|
20
|
+
docs/ai-support-bot.docblock.js 1.16 KB (entry point)
|
|
21
|
+
./example.js 0.71 KB (entry point)
|
|
22
|
+
./setup.js 0.94 KB (entry point)
|
|
23
23
|
|
|
24
24
|
[contractspec-bun-build] transpile target=browser root=src entries=6 noBundle=false
|
|
25
|
-
Bundled 6 modules in
|
|
25
|
+
Bundled 6 modules in 41ms
|
|
26
26
|
|
|
27
|
-
./ai-support-bot.feature.js 0.
|
|
28
|
-
./index.js
|
|
29
|
-
docs/index.js 1.
|
|
30
|
-
docs/ai-support-bot.docblock.js 1.
|
|
31
|
-
./example.js 0.
|
|
32
|
-
./setup.js
|
|
27
|
+
./ai-support-bot.feature.js 0.52 KB (entry point)
|
|
28
|
+
./index.js 3.31 KB (entry point)
|
|
29
|
+
docs/index.js 1.16 KB (entry point)
|
|
30
|
+
docs/ai-support-bot.docblock.js 1.16 KB (entry point)
|
|
31
|
+
./example.js 0.71 KB (entry point)
|
|
32
|
+
./setup.js 0.94 KB (entry point)
|
|
33
33
|
|
|
34
34
|
$ contractspec-bun-build types
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @contractspec/example.ai-support-bot
|
|
2
2
|
|
|
3
|
+
## 3.7.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- chore: auto-bump internal dependents
|
|
8
|
+
- Updated dependencies because of chore: auto-bump internal dependents
|
|
9
|
+
- Updated dependencies because of Introduce the Builder v3 control plane as a governed authoring layer over external execution providers.
|
|
10
|
+
- Updated dependencies because of Implement ContractSpec Connect as a first-class spec, runtime, and CLI workflow.
|
|
11
|
+
- @contractspec/lib.knowledge@3.7.18
|
|
12
|
+
- @contractspec/lib.support-bot@3.7.18
|
|
13
|
+
- @contractspec/lib.contracts-spec@5.2.0
|
|
14
|
+
- @contractspec/lib.logger@3.7.13
|
|
15
|
+
|
|
16
|
+
## 3.7.17
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Fix workflow runtime imports for sandboxed workflow execution and keep workflow authoring on safe subpaths.
|
|
21
|
+
- Migration: Keep Node-only workflow runner code out of "use workflow" entrypoints.
|
|
22
|
+
- Deprecations: Importing the broad `@contractspec/lib.contracts-spec/workflow` barrel from sandboxed workflow entrypoints is discouraged.
|
|
23
|
+
- Updated dependencies because of Fix workflow runtime imports for sandboxed workflow execution and keep workflow authoring on safe subpaths.
|
|
24
|
+
- Updated dependencies because of Add versioning-backed release capsules, generated patch notes, and guided upgrade flows.
|
|
25
|
+
- @contractspec/lib.contracts-spec@5.1.0
|
|
26
|
+
- @contractspec/lib.support-bot@3.7.17
|
|
27
|
+
- @contractspec/lib.knowledge@3.7.17
|
|
28
|
+
- @contractspec/lib.logger@3.7.13
|
|
29
|
+
|
|
3
30
|
## 3.7.16
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
|
@@ -1,20 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
3
|
-
import { defineFeature } from "@contractspec/lib.contracts-spec";
|
|
4
|
-
var AiSupportBotFeature = defineFeature({
|
|
5
|
-
meta: {
|
|
6
|
-
key: "ai-support-bot",
|
|
7
|
-
version: "1.0.0",
|
|
8
|
-
title: "AI Support Bot",
|
|
9
|
-
description: "AI support ticket classification and resolution using grounded knowledge",
|
|
10
|
-
domain: "support",
|
|
11
|
-
owners: ["@examples"],
|
|
12
|
-
tags: ["ai", "support", "knowledge", "tickets"],
|
|
13
|
-
stability: "experimental"
|
|
14
|
-
},
|
|
15
|
-
knowledge: [{ key: "ai-support-bot.knowledge.articles", version: "1.0.0" }],
|
|
16
|
-
docs: ["docs.examples.ai-support-bot", "docs.examples.ai-support-bot.usage"]
|
|
17
|
-
});
|
|
18
|
-
export {
|
|
19
|
-
AiSupportBotFeature
|
|
20
|
-
};
|
|
2
|
+
import{defineFeature as g}from"@contractspec/lib.contracts-spec";var j=g({meta:{key:"ai-support-bot",version:"1.0.0",title:"AI Support Bot",description:"AI support ticket classification and resolution using grounded knowledge",domain:"support",owners:["@examples"],tags:["ai","support","knowledge","tickets"],stability:"experimental"},knowledge:[{key:"ai-support-bot.knowledge.articles",version:"1.0.0"}],docs:["docs.examples.ai-support-bot","docs.examples.ai-support-bot.usage"]});export{j as AiSupportBotFeature};
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { defineFeature } from "@contractspec/lib.contracts-spec";
|
|
3
|
-
var AiSupportBotFeature = defineFeature({
|
|
4
|
-
meta: {
|
|
5
|
-
key: "ai-support-bot",
|
|
6
|
-
version: "1.0.0",
|
|
7
|
-
title: "AI Support Bot",
|
|
8
|
-
description: "AI support ticket classification and resolution using grounded knowledge",
|
|
9
|
-
domain: "support",
|
|
10
|
-
owners: ["@examples"],
|
|
11
|
-
tags: ["ai", "support", "knowledge", "tickets"],
|
|
12
|
-
stability: "experimental"
|
|
13
|
-
},
|
|
14
|
-
knowledge: [{ key: "ai-support-bot.knowledge.articles", version: "1.0.0" }],
|
|
15
|
-
docs: ["docs.examples.ai-support-bot", "docs.examples.ai-support-bot.usage"]
|
|
16
|
-
});
|
|
17
|
-
export {
|
|
18
|
-
AiSupportBotFeature
|
|
19
|
-
};
|
|
1
|
+
import{defineFeature as g}from"@contractspec/lib.contracts-spec";var j=g({meta:{key:"ai-support-bot",version:"1.0.0",title:"AI Support Bot",description:"AI support ticket classification and resolution using grounded knowledge",domain:"support",owners:["@examples"],tags:["ai","support","knowledge","tickets"],stability:"experimental"},knowledge:[{key:"ai-support-bot.knowledge.articles",version:"1.0.0"}],docs:["docs.examples.ai-support-bot","docs.examples.ai-support-bot.usage"]});export{j as AiSupportBotFeature};
|
|
@@ -1,38 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
|
|
3
|
-
var blocks = [
|
|
4
|
-
{
|
|
5
|
-
id: "docs.examples.ai-support-bot",
|
|
6
|
-
title: "AI Support Bot (example)",
|
|
7
|
-
summary: "Ticket classification + knowledge-grounded resolution + response drafting.",
|
|
8
|
-
kind: "reference",
|
|
9
|
-
visibility: "public",
|
|
10
|
-
route: "/docs/examples/ai-support-bot",
|
|
11
|
-
tags: ["support", "ai", "example"],
|
|
12
|
-
body: `## What this example shows
|
|
1
|
+
import{registerDocBlocks as f}from"@contractspec/lib.contracts-spec/docs";var h=[{id:"docs.examples.ai-support-bot",title:"AI Support Bot (example)",summary:"Ticket classification + knowledge-grounded resolution + response drafting.",kind:"reference",visibility:"public",route:"/docs/examples/ai-support-bot",tags:["support","ai","example"],body:`## What this example shows
|
|
13
2
|
- Classify a ticket into a support category.
|
|
14
3
|
- Use a knowledge port to generate a grounded resolution.
|
|
15
4
|
- Draft a response (email body) from the resolution.
|
|
16
5
|
|
|
17
6
|
## Guardrails
|
|
18
7
|
- Avoid logging raw ticket bodies/PII; prefer structured summaries.
|
|
19
|
-
- Keep knowledge and ticket adapters explicit and testable.`
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
id: "docs.examples.ai-support-bot.usage",
|
|
23
|
-
title: "AI Support Bot — Usage",
|
|
24
|
-
summary: "How to run the example and swap the knowledge adapter.",
|
|
25
|
-
kind: "usage",
|
|
26
|
-
visibility: "public",
|
|
27
|
-
route: "/docs/examples/ai-support-bot/usage",
|
|
28
|
-
tags: ["support", "usage"],
|
|
29
|
-
body: `## Usage
|
|
8
|
+
- Keep knowledge and ticket adapters explicit and testable.`},{id:"docs.examples.ai-support-bot.usage",title:"AI Support Bot — Usage",summary:"How to run the example and swap the knowledge adapter.",kind:"usage",visibility:"public",route:"/docs/examples/ai-support-bot/usage",tags:["support","usage"],body:`## Usage
|
|
30
9
|
- Call \`runAiSupportBotExample()\`.
|
|
31
10
|
- Replace the \`knowledge.query\` implementation with a real knowledge service.
|
|
32
11
|
|
|
33
12
|
## Notes
|
|
34
13
|
- Keep outputs structured.
|
|
35
|
-
- Use policy gates before exposing drafted replies to end-users.`
|
|
36
|
-
}
|
|
37
|
-
];
|
|
38
|
-
registerDocBlocks(blocks);
|
|
14
|
+
- Use policy gates before exposing drafted replies to end-users.`}];f(h);
|
|
@@ -1,38 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
|
|
3
|
-
var blocks = [
|
|
4
|
-
{
|
|
5
|
-
id: "docs.examples.ai-support-bot",
|
|
6
|
-
title: "AI Support Bot (example)",
|
|
7
|
-
summary: "Ticket classification + knowledge-grounded resolution + response drafting.",
|
|
8
|
-
kind: "reference",
|
|
9
|
-
visibility: "public",
|
|
10
|
-
route: "/docs/examples/ai-support-bot",
|
|
11
|
-
tags: ["support", "ai", "example"],
|
|
12
|
-
body: `## What this example shows
|
|
1
|
+
import{registerDocBlocks as m}from"@contractspec/lib.contracts-spec/docs";var f=[{id:"docs.examples.ai-support-bot",title:"AI Support Bot (example)",summary:"Ticket classification + knowledge-grounded resolution + response drafting.",kind:"reference",visibility:"public",route:"/docs/examples/ai-support-bot",tags:["support","ai","example"],body:`## What this example shows
|
|
13
2
|
- Classify a ticket into a support category.
|
|
14
3
|
- Use a knowledge port to generate a grounded resolution.
|
|
15
4
|
- Draft a response (email body) from the resolution.
|
|
16
5
|
|
|
17
6
|
## Guardrails
|
|
18
7
|
- Avoid logging raw ticket bodies/PII; prefer structured summaries.
|
|
19
|
-
- Keep knowledge and ticket adapters explicit and testable.`
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
id: "docs.examples.ai-support-bot.usage",
|
|
23
|
-
title: "AI Support Bot — Usage",
|
|
24
|
-
summary: "How to run the example and swap the knowledge adapter.",
|
|
25
|
-
kind: "usage",
|
|
26
|
-
visibility: "public",
|
|
27
|
-
route: "/docs/examples/ai-support-bot/usage",
|
|
28
|
-
tags: ["support", "usage"],
|
|
29
|
-
body: `## Usage
|
|
8
|
+
- Keep knowledge and ticket adapters explicit and testable.`},{id:"docs.examples.ai-support-bot.usage",title:"AI Support Bot — Usage",summary:"How to run the example and swap the knowledge adapter.",kind:"usage",visibility:"public",route:"/docs/examples/ai-support-bot/usage",tags:["support","usage"],body:`## Usage
|
|
30
9
|
- Call \`runAiSupportBotExample()\`.
|
|
31
10
|
- Replace the \`knowledge.query\` implementation with a real knowledge service.
|
|
32
11
|
|
|
33
12
|
## Notes
|
|
34
13
|
- Keep outputs structured.
|
|
35
|
-
- Use policy gates before exposing drafted replies to end-users.`
|
|
36
|
-
}
|
|
37
|
-
];
|
|
38
|
-
registerDocBlocks(blocks);
|
|
14
|
+
- Use policy gates before exposing drafted replies to end-users.`}];m(f);
|
package/dist/browser/example.js
CHANGED
|
@@ -1,33 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { defineExample } from "@contractspec/lib.contracts-spec";
|
|
3
|
-
var example = defineExample({
|
|
4
|
-
meta: {
|
|
5
|
-
key: "ai-support-bot",
|
|
6
|
-
version: "1.0.0",
|
|
7
|
-
title: "AI Support Bot",
|
|
8
|
-
description: "Classify and resolve a support ticket (with a drafted response) using the support-bot and knowledge libraries.",
|
|
9
|
-
kind: "script",
|
|
10
|
-
visibility: "public",
|
|
11
|
-
stability: "experimental",
|
|
12
|
-
owners: ["@platform.core"],
|
|
13
|
-
tags: ["support", "ai", "tickets", "knowledge"]
|
|
14
|
-
},
|
|
15
|
-
docs: {
|
|
16
|
-
rootDocId: "docs.examples.ai-support-bot",
|
|
17
|
-
usageDocId: "docs.examples.ai-support-bot.usage"
|
|
18
|
-
},
|
|
19
|
-
entrypoints: {
|
|
20
|
-
packageName: "@contractspec/example.ai-support-bot",
|
|
21
|
-
docs: "./docs"
|
|
22
|
-
},
|
|
23
|
-
surfaces: {
|
|
24
|
-
templates: true,
|
|
25
|
-
sandbox: { enabled: true, modes: ["markdown"] },
|
|
26
|
-
studio: { enabled: true, installable: true },
|
|
27
|
-
mcp: { enabled: true }
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
var example_default = example;
|
|
31
|
-
export {
|
|
32
|
-
example_default as default
|
|
33
|
-
};
|
|
1
|
+
import{defineExample as g}from"@contractspec/lib.contracts-spec";var h=g({meta:{key:"ai-support-bot",version:"1.0.0",title:"AI Support Bot",description:"Classify and resolve a support ticket (with a drafted response) using the support-bot and knowledge libraries.",kind:"script",visibility:"public",stability:"experimental",owners:["@platform.core"],tags:["support","ai","tickets","knowledge"]},docs:{rootDocId:"docs.examples.ai-support-bot",usageDocId:"docs.examples.ai-support-bot.usage"},entrypoints:{packageName:"@contractspec/example.ai-support-bot",docs:"./docs"},surfaces:{templates:!0,sandbox:{enabled:!0,modes:["markdown"]},studio:{enabled:!0,installable:!0},mcp:{enabled:!0}}}),q=h;export{q as default};
|
package/dist/browser/index.js
CHANGED
|
@@ -1,131 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import { defineFeature } from "@contractspec/lib.contracts-spec";
|
|
3
|
-
var AiSupportBotFeature = defineFeature({
|
|
4
|
-
meta: {
|
|
5
|
-
key: "ai-support-bot",
|
|
6
|
-
version: "1.0.0",
|
|
7
|
-
title: "AI Support Bot",
|
|
8
|
-
description: "AI support ticket classification and resolution using grounded knowledge",
|
|
9
|
-
domain: "support",
|
|
10
|
-
owners: ["@examples"],
|
|
11
|
-
tags: ["ai", "support", "knowledge", "tickets"],
|
|
12
|
-
stability: "experimental"
|
|
13
|
-
},
|
|
14
|
-
knowledge: [{ key: "ai-support-bot.knowledge.articles", version: "1.0.0" }],
|
|
15
|
-
docs: ["docs.examples.ai-support-bot", "docs.examples.ai-support-bot.usage"]
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
// src/docs/ai-support-bot.docblock.ts
|
|
19
|
-
import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
|
|
20
|
-
var blocks = [
|
|
21
|
-
{
|
|
22
|
-
id: "docs.examples.ai-support-bot",
|
|
23
|
-
title: "AI Support Bot (example)",
|
|
24
|
-
summary: "Ticket classification + knowledge-grounded resolution + response drafting.",
|
|
25
|
-
kind: "reference",
|
|
26
|
-
visibility: "public",
|
|
27
|
-
route: "/docs/examples/ai-support-bot",
|
|
28
|
-
tags: ["support", "ai", "example"],
|
|
29
|
-
body: `## What this example shows
|
|
1
|
+
import{defineFeature as H}from"@contractspec/lib.contracts-spec";var Y=H({meta:{key:"ai-support-bot",version:"1.0.0",title:"AI Support Bot",description:"AI support ticket classification and resolution using grounded knowledge",domain:"support",owners:["@examples"],tags:["ai","support","knowledge","tickets"],stability:"experimental"},knowledge:[{key:"ai-support-bot.knowledge.articles",version:"1.0.0"}],docs:["docs.examples.ai-support-bot","docs.examples.ai-support-bot.usage"]});import{registerDocBlocks as I}from"@contractspec/lib.contracts-spec/docs";var J=[{id:"docs.examples.ai-support-bot",title:"AI Support Bot (example)",summary:"Ticket classification + knowledge-grounded resolution + response drafting.",kind:"reference",visibility:"public",route:"/docs/examples/ai-support-bot",tags:["support","ai","example"],body:`## What this example shows
|
|
30
2
|
- Classify a ticket into a support category.
|
|
31
3
|
- Use a knowledge port to generate a grounded resolution.
|
|
32
4
|
- Draft a response (email body) from the resolution.
|
|
33
5
|
|
|
34
6
|
## Guardrails
|
|
35
7
|
- Avoid logging raw ticket bodies/PII; prefer structured summaries.
|
|
36
|
-
- Keep knowledge and ticket adapters explicit and testable.`
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
id: "docs.examples.ai-support-bot.usage",
|
|
40
|
-
title: "AI Support Bot — Usage",
|
|
41
|
-
summary: "How to run the example and swap the knowledge adapter.",
|
|
42
|
-
kind: "usage",
|
|
43
|
-
visibility: "public",
|
|
44
|
-
route: "/docs/examples/ai-support-bot/usage",
|
|
45
|
-
tags: ["support", "usage"],
|
|
46
|
-
body: `## Usage
|
|
8
|
+
- Keep knowledge and ticket adapters explicit and testable.`},{id:"docs.examples.ai-support-bot.usage",title:"AI Support Bot — Usage",summary:"How to run the example and swap the knowledge adapter.",kind:"usage",visibility:"public",route:"/docs/examples/ai-support-bot/usage",tags:["support","usage"],body:`## Usage
|
|
47
9
|
- Call \`runAiSupportBotExample()\`.
|
|
48
10
|
- Replace the \`knowledge.query\` implementation with a real knowledge service.
|
|
49
11
|
|
|
50
12
|
## Notes
|
|
51
13
|
- Keep outputs structured.
|
|
52
|
-
- Use policy gates before exposing drafted replies to end-users.`
|
|
53
|
-
}
|
|
54
|
-
];
|
|
55
|
-
registerDocBlocks(blocks);
|
|
56
|
-
// src/example.ts
|
|
57
|
-
import { defineExample } from "@contractspec/lib.contracts-spec";
|
|
58
|
-
var example = defineExample({
|
|
59
|
-
meta: {
|
|
60
|
-
key: "ai-support-bot",
|
|
61
|
-
version: "1.0.0",
|
|
62
|
-
title: "AI Support Bot",
|
|
63
|
-
description: "Classify and resolve a support ticket (with a drafted response) using the support-bot and knowledge libraries.",
|
|
64
|
-
kind: "script",
|
|
65
|
-
visibility: "public",
|
|
66
|
-
stability: "experimental",
|
|
67
|
-
owners: ["@platform.core"],
|
|
68
|
-
tags: ["support", "ai", "tickets", "knowledge"]
|
|
69
|
-
},
|
|
70
|
-
docs: {
|
|
71
|
-
rootDocId: "docs.examples.ai-support-bot",
|
|
72
|
-
usageDocId: "docs.examples.ai-support-bot.usage"
|
|
73
|
-
},
|
|
74
|
-
entrypoints: {
|
|
75
|
-
packageName: "@contractspec/example.ai-support-bot",
|
|
76
|
-
docs: "./docs"
|
|
77
|
-
},
|
|
78
|
-
surfaces: {
|
|
79
|
-
templates: true,
|
|
80
|
-
sandbox: { enabled: true, modes: ["markdown"] },
|
|
81
|
-
studio: { enabled: true, installable: true },
|
|
82
|
-
mcp: { enabled: true }
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
var example_default = example;
|
|
86
|
-
|
|
87
|
-
// src/setup.ts
|
|
88
|
-
import { Logger, LogLevel } from "@contractspec/lib.logger";
|
|
89
|
-
import { AutoResponder } from "@contractspec/lib.support-bot/bot";
|
|
90
|
-
import { TicketResolver } from "@contractspec/lib.support-bot/rag";
|
|
91
|
-
import { TicketClassifier } from "@contractspec/lib.support-bot/tickets";
|
|
92
|
-
var logger = new Logger({
|
|
93
|
-
level: LogLevel.INFO,
|
|
94
|
-
environment: "production",
|
|
95
|
-
enableColors: false
|
|
96
|
-
});
|
|
97
|
-
async function runAiSupportBotExample() {
|
|
98
|
-
const knowledge = {
|
|
99
|
-
async query(question) {
|
|
100
|
-
return {
|
|
101
|
-
answer: `The payout will retrigger automatically. (${question.slice(0, 40)}…)`,
|
|
102
|
-
references: []
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
const resolver = new TicketResolver({ knowledge });
|
|
107
|
-
const classifier = new TicketClassifier;
|
|
108
|
-
const responder = new AutoResponder;
|
|
109
|
-
const ticket = {
|
|
110
|
-
id: "TIC-42",
|
|
111
|
-
subject: "Payout failed",
|
|
112
|
-
body: "Hello, our supplier payout failed twice yesterday. Can you confirm status? It is urgent.",
|
|
113
|
-
channel: "email",
|
|
114
|
-
customerName: "Ivy",
|
|
115
|
-
metadata: { accountId: "acct_789" }
|
|
116
|
-
};
|
|
117
|
-
const classification = await classifier.classify(ticket);
|
|
118
|
-
const resolution = await resolver.resolve(ticket);
|
|
119
|
-
const draft = await responder.draft(ticket, resolution, classification);
|
|
120
|
-
logger.info("Support bot run completed", {
|
|
121
|
-
ticketId: ticket.id,
|
|
122
|
-
classification,
|
|
123
|
-
resolution,
|
|
124
|
-
emailDraft: { subject: draft.subject, body: draft.body }
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
export {
|
|
128
|
-
runAiSupportBotExample,
|
|
129
|
-
example_default as example,
|
|
130
|
-
AiSupportBotFeature
|
|
131
|
-
};
|
|
14
|
+
- Use policy gates before exposing drafted replies to end-users.`}];I(J);import{defineExample as K}from"@contractspec/lib.contracts-spec";var M=K({meta:{key:"ai-support-bot",version:"1.0.0",title:"AI Support Bot",description:"Classify and resolve a support ticket (with a drafted response) using the support-bot and knowledge libraries.",kind:"script",visibility:"public",stability:"experimental",owners:["@platform.core"],tags:["support","ai","tickets","knowledge"]},docs:{rootDocId:"docs.examples.ai-support-bot",usageDocId:"docs.examples.ai-support-bot.usage"},entrypoints:{packageName:"@contractspec/example.ai-support-bot",docs:"./docs"},surfaces:{templates:!0,sandbox:{enabled:!0,modes:["markdown"]},studio:{enabled:!0,installable:!0},mcp:{enabled:!0}}}),N=M;import{Logger as O,LogLevel as P}from"@contractspec/lib.logger";import{AutoResponder as Q}from"@contractspec/lib.support-bot/bot";import{TicketResolver as S}from"@contractspec/lib.support-bot/rag";import{TicketClassifier as U}from"@contractspec/lib.support-bot/tickets";var V=new O({level:P.INFO,environment:"production",enableColors:!1});async function q(){let w=new S({knowledge:{async query(G){return{answer:`The payout will retrigger automatically. (${G.slice(0,40)}…)`,references:[]}}}}),y=new U,z=new Q,m={id:"TIC-42",subject:"Payout failed",body:"Hello, our supplier payout failed twice yesterday. Can you confirm status? It is urgent.",channel:"email",customerName:"Ivy",metadata:{accountId:"acct_789"}},x=await y.classify(m),h=await w.resolve(m),j=await z.draft(m,h,x);V.info("Support bot run completed",{ticketId:m.id,classification:x,resolution:h,emailDraft:{subject:j.subject,body:j.body}})}export{q as runAiSupportBotExample,N as example,Y as AiSupportBotFeature};
|
package/dist/browser/setup.js
CHANGED
|
@@ -1,43 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { Logger, LogLevel } from "@contractspec/lib.logger";
|
|
3
|
-
import { AutoResponder } from "@contractspec/lib.support-bot/bot";
|
|
4
|
-
import { TicketResolver } from "@contractspec/lib.support-bot/rag";
|
|
5
|
-
import { TicketClassifier } from "@contractspec/lib.support-bot/tickets";
|
|
6
|
-
var logger = new Logger({
|
|
7
|
-
level: LogLevel.INFO,
|
|
8
|
-
environment: "production",
|
|
9
|
-
enableColors: false
|
|
10
|
-
});
|
|
11
|
-
async function runAiSupportBotExample() {
|
|
12
|
-
const knowledge = {
|
|
13
|
-
async query(question) {
|
|
14
|
-
return {
|
|
15
|
-
answer: `The payout will retrigger automatically. (${question.slice(0, 40)}…)`,
|
|
16
|
-
references: []
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
const resolver = new TicketResolver({ knowledge });
|
|
21
|
-
const classifier = new TicketClassifier;
|
|
22
|
-
const responder = new AutoResponder;
|
|
23
|
-
const ticket = {
|
|
24
|
-
id: "TIC-42",
|
|
25
|
-
subject: "Payout failed",
|
|
26
|
-
body: "Hello, our supplier payout failed twice yesterday. Can you confirm status? It is urgent.",
|
|
27
|
-
channel: "email",
|
|
28
|
-
customerName: "Ivy",
|
|
29
|
-
metadata: { accountId: "acct_789" }
|
|
30
|
-
};
|
|
31
|
-
const classification = await classifier.classify(ticket);
|
|
32
|
-
const resolution = await resolver.resolve(ticket);
|
|
33
|
-
const draft = await responder.draft(ticket, resolution, classification);
|
|
34
|
-
logger.info("Support bot run completed", {
|
|
35
|
-
ticketId: ticket.id,
|
|
36
|
-
classification,
|
|
37
|
-
resolution,
|
|
38
|
-
emailDraft: { subject: draft.subject, body: draft.body }
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
export {
|
|
42
|
-
runAiSupportBotExample
|
|
43
|
-
};
|
|
1
|
+
import{Logger as D,LogLevel as E}from"@contractspec/lib.logger";import{AutoResponder as F}from"@contractspec/lib.support-bot/bot";import{TicketResolver as G}from"@contractspec/lib.support-bot/rag";import{TicketClassifier as H}from"@contractspec/lib.support-bot/tickets";var I=new D({level:E.INFO,environment:"production",enableColors:!1});async function P(){let x=new G({knowledge:{async query(B){return{answer:`The payout will retrigger automatically. (${B.slice(0,40)}…)`,references:[]}}}}),y=new H,z=new F,h={id:"TIC-42",subject:"Payout failed",body:"Hello, our supplier payout failed twice yesterday. Can you confirm status? It is urgent.",channel:"email",customerName:"Ivy",metadata:{accountId:"acct_789"}},j=await y.classify(h),m=await x.resolve(h),w=await z.draft(h,m,j);I.info("Support bot run completed",{ticketId:h.id,classification:j,resolution:m,emailDraft:{subject:w.subject,body:w.body}})}export{P as runAiSupportBotExample};
|
|
@@ -1,39 +1,15 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
3
|
-
import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
|
|
4
|
-
var blocks = [
|
|
5
|
-
{
|
|
6
|
-
id: "docs.examples.ai-support-bot",
|
|
7
|
-
title: "AI Support Bot (example)",
|
|
8
|
-
summary: "Ticket classification + knowledge-grounded resolution + response drafting.",
|
|
9
|
-
kind: "reference",
|
|
10
|
-
visibility: "public",
|
|
11
|
-
route: "/docs/examples/ai-support-bot",
|
|
12
|
-
tags: ["support", "ai", "example"],
|
|
13
|
-
body: `## What this example shows
|
|
2
|
+
import{registerDocBlocks as f}from"@contractspec/lib.contracts-spec/docs";var h=[{id:"docs.examples.ai-support-bot",title:"AI Support Bot (example)",summary:"Ticket classification + knowledge-grounded resolution + response drafting.",kind:"reference",visibility:"public",route:"/docs/examples/ai-support-bot",tags:["support","ai","example"],body:`## What this example shows
|
|
14
3
|
- Classify a ticket into a support category.
|
|
15
4
|
- Use a knowledge port to generate a grounded resolution.
|
|
16
5
|
- Draft a response (email body) from the resolution.
|
|
17
6
|
|
|
18
7
|
## Guardrails
|
|
19
8
|
- Avoid logging raw ticket bodies/PII; prefer structured summaries.
|
|
20
|
-
- Keep knowledge and ticket adapters explicit and testable.`
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
id: "docs.examples.ai-support-bot.usage",
|
|
24
|
-
title: "AI Support Bot \u2014 Usage",
|
|
25
|
-
summary: "How to run the example and swap the knowledge adapter.",
|
|
26
|
-
kind: "usage",
|
|
27
|
-
visibility: "public",
|
|
28
|
-
route: "/docs/examples/ai-support-bot/usage",
|
|
29
|
-
tags: ["support", "usage"],
|
|
30
|
-
body: `## Usage
|
|
9
|
+
- Keep knowledge and ticket adapters explicit and testable.`},{id:"docs.examples.ai-support-bot.usage",title:"AI Support Bot \u2014 Usage",summary:"How to run the example and swap the knowledge adapter.",kind:"usage",visibility:"public",route:"/docs/examples/ai-support-bot/usage",tags:["support","usage"],body:`## Usage
|
|
31
10
|
- Call \`runAiSupportBotExample()\`.
|
|
32
11
|
- Replace the \`knowledge.query\` implementation with a real knowledge service.
|
|
33
12
|
|
|
34
13
|
## Notes
|
|
35
14
|
- Keep outputs structured.
|
|
36
|
-
- Use policy gates before exposing drafted replies to end-users.`
|
|
37
|
-
}
|
|
38
|
-
];
|
|
39
|
-
registerDocBlocks(blocks);
|
|
15
|
+
- Use policy gates before exposing drafted replies to end-users.`}];f(h);
|
package/dist/docs/index.js
CHANGED
|
@@ -1,39 +1,15 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
3
|
-
import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
|
|
4
|
-
var blocks = [
|
|
5
|
-
{
|
|
6
|
-
id: "docs.examples.ai-support-bot",
|
|
7
|
-
title: "AI Support Bot (example)",
|
|
8
|
-
summary: "Ticket classification + knowledge-grounded resolution + response drafting.",
|
|
9
|
-
kind: "reference",
|
|
10
|
-
visibility: "public",
|
|
11
|
-
route: "/docs/examples/ai-support-bot",
|
|
12
|
-
tags: ["support", "ai", "example"],
|
|
13
|
-
body: `## What this example shows
|
|
2
|
+
import{registerDocBlocks as m}from"@contractspec/lib.contracts-spec/docs";var f=[{id:"docs.examples.ai-support-bot",title:"AI Support Bot (example)",summary:"Ticket classification + knowledge-grounded resolution + response drafting.",kind:"reference",visibility:"public",route:"/docs/examples/ai-support-bot",tags:["support","ai","example"],body:`## What this example shows
|
|
14
3
|
- Classify a ticket into a support category.
|
|
15
4
|
- Use a knowledge port to generate a grounded resolution.
|
|
16
5
|
- Draft a response (email body) from the resolution.
|
|
17
6
|
|
|
18
7
|
## Guardrails
|
|
19
8
|
- Avoid logging raw ticket bodies/PII; prefer structured summaries.
|
|
20
|
-
- Keep knowledge and ticket adapters explicit and testable.`
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
id: "docs.examples.ai-support-bot.usage",
|
|
24
|
-
title: "AI Support Bot \u2014 Usage",
|
|
25
|
-
summary: "How to run the example and swap the knowledge adapter.",
|
|
26
|
-
kind: "usage",
|
|
27
|
-
visibility: "public",
|
|
28
|
-
route: "/docs/examples/ai-support-bot/usage",
|
|
29
|
-
tags: ["support", "usage"],
|
|
30
|
-
body: `## Usage
|
|
9
|
+
- Keep knowledge and ticket adapters explicit and testable.`},{id:"docs.examples.ai-support-bot.usage",title:"AI Support Bot \u2014 Usage",summary:"How to run the example and swap the knowledge adapter.",kind:"usage",visibility:"public",route:"/docs/examples/ai-support-bot/usage",tags:["support","usage"],body:`## Usage
|
|
31
10
|
- Call \`runAiSupportBotExample()\`.
|
|
32
11
|
- Replace the \`knowledge.query\` implementation with a real knowledge service.
|
|
33
12
|
|
|
34
13
|
## Notes
|
|
35
14
|
- Keep outputs structured.
|
|
36
|
-
- Use policy gates before exposing drafted replies to end-users.`
|
|
37
|
-
}
|
|
38
|
-
];
|
|
39
|
-
registerDocBlocks(blocks);
|
|
15
|
+
- Use policy gates before exposing drafted replies to end-users.`}];m(f);
|
package/dist/example.js
CHANGED
|
@@ -1,34 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
3
|
-
import { defineExample } from "@contractspec/lib.contracts-spec";
|
|
4
|
-
var example = defineExample({
|
|
5
|
-
meta: {
|
|
6
|
-
key: "ai-support-bot",
|
|
7
|
-
version: "1.0.0",
|
|
8
|
-
title: "AI Support Bot",
|
|
9
|
-
description: "Classify and resolve a support ticket (with a drafted response) using the support-bot and knowledge libraries.",
|
|
10
|
-
kind: "script",
|
|
11
|
-
visibility: "public",
|
|
12
|
-
stability: "experimental",
|
|
13
|
-
owners: ["@platform.core"],
|
|
14
|
-
tags: ["support", "ai", "tickets", "knowledge"]
|
|
15
|
-
},
|
|
16
|
-
docs: {
|
|
17
|
-
rootDocId: "docs.examples.ai-support-bot",
|
|
18
|
-
usageDocId: "docs.examples.ai-support-bot.usage"
|
|
19
|
-
},
|
|
20
|
-
entrypoints: {
|
|
21
|
-
packageName: "@contractspec/example.ai-support-bot",
|
|
22
|
-
docs: "./docs"
|
|
23
|
-
},
|
|
24
|
-
surfaces: {
|
|
25
|
-
templates: true,
|
|
26
|
-
sandbox: { enabled: true, modes: ["markdown"] },
|
|
27
|
-
studio: { enabled: true, installable: true },
|
|
28
|
-
mcp: { enabled: true }
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
var example_default = example;
|
|
32
|
-
export {
|
|
33
|
-
example_default as default
|
|
34
|
-
};
|
|
2
|
+
import{defineExample as g}from"@contractspec/lib.contracts-spec";var h=g({meta:{key:"ai-support-bot",version:"1.0.0",title:"AI Support Bot",description:"Classify and resolve a support ticket (with a drafted response) using the support-bot and knowledge libraries.",kind:"script",visibility:"public",stability:"experimental",owners:["@platform.core"],tags:["support","ai","tickets","knowledge"]},docs:{rootDocId:"docs.examples.ai-support-bot",usageDocId:"docs.examples.ai-support-bot.usage"},entrypoints:{packageName:"@contractspec/example.ai-support-bot",docs:"./docs"},surfaces:{templates:!0,sandbox:{enabled:!0,modes:["markdown"]},studio:{enabled:!0,installable:!0},mcp:{enabled:!0}}}),q=h;export{q as default};
|
package/dist/index.js
CHANGED
|
@@ -1,132 +1,15 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
3
|
-
import { defineFeature } from "@contractspec/lib.contracts-spec";
|
|
4
|
-
var AiSupportBotFeature = defineFeature({
|
|
5
|
-
meta: {
|
|
6
|
-
key: "ai-support-bot",
|
|
7
|
-
version: "1.0.0",
|
|
8
|
-
title: "AI Support Bot",
|
|
9
|
-
description: "AI support ticket classification and resolution using grounded knowledge",
|
|
10
|
-
domain: "support",
|
|
11
|
-
owners: ["@examples"],
|
|
12
|
-
tags: ["ai", "support", "knowledge", "tickets"],
|
|
13
|
-
stability: "experimental"
|
|
14
|
-
},
|
|
15
|
-
knowledge: [{ key: "ai-support-bot.knowledge.articles", version: "1.0.0" }],
|
|
16
|
-
docs: ["docs.examples.ai-support-bot", "docs.examples.ai-support-bot.usage"]
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
// src/docs/ai-support-bot.docblock.ts
|
|
20
|
-
import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
|
|
21
|
-
var blocks = [
|
|
22
|
-
{
|
|
23
|
-
id: "docs.examples.ai-support-bot",
|
|
24
|
-
title: "AI Support Bot (example)",
|
|
25
|
-
summary: "Ticket classification + knowledge-grounded resolution + response drafting.",
|
|
26
|
-
kind: "reference",
|
|
27
|
-
visibility: "public",
|
|
28
|
-
route: "/docs/examples/ai-support-bot",
|
|
29
|
-
tags: ["support", "ai", "example"],
|
|
30
|
-
body: `## What this example shows
|
|
2
|
+
import{defineFeature as H}from"@contractspec/lib.contracts-spec";var Y=H({meta:{key:"ai-support-bot",version:"1.0.0",title:"AI Support Bot",description:"AI support ticket classification and resolution using grounded knowledge",domain:"support",owners:["@examples"],tags:["ai","support","knowledge","tickets"],stability:"experimental"},knowledge:[{key:"ai-support-bot.knowledge.articles",version:"1.0.0"}],docs:["docs.examples.ai-support-bot","docs.examples.ai-support-bot.usage"]});import{registerDocBlocks as I}from"@contractspec/lib.contracts-spec/docs";var J=[{id:"docs.examples.ai-support-bot",title:"AI Support Bot (example)",summary:"Ticket classification + knowledge-grounded resolution + response drafting.",kind:"reference",visibility:"public",route:"/docs/examples/ai-support-bot",tags:["support","ai","example"],body:`## What this example shows
|
|
31
3
|
- Classify a ticket into a support category.
|
|
32
4
|
- Use a knowledge port to generate a grounded resolution.
|
|
33
5
|
- Draft a response (email body) from the resolution.
|
|
34
6
|
|
|
35
7
|
## Guardrails
|
|
36
8
|
- Avoid logging raw ticket bodies/PII; prefer structured summaries.
|
|
37
|
-
- Keep knowledge and ticket adapters explicit and testable.`
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
id: "docs.examples.ai-support-bot.usage",
|
|
41
|
-
title: "AI Support Bot \u2014 Usage",
|
|
42
|
-
summary: "How to run the example and swap the knowledge adapter.",
|
|
43
|
-
kind: "usage",
|
|
44
|
-
visibility: "public",
|
|
45
|
-
route: "/docs/examples/ai-support-bot/usage",
|
|
46
|
-
tags: ["support", "usage"],
|
|
47
|
-
body: `## Usage
|
|
9
|
+
- Keep knowledge and ticket adapters explicit and testable.`},{id:"docs.examples.ai-support-bot.usage",title:"AI Support Bot \u2014 Usage",summary:"How to run the example and swap the knowledge adapter.",kind:"usage",visibility:"public",route:"/docs/examples/ai-support-bot/usage",tags:["support","usage"],body:`## Usage
|
|
48
10
|
- Call \`runAiSupportBotExample()\`.
|
|
49
11
|
- Replace the \`knowledge.query\` implementation with a real knowledge service.
|
|
50
12
|
|
|
51
13
|
## Notes
|
|
52
14
|
- Keep outputs structured.
|
|
53
|
-
- Use policy gates before exposing drafted replies to end-users.`
|
|
54
|
-
}
|
|
55
|
-
];
|
|
56
|
-
registerDocBlocks(blocks);
|
|
57
|
-
// src/example.ts
|
|
58
|
-
import { defineExample } from "@contractspec/lib.contracts-spec";
|
|
59
|
-
var example = defineExample({
|
|
60
|
-
meta: {
|
|
61
|
-
key: "ai-support-bot",
|
|
62
|
-
version: "1.0.0",
|
|
63
|
-
title: "AI Support Bot",
|
|
64
|
-
description: "Classify and resolve a support ticket (with a drafted response) using the support-bot and knowledge libraries.",
|
|
65
|
-
kind: "script",
|
|
66
|
-
visibility: "public",
|
|
67
|
-
stability: "experimental",
|
|
68
|
-
owners: ["@platform.core"],
|
|
69
|
-
tags: ["support", "ai", "tickets", "knowledge"]
|
|
70
|
-
},
|
|
71
|
-
docs: {
|
|
72
|
-
rootDocId: "docs.examples.ai-support-bot",
|
|
73
|
-
usageDocId: "docs.examples.ai-support-bot.usage"
|
|
74
|
-
},
|
|
75
|
-
entrypoints: {
|
|
76
|
-
packageName: "@contractspec/example.ai-support-bot",
|
|
77
|
-
docs: "./docs"
|
|
78
|
-
},
|
|
79
|
-
surfaces: {
|
|
80
|
-
templates: true,
|
|
81
|
-
sandbox: { enabled: true, modes: ["markdown"] },
|
|
82
|
-
studio: { enabled: true, installable: true },
|
|
83
|
-
mcp: { enabled: true }
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
var example_default = example;
|
|
87
|
-
|
|
88
|
-
// src/setup.ts
|
|
89
|
-
import { Logger, LogLevel } from "@contractspec/lib.logger";
|
|
90
|
-
import { AutoResponder } from "@contractspec/lib.support-bot/bot";
|
|
91
|
-
import { TicketResolver } from "@contractspec/lib.support-bot/rag";
|
|
92
|
-
import { TicketClassifier } from "@contractspec/lib.support-bot/tickets";
|
|
93
|
-
var logger = new Logger({
|
|
94
|
-
level: LogLevel.INFO,
|
|
95
|
-
environment: "production",
|
|
96
|
-
enableColors: false
|
|
97
|
-
});
|
|
98
|
-
async function runAiSupportBotExample() {
|
|
99
|
-
const knowledge = {
|
|
100
|
-
async query(question) {
|
|
101
|
-
return {
|
|
102
|
-
answer: `The payout will retrigger automatically. (${question.slice(0, 40)}\u2026)`,
|
|
103
|
-
references: []
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
const resolver = new TicketResolver({ knowledge });
|
|
108
|
-
const classifier = new TicketClassifier;
|
|
109
|
-
const responder = new AutoResponder;
|
|
110
|
-
const ticket = {
|
|
111
|
-
id: "TIC-42",
|
|
112
|
-
subject: "Payout failed",
|
|
113
|
-
body: "Hello, our supplier payout failed twice yesterday. Can you confirm status? It is urgent.",
|
|
114
|
-
channel: "email",
|
|
115
|
-
customerName: "Ivy",
|
|
116
|
-
metadata: { accountId: "acct_789" }
|
|
117
|
-
};
|
|
118
|
-
const classification = await classifier.classify(ticket);
|
|
119
|
-
const resolution = await resolver.resolve(ticket);
|
|
120
|
-
const draft = await responder.draft(ticket, resolution, classification);
|
|
121
|
-
logger.info("Support bot run completed", {
|
|
122
|
-
ticketId: ticket.id,
|
|
123
|
-
classification,
|
|
124
|
-
resolution,
|
|
125
|
-
emailDraft: { subject: draft.subject, body: draft.body }
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
export {
|
|
129
|
-
runAiSupportBotExample,
|
|
130
|
-
example_default as example,
|
|
131
|
-
AiSupportBotFeature
|
|
132
|
-
};
|
|
15
|
+
- Use policy gates before exposing drafted replies to end-users.`}];I(J);import{defineExample as K}from"@contractspec/lib.contracts-spec";var M=K({meta:{key:"ai-support-bot",version:"1.0.0",title:"AI Support Bot",description:"Classify and resolve a support ticket (with a drafted response) using the support-bot and knowledge libraries.",kind:"script",visibility:"public",stability:"experimental",owners:["@platform.core"],tags:["support","ai","tickets","knowledge"]},docs:{rootDocId:"docs.examples.ai-support-bot",usageDocId:"docs.examples.ai-support-bot.usage"},entrypoints:{packageName:"@contractspec/example.ai-support-bot",docs:"./docs"},surfaces:{templates:!0,sandbox:{enabled:!0,modes:["markdown"]},studio:{enabled:!0,installable:!0},mcp:{enabled:!0}}}),N=M;import{Logger as O,LogLevel as P}from"@contractspec/lib.logger";import{AutoResponder as Q}from"@contractspec/lib.support-bot/bot";import{TicketResolver as S}from"@contractspec/lib.support-bot/rag";import{TicketClassifier as U}from"@contractspec/lib.support-bot/tickets";var V=new O({level:P.INFO,environment:"production",enableColors:!1});async function q(){let w=new S({knowledge:{async query(G){return{answer:`The payout will retrigger automatically. (${G.slice(0,40)}\u2026)`,references:[]}}}}),y=new U,z=new Q,m={id:"TIC-42",subject:"Payout failed",body:"Hello, our supplier payout failed twice yesterday. Can you confirm status? It is urgent.",channel:"email",customerName:"Ivy",metadata:{accountId:"acct_789"}},x=await y.classify(m),h=await w.resolve(m),j=await z.draft(m,h,x);V.info("Support bot run completed",{ticketId:m.id,classification:x,resolution:h,emailDraft:{subject:j.subject,body:j.body}})}export{q as runAiSupportBotExample,N as example,Y as AiSupportBotFeature};
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { defineFeature } from "@contractspec/lib.contracts-spec";
|
|
3
|
-
var AiSupportBotFeature = defineFeature({
|
|
4
|
-
meta: {
|
|
5
|
-
key: "ai-support-bot",
|
|
6
|
-
version: "1.0.0",
|
|
7
|
-
title: "AI Support Bot",
|
|
8
|
-
description: "AI support ticket classification and resolution using grounded knowledge",
|
|
9
|
-
domain: "support",
|
|
10
|
-
owners: ["@examples"],
|
|
11
|
-
tags: ["ai", "support", "knowledge", "tickets"],
|
|
12
|
-
stability: "experimental"
|
|
13
|
-
},
|
|
14
|
-
knowledge: [{ key: "ai-support-bot.knowledge.articles", version: "1.0.0" }],
|
|
15
|
-
docs: ["docs.examples.ai-support-bot", "docs.examples.ai-support-bot.usage"]
|
|
16
|
-
});
|
|
17
|
-
export {
|
|
18
|
-
AiSupportBotFeature
|
|
19
|
-
};
|
|
1
|
+
import{defineFeature as g}from"@contractspec/lib.contracts-spec";var j=g({meta:{key:"ai-support-bot",version:"1.0.0",title:"AI Support Bot",description:"AI support ticket classification and resolution using grounded knowledge",domain:"support",owners:["@examples"],tags:["ai","support","knowledge","tickets"],stability:"experimental"},knowledge:[{key:"ai-support-bot.knowledge.articles",version:"1.0.0"}],docs:["docs.examples.ai-support-bot","docs.examples.ai-support-bot.usage"]});export{j as AiSupportBotFeature};
|
|
@@ -1,38 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
|
|
3
|
-
var blocks = [
|
|
4
|
-
{
|
|
5
|
-
id: "docs.examples.ai-support-bot",
|
|
6
|
-
title: "AI Support Bot (example)",
|
|
7
|
-
summary: "Ticket classification + knowledge-grounded resolution + response drafting.",
|
|
8
|
-
kind: "reference",
|
|
9
|
-
visibility: "public",
|
|
10
|
-
route: "/docs/examples/ai-support-bot",
|
|
11
|
-
tags: ["support", "ai", "example"],
|
|
12
|
-
body: `## What this example shows
|
|
1
|
+
import{registerDocBlocks as f}from"@contractspec/lib.contracts-spec/docs";var h=[{id:"docs.examples.ai-support-bot",title:"AI Support Bot (example)",summary:"Ticket classification + knowledge-grounded resolution + response drafting.",kind:"reference",visibility:"public",route:"/docs/examples/ai-support-bot",tags:["support","ai","example"],body:`## What this example shows
|
|
13
2
|
- Classify a ticket into a support category.
|
|
14
3
|
- Use a knowledge port to generate a grounded resolution.
|
|
15
4
|
- Draft a response (email body) from the resolution.
|
|
16
5
|
|
|
17
6
|
## Guardrails
|
|
18
7
|
- Avoid logging raw ticket bodies/PII; prefer structured summaries.
|
|
19
|
-
- Keep knowledge and ticket adapters explicit and testable.`
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
id: "docs.examples.ai-support-bot.usage",
|
|
23
|
-
title: "AI Support Bot — Usage",
|
|
24
|
-
summary: "How to run the example and swap the knowledge adapter.",
|
|
25
|
-
kind: "usage",
|
|
26
|
-
visibility: "public",
|
|
27
|
-
route: "/docs/examples/ai-support-bot/usage",
|
|
28
|
-
tags: ["support", "usage"],
|
|
29
|
-
body: `## Usage
|
|
8
|
+
- Keep knowledge and ticket adapters explicit and testable.`},{id:"docs.examples.ai-support-bot.usage",title:"AI Support Bot — Usage",summary:"How to run the example and swap the knowledge adapter.",kind:"usage",visibility:"public",route:"/docs/examples/ai-support-bot/usage",tags:["support","usage"],body:`## Usage
|
|
30
9
|
- Call \`runAiSupportBotExample()\`.
|
|
31
10
|
- Replace the \`knowledge.query\` implementation with a real knowledge service.
|
|
32
11
|
|
|
33
12
|
## Notes
|
|
34
13
|
- Keep outputs structured.
|
|
35
|
-
- Use policy gates before exposing drafted replies to end-users.`
|
|
36
|
-
}
|
|
37
|
-
];
|
|
38
|
-
registerDocBlocks(blocks);
|
|
14
|
+
- Use policy gates before exposing drafted replies to end-users.`}];f(h);
|
package/dist/node/docs/index.js
CHANGED
|
@@ -1,38 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
|
|
3
|
-
var blocks = [
|
|
4
|
-
{
|
|
5
|
-
id: "docs.examples.ai-support-bot",
|
|
6
|
-
title: "AI Support Bot (example)",
|
|
7
|
-
summary: "Ticket classification + knowledge-grounded resolution + response drafting.",
|
|
8
|
-
kind: "reference",
|
|
9
|
-
visibility: "public",
|
|
10
|
-
route: "/docs/examples/ai-support-bot",
|
|
11
|
-
tags: ["support", "ai", "example"],
|
|
12
|
-
body: `## What this example shows
|
|
1
|
+
import{registerDocBlocks as m}from"@contractspec/lib.contracts-spec/docs";var f=[{id:"docs.examples.ai-support-bot",title:"AI Support Bot (example)",summary:"Ticket classification + knowledge-grounded resolution + response drafting.",kind:"reference",visibility:"public",route:"/docs/examples/ai-support-bot",tags:["support","ai","example"],body:`## What this example shows
|
|
13
2
|
- Classify a ticket into a support category.
|
|
14
3
|
- Use a knowledge port to generate a grounded resolution.
|
|
15
4
|
- Draft a response (email body) from the resolution.
|
|
16
5
|
|
|
17
6
|
## Guardrails
|
|
18
7
|
- Avoid logging raw ticket bodies/PII; prefer structured summaries.
|
|
19
|
-
- Keep knowledge and ticket adapters explicit and testable.`
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
id: "docs.examples.ai-support-bot.usage",
|
|
23
|
-
title: "AI Support Bot — Usage",
|
|
24
|
-
summary: "How to run the example and swap the knowledge adapter.",
|
|
25
|
-
kind: "usage",
|
|
26
|
-
visibility: "public",
|
|
27
|
-
route: "/docs/examples/ai-support-bot/usage",
|
|
28
|
-
tags: ["support", "usage"],
|
|
29
|
-
body: `## Usage
|
|
8
|
+
- Keep knowledge and ticket adapters explicit and testable.`},{id:"docs.examples.ai-support-bot.usage",title:"AI Support Bot — Usage",summary:"How to run the example and swap the knowledge adapter.",kind:"usage",visibility:"public",route:"/docs/examples/ai-support-bot/usage",tags:["support","usage"],body:`## Usage
|
|
30
9
|
- Call \`runAiSupportBotExample()\`.
|
|
31
10
|
- Replace the \`knowledge.query\` implementation with a real knowledge service.
|
|
32
11
|
|
|
33
12
|
## Notes
|
|
34
13
|
- Keep outputs structured.
|
|
35
|
-
- Use policy gates before exposing drafted replies to end-users.`
|
|
36
|
-
}
|
|
37
|
-
];
|
|
38
|
-
registerDocBlocks(blocks);
|
|
14
|
+
- Use policy gates before exposing drafted replies to end-users.`}];m(f);
|
package/dist/node/example.js
CHANGED
|
@@ -1,33 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { defineExample } from "@contractspec/lib.contracts-spec";
|
|
3
|
-
var example = defineExample({
|
|
4
|
-
meta: {
|
|
5
|
-
key: "ai-support-bot",
|
|
6
|
-
version: "1.0.0",
|
|
7
|
-
title: "AI Support Bot",
|
|
8
|
-
description: "Classify and resolve a support ticket (with a drafted response) using the support-bot and knowledge libraries.",
|
|
9
|
-
kind: "script",
|
|
10
|
-
visibility: "public",
|
|
11
|
-
stability: "experimental",
|
|
12
|
-
owners: ["@platform.core"],
|
|
13
|
-
tags: ["support", "ai", "tickets", "knowledge"]
|
|
14
|
-
},
|
|
15
|
-
docs: {
|
|
16
|
-
rootDocId: "docs.examples.ai-support-bot",
|
|
17
|
-
usageDocId: "docs.examples.ai-support-bot.usage"
|
|
18
|
-
},
|
|
19
|
-
entrypoints: {
|
|
20
|
-
packageName: "@contractspec/example.ai-support-bot",
|
|
21
|
-
docs: "./docs"
|
|
22
|
-
},
|
|
23
|
-
surfaces: {
|
|
24
|
-
templates: true,
|
|
25
|
-
sandbox: { enabled: true, modes: ["markdown"] },
|
|
26
|
-
studio: { enabled: true, installable: true },
|
|
27
|
-
mcp: { enabled: true }
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
var example_default = example;
|
|
31
|
-
export {
|
|
32
|
-
example_default as default
|
|
33
|
-
};
|
|
1
|
+
import{defineExample as g}from"@contractspec/lib.contracts-spec";var h=g({meta:{key:"ai-support-bot",version:"1.0.0",title:"AI Support Bot",description:"Classify and resolve a support ticket (with a drafted response) using the support-bot and knowledge libraries.",kind:"script",visibility:"public",stability:"experimental",owners:["@platform.core"],tags:["support","ai","tickets","knowledge"]},docs:{rootDocId:"docs.examples.ai-support-bot",usageDocId:"docs.examples.ai-support-bot.usage"},entrypoints:{packageName:"@contractspec/example.ai-support-bot",docs:"./docs"},surfaces:{templates:!0,sandbox:{enabled:!0,modes:["markdown"]},studio:{enabled:!0,installable:!0},mcp:{enabled:!0}}}),q=h;export{q as default};
|
package/dist/node/index.js
CHANGED
|
@@ -1,131 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import { defineFeature } from "@contractspec/lib.contracts-spec";
|
|
3
|
-
var AiSupportBotFeature = defineFeature({
|
|
4
|
-
meta: {
|
|
5
|
-
key: "ai-support-bot",
|
|
6
|
-
version: "1.0.0",
|
|
7
|
-
title: "AI Support Bot",
|
|
8
|
-
description: "AI support ticket classification and resolution using grounded knowledge",
|
|
9
|
-
domain: "support",
|
|
10
|
-
owners: ["@examples"],
|
|
11
|
-
tags: ["ai", "support", "knowledge", "tickets"],
|
|
12
|
-
stability: "experimental"
|
|
13
|
-
},
|
|
14
|
-
knowledge: [{ key: "ai-support-bot.knowledge.articles", version: "1.0.0" }],
|
|
15
|
-
docs: ["docs.examples.ai-support-bot", "docs.examples.ai-support-bot.usage"]
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
// src/docs/ai-support-bot.docblock.ts
|
|
19
|
-
import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
|
|
20
|
-
var blocks = [
|
|
21
|
-
{
|
|
22
|
-
id: "docs.examples.ai-support-bot",
|
|
23
|
-
title: "AI Support Bot (example)",
|
|
24
|
-
summary: "Ticket classification + knowledge-grounded resolution + response drafting.",
|
|
25
|
-
kind: "reference",
|
|
26
|
-
visibility: "public",
|
|
27
|
-
route: "/docs/examples/ai-support-bot",
|
|
28
|
-
tags: ["support", "ai", "example"],
|
|
29
|
-
body: `## What this example shows
|
|
1
|
+
import{defineFeature as H}from"@contractspec/lib.contracts-spec";var Y=H({meta:{key:"ai-support-bot",version:"1.0.0",title:"AI Support Bot",description:"AI support ticket classification and resolution using grounded knowledge",domain:"support",owners:["@examples"],tags:["ai","support","knowledge","tickets"],stability:"experimental"},knowledge:[{key:"ai-support-bot.knowledge.articles",version:"1.0.0"}],docs:["docs.examples.ai-support-bot","docs.examples.ai-support-bot.usage"]});import{registerDocBlocks as I}from"@contractspec/lib.contracts-spec/docs";var J=[{id:"docs.examples.ai-support-bot",title:"AI Support Bot (example)",summary:"Ticket classification + knowledge-grounded resolution + response drafting.",kind:"reference",visibility:"public",route:"/docs/examples/ai-support-bot",tags:["support","ai","example"],body:`## What this example shows
|
|
30
2
|
- Classify a ticket into a support category.
|
|
31
3
|
- Use a knowledge port to generate a grounded resolution.
|
|
32
4
|
- Draft a response (email body) from the resolution.
|
|
33
5
|
|
|
34
6
|
## Guardrails
|
|
35
7
|
- Avoid logging raw ticket bodies/PII; prefer structured summaries.
|
|
36
|
-
- Keep knowledge and ticket adapters explicit and testable.`
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
id: "docs.examples.ai-support-bot.usage",
|
|
40
|
-
title: "AI Support Bot — Usage",
|
|
41
|
-
summary: "How to run the example and swap the knowledge adapter.",
|
|
42
|
-
kind: "usage",
|
|
43
|
-
visibility: "public",
|
|
44
|
-
route: "/docs/examples/ai-support-bot/usage",
|
|
45
|
-
tags: ["support", "usage"],
|
|
46
|
-
body: `## Usage
|
|
8
|
+
- Keep knowledge and ticket adapters explicit and testable.`},{id:"docs.examples.ai-support-bot.usage",title:"AI Support Bot — Usage",summary:"How to run the example and swap the knowledge adapter.",kind:"usage",visibility:"public",route:"/docs/examples/ai-support-bot/usage",tags:["support","usage"],body:`## Usage
|
|
47
9
|
- Call \`runAiSupportBotExample()\`.
|
|
48
10
|
- Replace the \`knowledge.query\` implementation with a real knowledge service.
|
|
49
11
|
|
|
50
12
|
## Notes
|
|
51
13
|
- Keep outputs structured.
|
|
52
|
-
- Use policy gates before exposing drafted replies to end-users.`
|
|
53
|
-
}
|
|
54
|
-
];
|
|
55
|
-
registerDocBlocks(blocks);
|
|
56
|
-
// src/example.ts
|
|
57
|
-
import { defineExample } from "@contractspec/lib.contracts-spec";
|
|
58
|
-
var example = defineExample({
|
|
59
|
-
meta: {
|
|
60
|
-
key: "ai-support-bot",
|
|
61
|
-
version: "1.0.0",
|
|
62
|
-
title: "AI Support Bot",
|
|
63
|
-
description: "Classify and resolve a support ticket (with a drafted response) using the support-bot and knowledge libraries.",
|
|
64
|
-
kind: "script",
|
|
65
|
-
visibility: "public",
|
|
66
|
-
stability: "experimental",
|
|
67
|
-
owners: ["@platform.core"],
|
|
68
|
-
tags: ["support", "ai", "tickets", "knowledge"]
|
|
69
|
-
},
|
|
70
|
-
docs: {
|
|
71
|
-
rootDocId: "docs.examples.ai-support-bot",
|
|
72
|
-
usageDocId: "docs.examples.ai-support-bot.usage"
|
|
73
|
-
},
|
|
74
|
-
entrypoints: {
|
|
75
|
-
packageName: "@contractspec/example.ai-support-bot",
|
|
76
|
-
docs: "./docs"
|
|
77
|
-
},
|
|
78
|
-
surfaces: {
|
|
79
|
-
templates: true,
|
|
80
|
-
sandbox: { enabled: true, modes: ["markdown"] },
|
|
81
|
-
studio: { enabled: true, installable: true },
|
|
82
|
-
mcp: { enabled: true }
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
var example_default = example;
|
|
86
|
-
|
|
87
|
-
// src/setup.ts
|
|
88
|
-
import { Logger, LogLevel } from "@contractspec/lib.logger";
|
|
89
|
-
import { AutoResponder } from "@contractspec/lib.support-bot/bot";
|
|
90
|
-
import { TicketResolver } from "@contractspec/lib.support-bot/rag";
|
|
91
|
-
import { TicketClassifier } from "@contractspec/lib.support-bot/tickets";
|
|
92
|
-
var logger = new Logger({
|
|
93
|
-
level: LogLevel.INFO,
|
|
94
|
-
environment: "production",
|
|
95
|
-
enableColors: false
|
|
96
|
-
});
|
|
97
|
-
async function runAiSupportBotExample() {
|
|
98
|
-
const knowledge = {
|
|
99
|
-
async query(question) {
|
|
100
|
-
return {
|
|
101
|
-
answer: `The payout will retrigger automatically. (${question.slice(0, 40)}…)`,
|
|
102
|
-
references: []
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
const resolver = new TicketResolver({ knowledge });
|
|
107
|
-
const classifier = new TicketClassifier;
|
|
108
|
-
const responder = new AutoResponder;
|
|
109
|
-
const ticket = {
|
|
110
|
-
id: "TIC-42",
|
|
111
|
-
subject: "Payout failed",
|
|
112
|
-
body: "Hello, our supplier payout failed twice yesterday. Can you confirm status? It is urgent.",
|
|
113
|
-
channel: "email",
|
|
114
|
-
customerName: "Ivy",
|
|
115
|
-
metadata: { accountId: "acct_789" }
|
|
116
|
-
};
|
|
117
|
-
const classification = await classifier.classify(ticket);
|
|
118
|
-
const resolution = await resolver.resolve(ticket);
|
|
119
|
-
const draft = await responder.draft(ticket, resolution, classification);
|
|
120
|
-
logger.info("Support bot run completed", {
|
|
121
|
-
ticketId: ticket.id,
|
|
122
|
-
classification,
|
|
123
|
-
resolution,
|
|
124
|
-
emailDraft: { subject: draft.subject, body: draft.body }
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
export {
|
|
128
|
-
runAiSupportBotExample,
|
|
129
|
-
example_default as example,
|
|
130
|
-
AiSupportBotFeature
|
|
131
|
-
};
|
|
14
|
+
- Use policy gates before exposing drafted replies to end-users.`}];I(J);import{defineExample as K}from"@contractspec/lib.contracts-spec";var M=K({meta:{key:"ai-support-bot",version:"1.0.0",title:"AI Support Bot",description:"Classify and resolve a support ticket (with a drafted response) using the support-bot and knowledge libraries.",kind:"script",visibility:"public",stability:"experimental",owners:["@platform.core"],tags:["support","ai","tickets","knowledge"]},docs:{rootDocId:"docs.examples.ai-support-bot",usageDocId:"docs.examples.ai-support-bot.usage"},entrypoints:{packageName:"@contractspec/example.ai-support-bot",docs:"./docs"},surfaces:{templates:!0,sandbox:{enabled:!0,modes:["markdown"]},studio:{enabled:!0,installable:!0},mcp:{enabled:!0}}}),N=M;import{Logger as O,LogLevel as P}from"@contractspec/lib.logger";import{AutoResponder as Q}from"@contractspec/lib.support-bot/bot";import{TicketResolver as S}from"@contractspec/lib.support-bot/rag";import{TicketClassifier as U}from"@contractspec/lib.support-bot/tickets";var V=new O({level:P.INFO,environment:"production",enableColors:!1});async function q(){let w=new S({knowledge:{async query(G){return{answer:`The payout will retrigger automatically. (${G.slice(0,40)}…)`,references:[]}}}}),y=new U,z=new Q,m={id:"TIC-42",subject:"Payout failed",body:"Hello, our supplier payout failed twice yesterday. Can you confirm status? It is urgent.",channel:"email",customerName:"Ivy",metadata:{accountId:"acct_789"}},x=await y.classify(m),h=await w.resolve(m),j=await z.draft(m,h,x);V.info("Support bot run completed",{ticketId:m.id,classification:x,resolution:h,emailDraft:{subject:j.subject,body:j.body}})}export{q as runAiSupportBotExample,N as example,Y as AiSupportBotFeature};
|
package/dist/node/setup.js
CHANGED
|
@@ -1,43 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { Logger, LogLevel } from "@contractspec/lib.logger";
|
|
3
|
-
import { AutoResponder } from "@contractspec/lib.support-bot/bot";
|
|
4
|
-
import { TicketResolver } from "@contractspec/lib.support-bot/rag";
|
|
5
|
-
import { TicketClassifier } from "@contractspec/lib.support-bot/tickets";
|
|
6
|
-
var logger = new Logger({
|
|
7
|
-
level: LogLevel.INFO,
|
|
8
|
-
environment: "production",
|
|
9
|
-
enableColors: false
|
|
10
|
-
});
|
|
11
|
-
async function runAiSupportBotExample() {
|
|
12
|
-
const knowledge = {
|
|
13
|
-
async query(question) {
|
|
14
|
-
return {
|
|
15
|
-
answer: `The payout will retrigger automatically. (${question.slice(0, 40)}…)`,
|
|
16
|
-
references: []
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
const resolver = new TicketResolver({ knowledge });
|
|
21
|
-
const classifier = new TicketClassifier;
|
|
22
|
-
const responder = new AutoResponder;
|
|
23
|
-
const ticket = {
|
|
24
|
-
id: "TIC-42",
|
|
25
|
-
subject: "Payout failed",
|
|
26
|
-
body: "Hello, our supplier payout failed twice yesterday. Can you confirm status? It is urgent.",
|
|
27
|
-
channel: "email",
|
|
28
|
-
customerName: "Ivy",
|
|
29
|
-
metadata: { accountId: "acct_789" }
|
|
30
|
-
};
|
|
31
|
-
const classification = await classifier.classify(ticket);
|
|
32
|
-
const resolution = await resolver.resolve(ticket);
|
|
33
|
-
const draft = await responder.draft(ticket, resolution, classification);
|
|
34
|
-
logger.info("Support bot run completed", {
|
|
35
|
-
ticketId: ticket.id,
|
|
36
|
-
classification,
|
|
37
|
-
resolution,
|
|
38
|
-
emailDraft: { subject: draft.subject, body: draft.body }
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
export {
|
|
42
|
-
runAiSupportBotExample
|
|
43
|
-
};
|
|
1
|
+
import{Logger as D,LogLevel as E}from"@contractspec/lib.logger";import{AutoResponder as F}from"@contractspec/lib.support-bot/bot";import{TicketResolver as G}from"@contractspec/lib.support-bot/rag";import{TicketClassifier as H}from"@contractspec/lib.support-bot/tickets";var I=new D({level:E.INFO,environment:"production",enableColors:!1});async function P(){let x=new G({knowledge:{async query(B){return{answer:`The payout will retrigger automatically. (${B.slice(0,40)}…)`,references:[]}}}}),y=new H,z=new F,h={id:"TIC-42",subject:"Payout failed",body:"Hello, our supplier payout failed twice yesterday. Can you confirm status? It is urgent.",channel:"email",customerName:"Ivy",metadata:{accountId:"acct_789"}},j=await y.classify(h),m=await x.resolve(h),w=await z.draft(h,m,j);I.info("Support bot run completed",{ticketId:h.id,classification:j,resolution:m,emailDraft:{subject:w.subject,body:w.body}})}export{P as runAiSupportBotExample};
|
package/dist/setup.js
CHANGED
|
@@ -1,44 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
3
|
-
import { Logger, LogLevel } from "@contractspec/lib.logger";
|
|
4
|
-
import { AutoResponder } from "@contractspec/lib.support-bot/bot";
|
|
5
|
-
import { TicketResolver } from "@contractspec/lib.support-bot/rag";
|
|
6
|
-
import { TicketClassifier } from "@contractspec/lib.support-bot/tickets";
|
|
7
|
-
var logger = new Logger({
|
|
8
|
-
level: LogLevel.INFO,
|
|
9
|
-
environment: "production",
|
|
10
|
-
enableColors: false
|
|
11
|
-
});
|
|
12
|
-
async function runAiSupportBotExample() {
|
|
13
|
-
const knowledge = {
|
|
14
|
-
async query(question) {
|
|
15
|
-
return {
|
|
16
|
-
answer: `The payout will retrigger automatically. (${question.slice(0, 40)}\u2026)`,
|
|
17
|
-
references: []
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
const resolver = new TicketResolver({ knowledge });
|
|
22
|
-
const classifier = new TicketClassifier;
|
|
23
|
-
const responder = new AutoResponder;
|
|
24
|
-
const ticket = {
|
|
25
|
-
id: "TIC-42",
|
|
26
|
-
subject: "Payout failed",
|
|
27
|
-
body: "Hello, our supplier payout failed twice yesterday. Can you confirm status? It is urgent.",
|
|
28
|
-
channel: "email",
|
|
29
|
-
customerName: "Ivy",
|
|
30
|
-
metadata: { accountId: "acct_789" }
|
|
31
|
-
};
|
|
32
|
-
const classification = await classifier.classify(ticket);
|
|
33
|
-
const resolution = await resolver.resolve(ticket);
|
|
34
|
-
const draft = await responder.draft(ticket, resolution, classification);
|
|
35
|
-
logger.info("Support bot run completed", {
|
|
36
|
-
ticketId: ticket.id,
|
|
37
|
-
classification,
|
|
38
|
-
resolution,
|
|
39
|
-
emailDraft: { subject: draft.subject, body: draft.body }
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
export {
|
|
43
|
-
runAiSupportBotExample
|
|
44
|
-
};
|
|
2
|
+
import{Logger as D,LogLevel as E}from"@contractspec/lib.logger";import{AutoResponder as F}from"@contractspec/lib.support-bot/bot";import{TicketResolver as G}from"@contractspec/lib.support-bot/rag";import{TicketClassifier as H}from"@contractspec/lib.support-bot/tickets";var I=new D({level:E.INFO,environment:"production",enableColors:!1});async function P(){let x=new G({knowledge:{async query(B){return{answer:`The payout will retrigger automatically. (${B.slice(0,40)}\u2026)`,references:[]}}}}),y=new H,z=new F,h={id:"TIC-42",subject:"Payout failed",body:"Hello, our supplier payout failed twice yesterday. Can you confirm status? It is urgent.",channel:"email",customerName:"Ivy",metadata:{accountId:"acct_789"}},j=await y.classify(h),m=await x.resolve(h),w=await z.draft(h,m,j);I.info("Support bot run completed",{ticketId:h.id,classification:j,resolution:m,emailDraft:{subject:w.subject,body:w.body}})}export{P as runAiSupportBotExample};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/example.ai-support-bot",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.18",
|
|
4
4
|
"description": "AI support bot example: classify and resolve a support ticket using @contractspec/lib.support-bot.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -57,22 +57,22 @@
|
|
|
57
57
|
"dev": "contractspec-bun-build dev",
|
|
58
58
|
"clean": "rimraf dist .turbo",
|
|
59
59
|
"lint": "bun lint:fix",
|
|
60
|
-
"lint:fix": "biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .",
|
|
61
|
-
"lint:check": "biome check .",
|
|
60
|
+
"lint:fix": "node ../../../scripts/biome.cjs check --write --unsafe --only=nursery/useSortedClasses . && node ../../../scripts/biome.cjs check --write .",
|
|
61
|
+
"lint:check": "node ../../../scripts/biome.cjs check .",
|
|
62
62
|
"test": "bun test --pass-with-no-tests",
|
|
63
63
|
"prebuild": "contractspec-bun-build prebuild",
|
|
64
64
|
"typecheck": "tsc --noEmit"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@contractspec/lib.support-bot": "3.7.
|
|
68
|
-
"@contractspec/lib.knowledge": "3.7.
|
|
69
|
-
"@contractspec/lib.contracts-spec": "5.0
|
|
70
|
-
"@contractspec/lib.logger": "3.7.
|
|
67
|
+
"@contractspec/lib.support-bot": "3.7.18",
|
|
68
|
+
"@contractspec/lib.knowledge": "3.7.18",
|
|
69
|
+
"@contractspec/lib.contracts-spec": "5.2.0",
|
|
70
|
+
"@contractspec/lib.logger": "3.7.13"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@contractspec/tool.typescript": "3.7.
|
|
73
|
+
"@contractspec/tool.typescript": "3.7.13",
|
|
74
74
|
"typescript": "^5.9.3",
|
|
75
|
-
"@contractspec/tool.bun": "3.7.
|
|
75
|
+
"@contractspec/tool.bun": "3.7.14"
|
|
76
76
|
},
|
|
77
77
|
"publishConfig": {
|
|
78
78
|
"access": "public",
|