@lushly-dev/afd-server 2.2.1 → 2.4.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 (220) hide show
  1. package/README.md +468 -6
  2. package/dist/approval-crypto.d.ts +26 -4
  3. package/dist/approval-crypto.d.ts.map +1 -1
  4. package/dist/approval-crypto.js +90 -7
  5. package/dist/approval-crypto.js.map +1 -1
  6. package/dist/approval-relay.d.ts +5 -5
  7. package/dist/approval-relay.d.ts.map +1 -1
  8. package/dist/approval.d.ts +6 -1
  9. package/dist/approval.d.ts.map +1 -1
  10. package/dist/approval.js +43 -32
  11. package/dist/approval.js.map +1 -1
  12. package/dist/bootstrap/afd-context.d.ts +2 -27
  13. package/dist/bootstrap/afd-context.d.ts.map +1 -1
  14. package/dist/bootstrap/afd-context.js +6 -36
  15. package/dist/bootstrap/afd-context.js.map +1 -1
  16. package/dist/bootstrap/afd-help.d.ts +24 -2
  17. package/dist/bootstrap/afd-help.d.ts.map +1 -1
  18. package/dist/bootstrap/afd-help.js +17 -2
  19. package/dist/bootstrap/afd-help.js.map +1 -1
  20. package/dist/bootstrap/described-command.d.ts +1 -0
  21. package/dist/bootstrap/described-command.d.ts.map +1 -1
  22. package/dist/bootstrap/described-command.js.map +1 -1
  23. package/dist/bootstrap/registry.d.ts +13 -0
  24. package/dist/bootstrap/registry.d.ts.map +1 -1
  25. package/dist/bootstrap/registry.js +30 -1
  26. package/dist/bootstrap/registry.js.map +1 -1
  27. package/dist/command-allow.d.ts +31 -0
  28. package/dist/command-allow.d.ts.map +1 -0
  29. package/dist/command-allow.js +55 -0
  30. package/dist/command-allow.js.map +1 -0
  31. package/dist/command-names.d.ts +17 -0
  32. package/dist/command-names.d.ts.map +1 -1
  33. package/dist/command-names.js +55 -0
  34. package/dist/command-names.js.map +1 -1
  35. package/dist/command-routing.d.ts +10 -3
  36. package/dist/command-routing.d.ts.map +1 -1
  37. package/dist/command-routing.js +18 -7
  38. package/dist/command-routing.js.map +1 -1
  39. package/dist/confirmation-gate.d.ts +32 -0
  40. package/dist/confirmation-gate.d.ts.map +1 -0
  41. package/dist/confirmation-gate.js +140 -0
  42. package/dist/confirmation-gate.js.map +1 -0
  43. package/dist/confirmations.d.ts +15 -23
  44. package/dist/confirmations.d.ts.map +1 -1
  45. package/dist/confirmations.js +8 -127
  46. package/dist/confirmations.js.map +1 -1
  47. package/dist/context-fields-describe.d.ts +18 -0
  48. package/dist/context-fields-describe.d.ts.map +1 -0
  49. package/dist/context-fields-describe.js +17 -0
  50. package/dist/context-fields-describe.js.map +1 -0
  51. package/dist/context-fields.d.ts +50 -0
  52. package/dist/context-fields.d.ts.map +1 -0
  53. package/dist/context-fields.js +146 -0
  54. package/dist/context-fields.js.map +1 -0
  55. package/dist/context-scope.d.ts +29 -2
  56. package/dist/context-scope.d.ts.map +1 -1
  57. package/dist/context-scope.js +37 -1
  58. package/dist/context-scope.js.map +1 -1
  59. package/dist/credentials.d.ts +17 -0
  60. package/dist/credentials.d.ts.map +1 -0
  61. package/dist/credentials.js +16 -0
  62. package/dist/credentials.js.map +1 -0
  63. package/dist/define-core.d.ts +213 -0
  64. package/dist/define-core.d.ts.map +1 -0
  65. package/dist/define-core.js +161 -0
  66. package/dist/define-core.js.map +1 -0
  67. package/dist/define.d.ts +13 -8
  68. package/dist/define.d.ts.map +1 -1
  69. package/dist/define.js +13 -8
  70. package/dist/define.js.map +1 -1
  71. package/dist/direct-registry.d.ts +154 -7
  72. package/dist/direct-registry.d.ts.map +1 -1
  73. package/dist/direct-registry.js +111 -13
  74. package/dist/direct-registry.js.map +1 -1
  75. package/dist/direct-tool-surface.d.ts +66 -0
  76. package/dist/direct-tool-surface.d.ts.map +1 -0
  77. package/dist/direct-tool-surface.js +162 -0
  78. package/dist/direct-tool-surface.js.map +1 -0
  79. package/dist/direct.d.ts +68 -0
  80. package/dist/direct.d.ts.map +1 -0
  81. package/dist/direct.js +66 -0
  82. package/dist/direct.js.map +1 -0
  83. package/dist/execution.d.ts +11 -1
  84. package/dist/execution.d.ts.map +1 -1
  85. package/dist/execution.js +18 -4
  86. package/dist/execution.js.map +1 -1
  87. package/dist/frontmatter.d.ts +16 -0
  88. package/dist/frontmatter.d.ts.map +1 -0
  89. package/dist/frontmatter.js +111 -0
  90. package/dist/frontmatter.js.map +1 -0
  91. package/dist/http-handler.d.ts +11 -2
  92. package/dist/http-handler.d.ts.map +1 -1
  93. package/dist/http-handler.js +46 -15
  94. package/dist/http-handler.js.map +1 -1
  95. package/dist/http-security.d.ts.map +1 -1
  96. package/dist/http-security.js.map +1 -1
  97. package/dist/http-sessions.d.ts +12 -4
  98. package/dist/http-sessions.d.ts.map +1 -1
  99. package/dist/http-sessions.js +4 -4
  100. package/dist/http-sessions.js.map +1 -1
  101. package/dist/http-sse.js.map +1 -1
  102. package/dist/index.d.ts +16 -4
  103. package/dist/index.d.ts.map +1 -1
  104. package/dist/index.js +20 -4
  105. package/dist/index.js.map +1 -1
  106. package/dist/issue-message.d.ts +20 -0
  107. package/dist/issue-message.d.ts.map +1 -0
  108. package/dist/issue-message.js +55 -0
  109. package/dist/issue-message.js.map +1 -0
  110. package/dist/journal-replay.d.ts +7 -0
  111. package/dist/journal-replay.d.ts.map +1 -1
  112. package/dist/journal-replay.js +18 -1
  113. package/dist/journal-replay.js.map +1 -1
  114. package/dist/journal.d.ts +9 -1
  115. package/dist/journal.d.ts.map +1 -1
  116. package/dist/journal.js +44 -1
  117. package/dist/journal.js.map +1 -1
  118. package/dist/json-rpc.d.ts +2 -2
  119. package/dist/json-rpc.d.ts.map +1 -1
  120. package/dist/json-rpc.js.map +1 -1
  121. package/dist/json-schema.d.ts +30 -0
  122. package/dist/json-schema.d.ts.map +1 -0
  123. package/dist/json-schema.js +25 -0
  124. package/dist/json-schema.js.map +1 -0
  125. package/dist/lazy-tools.d.ts +3 -0
  126. package/dist/lazy-tools.d.ts.map +1 -1
  127. package/dist/lazy-tools.js +2 -0
  128. package/dist/lazy-tools.js.map +1 -1
  129. package/dist/mcp-auth-bearer.d.ts +23 -0
  130. package/dist/mcp-auth-bearer.d.ts.map +1 -0
  131. package/dist/mcp-auth-bearer.js +50 -0
  132. package/dist/mcp-auth-bearer.js.map +1 -0
  133. package/dist/mcp-auth-jwt.d.ts +178 -0
  134. package/dist/mcp-auth-jwt.d.ts.map +1 -0
  135. package/dist/mcp-auth-jwt.js +365 -0
  136. package/dist/mcp-auth-jwt.js.map +1 -0
  137. package/dist/mcp-auth-resource.d.ts +74 -0
  138. package/dist/mcp-auth-resource.d.ts.map +1 -0
  139. package/dist/mcp-auth-resource.js +196 -0
  140. package/dist/mcp-auth-resource.js.map +1 -0
  141. package/dist/mcp-auth-rules.d.ts +135 -0
  142. package/dist/mcp-auth-rules.d.ts.map +1 -0
  143. package/dist/mcp-auth-rules.js +306 -0
  144. package/dist/mcp-auth-rules.js.map +1 -0
  145. package/dist/mcp-auth.d.ts +81 -0
  146. package/dist/mcp-auth.d.ts.map +1 -0
  147. package/dist/mcp-auth.js +256 -0
  148. package/dist/mcp-auth.js.map +1 -0
  149. package/dist/mcp-modern.d.ts +29 -5
  150. package/dist/mcp-modern.d.ts.map +1 -1
  151. package/dist/mcp-modern.js +99 -19
  152. package/dist/mcp-modern.js.map +1 -1
  153. package/dist/meta-argument.d.ts +42 -0
  154. package/dist/meta-argument.d.ts.map +1 -0
  155. package/dist/meta-argument.js +102 -0
  156. package/dist/meta-argument.js.map +1 -0
  157. package/dist/meta-keys.d.ts +29 -0
  158. package/dist/meta-keys.d.ts.map +1 -0
  159. package/dist/meta-keys.js +90 -0
  160. package/dist/meta-keys.js.map +1 -0
  161. package/dist/meta-tools.d.ts +8 -1
  162. package/dist/meta-tools.d.ts.map +1 -1
  163. package/dist/meta-tools.js +17 -7
  164. package/dist/meta-tools.js.map +1 -1
  165. package/dist/middleware.d.ts.map +1 -1
  166. package/dist/middleware.js +0 -1
  167. package/dist/middleware.js.map +1 -1
  168. package/dist/patterns.d.ts +46 -0
  169. package/dist/patterns.d.ts.map +1 -0
  170. package/dist/patterns.js +38 -0
  171. package/dist/patterns.js.map +1 -0
  172. package/dist/principal-binding.d.ts +42 -0
  173. package/dist/principal-binding.d.ts.map +1 -0
  174. package/dist/principal-binding.js +70 -0
  175. package/dist/principal-binding.js.map +1 -0
  176. package/dist/request-context.d.ts +7 -1
  177. package/dist/request-context.d.ts.map +1 -1
  178. package/dist/request-context.js +14 -3
  179. package/dist/request-context.js.map +1 -1
  180. package/dist/resources.d.ts +122 -0
  181. package/dist/resources.d.ts.map +1 -0
  182. package/dist/resources.js +256 -0
  183. package/dist/resources.js.map +1 -0
  184. package/dist/schema.d.ts +7 -171
  185. package/dist/schema.d.ts.map +1 -1
  186. package/dist/schema.js +10 -135
  187. package/dist/schema.js.map +1 -1
  188. package/dist/server-types.d.ts +94 -7
  189. package/dist/server-types.d.ts.map +1 -1
  190. package/dist/server-types.js +2 -0
  191. package/dist/server-types.js.map +1 -1
  192. package/dist/server.d.ts +2 -2
  193. package/dist/server.d.ts.map +1 -1
  194. package/dist/server.js +45 -31
  195. package/dist/server.js.map +1 -1
  196. package/dist/skills.d.ts +95 -0
  197. package/dist/skills.d.ts.map +1 -0
  198. package/dist/skills.js +340 -0
  199. package/dist/skills.js.map +1 -0
  200. package/dist/strict-json.d.ts +17 -0
  201. package/dist/strict-json.d.ts.map +1 -0
  202. package/dist/strict-json.js +93 -0
  203. package/dist/strict-json.js.map +1 -0
  204. package/dist/tool-router.d.ts +13 -1
  205. package/dist/tool-router.d.ts.map +1 -1
  206. package/dist/tool-router.js +44 -10
  207. package/dist/tool-router.js.map +1 -1
  208. package/dist/tools.d.ts +10 -5
  209. package/dist/tools.d.ts.map +1 -1
  210. package/dist/tools.js +48 -22
  211. package/dist/tools.js.map +1 -1
  212. package/dist/validation.d.ts +6 -45
  213. package/dist/validation.d.ts.map +1 -1
  214. package/dist/validation.js +25 -58
  215. package/dist/validation.js.map +1 -1
  216. package/dist/verified-credentials.d.ts +34 -0
  217. package/dist/verified-credentials.d.ts.map +1 -0
  218. package/dist/verified-credentials.js +51 -0
  219. package/dist/verified-credentials.js.map +1 -0
  220. package/package.json +18 -6
