managed-deepagents 0.5.0-dev.88 → 0.5.0-dev.90

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 (213) hide show
  1. package/README.md +2 -2
  2. package/dist/channels/index.d.ts +7 -6
  3. package/dist/channels/index.d.ts.map +1 -1
  4. package/dist/channels/index.js +6 -5
  5. package/dist/channels/index.js.map +1 -1
  6. package/dist/channels/manifest.d.ts +0 -30
  7. package/dist/channels/manifest.d.ts.map +1 -1
  8. package/dist/channels/messaging-registry.d.ts +8 -4
  9. package/dist/channels/messaging-registry.d.ts.map +1 -1
  10. package/dist/channels/messaging-registry.js +22 -16
  11. package/dist/channels/messaging-registry.js.map +1 -1
  12. package/dist/channels/registry-types.d.ts +1 -1
  13. package/dist/channels/registry.d.ts.map +1 -1
  14. package/dist/channels/registry.js +1 -3
  15. package/dist/channels/registry.js.map +1 -1
  16. package/dist/channels/schedule-delivery.js +1 -1
  17. package/dist/channels/schedule-delivery.js.map +1 -1
  18. package/dist/{connectors → channels}/slack/adapter-core.d.ts +1 -1
  19. package/dist/channels/slack/adapter-core.d.ts.map +1 -0
  20. package/dist/channels/slack/adapter-core.js.map +1 -0
  21. package/dist/{connectors → channels}/slack/adapter.d.ts +3 -3
  22. package/dist/channels/slack/adapter.d.ts.map +1 -0
  23. package/dist/{connectors → channels}/slack/adapter.js +0 -1
  24. package/dist/channels/slack/adapter.js.map +1 -0
  25. package/dist/{connectors → channels}/slack/http.d.ts +3 -3
  26. package/dist/channels/slack/http.d.ts.map +1 -0
  27. package/dist/{connectors → channels}/slack/http.js +6 -10
  28. package/dist/channels/slack/http.js.map +1 -0
  29. package/dist/channels/slack/index.d.ts +89 -0
  30. package/dist/channels/slack/index.d.ts.map +1 -0
  31. package/dist/channels/slack/index.js +148 -0
  32. package/dist/channels/slack/index.js.map +1 -0
  33. package/dist/{connectors → channels}/slack/normalize.d.ts +3 -4
  34. package/dist/channels/slack/normalize.d.ts.map +1 -0
  35. package/dist/{connectors → channels}/slack/normalize.js +1 -5
  36. package/dist/channels/slack/normalize.js.map +1 -0
  37. package/dist/channels/slack/source-thread.d.ts.map +1 -0
  38. package/dist/channels/slack/source-thread.js.map +1 -0
  39. package/dist/{connectors → channels}/slack/transport.d.ts +1 -1
  40. package/dist/channels/slack/transport.d.ts.map +1 -0
  41. package/dist/{connectors → channels}/slack/transport.js +1 -1
  42. package/dist/channels/slack/transport.js.map +1 -0
  43. package/dist/connectors/slack/index.d.ts +10 -94
  44. package/dist/connectors/slack/index.d.ts.map +1 -1
  45. package/dist/connectors/slack/index.js +25 -152
  46. package/dist/connectors/slack/index.js.map +1 -1
  47. package/dist/connectors/toolserver/catalog.d.ts +4 -10
  48. package/dist/connectors/toolserver/catalog.d.ts.map +1 -1
  49. package/dist/connectors/toolserver/catalog.js +6 -54
  50. package/dist/connectors/toolserver/catalog.js.map +1 -1
  51. package/dist/connectors/toolserver/index.d.ts +5 -7
  52. package/dist/connectors/toolserver/index.d.ts.map +1 -1
  53. package/dist/connectors/toolserver/index.js +4 -6
  54. package/dist/connectors/toolserver/index.js.map +1 -1
  55. package/dist/connectors/toolserver/integrations.d.ts +4 -4
  56. package/dist/connectors/toolserver/integrations.d.ts.map +1 -1
  57. package/dist/extension.d.ts +1 -1
  58. package/dist/extension.js +1 -1
  59. package/dist/identity/claims.d.ts +0 -2
  60. package/dist/identity/claims.d.ts.map +1 -1
  61. package/dist/identity/claims.js +0 -4
  62. package/dist/identity/claims.js.map +1 -1
  63. package/dist/identity/connect-inference.d.ts +6 -7
  64. package/dist/identity/connect-inference.d.ts.map +1 -1
  65. package/dist/identity/connect-inference.js +7 -9
  66. package/dist/identity/connect-inference.js.map +1 -1
  67. package/dist/identity/github/connect-http.d.ts +4 -4
  68. package/dist/identity/github/connect-http.js +4 -4
  69. package/dist/identity/github/index.d.ts +0 -2
  70. package/dist/identity/github/index.d.ts.map +1 -1
  71. package/dist/identity/github/index.js +0 -2
  72. package/dist/identity/github/index.js.map +1 -1
  73. package/dist/identity/index.d.ts +4 -4
  74. package/dist/identity/index.d.ts.map +1 -1
  75. package/dist/identity/index.js +27 -15
  76. package/dist/identity/index.js.map +1 -1
  77. package/dist/identity/memory-slices.d.ts +4 -7
  78. package/dist/identity/memory-slices.d.ts.map +1 -1
  79. package/dist/identity/memory-slices.js +27 -49
  80. package/dist/identity/memory-slices.js.map +1 -1
  81. package/dist/identity/options.d.ts +6 -26
  82. package/dist/identity/options.d.ts.map +1 -1
  83. package/dist/identity/options.js +22 -58
  84. package/dist/identity/options.js.map +1 -1
  85. package/dist/identity/slack/connect-http.d.ts +3 -1
  86. package/dist/identity/slack/connect-http.d.ts.map +1 -1
  87. package/dist/identity/slack/connect-http.js +3 -1
  88. package/dist/identity/slack/connect-http.js.map +1 -1
  89. package/dist/identity/slack/links.d.ts +2 -1
  90. package/dist/identity/slack/links.d.ts.map +1 -1
  91. package/dist/identity/slack/links.js +2 -1
  92. package/dist/identity/slack/links.js.map +1 -1
  93. package/dist/identity/types.d.ts +12 -60
  94. package/dist/identity/types.d.ts.map +1 -1
  95. package/dist/index.d.ts +5 -7
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.js +1 -1
  98. package/dist/index.js.map +1 -1
  99. package/dist/ingress/index.d.ts +0 -2
  100. package/dist/ingress/index.d.ts.map +1 -1
  101. package/dist/ingress/index.js +1 -6
  102. package/dist/ingress/index.js.map +1 -1
  103. package/dist/namespaces.d.ts +45 -83
  104. package/dist/namespaces.d.ts.map +1 -1
  105. package/dist/namespaces.js +12 -21
  106. package/dist/namespaces.js.map +1 -1
  107. package/dist/runtime/auth.d.ts +11 -13
  108. package/dist/runtime/auth.d.ts.map +1 -1
  109. package/dist/runtime/auth.js +29 -54
  110. package/dist/runtime/auth.js.map +1 -1
  111. package/dist/runtime/channel.d.ts +91 -0
  112. package/dist/runtime/channel.d.ts.map +1 -0
  113. package/dist/runtime/channel.js +98 -0
  114. package/dist/runtime/channel.js.map +1 -0
  115. package/dist/runtime/connector.d.ts +3 -3
  116. package/dist/runtime/connector.js +5 -1
  117. package/dist/runtime/connector.js.map +1 -1
  118. package/dist/runtime/cors.d.ts +1 -1
  119. package/dist/runtime/cors.d.ts.map +1 -1
  120. package/dist/runtime/cors.js +5 -1
  121. package/dist/runtime/cors.js.map +1 -1
  122. package/dist/runtime/credentials.d.ts +6 -6
  123. package/dist/runtime/credentials.js +8 -10
  124. package/dist/runtime/credentials.js.map +1 -1
  125. package/dist/runtime/http.d.ts +1 -2
  126. package/dist/runtime/http.d.ts.map +1 -1
  127. package/dist/runtime/http.js +1 -2
  128. package/dist/runtime/http.js.map +1 -1
  129. package/dist/runtime/identity-http.d.ts +8 -3
  130. package/dist/runtime/identity-http.d.ts.map +1 -1
  131. package/dist/runtime/identity-http.js +50 -8
  132. package/dist/runtime/identity-http.js.map +1 -1
  133. package/dist/runtime/identity-runtime.d.ts +13 -13
  134. package/dist/runtime/identity-runtime.d.ts.map +1 -1
  135. package/dist/runtime/identity-runtime.js +14 -41
  136. package/dist/runtime/identity-runtime.js.map +1 -1
  137. package/dist/runtime/index.d.ts +2 -0
  138. package/dist/runtime/index.d.ts.map +1 -1
  139. package/dist/runtime/index.js +7 -5
  140. package/dist/runtime/index.js.map +1 -1
  141. package/dist/runtime/memory/lazy-context-backend.d.ts +2 -2
  142. package/dist/runtime/memory/lazy-context-backend.js +2 -2
  143. package/dist/runtime/memory/mounts.js +1 -1
  144. package/dist/runtime/memory/mounts.js.map +1 -1
  145. package/dist/runtime/memory/user-repo.d.ts.map +1 -1
  146. package/dist/runtime/memory/user-repo.js +3 -4
  147. package/dist/runtime/memory/user-repo.js.map +1 -1
  148. package/dist/runtime/types.d.ts +8 -0
  149. package/dist/runtime/types.d.ts.map +1 -1
  150. package/dist/runtime/validated-token.d.ts +1 -1
  151. package/dist/runtime/validated-token.d.ts.map +1 -1
  152. package/dist/runtime/validated-token.js +3 -16
  153. package/dist/runtime/validated-token.js.map +1 -1
  154. package/package.json +7 -7
  155. package/dist/connectors/github/adapter-core.d.ts +0 -15
  156. package/dist/connectors/github/adapter-core.d.ts.map +0 -1
  157. package/dist/connectors/github/adapter-core.js +0 -52
  158. package/dist/connectors/github/adapter-core.js.map +0 -1
  159. package/dist/connectors/github/define.d.ts +0 -168
  160. package/dist/connectors/github/define.d.ts.map +0 -1
  161. package/dist/connectors/github/define.js +0 -72
  162. package/dist/connectors/github/define.js.map +0 -1
  163. package/dist/connectors/github/http.d.ts +0 -25
  164. package/dist/connectors/github/http.d.ts.map +0 -1
  165. package/dist/connectors/github/http.js +0 -146
  166. package/dist/connectors/github/http.js.map +0 -1
  167. package/dist/connectors/github/index.d.ts +0 -121
  168. package/dist/connectors/github/index.d.ts.map +0 -1
  169. package/dist/connectors/github/index.js +0 -192
  170. package/dist/connectors/github/index.js.map +0 -1
  171. package/dist/connectors/github/match.d.ts +0 -20
  172. package/dist/connectors/github/match.d.ts.map +0 -1
  173. package/dist/connectors/github/match.js +0 -41
  174. package/dist/connectors/github/match.js.map +0 -1
  175. package/dist/connectors/github/normalize.d.ts +0 -32
  176. package/dist/connectors/github/normalize.d.ts.map +0 -1
  177. package/dist/connectors/github/normalize.js +0 -152
  178. package/dist/connectors/github/normalize.js.map +0 -1
  179. package/dist/connectors/github/sandbox.d.ts +0 -54
  180. package/dist/connectors/github/sandbox.d.ts.map +0 -1
  181. package/dist/connectors/github/sandbox.js +0 -532
  182. package/dist/connectors/github/sandbox.js.map +0 -1
  183. package/dist/connectors/github/source-thread.d.ts +0 -24
  184. package/dist/connectors/github/source-thread.d.ts.map +0 -1
  185. package/dist/connectors/github/source-thread.js +0 -54
  186. package/dist/connectors/github/source-thread.js.map +0 -1
  187. package/dist/connectors/github/transport.d.ts +0 -25
  188. package/dist/connectors/github/transport.d.ts.map +0 -1
  189. package/dist/connectors/github/transport.js +0 -106
  190. package/dist/connectors/github/transport.js.map +0 -1
  191. package/dist/connectors/langsmith/index.d.ts +0 -397
  192. package/dist/connectors/langsmith/index.d.ts.map +0 -1
  193. package/dist/connectors/langsmith/index.js +0 -436
  194. package/dist/connectors/langsmith/index.js.map +0 -1
  195. package/dist/connectors/langsmith/routes.d.ts +0 -236
  196. package/dist/connectors/langsmith/routes.d.ts.map +0 -1
  197. package/dist/connectors/langsmith/routes.js +0 -1173
  198. package/dist/connectors/langsmith/routes.js.map +0 -1
  199. package/dist/connectors/slack/adapter-core.d.ts.map +0 -1
  200. package/dist/connectors/slack/adapter-core.js.map +0 -1
  201. package/dist/connectors/slack/adapter.d.ts.map +0 -1
  202. package/dist/connectors/slack/adapter.js.map +0 -1
  203. package/dist/connectors/slack/http.d.ts.map +0 -1
  204. package/dist/connectors/slack/http.js.map +0 -1
  205. package/dist/connectors/slack/normalize.d.ts.map +0 -1
  206. package/dist/connectors/slack/normalize.js.map +0 -1
  207. package/dist/connectors/slack/source-thread.d.ts.map +0 -1
  208. package/dist/connectors/slack/source-thread.js.map +0 -1
  209. package/dist/connectors/slack/transport.d.ts.map +0 -1
  210. package/dist/connectors/slack/transport.js.map +0 -1
  211. /package/dist/{connectors → channels}/slack/adapter-core.js +0 -0
  212. /package/dist/{connectors → channels}/slack/source-thread.d.ts +0 -0
  213. /package/dist/{connectors → channels}/slack/source-thread.js +0 -0
