@koda-sl/baker-bridge 0.49.0-dev.ea15b0199 → 0.49.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.
Files changed (81) hide show
  1. package/README.md +10 -28
  2. package/dist/hono/agent-session.d.ts +0 -3
  3. package/dist/hono/agent-session.d.ts.map +1 -1
  4. package/dist/hono/agent-session.js +0 -15
  5. package/dist/hono/agent-session.js.map +1 -1
  6. package/dist/hono/agent.d.ts +2 -4
  7. package/dist/hono/agent.d.ts.map +1 -1
  8. package/dist/hono/agent.js +3 -17
  9. package/dist/hono/agent.js.map +1 -1
  10. package/dist/hono/agent.test.js +1 -128
  11. package/dist/hono/agent.test.js.map +1 -1
  12. package/dist/hono/bridge-job.d.ts +1 -16
  13. package/dist/hono/bridge-job.d.ts.map +1 -1
  14. package/dist/hono/bridge-job.js +6 -75
  15. package/dist/hono/bridge-job.js.map +1 -1
  16. package/dist/hono/bridge-job.test.js +6 -159
  17. package/dist/hono/bridge-job.test.js.map +1 -1
  18. package/dist/hono/callback.d.ts.map +1 -1
  19. package/dist/hono/callback.js +2 -2
  20. package/dist/hono/callback.js.map +1 -1
  21. package/dist/hono/convex.d.ts +1 -4
  22. package/dist/hono/convex.d.ts.map +1 -1
  23. package/dist/hono/convex.js +1 -10
  24. package/dist/hono/convex.js.map +1 -1
  25. package/dist/hono/convex.test.js +4 -6
  26. package/dist/hono/convex.test.js.map +1 -1
  27. package/dist/hono/prompt-context.d.ts +3 -0
  28. package/dist/hono/prompt-context.d.ts.map +1 -0
  29. package/dist/hono/prompt-context.js +13 -0
  30. package/dist/hono/prompt-context.js.map +1 -0
  31. package/dist/hono/prompt-context.test.d.ts +2 -0
  32. package/dist/hono/prompt-context.test.d.ts.map +1 -0
  33. package/dist/hono/prompt-context.test.js +39 -0
  34. package/dist/hono/prompt-context.test.js.map +1 -0
  35. package/dist/hono/relay.d.ts +1 -9
  36. package/dist/hono/relay.d.ts.map +1 -1
  37. package/dist/hono/relay.js +0 -8
  38. package/dist/hono/relay.js.map +1 -1
  39. package/dist/hono/server.d.ts.map +1 -1
  40. package/dist/hono/server.js +0 -21
  41. package/dist/hono/server.js.map +1 -1
  42. package/dist/hono/session-continuity.d.ts +1 -1
  43. package/dist/hono/session-continuity.d.ts.map +1 -1
  44. package/dist/hono/session-continuity.integration.test.js +0 -4
  45. package/dist/hono/session-continuity.integration.test.js.map +1 -1
  46. package/dist/hono/session-continuity.js.map +1 -1
  47. package/dist/hono/types.d.ts +1 -3
  48. package/dist/hono/types.d.ts.map +1 -1
  49. package/package.json +1 -1
  50. package/dist/hono/chat-change.d.ts +0 -102
  51. package/dist/hono/chat-change.d.ts.map +0 -1
  52. package/dist/hono/chat-change.js +0 -50
  53. package/dist/hono/chat-change.js.map +0 -1
  54. package/dist/hono/guards/__tests__/google-ads-rsa.test.d.ts +0 -2
  55. package/dist/hono/guards/__tests__/google-ads-rsa.test.d.ts.map +0 -1
  56. package/dist/hono/guards/__tests__/google-ads-rsa.test.js +0 -65
  57. package/dist/hono/guards/__tests__/google-ads-rsa.test.js.map +0 -1
  58. package/dist/hono/guards/google-ads-rsa.d.ts +0 -3
  59. package/dist/hono/guards/google-ads-rsa.d.ts.map +0 -1
  60. package/dist/hono/guards/google-ads-rsa.js +0 -32
  61. package/dist/hono/guards/google-ads-rsa.js.map +0 -1
  62. package/dist/hono/guards.d.ts +0 -3
  63. package/dist/hono/guards.d.ts.map +0 -1
  64. package/dist/hono/guards.js +0 -9
  65. package/dist/hono/guards.js.map +0 -1
  66. package/dist/hono/tag-input.d.ts +0 -40
  67. package/dist/hono/tag-input.d.ts.map +0 -1
  68. package/dist/hono/tag-input.js +0 -132
  69. package/dist/hono/tag-input.js.map +0 -1
  70. package/dist/hono/tag-input.test.d.ts +0 -2
  71. package/dist/hono/tag-input.test.d.ts.map +0 -1
  72. package/dist/hono/tag-input.test.js +0 -66
  73. package/dist/hono/tag-input.test.js.map +0 -1
  74. package/dist/hono/turn-result.d.ts +0 -36
  75. package/dist/hono/turn-result.d.ts.map +0 -1
  76. package/dist/hono/turn-result.js +0 -207
  77. package/dist/hono/turn-result.js.map +0 -1
  78. package/dist/hono/turn-result.test.d.ts +0 -2
  79. package/dist/hono/turn-result.test.d.ts.map +0 -1
  80. package/dist/hono/turn-result.test.js +0 -63
  81. package/dist/hono/turn-result.test.js.map +0 -1
