@contractspec/example.ai-support-bot 1.57.0 → 1.58.0

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/dist/index.js CHANGED
@@ -1,5 +1,114 @@
1
- import example from "./example.js";
2
- import { runAiSupportBotExample } from "./setup.js";
3
- import "./docs/index.js";
1
+ // @bun
2
+ // src/docs/ai-support-bot.docblock.ts
3
+ import { registerDocBlocks } from "@contractspec/lib.contracts/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
14
+ - Classify a ticket into a support category.
15
+ - Use a knowledge port to generate a grounded resolution.
16
+ - Draft a response (email body) from the resolution.
4
17
 
5
- export { example, runAiSupportBotExample };
18
+ ## Guardrails
19
+ - 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
31
+ - Call \`runAiSupportBotExample()\`.
32
+ - Replace the \`knowledge.query\` implementation with a real knowledge service.
33
+
34
+ ## Notes
35
+ - Keep outputs structured.
36
+ - Use policy gates before exposing drafted replies to end-users.`
37
+ }
38
+ ];
39
+ registerDocBlocks(blocks);
40
+ // src/example.ts
41
+ import { defineExample } from "@contractspec/lib.contracts";
42
+ var example = defineExample({
43
+ meta: {
44
+ key: "ai-support-bot",
45
+ version: "1.0.0",
46
+ title: "AI Support Bot",
47
+ description: "Classify and resolve a support ticket (with a drafted response) using the support-bot and knowledge libraries.",
48
+ kind: "script",
49
+ visibility: "public",
50
+ stability: "experimental",
51
+ owners: ["@platform.core"],
52
+ tags: ["support", "ai", "tickets", "knowledge"]
53
+ },
54
+ docs: {
55
+ rootDocId: "docs.examples.ai-support-bot",
56
+ usageDocId: "docs.examples.ai-support-bot.usage"
57
+ },
58
+ entrypoints: {
59
+ packageName: "@contractspec/example.ai-support-bot",
60
+ docs: "./docs"
61
+ },
62
+ surfaces: {
63
+ templates: true,
64
+ sandbox: { enabled: true, modes: ["markdown"] },
65
+ studio: { enabled: true, installable: true },
66
+ mcp: { enabled: true }
67
+ }
68
+ });
69
+ var example_default = example;
70
+
71
+ // src/setup.ts
72
+ import { TicketResolver } from "@contractspec/lib.support-bot/rag";
73
+ import { TicketClassifier } from "@contractspec/lib.support-bot/tickets";
74
+ import { AutoResponder } from "@contractspec/lib.support-bot/bot";
75
+ import { Logger, LogLevel } from "@contractspec/lib.logger";
76
+ var logger = new Logger({
77
+ level: LogLevel.DEBUG,
78
+ environment: "development",
79
+ enableColors: true
80
+ });
81
+ async function runAiSupportBotExample() {
82
+ const knowledge = {
83
+ async query(question) {
84
+ return {
85
+ answer: `The payout will retrigger automatically. (${question.slice(0, 40)}\u2026)`,
86
+ references: []
87
+ };
88
+ }
89
+ };
90
+ const resolver = new TicketResolver({ knowledge });
91
+ const classifier = new TicketClassifier;
92
+ const responder = new AutoResponder;
93
+ const ticket = {
94
+ id: "TIC-42",
95
+ subject: "Payout failed",
96
+ body: "Hello, our supplier payout failed twice yesterday. Can you confirm status? It is urgent.",
97
+ channel: "email",
98
+ customerName: "Ivy",
99
+ metadata: { accountId: "acct_789" }
100
+ };
101
+ const classification = await classifier.classify(ticket);
102
+ const resolution = await resolver.resolve(ticket);
103
+ const draft = await responder.draft(ticket, resolution, classification);
104
+ logger.info("Support bot run completed", {
105
+ ticketId: ticket.id,
106
+ classification,
107
+ resolution,
108
+ emailDraft: { subject: draft.subject, body: draft.body }
109
+ });
110
+ }
111
+ export {
112
+ runAiSupportBotExample,
113
+ example_default as example
114
+ };
@@ -0,0 +1,38 @@
1
+ // src/docs/ai-support-bot.docblock.ts
2
+ import { registerDocBlocks } from "@contractspec/lib.contracts/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
13
+ - Classify a ticket into a support category.
14
+ - Use a knowledge port to generate a grounded resolution.
15
+ - Draft a response (email body) from the resolution.
16
+
17
+ ## Guardrails
18
+ - 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
30
+ - Call \`runAiSupportBotExample()\`.
31
+ - Replace the \`knowledge.query\` implementation with a real knowledge service.
32
+
33
+ ## Notes
34
+ - Keep outputs structured.
35
+ - Use policy gates before exposing drafted replies to end-users.`
36
+ }
37
+ ];
38
+ registerDocBlocks(blocks);
@@ -0,0 +1,38 @@
1
+ // src/docs/ai-support-bot.docblock.ts
2
+ import { registerDocBlocks } from "@contractspec/lib.contracts/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
13
+ - Classify a ticket into a support category.
14
+ - Use a knowledge port to generate a grounded resolution.
15
+ - Draft a response (email body) from the resolution.
16
+
17
+ ## Guardrails
18
+ - 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
30
+ - Call \`runAiSupportBotExample()\`.
31
+ - Replace the \`knowledge.query\` implementation with a real knowledge service.
32
+
33
+ ## Notes
34
+ - Keep outputs structured.
35
+ - Use policy gates before exposing drafted replies to end-users.`
36
+ }
37
+ ];
38
+ registerDocBlocks(blocks);
@@ -0,0 +1,33 @@
1
+ // src/example.ts
2
+ import { defineExample } from "@contractspec/lib.contracts";
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
+ };
@@ -0,0 +1,113 @@
1
+ // src/docs/ai-support-bot.docblock.ts
2
+ import { registerDocBlocks } from "@contractspec/lib.contracts/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
13
+ - Classify a ticket into a support category.
14
+ - Use a knowledge port to generate a grounded resolution.
15
+ - Draft a response (email body) from the resolution.
16
+
17
+ ## Guardrails
18
+ - 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
30
+ - Call \`runAiSupportBotExample()\`.
31
+ - Replace the \`knowledge.query\` implementation with a real knowledge service.
32
+
33
+ ## Notes
34
+ - Keep outputs structured.
35
+ - Use policy gates before exposing drafted replies to end-users.`
36
+ }
37
+ ];
38
+ registerDocBlocks(blocks);
39
+ // src/example.ts
40
+ import { defineExample } from "@contractspec/lib.contracts";
41
+ var example = defineExample({
42
+ meta: {
43
+ key: "ai-support-bot",
44
+ version: "1.0.0",
45
+ title: "AI Support Bot",
46
+ description: "Classify and resolve a support ticket (with a drafted response) using the support-bot and knowledge libraries.",
47
+ kind: "script",
48
+ visibility: "public",
49
+ stability: "experimental",
50
+ owners: ["@platform.core"],
51
+ tags: ["support", "ai", "tickets", "knowledge"]
52
+ },
53
+ docs: {
54
+ rootDocId: "docs.examples.ai-support-bot",
55
+ usageDocId: "docs.examples.ai-support-bot.usage"
56
+ },
57
+ entrypoints: {
58
+ packageName: "@contractspec/example.ai-support-bot",
59
+ docs: "./docs"
60
+ },
61
+ surfaces: {
62
+ templates: true,
63
+ sandbox: { enabled: true, modes: ["markdown"] },
64
+ studio: { enabled: true, installable: true },
65
+ mcp: { enabled: true }
66
+ }
67
+ });
68
+ var example_default = example;
69
+
70
+ // src/setup.ts
71
+ import { TicketResolver } from "@contractspec/lib.support-bot/rag";
72
+ import { TicketClassifier } from "@contractspec/lib.support-bot/tickets";
73
+ import { AutoResponder } from "@contractspec/lib.support-bot/bot";
74
+ import { Logger, LogLevel } from "@contractspec/lib.logger";
75
+ var logger = new Logger({
76
+ level: LogLevel.DEBUG,
77
+ environment: "development",
78
+ enableColors: true
79
+ });
80
+ async function runAiSupportBotExample() {
81
+ const knowledge = {
82
+ async query(question) {
83
+ return {
84
+ answer: `The payout will retrigger automatically. (${question.slice(0, 40)}…)`,
85
+ references: []
86
+ };
87
+ }
88
+ };
89
+ const resolver = new TicketResolver({ knowledge });
90
+ const classifier = new TicketClassifier;
91
+ const responder = new AutoResponder;
92
+ const ticket = {
93
+ id: "TIC-42",
94
+ subject: "Payout failed",
95
+ body: "Hello, our supplier payout failed twice yesterday. Can you confirm status? It is urgent.",
96
+ channel: "email",
97
+ customerName: "Ivy",
98
+ metadata: { accountId: "acct_789" }
99
+ };
100
+ const classification = await classifier.classify(ticket);
101
+ const resolution = await resolver.resolve(ticket);
102
+ const draft = await responder.draft(ticket, resolution, classification);
103
+ logger.info("Support bot run completed", {
104
+ ticketId: ticket.id,
105
+ classification,
106
+ resolution,
107
+ emailDraft: { subject: draft.subject, body: draft.body }
108
+ });
109
+ }
110
+ export {
111
+ runAiSupportBotExample,
112
+ example_default as example
113
+ };
@@ -0,0 +1,43 @@
1
+ // src/setup.ts
2
+ import { TicketResolver } from "@contractspec/lib.support-bot/rag";
3
+ import { TicketClassifier } from "@contractspec/lib.support-bot/tickets";
4
+ import { AutoResponder } from "@contractspec/lib.support-bot/bot";
5
+ import { Logger, LogLevel } from "@contractspec/lib.logger";
6
+ var logger = new Logger({
7
+ level: LogLevel.DEBUG,
8
+ environment: "development",
9
+ enableColors: true
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
+ };
package/dist/setup.d.ts CHANGED
@@ -1,5 +1,2 @@
1
- //#region src/setup.d.ts
2
- declare function runAiSupportBotExample(): Promise<void>;
3
- //#endregion
4
- export { runAiSupportBotExample };
1
+ export declare function runAiSupportBotExample(): Promise<void>;
5
2
  //# sourceMappingURL=setup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setup.d.ts","names":[],"sources":["../src/setup.ts"],"mappings":";iBAesB,sBAAA,CAAA,GAA0B,OAAA"}
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAeA,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CAiC5D"}
package/dist/setup.js CHANGED
@@ -1,45 +1,44 @@
1
+ // @bun
2
+ // src/setup.ts
1
3
  import { TicketResolver } from "@contractspec/lib.support-bot/rag";
2
4
  import { TicketClassifier } from "@contractspec/lib.support-bot/tickets";
3
5
  import { AutoResponder } from "@contractspec/lib.support-bot/bot";
4
- import { LogLevel, Logger } from "@contractspec/lib.logger";
5
-
6
- //#region src/setup.ts
7
- const logger = new Logger({
8
- level: process.env.NODE_ENV === "production" ? LogLevel.INFO : LogLevel.DEBUG,
9
- environment: process.env.NODE_ENV || "development",
10
- enableColors: process.env.NODE_ENV !== "production"
6
+ import { Logger, LogLevel } from "@contractspec/lib.logger";
7
+ var logger = new Logger({
8
+ level: LogLevel.DEBUG,
9
+ environment: "development",
10
+ enableColors: true
11
11
  });
12
12
  async function runAiSupportBotExample() {
13
- const resolver = new TicketResolver({ knowledge: { async query(question) {
14
- return {
15
- answer: `The payout will retrigger automatically. (${question.slice(0, 40)}…)`,
16
- references: []
17
- };
18
- } } });
19
- const classifier = new TicketClassifier();
20
- const responder = new AutoResponder();
21
- const ticket = {
22
- id: "TIC-42",
23
- subject: "Payout failed",
24
- body: "Hello, our supplier payout failed twice yesterday. Can you confirm status? It is urgent.",
25
- channel: "email",
26
- customerName: "Ivy",
27
- metadata: { accountId: "acct_789" }
28
- };
29
- const classification = await classifier.classify(ticket);
30
- const resolution = await resolver.resolve(ticket);
31
- const draft = await responder.draft(ticket, resolution, classification);
32
- logger.info("Support bot run completed", {
33
- ticketId: ticket.id,
34
- classification,
35
- resolution,
36
- emailDraft: {
37
- subject: draft.subject,
38
- body: draft.body
39
- }
40
- });
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
41
  }
42
-
43
- //#endregion
44
- export { runAiSupportBotExample };
45
- //# sourceMappingURL=setup.js.map
42
+ export {
43
+ runAiSupportBotExample
44
+ };
package/package.json CHANGED
@@ -1,51 +1,88 @@
1
1
  {
2
2
  "name": "@contractspec/example.ai-support-bot",
3
- "version": "1.57.0",
3
+ "version": "1.58.0",
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",
7
7
  "exports": {
8
- ".": "./dist/index.js",
9
- "./docs": "./dist/docs/index.js",
10
- "./docs/ai-support-bot.docblock": "./dist/docs/ai-support-bot.docblock.js",
11
- "./example": "./dist/example.js",
12
- "./setup": "./dist/setup.js",
13
- "./*": "./*"
8
+ ".": "./src/index.ts",
9
+ "./docs": "./src/docs/index.ts",
10
+ "./docs/ai-support-bot.docblock": "./src/docs/ai-support-bot.docblock.ts",
11
+ "./docs/index": "./src/docs/index.ts",
12
+ "./example": "./src/example.ts",
13
+ "./setup": "./src/setup.ts"
14
14
  },
15
15
  "scripts": {
16
16
  "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
17
17
  "publish:pkg:canary": "bun publish:pkg --tag canary",
18
- "build": "bun build:types && bun build:bundle",
19
- "build:bundle": "tsdown",
20
- "build:types": "tsc --noEmit",
21
- "dev": "bun build:bundle --watch",
18
+ "build": "bun run prebuild && bun run build:bundle && bun run build:types",
19
+ "build:bundle": "contractspec-bun-build transpile",
20
+ "build:types": "contractspec-bun-build types",
21
+ "dev": "contractspec-bun-build dev",
22
22
  "clean": "rimraf dist .turbo",
23
23
  "lint": "bun lint:fix",
24
24
  "lint:fix": "eslint src --fix",
25
25
  "lint:check": "eslint src",
26
- "test": "bun test"
26
+ "test": "bun test",
27
+ "prebuild": "contractspec-bun-build prebuild",
28
+ "typecheck": "tsc --noEmit"
27
29
  },
28
30
  "dependencies": {
29
- "@contractspec/lib.support-bot": "1.57.0",
30
- "@contractspec/lib.knowledge": "1.57.0",
31
- "@contractspec/lib.contracts": "1.57.0",
32
- "@contractspec/lib.logger": "1.57.0"
31
+ "@contractspec/lib.support-bot": "1.58.0",
32
+ "@contractspec/lib.knowledge": "1.58.0",
33
+ "@contractspec/lib.contracts": "1.58.0",
34
+ "@contractspec/lib.logger": "1.58.0"
33
35
  },
34
36
  "devDependencies": {
35
- "@contractspec/tool.tsdown": "1.57.0",
36
- "@contractspec/tool.typescript": "1.57.0",
37
- "tsdown": "^0.20.3",
38
- "typescript": "^5.9.3"
37
+ "@contractspec/tool.typescript": "1.58.0",
38
+ "typescript": "^5.9.3",
39
+ "@contractspec/tool.bun": "1.57.0"
39
40
  },
40
41
  "publishConfig": {
41
42
  "access": "public",
42
43
  "exports": {
43
- ".": "./dist/index.js",
44
- "./docs": "./dist/docs/index.js",
45
- "./docs/ai-support-bot.docblock": "./dist/docs/ai-support-bot.docblock.js",
46
- "./example": "./dist/example.js",
47
- "./setup": "./dist/setup.js",
48
- "./*": "./*"
44
+ ".": {
45
+ "types": "./dist/index.d.ts",
46
+ "bun": "./dist/index.js",
47
+ "node": "./dist/node/index.mjs",
48
+ "browser": "./dist/browser/index.js",
49
+ "default": "./dist/index.js"
50
+ },
51
+ "./docs": {
52
+ "types": "./dist/docs/index.d.ts",
53
+ "bun": "./dist/docs/index.js",
54
+ "node": "./dist/node/docs/index.mjs",
55
+ "browser": "./dist/browser/docs/index.js",
56
+ "default": "./dist/docs/index.js"
57
+ },
58
+ "./docs/ai-support-bot.docblock": {
59
+ "types": "./dist/docs/ai-support-bot.docblock.d.ts",
60
+ "bun": "./dist/docs/ai-support-bot.docblock.js",
61
+ "node": "./dist/node/docs/ai-support-bot.docblock.mjs",
62
+ "browser": "./dist/browser/docs/ai-support-bot.docblock.js",
63
+ "default": "./dist/docs/ai-support-bot.docblock.js"
64
+ },
65
+ "./docs/index": {
66
+ "types": "./dist/docs/index.d.ts",
67
+ "bun": "./dist/docs/index.js",
68
+ "node": "./dist/node/docs/index.mjs",
69
+ "browser": "./dist/browser/docs/index.js",
70
+ "default": "./dist/docs/index.js"
71
+ },
72
+ "./example": {
73
+ "types": "./dist/example.d.ts",
74
+ "bun": "./dist/example.js",
75
+ "node": "./dist/node/example.mjs",
76
+ "browser": "./dist/browser/example.js",
77
+ "default": "./dist/example.js"
78
+ },
79
+ "./setup": {
80
+ "types": "./dist/setup.d.ts",
81
+ "bun": "./dist/setup.js",
82
+ "node": "./dist/node/setup.mjs",
83
+ "browser": "./dist/browser/setup.js",
84
+ "default": "./dist/setup.js"
85
+ }
49
86
  },
50
87
  "registry": "https://registry.npmjs.org/"
51
88
  },
package/tsdown.config.js CHANGED
@@ -1,5 +1,4 @@
1
- import { defineConfig } from 'tsdown';
2
- import { moduleLibrary } from '@contractspec/tool.tsdown';
1
+ import { defineConfig, moduleLibrary } from '@contractspec/tool.bun';
3
2
 
4
3
  export default defineConfig(() => ({
5
4
  ...moduleLibrary,
@@ -1,30 +0,0 @@
1
- $ tsdown
2
- ℹ tsdown v0.20.3 powered by rolldown v1.0.0-rc.3
3
- ℹ config file: /home/runner/work/contractspec/contractspec/packages/examples/ai-support-bot/tsdown.config.js
4
- ℹ entry: src/example.ts, src/index.ts, src/setup.ts, src/docs/ai-support-bot.docblock.ts, src/docs/index.ts
5
- ℹ target: esnext
6
- ℹ tsconfig: tsconfig.json
7
- ℹ Build start
8
- ℹ Cleaning 16 files
9
- ℹ dist/setup.js 1.53 kB │ gzip: 0.75 kB
10
- ℹ dist/docs/ai-support-bot.docblock.js 1.35 kB │ gzip: 0.66 kB
11
- ℹ dist/example.js 0.96 kB │ gzip: 0.51 kB
12
- ℹ dist/index.js 0.16 kB │ gzip: 0.11 kB
13
- ℹ dist/docs/index.js 0.04 kB │ gzip: 0.06 kB
14
- ℹ dist/setup.js.map 2.68 kB │ gzip: 1.18 kB
15
- ℹ dist/docs/ai-support-bot.docblock.js.map 1.84 kB │ gzip: 0.85 kB
16
- ℹ dist/example.js.map 1.43 kB │ gzip: 0.70 kB
17
- ℹ dist/example.d.ts.map 0.13 kB │ gzip: 0.13 kB
18
- ℹ dist/setup.d.ts.map 0.12 kB │ gzip: 0.12 kB
19
- ℹ dist/example.d.ts 0.25 kB │ gzip: 0.17 kB
20
- ℹ dist/setup.d.ts 0.17 kB │ gzip: 0.14 kB
21
- ℹ dist/index.d.ts 0.13 kB │ gzip: 0.09 kB
22
- ℹ dist/docs/ai-support-bot.docblock.d.ts 0.01 kB │ gzip: 0.03 kB
23
- ℹ dist/docs/index.d.ts 0.01 kB │ gzip: 0.03 kB
24
- ℹ 15 files, total: 10.80 kB
25
- [PLUGIN_TIMINGS] Warning: Your build spent significant time in plugins. Here is a breakdown:
26
- - tsdown:external (66%)
27
- - rolldown-plugin-dts:generate (33%)
28
- See https://rolldown.rs/options/checks#plugintimings for more details.
29
-
30
- ✔ Build complete in 16353ms
@@ -1 +0,0 @@
1
- {"version":3,"file":"ai-support-bot.docblock.js","names":[],"sources":["../../src/docs/ai-support-bot.docblock.ts"],"sourcesContent":["import type { DocBlock } from '@contractspec/lib.contracts/docs';\nimport { registerDocBlocks } from '@contractspec/lib.contracts/docs';\n\nconst blocks: DocBlock[] = [\n {\n id: 'docs.examples.ai-support-bot',\n title: 'AI Support Bot (example)',\n summary:\n 'Ticket classification + knowledge-grounded resolution + response drafting.',\n kind: 'reference',\n visibility: 'public',\n route: '/docs/examples/ai-support-bot',\n tags: ['support', 'ai', 'example'],\n body: `## What this example shows\\n- Classify a ticket into a support category.\\n- Use a knowledge port to generate a grounded resolution.\\n- Draft a response (email body) from the resolution.\\n\\n## Guardrails\\n- Avoid logging raw ticket bodies/PII; prefer structured summaries.\\n- Keep knowledge and ticket adapters explicit and testable.`,\n },\n {\n id: 'docs.examples.ai-support-bot.usage',\n title: 'AI Support Bot — Usage',\n summary: 'How to run the example and swap the knowledge adapter.',\n kind: 'usage',\n visibility: 'public',\n route: '/docs/examples/ai-support-bot/usage',\n tags: ['support', 'usage'],\n body: `## Usage\\n- Call \\`runAiSupportBotExample()\\`.\\n- Replace the \\`knowledge.query\\` implementation with a real knowledge service.\\n\\n## Notes\\n- Keep outputs structured.\\n- Use policy gates before exposing drafted replies to end-users.`,\n },\n];\n\nregisterDocBlocks(blocks);\n"],"mappings":";;;AA2BA,kBAxB2B,CACzB;CACE,IAAI;CACJ,OAAO;CACP,SACE;CACF,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM;EAAC;EAAW;EAAM;EAAU;CAClC,MAAM;CACP,EACD;CACE,IAAI;CACJ,OAAO;CACP,SAAS;CACT,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM,CAAC,WAAW,QAAQ;CAC1B,MAAM;CACP,CACF,CAEwB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["import { defineExample } from '@contractspec/lib.contracts';\n\nconst example = defineExample({\n meta: {\n key: 'ai-support-bot',\n version: '1.0.0',\n title: 'AI Support Bot',\n description:\n 'Classify and resolve a support ticket (with a drafted response) using the support-bot and knowledge libraries.',\n kind: 'script',\n visibility: 'public',\n stability: 'experimental',\n owners: ['@platform.core'],\n tags: ['support', 'ai', 'tickets', 'knowledge'],\n },\n docs: {\n rootDocId: 'docs.examples.ai-support-bot',\n usageDocId: 'docs.examples.ai-support-bot.usage',\n },\n entrypoints: {\n packageName: '@contractspec/example.ai-support-bot',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: { enabled: true, modes: ['markdown'] },\n studio: { enabled: true, installable: true },\n mcp: { enabled: true },\n },\n});\n\nexport default example;\n"],"mappings":";;;AAEA,MAAM,UAAU,cAAc;CAC5B,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAW;GAAM;GAAW;GAAY;EAChD;CACD,MAAM;EACJ,WAAW;EACX,YAAY;EACb;CACD,aAAa;EACX,aAAa;EACb,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GAAE,SAAS;GAAM,OAAO,CAAC,WAAW;GAAE;EAC/C,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF,CAAC"}