@copilotkit/mcp-apps-renderer 2.0.0-rc.5 → 2.0.0-rc.51
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/README.md +2 -3
- package/dist/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/activity.cjs +6 -0
- package/dist/activity.d.cts +2 -1
- package/dist/activity.d.mts +2 -1
- package/dist/activity.mjs +2 -1
- package/dist/activity.umd.js +369 -35
- package/dist/activity.umd.js.map +1 -1
- package/dist/content-schema.cjs +37 -35
- package/dist/content-schema.cjs.map +1 -1
- package/dist/content-schema.d.cts +40 -3309
- package/dist/content-schema.d.cts.map +1 -1
- package/dist/content-schema.d.mts +40 -3309
- package/dist/content-schema.d.mts.map +1 -1
- package/dist/content-schema.mjs +2 -2
- package/dist/content-schema.mjs.map +1 -1
- package/dist/host.cjs +246 -0
- package/dist/host.cjs.map +1 -0
- package/dist/host.d.cts +99 -0
- package/dist/host.d.cts.map +1 -0
- package/dist/host.d.mts +99 -0
- package/dist/host.d.mts.map +1 -0
- package/dist/host.mjs +241 -0
- package/dist/host.mjs.map +1 -0
- package/dist/request-queue.mjs.map +1 -1
- package/dist/session.d.cts +172 -0
- package/dist/session.d.cts.map +1 -0
- package/dist/session.d.mts +1 -58
- package/dist/session.d.mts.map +1 -1
- package/dist/session.mjs +2 -2
- package/dist/session.mjs.map +1 -1
- package/package.json +17 -8
package/dist/content-schema.cjs
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
1
2
|
let zod = require("zod");
|
|
3
|
+
zod = require_runtime.__toESM(zod);
|
|
2
4
|
|
|
3
5
|
//#region src/content-schema.ts
|
|
4
|
-
const looseObject = (shape) => zod.
|
|
5
|
-
const metaSchema = zod.
|
|
6
|
+
const looseObject = (shape) => zod.object(shape).loose();
|
|
7
|
+
const metaSchema = zod.record(zod.string(), zod.unknown());
|
|
6
8
|
const annotationsSchema = looseObject({
|
|
7
|
-
audience: zod.
|
|
8
|
-
priority: zod.
|
|
9
|
-
lastModified: zod.
|
|
9
|
+
audience: zod.array(zod.enum(["user", "assistant"])).optional(),
|
|
10
|
+
priority: zod.number().min(0).max(1).optional(),
|
|
11
|
+
lastModified: zod.string().optional()
|
|
10
12
|
});
|
|
11
|
-
const base64Schema = zod.
|
|
13
|
+
const base64Schema = zod.string().refine((value) => {
|
|
12
14
|
try {
|
|
13
15
|
atob(value);
|
|
14
16
|
return true;
|
|
@@ -16,69 +18,69 @@ const base64Schema = zod.z.string().refine((value) => {
|
|
|
16
18
|
return false;
|
|
17
19
|
}
|
|
18
20
|
}, "Expected base64-encoded data");
|
|
19
|
-
const resourceContentsSchema = zod.
|
|
20
|
-
uri: zod.
|
|
21
|
-
mimeType: zod.
|
|
22
|
-
text: zod.
|
|
21
|
+
const resourceContentsSchema = zod.union([looseObject({
|
|
22
|
+
uri: zod.string(),
|
|
23
|
+
mimeType: zod.string().optional(),
|
|
24
|
+
text: zod.string(),
|
|
23
25
|
_meta: metaSchema.optional()
|
|
24
26
|
}), looseObject({
|
|
25
|
-
uri: zod.
|
|
26
|
-
mimeType: zod.
|
|
27
|
+
uri: zod.string(),
|
|
28
|
+
mimeType: zod.string().optional(),
|
|
27
29
|
blob: base64Schema,
|
|
28
30
|
_meta: metaSchema.optional()
|
|
29
31
|
})]);
|
|
30
|
-
const contentItemSchema = zod.
|
|
32
|
+
const contentItemSchema = zod.discriminatedUnion("type", [
|
|
31
33
|
looseObject({
|
|
32
|
-
type: zod.
|
|
33
|
-
text: zod.
|
|
34
|
+
type: zod.literal("text"),
|
|
35
|
+
text: zod.string(),
|
|
34
36
|
annotations: annotationsSchema.optional(),
|
|
35
37
|
_meta: metaSchema.optional()
|
|
36
38
|
}),
|
|
37
39
|
looseObject({
|
|
38
|
-
type: zod.
|
|
40
|
+
type: zod.literal("image"),
|
|
39
41
|
data: base64Schema,
|
|
40
|
-
mimeType: zod.
|
|
42
|
+
mimeType: zod.string(),
|
|
41
43
|
annotations: annotationsSchema.optional(),
|
|
42
44
|
_meta: metaSchema.optional()
|
|
43
45
|
}),
|
|
44
46
|
looseObject({
|
|
45
|
-
type: zod.
|
|
47
|
+
type: zod.literal("audio"),
|
|
46
48
|
data: base64Schema,
|
|
47
|
-
mimeType: zod.
|
|
49
|
+
mimeType: zod.string(),
|
|
48
50
|
annotations: annotationsSchema.optional(),
|
|
49
51
|
_meta: metaSchema.optional()
|
|
50
52
|
}),
|
|
51
53
|
looseObject({
|
|
52
|
-
type: zod.
|
|
54
|
+
type: zod.literal("resource"),
|
|
53
55
|
resource: resourceContentsSchema,
|
|
54
56
|
annotations: annotationsSchema.optional(),
|
|
55
57
|
_meta: metaSchema.optional()
|
|
56
58
|
}),
|
|
57
59
|
looseObject({
|
|
58
|
-
type: zod.
|
|
59
|
-
uri: zod.
|
|
60
|
-
name: zod.
|
|
61
|
-
title: zod.
|
|
62
|
-
description: zod.
|
|
63
|
-
mimeType: zod.
|
|
64
|
-
size: zod.
|
|
60
|
+
type: zod.literal("resource_link"),
|
|
61
|
+
uri: zod.string(),
|
|
62
|
+
name: zod.string(),
|
|
63
|
+
title: zod.string().optional(),
|
|
64
|
+
description: zod.string().optional(),
|
|
65
|
+
mimeType: zod.string().optional(),
|
|
66
|
+
size: zod.number().optional(),
|
|
65
67
|
annotations: annotationsSchema.optional(),
|
|
66
68
|
_meta: metaSchema.optional()
|
|
67
69
|
})
|
|
68
70
|
]);
|
|
69
71
|
const callToolResultSchema = looseObject({
|
|
70
|
-
content: zod.
|
|
71
|
-
structuredContent: zod.
|
|
72
|
-
isError: zod.
|
|
73
|
-
_meta: zod.
|
|
72
|
+
content: zod.array(contentItemSchema).default([]),
|
|
73
|
+
structuredContent: zod.record(zod.string(), zod.unknown()).optional(),
|
|
74
|
+
isError: zod.boolean().optional(),
|
|
75
|
+
_meta: zod.record(zod.string(), zod.unknown()).optional()
|
|
74
76
|
});
|
|
75
77
|
/** Activity input accepts an omitted result.content; validation defaults it to []. */
|
|
76
78
|
const MCPAppsActivityContentSchema = looseObject({
|
|
77
79
|
result: callToolResultSchema,
|
|
78
|
-
resourceUri: zod.
|
|
79
|
-
serverHash: zod.
|
|
80
|
-
serverId: zod.
|
|
81
|
-
toolInput: zod.
|
|
80
|
+
resourceUri: zod.string(),
|
|
81
|
+
serverHash: zod.string(),
|
|
82
|
+
serverId: zod.string().optional(),
|
|
83
|
+
toolInput: zod.record(zod.string(), zod.unknown()).optional()
|
|
82
84
|
});
|
|
83
85
|
|
|
84
86
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-schema.cjs","names":["z"],"sources":["../src/content-schema.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"content-schema.cjs","names":["z"],"sources":["../src/content-schema.ts"],"sourcesContent":["import * as z from \"zod\";\n\n// Keep /activity bridge-free: the MCP SDK is only used as a test oracle.\n// This is the Angular host's content contract, expressed using our zod API.\nconst looseObject = <T extends z.ZodRawShape>(shape: T) =>\n z.object(shape).loose();\n\n// `_meta` is an extension channel, so its CONTENTS stay unconstrained - but the\n// SDK still requires it to be an object, and a string or array there is a bug\n// worth catching rather than forwarding.\nconst metaSchema = z.record(z.string(), z.unknown());\n\nconst annotationsSchema = looseObject({\n audience: z.array(z.enum([\"user\", \"assistant\"])).optional(),\n priority: z.number().min(0).max(1).optional(),\n lastModified: z.string().optional(),\n});\n\n// Validated by decoding, mirroring the MCP SDK's own base64 check, rather than\n// by pattern. The pattern this replaces additionally required canonical padding,\n// which the SDK does not: it accepts an unpadded payload that we rejected. Since\n// one bad block fails the whole content array, that cost the entire widget.\nconst base64Schema = z.string().refine((value) => {\n try {\n atob(value);\n return true;\n } catch {\n return false;\n }\n}, \"Expected base64-encoded data\");\n\nconst resourceContentsSchema = z.union([\n looseObject({\n uri: z.string(),\n mimeType: z.string().optional(),\n text: z.string(),\n _meta: metaSchema.optional(),\n }),\n looseObject({\n uri: z.string(),\n mimeType: z.string().optional(),\n blob: base64Schema,\n _meta: metaSchema.optional(),\n }),\n]);\n\nconst contentItemSchema = z.discriminatedUnion(\"type\", [\n looseObject({\n type: z.literal(\"text\"),\n text: z.string(),\n annotations: annotationsSchema.optional(),\n _meta: metaSchema.optional(),\n }),\n looseObject({\n type: z.literal(\"image\"),\n data: base64Schema,\n mimeType: z.string(),\n annotations: annotationsSchema.optional(),\n _meta: metaSchema.optional(),\n }),\n looseObject({\n type: z.literal(\"audio\"),\n data: base64Schema,\n mimeType: z.string(),\n annotations: annotationsSchema.optional(),\n _meta: metaSchema.optional(),\n }),\n looseObject({\n type: z.literal(\"resource\"),\n resource: resourceContentsSchema,\n annotations: annotationsSchema.optional(),\n _meta: metaSchema.optional(),\n }),\n looseObject({\n type: z.literal(\"resource_link\"),\n uri: z.string(),\n name: z.string(),\n title: z.string().optional(),\n description: z.string().optional(),\n mimeType: z.string().optional(),\n size: z.number().optional(),\n annotations: annotationsSchema.optional(),\n _meta: metaSchema.optional(),\n }),\n]);\n\nconst callToolResultSchema = looseObject({\n content: z.array(contentItemSchema).default([]),\n structuredContent: z.record(z.string(), z.unknown()).optional(),\n isError: z.boolean().optional(),\n _meta: z.record(z.string(), z.unknown()).optional(),\n});\n\n/** Activity input accepts an omitted result.content; validation defaults it to []. */\nexport const MCPAppsActivityContentSchema = looseObject({\n result: callToolResultSchema,\n resourceUri: z.string(),\n serverHash: z.string(),\n serverId: z.string().optional(),\n toolInput: z.record(z.string(), z.unknown()).optional(),\n});\n\n// Keep the public input contract compatible with structured-only results.\n// Parsed output is normalized before it crosses the bridge.\nexport type MCPAppsActivityContent = z.input<\n typeof MCPAppsActivityContentSchema\n>;\n"],"mappings":";;;;;AAIA,MAAM,eAAwC,UAC5CA,IAAE,OAAO,MAAM,CAAC,OAAO;AAKzB,MAAM,aAAaA,IAAE,OAAOA,IAAE,QAAQ,EAAEA,IAAE,SAAS,CAAC;AAEpD,MAAM,oBAAoB,YAAY;CACpC,UAAUA,IAAE,M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