@geminixiang/mikan 1.0.0-beta.13 → 1.0.0-beta.14
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/CHANGELOG.md +33 -0
- package/README.md +10 -10
- package/dist/adapters/discord/bot.d.ts.map +1 -1
- package/dist/adapters/discord/bot.js +26 -67
- package/dist/adapters/discord/bot.js.map +1 -1
- package/dist/adapters/discord/context.d.ts.map +1 -1
- package/dist/adapters/discord/context.js +17 -43
- package/dist/adapters/discord/context.js.map +1 -1
- package/dist/adapters/github/bot.d.ts +69 -1
- package/dist/adapters/github/bot.d.ts.map +1 -1
- package/dist/adapters/github/bot.js +428 -57
- package/dist/adapters/github/bot.js.map +1 -1
- package/dist/adapters/github/client.d.ts +32 -1
- package/dist/adapters/github/client.d.ts.map +1 -1
- package/dist/adapters/github/client.js +79 -0
- package/dist/adapters/github/client.js.map +1 -1
- package/dist/adapters/github/cloudbuild.d.ts +24 -0
- package/dist/adapters/github/cloudbuild.d.ts.map +1 -0
- package/dist/adapters/github/cloudbuild.js +71 -0
- package/dist/adapters/github/cloudbuild.js.map +1 -0
- package/dist/adapters/github/context.d.ts.map +1 -1
- package/dist/adapters/github/context.js +34 -31
- package/dist/adapters/github/context.js.map +1 -1
- package/dist/adapters/github/gcp-auth.d.ts +31 -0
- package/dist/adapters/github/gcp-auth.d.ts.map +1 -0
- package/dist/adapters/github/gcp-auth.js +196 -0
- package/dist/adapters/github/gcp-auth.js.map +1 -0
- package/dist/adapters/github/ids.d.ts +9 -0
- package/dist/adapters/github/ids.d.ts.map +1 -1
- package/dist/adapters/github/ids.js +14 -0
- package/dist/adapters/github/ids.js.map +1 -1
- package/dist/adapters/github/repo.d.ts +13 -2
- package/dist/adapters/github/repo.d.ts.map +1 -1
- package/dist/adapters/github/repo.js +80 -2
- package/dist/adapters/github/repo.js.map +1 -1
- package/dist/adapters/github/tool-pack.d.ts +3 -1
- package/dist/adapters/github/tool-pack.d.ts.map +1 -1
- package/dist/adapters/github/tool-pack.js +30 -4
- package/dist/adapters/github/tool-pack.js.map +1 -1
- package/dist/{tools/github-checks.d.ts → adapters/github/tools/checks.d.ts} +4 -2
- package/dist/adapters/github/tools/checks.d.ts.map +1 -0
- package/dist/{tools/github-checks.js → adapters/github/tools/checks.js} +28 -11
- package/dist/adapters/github/tools/checks.js.map +1 -0
- package/dist/adapters/github/tools/issue.d.ts +22 -0
- package/dist/adapters/github/tools/issue.d.ts.map +1 -0
- package/dist/adapters/github/tools/issue.js +59 -0
- package/dist/adapters/github/tools/issue.js.map +1 -0
- package/dist/{tools/github-pr.d.ts → adapters/github/tools/pr.d.ts} +2 -2
- package/dist/adapters/github/tools/pr.d.ts.map +1 -0
- package/dist/{tools/github-pr.js → adapters/github/tools/pr.js} +8 -4
- package/dist/adapters/github/tools/pr.js.map +1 -0
- package/dist/adapters/github/tools/read.d.ts +22 -0
- package/dist/adapters/github/tools/read.d.ts.map +1 -0
- package/dist/adapters/github/tools/read.js +152 -0
- package/dist/adapters/github/tools/read.js.map +1 -0
- package/dist/adapters/github/tools/review-reply.d.ts +19 -0
- package/dist/adapters/github/tools/review-reply.d.ts.map +1 -0
- package/dist/adapters/github/tools/review-reply.js +49 -0
- package/dist/adapters/github/tools/review-reply.js.map +1 -0
- package/dist/adapters/github/tools/sync.d.ts +17 -0
- package/dist/adapters/github/tools/sync.d.ts.map +1 -0
- package/dist/adapters/github/tools/sync.js +45 -0
- package/dist/adapters/github/tools/sync.js.map +1 -0
- package/dist/adapters/github/types.d.ts +174 -1
- package/dist/adapters/github/types.d.ts.map +1 -1
- package/dist/adapters/github/types.js.map +1 -1
- package/dist/adapters/intake.d.ts +16 -5
- package/dist/adapters/intake.d.ts.map +1 -1
- package/dist/adapters/intake.js +79 -22
- package/dist/adapters/intake.js.map +1 -1
- package/dist/adapters/slack/bot.d.ts +7 -6
- package/dist/adapters/slack/bot.d.ts.map +1 -1
- package/dist/adapters/slack/bot.js +65 -135
- package/dist/adapters/slack/bot.js.map +1 -1
- package/dist/adapters/slack/context.d.ts.map +1 -1
- package/dist/adapters/slack/context.js +3 -15
- package/dist/adapters/slack/context.js.map +1 -1
- package/dist/adapters/slack/response-lifecycle.d.ts.map +1 -1
- package/dist/adapters/slack/response-lifecycle.js +7 -16
- package/dist/adapters/slack/response-lifecycle.js.map +1 -1
- package/dist/adapters/slack/session.d.ts.map +1 -1
- package/dist/adapters/slack/session.js +5 -8
- package/dist/adapters/slack/session.js.map +1 -1
- package/dist/adapters/streaming.d.ts +4 -0
- package/dist/adapters/streaming.d.ts.map +1 -1
- package/dist/adapters/streaming.js +11 -0
- package/dist/adapters/streaming.js.map +1 -1
- package/dist/adapters/telegram/bot.d.ts +0 -2
- package/dist/adapters/telegram/bot.d.ts.map +1 -1
- package/dist/adapters/telegram/bot.js +16 -62
- package/dist/adapters/telegram/bot.js.map +1 -1
- package/dist/adapters/telegram/context.d.ts.map +1 -1
- package/dist/adapters/telegram/context.js +8 -28
- package/dist/adapters/telegram/context.js.map +1 -1
- package/dist/adapters/types.d.ts +28 -2
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/adapters/types.js.map +1 -1
- package/dist/agent.d.ts +21 -4
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +22 -9
- package/dist/agent.js.map +1 -1
- package/dist/commands/admin.d.ts.map +1 -1
- package/dist/commands/admin.js +2 -1
- package/dist/commands/admin.js.map +1 -1
- package/dist/commands/auto-reply.d.ts.map +1 -1
- package/dist/commands/auto-reply.js +2 -6
- package/dist/commands/auto-reply.js.map +1 -1
- package/dist/commands/extensions.d.ts.map +1 -1
- package/dist/commands/extensions.js +2 -1
- package/dist/commands/extensions.js.map +1 -1
- package/dist/commands/login.d.ts +2 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +30 -1
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/manifest.d.ts +72 -0
- package/dist/commands/manifest.d.ts.map +1 -0
- package/dist/commands/manifest.js +121 -0
- package/dist/commands/manifest.js.map +1 -0
- package/dist/commands/model.d.ts.map +1 -1
- package/dist/commands/model.js +2 -1
- package/dist/commands/model.js.map +1 -1
- package/dist/commands/new.d.ts.map +1 -1
- package/dist/commands/new.js +2 -1
- package/dist/commands/new.js.map +1 -1
- package/dist/commands/sandbox.d.ts.map +1 -1
- package/dist/commands/sandbox.js +3 -2
- package/dist/commands/sandbox.js.map +1 -1
- package/dist/commands/text.d.ts +2 -0
- package/dist/commands/text.d.ts.map +1 -0
- package/dist/commands/text.js +16 -0
- package/dist/commands/text.js.map +1 -0
- package/dist/commands/types.d.ts +12 -1
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/types.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +49 -54
- package/dist/config.js.map +1 -1
- package/dist/events.d.ts +10 -0
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +14 -5
- package/dist/events.js.map +1 -1
- package/dist/execution-resolver.d.ts.map +1 -1
- package/dist/execution-resolver.js +3 -3
- package/dist/execution-resolver.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.js +25 -5
- package/dist/main.js.map +1 -1
- package/dist/provisioner.d.ts.map +1 -1
- package/dist/provisioner.js +2 -5
- package/dist/provisioner.js.map +1 -1
- package/dist/runtime/conversation-runtime.d.ts +1 -1
- package/dist/runtime/conversation-runtime.d.ts.map +1 -1
- package/dist/runtime/conversation-runtime.js +230 -37
- package/dist/runtime/conversation-runtime.js.map +1 -1
- package/dist/runtime/types.d.ts +19 -4
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/runtime/types.js.map +1 -1
- package/dist/sandbox/cloudflare.d.ts +2 -0
- package/dist/sandbox/cloudflare.d.ts.map +1 -1
- package/dist/sandbox/cloudflare.js +7 -0
- package/dist/sandbox/cloudflare.js.map +1 -1
- package/dist/sandbox/container.d.ts +2 -0
- package/dist/sandbox/container.d.ts.map +1 -1
- package/dist/sandbox/container.js +7 -1
- package/dist/sandbox/container.js.map +1 -1
- package/dist/sandbox/firecracker.d.ts +2 -0
- package/dist/sandbox/firecracker.d.ts.map +1 -1
- package/dist/sandbox/firecracker.js +7 -1
- package/dist/sandbox/firecracker.js.map +1 -1
- package/dist/sandbox/host.d.ts +2 -0
- package/dist/sandbox/host.d.ts.map +1 -1
- package/dist/sandbox/host.js +11 -0
- package/dist/sandbox/host.js.map +1 -1
- package/dist/sandbox/identity.d.ts +21 -0
- package/dist/sandbox/identity.d.ts.map +1 -0
- package/dist/sandbox/identity.js +35 -0
- package/dist/sandbox/identity.js.map +1 -0
- package/dist/sandbox/types.d.ts +12 -0
- package/dist/sandbox/types.d.ts.map +1 -1
- package/dist/sandbox/types.js.map +1 -1
- package/dist/sandbox/utils.d.ts +11 -0
- package/dist/sandbox/utils.d.ts.map +1 -1
- package/dist/sandbox/utils.js +35 -0
- package/dist/sandbox/utils.js.map +1 -1
- package/dist/sessions/agent-memory-file-manager.d.ts.map +1 -1
- package/dist/sessions/agent-memory-file-manager.js +16 -19
- package/dist/sessions/agent-memory-file-manager.js.map +1 -1
- package/dist/sessions/history-line.d.ts +20 -0
- package/dist/sessions/history-line.d.ts.map +1 -0
- package/dist/sessions/history-line.js +24 -0
- package/dist/sessions/history-line.js.map +1 -0
- package/dist/sessions/policy.d.ts.map +1 -1
- package/dist/sessions/policy.js +4 -3
- package/dist/sessions/policy.js.map +1 -1
- package/dist/sessions/session-key.d.ts +31 -0
- package/dist/sessions/session-key.d.ts.map +1 -0
- package/dist/sessions/session-key.js +44 -0
- package/dist/sessions/session-key.js.map +1 -0
- package/dist/sessions/store.d.ts.map +1 -1
- package/dist/sessions/store.js +2 -2
- package/dist/sessions/store.js.map +1 -1
- package/dist/tools/bash.d.ts +3 -1
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +24 -17
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/edit.d.ts.map +1 -1
- package/dist/tools/edit.js +9 -12
- package/dist/tools/edit.js.map +1 -1
- package/dist/tools/event.d.ts +1 -1
- package/dist/tools/event.d.ts.map +1 -1
- package/dist/tools/event.js +33 -4
- package/dist/tools/event.js.map +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/types.d.ts +6 -1
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js.map +1 -1
- package/dist/tools/write.d.ts.map +1 -1
- package/dist/tools/write.js +1 -8
- package/dist/tools/write.js.map +1 -1
- package/dist/types.d.ts +13 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/vault/disabled.d.ts +9 -0
- package/dist/vault/disabled.d.ts.map +1 -0
- package/dist/vault/disabled.js +23 -0
- package/dist/vault/disabled.js.map +1 -0
- package/dist/vault/index.d.ts.map +1 -1
- package/dist/vault/index.js +2 -7
- package/dist/vault/index.js.map +1 -1
- package/dist/vault/routing.d.ts +1 -0
- package/dist/vault/routing.d.ts.map +1 -1
- package/dist/vault/routing.js +3 -10
- package/dist/vault/routing.js.map +1 -1
- package/dist/web/admin/portal.d.ts +27 -0
- package/dist/web/admin/portal.d.ts.map +1 -1
- package/dist/web/admin/portal.js +87 -126
- package/dist/web/admin/portal.js.map +1 -1
- package/dist/web/admin/types.d.ts +3 -0
- package/dist/web/admin/types.d.ts.map +1 -1
- package/dist/web/admin/types.js.map +1 -1
- package/dist/web/login/oauth.d.ts +2 -3
- package/dist/web/login/oauth.d.ts.map +1 -1
- package/dist/web/login/oauth.js +0 -31
- package/dist/web/login/oauth.js.map +1 -1
- package/dist/web/login/types.d.ts +0 -11
- package/dist/web/login/types.d.ts.map +1 -1
- package/dist/web/login/types.js.map +1 -1
- package/dist/web/server.d.ts.map +1 -1
- package/dist/web/server.js +7 -0
- package/dist/web/server.js.map +1 -1
- package/dist/web/session-view/command.d.ts.map +1 -1
- package/dist/web/session-view/command.js +4 -1
- package/dist/web/session-view/command.js.map +1 -1
- package/dist/web/session-view/portal.d.ts.map +1 -1
- package/dist/web/session-view/portal.js +3 -2
- package/dist/web/session-view/portal.js.map +1 -1
- package/dist/web/session-view/service.d.ts.map +1 -1
- package/dist/web/session-view/service.js +2 -1
- package/dist/web/session-view/service.js.map +1 -1
- package/dist/web/session-view/types.d.ts +2 -1
- package/dist/web/session-view/types.d.ts.map +1 -1
- package/dist/web/session-view/types.js.map +1 -1
- package/package.json +1 -1
- package/dist/runtime/agent-run-controller.d.ts +0 -31
- package/dist/runtime/agent-run-controller.d.ts.map +0 -1
- package/dist/runtime/agent-run-controller.js +0 -195
- package/dist/runtime/agent-run-controller.js.map +0 -1
- package/dist/tools/github-checks.d.ts.map +0 -1
- package/dist/tools/github-checks.js.map +0 -1
- package/dist/tools/github-pr.d.ts.map +0 -1
- package/dist/tools/github-pr.js.map +0 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
const githubSyncSchema = Type.Object({
|
|
3
|
+
branch: Type.Optional(Type.String({
|
|
4
|
+
description: "Remote branch to fetch. Omit to fetch this PR's latest head (or the default " +
|
|
5
|
+
"branch in a plain-issue conversation).",
|
|
6
|
+
})),
|
|
7
|
+
});
|
|
8
|
+
/**
|
|
9
|
+
* The `github_sync` tool refreshes the conversation's ./repo clone — a
|
|
10
|
+
* first-contact snapshot the sandbox cannot update itself (no credentials).
|
|
11
|
+
* Host-side fetch with an ephemeral read token; it reports instead of moving
|
|
12
|
+
* the checkout whenever that could lose the agent's local work.
|
|
13
|
+
*/
|
|
14
|
+
export function createGithubSyncTool() {
|
|
15
|
+
let syncFn = null;
|
|
16
|
+
const tool = {
|
|
17
|
+
name: "github_sync",
|
|
18
|
+
label: "github_sync",
|
|
19
|
+
description: "Update ./repo from GitHub: fetches this PR's latest head (or the default branch, " +
|
|
20
|
+
"or a named branch) and fast-forwards the checkout when that cannot lose your work; " +
|
|
21
|
+
"otherwise it fetches to FETCH_HEAD and reports so you can merge or rebase yourself. " +
|
|
22
|
+
"Only available in GitHub conversations.",
|
|
23
|
+
parameters: githubSyncSchema,
|
|
24
|
+
execute: async (_toolCallId, args, signal) => {
|
|
25
|
+
if (!syncFn) {
|
|
26
|
+
throw new Error("github_sync is only available in GitHub conversations.");
|
|
27
|
+
}
|
|
28
|
+
if (signal?.aborted) {
|
|
29
|
+
throw new Error("Operation aborted");
|
|
30
|
+
}
|
|
31
|
+
const report = await syncFn(args.branch);
|
|
32
|
+
return {
|
|
33
|
+
content: [{ type: "text", text: report }],
|
|
34
|
+
details: undefined,
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
tool,
|
|
40
|
+
setGithubSyncFunction: (fn) => {
|
|
41
|
+
syncFn = fn;
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../../src/adapters/github/tools/sync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC;IACnC,MAAM,EAAE,IAAI,CAAC,QAAQ,CACnB,IAAI,CAAC,MAAM,CAAC;QACV,WAAW,EACT,8EAA8E;YAC9E,wCAAwC;KAC3C,CAAC,CACH;CACF,CAAC,CAAC;AAIH;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB;IAIlC,IAAI,MAAM,GAAwB,IAAI,CAAC;IAEvC,MAAM,IAAI,GAAuC;QAC/C,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE,aAAa;QACpB,WAAW,EACT,mFAAmF;YACnF,qFAAqF;YACrF,sFAAsF;YACtF,yCAAyC;QAC3C,UAAU,EAAE,gBAAgB;QAC5B,OAAO,EAAE,KAAK,EAAE,WAAmB,EAAE,IAAyB,EAAE,MAAoB,EAAE,EAAE;YACtF,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;YAC5E,CAAC;YACD,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;gBACpB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;YACvC,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACzC,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gBAClD,OAAO,EAAE,SAAS;aACnB,CAAC;QACJ,CAAC;KACF,CAAC;IAEF,OAAO;QACL,IAAI;QACJ,qBAAqB,EAAE,CAAC,EAAE,EAAE,EAAE;YAC5B,MAAM,GAAG,EAAE,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport { Type } from \"@sinclair/typebox\";\n\nconst githubSyncSchema = Type.Object({\n branch: Type.Optional(\n Type.String({\n description:\n \"Remote branch to fetch. Omit to fetch this PR's latest head (or the default \" +\n \"branch in a plain-issue conversation).\",\n }),\n ),\n});\n\nexport type GithubSyncFn = (branch?: string) => Promise<string>;\n\n/**\n * The `github_sync` tool refreshes the conversation's ./repo clone — a\n * first-contact snapshot the sandbox cannot update itself (no credentials).\n * Host-side fetch with an ephemeral read token; it reports instead of moving\n * the checkout whenever that could lose the agent's local work.\n */\nexport function createGithubSyncTool(): {\n tool: AgentTool<typeof githubSyncSchema>;\n setGithubSyncFunction: (fn: GithubSyncFn | null) => void;\n} {\n let syncFn: GithubSyncFn | null = null;\n\n const tool: AgentTool<typeof githubSyncSchema> = {\n name: \"github_sync\",\n label: \"github_sync\",\n description:\n \"Update ./repo from GitHub: fetches this PR's latest head (or the default branch, \" +\n \"or a named branch) and fast-forwards the checkout when that cannot lose your work; \" +\n \"otherwise it fetches to FETCH_HEAD and reports so you can merge or rebase yourself. \" +\n \"Only available in GitHub conversations.\",\n parameters: githubSyncSchema,\n execute: async (_toolCallId: string, args: { branch?: string }, signal?: AbortSignal) => {\n if (!syncFn) {\n throw new Error(\"github_sync is only available in GitHub conversations.\");\n }\n if (signal?.aborted) {\n throw new Error(\"Operation aborted\");\n }\n const report = await syncFn(args.branch);\n return {\n content: [{ type: \"text\" as const, text: report }],\n details: undefined,\n };\n },\n };\n\n return {\n tool,\n setGithubSyncFunction: (fn) => {\n syncFn = fn;\n },\n };\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ConversationEvent } from "../../adapter.js";
|
|
2
|
+
import type { GcpTokenProvider } from "./gcp-auth.js";
|
|
2
3
|
export interface GithubEvent extends ConversationEvent {
|
|
3
4
|
type: "message" | "issue";
|
|
4
5
|
userName?: string;
|
|
@@ -19,6 +20,16 @@ export interface GithubBotConfig {
|
|
|
19
20
|
* re-trigger runs.
|
|
20
21
|
*/
|
|
21
22
|
syncStatePath: string;
|
|
23
|
+
/**
|
|
24
|
+
* Present when the host has GCP credentials (GOOGLE_APPLICATION_CREDENTIALS):
|
|
25
|
+
* lets github_checks fetch Cloud Build logs. Credentials never enter the
|
|
26
|
+
* sandbox; absent, external-CI checks degrade to guidance text.
|
|
27
|
+
*/
|
|
28
|
+
cloudBuild?: {
|
|
29
|
+
tokenProvider: GcpTokenProvider;
|
|
30
|
+
/** Project used when a check's details_url does not name one. */
|
|
31
|
+
projectFallback?: string;
|
|
32
|
+
};
|
|
22
33
|
}
|
|
23
34
|
/** Persisted per-repo poll watermark (DESIGN.md § Event source). */
|
|
24
35
|
interface GithubRepoSyncState {
|
|
@@ -28,6 +39,8 @@ interface GithubRepoSyncState {
|
|
|
28
39
|
cursor: string;
|
|
29
40
|
seenComments: number[];
|
|
30
41
|
seenIssues: number[];
|
|
42
|
+
/** Optional so state files written before review-comment polling still load. */
|
|
43
|
+
seenReviewComments?: number[];
|
|
31
44
|
}
|
|
32
45
|
export interface GithubSyncState {
|
|
33
46
|
repos: Record<string, GithubRepoSyncState>;
|
|
@@ -52,6 +65,14 @@ export interface GithubIssue {
|
|
|
52
65
|
created_at: string;
|
|
53
66
|
updated_at: string;
|
|
54
67
|
pull_request?: object;
|
|
68
|
+
/** open | closed */
|
|
69
|
+
state?: string;
|
|
70
|
+
labels?: {
|
|
71
|
+
name: string;
|
|
72
|
+
}[];
|
|
73
|
+
assignees?: {
|
|
74
|
+
login: string;
|
|
75
|
+
}[];
|
|
55
76
|
}
|
|
56
77
|
export interface GithubIssueComment {
|
|
57
78
|
id: number;
|
|
@@ -62,6 +83,24 @@ export interface GithubIssueComment {
|
|
|
62
83
|
/** API URL of the parent issue, e.g. …/repos/o/r/issues/42 */
|
|
63
84
|
issue_url: string;
|
|
64
85
|
}
|
|
86
|
+
/** An inline PR review comment (a comment on a diff line). */
|
|
87
|
+
export interface GithubReviewComment {
|
|
88
|
+
id: number;
|
|
89
|
+
body: string;
|
|
90
|
+
user: GithubUser;
|
|
91
|
+
created_at: string;
|
|
92
|
+
updated_at: string;
|
|
93
|
+
/** API URL of the parent PR, e.g. …/repos/o/r/pulls/42 */
|
|
94
|
+
pull_request_url: string;
|
|
95
|
+
/** File the comment is anchored to. */
|
|
96
|
+
path: string;
|
|
97
|
+
/** Line in the diff's right side; null when the anchor is outdated. */
|
|
98
|
+
line: number | null;
|
|
99
|
+
/** The diff excerpt the comment is anchored to. */
|
|
100
|
+
diff_hunk: string;
|
|
101
|
+
/** Set on replies: the id of the thread's root comment. */
|
|
102
|
+
in_reply_to_id?: number;
|
|
103
|
+
}
|
|
65
104
|
export interface GithubRepository {
|
|
66
105
|
name: string;
|
|
67
106
|
owner: GithubUser;
|
|
@@ -78,10 +117,45 @@ export interface GithubCollaboratorPermission {
|
|
|
78
117
|
export interface GithubPullRequest {
|
|
79
118
|
number: number;
|
|
80
119
|
html_url: string;
|
|
120
|
+
/** head.repo is null when the fork a PR came from was deleted. */
|
|
81
121
|
head?: {
|
|
82
122
|
ref: string;
|
|
83
123
|
sha: string;
|
|
124
|
+
repo?: {
|
|
125
|
+
full_name?: string;
|
|
126
|
+
} | null;
|
|
127
|
+
};
|
|
128
|
+
base?: {
|
|
129
|
+
ref: string;
|
|
84
130
|
};
|
|
131
|
+
title?: string;
|
|
132
|
+
body?: string | null;
|
|
133
|
+
/** open | closed */
|
|
134
|
+
state?: string;
|
|
135
|
+
draft?: boolean;
|
|
136
|
+
merged?: boolean;
|
|
137
|
+
mergeable_state?: string;
|
|
138
|
+
changed_files?: number;
|
|
139
|
+
additions?: number;
|
|
140
|
+
deletions?: number;
|
|
141
|
+
user?: GithubUser;
|
|
142
|
+
}
|
|
143
|
+
/** One row of GET /pulls/{n}/files. */
|
|
144
|
+
export interface GithubPullRequestFile {
|
|
145
|
+
filename: string;
|
|
146
|
+
/** added | removed | modified | renamed | … */
|
|
147
|
+
status: string;
|
|
148
|
+
additions: number;
|
|
149
|
+
deletions: number;
|
|
150
|
+
}
|
|
151
|
+
/** One submitted review of GET /pulls/{n}/reviews. */
|
|
152
|
+
export interface GithubPullRequestReview {
|
|
153
|
+
id: number;
|
|
154
|
+
user: GithubUser;
|
|
155
|
+
body: string | null;
|
|
156
|
+
/** APPROVED | CHANGES_REQUESTED | COMMENTED | DISMISSED | PENDING */
|
|
157
|
+
state: string;
|
|
158
|
+
submitted_at?: string;
|
|
85
159
|
}
|
|
86
160
|
export interface GithubCheckRun {
|
|
87
161
|
/** Check-run id; for GitHub Actions this doubles as the job id (log fetch). */
|
|
@@ -101,6 +175,10 @@ export interface GithubCheckRun {
|
|
|
101
175
|
title?: string | null;
|
|
102
176
|
summary?: string | null;
|
|
103
177
|
} | null;
|
|
178
|
+
/** The reporting app's own id for the run; Cloud Build puts the build UUID here. */
|
|
179
|
+
external_id?: string | null;
|
|
180
|
+
/** The reporting app's own results page; Cloud Build encodes the GCP project here. */
|
|
181
|
+
details_url?: string | null;
|
|
104
182
|
}
|
|
105
183
|
/** Permission subset requestable on a scoped installation token. */
|
|
106
184
|
export type GithubTokenPermissions = Partial<Record<"contents" | "pull_requests" | "issues", "read" | "write">>;
|
|
@@ -114,14 +192,45 @@ export interface CloneRepoOptions {
|
|
|
114
192
|
token: string;
|
|
115
193
|
botLogin: string;
|
|
116
194
|
botEmail: string;
|
|
117
|
-
/** When the conversation is a PR: fetch and
|
|
195
|
+
/** When the conversation is a PR: fetch and check out its head. */
|
|
118
196
|
prNumber?: number;
|
|
197
|
+
/**
|
|
198
|
+
* The PR's head branch name when it lives in this repo (not a fork): the
|
|
199
|
+
* checkout is named after it so committing there + github_pr updates the
|
|
200
|
+
* PR in place. Absent (fork/unknown), the checkout falls back to pr-<n>.
|
|
201
|
+
*/
|
|
202
|
+
prHeadBranch?: string;
|
|
119
203
|
}
|
|
120
204
|
export interface PushBranchOptions {
|
|
121
205
|
dir: string;
|
|
122
206
|
branch: string;
|
|
123
207
|
token: string;
|
|
124
208
|
}
|
|
209
|
+
export interface SyncRepoOptions {
|
|
210
|
+
dir: string;
|
|
211
|
+
/** Ephemeral contents:read token; used per-invocation, never stored. */
|
|
212
|
+
token: string;
|
|
213
|
+
/** Explicit branch to fetch; wins over prNumber/defaultBranch. */
|
|
214
|
+
branch?: string;
|
|
215
|
+
/** PR conversations: fetch pull/<n>/head into the local PR checkout. */
|
|
216
|
+
prNumber?: number;
|
|
217
|
+
/** Same-repo PR head name; the local checkout target. Fallback: pr-<n>. */
|
|
218
|
+
prHeadBranch?: string;
|
|
219
|
+
/** Fallback target when neither branch nor prNumber applies. */
|
|
220
|
+
defaultBranch?: string;
|
|
221
|
+
}
|
|
222
|
+
export interface SyncRepoResult {
|
|
223
|
+
/** Local branch the fetch targets (the PR head name, pr-<n>, or the branch). */
|
|
224
|
+
target: string;
|
|
225
|
+
fetchedSha: string;
|
|
226
|
+
/** True when the checkout was moved to the fetched head. */
|
|
227
|
+
updatedCheckout: boolean;
|
|
228
|
+
/** Working tree had uncommitted changes (checkout left alone). */
|
|
229
|
+
dirty: boolean;
|
|
230
|
+
currentBranch: string;
|
|
231
|
+
/** Bot-committed (agent-made) commits on the target that origin lacks. */
|
|
232
|
+
localCommits: number;
|
|
233
|
+
}
|
|
125
234
|
export interface GithubClientOptions {
|
|
126
235
|
appId: string;
|
|
127
236
|
privateKey: string;
|
|
@@ -160,6 +269,58 @@ export interface GithubCheckSummary {
|
|
|
160
269
|
appSlug: string | null;
|
|
161
270
|
/** The reporting app's own summary of the run, when it posted one. */
|
|
162
271
|
outputSummary: string | null;
|
|
272
|
+
/** The reporting app's run id (Cloud Build: the build UUID). */
|
|
273
|
+
externalId: string | null;
|
|
274
|
+
/** True when this run's log is fetchable via build_id (Cloud Build + GCP creds). */
|
|
275
|
+
buildLogAvailable?: boolean;
|
|
276
|
+
}
|
|
277
|
+
/** Arguments for the host-side `github_read` tool. */
|
|
278
|
+
export interface GithubReadRequest {
|
|
279
|
+
action: "pr" | "pr_files" | "pr_reviews" | "issue" | "comments" | "list";
|
|
280
|
+
/** Issue/PR number; defaults to the conversation's own. */
|
|
281
|
+
number?: number;
|
|
282
|
+
/** list only: open | closed | all (default open). */
|
|
283
|
+
state?: string;
|
|
284
|
+
/** list only: comma-separated label names. */
|
|
285
|
+
labels?: string;
|
|
286
|
+
/** list only: filter by author login. */
|
|
287
|
+
creator?: string;
|
|
288
|
+
}
|
|
289
|
+
/** Typed payload of one `github_read` action; the tool renders it. */
|
|
290
|
+
export type GithubReadResult = {
|
|
291
|
+
kind: "pr";
|
|
292
|
+
pr: GithubPullRequest;
|
|
293
|
+
} | {
|
|
294
|
+
kind: "pr_files";
|
|
295
|
+
files: GithubPullRequestFile[];
|
|
296
|
+
} | {
|
|
297
|
+
kind: "pr_reviews";
|
|
298
|
+
reviews: GithubPullRequestReview[];
|
|
299
|
+
threads: GithubReviewComment[];
|
|
300
|
+
} | {
|
|
301
|
+
kind: "issue";
|
|
302
|
+
issue: GithubIssue;
|
|
303
|
+
} | {
|
|
304
|
+
kind: "comments";
|
|
305
|
+
comments: GithubIssueComment[];
|
|
306
|
+
} | {
|
|
307
|
+
kind: "list";
|
|
308
|
+
issues: GithubIssue[];
|
|
309
|
+
};
|
|
310
|
+
/** Arguments for the host-side `github_issue` tool. Deliberately a closed
|
|
311
|
+
* action set: lock/delete/transfer are not offered at all. */
|
|
312
|
+
export interface GithubIssueRequest {
|
|
313
|
+
action: "add_labels" | "remove_label" | "add_assignees" | "remove_assignees" | "close" | "reopen";
|
|
314
|
+
/** Issue/PR number; defaults to the conversation's own (triage may target others). */
|
|
315
|
+
number?: number;
|
|
316
|
+
/** add_labels */
|
|
317
|
+
labels?: string[];
|
|
318
|
+
/** remove_label */
|
|
319
|
+
label?: string;
|
|
320
|
+
/** add_assignees / remove_assignees */
|
|
321
|
+
assignees?: string[];
|
|
322
|
+
/** close */
|
|
323
|
+
state_reason?: "completed" | "not_planned";
|
|
163
324
|
}
|
|
164
325
|
/**
|
|
165
326
|
* Host-side GitHub operations for github_* tools. Wired in main.ts over the
|
|
@@ -172,6 +333,18 @@ export interface PlatformGithubOps {
|
|
|
172
333
|
getChecks(conversationId: string, branch?: string): Promise<GithubCheckSummary[]>;
|
|
173
334
|
/** Log text of one CI job (an Actions check-run id), tail-truncated. */
|
|
174
335
|
getJobLog(conversationId: string, jobId: number): Promise<string>;
|
|
336
|
+
/** Log text of one Cloud Build run (a [build …] uuid), tail-truncated. */
|
|
337
|
+
getBuildLog(conversationId: string, buildId: string): Promise<string>;
|
|
338
|
+
/** Reply inside one inline review thread of the conversation's PR. */
|
|
339
|
+
replyToReviewThread(conversationId: string, commentId: number, body: string): Promise<{
|
|
340
|
+
url: string;
|
|
341
|
+
}>;
|
|
342
|
+
/** Refresh the conversation's ./repo clone; returns a human-readable report. */
|
|
343
|
+
syncRepo(conversationId: string, branch?: string): Promise<string>;
|
|
344
|
+
/** Read PR/issue metadata the clone cannot provide; same repo only. */
|
|
345
|
+
readGithub(conversationId: string, request: GithubReadRequest): Promise<GithubReadResult>;
|
|
346
|
+
/** Label/assignee/state management on this repo's issues; returns a report. */
|
|
347
|
+
manageIssue(conversationId: string, request: GithubIssueRequest): Promise<string>;
|
|
175
348
|
}
|
|
176
349
|
export {};
|
|
177
350
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/adapters/github/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/adapters/github/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,MAAM,WAAW,WAAY,SAAQ,iBAAiB;IACpD,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,4EAA4E;IAC5E,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,UAAU,CAAC,EAAE;QACX,aAAa,EAAE,gBAAgB,CAAC;QAChC,iEAAiE;QACjE,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAED,oEAAoE;AACpE,UAAU,mBAAmB;IAC3B,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,E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IAChC,uEAAuE;IACvE,eAAe,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC3F,kFAAkF;IAClF,SAAS,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAClF,wEAAwE;IACxE,SAAS,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAClE,0EAA0E;IAC1E,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACtE,sEAAsE;IACtE,mBAAmB,CACjB,cAAc,EAAE,MAAM,EACtB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5B,gFAAgF;IAChF,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACnE,uEAAuE;IACvE,UAAU,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC1F,+EAA+E;IAC/E,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACnF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/adapters/github/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ConversationEvent } from \"../../adapter.js\";\n\nexport interface GithubEvent extends ConversationEvent {\n type: \"message\" | \"issue\";\n userName?: string;\n}\n\nexport interface GithubBotConfig {\n appId: string;\n /** PEM-encoded GitHub App private key. */\n privateKey: string;\n installationId: string;\n /** `owner/repo` entries to watch; empty = all installation repositories. */\n repos: string[];\n pollIntervalMs: number;\n workingDir: string;\n /**\n * Where the poll watermark state (baseline + seen ids) is persisted. Lives\n * under the host-only state dir: the workspace dir can be mounted into\n * sandboxes, and sandboxed code must not be able to clear dedup state and\n * re-trigger runs.\n */\n syncStatePath: string;\n}\n\n/** Persisted per-repo poll watermark (DESIGN.md § Event source). */\ninterface GithubRepoSyncState {\n /** Comments/issues created before this ISO instant never trigger. */\n baseline: string;\n /** Newest updated_at seen; polls fetch from (cursor - overlap). */\n cursor: string;\n seenComments: number[];\n seenIssues: number[];\n}\n\nexport interface GithubSyncState {\n repos: Record<string, GithubRepoSyncState>;\n}\n\nexport interface GithubRepoRef {\n owner: string;\n repo: string;\n}\n\nexport interface GithubConversationRef extends GithubRepoRef {\n number: number;\n}\n\n// ── GitHub REST payload shapes (only the fields mikan reads) ─────────────────\n\ninterface GithubUser {\n login: string;\n type: string;\n}\n\nexport interface GithubIssue {\n id: number;\n number: number;\n title: string;\n body: string | null;\n user: GithubUser;\n created_at: string;\n updated_at: string;\n pull_request?: object;\n}\n\nexport interface GithubIssueComment {\n id: number;\n body: string;\n user: GithubUser;\n created_at: string;\n updated_at: string;\n /** API URL of the parent issue, e.g. …/repos/o/r/issues/42 */\n issue_url: string;\n}\n\nexport interface GithubRepository {\n name: string;\n owner: GithubUser;\n}\n\nexport interface GithubRepositoryDetails {\n default_branch: string;\n}\n\nexport interface GithubCollaboratorPermission {\n /** Legacy field: admin | write | read | none (maintain→write, triage→read). */\n permission: string;\n /** Granular assigned role (admin/maintain/write/triage/read or a custom role). */\n role_name?: string;\n}\n\nexport interface GithubPullRequest {\n number: number;\n html_url: string;\n head?: { ref: string; sha: string };\n}\n\nexport interface GithubCheckRun {\n /** Check-run id; for GitHub Actions this doubles as the job id (log fetch). */\n id: number;\n name: string;\n /** queued | in_progress | completed */\n status: string;\n /** success | failure | neutral | cancelled | skipped | timed_out | action_required | null while running */\n conclusion: string | null;\n html_url: string | null;\n /** The app that reported the check (github-actions vs external CI). */\n app?: { slug?: string } | null;\n /** Whatever the reporting app posted about the run. */\n output?: { title?: string | null; summary?: string | null } | null;\n}\n\n/** Permission subset requestable on a scoped installation token. */\nexport type GithubTokenPermissions = Partial<\n Record<\"contents\" | \"pull_requests\" | \"issues\", \"read\" | \"write\">\n>;\n\nexport type GithubReactionContent =\n | \"+1\"\n | \"-1\"\n | \"laugh\"\n | \"confused\"\n | \"heart\"\n | \"hooray\"\n | \"rocket\"\n | \"eyes\";\n\nexport interface CloneRepoOptions {\n /** HTTPS remote, e.g. https://github.com/owner/repo.git (no credentials). */\n url: string;\n /** Destination directory (the conversation dir's `repo/`). */\n dir: string;\n /** Ephemeral scoped installation token; used per-invocation, never stored. */\n token: string;\n botLogin: string;\n botEmail: string;\n /** When the conversation is a PR: fetch and checkout its head as pr-<n>. */\n prNumber?: number;\n}\n\nexport interface PushBranchOptions {\n dir: string;\n branch: string;\n token: string;\n}\n\nexport interface GithubClientOptions {\n appId: string;\n privateKey: string;\n installationId: string;\n /** Override the API root for tests; defaults to https://api.github.com */\n baseUrl?: string;\n fetchImpl?: typeof fetch;\n}\n\n// ── Host-side tool contracts (capability pack, not messaging core) ───────────\n\n/** Arguments for the host-side `github_pr` tool. */\nexport interface GithubPrRequest {\n /** Local branch in the conversation's ./repo clone; must match pi/<name>. */\n branch: string;\n title: string;\n body?: string;\n /** Target branch; defaults to the repository's default branch. */\n base?: string;\n draft?: boolean;\n}\n\nexport interface GithubPrResult {\n number: number;\n url: string;\n /** True when the branch already had an open PR that this push updated. */\n updatedExisting?: boolean;\n}\n\n/** Normalized check-run row for the host-side `github_checks` tool. */\nexport interface GithubCheckSummary {\n /** Check-run id; for GitHub Actions checks it is also the job id for log fetch. */\n id: number;\n name: string;\n /** queued | in_progress | completed */\n status: string;\n /** success | failure | … ; null while the run is still in progress */\n conclusion: string | null;\n url: string | null;\n /** Slug of the reporting app; \"github-actions\" checks have fetchable logs. */\n appSlug: string | null;\n /** The reporting app's own summary of the run, when it posted one. */\n outputSummary: string | null;\n}\n\n/**\n * Host-side GitHub operations for github_* tools. Wired in main.ts over the\n * GitHub bot; tokens stay host-side. Consumed by `createGithubToolPack`.\n */\nexport interface PlatformGithubOps {\n /** Push a prepared pi/* branch and open (or update) a pull request. */\n pushAndCreatePr(conversationId: string, request: GithubPrRequest): Promise<GithubPrResult>;\n /** CI check runs for a branch, or for the conversation's PR head when omitted. */\n getChecks(conversationId: string, branch?: string): Promise<GithubCheckSummary[]>;\n /** Log text of one CI job (an Actions check-run id), tail-truncated. */\n getJobLog(conversationId: string, jobId: number): Promise<string>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/adapters/github/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ConversationEvent } from \"../../adapter.js\";\nimport type { GcpTokenProvider } from \"./gcp-auth.js\";\n\nexport interface GithubEvent extends ConversationEvent {\n type: \"message\" | \"issue\";\n userName?: string;\n}\n\nexport interface GithubBotConfig {\n appId: string;\n /** PEM-encoded GitHub App private key. */\n privateKey: string;\n installationId: string;\n /** `owner/repo` entries to watch; empty = all installation repositories. */\n repos: string[];\n pollIntervalMs: number;\n workingDir: string;\n /**\n * Where the poll watermark state (baseline + seen ids) is persisted. Lives\n * under the host-only state dir: the workspace dir can be mounted into\n * sandboxes, and sandboxed code must not be able to clear dedup state and\n * re-trigger runs.\n */\n syncStatePath: string;\n /**\n * Present when the host has GCP credentials (GOOGLE_APPLICATION_CREDENTIALS):\n * lets github_checks fetch Cloud Build logs. Credentials never enter the\n * sandbox; absent, external-CI checks degrade to guidance text.\n */\n cloudBuild?: {\n tokenProvider: GcpTokenProvider;\n /** Project used when a check's details_url does not name one. */\n projectFallback?: string;\n };\n}\n\n/** Persisted per-repo poll watermark (DESIGN.md § Event source). */\ninterface GithubRepoSyncState {\n /** Comments/issues created before this ISO instant never trigger. */\n baseline: string;\n /** Newest updated_at seen; polls fetch from (cursor - overlap). */\n cursor: string;\n seenComments: number[];\n seenIssues: number[];\n /** Optional so state files written before review-comment polling still load. */\n seenReviewComments?: number[];\n}\n\nexport interface GithubSyncState {\n repos: Record<string, GithubRepoSyncState>;\n}\n\nexport interface GithubRepoRef {\n owner: string;\n repo: string;\n}\n\nexport interface GithubConversationRef extends GithubRepoRef {\n number: number;\n}\n\n// ── GitHub REST payload shapes (only the fields mikan reads) ─────────────────\n\ninterface GithubUser {\n login: string;\n type: string;\n}\n\nexport interface GithubIssue {\n id: number;\n number: number;\n title: string;\n body: string | null;\n user: GithubUser;\n created_at: string;\n updated_at: string;\n pull_request?: object;\n /** open | closed */\n state?: string;\n labels?: { name: string }[];\n assignees?: { login: string }[];\n}\n\nexport interface GithubIssueComment {\n id: number;\n body: string;\n user: GithubUser;\n created_at: string;\n updated_at: string;\n /** API URL of the parent issue, e.g. …/repos/o/r/issues/42 */\n issue_url: string;\n}\n\n/** An inline PR review comment (a comment on a diff line). */\nexport interface GithubReviewComment {\n id: number;\n body: string;\n user: GithubUser;\n created_at: string;\n updated_at: string;\n /** API URL of the parent PR, e.g. …/repos/o/r/pulls/42 */\n pull_request_url: string;\n /** File the comment is anchored to. */\n path: string;\n /** Line in the diff's right side; null when the anchor is outdated. */\n line: number | null;\n /** The diff excerpt the comment is anchored to. */\n diff_hunk: string;\n /** Set on replies: the id of the thread's root comment. */\n in_reply_to_id?: number;\n}\n\nexport interface GithubRepository {\n name: string;\n owner: GithubUser;\n}\n\nexport interface GithubRepositoryDetails {\n default_branch: string;\n}\n\nexport interface GithubCollaboratorPermission {\n /** Legacy field: admin | write | read | none (maintain→write, triage→read). */\n permission: string;\n /** Granular assigned role (admin/maintain/write/triage/read or a custom role). */\n role_name?: string;\n}\n\nexport interface GithubPullRequest {\n number: number;\n html_url: string;\n /** head.repo is null when the fork a PR came from was deleted. */\n head?: { ref: string; sha: string; repo?: { full_name?: string } | null };\n base?: { ref: string };\n title?: string;\n body?: string | null;\n /** open | closed */\n state?: string;\n draft?: boolean;\n merged?: boolean;\n mergeable_state?: string;\n changed_files?: number;\n additions?: number;\n deletions?: number;\n user?: GithubUser;\n}\n\n/** One row of GET /pulls/{n}/files. */\nexport interface GithubPullRequestFile {\n filename: string;\n /** added | removed | modified | renamed | … */\n status: string;\n additions: number;\n deletions: number;\n}\n\n/** One submitted review of GET /pulls/{n}/reviews. */\nexport interface GithubPullRequestReview {\n id: number;\n user: GithubUser;\n body: string | null;\n /** APPROVED | CHANGES_REQUESTED | COMMENTED | DISMISSED | PENDING */\n state: string;\n submitted_at?: string;\n}\n\nexport interface GithubCheckRun {\n /** Check-run id; for GitHub Actions this doubles as the job id (log fetch). */\n id: number;\n name: string;\n /** queued | in_progress | completed */\n status: string;\n /** success | failure | neutral | cancelled | skipped | timed_out | action_required | null while running */\n conclusion: string | null;\n html_url: string | null;\n /** The app that reported the check (github-actions vs external CI). */\n app?: { slug?: string } | null;\n /** Whatever the reporting app posted about the run. */\n output?: { title?: string | null; summary?: string | null } | null;\n /** The reporting app's own id for the run; Cloud Build puts the build UUID here. */\n external_id?: string | null;\n /** The reporting app's own results page; Cloud Build encodes the GCP project here. */\n details_url?: string | null;\n}\n\n/** Permission subset requestable on a scoped installation token. */\nexport type GithubTokenPermissions = Partial<\n Record<\"contents\" | \"pull_requests\" | \"issues\", \"read\" | \"write\">\n>;\n\nexport type GithubReactionContent =\n | \"+1\"\n | \"-1\"\n | \"laugh\"\n | \"confused\"\n | \"heart\"\n | \"hooray\"\n | \"rocket\"\n | \"eyes\";\n\nexport interface CloneRepoOptions {\n /** HTTPS remote, e.g. https://github.com/owner/repo.git (no credentials). */\n url: string;\n /** Destination directory (the conversation dir's `repo/`). */\n dir: string;\n /** Ephemeral scoped installation token; used per-invocation, never stored. */\n token: string;\n botLogin: string;\n botEmail: string;\n /** When the conversation is a PR: fetch and check out its head. */\n prNumber?: number;\n /**\n * The PR's head branch name when it lives in this repo (not a fork): the\n * checkout is named after it so committing there + github_pr updates the\n * PR in place. Absent (fork/unknown), the checkout falls back to pr-<n>.\n */\n prHeadBranch?: string;\n}\n\nexport interface PushBranchOptions {\n dir: string;\n branch: string;\n token: string;\n}\n\nexport interface SyncRepoOptions {\n dir: string;\n /** Ephemeral contents:read token; used per-invocation, never stored. */\n token: string;\n /** Explicit branch to fetch; wins over prNumber/defaultBranch. */\n branch?: string;\n /** PR conversations: fetch pull/<n>/head into the local PR checkout. */\n prNumber?: number;\n /** Same-repo PR head name; the local checkout target. Fallback: pr-<n>. */\n prHeadBranch?: string;\n /** Fallback target when neither branch nor prNumber applies. */\n defaultBranch?: string;\n}\n\nexport interface SyncRepoResult {\n /** Local branch the fetch targets (the PR head name, pr-<n>, or the branch). */\n target: string;\n fetchedSha: string;\n /** True when the checkout was moved to the fetched head. */\n updatedCheckout: boolean;\n /** Working tree had uncommitted changes (checkout left alone). */\n dirty: boolean;\n currentBranch: string;\n /** Bot-committed (agent-made) commits on the target that origin lacks. */\n localCommits: number;\n}\n\nexport interface GithubClientOptions {\n appId: string;\n privateKey: string;\n installationId: string;\n /** Override the API root for tests; defaults to https://api.github.com */\n baseUrl?: string;\n fetchImpl?: typeof fetch;\n}\n\n// ── Host-side tool contracts (capability pack, not messaging core) ───────────\n\n/** Arguments for the host-side `github_pr` tool. */\nexport interface GithubPrRequest {\n /** Local branch in the conversation's ./repo clone; must match pi/<name>. */\n branch: string;\n title: string;\n body?: string;\n /** Target branch; defaults to the repository's default branch. */\n base?: string;\n draft?: boolean;\n}\n\nexport interface GithubPrResult {\n number: number;\n url: string;\n /** True when the branch already had an open PR that this push updated. */\n updatedExisting?: boolean;\n}\n\n/** Normalized check-run row for the host-side `github_checks` tool. */\nexport interface GithubCheckSummary {\n /** Check-run id; for GitHub Actions checks it is also the job id for log fetch. */\n id: number;\n name: string;\n /** queued | in_progress | completed */\n status: string;\n /** success | failure | … ; null while the run is still in progress */\n conclusion: string | null;\n url: string | null;\n /** Slug of the reporting app; \"github-actions\" checks have fetchable logs. */\n appSlug: string | null;\n /** The reporting app's own summary of the run, when it posted one. */\n outputSummary: string | null;\n /** The reporting app's run id (Cloud Build: the build UUID). */\n externalId: string | null;\n /** True when this run's log is fetchable via build_id (Cloud Build + GCP creds). */\n buildLogAvailable?: boolean;\n}\n\n/** Arguments for the host-side `github_read` tool. */\nexport interface GithubReadRequest {\n action: \"pr\" | \"pr_files\" | \"pr_reviews\" | \"issue\" | \"comments\" | \"list\";\n /** Issue/PR number; defaults to the conversation's own. */\n number?: number;\n /** list only: open | closed | all (default open). */\n state?: string;\n /** list only: comma-separated label names. */\n labels?: string;\n /** list only: filter by author login. */\n creator?: string;\n}\n\n/** Typed payload of one `github_read` action; the tool renders it. */\nexport type GithubReadResult =\n | { kind: \"pr\"; pr: GithubPullRequest }\n | { kind: \"pr_files\"; files: GithubPullRequestFile[] }\n | { kind: \"pr_reviews\"; reviews: GithubPullRequestReview[]; threads: GithubReviewComment[] }\n | { kind: \"issue\"; issue: GithubIssue }\n | { kind: \"comments\"; comments: GithubIssueComment[] }\n | { kind: \"list\"; issues: GithubIssue[] };\n\n/** Arguments for the host-side `github_issue` tool. Deliberately a closed\n * action set: lock/delete/transfer are not offered at all. */\nexport interface GithubIssueRequest {\n action: \"add_labels\" | \"remove_label\" | \"add_assignees\" | \"remove_assignees\" | \"close\" | \"reopen\";\n /** Issue/PR number; defaults to the conversation's own (triage may target others). */\n number?: number;\n /** add_labels */\n labels?: string[];\n /** remove_label */\n label?: string;\n /** add_assignees / remove_assignees */\n assignees?: string[];\n /** close */\n state_reason?: \"completed\" | \"not_planned\";\n}\n\n/**\n * Host-side GitHub operations for github_* tools. Wired in main.ts over the\n * GitHub bot; tokens stay host-side. Consumed by `createGithubToolPack`.\n */\nexport interface PlatformGithubOps {\n /** Push a prepared pi/* branch and open (or update) a pull request. */\n pushAndCreatePr(conversationId: string, request: GithubPrRequest): Promise<GithubPrResult>;\n /** CI check runs for a branch, or for the conversation's PR head when omitted. */\n getChecks(conversationId: string, branch?: string): Promise<GithubCheckSummary[]>;\n /** Log text of one CI job (an Actions check-run id), tail-truncated. */\n getJobLog(conversationId: string, jobId: number): Promise<string>;\n /** Log text of one Cloud Build run (a [build …] uuid), tail-truncated. */\n getBuildLog(conversationId: string, buildId: string): Promise<string>;\n /** Reply inside one inline review thread of the conversation's PR. */\n replyToReviewThread(\n conversationId: string,\n commentId: number,\n body: string,\n ): Promise<{ url: string }>;\n /** Refresh the conversation's ./repo clone; returns a human-readable report. */\n syncRepo(conversationId: string, branch?: string): Promise<string>;\n /** Read PR/issue metadata the clone cannot provide; same repo only. */\n readGithub(conversationId: string, request: GithubReadRequest): Promise<GithubReadResult>;\n /** Label/assignee/state management on this repo's issues; returns a report. */\n manageIssue(conversationId: string, request: GithubIssueRequest): Promise<string>;\n}\n"]}
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import type { ConversationEvent } from "../adapter.js";
|
|
2
|
-
import type { MessageIntakeOptions } from "./types.js";
|
|
2
|
+
import type { MessageIntakeOptions, MessageIntakeOutcome } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Recognize a magic word: a highest-priority chat control phrase that bypasses
|
|
5
|
+
* trigger policy and queueing (see CONTEXT.md). One grammar for every
|
|
6
|
+
* platform: optional leading slash, optional `@botname` suffix, any case.
|
|
7
|
+
*/
|
|
8
|
+
export declare function matchMagicWord(text: string): "stop" | null;
|
|
3
9
|
/**
|
|
4
10
|
* Shared message ingress pipeline for platform adapters.
|
|
5
11
|
*
|
|
6
|
-
* Platform adapters
|
|
7
|
-
*
|
|
8
|
-
*
|
|
12
|
+
* Platform adapters normalize SDK events; this module owns the ordering for
|
|
13
|
+
* messages that may start an agent run:
|
|
14
|
+
*
|
|
15
|
+
* magic word → trigger policy → attachments → log → busy policy → queue → dispatch
|
|
16
|
+
*
|
|
17
|
+
* Magic words are matched before the trigger gate — `stop` must never wait on
|
|
18
|
+
* an auto-reply judgment or queue behind a running agent turn. Adapters state
|
|
19
|
+
* platform policy as data (`magicWord`, `busyPolicy`) instead of callbacks.
|
|
9
20
|
*/
|
|
10
|
-
export declare function processMessageIntake<TEvent extends ConversationEvent>(options: MessageIntakeOptions<TEvent>): Promise<
|
|
21
|
+
export declare function processMessageIntake<TEvent extends ConversationEvent>(options: MessageIntakeOptions<TEvent>): Promise<MessageIntakeOutcome>;
|
|
11
22
|
//# sourceMappingURL=intake.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intake.d.ts","sourceRoot":"","sources":["../../src/adapters/intake.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"intake.d.ts","sourceRoot":"","sources":["../../src/adapters/intake.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE7E;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE1D;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,SAAS,iBAAiB,EACzE,OAAO,EAAE,oBAAoB,CAAC,MAAM,CAAC,GACpC,OAAO,CAAC,oBAAoB,CAAC,CAoD/B"}
|
package/dist/adapters/intake.js
CHANGED
|
@@ -1,42 +1,99 @@
|
|
|
1
|
+
import { formatAlreadyWorking, formatNothingRunning } from "../platform-messages.js";
|
|
1
2
|
import { evaluateAutoReplyPolicy } from "../trigger.js";
|
|
3
|
+
import { resolveOnlyScopedStopTarget, resolveStopTarget } from "./shared.js";
|
|
4
|
+
/**
|
|
5
|
+
* Recognize a magic word: a highest-priority chat control phrase that bypasses
|
|
6
|
+
* trigger policy and queueing (see CONTEXT.md). One grammar for every
|
|
7
|
+
* platform: optional leading slash, optional `@botname` suffix, any case.
|
|
8
|
+
*/
|
|
9
|
+
export function matchMagicWord(text) {
|
|
10
|
+
return /^\/?stop(?:@\w+)?$/i.test(text.trim()) ? "stop" : null;
|
|
11
|
+
}
|
|
2
12
|
/**
|
|
3
13
|
* Shared message ingress pipeline for platform adapters.
|
|
4
14
|
*
|
|
5
|
-
* Platform adapters
|
|
6
|
-
*
|
|
7
|
-
*
|
|
15
|
+
* Platform adapters normalize SDK events; this module owns the ordering for
|
|
16
|
+
* messages that may start an agent run:
|
|
17
|
+
*
|
|
18
|
+
* magic word → trigger policy → attachments → log → busy policy → queue → dispatch
|
|
19
|
+
*
|
|
20
|
+
* Magic words are matched before the trigger gate — `stop` must never wait on
|
|
21
|
+
* an auto-reply judgment or queue behind a running agent turn. Adapters state
|
|
22
|
+
* platform policy as data (`magicWord`, `busyPolicy`) instead of callbacks.
|
|
8
23
|
*/
|
|
9
24
|
export async function processMessageIntake(options) {
|
|
25
|
+
if (matchMagicWord(options.magicWord.text ?? options.eventBase.text) === "stop") {
|
|
26
|
+
options.log?.({ ...options.logEntryBase, attachments: [] });
|
|
27
|
+
await handleStopMagicWord(options);
|
|
28
|
+
return "magic-word";
|
|
29
|
+
}
|
|
10
30
|
const triggerResult = options.isAutoReplyCandidate
|
|
11
31
|
? await evaluateAutoReplyPolicy({ event: options.eventBase, workingDir: options.workingDir })
|
|
12
32
|
: { trigger: true, reason: "addressed" };
|
|
13
33
|
if (!triggerResult.trigger) {
|
|
14
34
|
options.log?.({ ...options.logEntryBase, attachments: [] });
|
|
15
|
-
|
|
16
|
-
|
|
35
|
+
return "not-triggered";
|
|
36
|
+
}
|
|
37
|
+
function prepareEvent(attachments) {
|
|
38
|
+
const event = { ...options.eventBase, attachments };
|
|
39
|
+
options.log?.({ ...options.logEntryBase, attachments });
|
|
40
|
+
return event;
|
|
41
|
+
}
|
|
42
|
+
async function rejectedWhileBusy() {
|
|
43
|
+
const sessionKey = options.eventBase.sessionKey ?? options.eventBase.conversationId;
|
|
44
|
+
if (!options.handler.isRunning(sessionKey))
|
|
45
|
+
return false;
|
|
46
|
+
await options.bot.postMessage(options.eventBase.conversationId, formatAlreadyWorking(options.bot, "/stop"));
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
function dispatch(event) {
|
|
50
|
+
const context = options.createContext(event);
|
|
51
|
+
return options.handler.handleEvent(event, options.bot, context);
|
|
17
52
|
}
|
|
18
53
|
if (options.deferAttachmentsUntilRun) {
|
|
54
|
+
// Busy rejection happens inside the queued work here, so the outcome is
|
|
55
|
+
// already "enqueued" by the time it is evaluated.
|
|
19
56
|
options.enqueue(options.queueKey, async () => {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
options.log?.({ ...options.logEntryBase, attachments });
|
|
23
|
-
if (options.beforeEnqueue && !(await options.beforeEnqueue(event))) {
|
|
57
|
+
const event = prepareEvent(await options.processAttachments());
|
|
58
|
+
if (options.busyPolicy === "reject" && (await rejectedWhileBusy()))
|
|
24
59
|
return;
|
|
25
|
-
|
|
26
|
-
const context = options.createContext(event);
|
|
27
|
-
return options.handler.handleEvent(event, options.bot, context);
|
|
60
|
+
return dispatch(event);
|
|
28
61
|
});
|
|
29
|
-
return;
|
|
62
|
+
return "enqueued";
|
|
63
|
+
}
|
|
64
|
+
const event = prepareEvent(await options.processAttachments());
|
|
65
|
+
if (options.busyPolicy === "reject" && (await rejectedWhileBusy()))
|
|
66
|
+
return "rejected-busy";
|
|
67
|
+
options.enqueue(options.queueKey, () => dispatch(event));
|
|
68
|
+
return "enqueued";
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Resolve and stop the session a magic-word `stop` targets. When nothing is
|
|
72
|
+
* running, reply only if the message addressed the bot — an unaddressed
|
|
73
|
+
* "stop" in a busy channel should never make the bot pipe up.
|
|
74
|
+
*/
|
|
75
|
+
async function handleStopMagicWord(options) {
|
|
76
|
+
const { handler, bot, eventBase, magicWord } = options;
|
|
77
|
+
const conversationId = eventBase.conversationId;
|
|
78
|
+
const sessionKey = eventBase.sessionKey;
|
|
79
|
+
let target = resolveStopTarget({ handler, conversationId, sessionKey });
|
|
80
|
+
if (!target && widensToScopedSession(magicWord.scopeFallback, sessionKey, conversationId)) {
|
|
81
|
+
target = resolveOnlyScopedStopTarget(handler, conversationId);
|
|
30
82
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
options.log?.({ ...options.logEntryBase, attachments });
|
|
34
|
-
if (options.beforeEnqueue && !(await options.beforeEnqueue(event))) {
|
|
35
|
-
return;
|
|
83
|
+
if (target) {
|
|
84
|
+
await handler.handleStop(target, conversationId, bot);
|
|
36
85
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
86
|
+
else if (magicWord.addressed) {
|
|
87
|
+
await bot.postMessage(conversationId, formatNothingRunning(bot));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function widensToScopedSession(scopeFallback, sessionKey, conversationId) {
|
|
91
|
+
if (scopeFallback === "never")
|
|
92
|
+
return false;
|
|
93
|
+
if (scopeFallback === "always")
|
|
94
|
+
return true;
|
|
95
|
+
// "top-level": only a message aimed at the persistent conversation session
|
|
96
|
+
// may widen to the single running scoped session; thread messages stay put.
|
|
97
|
+
return sessionKey === undefined || sessionKey === conversationId;
|
|
41
98
|
}
|
|
42
99
|
//# sourceMappingURL=intake.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intake.js","sourceRoot":"","sources":["../../src/adapters/intake.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"intake.js","sourceRoot":"","sources":["../../src/adapters/intake.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAG7E;;;;GAIG;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js\";\nimport { formatAlreadyWorking, formatNothingRunning } from \"../platform-messages.js\";\nimport { evaluateAutoReplyPolicy } from \"../trigger.js\";\nimport { resolveOnlyScopedStopTarget, resolveStopTarget } from \"./shared.js\";\nimport type { MessageIntakeOptions, MessageIntakeOutcome } from \"./types.js\";\n\n/**\n * Recognize a magic word: a highest-priority chat control phrase that bypasses\n * trigger policy and queueing (see CONTEXT.md). One grammar for every\n * platform: optional leading slash, optional `@botname` suffix, any case.\n */\nexport function matchMagicWord(text: string): \"stop\" | null {\n return /^\\/?stop(?:@\\w+)?$/i.test(text.trim()) ? \"stop\" : null;\n}\n\n/**\n * Shared message ingress pipeline for platform adapters.\n *\n * Platform adapters normalize SDK events; this module owns the ordering for\n * messages that may start an agent run:\n *\n * magic word → trigger policy → attachments → log → busy policy → queue → dispatch\n *\n * Magic words are matched before the trigger gate — `stop` must never wait on\n * an auto-reply judgment or queue behind a running agent turn. Adapters state\n * platform policy as data (`magicWord`, `busyPolicy`) instead of callbacks.\n */\nexport async function processMessageIntake<TEvent extends ConversationEvent>(\n options: MessageIntakeOptions<TEvent>,\n): Promise<MessageIntakeOutcome> {\n if (matchMagicWord(options.magicWord.text ?? options.eventBase.text) === \"stop\") {\n options.log?.({ ...options.logEntryBase, attachments: [] });\n await handleStopMagicWord(options);\n return \"magic-word\";\n }\n\n const triggerResult = options.isAutoReplyCandidate\n ? await evaluateAutoReplyPolicy({ event: options.eventBase, workingDir: options.workingDir })\n : ({ trigger: true, reason: \"addressed\" } as const);\n\n if (!triggerResult.trigger) {\n options.log?.({ ...options.logEntryBase, attachments: [] });\n return \"not-triggered\";\n }\n\n function prepareEvent(attachments: unknown[]): TEvent {\n const event = { ...options.eventBase, attachments } as TEvent;\n options.log?.({ ...options.logEntryBase, attachments });\n return event;\n }\n\n async function rejectedWhileBusy(): Promise<boolean> {\n const sessionKey = options.eventBase.sessionKey ?? options.eventBase.conversationId;\n if (!options.handler.isRunning(sessionKey)) return false;\n await options.bot.postMessage(\n options.eventBase.conversationId,\n formatAlreadyWorking(options.bot, \"/stop\"),\n );\n return true;\n }\n\n function dispatch(event: TEvent): Promise<void> {\n const context = options.createContext(event);\n return options.handler.handleEvent(event, options.bot, context);\n }\n\n if (options.deferAttachmentsUntilRun) {\n // Busy rejection happens inside the queued work here, so the outcome is\n // already \"enqueued\" by the time it is evaluated.\n options.enqueue(options.queueKey, async () => {\n const event = prepareEvent(await options.processAttachments());\n if (options.busyPolicy === \"reject\" && (await rejectedWhileBusy())) return;\n return dispatch(event);\n });\n return \"enqueued\";\n }\n\n const event = prepareEvent(await options.processAttachments());\n if (options.busyPolicy === \"reject\" && (await rejectedWhileBusy())) return \"rejected-busy\";\n options.enqueue(options.queueKey, () => dispatch(event));\n return \"enqueued\";\n}\n\n/**\n * Resolve and stop the session a magic-word `stop` targets. When nothing is\n * running, reply only if the message addressed the bot — an unaddressed\n * \"stop\" in a busy channel should never make the bot pipe up.\n */\nasync function handleStopMagicWord<TEvent extends ConversationEvent>(\n options: MessageIntakeOptions<TEvent>,\n): Promise<void> {\n const { handler, bot, eventBase, magicWord } = options;\n const conversationId = eventBase.conversationId;\n const sessionKey = eventBase.sessionKey;\n\n let target = resolveStopTarget({ handler, conversationId, sessionKey });\n if (!target && widensToScopedSession(magicWord.scopeFallback, sessionKey, conversationId)) {\n target = resolveOnlyScopedStopTarget(handler, conversationId);\n }\n\n if (target) {\n await handler.handleStop(target, conversationId, bot);\n } else if (magicWord.addressed) {\n await bot.postMessage(conversationId, formatNothingRunning(bot));\n }\n}\n\nfunction widensToScopedSession(\n scopeFallback: \"top-level\" | \"always\" | \"never\",\n sessionKey: string | undefined,\n conversationId: string,\n): boolean {\n if (scopeFallback === \"never\") return false;\n if (scopeFallback === \"always\") return true;\n // \"top-level\": only a message aimed at the persistent conversation session\n // may widen to the single running scoped session; thread messages stay put.\n return sessionKey === undefined || sessionKey === conversationId;\n}\n"]}
|
|
@@ -70,15 +70,16 @@ export declare class SlackMessagingBot implements MessagingBot {
|
|
|
70
70
|
private hasKnownThreadSession;
|
|
71
71
|
private processSlackMessageIntake;
|
|
72
72
|
private buildHomeView;
|
|
73
|
-
private resolveStopTarget;
|
|
74
|
-
private isStopText;
|
|
75
73
|
private createCommandAdapters;
|
|
76
74
|
private buildSlashCommandEvent;
|
|
77
|
-
|
|
75
|
+
/**
|
|
76
|
+
* Generic slash-command route: synthesize the command text per the
|
|
77
|
+
* manifest's SlackSlashRoute data and dispatch to the handler. `/pi-new`
|
|
78
|
+
* stays bespoke (routeSlashNewCommand) because it replies in 中文 and calls
|
|
79
|
+
* handleNewCommand directly.
|
|
80
|
+
*/
|
|
81
|
+
private routeSlashCommand;
|
|
78
82
|
private routeSlashNewCommand;
|
|
79
|
-
private routeSlashModelCommand;
|
|
80
|
-
private routeSlashSessionCommand;
|
|
81
|
-
private routeSlashAdminCommand;
|
|
82
83
|
private setupEventHandlers;
|
|
83
84
|
private handleAppMention;
|
|
84
85
|
private handleMessageEvent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bot.d.ts","sourceRoot":"","sources":["../../../src/adapters/slack/bot.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,YAAY,EAEZ,iBAAiB,EACjB,qBAAqB,EAKrB,aAAa,EACd,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"bot.d.ts","sourceRoot":"","sources":["../../../src/adapters/slack/bot.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,YAAY,EAEZ,iBAAiB,EACjB,qBAAqB,EAKrB,aAAa,EACd,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,KAAK,EAAc,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,KAAK,EAGV,YAAY,EAEZ,SAAS,EACV,MAAM,YAAY,CAAC;AA8EpB;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG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