@geminixiang/mikan 1.0.0-beta.76 → 1.0.0-beta.78
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 +39 -0
- package/dist/adapters/commands/login.d.ts.map +1 -1
- package/dist/adapters/commands/login.js +0 -9
- package/dist/adapters/commands/login.js.map +1 -1
- package/dist/adapters/commands/manifest.d.ts +0 -19
- package/dist/adapters/commands/manifest.d.ts.map +1 -1
- package/dist/adapters/commands/manifest.js +0 -34
- package/dist/adapters/commands/manifest.js.map +1 -1
- package/dist/adapters/commands/model.d.ts +0 -5
- package/dist/adapters/commands/model.d.ts.map +1 -1
- package/dist/adapters/commands/model.js +0 -5
- package/dist/adapters/commands/model.js.map +1 -1
- package/dist/adapters/commands/new.d.ts.map +1 -1
- package/dist/adapters/commands/new.js +0 -2
- package/dist/adapters/commands/new.js.map +1 -1
- package/dist/adapters/commands/registry.d.ts +0 -1
- package/dist/adapters/commands/registry.d.ts.map +1 -1
- package/dist/adapters/commands/registry.js +0 -8
- package/dist/adapters/commands/registry.js.map +1 -1
- package/dist/adapters/commands/session-view.d.ts.map +1 -1
- package/dist/adapters/commands/session-view.js +0 -2
- package/dist/adapters/commands/session-view.js.map +1 -1
- package/dist/adapters/commands/types.d.ts +0 -29
- package/dist/adapters/commands/types.d.ts.map +1 -1
- package/dist/adapters/commands/types.js.map +1 -1
- package/dist/adapters/commands/utils.d.ts +0 -3
- package/dist/adapters/commands/utils.d.ts.map +1 -1
- package/dist/adapters/commands/utils.js +0 -3
- package/dist/adapters/commands/utils.js.map +1 -1
- package/dist/adapters/discord/bot.d.ts +0 -4
- package/dist/adapters/discord/bot.d.ts.map +1 -1
- package/dist/adapters/discord/bot.js +5 -41
- package/dist/adapters/discord/bot.js.map +1 -1
- package/dist/adapters/discord/components.d.ts +0 -23
- package/dist/adapters/discord/components.d.ts.map +1 -1
- package/dist/adapters/discord/components.js +0 -23
- package/dist/adapters/discord/components.js.map +1 -1
- package/dist/adapters/discord/context.d.ts.map +1 -1
- package/dist/adapters/discord/context.js +1 -11
- package/dist/adapters/discord/context.js.map +1 -1
- package/dist/adapters/discord/format.d.ts +0 -1
- package/dist/adapters/discord/format.d.ts.map +1 -1
- package/dist/adapters/discord/format.js +0 -37
- package/dist/adapters/discord/format.js.map +1 -1
- package/dist/adapters/github/bot.d.ts +0 -44
- package/dist/adapters/github/bot.d.ts.map +1 -1
- package/dist/adapters/github/bot.js +1 -120
- package/dist/adapters/github/bot.js.map +1 -1
- package/dist/adapters/github/client.d.ts +0 -57
- package/dist/adapters/github/client.d.ts.map +1 -1
- package/dist/adapters/github/client.js +0 -59
- package/dist/adapters/github/client.js.map +1 -1
- package/dist/adapters/github/context.d.ts.map +1 -1
- package/dist/adapters/github/context.js +1 -8
- package/dist/adapters/github/context.js.map +1 -1
- package/dist/adapters/github/github-ops.d.ts +0 -55
- package/dist/adapters/github/github-ops.d.ts.map +1 -1
- package/dist/adapters/github/github-ops.js +0 -59
- package/dist/adapters/github/github-ops.js.map +1 -1
- package/dist/adapters/github/ids.d.ts +0 -27
- package/dist/adapters/github/ids.d.ts.map +1 -1
- package/dist/adapters/github/ids.js +0 -29
- package/dist/adapters/github/ids.js.map +1 -1
- package/dist/adapters/github/repo.d.ts +0 -25
- package/dist/adapters/github/repo.d.ts.map +1 -1
- package/dist/adapters/github/repo.js +0 -49
- package/dist/adapters/github/repo.js.map +1 -1
- package/dist/adapters/github/tool-pack.d.ts +0 -10
- package/dist/adapters/github/tool-pack.d.ts.map +1 -1
- package/dist/adapters/github/tool-pack.js +0 -10
- package/dist/adapters/github/tool-pack.js.map +1 -1
- package/dist/adapters/github/tools/checks.d.ts +0 -6
- package/dist/adapters/github/tools/checks.d.ts.map +1 -1
- package/dist/adapters/github/tools/checks.js +0 -7
- package/dist/adapters/github/tools/checks.js.map +1 -1
- package/dist/adapters/github/tools/issue.d.ts +0 -5
- package/dist/adapters/github/tools/issue.d.ts.map +1 -1
- package/dist/adapters/github/tools/issue.js +0 -5
- package/dist/adapters/github/tools/issue.js.map +1 -1
- package/dist/adapters/github/tools/pr.d.ts +0 -7
- package/dist/adapters/github/tools/pr.d.ts.map +1 -1
- package/dist/adapters/github/tools/pr.js +0 -7
- package/dist/adapters/github/tools/pr.js.map +1 -1
- package/dist/adapters/github/tools/read.d.ts +0 -6
- package/dist/adapters/github/tools/read.d.ts.map +1 -1
- package/dist/adapters/github/tools/read.js +0 -8
- package/dist/adapters/github/tools/read.js.map +1 -1
- package/dist/adapters/github/tools/review-reply.d.ts +0 -5
- package/dist/adapters/github/tools/review-reply.d.ts.map +1 -1
- package/dist/adapters/github/tools/review-reply.js +0 -5
- package/dist/adapters/github/tools/review-reply.js.map +1 -1
- package/dist/adapters/github/tools/sync.d.ts +0 -6
- package/dist/adapters/github/tools/sync.d.ts.map +1 -1
- package/dist/adapters/github/tools/sync.js +0 -6
- package/dist/adapters/github/tools/sync.js.map +1 -1
- package/dist/adapters/github/types.d.ts +0 -88
- package/dist/adapters/github/types.d.ts.map +1 -1
- package/dist/adapters/github/types.js.map +1 -1
- package/dist/adapters/github/webhook.d.ts +0 -13
- package/dist/adapters/github/webhook.d.ts.map +1 -1
- package/dist/adapters/github/webhook.js +0 -16
- package/dist/adapters/github/webhook.js.map +1 -1
- package/dist/adapters/index.d.ts +3 -4
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/intake.d.ts +0 -17
- package/dist/adapters/intake.d.ts.map +1 -1
- package/dist/adapters/intake.js +6 -32
- package/dist/adapters/intake.js.map +1 -1
- package/dist/adapters/markdown-tables.d.ts +0 -10
- package/dist/adapters/markdown-tables.d.ts.map +1 -1
- package/dist/adapters/markdown-tables.js +1 -42
- package/dist/adapters/markdown-tables.js.map +1 -1
- package/dist/adapters/progressive-renderer.d.ts.map +1 -1
- package/dist/adapters/progressive-renderer.js +3 -25
- package/dist/adapters/progressive-renderer.js.map +1 -1
- package/dist/adapters/shared.d.ts +0 -57
- package/dist/adapters/shared.d.ts.map +1 -1
- package/dist/adapters/shared.js +0 -71
- package/dist/adapters/shared.js.map +1 -1
- package/dist/adapters/slack/assistant.d.ts +0 -49
- package/dist/adapters/slack/assistant.d.ts.map +1 -1
- package/dist/adapters/slack/assistant.js +0 -97
- package/dist/adapters/slack/assistant.js.map +1 -1
- package/dist/adapters/slack/auto-reply-context.d.ts +0 -7
- package/dist/adapters/slack/auto-reply-context.d.ts.map +1 -1
- package/dist/adapters/slack/auto-reply-context.js +0 -7
- package/dist/adapters/slack/auto-reply-context.js.map +1 -1
- package/dist/adapters/slack/blocks.d.ts +0 -9
- package/dist/adapters/slack/blocks.d.ts.map +1 -1
- package/dist/adapters/slack/blocks.js +0 -20
- package/dist/adapters/slack/blocks.js.map +1 -1
- package/dist/adapters/slack/bot.d.ts +0 -116
- package/dist/adapters/slack/bot.d.ts.map +1 -1
- package/dist/adapters/slack/bot.js +7 -231
- 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 +1 -3
- package/dist/adapters/slack/context.js.map +1 -1
- package/dist/adapters/slack/jev-context.d.ts +0 -13
- package/dist/adapters/slack/jev-context.d.ts.map +1 -1
- package/dist/adapters/slack/jev-context.js +0 -12
- package/dist/adapters/slack/jev-context.js.map +1 -1
- package/dist/adapters/slack/markdown.d.ts +0 -1
- package/dist/adapters/slack/markdown.d.ts.map +1 -1
- package/dist/adapters/slack/markdown.js +0 -5
- package/dist/adapters/slack/markdown.js.map +1 -1
- package/dist/adapters/slack/persona.d.ts +0 -9
- package/dist/adapters/slack/persona.d.ts.map +1 -1
- package/dist/adapters/slack/persona.js +0 -9
- package/dist/adapters/slack/persona.js.map +1 -1
- package/dist/adapters/slack/response-lifecycle.d.ts.map +1 -1
- package/dist/adapters/slack/response-lifecycle.js +1 -45
- package/dist/adapters/slack/response-lifecycle.js.map +1 -1
- package/dist/adapters/slack/session.d.ts +2 -1
- package/dist/adapters/slack/session.d.ts.map +1 -1
- package/dist/adapters/slack/session.js +2 -2
- package/dist/adapters/slack/session.js.map +1 -1
- package/dist/adapters/slack/stream-limits.d.ts +0 -25
- package/dist/adapters/slack/stream-limits.d.ts.map +1 -1
- package/dist/adapters/slack/stream-limits.js +0 -34
- package/dist/adapters/slack/stream-limits.js.map +1 -1
- package/dist/adapters/slack/task-intent.d.ts +0 -13
- package/dist/adapters/slack/task-intent.d.ts.map +1 -1
- package/dist/adapters/slack/task-intent.js +0 -7
- package/dist/adapters/slack/task-intent.js.map +1 -1
- package/dist/adapters/slack/task-status.d.ts +0 -1
- package/dist/adapters/slack/task-status.d.ts.map +1 -1
- package/dist/adapters/slack/task-status.js +1 -9
- package/dist/adapters/slack/task-status.js.map +1 -1
- package/dist/adapters/slack/tool-pack.d.ts +0 -6
- package/dist/adapters/slack/tool-pack.d.ts.map +1 -1
- package/dist/adapters/slack/tool-pack.js +0 -6
- package/dist/adapters/slack/tool-pack.js.map +1 -1
- package/dist/adapters/slack/tools/blockkit.d.ts.map +1 -1
- package/dist/adapters/slack/tools/blockkit.js +0 -11
- package/dist/adapters/slack/tools/blockkit.js.map +1 -1
- package/dist/adapters/slack/types.d.ts +0 -19
- package/dist/adapters/slack/types.d.ts.map +1 -1
- package/dist/adapters/slack/types.js.map +1 -1
- package/dist/adapters/slack/update-diagnostics.d.ts +0 -1
- package/dist/adapters/slack/update-diagnostics.d.ts.map +1 -1
- package/dist/adapters/slack/update-diagnostics.js +1 -7
- package/dist/adapters/slack/update-diagnostics.js.map +1 -1
- package/dist/adapters/telegram/bot.d.ts +0 -6
- package/dist/adapters/telegram/bot.d.ts.map +1 -1
- package/dist/adapters/telegram/bot.js +1 -50
- 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 +1 -8
- package/dist/adapters/telegram/context.js.map +1 -1
- package/dist/adapters/types.d.ts +0 -57
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/adapters/types.js.map +1 -1
- package/dist/adapters/web/admin/client-assets.d.ts +4 -0
- package/dist/adapters/web/admin/client-assets.d.ts.map +1 -0
- package/dist/adapters/web/admin/client-assets.js +1765 -0
- package/dist/adapters/web/admin/client-assets.js.map +1 -0
- package/dist/adapters/web/admin/portal.d.ts +0 -10
- package/dist/adapters/web/admin/portal.d.ts.map +1 -1
- package/dist/adapters/web/admin/portal.js +6 -1909
- package/dist/adapters/web/admin/portal.js.map +1 -1
- package/dist/adapters/web/admin/types.d.ts +0 -3
- package/dist/adapters/web/admin/types.d.ts.map +1 -1
- package/dist/adapters/web/admin/types.js.map +1 -1
- package/dist/adapters/web/login/oauth.d.ts.map +1 -1
- package/dist/adapters/web/login/oauth.js +3 -7
- package/dist/adapters/web/login/oauth.js.map +1 -1
- package/dist/adapters/web/login/portal.d.ts +0 -10
- package/dist/adapters/web/login/portal.d.ts.map +1 -1
- package/dist/adapters/web/login/portal.js +4 -37
- package/dist/adapters/web/login/portal.js.map +1 -1
- package/dist/adapters/web/login/types.d.ts +0 -5
- package/dist/adapters/web/login/types.d.ts.map +1 -1
- package/dist/adapters/web/login/types.js.map +1 -1
- package/dist/adapters/web/portal-shell.d.ts +0 -12
- package/dist/adapters/web/portal-shell.d.ts.map +1 -1
- package/dist/adapters/web/portal-shell.js +8 -25
- package/dist/adapters/web/portal-shell.js.map +1 -1
- package/dist/adapters/web/server.d.ts +0 -1
- package/dist/adapters/web/server.d.ts.map +1 -1
- package/dist/adapters/web/server.js +0 -2
- package/dist/adapters/web/server.js.map +1 -1
- package/dist/adapters/web/session-view/portal.d.ts.map +1 -1
- package/dist/adapters/web/session-view/portal.js +13 -24
- package/dist/adapters/web/session-view/portal.js.map +1 -1
- package/dist/adapters/web/session-view/types.d.ts.map +1 -1
- package/dist/adapters/web/session-view/types.js.map +1 -1
- package/dist/adapters/web/token-store.d.ts +0 -2
- package/dist/adapters/web/token-store.d.ts.map +1 -1
- package/dist/adapters/web/token-store.js +0 -2
- package/dist/adapters/web/token-store.js.map +1 -1
- package/dist/cli/arg-grammar.d.ts +0 -3
- package/dist/cli/arg-grammar.d.ts.map +1 -1
- package/dist/cli/arg-grammar.js +0 -3
- package/dist/cli/arg-grammar.js.map +1 -1
- package/dist/cli/boot.d.ts.map +1 -1
- package/dist/cli/boot.js +3 -12
- package/dist/cli/boot.js.map +1 -1
- package/dist/cli/download.d.ts.map +1 -1
- package/dist/cli/download.js +2 -6
- package/dist/cli/download.js.map +1 -1
- package/dist/cli/office.d.ts.map +1 -1
- package/dist/cli/office.js +0 -31
- package/dist/cli/office.js.map +1 -1
- package/dist/cli/onboard.d.ts +0 -2
- package/dist/cli/onboard.d.ts.map +1 -1
- package/dist/cli/onboard.js +0 -30
- package/dist/cli/onboard.js.map +1 -1
- package/dist/cli/process-lifecycle.d.ts +0 -5
- package/dist/cli/process-lifecycle.d.ts.map +1 -1
- package/dist/cli/process-lifecycle.js +0 -6
- package/dist/cli/process-lifecycle.js.map +1 -1
- package/dist/cli/sandbox.d.ts +3 -0
- package/dist/cli/sandbox.d.ts.map +1 -0
- package/dist/cli/sandbox.js +79 -0
- package/dist/cli/sandbox.js.map +1 -0
- package/dist/cli/sessions.d.ts.map +1 -1
- package/dist/cli/sessions.js +0 -11
- package/dist/cli/sessions.js.map +1 -1
- package/dist/cli/types.d.ts +2 -6
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/cli/types.js.map +1 -1
- package/dist/env-manifest.d.ts +0 -21
- package/dist/env-manifest.d.ts.map +1 -1
- package/dist/env-manifest.js +0 -11
- package/dist/env-manifest.js.map +1 -1
- package/dist/events/index.d.ts +0 -51
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +0 -42
- package/dist/events/index.js.map +1 -1
- package/dist/events/scheduler.d.ts +0 -8
- package/dist/events/scheduler.d.ts.map +1 -1
- package/dist/events/scheduler.js +0 -8
- package/dist/events/scheduler.js.map +1 -1
- package/dist/file-guards.d.ts +0 -15
- package/dist/file-guards.d.ts.map +1 -1
- package/dist/file-guards.js +2 -26
- package/dist/file-guards.js.map +1 -1
- package/dist/harness/execution-env.d.ts +0 -15
- package/dist/harness/execution-env.d.ts.map +1 -1
- package/dist/harness/execution-env.js +4 -55
- package/dist/harness/execution-env.js.map +1 -1
- package/dist/harness/http.d.ts +0 -12
- package/dist/harness/http.d.ts.map +1 -1
- package/dist/harness/http.js +0 -34
- package/dist/harness/http.js.map +1 -1
- package/dist/harness/index.d.ts +4 -7
- package/dist/harness/index.d.ts.map +1 -1
- package/dist/harness/index.js +4 -7
- package/dist/harness/index.js.map +1 -1
- package/dist/harness/jev.d.ts +0 -28
- package/dist/harness/jev.d.ts.map +1 -1
- package/dist/harness/jev.js +0 -45
- package/dist/harness/jev.js.map +1 -1
- package/dist/harness/mcp-result.d.ts +20 -0
- package/dist/harness/mcp-result.d.ts.map +1 -0
- package/dist/harness/mcp-result.js +171 -0
- package/dist/harness/mcp-result.js.map +1 -0
- package/dist/harness/mcp.d.ts +0 -19
- package/dist/harness/mcp.d.ts.map +1 -1
- package/dist/harness/mcp.js +7 -66
- package/dist/harness/mcp.js.map +1 -1
- package/dist/harness/models.d.ts +0 -19
- package/dist/harness/models.d.ts.map +1 -1
- package/dist/harness/models.js +0 -52
- package/dist/harness/models.js.map +1 -1
- package/dist/harness/open-connector.d.ts +0 -12
- package/dist/harness/open-connector.d.ts.map +1 -1
- package/dist/harness/open-connector.js +0 -22
- package/dist/harness/open-connector.js.map +1 -1
- package/dist/harness/presenter.d.ts +1 -0
- package/dist/harness/presenter.d.ts.map +1 -1
- package/dist/harness/presenter.js +16 -66
- package/dist/harness/presenter.js.map +1 -1
- package/dist/harness/prompt.d.ts +0 -11
- package/dist/harness/prompt.d.ts.map +1 -1
- package/dist/harness/prompt.js +1 -18
- package/dist/harness/prompt.js.map +1 -1
- package/dist/harness/runner.d.ts.map +1 -1
- package/dist/harness/runner.js +8 -28
- package/dist/harness/runner.js.map +1 -1
- package/dist/harness/session.d.ts +11 -28
- package/dist/harness/session.d.ts.map +1 -1
- package/dist/harness/session.js +100 -38
- package/dist/harness/session.js.map +1 -1
- package/dist/harness/skills.d.ts +0 -22
- package/dist/harness/skills.d.ts.map +1 -1
- package/dist/harness/skills.js +0 -20
- package/dist/harness/skills.js.map +1 -1
- package/dist/harness/subagent-profiles.d.ts +0 -4
- package/dist/harness/subagent-profiles.d.ts.map +1 -1
- package/dist/harness/subagent-profiles.js +0 -29
- package/dist/harness/subagent-profiles.js.map +1 -1
- package/dist/harness/subagent.d.ts +0 -25
- package/dist/harness/subagent.d.ts.map +1 -1
- package/dist/harness/subagent.js +1 -70
- package/dist/harness/subagent.js.map +1 -1
- package/dist/harness/tools/event.d.ts.map +1 -1
- package/dist/harness/tools/event.js +0 -9
- package/dist/harness/tools/event.js.map +1 -1
- package/dist/harness/tools/generate-image.d.ts +0 -6
- package/dist/harness/tools/generate-image.d.ts.map +1 -1
- package/dist/harness/tools/generate-image.js.map +1 -1
- package/dist/harness/tools/host-fn-tool.d.ts +0 -17
- package/dist/harness/tools/host-fn-tool.d.ts.map +1 -1
- package/dist/harness/tools/host-fn-tool.js +0 -16
- package/dist/harness/tools/host-fn-tool.js.map +1 -1
- package/dist/harness/tools/index.d.ts +1 -7
- package/dist/harness/tools/index.d.ts.map +1 -1
- package/dist/harness/tools/index.js +3 -14
- package/dist/harness/tools/index.js.map +1 -1
- package/dist/harness/tools/jev-browser.d.ts +4 -94
- package/dist/harness/tools/jev-browser.d.ts.map +1 -1
- package/dist/harness/tools/jev-browser.js +203 -92
- package/dist/harness/tools/jev-browser.js.map +1 -1
- package/dist/harness/tools/jev.d.ts +0 -8
- package/dist/harness/tools/jev.d.ts.map +1 -1
- package/dist/harness/tools/jev.js +0 -11
- package/dist/harness/tools/jev.js.map +1 -1
- package/dist/harness/tools/pi-tools.d.ts +1 -11
- package/dist/harness/tools/pi-tools.d.ts.map +1 -1
- package/dist/harness/tools/pi-tools.js +1 -30
- package/dist/harness/tools/pi-tools.js.map +1 -1
- package/dist/harness/tools/react.d.ts +0 -5
- package/dist/harness/tools/react.d.ts.map +1 -1
- package/dist/harness/tools/react.js +0 -5
- package/dist/harness/tools/react.js.map +1 -1
- package/dist/harness/tools/secret-redaction.d.ts +0 -25
- package/dist/harness/tools/secret-redaction.d.ts.map +1 -1
- package/dist/harness/tools/secret-redaction.js +3 -36
- package/dist/harness/tools/secret-redaction.js.map +1 -1
- package/dist/harness/tools/subagent.d.ts +0 -34
- package/dist/harness/tools/subagent.d.ts.map +1 -1
- package/dist/harness/tools/subagent.js +0 -92
- package/dist/harness/tools/subagent.js.map +1 -1
- package/dist/harness/tools/task.d.ts +0 -1
- package/dist/harness/tools/task.d.ts.map +1 -1
- package/dist/harness/tools/task.js +0 -1
- package/dist/harness/tools/task.js.map +1 -1
- package/dist/harness/tools/types.d.ts +0 -16
- package/dist/harness/tools/types.d.ts.map +1 -1
- package/dist/harness/tools/types.js.map +1 -1
- package/dist/harness/types.d.ts +1 -77
- package/dist/harness/types.d.ts.map +1 -1
- package/dist/harness/types.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/log.d.ts.map +1 -1
- package/dist/log.js +0 -13
- package/dist/log.js.map +1 -1
- package/dist/main.js +7 -52
- package/dist/main.js.map +1 -1
- package/dist/memory-capture/index.d.ts +16 -0
- package/dist/memory-capture/index.d.ts.map +1 -0
- package/dist/memory-capture/index.js +194 -0
- package/dist/memory-capture/index.js.map +1 -0
- package/dist/memory-capture/types.d.ts +27 -0
- package/dist/memory-capture/types.d.ts.map +1 -0
- package/dist/memory-capture/types.js.map +1 -0
- package/dist/observability/index.d.ts +0 -9
- package/dist/observability/index.d.ts.map +1 -1
- package/dist/observability/index.js +0 -9
- package/dist/observability/index.js.map +1 -1
- package/dist/observability/instrument.js +0 -5
- package/dist/observability/instrument.js.map +1 -1
- package/dist/observability/otel.js +0 -1
- package/dist/observability/otel.js.map +1 -1
- package/dist/observability/sentry.d.ts +0 -18
- package/dist/observability/sentry.d.ts.map +1 -1
- package/dist/observability/sentry.js +0 -36
- package/dist/observability/sentry.js.map +1 -1
- package/dist/observability/types.d.ts +1 -10
- package/dist/observability/types.d.ts.map +1 -1
- package/dist/observability/types.js.map +1 -1
- package/dist/office/index.d.ts +0 -76
- package/dist/office/index.d.ts.map +1 -1
- package/dist/office/index.js +4 -154
- package/dist/office/index.js.map +1 -1
- package/dist/office/projection.d.ts +0 -29
- package/dist/office/projection.d.ts.map +1 -1
- package/dist/office/projection.js +5 -41
- package/dist/office/projection.js.map +1 -1
- package/dist/office/types.d.ts +0 -66
- package/dist/office/types.d.ts.map +1 -1
- package/dist/office/types.js.map +1 -1
- package/dist/runtime/conversation-runtime.d.ts.map +1 -1
- package/dist/runtime/conversation-runtime.js +22 -83
- package/dist/runtime/conversation-runtime.js.map +1 -1
- package/dist/runtime/session-lifecycle.d.ts +0 -10
- package/dist/runtime/session-lifecycle.d.ts.map +1 -1
- package/dist/runtime/session-lifecycle.js +0 -12
- package/dist/runtime/session-lifecycle.js.map +1 -1
- package/dist/runtime/types.d.ts +2 -29
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/runtime/types.js.map +1 -1
- package/dist/sandbox/cloudflare.d.ts.map +1 -1
- package/dist/sandbox/cloudflare.js +2 -1
- package/dist/sandbox/cloudflare.js.map +1 -1
- package/dist/sandbox/container.d.ts.map +1 -1
- package/dist/sandbox/container.js +21 -15
- package/dist/sandbox/container.js.map +1 -1
- package/dist/sandbox/host.d.ts.map +1 -1
- package/dist/sandbox/host.js +0 -2
- package/dist/sandbox/host.js.map +1 -1
- package/dist/sandbox/identity.d.ts +0 -28
- package/dist/sandbox/identity.d.ts.map +1 -1
- package/dist/sandbox/identity.js +0 -28
- package/dist/sandbox/identity.js.map +1 -1
- package/dist/sandbox/index.d.ts +0 -18
- package/dist/sandbox/index.d.ts.map +1 -1
- package/dist/sandbox/index.js +2 -19
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/layout.d.ts +7 -0
- package/dist/sandbox/layout.d.ts.map +1 -0
- package/dist/sandbox/layout.js +13 -0
- package/dist/sandbox/layout.js.map +1 -0
- package/dist/sandbox/provisioner.d.ts +24 -65
- package/dist/sandbox/provisioner.d.ts.map +1 -1
- package/dist/sandbox/provisioner.js +213 -125
- package/dist/sandbox/provisioner.js.map +1 -1
- package/dist/sandbox/types.d.ts +0 -39
- package/dist/sandbox/types.d.ts.map +1 -1
- package/dist/sandbox/types.js.map +1 -1
- package/dist/sandbox/utils.d.ts +2 -5
- package/dist/sandbox/utils.d.ts.map +1 -1
- package/dist/sandbox/utils.js +31 -31
- package/dist/sandbox/utils.js.map +1 -1
- package/dist/sessions/chat-history-sync.d.ts +0 -6
- package/dist/sessions/chat-history-sync.d.ts.map +1 -1
- package/dist/sessions/chat-history-sync.js +1 -33
- package/dist/sessions/chat-history-sync.js.map +1 -1
- package/dist/sessions/history-line.d.ts +0 -20
- package/dist/sessions/history-line.d.ts.map +1 -1
- package/dist/sessions/history-line.js +0 -20
- package/dist/sessions/history-line.js.map +1 -1
- package/dist/sessions/migrate-common.d.ts +0 -15
- package/dist/sessions/migrate-common.d.ts.map +1 -1
- package/dist/sessions/migrate-common.js +0 -19
- package/dist/sessions/migrate-common.js.map +1 -1
- package/dist/sessions/migrate-pi-084.d.ts.map +1 -1
- package/dist/sessions/migrate-pi-084.js +0 -7
- package/dist/sessions/migrate-pi-084.js.map +1 -1
- package/dist/sessions/migrate-v3.d.ts +0 -7
- package/dist/sessions/migrate-v3.d.ts.map +1 -1
- package/dist/sessions/migrate-v3.js +1 -67
- package/dist/sessions/migrate-v3.js.map +1 -1
- package/dist/sessions/session-key.d.ts +3 -17
- package/dist/sessions/session-key.d.ts.map +1 -1
- package/dist/sessions/session-key.js +8 -35
- package/dist/sessions/session-key.js.map +1 -1
- package/dist/sessions/session-store.d.ts +1 -7
- package/dist/sessions/session-store.d.ts.map +1 -1
- package/dist/sessions/session-store.js +8 -50
- package/dist/sessions/session-store.js.map +1 -1
- package/dist/sessions/store.d.ts +0 -60
- package/dist/sessions/store.d.ts.map +1 -1
- package/dist/sessions/store.js +0 -113
- package/dist/sessions/store.js.map +1 -1
- package/dist/sessions/types.d.ts +0 -17
- package/dist/sessions/types.d.ts.map +1 -1
- package/dist/sessions/types.js.map +1 -1
- package/dist/settings/apply.d.ts +0 -6
- package/dist/settings/apply.d.ts.map +1 -1
- package/dist/settings/apply.js +0 -29
- package/dist/settings/apply.js.map +1 -1
- package/dist/settings/index.d.ts +0 -53
- package/dist/settings/index.d.ts.map +1 -1
- package/dist/settings/index.js +0 -77
- package/dist/settings/index.js.map +1 -1
- package/dist/settings/migrate.d.ts +0 -5
- package/dist/settings/migrate.d.ts.map +1 -1
- package/dist/settings/migrate.js +0 -17
- package/dist/settings/migrate.js.map +1 -1
- package/dist/types.d.ts +9 -159
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/vault/index.d.ts +2 -36
- package/dist/vault/index.d.ts.map +1 -1
- package/dist/vault/index.js +135 -65
- package/dist/vault/index.js.map +1 -1
- package/dist/vault/types.d.ts +0 -15
- package/dist/vault/types.d.ts.map +1 -1
- package/dist/vault/types.js.map +1 -1
- package/package.json +1 -1
- package/dist/dream/index.d.ts +0 -20
- package/dist/dream/index.d.ts.map +0 -1
- package/dist/dream/index.js +0 -264
- package/dist/dream/index.js.map +0 -1
- package/dist/dream/types.d.ts +0 -30
- package/dist/dream/types.d.ts.map +0 -1
- package/dist/dream/types.js.map +0 -1
- /package/dist/{dream → memory-capture}/types.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../../../src/adapters/github/tools/read.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAU1E,MAAM,gBAAgB,GAAG,I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AAE,qBAAqB,EAAE,KAAK,EAAE,CAAC;AAChD,CAAC","sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport { Type } from \"@sinclair/typebox\";\nimport { defineHostFnTool } from \"../../../harness/tools/host-fn-tool.js\";\nimport type {\n GithubPullRequest,\n GithubReadFn,\n GithubReadRequest,\n GithubReadResult,\n} from \"../types.js\";\n\nexport type { GithubReadFn } from \"../types.js\";\n\nconst githubReadSchema = Type.Object({\n action: Type.Union(\n [\n Type.Literal(\"pr\"),\n Type.Literal(\"pr_files\"),\n Type.Literal(\"pr_reviews\"),\n Type.Literal(\"issue\"),\n Type.Literal(\"comments\"),\n Type.Literal(\"list\"),\n ],\n {\n description:\n \"pr: PR metadata (state, base/head, diff stats). pr_files: changed files. \" +\n \"pr_reviews: submitted reviews + open inline threads (with rc- ids for \" +\n \"github_review_reply). issue: issue metadata. comments: recent conversation \" +\n \"comments. list: issues/PRs in this repo.\",\n },\n ),\n number: Type.Optional(\n Type.Number({\n description: \"Issue/PR number to read; omit for this conversation's own.\",\n }),\n ),\n state: Type.Optional(\n Type.String({ description: \"list only: open | closed | all (default open).\" }),\n ),\n labels: Type.Optional(\n Type.String({ description: \"list only: comma-separated label names to filter by.\" }),\n ),\n creator: Type.Optional(Type.String({ description: \"list only: filter by author login.\" })),\n});\n\nconst MAX_BODY_CHARS = 1000;\nconst MAX_COMMENT_CHARS = 500;\nconst MAX_REVIEW_BODY_CHARS = 300;\n\nfunction truncate(text: string, max: number): string {\n return text.length > max ? `${text.slice(0, max)}…` : text;\n}\n\nfunction formatPr(pr: GithubPullRequest): string {\n const flags = [\n pr.state ?? \"unknown\",\n pr.draft ? \"draft\" : null,\n pr.merged ? \"merged\" : null,\n pr.mergeable_state ? `mergeable_state: ${pr.mergeable_state}` : null,\n ].filter(Boolean);\n return [\n `PR #${pr.number}: ${pr.title ?? \"\"} [${flags.join(\", \")}]`,\n `${pr.head?.ref ?? \"?\"} → ${pr.base?.ref ?? \"?\"} | ${pr.changed_files ?? \"?\"} files, +${pr.additions ?? \"?\"} -${pr.deletions ?? \"?\"}`,\n pr.user ? `author: @${pr.user.login}` : null,\n pr.body ? truncate(pr.body, MAX_BODY_CHARS) : \"(no description)\",\n ]\n .filter(Boolean)\n .join(\"\\n\");\n}\n\nfunction formatReviews({\n reviews,\n threads,\n}: Extract<GithubReadResult, { kind: \"pr_reviews\" }>): string {\n const reviewLines = reviews\n .filter((review) => review.state !== \"PENDING\")\n .map((review) => {\n const body = review.body?.trim() ? ` — ${truncate(review.body, MAX_REVIEW_BODY_CHARS)}` : \"\";\n return `@${review.user.login}: ${review.state}${body}`;\n });\n // Count once rather than rescanning every comment for each root. Orphan replies\n // still count only toward their own parent; they never become root threads.\n const replyCounts = new Map<number | undefined, number>();\n for (const { in_reply_to_id: parent } of threads) {\n replyCounts.set(parent, (replyCounts.get(parent) ?? 0) + 1);\n }\n const threadLines = threads\n .filter((comment) => comment.in_reply_to_id === undefined)\n .map((comment) => {\n const location = comment.line !== null ? `${comment.path}:${comment.line}` : comment.path;\n const count = replyCounts.get(comment.id) ?? 0;\n const replyNote = count ? ` (${count} repl${count === 1 ? \"y\" : \"ies\"})` : \"\";\n return `rc-${comment.id} ${location} @${comment.user.login}${replyNote}: ${truncate(comment.body, MAX_REVIEW_BODY_CHARS)}`;\n });\n return [\n reviewLines.length ? `Reviews:\\n${reviewLines.join(\"\\n\")}` : \"No submitted reviews.\",\n threadLines.length\n ? `Inline threads (reply with github_review_reply):\\n${threadLines.join(\"\\n\")}`\n : \"No inline review threads.\",\n ].join(\"\\n\\n\");\n}\n\nfunction formatResult(result: GithubReadResult): string {\n switch (result.kind) {\n case \"pr\":\n return formatPr(result.pr);\n case \"pr_files\": {\n if (result.files.length === 0) return \"No changed files.\";\n const lines = result.files.map(\n (file) => `${file.status.padEnd(8)} ${file.filename} +${file.additions} -${file.deletions}`,\n );\n return [`${result.files.length} changed file(s):`, ...lines].join(\"\\n\");\n }\n case \"pr_reviews\":\n return formatReviews(result);\n case \"issue\": {\n const issue = result.issue;\n const labels = (issue.labels ?? []).map((label) => label.name).join(\", \");\n const assignees = (issue.assignees ?? []).map((assignee) => `@${assignee.login}`).join(\", \");\n return [\n `#${issue.number}: ${issue.title} [${issue.state ?? \"unknown\"}${issue.pull_request ? \", PR\" : \"\"}]`,\n labels ? `labels: ${labels}` : null,\n assignees ? `assignees: ${assignees}` : null,\n `author: @${issue.user.login}`,\n issue.body ? truncate(issue.body, MAX_BODY_CHARS) : \"(no body)\",\n ]\n .filter(Boolean)\n .join(\"\\n\");\n }\n case \"comments\": {\n return (\n result.comments\n .map(\n (comment) =>\n `@${comment.user.login} (${comment.created_at}): ${truncate(comment.body, MAX_COMMENT_CHARS)}`,\n )\n .join(\"\\n\") || \"No comments.\"\n );\n }\n case \"list\": {\n return (\n result.issues\n .map((issue) => {\n const labels = (issue.labels ?? []).map((label) => label.name).join(\", \");\n const kind = issue.pull_request ? \"PR\" : \"issue\";\n return `#${issue.number} [${issue.state ?? \"?\"} ${kind}] ${issue.title}${labels ? ` (${labels})` : \"\"}`;\n })\n .join(\"\\n\") || \"No matching issues.\"\n );\n }\n }\n}\n\n/**\n * The `github_read` tool reads what the ./repo clone cannot show: PR diff\n * stats and changed files, review state with open inline threads, and other\n * issues/PRs in this repo for triage. Read-only, host-side, same-repo by\n * construction; wired per run and only for GitHub conversations.\n */\nexport function createGithubReadTool(): {\n tool: AgentTool<typeof githubReadSchema>;\n setGithubReadFunction: (fn: GithubReadFn | null) => void;\n} {\n const { tool, setFn } = defineHostFnTool<GithubReadFn, typeof githubReadSchema>({\n name: \"github_read\",\n description:\n \"Read GitHub metadata for this repo: PR state/diff stats (pr), changed files \" +\n \"(pr_files), reviews and open inline threads (pr_reviews), issue metadata (issue), \" +\n \"recent comments (comments), or a filtered issue/PR listing (list). number defaults \" +\n \"to this conversation's issue/PR. Only available in GitHub conversations.\",\n parameters: githubReadSchema,\n unavailable: \"github_read is only available in GitHub conversations.\",\n run: async (readFn, args) => {\n const result = await readFn(args as GithubReadRequest);\n return {\n content: [{ type: \"text\" as const, text: formatResult(result) }],\n details: undefined,\n };\n },\n });\n\n return { tool, setGithubReadFunction: setFn };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../../../src/adapters/github/tools/read.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAU1E,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC;IACnC,MAAM,EAAE,IAAI,CAAC,KAAK,CAChB;QACE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;QAClB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;QACxB,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;QAC1B,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;QACrB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;QACxB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;KACrB,EACD;QACE,WAAW,EACT,2EAA2E;YAC3E,wEAAwE;YACxE,6EAA6E;YAC7E,0CAA0C;KAC7C,CACF;IACD,MAAM,EAAE,IAAI,CAAC,QAAQ,CACnB,IAAI,CAAC,MAAM,CAAC;QACV,WAAW,EAAE,4DAA4D;KAC1E,CAAC,CACH;IACD,KAAK,EAAE,IAAI,CAAC,QAAQ,CAClB,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,gDAAgD,EAAE,CAAC,CAC/E;IACD,MAAM,EAAE,IAAI,CAAC,QAAQ,CACnB,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,sDAAsD,EAAE,CAAC,CACrF;IACD,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,oCAAoC,EAAE,CAAC,CAAC;CAC3F,CAAC,CAAC;AAEH,MAAM,cAAc,GAA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EAAE,IAAI,EAAE,EAAE;YAC1B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAyB,CAAC,CAAC;YACvD,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;gBAChE,OAAO,EAAE,SAAS;aACnB,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAE,qBAAqB,EAAE,KAAK,EAAE,CAAC;AAChD,CAAC","sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport { Type } from \"@sinclair/typebox\";\nimport { defineHostFnTool } from \"../../../harness/tools/host-fn-tool.js\";\nimport type {\n GithubPullRequest,\n GithubReadFn,\n GithubReadRequest,\n GithubReadResult,\n} from \"../types.js\";\n\nexport type { GithubReadFn } from \"../types.js\";\n\nconst githubReadSchema = Type.Object({\n action: Type.Union(\n [\n Type.Literal(\"pr\"),\n Type.Literal(\"pr_files\"),\n Type.Literal(\"pr_reviews\"),\n Type.Literal(\"issue\"),\n Type.Literal(\"comments\"),\n Type.Literal(\"list\"),\n ],\n {\n description:\n \"pr: PR metadata (state, base/head, diff stats). pr_files: changed files. \" +\n \"pr_reviews: submitted reviews + open inline threads (with rc- ids for \" +\n \"github_review_reply). issue: issue metadata. comments: recent conversation \" +\n \"comments. list: issues/PRs in this repo.\",\n },\n ),\n number: Type.Optional(\n Type.Number({\n description: \"Issue/PR number to read; omit for this conversation's own.\",\n }),\n ),\n state: Type.Optional(\n Type.String({ description: \"list only: open | closed | all (default open).\" }),\n ),\n labels: Type.Optional(\n Type.String({ description: \"list only: comma-separated label names to filter by.\" }),\n ),\n creator: Type.Optional(Type.String({ description: \"list only: filter by author login.\" })),\n});\n\nconst MAX_BODY_CHARS = 1000;\nconst MAX_COMMENT_CHARS = 500;\nconst MAX_REVIEW_BODY_CHARS = 300;\n\nfunction truncate(text: string, max: number): string {\n return text.length > max ? `${text.slice(0, max)}…` : text;\n}\n\nfunction formatPr(pr: GithubPullRequest): string {\n const flags = [\n pr.state ?? \"unknown\",\n pr.draft ? \"draft\" : null,\n pr.merged ? \"merged\" : null,\n pr.mergeable_state ? `mergeable_state: ${pr.mergeable_state}` : null,\n ].filter(Boolean);\n return [\n `PR #${pr.number}: ${pr.title ?? \"\"} [${flags.join(\", \")}]`,\n `${pr.head?.ref ?? \"?\"} → ${pr.base?.ref ?? \"?\"} | ${pr.changed_files ?? \"?\"} files, +${pr.additions ?? \"?\"} -${pr.deletions ?? \"?\"}`,\n pr.user ? `author: @${pr.user.login}` : null,\n pr.body ? truncate(pr.body, MAX_BODY_CHARS) : \"(no description)\",\n ]\n .filter(Boolean)\n .join(\"\\n\");\n}\n\nfunction formatReviews({\n reviews,\n threads,\n}: Extract<GithubReadResult, { kind: \"pr_reviews\" }>): string {\n const reviewLines = reviews\n .filter((review) => review.state !== \"PENDING\")\n .map((review) => {\n const body = review.body?.trim() ? ` — ${truncate(review.body, MAX_REVIEW_BODY_CHARS)}` : \"\";\n return `@${review.user.login}: ${review.state}${body}`;\n });\n const replyCounts = new Map<number | undefined, number>();\n for (const { in_reply_to_id: parent } of threads) {\n replyCounts.set(parent, (replyCounts.get(parent) ?? 0) + 1);\n }\n const threadLines = threads\n .filter((comment) => comment.in_reply_to_id === undefined)\n .map((comment) => {\n const location = comment.line !== null ? `${comment.path}:${comment.line}` : comment.path;\n const count = replyCounts.get(comment.id) ?? 0;\n const replyNote = count ? ` (${count} repl${count === 1 ? \"y\" : \"ies\"})` : \"\";\n return `rc-${comment.id} ${location} @${comment.user.login}${replyNote}: ${truncate(comment.body, MAX_REVIEW_BODY_CHARS)}`;\n });\n return [\n reviewLines.length ? `Reviews:\\n${reviewLines.join(\"\\n\")}` : \"No submitted reviews.\",\n threadLines.length\n ? `Inline threads (reply with github_review_reply):\\n${threadLines.join(\"\\n\")}`\n : \"No inline review threads.\",\n ].join(\"\\n\\n\");\n}\n\nfunction formatResult(result: GithubReadResult): string {\n switch (result.kind) {\n case \"pr\":\n return formatPr(result.pr);\n case \"pr_files\": {\n if (result.files.length === 0) return \"No changed files.\";\n const lines = result.files.map(\n (file) => `${file.status.padEnd(8)} ${file.filename} +${file.additions} -${file.deletions}`,\n );\n return [`${result.files.length} changed file(s):`, ...lines].join(\"\\n\");\n }\n case \"pr_reviews\":\n return formatReviews(result);\n case \"issue\": {\n const issue = result.issue;\n const labels = (issue.labels ?? []).map((label) => label.name).join(\", \");\n const assignees = (issue.assignees ?? []).map((assignee) => `@${assignee.login}`).join(\", \");\n return [\n `#${issue.number}: ${issue.title} [${issue.state ?? \"unknown\"}${issue.pull_request ? \", PR\" : \"\"}]`,\n labels ? `labels: ${labels}` : null,\n assignees ? `assignees: ${assignees}` : null,\n `author: @${issue.user.login}`,\n issue.body ? truncate(issue.body, MAX_BODY_CHARS) : \"(no body)\",\n ]\n .filter(Boolean)\n .join(\"\\n\");\n }\n case \"comments\": {\n return (\n result.comments\n .map(\n (comment) =>\n `@${comment.user.login} (${comment.created_at}): ${truncate(comment.body, MAX_COMMENT_CHARS)}`,\n )\n .join(\"\\n\") || \"No comments.\"\n );\n }\n case \"list\": {\n return (\n result.issues\n .map((issue) => {\n const labels = (issue.labels ?? []).map((label) => label.name).join(\", \");\n const kind = issue.pull_request ? \"PR\" : \"issue\";\n return `#${issue.number} [${issue.state ?? \"?\"} ${kind}] ${issue.title}${labels ? ` (${labels})` : \"\"}`;\n })\n .join(\"\\n\") || \"No matching issues.\"\n );\n }\n }\n}\n\nexport function createGithubReadTool(): {\n tool: AgentTool<typeof githubReadSchema>;\n setGithubReadFunction: (fn: GithubReadFn | null) => void;\n} {\n const { tool, setFn } = defineHostFnTool<GithubReadFn, typeof githubReadSchema>({\n name: \"github_read\",\n description:\n \"Read GitHub metadata for this repo: PR state/diff stats (pr), changed files \" +\n \"(pr_files), reviews and open inline threads (pr_reviews), issue metadata (issue), \" +\n \"recent comments (comments), or a filtered issue/PR listing (list). number defaults \" +\n \"to this conversation's issue/PR. Only available in GitHub conversations.\",\n parameters: githubReadSchema,\n unavailable: \"github_read is only available in GitHub conversations.\",\n run: async (readFn, args) => {\n const result = await readFn(args as GithubReadRequest);\n return {\n content: [{ type: \"text\" as const, text: formatResult(result) }],\n details: undefined,\n };\n },\n });\n\n return { tool, setGithubReadFunction: setFn };\n}\n"]}
|
|
@@ -5,11 +5,6 @@ declare const githubReviewReplySchema: import("@sinclair/typebox").TObject<{
|
|
|
5
5
|
}>;
|
|
6
6
|
import type { GithubReviewReplyFn } from "../types.js";
|
|
7
7
|
export type { GithubReviewReplyFn } from "../types.js";
|
|
8
|
-
/**
|
|
9
|
-
* The `github_review_reply` tool answers inside one inline PR review thread
|
|
10
|
-
* (the responder's normal replies post as plain PR comments instead). Runs
|
|
11
|
-
* host-side as the App; wired per run and only for GitHub conversations.
|
|
12
|
-
*/
|
|
13
8
|
export declare function createGithubReviewReplyTool(): {
|
|
14
9
|
tool: AgentTool<typeof githubReviewReplySchema>;
|
|
15
10
|
setGithubReviewReplyFunction: (fn: GithubReviewReplyFn | null) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-reply.d.ts","sourceRoot":"","sources":["../../../../src/adapters/github/tools/review-reply.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAI/D,QAAA,MAAM,uBAAuB;;;EAO3B,CAAC;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD
|
|
1
|
+
{"version":3,"file":"review-reply.d.ts","sourceRoot":"","sources":["../../../../src/adapters/github/tools/review-reply.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAI/D,QAAA,MAAM,uBAAuB;;;EAO3B,CAAC;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,wBAAgB,2BAA2B,IAAI;IAC7C,IAAI,EAAE,SAAS,CAAC,OAAO,uBAAuB,CAAC,CAAC;IAChD,4BAA4B,EAAE,CAAC,EAAE,EAAE,mBAAmB,GAAG,IAAI,KAAK,IAAI,CAAC;CACxE,CAwBA"}
|
|
@@ -7,11 +7,6 @@ const githubReviewReplySchema = Type.Object({
|
|
|
7
7
|
}),
|
|
8
8
|
body: Type.String({ description: "Reply text (Markdown)." }),
|
|
9
9
|
});
|
|
10
|
-
/**
|
|
11
|
-
* The `github_review_reply` tool answers inside one inline PR review thread
|
|
12
|
-
* (the responder's normal replies post as plain PR comments instead). Runs
|
|
13
|
-
* host-side as the App; wired per run and only for GitHub conversations.
|
|
14
|
-
*/
|
|
15
10
|
export function createGithubReviewReplyTool() {
|
|
16
11
|
const { tool, setFn } = defineHostFnTool({
|
|
17
12
|
name: "github_review_reply",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-reply.js","sourceRoot":"","sources":["../../../../src/adapters/github/tools/review-reply.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E,MAAM,uBAAuB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC1C,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC;QACtB,WAAW,EACT,gFAAgF;YAChF,wEAAwE;KAC3E,CAAC;IACF,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;CAC7D,CAAC,CAAC;AAMH
|
|
1
|
+
{"version":3,"file":"review-reply.js","sourceRoot":"","sources":["../../../../src/adapters/github/tools/review-reply.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E,MAAM,uBAAuB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC1C,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC;QACtB,WAAW,EACT,gFAAgF;YAChF,wEAAwE;KAC3E,CAAC;IACF,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;CAC7D,CAAC,CAAC;AAMH,MAAM,UAAU,2BAA2B;IAIzC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,gBAAgB,CAAsD;QAC5F,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EACT,uEAAuE;YACvE,mFAAmF;YACnF,yFAAyF;QAC3F,UAAU,EAAE,uBAAuB;QACnC,WAAW,EAAE,gEAAgE;QAC7E,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;YAC3B,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YACzD,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,+BAA+B,IAAI,CAAC,UAAU,KAAK,MAAM,CAAC,GAAG,EAAE;qBACtE;iBACF;gBACD,OAAO,EAAE,SAAS;aACnB,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAE,4BAA4B,EAAE,KAAK,EAAE,CAAC;AACvD,CAAC","sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport { Type } from \"@sinclair/typebox\";\nimport { defineHostFnTool } from \"../../../harness/tools/host-fn-tool.js\";\n\nconst githubReviewReplySchema = Type.Object({\n comment_id: Type.Number({\n description:\n \"Numeric id from an [PR review comment rc-<id> …] message in this conversation \" +\n \"(e.g. 8001 for rc-8001). The reply lands inside that comment's thread.\",\n }),\n body: Type.String({ description: \"Reply text (Markdown).\" }),\n});\n\nimport type { GithubReviewReplyFn } from \"../types.js\";\n\nexport type { GithubReviewReplyFn } from \"../types.js\";\n\nexport function createGithubReviewReplyTool(): {\n tool: AgentTool<typeof githubReviewReplySchema>;\n setGithubReviewReplyFunction: (fn: GithubReviewReplyFn | null) => void;\n} {\n const { tool, setFn } = defineHostFnTool<GithubReviewReplyFn, typeof githubReviewReplySchema>({\n name: \"github_review_reply\",\n description:\n \"Reply inside a specific PR review thread. Use the numeric id from an \" +\n \"[PR review comment rc-<id> …] message as comment_id; a plain response would post \" +\n \"as a normal PR comment instead of in-thread. Only available in GitHub PR conversations.\",\n parameters: githubReviewReplySchema,\n unavailable: \"github_review_reply is only available in GitHub conversations.\",\n run: async (replyFn, args) => {\n const result = await replyFn(args.comment_id, args.body);\n return {\n content: [\n {\n type: \"text\" as const,\n text: `Replied in review thread rc-${args.comment_id}: ${result.url}`,\n },\n ],\n details: undefined,\n };\n },\n });\n\n return { tool, setGithubReviewReplyFunction: setFn };\n}\n"]}
|
|
@@ -4,12 +4,6 @@ declare const githubSyncSchema: import("@sinclair/typebox").TObject<{
|
|
|
4
4
|
}>;
|
|
5
5
|
import type { GithubSyncFn } from "../types.js";
|
|
6
6
|
export type { GithubSyncFn } from "../types.js";
|
|
7
|
-
/**
|
|
8
|
-
* The `github_sync` tool refreshes the conversation's ./repo clone — a
|
|
9
|
-
* first-contact snapshot the sandbox cannot update itself (no credentials).
|
|
10
|
-
* Host-side fetch with an ephemeral read token; it reports instead of moving
|
|
11
|
-
* the checkout whenever that could lose the agent's local work.
|
|
12
|
-
*/
|
|
13
7
|
export declare function createGithubSyncTool(): {
|
|
14
8
|
tool: AgentTool<typeof githubSyncSchema>;
|
|
15
9
|
setGithubSyncFunction: (fn: GithubSyncFn | null) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../../src/adapters/github/tools/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAI/D,QAAA,MAAM,gBAAgB;;EAQpB,CAAC;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../../src/adapters/github/tools/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAI/D,QAAA,MAAM,gBAAgB;;EAQpB,CAAC;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,wBAAgB,oBAAoB,IAAI;IACtC,IAAI,EAAE,SAAS,CAAC,OAAO,gBAAgB,CAAC,CAAC;IACzC,qBAAqB,EAAE,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,KAAK,IAAI,CAAC;CAC1D,CAoBA"}
|
|
@@ -6,12 +6,6 @@ const githubSyncSchema = Type.Object({
|
|
|
6
6
|
"branch in a plain-issue conversation).",
|
|
7
7
|
})),
|
|
8
8
|
});
|
|
9
|
-
/**
|
|
10
|
-
* The `github_sync` tool refreshes the conversation's ./repo clone — a
|
|
11
|
-
* first-contact snapshot the sandbox cannot update itself (no credentials).
|
|
12
|
-
* Host-side fetch with an ephemeral read token; it reports instead of moving
|
|
13
|
-
* the checkout whenever that could lose the agent's local work.
|
|
14
|
-
*/
|
|
15
9
|
export function createGithubSyncTool() {
|
|
16
10
|
const { tool, setFn } = defineHostFnTool({
|
|
17
11
|
name: "github_sync",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../../src/adapters/github/tools/sync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAA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AAE,CAAC;AAChD,CAAC","sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport { Type } from \"@sinclair/typebox\";\nimport { defineHostFnTool } from \"../../../harness/tools/host-fn-tool.js\";\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\nimport type { GithubSyncFn } from \"../types.js\";\n\nexport type { GithubSyncFn } from \"../types.js\";\n\nexport function createGithubSyncTool(): {\n tool: AgentTool<typeof githubSyncSchema>;\n setGithubSyncFunction: (fn: GithubSyncFn | null) => void;\n} {\n const { tool, setFn } = defineHostFnTool<GithubSyncFn, typeof githubSyncSchema>({\n name: \"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 unavailable: \"github_sync is only available in GitHub conversations.\",\n run: async (syncFn, args) => {\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 { tool, setGithubSyncFunction: setFn };\n}\n"]}
|
|
@@ -6,30 +6,18 @@ export interface GithubEvent extends ConversationEvent {
|
|
|
6
6
|
}
|
|
7
7
|
export interface GithubBotConfig {
|
|
8
8
|
appId: string;
|
|
9
|
-
/** PEM-encoded GitHub App private key. */
|
|
10
9
|
privateKey: string;
|
|
11
10
|
installationId: string;
|
|
12
|
-
/** `owner/repo` entries to watch; empty = all installation repositories. */
|
|
13
11
|
repos: string[];
|
|
14
12
|
pollIntervalMs: number;
|
|
15
13
|
workspace: Workspace;
|
|
16
|
-
/**
|
|
17
|
-
* Where the poll watermark state (baseline + seen ids) is persisted. Lives
|
|
18
|
-
* under the host-only state dir: the workspace dir can be mounted into
|
|
19
|
-
* sandboxes, and sandboxed code must not be able to clear dedup state and
|
|
20
|
-
* re-trigger runs.
|
|
21
|
-
*/
|
|
22
14
|
syncStatePath: string;
|
|
23
15
|
}
|
|
24
|
-
/** Persisted per-repo poll watermark (DESIGN.md § Event source). */
|
|
25
16
|
interface GithubRepoSyncState {
|
|
26
|
-
/** Comments/issues created before this ISO instant never trigger. */
|
|
27
17
|
baseline: string;
|
|
28
|
-
/** Newest updated_at seen; polls fetch from (cursor - overlap). */
|
|
29
18
|
cursor: string;
|
|
30
19
|
seenComments: number[];
|
|
31
20
|
seenIssues: number[];
|
|
32
|
-
/** Optional so state files written before review-comment polling still load. */
|
|
33
21
|
seenReviewComments?: number[];
|
|
34
22
|
}
|
|
35
23
|
export interface GithubSyncState {
|
|
@@ -55,7 +43,6 @@ export interface GithubIssue {
|
|
|
55
43
|
created_at: string;
|
|
56
44
|
updated_at: string;
|
|
57
45
|
pull_request?: object;
|
|
58
|
-
/** open | closed */
|
|
59
46
|
state?: string;
|
|
60
47
|
labels?: {
|
|
61
48
|
name: string;
|
|
@@ -70,25 +57,18 @@ export interface GithubIssueComment {
|
|
|
70
57
|
user: GithubUser;
|
|
71
58
|
created_at: string;
|
|
72
59
|
updated_at: string;
|
|
73
|
-
/** API URL of the parent issue, e.g. …/repos/o/r/issues/42 */
|
|
74
60
|
issue_url: string;
|
|
75
61
|
}
|
|
76
|
-
/** An inline PR review comment (a comment on a diff line). */
|
|
77
62
|
export interface GithubReviewComment {
|
|
78
63
|
id: number;
|
|
79
64
|
body: string;
|
|
80
65
|
user: GithubUser;
|
|
81
66
|
created_at: string;
|
|
82
67
|
updated_at: string;
|
|
83
|
-
/** API URL of the parent PR, e.g. …/repos/o/r/pulls/42 */
|
|
84
68
|
pull_request_url: string;
|
|
85
|
-
/** File the comment is anchored to. */
|
|
86
69
|
path: string;
|
|
87
|
-
/** Line in the diff's right side; null when the anchor is outdated. */
|
|
88
70
|
line: number | null;
|
|
89
|
-
/** The diff excerpt the comment is anchored to. */
|
|
90
71
|
diff_hunk: string;
|
|
91
|
-
/** Set on replies: the id of the thread's root comment. */
|
|
92
72
|
in_reply_to_id?: number;
|
|
93
73
|
}
|
|
94
74
|
export interface GithubRepository {
|
|
@@ -99,15 +79,12 @@ export interface GithubRepositoryDetails {
|
|
|
99
79
|
default_branch: string;
|
|
100
80
|
}
|
|
101
81
|
export interface GithubCollaboratorPermission {
|
|
102
|
-
/** Legacy field: admin | write | read | none (maintain→write, triage→read). */
|
|
103
82
|
permission: string;
|
|
104
|
-
/** Granular assigned role (admin/maintain/write/triage/read or a custom role). */
|
|
105
83
|
role_name?: string;
|
|
106
84
|
}
|
|
107
85
|
export interface GithubPullRequest {
|
|
108
86
|
number: number;
|
|
109
87
|
html_url: string;
|
|
110
|
-
/** head.repo is null when the fork a PR came from was deleted. */
|
|
111
88
|
head?: {
|
|
112
89
|
ref: string;
|
|
113
90
|
sha: string;
|
|
@@ -120,7 +97,6 @@ export interface GithubPullRequest {
|
|
|
120
97
|
};
|
|
121
98
|
title?: string;
|
|
122
99
|
body?: string | null;
|
|
123
|
-
/** open | closed */
|
|
124
100
|
state?: string;
|
|
125
101
|
draft?: boolean;
|
|
126
102
|
merged?: boolean;
|
|
@@ -130,61 +106,42 @@ export interface GithubPullRequest {
|
|
|
130
106
|
deletions?: number;
|
|
131
107
|
user?: GithubUser;
|
|
132
108
|
}
|
|
133
|
-
/** One row of GET /pulls/{n}/files. */
|
|
134
109
|
export interface GithubPullRequestFile {
|
|
135
110
|
filename: string;
|
|
136
|
-
/** added | removed | modified | renamed | … */
|
|
137
111
|
status: string;
|
|
138
112
|
additions: number;
|
|
139
113
|
deletions: number;
|
|
140
114
|
}
|
|
141
|
-
/** One submitted review of GET /pulls/{n}/reviews. */
|
|
142
115
|
export interface GithubPullRequestReview {
|
|
143
116
|
id: number;
|
|
144
117
|
user: GithubUser;
|
|
145
118
|
body: string | null;
|
|
146
|
-
/** APPROVED | CHANGES_REQUESTED | COMMENTED | DISMISSED | PENDING */
|
|
147
119
|
state: string;
|
|
148
120
|
submitted_at?: string;
|
|
149
121
|
}
|
|
150
122
|
export interface GithubCheckRun {
|
|
151
|
-
/** Check-run id; for GitHub Actions this doubles as the job id (log fetch). */
|
|
152
123
|
id: number;
|
|
153
124
|
name: string;
|
|
154
|
-
/** queued | in_progress | completed */
|
|
155
125
|
status: string;
|
|
156
|
-
/** success | failure | neutral | cancelled | skipped | timed_out | action_required | null while running */
|
|
157
126
|
conclusion: string | null;
|
|
158
127
|
html_url: string | null;
|
|
159
|
-
/** The app that reported the check (github-actions vs external CI). */
|
|
160
128
|
app?: {
|
|
161
129
|
slug?: string;
|
|
162
130
|
} | null;
|
|
163
|
-
/** Whatever the reporting app posted about the run. */
|
|
164
131
|
output?: {
|
|
165
132
|
title?: string | null;
|
|
166
133
|
summary?: string | null;
|
|
167
134
|
} | null;
|
|
168
135
|
}
|
|
169
|
-
/** Permission subset requestable on a scoped installation token. */
|
|
170
136
|
export type GithubTokenPermissions = Partial<Record<"contents" | "pull_requests" | "issues", "read" | "write">>;
|
|
171
137
|
export type GithubReactionContent = "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes";
|
|
172
138
|
export interface CloneRepoOptions {
|
|
173
|
-
/** HTTPS remote, e.g. https://github.com/owner/repo.git (no credentials). */
|
|
174
139
|
url: string;
|
|
175
|
-
/** Destination directory (the conversation dir's `repo/`). */
|
|
176
140
|
dir: string;
|
|
177
|
-
/** Ephemeral scoped installation token; used per-invocation, never stored. */
|
|
178
141
|
token: string;
|
|
179
142
|
botLogin: string;
|
|
180
143
|
botEmail: string;
|
|
181
|
-
/** When the conversation is a PR: fetch and check out its head. */
|
|
182
144
|
prNumber?: number;
|
|
183
|
-
/**
|
|
184
|
-
* The PR's head branch name when it lives in this repo (not a fork): the
|
|
185
|
-
* checkout is named after it so committing there + github_pr updates the
|
|
186
|
-
* PR in place. Absent (fork/unknown), the checkout falls back to pr-<n>.
|
|
187
|
-
*/
|
|
188
145
|
prHeadBranch?: string;
|
|
189
146
|
}
|
|
190
147
|
export interface PushBranchOptions {
|
|
@@ -194,85 +151,59 @@ export interface PushBranchOptions {
|
|
|
194
151
|
}
|
|
195
152
|
export interface SyncRepoOptions {
|
|
196
153
|
dir: string;
|
|
197
|
-
/** Ephemeral contents:read token; used per-invocation, never stored. */
|
|
198
154
|
token: string;
|
|
199
|
-
/** Explicit branch to fetch; wins over prNumber/defaultBranch. */
|
|
200
155
|
branch?: string;
|
|
201
|
-
/** PR conversations: fetch pull/<n>/head into the local PR checkout. */
|
|
202
156
|
prNumber?: number;
|
|
203
|
-
/** Same-repo PR head name; the local checkout target. Fallback: pr-<n>. */
|
|
204
157
|
prHeadBranch?: string;
|
|
205
|
-
/** Fallback target when neither branch nor prNumber applies. */
|
|
206
158
|
defaultBranch?: string;
|
|
207
159
|
}
|
|
208
160
|
export interface SyncRepoResult {
|
|
209
|
-
/** Local branch the fetch targets (the PR head name, pr-<n>, or the branch). */
|
|
210
161
|
target: string;
|
|
211
162
|
fetchedSha: string;
|
|
212
|
-
/** True when the checkout was moved to the fetched head. */
|
|
213
163
|
updatedCheckout: boolean;
|
|
214
|
-
/** Working tree had uncommitted changes (checkout left alone). */
|
|
215
164
|
dirty: boolean;
|
|
216
165
|
currentBranch: string;
|
|
217
|
-
/** Bot-committed (agent-made) commits on the target that origin lacks. */
|
|
218
166
|
localCommits: number;
|
|
219
167
|
}
|
|
220
168
|
export interface GithubClientOptions {
|
|
221
169
|
appId: string;
|
|
222
170
|
privateKey: string;
|
|
223
171
|
installationId: string;
|
|
224
|
-
/** Override the API root for tests; defaults to https://api.github.com */
|
|
225
172
|
baseUrl?: string;
|
|
226
173
|
fetchImpl?: typeof fetch;
|
|
227
174
|
}
|
|
228
|
-
/** Arguments for the host-side `github_pr` tool. */
|
|
229
175
|
export interface GithubPrRequest {
|
|
230
|
-
/** Local branch in the conversation's ./repo clone; must match pi/<name>. */
|
|
231
176
|
branch: string;
|
|
232
177
|
title: string;
|
|
233
178
|
body?: string;
|
|
234
|
-
/** Target branch; defaults to the repository's default branch. */
|
|
235
179
|
base?: string;
|
|
236
180
|
draft?: boolean;
|
|
237
181
|
}
|
|
238
182
|
export interface GithubPrResult {
|
|
239
183
|
number: number;
|
|
240
184
|
url: string;
|
|
241
|
-
/** True when the branch already had an open PR that this push updated. */
|
|
242
185
|
updatedExisting?: boolean;
|
|
243
186
|
}
|
|
244
|
-
/** Normalized check-run row for the host-side `github_checks` tool. */
|
|
245
187
|
export interface GithubCheckSummary {
|
|
246
|
-
/** Check-run id; for GitHub Actions checks it is also the job id for log fetch. */
|
|
247
188
|
id: number;
|
|
248
189
|
name: string;
|
|
249
|
-
/** queued | in_progress | completed */
|
|
250
190
|
status: string;
|
|
251
|
-
/** success | failure | … ; null while the run is still in progress */
|
|
252
191
|
conclusion: string | null;
|
|
253
192
|
url: string | null;
|
|
254
|
-
/** Slug of the reporting app; "github-actions" checks have fetchable logs. */
|
|
255
193
|
appSlug: string | null;
|
|
256
|
-
/** The reporting app's own summary of the run, when it posted one. */
|
|
257
194
|
outputSummary: string | null;
|
|
258
195
|
}
|
|
259
196
|
export interface GithubChecksFns {
|
|
260
197
|
getChecks: (branch?: string) => Promise<GithubCheckSummary[]>;
|
|
261
198
|
getJobLog: (jobId: number) => Promise<string>;
|
|
262
199
|
}
|
|
263
|
-
/** Arguments for the host-side `github_read` tool. */
|
|
264
200
|
export interface GithubReadRequest {
|
|
265
201
|
action: "pr" | "pr_files" | "pr_reviews" | "issue" | "comments" | "list";
|
|
266
|
-
/** Issue/PR number; defaults to the conversation's own. */
|
|
267
202
|
number?: number;
|
|
268
|
-
/** list only: open | closed | all (default open). */
|
|
269
203
|
state?: string;
|
|
270
|
-
/** list only: comma-separated label names. */
|
|
271
204
|
labels?: string;
|
|
272
|
-
/** list only: filter by author login. */
|
|
273
205
|
creator?: string;
|
|
274
206
|
}
|
|
275
|
-
/** Typed payload of one `github_read` action; the tool renders it. */
|
|
276
207
|
export type GithubReadResult = {
|
|
277
208
|
kind: "pr";
|
|
278
209
|
pr: GithubPullRequest;
|
|
@@ -293,25 +224,14 @@ export type GithubReadResult = {
|
|
|
293
224
|
kind: "list";
|
|
294
225
|
issues: GithubIssue[];
|
|
295
226
|
};
|
|
296
|
-
/** Arguments for the host-side `github_issue` tool. Deliberately a closed
|
|
297
|
-
* action set: lock/delete/transfer are not offered at all. */
|
|
298
227
|
export interface GithubIssueRequest {
|
|
299
228
|
action: "add_labels" | "remove_label" | "add_assignees" | "remove_assignees" | "close" | "reopen";
|
|
300
|
-
/** Issue/PR number; defaults to the conversation's own (triage may target others). */
|
|
301
229
|
number?: number;
|
|
302
|
-
/** add_labels */
|
|
303
230
|
labels?: string[];
|
|
304
|
-
/** remove_label */
|
|
305
231
|
label?: string;
|
|
306
|
-
/** add_assignees / remove_assignees */
|
|
307
232
|
assignees?: string[];
|
|
308
|
-
/** close */
|
|
309
233
|
state_reason?: "completed" | "not_planned";
|
|
310
234
|
}
|
|
311
|
-
/**
|
|
312
|
-
* Host-side GitHub operations for github_* tools. Wired in main.ts over the
|
|
313
|
-
* GitHub bot; tokens stay host-side. Consumed by `createGithubToolPack`.
|
|
314
|
-
*/
|
|
315
235
|
export type GithubSyncFn = (branch?: string) => Promise<string>;
|
|
316
236
|
export type GithubReviewReplyFn = (commentId: number, body: string) => Promise<{
|
|
317
237
|
url: string;
|
|
@@ -319,26 +239,18 @@ export type GithubReviewReplyFn = (commentId: number, body: string) => Promise<{
|
|
|
319
239
|
export type GithubReadFn = (request: GithubReadRequest) => Promise<GithubReadResult>;
|
|
320
240
|
export type GithubIssueFn = (request: GithubIssueRequest) => Promise<string>;
|
|
321
241
|
export interface PlatformGithubOps {
|
|
322
|
-
/** Push a prepared pi/* branch and open (or update) a pull request. */
|
|
323
242
|
pushAndCreatePr(conversationId: string, request: GithubPrRequest): Promise<GithubPrResult>;
|
|
324
|
-
/** CI check runs for a branch, or for the conversation's PR head when omitted. */
|
|
325
243
|
getChecks(conversationId: string, branch?: string): Promise<GithubCheckSummary[]>;
|
|
326
|
-
/** Log text of one CI job (an Actions check-run id), tail-truncated. */
|
|
327
244
|
getJobLog(conversationId: string, jobId: number): Promise<string>;
|
|
328
|
-
/** Reply inside one inline review thread of the conversation's PR. */
|
|
329
245
|
replyToReviewThread(conversationId: string, commentId: number, body: string): Promise<{
|
|
330
246
|
url: string;
|
|
331
247
|
}>;
|
|
332
|
-
/** Refresh the conversation's ./repo clone; returns a human-readable report. */
|
|
333
248
|
syncRepo(conversationId: string, branch?: string): Promise<string>;
|
|
334
|
-
/** Read PR/issue metadata the clone cannot provide; same repo only. */
|
|
335
249
|
readGithub(conversationId: string, request: GithubReadRequest): Promise<GithubReadResult>;
|
|
336
|
-
/** Label/assignee/state management on this repo's issues; returns a report. */
|
|
337
250
|
manageIssue(conversationId: string, request: GithubIssueRequest): Promise<string>;
|
|
338
251
|
}
|
|
339
252
|
export interface GithubWebhookOptions {
|
|
340
253
|
secret: string;
|
|
341
|
-
/** Called after signature verification for relevant events. */
|
|
342
254
|
onPoke: () => void;
|
|
343
255
|
}
|
|
344
256
|
export {};
|
|
@@ -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,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,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,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/adapters/github/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAA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CAAC,CAAC;AAE7E,MAAM,WAAW,iBAAiB;IAChC,eAAe,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC3F,SAAS,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAClF,SAAS,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAClE,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,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACnE,UAAU,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC1F,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACnF;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/adapters/github/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ConversationEvent } from \"../index.js\";\nimport type { Workspace } from \"../../office/types.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 workspace: Workspace;\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 /** 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}\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}\n\nexport interface GithubChecksFns {\n getChecks: (branch?: string) => Promise<GithubCheckSummary[]>;\n getJobLog: (jobId: number) => Promise<string>;\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 type GithubSyncFn = (branch?: string) => Promise<string>;\n\nexport type GithubReviewReplyFn = (commentId: number, body: string) => Promise<{ url: string }>;\n\nexport type GithubReadFn = (request: GithubReadRequest) => Promise<GithubReadResult>;\n\nexport type GithubIssueFn = (request: GithubIssueRequest) => Promise<string>;\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 /** 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\nexport interface GithubWebhookOptions {\n secret: string;\n /** Called after signature verification for relevant events. */\n onPoke: () => void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/adapters/github/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ConversationEvent } from \"../index.js\";\nimport type { Workspace } from \"../../office/types.js\";\n\nexport interface GithubEvent extends ConversationEvent {\n type: \"message\" | \"issue\";\n userName?: string;\n}\n\nexport interface GithubBotConfig {\n appId: string;\n privateKey: string;\n installationId: string;\n repos: string[];\n pollIntervalMs: number;\n workspace: Workspace;\n syncStatePath: string;\n}\n\ninterface GithubRepoSyncState {\n baseline: string;\n cursor: string;\n seenComments: number[];\n seenIssues: number[];\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\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 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 issue_url: string;\n}\n\nexport interface GithubReviewComment {\n id: number;\n body: string;\n user: GithubUser;\n created_at: string;\n updated_at: string;\n pull_request_url: string;\n path: string;\n line: number | null;\n diff_hunk: string;\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 permission: string;\n role_name?: string;\n}\n\nexport interface GithubPullRequest {\n number: number;\n html_url: string;\n head?: { ref: string; sha: string; repo?: { full_name?: string } | null };\n base?: { ref: string };\n title?: string;\n body?: string | null;\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\nexport interface GithubPullRequestFile {\n filename: string;\n status: string;\n additions: number;\n deletions: number;\n}\n\nexport interface GithubPullRequestReview {\n id: number;\n user: GithubUser;\n body: string | null;\n state: string;\n submitted_at?: string;\n}\n\nexport interface GithubCheckRun {\n id: number;\n name: string;\n status: string;\n conclusion: string | null;\n html_url: string | null;\n app?: { slug?: string } | null;\n output?: { title?: string | null; summary?: string | null } | null;\n}\n\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 url: string;\n dir: string;\n token: string;\n botLogin: string;\n botEmail: string;\n prNumber?: number;\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 token: string;\n branch?: string;\n prNumber?: number;\n prHeadBranch?: string;\n defaultBranch?: string;\n}\n\nexport interface SyncRepoResult {\n target: string;\n fetchedSha: string;\n updatedCheckout: boolean;\n dirty: boolean;\n currentBranch: string;\n localCommits: number;\n}\n\nexport interface GithubClientOptions {\n appId: string;\n privateKey: string;\n installationId: string;\n baseUrl?: string;\n fetchImpl?: typeof fetch;\n}\n\nexport interface GithubPrRequest {\n branch: string;\n title: string;\n body?: string;\n base?: string;\n draft?: boolean;\n}\n\nexport interface GithubPrResult {\n number: number;\n url: string;\n updatedExisting?: boolean;\n}\n\nexport interface GithubCheckSummary {\n id: number;\n name: string;\n status: string;\n conclusion: string | null;\n url: string | null;\n appSlug: string | null;\n outputSummary: string | null;\n}\n\nexport interface GithubChecksFns {\n getChecks: (branch?: string) => Promise<GithubCheckSummary[]>;\n getJobLog: (jobId: number) => Promise<string>;\n}\n\nexport interface GithubReadRequest {\n action: \"pr\" | \"pr_files\" | \"pr_reviews\" | \"issue\" | \"comments\" | \"list\";\n number?: number;\n state?: string;\n labels?: string;\n creator?: string;\n}\n\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\nexport interface GithubIssueRequest {\n action: \"add_labels\" | \"remove_label\" | \"add_assignees\" | \"remove_assignees\" | \"close\" | \"reopen\";\n number?: number;\n labels?: string[];\n label?: string;\n assignees?: string[];\n state_reason?: \"completed\" | \"not_planned\";\n}\n\nexport type GithubSyncFn = (branch?: string) => Promise<string>;\n\nexport type GithubReviewReplyFn = (commentId: number, body: string) => Promise<{ url: string }>;\n\nexport type GithubReadFn = (request: GithubReadRequest) => Promise<GithubReadResult>;\n\nexport type GithubIssueFn = (request: GithubIssueRequest) => Promise<string>;\n\nexport interface PlatformGithubOps {\n pushAndCreatePr(conversationId: string, request: GithubPrRequest): Promise<GithubPrResult>;\n getChecks(conversationId: string, branch?: string): Promise<GithubCheckSummary[]>;\n getJobLog(conversationId: string, jobId: number): Promise<string>;\n replyToReviewThread(\n conversationId: string,\n commentId: number,\n body: string,\n ): Promise<{ url: string }>;\n syncRepo(conversationId: string, branch?: string): Promise<string>;\n readGithub(conversationId: string, request: GithubReadRequest): Promise<GithubReadResult>;\n manageIssue(conversationId: string, request: GithubIssueRequest): Promise<string>;\n}\n\nexport interface GithubWebhookOptions {\n secret: string;\n onPoke: () => void;\n}\n"]}
|
|
@@ -1,20 +1,7 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
2
|
import type { GithubWebhookOptions } from "./types.js";
|
|
3
3
|
export type { GithubWebhookOptions } from "./types.js";
|
|
4
|
-
/**
|
|
5
|
-
* GitHub webhook receiver — a poke, not an event source. Deliveries are
|
|
6
|
-
* unordered, unguaranteed, and may repeat, so the payload is never parsed into
|
|
7
|
-
* the intake pipeline; a verified delivery only asks the bot to poll soon, and
|
|
8
|
-
* the poll's watermark/dedup discipline decides what actually triggers
|
|
9
|
-
* (DESIGN.md § Event source). Polling stays on as the missed-delivery
|
|
10
|
-
* backstop.
|
|
11
|
-
*/
|
|
12
4
|
export declare const GITHUB_WEBHOOK_PATH = "/github/webhook";
|
|
13
|
-
/** Constant-time check of `X-Hub-Signature-256: sha256=<hex>` over the raw body. */
|
|
14
5
|
export declare function verifyWebhookSignature(secret: string, body: Buffer, signatureHeader: string | undefined): boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Handle a request if it targets the webhook path. Returns false when the
|
|
17
|
-
* request is not for this route so the caller falls through.
|
|
18
|
-
*/
|
|
19
6
|
export declare function handleGithubWebhookRequest(req: IncomingMessage, res: ServerResponse, url: URL, options: GithubWebhookOptions): Promise<boolean>;
|
|
20
7
|
//# sourceMappingURL=webhook.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../src/adapters/github/webhook.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,YAAY,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD
|
|
1
|
+
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../src/adapters/github/webhook.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,YAAY,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAwBrD,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,MAAM,GAAG,SAAS,GAClC,OAAO,CAMT;AAED,wBAAsB,0BAA0B,CAC9C,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,OAAO,CAAC,CAmClB"}
|
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
2
2
|
import * as log from "../../log.js";
|
|
3
|
-
/**
|
|
4
|
-
* GitHub webhook receiver — a poke, not an event source. Deliveries are
|
|
5
|
-
* unordered, unguaranteed, and may repeat, so the payload is never parsed into
|
|
6
|
-
* the intake pipeline; a verified delivery only asks the bot to poll soon, and
|
|
7
|
-
* the poll's watermark/dedup discipline decides what actually triggers
|
|
8
|
-
* (DESIGN.md § Event source). Polling stays on as the missed-delivery
|
|
9
|
-
* backstop.
|
|
10
|
-
*/
|
|
11
3
|
export const GITHUB_WEBHOOK_PATH = "/github/webhook";
|
|
12
|
-
/** Events that can carry a new conversation-triggering item. */
|
|
13
4
|
const POKE_EVENTS = new Set(["issues", "issue_comment", "pull_request_review_comment"]);
|
|
14
|
-
/** GitHub payloads are small; anything larger than this is not GitHub. */
|
|
15
5
|
const MAX_BODY_BYTES = 1024 * 1024;
|
|
16
6
|
function readBody(req, maxBytes) {
|
|
17
7
|
return new Promise((resolve, reject) => {
|
|
@@ -30,7 +20,6 @@ function readBody(req, maxBytes) {
|
|
|
30
20
|
req.on("error", reject);
|
|
31
21
|
});
|
|
32
22
|
}
|
|
33
|
-
/** Constant-time check of `X-Hub-Signature-256: sha256=<hex>` over the raw body. */
|
|
34
23
|
export function verifyWebhookSignature(secret, body, signatureHeader) {
|
|
35
24
|
if (!signatureHeader?.startsWith("sha256="))
|
|
36
25
|
return false;
|
|
@@ -40,10 +29,6 @@ export function verifyWebhookSignature(secret, body, signatureHeader) {
|
|
|
40
29
|
return false;
|
|
41
30
|
return timingSafeEqual(Buffer.from(received, "utf-8"), Buffer.from(expected, "utf-8"));
|
|
42
31
|
}
|
|
43
|
-
/**
|
|
44
|
-
* Handle a request if it targets the webhook path. Returns false when the
|
|
45
|
-
* request is not for this route so the caller falls through.
|
|
46
|
-
*/
|
|
47
32
|
export async function handleGithubWebhookRequest(req, res, url, options) {
|
|
48
33
|
if (url.pathname !== GITHUB_WEBHOOK_PATH)
|
|
49
34
|
return false;
|
|
@@ -68,7 +53,6 @@ export async function handleGithubWebhookRequest(req, res, url, options) {
|
|
|
68
53
|
res.end(JSON.stringify({ ok: true }));
|
|
69
54
|
return true;
|
|
70
55
|
}
|
|
71
|
-
// Respond before the poll runs — GitHub times deliveries out at 10s.
|
|
72
56
|
res.writeHead(202).end();
|
|
73
57
|
if (typeof event === "string" && POKE_EVENTS.has(event)) {
|
|
74
58
|
options.onPoke();
|