@@ -1,102 +0,0 @@
1
- export declare const CHANGE_TYPES: readonly ["landing", "document", "knowledge", "brand", "company", "flow", "action", "report"];
2
- export declare const CHANGE_ACTIONS: readonly ["created", "updated", "deleted"];
3
- export declare const REPORT_STATUSES: readonly ["draft", "active", "error", "archived"];
4
- export declare const DOCUMENT_FORMATS: readonly ["pdf", "pptx", "docx", "xlsx", "csv", "json"];
5
- export type ChangeType = (typeof CHANGE_TYPES)[number];
6
- export type ChangeAction = (typeof CHANGE_ACTIONS)[number];
7
- export type ReportStatus = (typeof REPORT_STATUSES)[number];
8
- export type DocumentFormat = (typeof DOCUMENT_FORMATS)[number];
9
- type BaseChatChange<T extends ChangeType> = {
10
- type: T;
11
- slug: string;
12
- action: ChangeAction;
13
- contentVersion?: number;
14
- };
15
- type DocumentChatChange = BaseChatChange<"document"> & {
16
- format?: DocumentFormat;
17
- };
18
- type ReportChatChange = BaseChatChange<"report"> & {
19
- title?: string;
20
- description?: string;
21
- intent?: string;
22
- status?: ReportStatus;
23
- sourcePath?: string;
24
- definitionContentVersion?: number;
25
- dashboardContentVersion?: number;
26
- endpointContentVersion?: number;
27
- errorMessage?: string;
28
- };
29
- export type ChatChange = DocumentChatChange | ReportChatChange | BaseChatChange<Exclude<ChangeType, "document" | "report">>;
30
- export declare const chatChangeJsonSchema: {
31
- readonly oneOf: readonly [...{
32
- type: string;
33
- additionalProperties: boolean;
34
- required: string[];
35
- properties: {
36
- type: {
37
- const: "action" | "brand" | "company" | "document" | "flow" | "knowledge" | "landing";
38
- };
39
- slug: {
40
- type: string;
41
- minLength: number;
42
- };
43
- action: {
44
- enum: readonly ["created", "updated", "deleted"];
45
- };
46
- contentVersion: {
47
- type: string;
48
- };
49
- format?: {
50
- enum: readonly ["pdf", "pptx", "docx", "xlsx", "csv", "json"];
51
- } | undefined;
52
- };
53
- }[], {
54
- readonly type: "object";
55
- readonly additionalProperties: false;
56
- readonly required: readonly ["type", "slug", "action"];
57
- readonly properties: {
58
- readonly type: {
59
- readonly const: "report";
60
- };
61
- readonly slug: {
62
- readonly type: "string";
63
- readonly minLength: 1;
64
- };
65
- readonly action: {
66
- readonly enum: readonly ["created", "updated", "deleted"];
67
- };
68
- readonly contentVersion: {
69
- readonly type: "number";
70
- };
71
- readonly title: {
72
- readonly type: "string";
73
- };
74
- readonly description: {
75
- readonly type: "string";
76
- };
77
- readonly intent: {
78
- readonly type: "string";
79
- };
80
- readonly status: {
81
- readonly enum: readonly ["draft", "active", "error", "archived"];
82
- };
83
- readonly sourcePath: {
84
- readonly type: "string";
85
- };
86
- readonly definitionContentVersion: {
87
- readonly type: "number";
88
- };
89
- readonly dashboardContentVersion: {
90
- readonly type: "number";
91
- };
92
- readonly endpointContentVersion: {
93
- readonly type: "number";
94
- };
95
- readonly errorMessage: {
96
- readonly type: "string";
97
- };
98
- };
99
- }];
100
- };
101
- export {};
102
- //# sourceMappingURL=chat-change.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chat-change.d.ts","sourceRoot":"","sources":["../../src/hono/chat-change.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,YACvB,SAAS,EACT,UAAU,EACV,WAAW,EACX,OAAO,EACP,SAAS,EACT,MAAM,EACN,QAAQ,EACR,QAAQ,CACA,CAAC;AACX,eAAO,MAAM,cAAc,YAAI,SAAS,EAAE,SAAS,EAAE,SAAS,CAAU,CAAC;AACzE,eAAO,MAAM,eAAe,YAAI,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAU,CAAC;AACjF,eAAO,MAAM,gBAAgB,YAAI,KAAK,EAAE,MAAM,EAAE,MAAM,E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KAAK;;;gBACL,IAAI;gBAAY,SAAS;;;gBACvB,IAAI;;;gBACI,IAAI;;;;;;;uBAKlB,QAAQ;;qCAEH,MAAM,EAAE,MAAM,EAAE,QAAQ;;qBAEjC,IAAI;yBAAI,KAAK,EAAE,QAAQ;;qBACvB,IAAI;yBAAI,IAAI,EAAE,QAAQ;yBAAE,SAAS,EAAE,CAAC;;qBACpC,MAAM;yBAAI,IAAI;;qBACd,cAAc;yBAAI,IAAI,EAAE,QAAQ;;qBAChC,KAAK;yBAAI,IAAI,EAAE,QAAQ;;qBACvB,WAAW;yBAAI,IAAI,EAAE,QAAQ;;qBAC7B,MAAM;yBAAI,IAAI,EAAE,QAAQ;;qBACxB,MAAM;yBAAI,IAAI;;qBACd,UAAU;yBAAI,IAAI,EAAE,QAAQ;;qBAC5B,wBAAwB;yBAAI,IAAI,EAAE,QAAQ;;qBAC1C,uBAAuB;yBAAI,IAAI,EAAE,QAAQ;;qBACzC,sBAAsB;yBAAI,IAAI,EAAE,QAAQ;;qBACxC,YAAY;yBAAI,IAAI,EAAE,QAAQ;;;;CAI5B,CAAC"}
@@ -1,50 +0,0 @@
1
- export const CHANGE_TYPES = [
2
- "landing",
3
- "document",
4
- "knowledge",
5
- "brand",
6
- "company",
7
- "flow",
8
- "action",
9
- "report",
10
- ];
11
- export const CHANGE_ACTIONS = ["created", "updated", "deleted"];
12
- export const REPORT_STATUSES = ["draft", "active", "error", "archived"];
13
- export const DOCUMENT_FORMATS = ["pdf", "pptx", "docx", "xlsx", "csv", "json"];
14
- export const chatChangeJsonSchema = {
15
- oneOf: [
16
- ...CHANGE_TYPES.filter((type) => type !== "report").map((type) => ({
17
- type: "object",
18
- additionalProperties: false,
19
- required: ["type", "slug", "action"],
20
- properties: {
21
- type: { const: type },
22
- slug: { type: "string", minLength: 1 },
23
- action: { enum: CHANGE_ACTIONS },
24
- contentVersion: { type: "number" },
25
- ...(type === "document" ? { format: { enum: DOCUMENT_FORMATS } } : {}),
26
- },
27
- })),
28
- {
29
- type: "object",
30
- additionalProperties: false,
31
- required: ["type", "slug", "action"],
32
- properties: {
33
- type: { const: "report" },
34
- slug: { type: "string", minLength: 1 },
35
- action: { enum: CHANGE_ACTIONS },
36
- contentVersion: { type: "number" },
37
- title: { type: "string" },
38
- description: { type: "string" },
39
- intent: { type: "string" },
40
- status: { enum: REPORT_STATUSES },
41
- sourcePath: { type: "string" },
42
- definitionContentVersion: { type: "number" },
43
- dashboardContentVersion: { type: "number" },
44
- endpointContentVersion: { type: "number" },
45
- errorMessage: { type: "string" },
46
- },
47
- },
48
- ],
49
- };
50
- //# sourceMappingURL=chat-change.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chat-change.js","sourceRoot":"","sources":["../../src/hono/chat-change.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,SAAS;IACT,UAAU;IACV,WAAW;IACX,OAAO;IACP,SAAS;IACT,MAAM;IACN,QAAQ;IACR,QAAQ;CACA,CAAC;AACX,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAU,CAAC;AACzE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAU,CAAC;AACjF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAU,CAAC;AAmCxF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE;QACL,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACjE,IAAI,EAAE,QAAQ;YACd,oBAAoB,EAAE,KAAK;YAC3B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ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Q,EAAE;aACjC;SACF;KACF;CACO,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=google-ads-rsa.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"google-ads-rsa.test.d.ts","sourceRoot":"","sources":["../../../../src/hono/guards/__tests__/google-ads-rsa.test.ts"],"names":[],"mappings":""}
@@ -1,65 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { validateAssistantOutputGuards } from "../../guards.js";
3
- import { TurnResultIntake } from "../../turn-result.js";
4
- import { validateGoogleAdsRsaAssets } from "../google-ads-rsa.js";
5
- function turnResultWithAssets(headlines, descriptions) {
6
- const result = TurnResultIntake.fromStructuredOutput({
7
- changes: [],
8
- outputGuards: {
9
- googleAdsRsa: {
10
- assets: { headlines, descriptions },
11
- },
12
- },
13
- });
14
- expect(result).not.toBeNull();
15
- return result;
16
- }
17
- describe("Google Ads RSA output guard", () => {
18
- it("accepts valid RSA headlines and descriptions declared in Turn Result output", () => {
19
- const result = turnResultWithAssets(["Book a Free Demo", "Cut Wasted Ad Spend"], ["Find leaks in your account and fix wasted spend before next month."]);
20
- expect(() => validateAssistantOutputGuards(result)).not.toThrow();
21
- });
22
- it("rejects RSA assets over Google character limits with a clear error", () => {
23
- const result = turnResultWithAssets(["This Headline Is Definitely Over Thirty Characters"], ["This description is intentionally longer than ninety characters so the bridge rejects it before completion."]);
24
- expect(() => validateAssistantOutputGuards(result)).toThrow('Google Ads RSA output guard failed: headline 1 is 50 characters (max 30): "This Headline Is Definitely Over Thirty Characters"; description 1 is 107 characters (max 90): "This description is intentionally longer than ninety characters so the bridge rejects it before completion."');
25
- });
26
- it("allows legacy Turn Result output without output guards", () => {
27
- const result = TurnResultIntake.fromStructuredOutput({ changes: [] });
28
- expect(result).toEqual({ changes: [] });
29
- expect(() => validateAssistantOutputGuards(result)).not.toThrow();
30
- });
31
- it("exposes optional googleAdsRsa assets in the structured output schema", () => {
32
- const outputFormat = TurnResultIntake.outputFormat();
33
- expect(outputFormat).toMatchObject({
34
- type: "json_schema",
35
- schema: {
36
- properties: {
37
- outputGuards: {
38
- properties: {
39
- googleAdsRsa: {
40
- required: ["assets"],
41
- properties: {
42
- assets: {
43
- properties: {
44
- headlines: { type: "array", items: { type: "string" } },
45
- descriptions: { type: "array", items: { type: "string" } },
46
- },
47
- },
48
- },
49
- },
50
- },
51
- },
52
- },
53
- },
54
- });
55
- });
56
- });
57
- describe("validateGoogleAdsRsaAssets", () => {
58
- it("recomputes lengths from asset text", () => {
59
- expect(() => validateGoogleAdsRsaAssets({
60
- headlines: ["123456789012345678901234567890"],
61
- descriptions: ["1".repeat(90)],
62
- })).not.toThrow();
63
- });
64
- });
65
- //# sourceMappingURL=google-ads-rsa.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"google-ads-rsa.test.js","sourceRoot":"","sources":["../../../../src/hono/guards/__tests__/google-ads-rsa.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElE,SAAS,oBAAoB,CAAC,SAAmB,EAAE,YAAsB;IACvE,MAAM,MAAM,GAAG,gBAAgB,CAAC,oBAAoB,CAAC;QACnD,OAAO,EAAE,EAAE;QACX,YAAY,EAAE;YACZ,YAAY,EAAE;gBACZ,MAAM,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE;aACpC;SACF;KACF,CAAC,CAAC;IACH,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC9B,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,EAAE,CAAC,6EAA6E,E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AAE;wCACN,UAAU,EAAE;4CACV,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;4CACvD,YAAY,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;yCAC3D;qCACF;iCACF;6BACF;yBACF;qBACF;iBACF;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,CAAC,GAAG,EAAE,CACV,0BAA0B,CAAC;YACzB,SAAS,EAAE,CAAC,gCAAgC,CAAC;YAC7C,YAAY,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;SAC/B,CAAC,CACH,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { GoogleAdsRsaAssets } from "../turn-result.ts";
2
- export declare function validateGoogleAdsRsaAssets(assets: GoogleAdsRsaAssets): void;
3
- //# sourceMappingURL=google-ads-rsa.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"google-ads-rsa.d.ts","sourceRoot":"","sources":["../../../src/hono/guards/google-ads-rsa.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAkC5D,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAc3E"}
@@ -1,32 +0,0 @@
1
- const HEADLINE_MAX_LENGTH = 30;
2
- const DESCRIPTION_MAX_LENGTH = 90;
3
- function countGoogleAdsCharacters(value) {
4
- return Array.from(value).length;
5
- }
6
- function collectViolations(assets) {
7
- const violations = [];
8
- assets.headlines.forEach((text, index) => {
9
- const length = countGoogleAdsCharacters(text);
10
- if (length > HEADLINE_MAX_LENGTH) {
11
- violations.push({ kind: "headline", index, maxLength: HEADLINE_MAX_LENGTH, text, length });
12
- }
13
- });
14
- assets.descriptions.forEach((text, index) => {
15
- const length = countGoogleAdsCharacters(text);
16
- if (length > DESCRIPTION_MAX_LENGTH) {
17
- violations.push({ kind: "description", index, maxLength: DESCRIPTION_MAX_LENGTH, text, length });
18
- }
19
- });
20
- return violations;
21
- }
22
- export function validateGoogleAdsRsaAssets(assets) {
23
- const violations = collectViolations(assets);
24
- if (violations.length === 0) {
25
- return;
26
- }
27
- const details = violations
28
- .map((violation) => `${violation.kind} ${String(violation.index + 1)} is ${String(violation.length)} characters (max ${String(violation.maxLength)}): "${violation.text}"`)
29
- .join("; ");
30
- throw new Error(`Google Ads RSA output guard failed: ${details}`);
31
- }
32
- //# sourceMappingURL=google-ads-rsa.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"google-ads-rsa.js","sourceRoot":"","sources":["../../../src/hono/guards/google-ads-rsa.ts"],"names":[],"mappings":"AAEA,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAElC,SAAS,wBAAwB,CAAC,KAAa;IAC7C,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;AAClC,CAAC;AAUD,SAAS,iBAAiB,CAAC,MAA0B;IACnD,MAAM,UAAU,GAAgB,EAAE,CAAC;IACnC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACvC,MAAM,MAAM,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,MAAM,GAAG,mBAAmB,EAAE,CAAC;YACjC,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QAC7F,CAAC;IACH,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QAC1C,MAAM,MAAM,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,MAAM,GAAG,sBAAsB,EAAE,CAAC;YACpC,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,sBAAsB,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QACnG,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,MAA0B;IACnE,MAAM,UAAU,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC7C,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO;IACT,CAAC;IACD,MAAM,OAAO,GAAG,UAAU;SACvB,GAAG,CACF,CAAC,SAAS,EAAE,EAAE,CACZ,GAAG,SAAS,CAAC,IAAI,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,OAAO,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,oBAAoB,MAAM,CACvG,SAAS,CAAC,SAAS,CACpB,OAAO,SAAS,CAAC,IAAI,GAAG,CAC5B;SACA,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,MAAM,IAAI,KAAK,CAAC,uCAAuC,OAAO,EAAE,CAAC,CAAC;AACpE,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { NormalizedTurnResult } from "./turn-result.ts";
2
- export declare function validateAssistantOutputGuards(turnResult: NormalizedTurnResult | null): void;
3
- //# sourceMappingURL=guards.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../src/hono/guards.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,wBAAgB,6BAA6B,CAAC,UAAU,EAAE,oBAAoB,GAAG,IAAI,GAAG,IAAI,CAM3F"}
@@ -1,9 +0,0 @@
1
- import { validateGoogleAdsRsaAssets } from "./guards/google-ads-rsa.js";
2
- export function validateAssistantOutputGuards(turnResult) {
3
- const googleAdsRsa = turnResult?.outputGuards?.googleAdsRsa;
4
- if (!googleAdsRsa) {
5
- return;
6
- }
7
- validateGoogleAdsRsaAssets(googleAdsRsa.assets);
8
- }
9
- //# sourceMappingURL=guards.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"guards.js","sourceRoot":"","sources":["../../src/hono/guards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAGxE,MAAM,UAAU,6BAA6B,CAAC,UAAuC;IACnF,MAAM,YAAY,GAAG,UAAU,EAAE,YAAY,EAAE,YAAY,CAAC;IAC5D,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO;IACT,CAAC;IACD,0BAA0B,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;AAClD,CAAC"}
@@ -1,40 +0,0 @@
1
- import { z } from "zod";
2
- export declare const BAKER_UI_SERVER_NAME = "baker_ui";
3
- export declare const TAG_INPUT_TOOL_NAME = "mcp__baker_ui__request_tag_input";
4
- export declare const TAG_TYPES: [string, ...string[]];
5
- export type TagInputToolInput = {
6
- mode: "create" | "edit";
7
- tagType: string;
8
- ref?: string;
9
- prefilledConfig?: Record<string, string>;
10
- requestedSecretFields?: string[];
11
- message?: string;
12
- resolution?: Record<string, unknown>;
13
- };
14
- export declare const tagInputResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
15
- status: z.ZodLiteral<"submitted">;
16
- ref: z.ZodString;
17
- type: z.ZodString;
18
- identifier: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
19
- secretFieldsSet: z.ZodArray<z.ZodString>;
20
- note: z.ZodOptional<z.ZodString>;
21
- }, z.core.$strip>, z.ZodObject<{
22
- status: z.ZodLiteral<"declined">;
23
- reason: z.ZodOptional<z.ZodString>;
24
- }, z.core.$strip>], "status">;
25
- export type TagInputResult = z.infer<typeof tagInputResultSchema>;
26
- /** Parse-at-boundary for the bridge's `/tag-input-decision` endpoint. Returns null on any mismatch. */
27
- export declare function parseTagInputResult(value: unknown): TagInputResult | null;
28
- /**
29
- * Strip secret-field values a model may have (incorrectly) placed into
30
- * `prefilledConfig`, and move their NAMES into `requestedSecretFields` so the
31
- * user is still asked for them — just without the leaked value travelling on.
32
- */
33
- export declare function sanitizeTagInputRequest(input: TagInputToolInput): TagInputToolInput;
34
- /**
35
- * The handler runs only AFTER `canUseTool` resolved (the bridge blocks there
36
- * and injects `resolution` into the input) — so it just echoes the redacted
37
- * resolution as the tool result.
38
- */
39
- export declare function createBakerUiServer(): import("@anthropic-ai/claude-agent-sdk").McpSdkServerConfigWithInstance;
40
- //# sourceMappingURL=tag-input.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tag-input.d.ts","sourceRoot":"","sources":["../../src/hono/tag-input.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAC/C,eAAO,MAAM,mBAAmB,qCAAqC,CAAC;AA2BtE,eAAO,MAAM,SAAS,EAAyC,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;AAwBrF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;6BAa/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,uGAAuG;AACvG,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAGzE;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,iBAAiB,GAAG,iBAAiB,CAmBnF;AAUD;;;;GAIG;AACH,wBAAgB,mBAAmB,4EAiBlC"}
@@ -1,132 +0,0 @@
1
- /**
2
- * `baker_ui` — in-process SDK MCP server hosting interactive dashboard tools.
3
- *
4
- * `request_tag_input` is the blocking secure tag form: the agent invokes it
5
- * when a marketing tag needs values the model must never see (API keys, OAuth
6
- * connections). The bridge intercepts the call in `canUseTool` (mirroring
7
- * AskUserQuestion), parks the turn on a pending promise, and the dashboard
8
- * renders the form. The user's submission writes secrets straight into the
9
- * chat's staged tag draft in Convex; the bridge receives only the REDACTED
10
- * result, injects it into `updatedInput.resolution`, and this tool's trivial
11
- * handler echoes it back as the tool result.
12
- */
13
- import { createSdkMcpServer, tool } from "@anthropic-ai/claude-agent-sdk";
14
- import { z } from "zod";
15
- export const BAKER_UI_SERVER_NAME = "baker_ui";
16
- export const TAG_INPUT_TOOL_NAME = "mcp__baker_ui__request_tag_input";
17
- // Mirror of `TAG_SECRET_FIELDS` in packages/api/src/tags.ts (the bridge is
18
- // published standalone and cannot depend on @baker/api). The backend strips
19
- // secret keys again at /api/chat/tag-input-request — this mirror is UX-side
20
- // defense in depth, not the enforcement point.
21
- const SECRET_FIELDS_BY_TYPE = {
22
- meta: ["accessToken"],
23
- amplitude: [],
24
- googleAds: ["oauthProviderId", "customerAccountId", "customerId", "loginCustomerId"],
25
- tiktok: ["accessToken"],
26
- vwo: [],
27
- hotjar: [],
28
- clarity: [],
29
- pinterest: ["conversionToken"],
30
- code: [],
31
- googleAnalytics: ["apiSecret"],
32
- googleTagManager: ["authorizationToken"],
33
- hubspot: [],
34
- linkedinInsightTag: ["oauthProviderId"],
35
- onetrust: [],
36
- posthog: [],
37
- datafast: ["apiKey"],
38
- recaptcha: [],
39
- twitterAds: ["oauthProviderId"],
40
- };
41
- export const TAG_TYPES = Object.keys(SECRET_FIELDS_BY_TYPE);
42
- const tagInputRequestShape = {
43
- mode: z.enum(["create", "edit"]).describe("create a new tag, or edit an existing one"),
44
- tagType: z.enum(TAG_TYPES).describe("Marketing tag type (matches `baker tags list` types)"),
45
- ref: z
46
- .string()
47
- .optional()
48
- .describe("Edit mode, or filling secrets on a staged create: the tag id or tag_temp_* ref from `baker tags list`"),
49
- prefilledConfig: z
50
- .record(z.string(), z.string())
51
- .optional()
52
- .describe("Non-secret config values to prefill the form with. Never place secret values here."),
53
- requestedSecretFields: z
54
- .array(z.string())
55
- .optional()
56
- .describe("Secret field names the user should provide (e.g. accessToken, apiSecret, oauthProviderId)"),
57
- message: z.string().optional().describe("One short sentence shown above the form explaining why this is needed"),
58
- resolution: z
59
- .record(z.string(), z.unknown())
60
- .optional()
61
- .describe("Internal — injected by the bridge after the user resolves the form. Never set this yourself."),
62
- };
63
- export const tagInputResultSchema = z.discriminatedUnion("status", [
64
- z.object({
65
- status: z.literal("submitted"),
66
- ref: z.string(),
67
- type: z.string(),
68
- identifier: z.record(z.string(), z.string()).optional(),
69
- secretFieldsSet: z.array(z.string()),
70
- note: z.string().optional(),
71
- }),
72
- z.object({
73
- status: z.literal("declined"),
74
- reason: z.string().optional(),
75
- }),
76
- ]);
77
- /** Parse-at-boundary for the bridge's `/tag-input-decision` endpoint. Returns null on any mismatch. */
78
- export function parseTagInputResult(value) {
79
- const parsed = tagInputResultSchema.safeParse(value);
80
- return parsed.success ? parsed.data : null;
81
- }
82
- /**
83
- * Strip secret-field values a model may have (incorrectly) placed into
84
- * `prefilledConfig`, and move their NAMES into `requestedSecretFields` so the
85
- * user is still asked for them — just without the leaked value travelling on.
86
- */
87
- export function sanitizeTagInputRequest(input) {
88
- const secretFields = SECRET_FIELDS_BY_TYPE[input.tagType] ?? [];
89
- const prefilled = input.prefilledConfig ?? {};
90
- const cleaned = {};
91
- const leaked = [];
92
- for (const [key, value] of Object.entries(prefilled)) {
93
- if (secretFields.includes(key)) {
94
- leaked.push(key);
95
- }
96
- else {
97
- cleaned[key] = value;
98
- }
99
- }
100
- const requested = [...new Set([...(input.requestedSecretFields ?? []), ...leaked])];
101
- const { resolution: _resolution, ...rest } = input;
102
- return {
103
- ...rest,
104
- ...(Object.keys(cleaned).length > 0 ? { prefilledConfig: cleaned } : { prefilledConfig: undefined }),
105
- ...(requested.length > 0 ? { requestedSecretFields: requested } : { requestedSecretFields: undefined }),
106
- };
107
- }
108
- const TAG_INPUT_TOOL_DESCRIPTION = [
109
- "Ask the user to fill a marketing-tag configuration form in the dashboard chat. BLOCKS until the user submits or declines.",
110
- "Use this whenever a tag needs secret values (API keys, access tokens, OAuth connections) — never ask for secrets in plain chat and never accept them as message text.",
111
- "Prefill every non-secret field you already know via prefilledConfig, and list the secret fields you need in requestedSecretFields.",
112
- "The user's secret values go straight into the staged tag draft — the result you receive is redacted (field names only).",
113
- "The staged change applies to production only when the chat is published.",
114
- ].join(" ");
115
- /**
116
- * The handler runs only AFTER `canUseTool` resolved (the bridge blocks there
117
- * and injects `resolution` into the input) — so it just echoes the redacted
118
- * resolution as the tool result.
119
- */
120
- export function createBakerUiServer() {
121
- return createSdkMcpServer({
122
- name: BAKER_UI_SERVER_NAME,
123
- version: "1.0.0",
124
- tools: [
125
- tool("request_tag_input", TAG_INPUT_TOOL_DESCRIPTION, tagInputRequestShape, (args) => {
126
- const resolution = args.resolution ?? { status: "declined", reason: "no resolution received" };
127
- return Promise.resolve({ content: [{ type: "text", text: JSON.stringify(resolution) }] });
128
- }),
129
- ],
130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input.test.d.ts","sourceRoot":"","sources":["../../src/hono/tag-input.test.ts"],"names":[],"mappings":""}
@@ -1,66 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { parseTagInputResult, sanitizeTagInputRequest } from "./tag-input.js";
3
- describe("sanitizeTagInputRequest", () => {
4
- it("moves leaked secret prefill values into requested fields, dropping the value", () => {
5
- const sanitized = sanitizeTagInputRequest({
6
- mode: "create",
7
- tagType: "meta",
8
- prefilledConfig: { pixelId: "123", accessToken: "EAAB-leak" },
9
- });
10
- expect(sanitized.prefilledConfig).toEqual({ pixelId: "123" });
11
- expect(sanitized.requestedSecretFields).toEqual(["accessToken"]);
12
- expect(JSON.stringify(sanitized)).not.toContain("EAAB-leak");
13
- });
14
- it("keeps non-secret prefill and merges requested fields without duplicates", () => {
15
- const sanitized = sanitizeTagInputRequest({
16
- mode: "edit",
17
- tagType: "googleAnalytics",
18
- ref: "jd7tag",
19
- prefilledConfig: { measurementId: "G-ABC", apiSecret: "shhh" },
20
- requestedSecretFields: ["apiSecret"],
21
- message: "Rotate the secret",
22
- });
23
- expect(sanitized.prefilledConfig).toEqual({ measurementId: "G-ABC" });
24
- expect(sanitized.requestedSecretFields).toEqual(["apiSecret"]);
25
- expect(sanitized.message).toBe("Rotate the secret");
26
- });
27
- it("never forwards a model-supplied resolution", () => {
28
- const sanitized = sanitizeTagInputRequest({
29
- mode: "create",
30
- tagType: "clarity",
31
- resolution: { status: "submitted", forged: true },
32
- });
33
- expect("resolution" in sanitized && sanitized.resolution !== undefined).toBe(false);
34
- });
35
- it("leaves unknown tag types untouched (backend validates)", () => {
36
- const sanitized = sanitizeTagInputRequest({
37
- mode: "create",
38
- tagType: "not-a-type",
39
- prefilledConfig: { anything: "goes" },
40
- });
41
- expect(sanitized.prefilledConfig).toEqual({ anything: "goes" });
42
- });
43
- });
44
- describe("parseTagInputResult", () => {
45
- it("accepts a submitted result", () => {
46
- expect(parseTagInputResult({
47
- status: "submitted",
48
- ref: "tag_temp_x",
49
- type: "meta",
50
- identifier: { pixelId: "123" },
51
- secretFieldsSet: ["accessToken"],
52
- })).toMatchObject({ status: "submitted", ref: "tag_temp_x" });
53
- });
54
- it("accepts a declined result", () => {
55
- expect(parseTagInputResult({ status: "declined", reason: "skipped" })).toEqual({
56
- status: "declined",
57
- reason: "skipped",
58
- });
59
- });
60
- it("rejects malformed payloads", () => {
61
- expect(parseTagInputResult({ status: "submitted" })).toBeNull();
62
- expect(parseTagInputResult("nope")).toBeNull();
63
- expect(parseTagInputResult(null)).toBeNull();
64
- });
65
- });
66
- //# sourceMappingURL=tag-input.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tag-input.test.js","sourceRoot":"","sources":["../../src/hono/tag-input.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAE9E,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,EAAE,CAAC,8EAA8E,EAAE,GAAG,EAAE;QACtF,MAAM,SAAS,GAAG,uBAAuB,CAAC;YACxC,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,MAAM;YACf,eAAe,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE;SAC9D,CAAC,CAAC;QACH,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;QAC9D,MAAM,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;QACjE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yEAAyE,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AAE,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACpC,MAAM,CACJ,mBAAmB,CAAC;YAClB,MAAM,EAAE,WAAW;YACnB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,MAAM;YACZ,UAAU,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;YAC9B,eAAe,EAAE,CAAC,aAAa,CAAC;SACjC,CAAC,CACH,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,YAAY,EAAE,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACnC,MAAM,CAAC,mBAAmB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;YAC7E,MAAM,EAAE,UAAU;YAClB,MAAM,EAAE,SAAS;SAClB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACpC,MAAM,CAAC,mBAAmB,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QAChE,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC/C,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,36 +0,0 @@
1
- import type { OutputFormat, SDKMessage } from "@anthropic-ai/claude-agent-sdk";
2
- import type { ChatChange } from "./chat-change.ts";
3
- import type { CurrentReference } from "./types.ts";
4
- declare function turnResultOutputFormat(): OutputFormat;
5
- export interface GoogleAdsRsaAssets {
6
- headlines: string[];
7
- descriptions: string[];
8
- }
9
- export interface NormalizedOutputGuards {
10
- googleAdsRsa?: {
11
- assets: GoogleAdsRsaAssets;
12
- };
13
- }
14
- export interface NormalizedTurnResult {
15
- changes: ChatChange[];
16
- outputGuards?: NormalizedOutputGuards;
17
- }
18
- type TurnResultCallbackPayload = {
19
- turnResult?: {
20
- changes: ChatChange[];
21
- };
22
- };
23
- declare function normalizeTurnResult(input: unknown): NormalizedTurnResult | null;
24
- declare function callbackPayload(turnResult: NormalizedTurnResult | null | undefined, isError: boolean): TurnResultCallbackPayload;
25
- declare function appendCurrentChangesContext(prompt: string, currentChanges: ChatChange[] | undefined): string;
26
- declare function appendCurrentReferenceContext(prompt: string, currentReference: CurrentReference | undefined): string;
27
- export declare const TurnResultIntake: {
28
- readonly outputFormat: typeof turnResultOutputFormat;
29
- readonly appendCurrentChangesContext: typeof appendCurrentChangesContext;
30
- readonly appendCurrentReferenceContext: typeof appendCurrentReferenceContext;
31
- readonly fromStructuredOutput: typeof normalizeTurnResult;
32
- readonly fromSdkMessage: (message: SDKMessage) => NormalizedTurnResult | null;
33
- readonly callbackPayload: typeof callbackPayload;
34
- };
35
- export {};
36
- //# sourceMappingURL=turn-result.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"turn-result.d.ts","sourceRoot":"","sources":["../../src/hono/turn-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,KAAK,EAA4B,UAAU,EAAgC,MAAM,kBAAkB,CAAC;AAQ3G,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,iBAAS,sBAAsB,IAAI,YAAY,CAmD9C;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,sBAA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