@@ -1 +1 @@
1
- {"version":3,"file":"request-context.js","sourceRoot":"","sources":["../src/request-context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,wFAAwF;AACxF,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;AAEjF,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACtE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACzC,aAA+C,EAC/C,GAAoB;IAEpB,MAAM,KAAK,GAAY,aAAa,CAAC,CAAC,CAAC,MAAM,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACrE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IAC7E,OAAO,MAAM,CAAC,WAAW,CACxB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,qBAAqB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CACxE,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"request-context.js","sourceRoot":"","sources":["../src/request-context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAIjD,wFAAwF;AACxF,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;AAEjF,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACtE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACzC,aAA+C,EAC/C,GAAoB,EACpB,WAAyB;IAEzB,MAAM,KAAK,GAAY,aAAa;QACnC,CAAC,CAAC,MAAM,aAAa,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,CAAC,CAAC,EAAE,CAAC;IACN,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IAC7E,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAChC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,qBAAqB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CACxE,CAAC;IACF,IAAI,CAAC,WAAW;QAAE,OAAO,MAAM,CAAC;IAChC,OAAO,EAAE,GAAG,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,gBAAgB,CAAC,WAAW,CAAC,EAAE,CAAC;AACzF,CAAC"}
@@ -0,0 +1,122 @@
1
+ /**
2
+ * @fileoverview MCP resources and the Skills extension's methods (`spec/mcp-resources.md`).
3
+ *
4
+ * A server given `resources` serves a {@link ResourceProvider}'s entries; one given `skills`
5
+ * serves a {@link SkillCatalog} through `skills/list`, `skills/get` and the skill files as
6
+ * resources. A server given either declares the `resources` capability (never `subscribe` or
7
+ * `listChanged`: AFD servers push nothing), and one given a catalog also declares
8
+ * `io.modelcontextprotocol/skills`.
9
+ *
10
+ * A read runs no command, middleware, confirmation, approval or journal entry, and
11
+ * `createContext` does not run for it; failures are JSON-RPC errors, never `CommandResult`s. An
12
+ * unknown URI is `-32602` with `data.uri` on both MCP eras.
13
+ */
14
+ import { ProtocolError, type Server } from '@modelcontextprotocol/server';
15
+ import { type SkillCatalog } from './skills.js';
16
+ /** The MIME type MCP Apps requires of a `ui://` resource. */
17
+ export declare const MCP_APP_MIME_TYPE = "text/html;profile=mcp-app";
18
+ /**
19
+ * One item of `resources/list` (`spec/mcp-resources.md`, R2).
20
+ *
21
+ * The server checks the entries when it is built and each time it lists them, and refuses the
22
+ * whole list with `-32603` when one breaks a rule.
23
+ */
24
+ export interface ResourceEntry {
25
+ /** An absolute URI with a scheme and no whitespace or control character, unique in the server. */
26
+ uri: string;
27
+ /** Non-empty. */
28
+ name: string;
29
+ title?: string;
30
+ description?: string;
31
+ icons?: unknown[];
32
+ annotations?: Record<string, unknown>;
33
+ /** SHOULD be set. A `ui://` entry needs {@link MCP_APP_MIME_TYPE}. */
34
+ mimeType?: string;
35
+ /**
36
+ * The length in bytes of what a read returns. Filled in from `content` when that is given; when
37
+ * both are, they must agree.
38
+ */
39
+ size?: number;
40
+ /**
41
+ * Extra `_meta` entries under the key rule (T2), where `ui` is not allowed. The server adds
42
+ * `dev.afd/digest` for an entry with `content`.
43
+ */
44
+ _meta?: Record<string, unknown>;
45
+ /**
46
+ * The resource's bytes, when the provider has them up front: the server serves them, lists the
47
+ * `size` and sets `dev.afd/digest`. A string is stored as UTF-8. Without it, a read calls
48
+ * {@link ResourceProvider.read}.
49
+ */
50
+ content?: string | Uint8Array;
51
+ }
52
+ /** What {@link ResourceProvider.read} returns: the bytes of one resource. */
53
+ export interface ResourceContents {
54
+ /** Sent as `text` when valid UTF-8, otherwise as `blob` (standard base64). */
55
+ content: string | Uint8Array;
56
+ /** Used only when the resource has no listed entry (the entry's is used otherwise). */
57
+ mimeType?: string;
58
+ /**
59
+ * `_meta` of the content item under the key rule, where `ui` is allowed so an MCP Apps view can
60
+ * carry its `_meta.ui` (`csp`, `permissions`, `domain`, `prefersBorder`).
61
+ */
62
+ _meta?: Record<string, unknown>;
63
+ }
64
+ /**
65
+ * What a server is given to serve resources (`spec/mcp-resources.md`, "Terms").
66
+ *
67
+ * `list` is called each time the server lists, so a provider may change its entries while the
68
+ * server runs; the list MUST NOT vary by caller, connection or context, and an AFD provider is
69
+ * given no request input. An entry with `content` is served by the server; any other is read
70
+ * through `read`.
71
+ */
72
+ export interface ResourceProvider {
73
+ /** The entries, in the order `resources/list` returns them. */
74
+ list(): readonly ResourceEntry[];
75
+ /**
76
+ * The content at `uri`, or `undefined` when the provider serves nothing there (`-32602`). A
77
+ * server MAY serve a URI it does not list, so this is called for every URI that is not a skill
78
+ * file and not an entry with `content`. A throw is `-32603`, reported to `onError`.
79
+ */
80
+ read?(uri: string): ResourceContents | undefined | Promise<ResourceContents | undefined>;
81
+ }
82
+ /** What `createMcpServer` and `createMcpHandler` take as `resources`: a provider, or static entries. */
83
+ export type ResourcesOption = ResourceProvider | readonly ResourceEntry[];
84
+ /** Check a provider's entries against R2. @throws An error naming the entry. */
85
+ export declare function checkEntries(entries: readonly ResourceEntry[]): void;
86
+ /** What a server serves beyond tools. */
87
+ export interface ResourceService {
88
+ /** The capabilities to declare in `server/discover` and `initialize` (R1, S1). */
89
+ readonly capabilities: Record<string, unknown>;
90
+ /** Install the handlers on one `Server` instance. */
91
+ install(server: Server, options: ResourceServing): void;
92
+ }
93
+ /** How one `Server` instance serves resources. */
94
+ export interface ResourceServing {
95
+ /** Whether the instance serves MCP 2026-07-28 (cache fields on results). */
96
+ modern: boolean;
97
+ /** The error a failure while serving becomes (`-32603`, reported to `onError`). */
98
+ internalError(error: unknown): ProtocolError;
99
+ }
100
+ /**
101
+ * Build the resource service, or `undefined` when the server was given neither a provider nor a
102
+ * catalog.
103
+ *
104
+ * @throws An error naming the entry, when the provider's entries break a rule of R2.
105
+ */
106
+ export declare function createResourceService(option: ResourcesOption | undefined, skills: SkillCatalog | undefined, ttlMs: number): ResourceService | undefined;
107
+ /** The cache hints the SDK applies to the standard resource results of a modern-era server. */
108
+ export declare function resourceCacheHints(ttlMs: number): {
109
+ readonly 'resources/list': {
110
+ readonly ttlMs: number;
111
+ readonly cacheScope: 'public';
112
+ };
113
+ readonly 'resources/templates/list': {
114
+ readonly ttlMs: number;
115
+ readonly cacheScope: 'public';
116
+ };
117
+ readonly 'resources/read': {
118
+ readonly ttlMs: number;
119
+ readonly cacheScope: 'public';
120
+ };
121
+ };
122
+ //# sourceMappingURL=resources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../src/resources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,EAAqB,KAAK,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAG7F,OAAO,EAAwC,KAAK,YAAY,EAAgB,MAAM,aAAa,CAAC;AAEpG,6DAA6D;AAC7D,eAAO,MAAM,iBAAiB,8BAA8B,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC7B,kGAAkG;IAClG,GAAG,EAAE,MAAM,CAAC;IACZ,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;CAC9B;AAED,6EAA6E;AAC7E,MAAM,WAAW,gBAAgB;IA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gBAAgB;;6BAFiB,QAAQ;;aAGzC,0BAA0B;;;;aAC1B,gBAAgB;;;;EAEjB"}
@@ -0,0 +1,256 @@
1
+ /**
2
+ * @fileoverview MCP resources and the Skills extension's methods (`spec/mcp-resources.md`).
3
+ *
4
+ * A server given `resources` serves a {@link ResourceProvider}'s entries; one given `skills`
5
+ * serves a {@link SkillCatalog} through `skills/list`, `skills/get` and the skill files as
6
+ * resources. A server given either declares the `resources` capability (never `subscribe` or
7
+ * `listChanged`: AFD servers push nothing), and one given a catalog also declares
8
+ * `io.modelcontextprotocol/skills`.
9
+ *
10
+ * A read runs no command, middleware, confirmation, approval or journal entry, and
11
+ * `createContext` does not run for it; failures are JSON-RPC errors, never `CommandResult`s. An
12
+ * unknown URI is `-32602` with `data.uri` on both MCP eras.
13
+ */
14
+ import { ProtocolError, ProtocolErrorCode } from '@modelcontextprotocol/server';
15
+ import { z } from 'zod';
16
+ import { checkMetaEntry } from './meta-keys.js';
17
+ import { DIGEST_META_KEY, SKILLS_EXTENSION_ID, sha256Digest } from './skills.js';
18
+ /** The MIME type MCP Apps requires of a `ui://` resource. */
19
+ export const MCP_APP_MIME_TYPE = 'text/html;profile=mcp-app';
20
+ const utf8 = new TextEncoder();
21
+ function bytesOf(content) {
22
+ return typeof content === 'string' ? utf8.encode(content) : content;
23
+ }
24
+ /** The scheme of an absolute URI, when `uri` has one that RFC 3986 allows and no whitespace or control character. */
25
+ function schemeOf(uri) {
26
+ const match = /^([A-Za-z][A-Za-z0-9+.-]*):(.*)$/su.exec(uri);
27
+ if (!match || /[\p{White_Space}\p{Cc}]/u.test(match[2]))
28
+ return undefined;
29
+ return match[1];
30
+ }
31
+ /** Check a provider's entries against R2. @throws An error naming the entry. */
32
+ export function checkEntries(entries) {
33
+ if (!Array.isArray(entries))
34
+ throw new Error('resources: list() must return an array of entries');
35
+ const seen = new Set();
36
+ for (const entry of entries) {
37
+ const uri = entry?.uri;
38
+ const fail = (rule) => new Error(`resource "${String(uri)}": ${rule}`);
39
+ if (typeof uri !== 'string')
40
+ throw fail('the uri must be a string');
41
+ const scheme = schemeOf(uri);
42
+ if (scheme === undefined)
43
+ throw fail('the uri must be an absolute URI with a scheme');
44
+ if (seen.has(uri))
45
+ throw fail('the uri is used by another entry');
46
+ seen.add(uri);
47
+ if (typeof entry.name !== 'string' || entry.name === '') {
48
+ throw fail('the name must not be empty');
49
+ }
50
+ for (const field of ['title', 'description', 'mimeType']) {
51
+ if (entry[field] !== undefined && typeof entry[field] !== 'string') {
52
+ throw fail(`${field} must be a string`);
53
+ }
54
+ }
55
+ if (entry.size !== undefined && !(Number.isSafeInteger(entry.size) && entry.size >= 0)) {
56
+ throw fail('the size must be a non-negative integer');
57
+ }
58
+ if (scheme.toLowerCase() === 'skill') {
59
+ throw fail('the skill:// scheme belongs to the skill catalog (the skills option)');
60
+ }
61
+ if (scheme.toLowerCase() === 'ui' && entry.mimeType !== MCP_APP_MIME_TYPE) {
62
+ throw fail(`a ui:// entry must have the mimeType ${MCP_APP_MIME_TYPE}`);
63
+ }
64
+ if (entry._meta !== undefined) {
65
+ if (entry._meta === null || typeof entry._meta !== 'object' || Array.isArray(entry._meta)) {
66
+ throw fail('_meta must be an object');
67
+ }
68
+ for (const [key, value] of Object.entries(entry._meta)) {
69
+ const reason = checkMetaEntry(key, value, false);
70
+ if (reason)
71
+ throw fail(reason);
72
+ }
73
+ }
74
+ if (entry.content !== undefined) {
75
+ if (typeof entry.content !== 'string' && !(entry.content instanceof Uint8Array)) {
76
+ throw fail('content must be a string or a Uint8Array');
77
+ }
78
+ if (entry.size !== undefined && entry.size !== bytesOf(entry.content).length) {
79
+ throw fail("the size must equal the length of the content's bytes");
80
+ }
81
+ }
82
+ }
83
+ }
84
+ /** One `contents` item: `text` when the bytes are valid UTF-8, otherwise `blob`. */
85
+ function contentItem(uri, mimeType, bytes, meta) {
86
+ const item = { uri };
87
+ if (mimeType !== undefined)
88
+ item.mimeType = mimeType;
89
+ try {
90
+ item.text = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(bytes);
91
+ }
92
+ catch {
93
+ item.blob = Buffer.from(bytes).toString('base64');
94
+ }
95
+ if (meta && Object.keys(meta).length > 0)
96
+ item._meta = meta;
97
+ return item;
98
+ }
99
+ /** The `resources/list` item of an entry: its fields, the size and digest of its bytes, and `_meta`. */
100
+ function listItem(entry) {
101
+ const bytes = entry.content === undefined ? undefined : bytesOf(entry.content);
102
+ const meta = {
103
+ ...entry._meta,
104
+ ...(bytes && { [DIGEST_META_KEY]: sha256Digest(bytes) }),
105
+ };
106
+ return {
107
+ uri: entry.uri,
108
+ name: entry.name,
109
+ ...(entry.title !== undefined && { title: entry.title }),
110
+ ...(entry.description !== undefined && { description: entry.description }),
111
+ ...(entry.icons !== undefined && { icons: entry.icons }),
112
+ ...(entry.annotations !== undefined && { annotations: entry.annotations }),
113
+ ...(entry.mimeType !== undefined && { mimeType: entry.mimeType }),
114
+ ...((bytes ?? entry.size) !== undefined && { size: bytes ? bytes.length : entry.size }),
115
+ ...(Object.keys(meta).length > 0 && { _meta: meta }),
116
+ };
117
+ }
118
+ function notFound(uri) {
119
+ return new ProtocolError(ProtocolErrorCode.InvalidParams, 'Resource not found', { uri });
120
+ }
121
+ function refuseCursor(cursor) {
122
+ if (cursor === undefined)
123
+ return;
124
+ throw new ProtocolError(ProtocolErrorCode.InvalidParams, 'This server returns one page and never issues a cursor');
125
+ }
126
+ /** The cache fields of a modern-era result (R3): the `tools/list` TTL option, `cacheScope: "public"`. */
127
+ function hints(modern, ttlMs) {
128
+ return modern ? { ttlMs, cacheScope: 'public' } : {};
129
+ }
130
+ /** Look up the provider's entries, checked again each time because a provider may change them. */
131
+ function providerOf(option) {
132
+ if (option === undefined)
133
+ return undefined;
134
+ if (Array.isArray(option)) {
135
+ const entries = [...option];
136
+ return { list: () => entries };
137
+ }
138
+ return option;
139
+ }
140
+ /**
141
+ * Build the resource service, or `undefined` when the server was given neither a provider nor a
142
+ * catalog.
143
+ *
144
+ * @throws An error naming the entry, when the provider's entries break a rule of R2.
145
+ */
146
+ export function createResourceService(option, skills, ttlMs) {
147
+ const provider = providerOf(option);
148
+ if (!provider && !skills)
149
+ return undefined;
150
+ if (provider && typeof provider.list !== 'function') {
151
+ throw new Error('resources: expected an array of entries or an object with list()');
152
+ }
153
+ if (provider)
154
+ checkEntries(provider.list());
155
+ const entriesOf = () => {
156
+ if (!provider)
157
+ return [];
158
+ const entries = provider.list();
159
+ checkEntries(entries);
160
+ return entries;
161
+ };
162
+ async function readItem(uri) {
163
+ const file = skills?.file(uri);
164
+ if (file)
165
+ return contentItem(uri, file.mimeType, file.bytes);
166
+ // The `skill://` scheme is the catalog's alone (R2): a provider is never asked for it.
167
+ if (!provider || schemeOf(uri)?.toLowerCase() === 'skill')
168
+ throw notFound(uri);
169
+ const entry = entriesOf().find((item) => item.uri === uri);
170
+ if (entry?.content !== undefined) {
171
+ return contentItem(uri, entry.mimeType, bytesOf(entry.content));
172
+ }
173
+ const contents = await provider.read?.(uri);
174
+ if (!contents)
175
+ throw notFound(uri);
176
+ if (contents._meta !== undefined) {
177
+ for (const [key, value] of Object.entries(contents._meta)) {
178
+ const reason = checkMetaEntry(key, value, true);
179
+ if (reason)
180
+ throw new Error(`resource "${uri}": ${reason}`);
181
+ }
182
+ }
183
+ const bytes = bytesOf(contents.content);
184
+ if (entry?.size !== undefined && entry.size !== bytes.length) {
185
+ throw new Error(`resource "${uri}": the listed size is ${entry.size} but the read returned ${bytes.length} bytes`);
186
+ }
187
+ return contentItem(uri, entry?.mimeType ?? contents.mimeType, bytes, contents._meta);
188
+ }
189
+ const uriParams = z.looseObject({ uri: z.string() });
190
+ const listParams = z.looseObject({ cursor: z.string().optional() });
191
+ return {
192
+ capabilities: {
193
+ resources: { subscribe: false, listChanged: false },
194
+ ...(skills && {
195
+ extensions: {
196
+ [SKILLS_EXTENSION_ID]: skills.directoryRead ? { directoryRead: true } : {},
197
+ },
198
+ }),
199
+ },
200
+ install(server, { modern, internalError }) {
201
+ const guarded = async (work) => {
202
+ try {
203
+ return await work();
204
+ }
205
+ catch (error) {
206
+ throw error instanceof ProtocolError ? error : internalError(error);
207
+ }
208
+ };
209
+ const complete = (result) => ({
210
+ ...result,
211
+ ...hints(modern, ttlMs),
212
+ });
213
+ server.setRequestHandler('resources/list', (request) => guarded(() => {
214
+ refuseCursor(request.params?.cursor);
215
+ return {
216
+ resources: [...entriesOf().map(listItem), ...(skills?.resources() ?? [])],
217
+ };
218
+ }));
219
+ server.setRequestHandler('resources/templates/list', (request) => guarded(() => {
220
+ refuseCursor(request.params?.cursor);
221
+ return { resourceTemplates: [] };
222
+ }));
223
+ server.setRequestHandler('resources/read', (request) => guarded(async () => ({ contents: [await readItem(request.params.uri)] })));
224
+ if (!skills)
225
+ return;
226
+ server.setRequestHandler('skills/list', { params: listParams }, (params) => guarded(() => {
227
+ refuseCursor(params.cursor);
228
+ return complete({ skills: skills.entries() });
229
+ }));
230
+ server.setRequestHandler('skills/get', { params: uriParams }, (params) => guarded(() => {
231
+ const entry = skills.entry(params.uri);
232
+ if (!entry)
233
+ throw notFound(params.uri);
234
+ return complete({ skill: entry });
235
+ }));
236
+ if (skills.directoryRead) {
237
+ server.setRequestHandler('resources/directory/read', { params: uriParams }, (params) => guarded(() => {
238
+ const children = skills.directory(params.uri);
239
+ if (!children)
240
+ throw notFound(params.uri);
241
+ return complete({ resources: children });
242
+ }));
243
+ }
244
+ },
245
+ };
246
+ }
247
+ /** The cache hints the SDK applies to the standard resource results of a modern-era server. */
248
+ export function resourceCacheHints(ttlMs) {
249
+ const hint = { ttlMs, cacheScope: 'public' };
250
+ return {
251
+ 'resources/list': hint,
252
+ 'resources/templates/list': hint,
253
+ 'resources/read': hint,
254
+ };
255
+ }
256
+ //# sourceMappingURL=resources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.js","sourceRoot":"","sources":["../src/resources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,EA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C,CAAC;YACnC,CAAC,CAAC,CACF,CAAC;YACF,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;gBAC1B,MAAM,CAAC,iBAAiB,CAAC,0BAA0B,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC,MAAM,EAAE,EAAE,CACtF,OAAO,CAAC,GAAG,EAAE;oBACZ,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;oBAC9C,IAAI,CAAC,QAAQ;wBAAE,MAAM,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;oBAC1C,OAAO,QAAQ,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;gBAC1C,CAAC,CAAC,CACF,CAAC;YACH,CAAC;QACF,CAAC;KACD,CAAC;AACH,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC/C,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAW,CAAC;IACtD,OAAO;QACN,gBAAgB,EAAE,IAAI;QACtB,0BAA0B,EAAE,IAAI;QAChC,gBAAgB,EAAE,IAAI;KACb,CAAC;AACZ,CAAC"}
package/dist/schema.d.ts CHANGED
@@ -4,148 +4,11 @@
4
4
  * This module provides utilities for defining commands using Zod schemas,
5
5
  * with automatic JSON Schema generation for MCP tool definitions.
6
6
  */
7
- import type { ApprovalPolicy, CommandContext, CommandDefinition, CommandExample, CommandParameter, CommandResult, ExposeOptions, JsonSchema } from '@lushly-dev/afd-core';
8
- import { type ZodType, z } from 'zod';
9
- /**
10
- * Options for defining a command with Zod schema.
11
- */
12
- export interface ZodCommandOptions<TInput extends ZodType, TOutput> {
13
- /** Unique command name in kebab-case (e.g., 'todo-create') */
14
- name: string;
15
- /** Human-readable description of what the command does */
16
- description: string;
17
- /** Zod schema for input validation */
18
- input: TInput;
19
- /**
20
- * Optional Zod schema describing the command's output data shape.
21
- * Used for agent introspection — not validated at runtime.
22
- * Describes the shape of `CommandResult.data`, not the full envelope.
23
- */
24
- output?: ZodType<TOutput>;
25
- /** Command handler function */
26
- handler: (input: z.infer<TInput>, context: CommandContext) => Promise<CommandResult<TOutput>>;
27
- /** Category for grouping related commands */
28
- category?: string;
29
- /** Whether this command performs side effects */
30
- mutation?: boolean;
31
- /** Command version for tracking changes */
32
- version?: string;
33
- /** Tags for additional categorization */
34
- tags?: string[];
35
- /** Commands that should be called before this one. Metadata only — not enforced at runtime. */
36
- requires?: string[];
37
- /** Estimated execution time category */
38
- executionTime?: 'instant' | 'fast' | 'slow' | 'long-running';
39
- /** Error codes this command may return */
40
- errors?: string[];
41
- /**
42
- * Whether this command returns a HandoffResult for protocol handoffs.
43
- * When true, the command will automatically be tagged with 'handoff'.
44
- */
45
- handoff?: boolean;
46
- /**
47
- * The specific handoff protocol this command uses (if handoff is true).
48
- * When specified, the command will also be tagged with 'handoff:{protocol}'.
49
- */
50
- handoffProtocol?: 'websocket' | 'webrtc' | 'sse' | 'http-stream' | string;
51
- /**
52
- * Whether this command performs destructive/irreversible actions.
53
- * When true, frontends SHOULD prompt for user confirmation before
54
- * applying the result locally.
55
- */
56
- destructive?: boolean;
57
- /**
58
- * Custom confirmation prompt message for destructive commands.
59
- * If not provided, frontends MAY use a generic confirmation message.
60
- * @example "Delete 'Buy groceries' permanently?"
61
- */
62
- confirmPrompt?: string;
63
- /**
64
- * Whether this command can be undone.
65
- * Implementation is consumer-specific; AFD only carries the flag.
66
- */
67
- undoable?: boolean;
68
- /**
69
- * Whether a call needs a human's approval before the handler runs: `'required'`,
70
- * `'not-required'` (the default), or a function of the validated input and context.
71
- * Enforced by `createApprovalMiddleware`; reported as `_meta.approval`.
72
- */
73
- approval?: ApprovalPolicy<z.infer<TInput>>;
74
- /**
75
- * Which interfaces this command is exposed to.
76
- * Controls visibility in command palette, MCP, agent, and CLI surfaces.
77
- * Defaults to `defaultExpose` if not specified.
78
- */
79
- expose?: ExposeOptions;
80
- /**
81
- * Concrete input examples to help agents construct valid payloads.
82
- * Each example is validated against the input schema at define-time.
83
- */
84
- examples?: CommandExample<z.input<TInput>>[];
85
- /**
86
- * Contexts this command belongs to. When context-based tool scoping is enabled,
87
- * only commands matching the active context (or commands without contexts) are visible.
88
- */
89
- contexts?: string[];
90
- }
91
- /**
92
- * A command definition that includes Zod schema for runtime validation.
93
- */
94
- export interface ZodCommandDefinition<TInput extends ZodType = ZodType, TOutput = unknown> {
95
- /** Unique command name */
96
- name: string;
97
- /** Human-readable description */
98
- description: string;
99
- /** Zod schema for input validation */
100
- inputSchema: TInput;
101
- /** JSON Schema representation (for MCP tools) */
102
- jsonSchema: JsonSchema;
103
- /** Command handler */
104
- handler: (input: z.infer<TInput>, context: CommandContext) => Promise<CommandResult<TOutput>>;
105
- /** Category for grouping */
106
- category?: string;
107
- /** Whether this is a mutation */
108
- mutation?: boolean;
109
- /** Command version */
110
- version?: string;
111
- /** Tags for categorization */
112
- tags?: string[];
113
- /** Commands that should be called before this one. Metadata only — not enforced at runtime. */
114
- requires?: string[];
115
- /** Execution time category */
116
- executionTime?: 'instant' | 'fast' | 'slow' | 'long-running';
117
- /** Possible error codes */
118
- errors?: string[];
119
- /** Whether this command returns a HandoffResult */
120
- handoff?: boolean;
121
- /** The specific handoff protocol this command uses */
122
- handoffProtocol?: 'websocket' | 'webrtc' | 'sse' | 'http-stream' | string;
123
- /** Whether this command is destructive (triggers confirmation UI) */
124
- destructive?: boolean;
125
- /** Custom confirmation prompt message */
126
- confirmPrompt?: string;
127
- /** Whether this command can be undone */
128
- undoable?: boolean;
129
- /** Pre-execution approval policy (enforced by `createApprovalMiddleware`) */
130
- approval?: ApprovalPolicy<z.infer<TInput>>;
131
- /**
132
- * Which interfaces this command is exposed to.
133
- * Controls visibility in command palette, MCP, agent, and CLI surfaces.
134
- */
135
- expose?: ExposeOptions;
136
- /** Concrete input examples validated against the input schema */
137
- examples?: CommandExample<z.input<TInput>>[];
138
- /** Zod schema for output validation (optional) */
139
- outputSchema?: ZodType;
140
- /** JSON Schema for the output data shape (derived from outputSchema) */
141
- outputJsonSchema?: JsonSchema;
142
- /** Contexts this command belongs to */
143
- contexts?: string[];
144
- /**
145
- * Convert to standard CommandDefinition format.
146
- */
147
- toCommandDefinition(): CommandDefinition<z.infer<TInput>, TOutput>;
148
- }
7
+ import type { ZodObject, ZodRawShape, ZodType } from 'zod';
8
+ import { type $ZodType } from 'zod/v4/core';
9
+ import { type ZodCommandDefinition, type ZodCommandOptions } from './define-core.js';
10
+ export { defineCommandWithSchema, jsonSchemaToParameters, type ZodCommandDefinition, type ZodCommandOptions, } from './define-core.js';
11
+ export { type ZodToJsonSchemaOptions, zodToJsonSchema } from './json-schema.js';
149
12
  /**
150
13
  * Define a command with Zod schema for type-safe input validation.
151
14
  *
@@ -171,40 +34,13 @@ export interface ZodCommandDefinition<TInput extends ZodType = ZodType, TOutput
171
34
  * ```
172
35
  */
173
36
  export declare function defineCommand<TInput extends ZodType, TOutput>(options: ZodCommandOptions<TInput, TOutput>): ZodCommandDefinition<TInput, TOutput>;
174
- /**
175
- * Options for {@link zodToJsonSchema}.
176
- */
177
- export interface ZodToJsonSchemaOptions {
178
- /**
179
- * Which side of the schema to describe.
180
- *
181
- * - `'input'` (default): what a caller may send. Fields with `.default()` are
182
- * optional, and `.transform()`/`.pipe()` are described by their input type.
183
- * Use this for command inputs and MCP tool `inputSchema`s.
184
- * - `'output'`: what parsing produces. Defaulted fields are required, and a
185
- * `.transform()` cannot be represented (Zod throws). Use this for output schemas.
186
- */
187
- io?: 'input' | 'output';
188
- }
189
- /**
190
- * Convert a Zod schema to JSON Schema (draft-7).
191
- *
192
- * @param schema - Zod schema to convert
193
- * @param options - Conversion options; `io` defaults to `'input'`
194
- * @returns JSON Schema representation
195
- */
196
- export declare function zodToJsonSchema(schema: ZodType, options?: ZodToJsonSchemaOptions): JsonSchema;
197
- /**
198
- * Convert JSON Schema to CommandParameter array for @lushly-dev/afd-core compatibility.
199
- */
200
- export declare function jsonSchemaToParameters(schema: JsonSchema): CommandParameter[];
201
37
  /**
202
38
  * Get the field names a caller must provide for a Zod object schema.
203
39
  * Fields with `.default()` or `.optional()` are not required.
204
40
  */
205
- export declare function getRequiredFields(schema: ZodType): string[];
41
+ export declare function getRequiredFields(schema: $ZodType): string[];
206
42
  /**
207
43
  * Check if a Zod schema represents an object type.
208
44
  */
209
- export declare function isObjectSchema(schema: ZodType): schema is z.ZodObject<z.ZodRawShape>;
45
+ export declare function isObjectSchema(schema: ZodType): schema is ZodObject<ZodRawShape>;
210
46
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACX,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,UAAU,EACV,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,KAAK,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMtC;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,MAAM,SAAS,OAAO,EAAE,OAAO;IACjE,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IAEb,0DAA0D;IAC1D,WAAW,EAAE,MAAM,CAAC;IAEpB,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAE1B,+BAA+B;IAC/B,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;IAE9F,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,OAAO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