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
|
@@ -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,OAAO,EAIL,KAAK,yBAAyB,EAC9B,KAAK,eAAe,EACrB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,oBAAoB,EACpB,6BAA6B,GAC9B,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,oBAAoB,EACpB,4BAA4B,EAC5B,oBAAoB,EACpB,wBAAwB,EACxB,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AAErB,kFAAkF;AAClF,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAE7D;;;;;;;GAOG;AACH,MAAM,WAAW,wBAAwB;IACvC,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B,GAClC,eAAe,CAOjB;AAmBD,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,EACjB,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AACtD,YAAY,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EACL,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,192 +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 { z } from "zod";
|
|
21
|
-
import { GITHUB_CHANNEL_REQUIRED_ENV, toGitHubChannelManifest, } from "./define.js";
|
|
22
|
-
import { handleGitHubEventsRequest } from "./http.js";
|
|
23
|
-
import { transportFromEnv } from "./transport.js";
|
|
24
|
-
import { CONNECTOR_BRAND, } from "../../runtime/connector.js";
|
|
25
|
-
import { GITHUB_SLUG, toolServerConnectorSchema, toolServerTools, } from "../toolserver/index.js";
|
|
26
|
-
import { provisionGitHubSandbox } from "./sandbox.js";
|
|
27
|
-
export { provisionGitHubSandbox, buildGitHubProvisionScript, CLONE_FAILED_MARKDOWN, isBenignCheckoutFailure, GITHUB_TOKEN_REMOTE_PATH, GITHUB_PROVISION_REMOTE_PATH, } from "./sandbox.js";
|
|
28
|
-
export { GITHUB_CHANNEL_REQUIRED_ENV, requiredGitHubPermissions, toGitHubChannelManifest, } from "./define.js";
|
|
29
|
-
/** Sandbox-relative paths may not escape the workspace or be absolute. */
|
|
30
|
-
const relativePath = (message) => z.string(message).refine(isSafeRelativePath, message);
|
|
31
|
-
const repositoryCheckout = z
|
|
32
|
-
.object({
|
|
33
|
-
repo: z
|
|
34
|
-
.string()
|
|
35
|
-
.refine(isExactRepo, 'repo must look like "owner/repo"')
|
|
36
|
-
.optional(),
|
|
37
|
-
from: z.literal("event.repository").optional(),
|
|
38
|
-
path: relativePath("path must be a safe relative sandbox path"),
|
|
39
|
-
ref: z.string().optional(),
|
|
40
|
-
depth: z.int("depth must be >= 1").min(1, "depth must be >= 1").optional(),
|
|
41
|
-
sparsePaths: z
|
|
42
|
-
.array(relativePath("sparsePaths must be safe relative paths"))
|
|
43
|
-
.optional(),
|
|
44
|
-
submodules: z.boolean().optional(),
|
|
45
|
-
write: z.boolean().optional(),
|
|
46
|
-
onReuse: z
|
|
47
|
-
.enum(["keep", "reset", "fetch"], {
|
|
48
|
-
error: 'onReuse must be "keep", "reset", or "fetch"',
|
|
49
|
-
})
|
|
50
|
-
.optional(),
|
|
51
|
-
})
|
|
52
|
-
.refine((repo) => repo.repo !== undefined || repo.from === "event.repository", 'requires `repo` or from: "event.repository"');
|
|
53
|
-
const githubEventHandler = z.object({
|
|
54
|
-
on: z
|
|
55
|
-
.string('on must be a non-empty string (e.g. "pull_request", "pull_request.opened", or "*")')
|
|
56
|
-
.trim()
|
|
57
|
-
.min(1, 'on must be a non-empty string (e.g. "pull_request", "pull_request.opened", or "*")'),
|
|
58
|
-
repositories: z.array(z.string()).optional(),
|
|
59
|
-
autoReply: z.boolean().default(true),
|
|
60
|
-
prompt: z.custom((prompt) => typeof prompt === "function", "requires a `prompt` function"),
|
|
61
|
-
});
|
|
62
|
-
/**
|
|
63
|
-
* The GitHub connector's arguments: the gateway options, plus the sandbox ones.
|
|
64
|
-
*
|
|
65
|
-
* Checkout paths are the security-relevant part: they land in the sandbox, so
|
|
66
|
-
* each one must stay inside the workspace and no two may collide.
|
|
67
|
-
*/
|
|
68
|
-
const githubConnectorConfig = toolServerConnectorSchema({
|
|
69
|
-
repositories: z
|
|
70
|
-
.array(repositoryCheckout)
|
|
71
|
-
.check((ctx) => {
|
|
72
|
-
const seen = new Set();
|
|
73
|
-
for (const repo of ctx.value) {
|
|
74
|
-
if (seen.has(repo.path)) {
|
|
75
|
-
ctx.issues.push({
|
|
76
|
-
code: "custom",
|
|
77
|
-
input: ctx.value,
|
|
78
|
-
message: `duplicate repository checkout path "${repo.path}"`,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
seen.add(repo.path);
|
|
82
|
-
}
|
|
83
|
-
})
|
|
84
|
-
.prefault([]),
|
|
85
|
-
installCLI: z.boolean().default(true),
|
|
86
|
-
injectCredentials: z.boolean().default(true),
|
|
87
|
-
events: z
|
|
88
|
-
.array(githubEventHandler)
|
|
89
|
-
.nonempty("requires a non-empty `events` array")
|
|
90
|
-
.optional(),
|
|
91
|
-
}).transform(defaultToolsFromCLI);
|
|
92
|
-
const githubTools = toolServerTools(GITHUB_SLUG, "connectors.github");
|
|
93
|
-
function hide(target, key, value) {
|
|
94
|
-
Object.defineProperty(target, key, { value, enumerable: false });
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Leave the integration's tools off when the sandbox has `gh`.
|
|
98
|
-
*
|
|
99
|
-
* The CLI and the tools are two routes to the same API, and an agent that can run
|
|
100
|
-
* `gh` does not need the integration's tool definitions in its prompt to reach the
|
|
101
|
-
* same endpoints. So the CLI — installed by default — implies no tools, and a
|
|
102
|
-
* project gets them by naming them or by dropping the CLI.
|
|
103
|
-
*
|
|
104
|
-
* Any explicit selection wins, including `excludeTools` on its own: asking for a
|
|
105
|
-
* tool is asking for it, whatever else is in the sandbox.
|
|
106
|
-
*/
|
|
107
|
-
function defaultToolsFromCLI(args) {
|
|
108
|
-
const selected = args.includeTools !== undefined || args.excludeTools !== undefined;
|
|
109
|
-
if (selected || !args.installCLI) {
|
|
110
|
-
return args;
|
|
111
|
-
}
|
|
112
|
-
return { ...args, includeTools: [] };
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Build the branded GitHub connector declaration.
|
|
116
|
-
*
|
|
117
|
-
* Sandbox + tools follow today's defaults. When {@link GitHubConnectorConfig.events}
|
|
118
|
-
* is set, Events / messaging / requirements hooks are attached as well.
|
|
119
|
-
*
|
|
120
|
-
* At least one of repositories, tool selection (`includeTools` /
|
|
121
|
-
* `excludeTools`), or `events` gives the connector a purpose beyond default
|
|
122
|
-
* sandbox provisioning — but an empty config remains valid (sandbox-only).
|
|
123
|
-
*/
|
|
124
|
-
export function githubConnector(config) {
|
|
125
|
-
const validate = githubConnectorConfig["~standard"].validate;
|
|
126
|
-
const result = validate(config);
|
|
127
|
-
if (result instanceof Promise) {
|
|
128
|
-
throw new TypeError("connectors.github(...) needs a schema that validates synchronously");
|
|
129
|
-
}
|
|
130
|
-
if (result.issues) {
|
|
131
|
-
const message = result.issues.map((issue) => issue.message).join("; ");
|
|
132
|
-
throw new Error(`connectors.github(...) ${message}`);
|
|
133
|
-
}
|
|
134
|
-
const args = result.value;
|
|
135
|
-
// `events` is authoring-only: the Connector.events hook owns that property.
|
|
136
|
-
const { events: eventHandlers, ...rest } = args;
|
|
137
|
-
const self = { kind: "github", ...rest };
|
|
138
|
-
hide(self, CONNECTOR_BRAND, true);
|
|
139
|
-
hide(self, "tools", (ctx) => githubTools(ctx, self));
|
|
140
|
-
hide(self, "sandbox", async (ctx) => {
|
|
141
|
-
await provisionGitHubSandbox(ctx.backend, self, {
|
|
142
|
-
mode: ctx.mode,
|
|
143
|
-
config: ctx.config,
|
|
144
|
-
identity: ctx.identity,
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
if (eventHandlers !== undefined && eventHandlers.length > 0) {
|
|
148
|
-
const webhookConfig = {
|
|
149
|
-
events: eventHandlers,
|
|
150
|
-
};
|
|
151
|
-
hide(self, "events", (ctx) => handleGitHubEventsRequest(ctx.request, {
|
|
152
|
-
name: ctx.name,
|
|
153
|
-
config: webhookConfig,
|
|
154
|
-
definition: { config: webhookConfig },
|
|
155
|
-
rawBody: ctx.rawBody,
|
|
156
|
-
}));
|
|
157
|
-
hide(self, "messaging", (env) => transportFromEnv(env));
|
|
158
|
-
hide(self, "requirements", (name) => toGitHubRequirements(name, webhookConfig));
|
|
159
|
-
}
|
|
160
|
-
return self;
|
|
161
|
-
}
|
|
162
|
-
/** Build deploy/runtime requirements for a file-derived connector name. */
|
|
163
|
-
export function toGitHubRequirements(name, config) {
|
|
164
|
-
return {
|
|
165
|
-
name,
|
|
166
|
-
provider: "github",
|
|
167
|
-
...toGitHubChannelManifest(config),
|
|
168
|
-
requiredEnv: [...GITHUB_CHANNEL_REQUIRED_ENV],
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
function isExactRepo(pattern) {
|
|
172
|
-
const [owner, repo, extra] = pattern.split("/");
|
|
173
|
-
if (!owner || !repo || extra !== undefined)
|
|
174
|
-
return false;
|
|
175
|
-
return isSlug(owner) && isSlug(repo);
|
|
176
|
-
}
|
|
177
|
-
function isSlug(value) {
|
|
178
|
-
return /^[A-Za-z0-9_.-]+$/.test(value);
|
|
179
|
-
}
|
|
180
|
-
function isSafeRelativePath(path) {
|
|
181
|
-
if (path.length === 0 || path.startsWith("/") || path.includes("\0")) {
|
|
182
|
-
return false;
|
|
183
|
-
}
|
|
184
|
-
return !path.split("/").some((part) => part === "..");
|
|
185
|
-
}
|
|
186
|
-
export { githubTriggerMatches, matchGitHubHandler } from "./match.js";
|
|
187
|
-
export { verifyGitHubWebhookSignature, normalizeGitHubEvent, extractIssueOrPullNumber, GITHUB_WEBHOOK_SECRET_ENV, } from "./normalize.js";
|
|
188
|
-
export { createGitHubAppTransport, transportFromEnv, GITHUB_APP_ID_ENV, GITHUB_APP_PRIVATE_KEY_ENV, GITHUB_INSTALLATION_ID_ENV, } from "./transport.js";
|
|
189
|
-
export { encodeGitHubSourceThreadKey, decodeGitHubSourceThreadKey, } from "./source-thread.js";
|
|
190
|
-
export { handleGitHubEventsRequest } from "./http.js";
|
|
191
|
-
export { githubChannelAdapter, githubConfigFromManifest, } from "./adapter-core.js";
|
|
192
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/connectors/github/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,2BAA2B,EAC3B,uBAAuB,GAIxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EACL,eAAe,GAKhB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,WAAW,EACX,yBAAyB,EACzB,eAAe,GAGhB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAA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I,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACxD,CAAC;AAED,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,EACjB,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAEtD,OAAO,EACL,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure GitHub handler routing — kept out of `define.ts` so normalize/http can
|
|
3
|
-
* load without pulling the channel authoring module (and its adapter) back in.
|
|
4
|
-
*/
|
|
5
|
-
import type { RequiredGitHubChannelConfig, RequiredGitHubChannelHandler } from "./define.js";
|
|
6
|
-
/**
|
|
7
|
-
* Whether a handler `on` filter matches a delivery.
|
|
8
|
-
*
|
|
9
|
-
* @param on - `"*"`, `"pull_request"`, or `"pull_request.opened"`
|
|
10
|
-
* @param eventName - `X-GitHub-Event`
|
|
11
|
-
* @param action - `payload.action` when present
|
|
12
|
-
*/
|
|
13
|
-
export declare function githubTriggerMatches(on: string, eventName: string, action?: string): boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Find the first handler that matches event/action + repository.
|
|
16
|
-
*
|
|
17
|
-
* @returns The handler, or `undefined` when no handler matches (event ignored).
|
|
18
|
-
*/
|
|
19
|
-
export declare function matchGitHubHandler(config: RequiredGitHubChannelConfig, eventName: string, repository: string | undefined, action?: string): RequiredGitHubChannelHandler | undefined;
|
|
20
|
-
//# sourceMappingURL=match.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"match.d.ts","sourceRoot":"","sources":["../../../src/connectors/github/match.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,2BAA2B,EAC3B,4BAA4B,EAC7B,MAAM,aAAa,CAAC;AAErB;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAMT;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,2BAA2B,EACnC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,MAAM,CAAC,EAAE,MAAM,GACd,4BAA4B,GAAG,SAAS,CAU1C"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure GitHub handler routing — kept out of `define.ts` so normalize/http can
|
|
3
|
-
* load without pulling the channel authoring module (and its adapter) back in.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Whether a handler `on` filter matches a delivery.
|
|
7
|
-
*
|
|
8
|
-
* @param on - `"*"`, `"pull_request"`, or `"pull_request.opened"`
|
|
9
|
-
* @param eventName - `X-GitHub-Event`
|
|
10
|
-
* @param action - `payload.action` when present
|
|
11
|
-
*/
|
|
12
|
-
export function githubTriggerMatches(on, eventName, action) {
|
|
13
|
-
if (!on || !eventName)
|
|
14
|
-
return false;
|
|
15
|
-
if (on === "*")
|
|
16
|
-
return true;
|
|
17
|
-
if (on === eventName)
|
|
18
|
-
return true;
|
|
19
|
-
if (action !== undefined && on === `${eventName}.${action}`)
|
|
20
|
-
return true;
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Find the first handler that matches event/action + repository.
|
|
25
|
-
*
|
|
26
|
-
* @returns The handler, or `undefined` when no handler matches (event ignored).
|
|
27
|
-
*/
|
|
28
|
-
export function matchGitHubHandler(config, eventName, repository, action) {
|
|
29
|
-
for (const handler of config.events) {
|
|
30
|
-
if (!githubTriggerMatches(handler.on, eventName, action))
|
|
31
|
-
continue;
|
|
32
|
-
const repos = handler.repositories;
|
|
33
|
-
if (repos && repos.length > 0) {
|
|
34
|
-
if (!repository || !repos.includes(repository))
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
return handler;
|
|
38
|
-
}
|
|
39
|
-
return undefined;
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=match.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"match.js","sourceRoot":"","sources":["../../../src/connectors/github/match.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAClC,EAAU,EACV,SAAiB,EACjB,MAAe;IAEf,IAAI,CAAC,EAAE,IAAI,CAAC,SAAS;QAAE,OAAO,KAAK,CAAC;IACpC,IAAI,EAAE,KAAK,GAAG;QAAE,OAAO,IAAI,CAAC;IAC5B,IAAI,EAAE,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAClC,IAAI,MAAM,KAAK,SAAS,IAAI,EAAE,KAAK,GAAG,SAAS,IAAI,MAAM,EAAE;QAAE,OAAO,IAAI,CAAC;IACzE,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAmC,EACnC,SAAiB,EACjB,UAA8B,EAC9B,MAAe;IAEf,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QACpC,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC;YAAE,SAAS;QACnE,MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC;QACnC,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9B,IAAI,CAAC,UAAU,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC;gBAAE,SAAS;QAC3D,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GitHub App webhook verify + normalize into {@link ChannelEvent}.
|
|
3
|
-
*/
|
|
4
|
-
import type { ChannelEvent } from "../../channels/types.js";
|
|
5
|
-
import type { GitHubWebhookPromptEvent, RequiredGitHubChannelConfig, RequiredGitHubChannelHandler } from "./define.js";
|
|
6
|
-
export declare const GITHUB_WEBHOOK_SECRET_ENV = "GITHUB_WEBHOOK_SECRET";
|
|
7
|
-
export interface GitHubNormalizeResult {
|
|
8
|
-
event: ChannelEvent;
|
|
9
|
-
sourceThreadKey: string;
|
|
10
|
-
trigger: string;
|
|
11
|
-
ignored?: boolean;
|
|
12
|
-
/** Matched handler when the event is accepted (live `prompt` included). */
|
|
13
|
-
handler?: RequiredGitHubChannelHandler;
|
|
14
|
-
/** Envelope passed to {@link RequiredGitHubChannelHandler.prompt}. */
|
|
15
|
-
promptEvent?: GitHubWebhookPromptEvent;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Verify `X-Hub-Signature-256` against the raw body before parsing JSON.
|
|
19
|
-
*/
|
|
20
|
-
export declare function verifyGitHubWebhookSignature(rawBody: string | Uint8Array, signatureHeader: string, secret: string): void;
|
|
21
|
-
/**
|
|
22
|
-
* Normalize a verified GitHub webhook payload into a {@link ChannelEvent}.
|
|
23
|
-
*
|
|
24
|
-
* Accepts any `X-GitHub-Event`. Returns `ignored: true` when no handler matches.
|
|
25
|
-
*/
|
|
26
|
-
export declare function normalizeGitHubEvent(body: unknown, headers: {
|
|
27
|
-
eventName: string;
|
|
28
|
-
deliveryId: string;
|
|
29
|
-
}, config: RequiredGitHubChannelConfig, installationIdFallback?: string): GitHubNormalizeResult;
|
|
30
|
-
/** Best-effort issue/PR number from common webhook payload shapes. */
|
|
31
|
-
export declare function extractIssueOrPullNumber(payload: Record<string, unknown>): number | undefined;
|
|
32
|
-
//# sourceMappingURL=normalize.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/connectors/github/normalize.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EACV,wBAAwB,EACxB,2BAA2B,EAC3B,4BAA4B,EAC7B,MAAM,aAAa,CAAC;AAIrB,eAAO,MAAM,yBAAyB,0BAA0B,CAAC;AAEjE,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,YAAY,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,4BAA4B,CAAC;IACvC,sEAAsE;IACtE,WAAW,CAAC,EAAE,wBAAwB,CAAC;CACxC;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,MAAM,GAAG,UAAU,EAC5B,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,MAAM,GACb,IAAI,CA0BN;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,OAAO,EACb,OAAO,EAAE;IACP,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,EACD,MAAM,EAAE,2BAA2B,EACnC,sBAAsB,CAAC,EAAE,MAAM,GAC9B,qBAAqB,CAgGvB;AAED,sEAAsE;AACtE,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,MAAM,GAAG,SAAS,CAMpB"}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GitHub App webhook verify + normalize into {@link ChannelEvent}.
|
|
3
|
-
*/
|
|
4
|
-
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
5
|
-
import { randomUUID } from "node:crypto";
|
|
6
|
-
import { ChannelError } from "../../channels/errors.js";
|
|
7
|
-
import { matchGitHubHandler } from "./match.js";
|
|
8
|
-
import { encodeGitHubSourceThreadKey } from "./source-thread.js";
|
|
9
|
-
export const GITHUB_WEBHOOK_SECRET_ENV = "GITHUB_WEBHOOK_SECRET";
|
|
10
|
-
/**
|
|
11
|
-
* Verify `X-Hub-Signature-256` against the raw body before parsing JSON.
|
|
12
|
-
*/
|
|
13
|
-
export function verifyGitHubWebhookSignature(rawBody, signatureHeader, secret) {
|
|
14
|
-
if (!secret) {
|
|
15
|
-
throw new ChannelError("channel_provider_rejected", "GitHub webhook secret is not configured");
|
|
16
|
-
}
|
|
17
|
-
const expectedPrefix = "sha256=";
|
|
18
|
-
if (!signatureHeader.startsWith(expectedPrefix)) {
|
|
19
|
-
throw new ChannelError("channel_invalid_signature", "missing or invalid X-Hub-Signature-256");
|
|
20
|
-
}
|
|
21
|
-
const body = typeof rawBody === "string" ? Buffer.from(rawBody) : Buffer.from(rawBody);
|
|
22
|
-
const digest = createHmac("sha256", secret).update(body).digest("hex");
|
|
23
|
-
const provided = signatureHeader.slice(expectedPrefix.length);
|
|
24
|
-
const a = Buffer.from(digest, "utf8");
|
|
25
|
-
const b = Buffer.from(provided, "utf8");
|
|
26
|
-
if (a.length !== b.length || !timingSafeEqual(a, b)) {
|
|
27
|
-
throw new ChannelError("channel_invalid_signature", "GitHub webhook signature mismatch");
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Normalize a verified GitHub webhook payload into a {@link ChannelEvent}.
|
|
32
|
-
*
|
|
33
|
-
* Accepts any `X-GitHub-Event`. Returns `ignored: true` when no handler matches.
|
|
34
|
-
*/
|
|
35
|
-
export function normalizeGitHubEvent(body, headers, config, installationIdFallback) {
|
|
36
|
-
if (!headers.eventName) {
|
|
37
|
-
return ignoredResult(headers.deliveryId);
|
|
38
|
-
}
|
|
39
|
-
const payload = asObject(body);
|
|
40
|
-
const action = stringField(payload.action);
|
|
41
|
-
const installationId = stringField(asObject(payload.installation)?.id) ??
|
|
42
|
-
(numberField(asObject(payload.installation)?.id) !== undefined
|
|
43
|
-
? String(numberField(asObject(payload.installation)?.id))
|
|
44
|
-
: undefined) ??
|
|
45
|
-
installationIdFallback ??
|
|
46
|
-
undefined;
|
|
47
|
-
const repository = asObject(payload.repository);
|
|
48
|
-
const ownerLogin = stringField(asObject(repository.owner)?.login) ??
|
|
49
|
-
stringField(repository.full_name)?.split("/")[0] ??
|
|
50
|
-
undefined;
|
|
51
|
-
const repoName = stringField(repository.name) ??
|
|
52
|
-
stringField(repository.full_name)?.split("/")[1] ??
|
|
53
|
-
undefined;
|
|
54
|
-
const fullName = stringField(repository.full_name) ??
|
|
55
|
-
(ownerLogin && repoName ? `${ownerLogin}/${repoName}` : undefined);
|
|
56
|
-
const handler = matchGitHubHandler(config, headers.eventName, fullName, action);
|
|
57
|
-
if (!handler) {
|
|
58
|
-
return ignoredResult(headers.deliveryId);
|
|
59
|
-
}
|
|
60
|
-
const issueOrPullNumber = extractIssueOrPullNumber(payload);
|
|
61
|
-
const trigger = action !== undefined ? `${headers.eventName}.${action}` : headers.eventName;
|
|
62
|
-
const promptEvent = {
|
|
63
|
-
eventName: headers.eventName,
|
|
64
|
-
...(action !== undefined ? { action } : {}),
|
|
65
|
-
trigger,
|
|
66
|
-
deliveryId: headers.deliveryId,
|
|
67
|
-
...(fullName !== undefined ? { repository: fullName } : {}),
|
|
68
|
-
...(installationId !== undefined ? { installationId } : {}),
|
|
69
|
-
...(issueOrPullNumber !== undefined ? { issueOrPullNumber } : {}),
|
|
70
|
-
payload: body,
|
|
71
|
-
};
|
|
72
|
-
const text = handler.prompt(promptEvent);
|
|
73
|
-
const conversationId = ownerLogin && repoName && issueOrPullNumber !== undefined
|
|
74
|
-
? `${ownerLogin}/${repoName}#${issueOrPullNumber}`
|
|
75
|
-
: (fullName ?? headers.deliveryId);
|
|
76
|
-
const sourceThreadKey = encodeGitHubSourceThreadKey({
|
|
77
|
-
installationId: installationId ?? "unknown",
|
|
78
|
-
owner: ownerLogin,
|
|
79
|
-
repo: repoName,
|
|
80
|
-
number: issueOrPullNumber,
|
|
81
|
-
deliveryId: headers.deliveryId,
|
|
82
|
-
});
|
|
83
|
-
return {
|
|
84
|
-
trigger,
|
|
85
|
-
sourceThreadKey,
|
|
86
|
-
handler,
|
|
87
|
-
promptEvent,
|
|
88
|
-
event: {
|
|
89
|
-
deliveryId: randomUUID(),
|
|
90
|
-
eventId: headers.deliveryId,
|
|
91
|
-
type: trigger,
|
|
92
|
-
address: {
|
|
93
|
-
conversationId,
|
|
94
|
-
...(issueOrPullNumber !== undefined
|
|
95
|
-
? { threadId: conversationId }
|
|
96
|
-
: {}),
|
|
97
|
-
},
|
|
98
|
-
message: { id: headers.deliveryId, text, attachments: [] },
|
|
99
|
-
native: {
|
|
100
|
-
provider: "github",
|
|
101
|
-
payload: {
|
|
102
|
-
eventName: headers.eventName,
|
|
103
|
-
...(action !== undefined ? { action } : {}),
|
|
104
|
-
...(fullName !== undefined ? { repository: fullName } : {}),
|
|
105
|
-
...(installationId !== undefined
|
|
106
|
-
? { installation: { id: installationId } }
|
|
107
|
-
: {}),
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
/** Best-effort issue/PR number from common webhook payload shapes. */
|
|
114
|
-
export function extractIssueOrPullNumber(payload) {
|
|
115
|
-
const pr = numberField(asObject(payload.pull_request).number);
|
|
116
|
-
if (pr !== undefined)
|
|
117
|
-
return pr;
|
|
118
|
-
const issue = numberField(asObject(payload.issue).number);
|
|
119
|
-
if (issue !== undefined)
|
|
120
|
-
return issue;
|
|
121
|
-
return numberField(payload.number);
|
|
122
|
-
}
|
|
123
|
-
function ignoredResult(deliveryHeader) {
|
|
124
|
-
return {
|
|
125
|
-
ignored: true,
|
|
126
|
-
trigger: "ignored",
|
|
127
|
-
sourceThreadKey: "",
|
|
128
|
-
event: {
|
|
129
|
-
deliveryId: randomUUID(),
|
|
130
|
-
eventId: deliveryHeader,
|
|
131
|
-
type: "ignored",
|
|
132
|
-
address: { conversationId: "" },
|
|
133
|
-
},
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
function asObject(value) {
|
|
137
|
-
return typeof value === "object" && value !== null
|
|
138
|
-
? value
|
|
139
|
-
: {};
|
|
140
|
-
}
|
|
141
|
-
function stringField(value) {
|
|
142
|
-
if (typeof value === "number" && Number.isFinite(value)) {
|
|
143
|
-
return String(value);
|
|
144
|
-
}
|
|
145
|
-
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
146
|
-
}
|
|
147
|
-
function numberField(value) {
|
|
148
|
-
return typeof value === "number" && Number.isFinite(value)
|
|
149
|
-
? value
|
|
150
|
-
: undefined;
|
|
151
|
-
}
|
|
152
|
-
//# sourceMappingURL=normalize.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../../src/connectors/github/normalize.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAOxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEjE,MAAM,CAAC,MAAM,yBAAyB,GAAG,uBAAuB,CAAC;AAajE;;GAEG;AACH,MAAM,UAAU,4B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