@@ -1,168 +0,0 @@
1
- /**
2
- * GitHub App webhook event types and manifest helpers.
3
- *
4
- * Authoring lives on `connectors.github({ events: [...] })`. This module keeps
5
- * the shared event/handler types and JSON manifest helpers used by the
6
- * connector, HTTP adapter, and normalize/match path.
7
- *
8
- * MDA does **not** ship copies of GitHub webhook payload types. Prefer
9
- * [`@octokit/webhooks-types`](https://www.npmjs.com/package/@octokit/webhooks-types)
10
- * in the agent project and narrow {@link GitHubWebhookPromptEvent.payload}:
11
- *
12
- * @example
13
- * ```ts
14
- * import type { PullRequestOpenedEvent } from "@octokit/webhooks-types";
15
- *
16
- * prompt(event) {
17
- * const pr = event.payload as PullRequestOpenedEvent;
18
- * return `Review ${pr.pull_request.title}`;
19
- * }
20
- * ```
21
- */
22
- import type { ChannelManifestBody } from "../../channels/manifest.js";
23
- /**
24
- * GitHub webhook filter for a handler's {@link GitHubChannelHandler.on}.
25
- *
26
- * - `"pull_request"` — any action for that `X-GitHub-Event`
27
- * - `"pull_request.opened"` — event + `payload.action`
28
- * - `"*"` — every webhook delivery
29
- *
30
- * Any non-empty string is accepted; MDA does not maintain an event allowlist.
31
- */
32
- export type GitHubChannelTrigger = string;
33
- /**
34
- * Envelope passed to {@link GitHubChannelHandler.prompt}.
35
- *
36
- * Common routing fields are lifted for filters / auto-reply. The raw webhook
37
- * JSON stays on {@link GitHubWebhookPromptEvent.payload} as `unknown` so callers
38
- * can narrow with Octokit (or other) types without MDA duplicating schemas.
39
- */
40
- export interface GitHubWebhookPromptEvent {
41
- /**
42
- * `X-GitHub-Event` header value (e.g. `"pull_request"`, `"issues"`, `"push"`).
43
- */
44
- eventName: string;
45
- /**
46
- * `payload.action` when present (e.g. `"opened"`). Omitted for events without
47
- * an action field.
48
- */
49
- action?: string;
50
- /**
51
- * Convenience id: `eventName` or `eventName.action` when `action` is set.
52
- *
53
- * @example `"pull_request.opened"`
54
- */
55
- trigger: string;
56
- /** `X-GitHub-Delivery` header. */
57
- deliveryId: string;
58
- /** Repository full name (`owner/repo`) when the payload includes `repository`. */
59
- repository?: string;
60
- /** GitHub App installation id when present on the payload or env fallback. */
61
- installationId?: string;
62
- /**
63
- * Issue or pull request number when the payload includes one (used for
64
- * source-thread keys and auto-reply comments).
65
- */
66
- issueOrPullNumber?: number;
67
- /**
68
- * Verified webhook JSON body. Treat as `unknown` and narrow with
69
- * `@octokit/webhooks-types` (or equivalent) in the agent project.
70
- */
71
- payload: unknown;
72
- }
73
- /**
74
- * One webhook subscription inside `connectors.github({ events })`.
75
- *
76
- * Entries are matched in order: first whose `on` matches the webhook and whose
77
- * `repositories` allowlist (if set) includes the repo wins.
78
- */
79
- export interface GitHubChannelHandler {
80
- /**
81
- * Which deliveries this handler accepts.
82
- *
83
- * @see GitHubChannelTrigger
84
- */
85
- on: GitHubChannelTrigger;
86
- /**
87
- * Restrict this handler to these repositories (`owner/repo`).
88
- * Omit or leave empty to accept any repository (including payloads with no
89
- * `repository` field when the allowlist is omitted).
90
- */
91
- repositories?: readonly string[];
92
- /**
93
- * When `true` and the payload identifies an issue/PR (`owner/repo#N`), post
94
- * the agent’s final reply as an issue comment on that conversation. When
95
- * `false`, or when no issue/PR number can be resolved, the agent still runs
96
- * but no comment is posted.
97
- *
98
- * @default true
99
- */
100
- autoReply?: boolean;
101
- /**
102
- * Build the human message for the agent turn from the webhook envelope.
103
- *
104
- * Narrow `event.payload` with `@octokit/webhooks-types` in your project —
105
- * MDA does not vendor those schemas.
106
- */
107
- prompt: (event: GitHubWebhookPromptEvent) => string;
108
- }
109
- /**
110
- * Serializable event metadata embedded in the compile/deploy manifest.
111
- * Live `prompt` callbacks are not included — they come from the imported module.
112
- */
113
- export interface GitHubChannelHandlerManifest {
114
- /** Event filter (`event`, `event.action`, or `"*"`). */
115
- on: GitHubChannelTrigger;
116
- /** Optional repo allowlist (`owner/repo`). */
117
- repositories?: readonly string[];
118
- /** Whether this handler attempts a PR/issue comment after the agent run. */
119
- autoReply: boolean;
120
- }
121
- /**
122
- * Live webhook config consumed by normalize/match/HTTP.
123
- *
124
- * Retains `prompt` callbacks for runtime. Built from `connectors.github({ events })`
125
- * or reconstructed (without live prompts) from the JSON manifest.
126
- */
127
- export interface RequiredGitHubChannelConfig {
128
- /** Normalized events with defaults applied (`autoReply` → `true`). */
129
- events: readonly RequiredGitHubChannelHandler[];
130
- }
131
- /**
132
- * Normalized event handler with defaults applied.
133
- */
134
- export interface RequiredGitHubChannelHandler {
135
- on: GitHubChannelTrigger;
136
- repositories?: readonly string[];
137
- autoReply: boolean;
138
- prompt: (event: GitHubWebhookPromptEvent) => string;
139
- }
140
- /**
141
- * Authoring input shape for GitHub webhook events (also on
142
- * {@link import("../../connectors/github/index.js").GitHubConnectorConfig}).
143
- */
144
- export interface GitHubChannelConfig {
145
- /** Ordered event list. First match wins for each webhook delivery. */
146
- events: readonly GitHubChannelHandler[];
147
- }
148
- /** Live config shell passed into the GitHub HTTP handler. */
149
- export type GitHubChannelDefinition = {
150
- config: RequiredGitHubChannelConfig;
151
- };
152
- /** Env vars for Phase 1 single-install GitHub App webhooks. */
153
- export declare const GITHUB_CHANNEL_REQUIRED_ENV: readonly ["GITHUB_WEBHOOK_SECRET", "GITHUB_APP_ID", "GITHUB_APP_PRIVATE_KEY", "GITHUB_INSTALLATION_ID"];
154
- /**
155
- * GitHub App permissions implied by event handlers.
156
- *
157
- * Auto-reply comments need `issues:write`. Contents/metadata reads are declared
158
- * broadly so arbitrary webhook handlers can inspect payloads; tighten App
159
- * permissions in GitHub settings to match what you actually use.
160
- */
161
- export declare function requiredGitHubPermissions(config: RequiredGitHubChannelConfig): string[];
162
- /**
163
- * Build author-supplied deploy fields for GitHub webhook ingress.
164
- *
165
- * `name` and `provider` are stamped by the connector `requirements` hook.
166
- */
167
- export declare function toGitHubChannelManifest(definition: GitHubChannelDefinition | RequiredGitHubChannelConfig): ChannelManifestBody;
168
- //# sourceMappingURL=define.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../../src/connectors/github/define.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGtE;;;;;;;;GAQG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,kFAAkF;IAClF,UAAU,CAAC,EAAE,MAAM,CAAC;IACp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f,wBAAwB,EACxB,wBAAwB,CAChB,CAAC;AAEX;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,2BAA2B,GAClC,MAAM,EAAE,CASV;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,uBAAuB,GAAG,2BAA2B,GAChE,mBAAmB,CAuBrB"}
@@ -1,72 +0,0 @@
1
- /**
2
- * GitHub App webhook event types and manifest helpers.
3
- *
4
- * Authoring lives on `connectors.github({ events: [...] })`. This module keeps
5
- * the shared event/handler types and JSON manifest helpers used by the
6
- * connector, HTTP adapter, and normalize/match path.
7
- *
8
- * MDA does **not** ship copies of GitHub webhook payload types. Prefer
9
- * [`@octokit/webhooks-types`](https://www.npmjs.com/package/@octokit/webhooks-types)
10
- * in the agent project and narrow {@link GitHubWebhookPromptEvent.payload}:
11
- *
12
- * @example
13
- * ```ts
14
- * import type { PullRequestOpenedEvent } from "@octokit/webhooks-types";
15
- *
16
- * prompt(event) {
17
- * const pr = event.payload as PullRequestOpenedEvent;
18
- * return `Review ${pr.pull_request.title}`;
19
- * }
20
- * ```
21
- */
22
- /** Env vars for Phase 1 single-install GitHub App webhooks. */
23
- export const GITHUB_CHANNEL_REQUIRED_ENV = [
24
- "GITHUB_WEBHOOK_SECRET",
25
- "GITHUB_APP_ID",
26
- "GITHUB_APP_PRIVATE_KEY",
27
- "GITHUB_INSTALLATION_ID",
28
- ];
29
- /**
30
- * GitHub App permissions implied by event handlers.
31
- *
32
- * Auto-reply comments need `issues:write`. Contents/metadata reads are declared
33
- * broadly so arbitrary webhook handlers can inspect payloads; tighten App
34
- * permissions in GitHub settings to match what you actually use.
35
- */
36
- export function requiredGitHubPermissions(config) {
37
- const perms = new Set(["metadata:read"]);
38
- for (const handler of config.events) {
39
- if (handler.autoReply) {
40
- perms.add("issues:write");
41
- perms.add("pull_requests:read");
42
- }
43
- }
44
- return [...perms].sort();
45
- }
46
- /**
47
- * Build author-supplied deploy fields for GitHub webhook ingress.
48
- *
49
- * `name` and `provider` are stamped by the connector `requirements` hook.
50
- */
51
- export function toGitHubChannelManifest(definition) {
52
- const config = "config" in definition && definition.config
53
- ? definition.config
54
- : definition;
55
- const events = config.events.map((handler) => ({
56
- on: handler.on,
57
- repositories: handler.repositories,
58
- autoReply: handler.autoReply,
59
- }));
60
- const triggers = [...new Set(events.map((h) => h.on))];
61
- const anyAutoReply = events.some((h) => h.autoReply);
62
- return {
63
- autoReply: anyAutoReply,
64
- requiredPermissions: requiredGitHubPermissions(config),
65
- requiredEnv: [...GITHUB_CHANNEL_REQUIRED_ENV],
66
- providerConfig: {
67
- triggers,
68
- events: events,
69
- },
70
- };
71
- }
72
- //# sourceMappingURL=define.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"define.js","sourceRoot":"","sources":["../../../src/connectors/github/define.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA8IH,+DAA+D;AAC/D,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,uBAAuB;IACvB,eAAe;IACf,wBAAwB;IACxB,wBAAwB;CAChB,CAAC;AAEX;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CACvC,MAAmC;IAEnC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAS,CAAC,eAAe,CAAC,CAAC,CAAC;IACjD,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QACpC,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;YACtB,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAC1B,KAAK,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;AAC3B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,UAAiE;IAEjE,MAAM,MAAM,GACV,QAAQ,IAAI,UAAU,IAAI,UAAU,CAAC,MAAM;QACzC,CAAC,CAAC,UAAU,CAAC,MAAM;QACnB,CAAC,CAAE,UAA0C,CAAC;IAClD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAC9B,CAAC,OAAO,EAAgC,EAAE,CAAC,CAAC;QAC1C,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,SAAS,EAAE,OAAO,CAAC,SAAS;KAC7B,CAAC,CACH,CAAC;IACF,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACvD,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACrD,OAAO;QACL,SAAS,EAAE,YAAY;QACvB,mBAAmB,EAAE,yBAAyB,CAAC,MAAM,CAAC;QACtD,WAAW,EAAE,CAAC,GAAG,2BAA2B,CAAC;QAC7C,cAAc,EAAE;YACd,QAAQ;YACR,MAAM,EAAE,MAA8B;SACvC;KACF,CAAC;AACJ,CAAC"}
@@ -1,25 +0,0 @@
1
- /**
2
- * Managed GitHub App webhook HTTP handler + agent runner.
3
- */
4
- import { InMemoryChannelStore } from "../../channels/store.js";
5
- import { invokeIngressAgent } from "../../ingress/index.js";
6
- import type { GitHubChannelDefinition, RequiredGitHubChannelConfig } from "./define.js";
7
- export interface GitHubChannelHttpConfig {
8
- name: string;
9
- config: RequiredGitHubChannelConfig;
10
- /** Live definition (preferred); supplies events with `prompt`. */
11
- definition?: GitHubChannelDefinition;
12
- store?: InMemoryChannelStore;
13
- schedule?: (work: () => Promise<void>) => void;
14
- invokeAgent?: typeof invokeIngressAgent;
15
- rawBody?: string | Uint8Array;
16
- webhookSecret?: string;
17
- installationId?: string;
18
- assistantId?: string;
19
- deploymentId?: string;
20
- }
21
- /**
22
- * Handle `POST /channels/{name}/events` for a GitHub App webhook.
23
- */
24
- export declare function handleGitHubEventsRequest(request: Request, channel: GitHubChannelHttpConfig): Promise<Response>;
25
- //# sourceMappingURL=http.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/connectors/github/http.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAO/D,OAAO,EACL,kBAAkB,EAEnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EACV,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,aAAa,CAAC;AAqBrB,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,2BAA2B,CAAC;IACpC,kEAAkE;IAClE,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;IAC/C,WAAW,CAAC,EAAE,OAAO,kBAAkB,CAAC;IACxC,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,QAAQ,CAAC,CAgJnB"}
@@ -1,146 +0,0 @@
1
- /**
2
- * Managed GitHub App webhook HTTP handler + agent runner.
3
- */
4
- import { ChannelError } from "../../channels/errors.js";
5
- import { InMemoryChannelStore } from "../../channels/store.js";
6
- import { clearFinalPosted, wasDeliveryFinalPosted, } from "../../channels/binding.js";
7
- import { createRuntimeChannel } from "../../channels/runtime.js";
8
- import { invokeIngressAgent, scheduleIngressWork, } from "../../ingress/index.js";
9
- import { GITHUB_WEBHOOK_SECRET_ENV, normalizeGitHubEvent, verifyGitHubWebhookSignature, } from "./normalize.js";
10
- import { GITHUB_INSTALLATION_ID_ENV, transportFromEnv } from "./transport.js";
11
- const DEFAULT_ASSISTANT_ID = "agent";
12
- const ASSISTANT_ID_ENV = "MDA_ASSISTANT_ID";
13
- function resolveAssistantId(override) {
14
- const fromOverride = override?.trim();
15
- if (fromOverride)
16
- return fromOverride;
17
- const fromEnv = process.env[ASSISTANT_ID_ENV]?.trim();
18
- if (fromEnv)
19
- return fromEnv;
20
- return DEFAULT_ASSISTANT_ID;
21
- }
22
- const defaultStore = new InMemoryChannelStore();
23
- /**
24
- * Handle `POST /channels/{name}/events` for a GitHub App webhook.
25
- */
26
- export async function handleGitHubEventsRequest(request, channel) {
27
- const secret = channel.webhookSecret ?? process.env[GITHUB_WEBHOOK_SECRET_ENV] ?? "";
28
- const rawBody = channel.rawBody ?? (await request.text());
29
- const signature = request.headers.get("x-hub-signature-256") ?? "";
30
- try {
31
- verifyGitHubWebhookSignature(rawBody, signature, secret);
32
- }
33
- catch (error) {
34
- if (error instanceof ChannelError) {
35
- return jsonError(401, error.message);
36
- }
37
- throw error;
38
- }
39
- let body;
40
- try {
41
- const text = typeof rawBody === "string" ? rawBody : new TextDecoder().decode(rawBody);
42
- body = JSON.parse(text);
43
- }
44
- catch {
45
- return jsonError(400, "invalid JSON body");
46
- }
47
- const eventName = request.headers.get("x-github-event") ?? "";
48
- const deliveryHeader = request.headers.get("x-github-delivery") ?? "";
49
- const installationId = channel.installationId ?? process.env[GITHUB_INSTALLATION_ID_ENV] ?? "";
50
- const config = channel.definition?.config ?? channel.config;
51
- const normalized = normalizeGitHubEvent(body, { eventName, deliveryId: deliveryHeader || cryptoRandom() }, config, installationId);
52
- const store = channel.store ?? defaultStore;
53
- const deploymentId = channel.deploymentId ?? "local";
54
- if (normalized.ignored) {
55
- store.acceptDelivery({
56
- deploymentId,
57
- channelDefinitionId: channel.name,
58
- provider: "github",
59
- apiAppId: installationId,
60
- eventId: normalized.event.eventId,
61
- sourceThreadKey: normalized.sourceThreadKey || "ignored",
62
- status: "filtered",
63
- filterReason: "event_filtered",
64
- event: normalized.event,
65
- });
66
- return new Response("", { status: 202 });
67
- }
68
- const { delivery, duplicate } = store.acceptDelivery({
69
- deploymentId,
70
- channelDefinitionId: channel.name,
71
- provider: "github",
72
- apiAppId: installationId,
73
- eventId: normalized.event.eventId,
74
- sourceThreadKey: normalized.sourceThreadKey,
75
- status: "accepted",
76
- event: normalized.event,
77
- });
78
- if (duplicate) {
79
- return new Response("", { status: 202 });
80
- }
81
- const invoke = channel.invokeAgent ?? invokeIngressAgent;
82
- const userId = `github-app:${installationId || "unknown"}`;
83
- // Auto-reply needs owner/repo#N for the installation comment transport.
84
- const conversationId = normalized.event.address.conversationId ?? "";
85
- const canComment = /^[^/]+\/[^#]+#\d+$/.test(conversationId);
86
- const autoReply = (normalized.handler?.autoReply ?? true) && canComment;
87
- scheduleIngressWork(async () => {
88
- clearFinalPosted(delivery.deliveryId);
89
- delivery.status = "running";
90
- delivery.updatedAt = new Date().toISOString();
91
- const binding = {
92
- name: channel.name,
93
- provider: "github",
94
- event: normalized.event,
95
- address: normalized.event.address,
96
- autoReply,
97
- deliveryId: delivery.deliveryId,
98
- };
99
- const text = normalized.event.message?.text?.trim() ?? "";
100
- if (!text) {
101
- delivery.status = "delivered";
102
- delivery.updatedAt = new Date().toISOString();
103
- return;
104
- }
105
- const result = await invoke({
106
- userId,
107
- sourceThreadKey: normalized.sourceThreadKey,
108
- binding,
109
- text,
110
- assistantId: resolveAssistantId(channel.assistantId),
111
- sourceProvider: "github",
112
- });
113
- if (autoReply &&
114
- !wasDeliveryFinalPosted(delivery.deliveryId) &&
115
- result.replyText.trim().length > 0) {
116
- const transport = transportFromEnv();
117
- if (!transport) {
118
- throw new ChannelError("channel_run_failed", "auto-reply requires GitHub App credentials (GITHUB_APP_ID, GITHUB_APP_PRIVATE_KEY, GITHUB_INSTALLATION_ID)");
119
- }
120
- const runtimeChannel = createRuntimeChannel({
121
- name: channel.name,
122
- provider: "github",
123
- event: normalized.event,
124
- address: normalized.event.address,
125
- capabilities: { update: false },
126
- transport,
127
- onFinalPosted: () => undefined,
128
- });
129
- const posted = await runtimeChannel.post({ text: result.replyText }, { final: true });
130
- delivery.outboundMessageIds.push(posted.id);
131
- }
132
- delivery.status = "delivered";
133
- delivery.updatedAt = new Date().toISOString();
134
- }, {
135
- label: `channel "${channel.name}" delivery ${delivery.deliveryId}`,
136
- schedule: channel.schedule,
137
- });
138
- return new Response("", { status: 202 });
139
- }
140
- function jsonError(status, message) {
141
- return Response.json({ error: message }, { status });
142
- }
143
- function cryptoRandom() {
144
- return globalThis.crypto?.randomUUID?.() ?? `delivery-${Date.now()}`;
145
- }
146
- //# sourceMappingURL=http.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/connectors/github/http.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EACL,gBAAgB,EAEhB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAE9E,MAAM,oBAAoB,GAAG,OAAO,CAAC;AACrC,MAAM,gBAAgB,G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AC,IAAI,CACtC,EAAE,IAAI,EAAE,MAAM,CAAC,SAAS,EAAE,EAC1B,EAAE,KAAK,EAAE,IAAI,EAAE,CAChB,CAAC;YACF,QAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC9C,CAAC;QAED,QAAQ,CAAC,MAAM,GAAG,WAAW,CAAC;QAC9B,QAAQ,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAChD,CAAC,EACD;QACE,KAAK,EAAE,YAAY,OAAO,CAAC,IAAI,cAAc,QAAQ,CAAC,UAAU,EAAE;QAClE,QAAQ,EAAE,OAAO,CAAC,QAAQ;KAC3B,CACF,CAAC;IAEF,OAAO,IAAI,QAAQ,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;AAC3C,CAAC;AAED,SAAS,SAAS,CAAC,MAAc,EAAE,OAAe;IAChD,OAAO,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AACvD,CAAC;AAED,SAAS,YAAY;IACnB,OAAO,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,IAAI,YAAY,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;AACvE,CAAC"}
@@ -1,121 +0,0 @@
1
- /**
2
- * GitHub connector — workspace tools, sandbox checkout, and optional webhooks.
3
- *
4
- * A [tool server integration](../toolserver) like `connectors.gmail`, so the
5
- * workspace's GitHub tools — issues, pull requests, reviews — come from the same
6
- * gateway against the same credential. GitHub reaches further than an API
7
- * though: an agent works on a repository by having it checked out. So this
8
- * connector also provisions the sandbox, declaring which repositories to clone,
9
- * whether to install the GitHub CLI, and whether resolved identity credentials
10
- * should be available inside the sandbox so the agent can act as the user.
11
- *
12
- * Optional `events` merges former `channels.github` authoring: GitHub App
13
- * webhook ingress at `POST /connectors/{name}/events`, messaging transport, and
14
- * deploy requirements. Connect-with-GitHub OAuth remains `connect.github`.
15
- *
16
- * The two halves interact in one place: installing the CLI (the default) leaves
17
- * the integration's tools off, because `gh` already reaches the same API. Naming
18
- * tools, or dropping the CLI, turns them on. See {@link defaultToolsFromCLI}.
19
- */
20
- import { type GitHubChannelHandler, type RequiredGitHubChannelConfig } from "./define.js";
21
- import type { ChannelManifest } from "../../channels/manifest.js";
22
- import { type Connector } from "../../runtime/connector.js";
23
- import { type ToolServerConnectorConfig, type ToolsForFactory } from "../toolserver/index.js";
24
- export { provisionGitHubSandbox, buildGitHubProvisionScript, CLONE_FAILED_MARKDOWN, isBenignCheckoutFailure, GITHUB_TOKEN_REMOTE_PATH, GITHUB_PROVISION_REMOTE_PATH, } from "./sandbox.js";
25
- export type { GitHubSandboxBackend, ProvisionGitHubSandboxOptions, } from "./sandbox.js";
26
- export type { GitHubChannelHandler, GitHubChannelHandlerManifest, GitHubChannelTrigger, GitHubWebhookPromptEvent, RequiredGitHubChannelConfig, RequiredGitHubChannelHandler, } from "./define.js";
27
- export { GITHUB_CHANNEL_REQUIRED_ENV, requiredGitHubPermissions, toGitHubChannelManifest, } from "./define.js";
28
- /** How MDA should treat an existing sandbox checkout when a sandbox is reused. */
29
- export type GitHubCheckoutReuse = "keep" | "reset" | "fetch";
30
- /**
31
- * Repository checkout declaration for the GitHub connector.
32
- *
33
- * Static `repo` checkouts are cloned when a sandbox is first provisioned. When
34
- * a thread starts against a reused sandbox, MDA applies {@link onReuse}
35
- * (default `"fetch"`) so the working tree picks up the latest commits for
36
- * {@link ref}.
37
- */
38
- export interface GitHubRepositoryCheckout {
39
- /** Static repository to checkout, formatted as `owner/repo`. */
40
- repo?: string;
41
- /** Dynamic binding to the repository from a future GitHub channel event. */
42
- from?: "event.repository";
43
- /** Relative sandbox path where the repository should appear. */
44
- path: string;
45
- /** Git ref, branch, tag, SHA, or future `event.*` expression to checkout. */
46
- ref?: string;
47
- /** Shallow clone depth. Must be an integer >= 1. */
48
- depth?: number;
49
- /** Optional sparse checkout paths, relative to the repository root. */
50
- sparsePaths?: string[];
51
- /** Whether submodules should be initialized. Defaults to false. */
52
- submodules?: boolean;
53
- /** Whether the checkout needs write credentials instead of read credentials. */
54
- write?: boolean;
55
- /**
56
- * Reuse behavior when a thread starts against an existing sandbox checkout.
57
- * Defaults to `"fetch"` (pull latest for {@link ref}).
58
- */
59
- onReuse?: GitHubCheckoutReuse;
60
- }
61
- /**
62
- * Configuration accepted by `connectors.github`.
63
- *
64
- * The tool selection it inherits — {@link ToolServerConnectorConfig} — picks which
65
- * of the integration's tools the agent gets. Sandbox options provision checkouts.
66
- * Optional {@link events} mounts GitHub App webhook ingress + messaging.
67
- */
68
- export interface GitHubConnectorConfig extends ToolServerConnectorConfig<ToolsForFactory<"github">> {
69
- /** Repository checkouts to provision into the sandbox snapshot/workspace. */
70
- repositories?: GitHubRepositoryCheckout[];
71
- /**
72
- * Install the [GitHub CLI](https://cli.github.com/) (`gh`) into the sandbox
73
- * during provisioning. Defaults to `true`.
74
- *
75
- * Also decides the default tool surface: with `gh` in the sandbox the agent
76
- * already reaches the GitHub API, so the integration's tools stay off unless
77
- * {@link ToolServerConnectorConfig.includeTools} or
78
- * {@link ToolServerConnectorConfig.excludeTools} asks for them.
79
- */
80
- installCLI?: boolean;
81
- /**
82
- * Inject resolved GitHub identity credentials into the sandbox (`GH_TOKEN`,
83
- * git credential helper) so the agent can act as the user. Defaults to `true`.
84
- */
85
- injectCredentials?: boolean;
86
- /**
87
- * Ordered GitHub App webhook subscriptions. When set, mounts Events ingress
88
- * at `/connectors/{name}/events`, messaging, and deploy requirements.
89
- *
90
- * First match wins for each delivery. Not stored on the connector instance
91
- * (the `events` hook owns that property name); live `prompt` callbacks are
92
- * closed over by the hook.
93
- */
94
- events?: readonly GitHubChannelHandler[];
95
- }
96
- /** Branded GitHub connector declaration discovered from `connectors/github.ts`. */
97
- export type GitHubConnector = Connector & ToolServerConnectorConfig<ToolsForFactory<"github">> & Required<Pick<GitHubConnectorConfig, "repositories" | "installCLI" | "injectCredentials">> & {
98
- /** Connector kind used for diagnostics and route namespacing. */
99
- kind: "github";
100
- };
101
- /**
102
- * Build the branded GitHub connector declaration.
103
- *
104
- * Sandbox + tools follow today's defaults. When {@link GitHubConnectorConfig.events}
105
- * is set, Events / messaging / requirements hooks are attached as well.
106
- *
107
- * At least one of repositories, tool selection (`includeTools` /
108
- * `excludeTools`), or `events` gives the connector a purpose beyond default
109
- * sandbox provisioning — but an empty config remains valid (sandbox-only).
110
- */
111
- export declare function githubConnector(config?: GitHubConnectorConfig): GitHubConnector;
112
- /** Build deploy/runtime requirements for a file-derived connector name. */
113
- export declare function toGitHubRequirements(name: string, config: RequiredGitHubChannelConfig): ChannelManifest;
114
- export { githubTriggerMatches, matchGitHubHandler } from "./match.js";
115
- export { verifyGitHubWebhookSignature, normalizeGitHubEvent, extractIssueOrPullNumber, GITHUB_WEBHOOK_SECRET_ENV, } from "./normalize.js";
116
- export { createGitHubAppTransport, transportFromEnv, GITHUB_APP_ID_ENV, GITHUB_APP_PRIVATE_KEY_ENV, GITHUB_INSTALLATION_ID_ENV, } from "./transport.js";
117
- export { encodeGitHubSourceThreadKey, decodeGitHubSourceThreadKey, } from "./source-thread.js";
118
- export { handleGitHubEventsRequest } from "./http.js";
119
- export type { GitHubChannelHttpConfig } from "./http.js";
120
- export { githubChannelAdapter, githubConfigFromManifest, } from "./adapter-core.js";
121
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/connectors/github/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EAEjC,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAEL,KAAK,SAAS,EAIf,MAAM,4BAA4B,CAAC;AACpC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