managed-deepagents 0.5.0-dev.89 → 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.
- package/dist/channels/index.d.ts +6 -5
- package/dist/channels/index.d.ts.map +1 -1
- package/dist/channels/index.js +6 -5
- package/dist/channels/index.js.map +1 -1
- package/dist/channels/messaging-registry.d.ts +8 -4
- package/dist/channels/messaging-registry.d.ts.map +1 -1
- package/dist/channels/messaging-registry.js +22 -16
- package/dist/channels/messaging-registry.js.map +1 -1
- package/dist/channels/registry-types.d.ts +1 -1
- package/dist/channels/registry-types.d.ts.map +1 -1
- package/dist/channels/registry.d.ts.map +1 -1
- package/dist/channels/registry.js +1 -3
- package/dist/channels/registry.js.map +1 -1
- package/dist/channels/schedule-delivery.js +1 -1
- package/dist/channels/schedule-delivery.js.map +1 -1
- package/dist/{connectors → channels}/slack/adapter-core.d.ts +1 -1
- package/dist/channels/slack/adapter-core.d.ts.map +1 -0
- package/dist/channels/slack/adapter-core.js.map +1 -0
- package/dist/{connectors → channels}/slack/adapter.d.ts +3 -3
- package/dist/channels/slack/adapter.d.ts.map +1 -0
- package/dist/channels/slack/adapter.js.map +1 -0
- package/dist/{connectors → channels}/slack/http.d.ts +4 -4
- package/dist/channels/slack/http.d.ts.map +1 -0
- package/dist/{connectors → channels}/slack/http.js +6 -6
- package/dist/channels/slack/http.js.map +1 -0
- package/dist/channels/slack/index.d.ts +89 -0
- package/dist/channels/slack/index.d.ts.map +1 -0
- package/dist/channels/slack/index.js +148 -0
- package/dist/channels/slack/index.js.map +1 -0
- package/dist/{connectors → channels}/slack/normalize.d.ts +3 -3
- package/dist/channels/slack/normalize.d.ts.map +1 -0
- package/dist/{connectors → channels}/slack/normalize.js +1 -1
- package/dist/channels/slack/normalize.js.map +1 -0
- package/dist/channels/slack/source-thread.d.ts.map +1 -0
- package/dist/channels/slack/source-thread.js.map +1 -0
- package/dist/{connectors → channels}/slack/transport.d.ts +1 -1
- package/dist/channels/slack/transport.d.ts.map +1 -0
- package/dist/{connectors → channels}/slack/transport.js +1 -1
- package/dist/channels/slack/transport.js.map +1 -0
- package/dist/connectors/slack/index.d.ts +10 -79
- package/dist/connectors/slack/index.d.ts.map +1 -1
- package/dist/connectors/slack/index.js +24 -127
- package/dist/connectors/slack/index.js.map +1 -1
- package/dist/connectors/toolserver/catalog.d.ts +4 -10
- package/dist/connectors/toolserver/catalog.d.ts.map +1 -1
- package/dist/connectors/toolserver/catalog.js +6 -54
- package/dist/connectors/toolserver/catalog.js.map +1 -1
- package/dist/connectors/toolserver/index.d.ts +5 -7
- package/dist/connectors/toolserver/index.d.ts.map +1 -1
- package/dist/connectors/toolserver/index.js +4 -6
- package/dist/connectors/toolserver/index.js.map +1 -1
- package/dist/connectors/toolserver/integrations.d.ts +4 -4
- package/dist/connectors/toolserver/integrations.d.ts.map +1 -1
- package/dist/extension.d.ts +1 -1
- package/dist/extension.js +1 -1
- package/dist/identity/connect-inference.d.ts +6 -7
- package/dist/identity/connect-inference.d.ts.map +1 -1
- package/dist/identity/connect-inference.js +7 -9
- package/dist/identity/connect-inference.js.map +1 -1
- package/dist/identity/github/connect-http.d.ts +4 -4
- package/dist/identity/github/connect-http.js +4 -4
- package/dist/identity/github/index.d.ts +0 -2
- package/dist/identity/github/index.d.ts.map +1 -1
- package/dist/identity/github/index.js +0 -2
- package/dist/identity/github/index.js.map +1 -1
- package/dist/identity/options.d.ts +2 -3
- package/dist/identity/options.d.ts.map +1 -1
- package/dist/identity/options.js.map +1 -1
- package/dist/identity/slack/connect-http.d.ts +3 -1
- package/dist/identity/slack/connect-http.d.ts.map +1 -1
- package/dist/identity/slack/connect-http.js +3 -1
- package/dist/identity/slack/connect-http.js.map +1 -1
- package/dist/identity/slack/links.d.ts +2 -1
- package/dist/identity/slack/links.d.ts.map +1 -1
- package/dist/identity/slack/links.js +2 -1
- package/dist/identity/slack/links.js.map +1 -1
- package/dist/identity/types.d.ts +1 -1
- package/dist/identity/types.d.ts.map +1 -1
- package/dist/index.d.ts +4 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/namespaces.d.ts +45 -83
- package/dist/namespaces.d.ts.map +1 -1
- package/dist/namespaces.js +12 -21
- package/dist/namespaces.js.map +1 -1
- package/dist/runtime/auth.d.ts +1 -1
- package/dist/runtime/auth.d.ts.map +1 -1
- package/dist/runtime/auth.js +13 -3
- package/dist/runtime/auth.js.map +1 -1
- package/dist/runtime/channel.d.ts +91 -0
- package/dist/runtime/channel.d.ts.map +1 -0
- package/dist/runtime/channel.js +98 -0
- package/dist/runtime/channel.js.map +1 -0
- package/dist/runtime/connector.d.ts +1 -1
- package/dist/runtime/connector.js +5 -1
- package/dist/runtime/connector.js.map +1 -1
- package/dist/runtime/cors.d.ts +1 -1
- package/dist/runtime/cors.d.ts.map +1 -1
- package/dist/runtime/cors.js +5 -1
- package/dist/runtime/cors.js.map +1 -1
- package/dist/runtime/http.d.ts +1 -2
- package/dist/runtime/http.d.ts.map +1 -1
- package/dist/runtime/http.js +1 -2
- package/dist/runtime/http.js.map +1 -1
- package/dist/runtime/identity-http.d.ts +8 -3
- package/dist/runtime/identity-http.d.ts.map +1 -1
- package/dist/runtime/identity-http.js +50 -8
- package/dist/runtime/identity-http.js.map +1 -1
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +4 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/types.d.ts +8 -0
- package/dist/runtime/types.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/connectors/github/adapter-core.d.ts +0 -15
- package/dist/connectors/github/adapter-core.d.ts.map +0 -1
- package/dist/connectors/github/adapter-core.js +0 -52
- package/dist/connectors/github/adapter-core.js.map +0 -1
- package/dist/connectors/github/define.d.ts +0 -168
- package/dist/connectors/github/define.d.ts.map +0 -1
- package/dist/connectors/github/define.js +0 -72
- package/dist/connectors/github/define.js.map +0 -1
- package/dist/connectors/github/http.d.ts +0 -25
- package/dist/connectors/github/http.d.ts.map +0 -1
- package/dist/connectors/github/http.js +0 -146
- package/dist/connectors/github/http.js.map +0 -1
- package/dist/connectors/github/index.d.ts +0 -121
- package/dist/connectors/github/index.d.ts.map +0 -1
- package/dist/connectors/github/index.js +0 -192
- package/dist/connectors/github/index.js.map +0 -1
- package/dist/connectors/github/match.d.ts +0 -20
- package/dist/connectors/github/match.d.ts.map +0 -1
- package/dist/connectors/github/match.js +0 -41
- package/dist/connectors/github/match.js.map +0 -1
- package/dist/connectors/github/normalize.d.ts +0 -32
- package/dist/connectors/github/normalize.d.ts.map +0 -1
- package/dist/connectors/github/normalize.js +0 -152
- package/dist/connectors/github/normalize.js.map +0 -1
- package/dist/connectors/github/sandbox.d.ts +0 -54
- package/dist/connectors/github/sandbox.d.ts.map +0 -1
- package/dist/connectors/github/sandbox.js +0 -532
- package/dist/connectors/github/sandbox.js.map +0 -1
- package/dist/connectors/github/source-thread.d.ts +0 -24
- package/dist/connectors/github/source-thread.d.ts.map +0 -1
- package/dist/connectors/github/source-thread.js +0 -54
- package/dist/connectors/github/source-thread.js.map +0 -1
- package/dist/connectors/github/transport.d.ts +0 -25
- package/dist/connectors/github/transport.d.ts.map +0 -1
- package/dist/connectors/github/transport.js +0 -106
- package/dist/connectors/github/transport.js.map +0 -1
- package/dist/connectors/langsmith/index.d.ts +0 -397
- package/dist/connectors/langsmith/index.d.ts.map +0 -1
- package/dist/connectors/langsmith/index.js +0 -436
- package/dist/connectors/langsmith/index.js.map +0 -1
- package/dist/connectors/langsmith/routes.d.ts +0 -236
- package/dist/connectors/langsmith/routes.d.ts.map +0 -1
- package/dist/connectors/langsmith/routes.js +0 -1154
- package/dist/connectors/langsmith/routes.js.map +0 -1
- package/dist/connectors/slack/adapter-core.d.ts.map +0 -1
- package/dist/connectors/slack/adapter-core.js.map +0 -1
- package/dist/connectors/slack/adapter.d.ts.map +0 -1
- package/dist/connectors/slack/adapter.js.map +0 -1
- package/dist/connectors/slack/http.d.ts.map +0 -1
- package/dist/connectors/slack/http.js.map +0 -1
- package/dist/connectors/slack/normalize.d.ts.map +0 -1
- package/dist/connectors/slack/normalize.js.map +0 -1
- package/dist/connectors/slack/source-thread.d.ts.map +0 -1
- package/dist/connectors/slack/source-thread.js.map +0 -1
- package/dist/connectors/slack/transport.d.ts.map +0 -1
- package/dist/connectors/slack/transport.js.map +0 -1
- /package/dist/{connectors → channels}/slack/adapter-core.js +0 -0
- /package/dist/{connectors → channels}/slack/adapter.js +0 -0
- /package/dist/{connectors → channels}/slack/source-thread.d.ts +0 -0
- /package/dist/{connectors → channels}/slack/source-thread.js +0 -0
package/dist/runtime/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IdentityDefinition } from "../identity/index.js";
|
|
2
2
|
import type { SandboxDefinition } from "../sandbox.js";
|
|
3
|
+
import type { Channel } from "./channel.js";
|
|
3
4
|
import type { Connector } from "./connector.js";
|
|
4
5
|
/**
|
|
5
6
|
* Any object that carries a per-run LangGraph `configurable` map. The shared base
|
|
@@ -54,6 +55,13 @@ export interface ManagedAgentOptions {
|
|
|
54
55
|
* tools appended to the agent's authored tools.
|
|
55
56
|
*/
|
|
56
57
|
connectors?: Connector[];
|
|
58
|
+
/**
|
|
59
|
+
* The channels discovered under `channels/`, already validated by
|
|
60
|
+
* `collectChannels`. Reserved on the agent options bag so the generated
|
|
61
|
+
* entry can pass the same object shape; Events/messaging mount on the
|
|
62
|
+
* managed HTTP app, not the agent graph.
|
|
63
|
+
*/
|
|
64
|
+
channels?: Channel[];
|
|
57
65
|
/**
|
|
58
66
|
* The root `identity.ts` declaration, if the project opts into managed
|
|
59
67
|
* identity. Resolution + thread scoping run in the generated custom-auth
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/runtime/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EA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EAAE,MAAM,gBAAgB,CAAC;AAEhD;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAiB,SAAQ,mBAAmB;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "managed-deepagents",
|
|
3
|
-
"version": "0.5.0-dev.
|
|
3
|
+
"version": "0.5.0-dev.90",
|
|
4
4
|
"description": "Managed Deep Agents — the `defineDeepAgent` authoring interface plus the CLI that compiles and deploys a code-first Deep Agent repository to a managed LangGraph runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"langchain",
|
|
@@ -64,12 +64,12 @@
|
|
|
64
64
|
"zod": "^4.4.3"
|
|
65
65
|
},
|
|
66
66
|
"optionalDependencies": {
|
|
67
|
-
"@langchain/managed-deepagents-darwin-arm64": "0.5.0-dev.
|
|
68
|
-
"@langchain/managed-deepagents-darwin-x64": "0.5.0-dev.
|
|
69
|
-
"@langchain/managed-deepagents-linux-arm64": "0.5.0-dev.
|
|
70
|
-
"@langchain/managed-deepagents-linux-x64": "0.5.0-dev.
|
|
71
|
-
"@langchain/managed-deepagents-win32-arm64": "0.5.0-dev.
|
|
72
|
-
"@langchain/managed-deepagents-win32-x64": "0.5.0-dev.
|
|
67
|
+
"@langchain/managed-deepagents-darwin-arm64": "0.5.0-dev.90",
|
|
68
|
+
"@langchain/managed-deepagents-darwin-x64": "0.5.0-dev.90",
|
|
69
|
+
"@langchain/managed-deepagents-linux-arm64": "0.5.0-dev.90",
|
|
70
|
+
"@langchain/managed-deepagents-linux-x64": "0.5.0-dev.90",
|
|
71
|
+
"@langchain/managed-deepagents-win32-arm64": "0.5.0-dev.90",
|
|
72
|
+
"@langchain/managed-deepagents-win32-x64": "0.5.0-dev.90"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@types/node": "^26.1.1",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GitHub adapter object without imports from the connector factory (avoids load cycles).
|
|
3
|
-
*/
|
|
4
|
-
import type { ChannelManifest } from "../../channels/manifest.js";
|
|
5
|
-
import type { ChannelProviderAdapter } from "../../channels/registry-types.js";
|
|
6
|
-
import type { RequiredGitHubChannelConfig } from "./define.js";
|
|
7
|
-
/**
|
|
8
|
-
* Rebuild a config shell from the JSON manifest when the live module is absent.
|
|
9
|
-
*
|
|
10
|
-
* Manifest events have no `prompt` — callers that only have the manifest
|
|
11
|
-
* cannot produce agent task text. Prefer passing the live definition.
|
|
12
|
-
*/
|
|
13
|
-
export declare function githubConfigFromManifest(manifest: ChannelManifest): RequiredGitHubChannelConfig;
|
|
14
|
-
export declare const githubChannelAdapter: ChannelProviderAdapter;
|
|
15
|
-
//# sourceMappingURL=adapter-core.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapter-core.d.ts","sourceRoot":"","sources":["../../../src/connectors/github/adapter-core.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAc,MAAM,4BAA4B,CAAC;AAC9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,KAAK,EAEV,2BAA2B,EAE5B,MAAM,aAAa,CAAC;AAIrB;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,eAAe,GACxB,2BAA2B,CA4B7B;AAED,eAAO,MAAM,oBAAoB,EAAE,sBAoBlC,CAAC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GitHub adapter object without imports from the connector factory (avoids load cycles).
|
|
3
|
-
*/
|
|
4
|
-
import { handleGitHubEventsRequest } from "./http.js";
|
|
5
|
-
import { transportFromEnv } from "./transport.js";
|
|
6
|
-
/**
|
|
7
|
-
* Rebuild a config shell from the JSON manifest when the live module is absent.
|
|
8
|
-
*
|
|
9
|
-
* Manifest events have no `prompt` — callers that only have the manifest
|
|
10
|
-
* cannot produce agent task text. Prefer passing the live definition.
|
|
11
|
-
*/
|
|
12
|
-
export function githubConfigFromManifest(manifest) {
|
|
13
|
-
const cfg = manifest.providerConfig;
|
|
14
|
-
const rawEvents = cfg.events;
|
|
15
|
-
if (!Array.isArray(rawEvents) || rawEvents.length === 0) {
|
|
16
|
-
return { events: [] };
|
|
17
|
-
}
|
|
18
|
-
const events = rawEvents.map((entry, index) => {
|
|
19
|
-
const h = entry;
|
|
20
|
-
const on = h.on;
|
|
21
|
-
const autoReply = typeof h.autoReply === "boolean" ? h.autoReply : true;
|
|
22
|
-
const repositories = Array.isArray(h.repositories)
|
|
23
|
-
? h.repositories
|
|
24
|
-
: undefined;
|
|
25
|
-
return {
|
|
26
|
-
on,
|
|
27
|
-
repositories,
|
|
28
|
-
autoReply,
|
|
29
|
-
prompt: () => {
|
|
30
|
-
throw new Error(`GitHub connector "${manifest.name}" events[${index}] has no live ` +
|
|
31
|
-
"`prompt` callback; ensure the connector module is loaded.");
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
});
|
|
35
|
-
return { events };
|
|
36
|
-
}
|
|
37
|
-
export const githubChannelAdapter = {
|
|
38
|
-
provider: "github",
|
|
39
|
-
async handleEventsRequest(request, ctx) {
|
|
40
|
-
const definition = ctx.definition;
|
|
41
|
-
return handleGitHubEventsRequest(request, {
|
|
42
|
-
name: ctx.name,
|
|
43
|
-
config: definition?.config ?? githubConfigFromManifest(ctx.manifest),
|
|
44
|
-
definition: ctx.definition,
|
|
45
|
-
rawBody: ctx.rawBody,
|
|
46
|
-
});
|
|
47
|
-
},
|
|
48
|
-
createTransport(env) {
|
|
49
|
-
return transportFromEnv(env);
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
//# sourceMappingURL=adapter-core.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapter-core.js","sourceRoot":"","sources":["../../../src/connectors/github/adapter-core.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACtC,QAAyB;IAEzB,MAAM,GAAG,GAAG,QAAQ,CAAC,cAA4B,CAAC;IAClD,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC;IAC7B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxD,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IACxB,CAAC;IACD,MAAM,MAAM,GA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|
|
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;IACpB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,EAAE,EAAE,oBAAoB,CAAC;IACzB;;;;OAIG;IACH,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,MAAM,EAAE,CAAC,KAAK,EAAE,wBAAwB,KAAK,MAAM,CAAC;CACrD;AAED;;;GAGG;AACH,MAAM,WAAW,4BAA4B;IAC3C,wDAAwD;IACxD,EAAE,EAAE,oBAAoB,CAAC;IACzB,8CAA8C;IAC9C,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,4EAA4E;IAC5E,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,2BAA2B;IAC1C,sEAAsE;IACtE,MAAM,EAAE,SAAS,4BAA4B,EAAE,CAAC;CACjD;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,EAAE,EAAE,oBAAoB,CAAC;IACzB,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,CAAC,KAAK,EAAE,wBAAwB,KAAK,MAAM,CAAC;CACrD;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,sEAAsE;IACtE,MAAM,EAAE,SAAS,oBAAoB,EAAE,CAAC;CACzC;AAED,6DAA6D;AAC7D,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,2BAA2B,CAAC;CACrC,CAAC;AAEF,+DAA+D;AAC/D,eAAO,MAAM,2BAA2B,YACtC,uBAAuB,EACvB,eAAe,EACf,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 /connectors/{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 /connectors/{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;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