lastlight 0.16.0 → 0.16.1
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/README.md +71 -692
- package/dist/cli-config.js.map +1 -0
- package/dist/cli-format.js.map +1 -0
- package/dist/{cli/cli-server.d.ts → cli-server.d.ts} +26 -1
- package/dist/{cli/cli-server.js → cli-server.js} +40 -5
- package/dist/cli-server.js.map +1 -0
- package/dist/cli-timeline.js.map +1 -0
- package/dist/{cli/cli.js → cli.js} +4 -3
- package/dist/cli.js.map +1 -0
- package/dist/{cli/fork-cli.d.ts → fork-cli.d.ts} +3 -3
- package/dist/{cli/fork-cli.js → fork-cli.js} +28 -27
- package/dist/fork-cli.js.map +1 -0
- package/dist/{cli/oauth-cli.js → oauth-cli.js} +1 -1
- package/dist/oauth-cli.js.map +1 -0
- package/dist/{cli/setup.js → setup.js} +10 -4
- package/dist/setup.js.map +1 -0
- package/dist/{cli/skills-install.d.ts → skills-install.d.ts} +6 -0
- package/dist/{cli/skills-install.js → skills-install.js} +6 -2
- package/dist/skills-install.js.map +1 -0
- package/package.json +20 -65
- package/plugins/lastlight/.claude-plugin/plugin.json +1 -1
- package/agent-context/rules.md +0 -80
- package/agent-context/security.md +0 -69
- package/agent-context/soul.md +0 -21
- package/config/default.yaml +0 -119
- package/deploy/.env.production.example +0 -100
- package/deploy/entrypoint.sh +0 -82
- package/deploy/native/README.md +0 -160
- package/deploy/native/install.sh +0 -110
- package/deploy/native/lastlight.env.example +0 -95
- package/deploy/native/lastlight.service +0 -50
- package/deploy/sandbox-entrypoint.sh +0 -93
- package/dist/admin/auth.d.ts +0 -51
- package/dist/admin/auth.js +0 -121
- package/dist/admin/auth.js.map +0 -1
- package/dist/admin/chat-session-reader.d.ts +0 -39
- package/dist/admin/chat-session-reader.js +0 -84
- package/dist/admin/chat-session-reader.js.map +0 -1
- package/dist/admin/docker.d.ts +0 -61
- package/dist/admin/docker.js +0 -187
- package/dist/admin/docker.js.map +0 -1
- package/dist/admin/index.d.ts +0 -9
- package/dist/admin/index.js +0 -59
- package/dist/admin/index.js.map +0 -1
- package/dist/admin/routes.d.ts +0 -81
- package/dist/admin/routes.js +0 -1381
- package/dist/admin/routes.js.map +0 -1
- package/dist/admin/sessions.d.ts +0 -89
- package/dist/admin/sessions.js +0 -204
- package/dist/admin/sessions.js.map +0 -1
- package/dist/admin/tail.d.ts +0 -12
- package/dist/admin/tail.js +0 -145
- package/dist/admin/tail.js.map +0 -1
- package/dist/admin/version.d.ts +0 -22
- package/dist/admin/version.js +0 -92
- package/dist/admin/version.js.map +0 -1
- package/dist/cli/cli-config.js.map +0 -1
- package/dist/cli/cli-format.js.map +0 -1
- package/dist/cli/cli-server.js.map +0 -1
- package/dist/cli/cli-timeline.js.map +0 -1
- package/dist/cli/cli.js.map +0 -1
- package/dist/cli/fork-cli.js.map +0 -1
- package/dist/cli/oauth-cli.js.map +0 -1
- package/dist/cli/setup.js.map +0 -1
- package/dist/cli/skills-install.js.map +0 -1
- package/dist/config/config-resolve.d.ts +0 -28
- package/dist/config/config-resolve.js +0 -47
- package/dist/config/config-resolve.js.map +0 -1
- package/dist/config/config.d.ts +0 -157
- package/dist/config/config.js +0 -581
- package/dist/config/config.js.map +0 -1
- package/dist/config/core-pin.d.ts +0 -16
- package/dist/config/core-pin.js +0 -85
- package/dist/config/core-pin.js.map +0 -1
- package/dist/config/overlay-assets.d.ts +0 -20
- package/dist/config/overlay-assets.js +0 -114
- package/dist/config/overlay-assets.js.map +0 -1
- package/dist/config/overlay-bootstrap.d.ts +0 -44
- package/dist/config/overlay-bootstrap.js +0 -304
- package/dist/config/overlay-bootstrap.js.map +0 -1
- package/dist/connectors/github-webhook.d.ts +0 -45
- package/dist/connectors/github-webhook.js +0 -321
- package/dist/connectors/github-webhook.js.map +0 -1
- package/dist/connectors/index.d.ts +0 -18
- package/dist/connectors/index.js +0 -41
- package/dist/connectors/index.js.map +0 -1
- package/dist/connectors/messaging/base.d.ts +0 -42
- package/dist/connectors/messaging/base.js +0 -139
- package/dist/connectors/messaging/base.js.map +0 -1
- package/dist/connectors/messaging/delivery.d.ts +0 -14
- package/dist/connectors/messaging/delivery.js +0 -38
- package/dist/connectors/messaging/delivery.js.map +0 -1
- package/dist/connectors/messaging/index.d.ts +0 -4
- package/dist/connectors/messaging/index.js +0 -4
- package/dist/connectors/messaging/index.js.map +0 -1
- package/dist/connectors/messaging/session-manager.d.ts +0 -53
- package/dist/connectors/messaging/session-manager.js +0 -255
- package/dist/connectors/messaging/session-manager.js.map +0 -1
- package/dist/connectors/messaging/types.d.ts +0 -58
- package/dist/connectors/messaging/types.js +0 -7
- package/dist/connectors/messaging/types.js.map +0 -1
- package/dist/connectors/slack/connector.d.ts +0 -142
- package/dist/connectors/slack/connector.js +0 -494
- package/dist/connectors/slack/connector.js.map +0 -1
- package/dist/connectors/slack/index.d.ts +0 -2
- package/dist/connectors/slack/index.js +0 -3
- package/dist/connectors/slack/index.js.map +0 -1
- package/dist/connectors/slack/mrkdwn.d.ts +0 -19
- package/dist/connectors/slack/mrkdwn.js +0 -240
- package/dist/connectors/slack/mrkdwn.js.map +0 -1
- package/dist/connectors/types.d.ts +0 -61
- package/dist/connectors/types.js +0 -2
- package/dist/connectors/types.js.map +0 -1
- package/dist/cron/fanout.d.ts +0 -33
- package/dist/cron/fanout.js +0 -55
- package/dist/cron/fanout.js.map +0 -1
- package/dist/cron/jobs.d.ts +0 -18
- package/dist/cron/jobs.js +0 -37
- package/dist/cron/jobs.js.map +0 -1
- package/dist/cron/scheduler.d.ts +0 -45
- package/dist/cron/scheduler.js +0 -105
- package/dist/cron/scheduler.js.map +0 -1
- package/dist/engine/agent-executor.d.ts +0 -34
- package/dist/engine/agent-executor.js +0 -246
- package/dist/engine/agent-executor.js.map +0 -1
- package/dist/engine/chat/chat-runner.d.ts +0 -132
- package/dist/engine/chat/chat-runner.js +0 -424
- package/dist/engine/chat/chat-runner.js.map +0 -1
- package/dist/engine/chat/chat-skills.d.ts +0 -45
- package/dist/engine/chat/chat-skills.js +0 -184
- package/dist/engine/chat/chat-skills.js.map +0 -1
- package/dist/engine/chat/chat.d.ts +0 -54
- package/dist/engine/chat/chat.js +0 -316
- package/dist/engine/chat/chat.js.map +0 -1
- package/dist/engine/chat/message-batcher.d.ts +0 -32
- package/dist/engine/chat/message-batcher.js +0 -109
- package/dist/engine/chat/message-batcher.js.map +0 -1
- package/dist/engine/dispatcher.d.ts +0 -73
- package/dist/engine/dispatcher.js +0 -663
- package/dist/engine/dispatcher.js.map +0 -1
- package/dist/engine/event-shim.d.ts +0 -117
- package/dist/engine/event-shim.js +0 -435
- package/dist/engine/event-shim.js.map +0 -1
- package/dist/engine/executors/orchestrator.d.ts +0 -81
- package/dist/engine/executors/orchestrator.js +0 -365
- package/dist/engine/executors/orchestrator.js.map +0 -1
- package/dist/engine/executors/shared.d.ts +0 -189
- package/dist/engine/executors/shared.js +0 -616
- package/dist/engine/executors/shared.js.map +0 -1
- package/dist/engine/github/git-auth.d.ts +0 -62
- package/dist/engine/github/git-auth.js +0 -161
- package/dist/engine/github/git-auth.js.map +0 -1
- package/dist/engine/github/github-app-client.d.ts +0 -23
- package/dist/engine/github/github-app-client.js +0 -33
- package/dist/engine/github/github-app-client.js.map +0 -1
- package/dist/engine/github/github-tools.d.ts +0 -18
- package/dist/engine/github/github-tools.js +0 -263
- package/dist/engine/github/github-tools.js.map +0 -1
- package/dist/engine/github/github.d.ts +0 -1193
- package/dist/engine/github/github.js +0 -357
- package/dist/engine/github/github.js.map +0 -1
- package/dist/engine/github/profiles.d.ts +0 -279
- package/dist/engine/github/profiles.js +0 -42
- package/dist/engine/github/profiles.js.map +0 -1
- package/dist/engine/github/review-poster.d.ts +0 -98
- package/dist/engine/github/review-poster.js +0 -177
- package/dist/engine/github/review-poster.js.map +0 -1
- package/dist/engine/llm.d.ts +0 -79
- package/dist/engine/llm.js +0 -269
- package/dist/engine/llm.js.map +0 -1
- package/dist/engine/oauth.d.ts +0 -43
- package/dist/engine/oauth.js +0 -103
- package/dist/engine/oauth.js.map +0 -1
- package/dist/engine/router.d.ts +0 -29
- package/dist/engine/router.js +0 -680
- package/dist/engine/router.js.map +0 -1
- package/dist/engine/screen/classifier.d.ts +0 -93
- package/dist/engine/screen/classifier.js +0 -215
- package/dist/engine/screen/classifier.js.map +0 -1
- package/dist/engine/screen/screen.d.ts +0 -41
- package/dist/engine/screen/screen.js +0 -93
- package/dist/engine/screen/screen.js.map +0 -1
- package/dist/evals-api.d.ts +0 -24
- package/dist/evals-api.js +0 -22
- package/dist/evals-api.js.map +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -940
- package/dist/index.js.map +0 -1
- package/dist/managed-repos.d.ts +0 -30
- package/dist/managed-repos.js +0 -72
- package/dist/managed-repos.js.map +0 -1
- package/dist/notify/blocks.d.ts +0 -23
- package/dist/notify/blocks.js +0 -118
- package/dist/notify/blocks.js.map +0 -1
- package/dist/notify/index.d.ts +0 -17
- package/dist/notify/index.js +0 -7
- package/dist/notify/index.js.map +0 -1
- package/dist/notify/model.d.ts +0 -57
- package/dist/notify/model.js +0 -89
- package/dist/notify/model.js.map +0 -1
- package/dist/notify/notifier.d.ts +0 -18
- package/dist/notify/notifier.js +0 -100
- package/dist/notify/notifier.js.map +0 -1
- package/dist/notify/render.d.ts +0 -21
- package/dist/notify/render.js +0 -59
- package/dist/notify/render.js.map +0 -1
- package/dist/notify/transports/github.d.ts +0 -26
- package/dist/notify/transports/github.js +0 -27
- package/dist/notify/transports/github.js.map +0 -1
- package/dist/notify/transports/slack.d.ts +0 -27
- package/dist/notify/transports/slack.js +0 -37
- package/dist/notify/transports/slack.js.map +0 -1
- package/dist/notify/types.d.ts +0 -119
- package/dist/notify/types.js +0 -16
- package/dist/notify/types.js.map +0 -1
- package/dist/providers.d.ts +0 -125
- package/dist/providers.js +0 -279
- package/dist/providers.js.map +0 -1
- package/dist/sandbox/docker.d.ts +0 -180
- package/dist/sandbox/docker.js +0 -517
- package/dist/sandbox/docker.js.map +0 -1
- package/dist/sandbox/egress-allowlist.d.ts +0 -74
- package/dist/sandbox/egress-allowlist.js +0 -164
- package/dist/sandbox/egress-allowlist.js.map +0 -1
- package/dist/sandbox/egress-firewall-config.d.ts +0 -127
- package/dist/sandbox/egress-firewall-config.js +0 -434
- package/dist/sandbox/egress-firewall-config.js.map +0 -1
- package/dist/sandbox/images.d.ts +0 -23
- package/dist/sandbox/images.js +0 -55
- package/dist/sandbox/images.js.map +0 -1
- package/dist/sandbox/index.d.ts +0 -112
- package/dist/sandbox/index.js +0 -332
- package/dist/sandbox/index.js.map +0 -1
- package/dist/sandbox/sandbox.d.ts +0 -214
- package/dist/sandbox/sandbox.js +0 -453
- package/dist/sandbox/sandbox.js.map +0 -1
- package/dist/sandbox/smol.d.ts +0 -162
- package/dist/sandbox/smol.js +0 -485
- package/dist/sandbox/smol.js.map +0 -1
- package/dist/session-log.d.ts +0 -63
- package/dist/session-log.js +0 -290
- package/dist/session-log.js.map +0 -1
- package/dist/state/approval-store.d.ts +0 -88
- package/dist/state/approval-store.js +0 -149
- package/dist/state/approval-store.js.map +0 -1
- package/dist/state/build-assets.d.ts +0 -50
- package/dist/state/build-assets.js +0 -154
- package/dist/state/build-assets.js.map +0 -1
- package/dist/state/db.d.ts +0 -81
- package/dist/state/db.js +0 -155
- package/dist/state/db.js.map +0 -1
- package/dist/state/execution-store.d.ts +0 -257
- package/dist/state/execution-store.js +0 -527
- package/dist/state/execution-store.js.map +0 -1
- package/dist/state/migrate.d.ts +0 -15
- package/dist/state/migrate.js +0 -175
- package/dist/state/migrate.js.map +0 -1
- package/dist/state/workflow-run-store.d.ts +0 -216
- package/dist/state/workflow-run-store.js +0 -403
- package/dist/state/workflow-run-store.js.map +0 -1
- package/dist/telemetry/index.d.ts +0 -38
- package/dist/telemetry/index.js +0 -253
- package/dist/telemetry/index.js.map +0 -1
- package/dist/telemetry/pi-events.d.ts +0 -12
- package/dist/telemetry/pi-events.js +0 -134
- package/dist/telemetry/pi-events.js.map +0 -1
- package/dist/workflows/dag.d.ts +0 -37
- package/dist/workflows/dag.js +0 -118
- package/dist/workflows/dag.js.map +0 -1
- package/dist/workflows/loader.d.ts +0 -53
- package/dist/workflows/loader.js +0 -421
- package/dist/workflows/loader.js.map +0 -1
- package/dist/workflows/loop-eval.d.ts +0 -28
- package/dist/workflows/loop-eval.js +0 -74
- package/dist/workflows/loop-eval.js.map +0 -1
- package/dist/workflows/phase-executor.d.ts +0 -222
- package/dist/workflows/phase-executor.js +0 -1153
- package/dist/workflows/phase-executor.js.map +0 -1
- package/dist/workflows/phase-ref.d.ts +0 -50
- package/dist/workflows/phase-ref.js +0 -91
- package/dist/workflows/phase-ref.js.map +0 -1
- package/dist/workflows/resume.d.ts +0 -58
- package/dist/workflows/resume.js +0 -313
- package/dist/workflows/resume.js.map +0 -1
- package/dist/workflows/runner.d.ts +0 -63
- package/dist/workflows/runner.js +0 -381
- package/dist/workflows/runner.js.map +0 -1
- package/dist/workflows/schema.d.ts +0 -344
- package/dist/workflows/schema.js +0 -460
- package/dist/workflows/schema.js.map +0 -1
- package/dist/workflows/simple.d.ts +0 -90
- package/dist/workflows/simple.js +0 -393
- package/dist/workflows/simple.js.map +0 -1
- package/dist/workflows/target-policy.d.ts +0 -74
- package/dist/workflows/target-policy.js +0 -80
- package/dist/workflows/target-policy.js.map +0 -1
- package/dist/workflows/templates.d.ts +0 -88
- package/dist/workflows/templates.js +0 -127
- package/dist/workflows/templates.js.map +0 -1
- package/dist/workflows/triggers.d.ts +0 -21
- package/dist/workflows/triggers.js +0 -45
- package/dist/workflows/triggers.js.map +0 -1
- package/dist/workflows/verdict.d.ts +0 -19
- package/dist/workflows/verdict.js +0 -30
- package/dist/workflows/verdict.js.map +0 -1
- package/dist/worktree/manager.d.ts +0 -43
- package/dist/worktree/manager.js +0 -127
- package/dist/worktree/manager.js.map +0 -1
- package/docker-compose.yml +0 -274
- package/sandbox.Dockerfile +0 -68
- package/skills/README.md +0 -42
- package/skills/browser-qa/SKILL.md +0 -208
- package/skills/browser-qa/scripts/agent-browser.mjs +0 -531
- package/skills/building/SKILL.md +0 -95
- package/skills/chat/SKILL.md +0 -36
- package/skills/code-review/SKILL.md +0 -82
- package/skills/debug-production/SKILL.md +0 -108
- package/skills/demo/SKILL.md +0 -228
- package/skills/demo/scripts/compose-demo.sh +0 -243
- package/skills/issue-answer/SKILL.md +0 -91
- package/skills/issue-comment/SKILL.md +0 -49
- package/skills/issue-triage/SKILL.md +0 -149
- package/skills/issue-triage/references/AGENT-BRIEF.md +0 -65
- package/skills/pr-comment/SKILL.md +0 -64
- package/skills/pr-review/SKILL.md +0 -148
- package/skills/pr-review/references/findings-schema.md +0 -89
- package/skills/qa-test/SKILL.md +0 -97
- package/skills/repo-health/SKILL.md +0 -67
- package/skills/security-feedback/SKILL.md +0 -173
- package/skills/security-feedback/references/templates.md +0 -77
- package/skills/security-review/SKILL.md +0 -215
- package/skills/security-review/references/issue-format.md +0 -302
- package/skills/verify/SKILL.md +0 -118
- package/workflows/answer.yaml +0 -44
- package/workflows/build.yaml +0 -129
- package/workflows/cron-health.yaml +0 -6
- package/workflows/cron-review.yaml +0 -8
- package/workflows/cron-security.yaml +0 -6
- package/workflows/cron-triage.yaml +0 -8
- package/workflows/demo.yaml +0 -62
- package/workflows/examples/bash-smoke.yaml +0 -41
- package/workflows/examples/parallel-review.yaml +0 -36
- package/workflows/examples/tdd-loop.yaml +0 -17
- package/workflows/explore.yaml +0 -80
- package/workflows/issue-comment.yaml +0 -15
- package/workflows/issue-triage.yaml +0 -22
- package/workflows/pr-comment.yaml +0 -16
- package/workflows/pr-fix.yaml +0 -17
- package/workflows/pr-review.yaml +0 -50
- package/workflows/prompts/answer.md +0 -68
- package/workflows/prompts/architect.md +0 -44
- package/workflows/prompts/classifier.md +0 -60
- package/workflows/prompts/classify-adds-info.md +0 -17
- package/workflows/prompts/demo.md +0 -125
- package/workflows/prompts/executor.md +0 -42
- package/workflows/prompts/explore-ask.md +0 -99
- package/workflows/prompts/explore-publish.md +0 -31
- package/workflows/prompts/explore-read.md +0 -120
- package/workflows/prompts/explore-synthesize.md +0 -88
- package/workflows/prompts/fix.md +0 -18
- package/workflows/prompts/guardrails.md +0 -96
- package/workflows/prompts/pr-fix.md +0 -26
- package/workflows/prompts/pr.md +0 -39
- package/workflows/prompts/qa-browser.md +0 -95
- package/workflows/prompts/qa-synth.md +0 -44
- package/workflows/prompts/qa-test.md +0 -60
- package/workflows/prompts/re-reviewer.md +0 -33
- package/workflows/prompts/reviewer.md +0 -60
- package/workflows/prompts/verify-browser.md +0 -93
- package/workflows/prompts/verify-synth.md +0 -44
- package/workflows/prompts/verify.md +0 -63
- package/workflows/qa-test.yaml +0 -94
- package/workflows/repo-health.yaml +0 -15
- package/workflows/security-feedback.yaml +0 -25
- package/workflows/security-review.yaml +0 -37
- package/workflows/verify.yaml +0 -93
- /package/dist/{cli/cli-config.d.ts → cli-config.d.ts} +0 -0
- /package/dist/{cli/cli-config.js → cli-config.js} +0 -0
- /package/dist/{cli/cli-format.d.ts → cli-format.d.ts} +0 -0
- /package/dist/{cli/cli-format.js → cli-format.js} +0 -0
- /package/dist/{cli/cli-timeline.d.ts → cli-timeline.d.ts} +0 -0
- /package/dist/{cli/cli-timeline.js → cli-timeline.js} +0 -0
- /package/dist/{cli/cli.d.ts → cli.d.ts} +0 -0
- /package/dist/{cli/oauth-cli.d.ts → oauth-cli.d.ts} +0 -0
- /package/dist/{cli/setup.d.ts → setup.d.ts} +0 -0
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
export type GitHubPermissionLevel = "read" | "write";
|
|
2
|
-
/**
|
|
3
|
-
* Subset of GitHub App installation-token permissions supported by Last Light.
|
|
4
|
-
* Any omitted permission inherits the app's installation defaults.
|
|
5
|
-
*/
|
|
6
|
-
export type GitHubTokenPermissions = Partial<{
|
|
7
|
-
contents: GitHubPermissionLevel;
|
|
8
|
-
issues: GitHubPermissionLevel;
|
|
9
|
-
pull_requests: GitHubPermissionLevel;
|
|
10
|
-
metadata: GitHubPermissionLevel;
|
|
11
|
-
}>;
|
|
12
|
-
/**
|
|
13
|
-
* Mint a GitHub App installation token; OPTIONALLY also write the bot
|
|
14
|
-
* identity + credential helper to the user's global git config.
|
|
15
|
-
*
|
|
16
|
-
* The default is to leave `~/.gitconfig` alone — every agent run happens
|
|
17
|
-
* inside a Docker sandbox where `sandbox-entrypoint.sh` configures git at
|
|
18
|
-
* the container's `--system` scope using the `GIT_TOKEN` env var the
|
|
19
|
-
* harness forwards. The harness process itself does not need git
|
|
20
|
-
* credentials for normal operation.
|
|
21
|
-
*
|
|
22
|
-
* Set `LASTLIGHT_WRITE_GLOBAL_GIT=1` only if you have a non-sandboxed
|
|
23
|
-
* code path that needs the harness user to be able to push as the bot.
|
|
24
|
-
*/
|
|
25
|
-
export declare function configureGitAuth(config: {
|
|
26
|
-
appId: string;
|
|
27
|
-
privateKeyPath: string;
|
|
28
|
-
installationId: string;
|
|
29
|
-
/** Resolved bot login incl. the `[bot]` suffix (e.g. `last-light[bot]`). */
|
|
30
|
-
botLogin?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Optional repository-name allowlist for the minted installation token.
|
|
33
|
-
* Names are repo names within the installation owner (e.g. ["lastlight"]).
|
|
34
|
-
*/
|
|
35
|
-
repositories?: string[];
|
|
36
|
-
/** Optional per-token permission downscoping. */
|
|
37
|
-
permissions?: GitHubTokenPermissions;
|
|
38
|
-
}): Promise<{
|
|
39
|
-
token: string;
|
|
40
|
-
expiresAt: string;
|
|
41
|
-
}>;
|
|
42
|
-
/**
|
|
43
|
-
* Mint a fresh installation token. Same opt-in rule as configureGitAuth:
|
|
44
|
-
* `LASTLIGHT_WRITE_GLOBAL_GIT=1` is required before this rotates the
|
|
45
|
-
* credential helper in the user's `~/.gitconfig`. Otherwise the token is
|
|
46
|
-
* just returned (executor.ts forwards it to the sandbox via env).
|
|
47
|
-
*/
|
|
48
|
-
export declare function refreshGitAuth(config: {
|
|
49
|
-
appId: string;
|
|
50
|
-
privateKeyPath: string;
|
|
51
|
-
installationId: string;
|
|
52
|
-
/**
|
|
53
|
-
* Optional repository-name allowlist for the minted installation token.
|
|
54
|
-
* Names are repo names within the installation owner (e.g. ["lastlight"]).
|
|
55
|
-
*/
|
|
56
|
-
repositories?: string[];
|
|
57
|
-
/** Optional per-token permission downscoping. */
|
|
58
|
-
permissions?: GitHubTokenPermissions;
|
|
59
|
-
}): Promise<{
|
|
60
|
-
token: string;
|
|
61
|
-
expiresAt: string;
|
|
62
|
-
}>;
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { execFileSync } from "child_process";
|
|
2
|
-
import { createSign } from "crypto";
|
|
3
|
-
import { mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
4
|
-
import { homedir } from "os";
|
|
5
|
-
import { dirname, join, resolve } from "path";
|
|
6
|
-
/**
|
|
7
|
-
* Whether to write the bot identity + credential helper to the user's
|
|
8
|
-
* GLOBAL git config (`~/.gitconfig`). Defaults to **false** — the harness
|
|
9
|
-
* still mints installation tokens and forwards them to sandboxes via the
|
|
10
|
-
* `GIT_TOKEN` env var, where `sandbox-entrypoint.sh` configures git at the
|
|
11
|
-
* container's `--system` scope. The host's `~/.gitconfig` is left
|
|
12
|
-
* untouched.
|
|
13
|
-
*
|
|
14
|
-
* Set `LASTLIGHT_WRITE_GLOBAL_GIT=1` only when the harness itself runs git
|
|
15
|
-
* commands against your real filesystem (e.g. a non-sandboxed direct
|
|
16
|
-
* execution path). Production Docker doesn't need this — the entrypoint
|
|
17
|
-
* sets `--system` config inside the container.
|
|
18
|
-
*
|
|
19
|
-
* `LASTLIGHT_LOCAL_DEV=1` is accepted as a compat alias for the inverse
|
|
20
|
-
* (legacy meaning: "skip global writes") and silently ignored; that is
|
|
21
|
-
* now the default. The flag is harmless if left in place but the
|
|
22
|
-
* intentional opt-in is `LASTLIGHT_WRITE_GLOBAL_GIT=1`.
|
|
23
|
-
*/
|
|
24
|
-
function shouldWriteGlobalGitConfig() {
|
|
25
|
-
return process.env.LASTLIGHT_WRITE_GLOBAL_GIT === "1";
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Conservative shape check on a GitHub installation token. The credentials
|
|
29
|
-
* file we write contains a single URL of the form
|
|
30
|
-
* `https://x-access-token:${token}@github.com` — any `@`, `:`, `/`, or
|
|
31
|
-
* newline in the token would break URL parsing or inject extra entries.
|
|
32
|
-
* Real GitHub tokens are alphanumeric (plus `_`); this assertion catches
|
|
33
|
-
* any future format change before we write a malformed credentials file.
|
|
34
|
-
*/
|
|
35
|
-
function assertSafeToken(token) {
|
|
36
|
-
if (!/^[A-Za-z0-9_-]+$/.test(token)) {
|
|
37
|
-
throw new Error("Refusing to embed a token containing characters outside [A-Za-z0-9_-] into git credentials file");
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Resolve the path of the shared credentials file used by `credential.helper
|
|
42
|
-
* store`. Honors `LASTLIGHT_GIT_CREDENTIALS` so the sandbox entrypoint and
|
|
43
|
-
* the MCP server can agree on a path; falls back to `~/.config/lastlight/
|
|
44
|
-
* git-credentials` for the opt-in host write.
|
|
45
|
-
*
|
|
46
|
-
* Whitespace in the path would break git's helper-arg splitting (the
|
|
47
|
-
* `store --file=<path>` value is shell-split on spaces, not exec'd), so
|
|
48
|
-
* reject any whitespace defensively.
|
|
49
|
-
*/
|
|
50
|
-
function credentialsFilePath() {
|
|
51
|
-
const fromEnv = process.env.LASTLIGHT_GIT_CREDENTIALS?.trim();
|
|
52
|
-
const path = fromEnv || join(homedir(), ".config", "lastlight", "git-credentials");
|
|
53
|
-
if (/\s/.test(path)) {
|
|
54
|
-
throw new Error(`LASTLIGHT_GIT_CREDENTIALS contains whitespace; git's helper-arg parsing would break: ${path}`);
|
|
55
|
-
}
|
|
56
|
-
return path;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Write the credentials file consumed by `credential.helper store`. One
|
|
60
|
-
* line: `https://x-access-token:${token}@github.com`. File is mode 600,
|
|
61
|
-
* parent dir mode 700. Returns the absolute path.
|
|
62
|
-
*/
|
|
63
|
-
function writeCredentialsFile(token) {
|
|
64
|
-
assertSafeToken(token);
|
|
65
|
-
const credPath = credentialsFilePath();
|
|
66
|
-
mkdirSync(dirname(credPath), { recursive: true, mode: 0o700 });
|
|
67
|
-
writeFileSync(credPath, `https://x-access-token:${token}@github.com\n`, { mode: 0o600 });
|
|
68
|
-
return credPath;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Mint a GitHub App installation token; OPTIONALLY also write the bot
|
|
72
|
-
* identity + credential helper to the user's global git config.
|
|
73
|
-
*
|
|
74
|
-
* The default is to leave `~/.gitconfig` alone — every agent run happens
|
|
75
|
-
* inside a Docker sandbox where `sandbox-entrypoint.sh` configures git at
|
|
76
|
-
* the container's `--system` scope using the `GIT_TOKEN` env var the
|
|
77
|
-
* harness forwards. The harness process itself does not need git
|
|
78
|
-
* credentials for normal operation.
|
|
79
|
-
*
|
|
80
|
-
* Set `LASTLIGHT_WRITE_GLOBAL_GIT=1` only if you have a non-sandboxed
|
|
81
|
-
* code path that needs the harness user to be able to push as the bot.
|
|
82
|
-
*/
|
|
83
|
-
export async function configureGitAuth(config) {
|
|
84
|
-
const token = await getInstallationToken(config);
|
|
85
|
-
if (!shouldWriteGlobalGitConfig()) {
|
|
86
|
-
console.log(`[git-auth] Minted GitHub App token (expires: ${token.expiresAt}). ` +
|
|
87
|
-
`Global git config left untouched; sandboxes receive the token via GIT_TOKEN. ` +
|
|
88
|
-
`Set LASTLIGHT_WRITE_GLOBAL_GIT=1 to also write ~/.gitconfig.`);
|
|
89
|
-
return token;
|
|
90
|
-
}
|
|
91
|
-
// Opt-in path: write the token to a 600-mode credentials file and point
|
|
92
|
-
// git's built-in `store` helper at it. No shell interpolation anywhere
|
|
93
|
-
// along the way — git invokes `credential-store --file=<path>` as
|
|
94
|
-
// argv-array, not through a shell.
|
|
95
|
-
const credPath = writeCredentialsFile(token.token);
|
|
96
|
-
execGit(["config", "--global", "credential.helper", `store --file=${credPath}`]);
|
|
97
|
-
const botLogin = config.botLogin || "last-light[bot]";
|
|
98
|
-
execGit(["config", "--global", "user.name", botLogin]);
|
|
99
|
-
execGit(["config", "--global", "user.email", `${botLogin}@users.noreply.github.com`]);
|
|
100
|
-
console.log(`[git-auth] Configured GLOBAL git with GitHub App token (file: ${credPath}, expires: ${token.expiresAt})`);
|
|
101
|
-
return token;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Mint a fresh installation token. Same opt-in rule as configureGitAuth:
|
|
105
|
-
* `LASTLIGHT_WRITE_GLOBAL_GIT=1` is required before this rotates the
|
|
106
|
-
* credential helper in the user's `~/.gitconfig`. Otherwise the token is
|
|
107
|
-
* just returned (executor.ts forwards it to the sandbox via env).
|
|
108
|
-
*/
|
|
109
|
-
export async function refreshGitAuth(config) {
|
|
110
|
-
const token = await getInstallationToken(config);
|
|
111
|
-
if (!shouldWriteGlobalGitConfig()) {
|
|
112
|
-
return token;
|
|
113
|
-
}
|
|
114
|
-
const credPath = writeCredentialsFile(token.token);
|
|
115
|
-
// The credential.helper config already points at this path from the
|
|
116
|
-
// initial configureGitAuth call, but set it again so refreshGitAuth is
|
|
117
|
-
// safe to call standalone (idempotent).
|
|
118
|
-
execGit(["config", "--global", "credential.helper", `store --file=${credPath}`]);
|
|
119
|
-
console.log(`[git-auth] Refreshed token in GLOBAL git config (file: ${credPath}, expires: ${token.expiresAt})`);
|
|
120
|
-
return token;
|
|
121
|
-
}
|
|
122
|
-
// ── Internal ────────────────────────────────────────────────────────
|
|
123
|
-
async function getInstallationToken(config) {
|
|
124
|
-
const privateKey = readFileSync(resolve(config.privateKeyPath), "utf-8");
|
|
125
|
-
// Generate JWT (RS256, no external dependency)
|
|
126
|
-
const now = Math.floor(Date.now() / 1000);
|
|
127
|
-
const header = Buffer.from(JSON.stringify({ alg: "RS256", typ: "JWT" })).toString("base64url");
|
|
128
|
-
const payload = Buffer.from(JSON.stringify({ iat: now - 60, exp: now + 600, iss: config.appId })).toString("base64url");
|
|
129
|
-
const signer = createSign("RSA-SHA256");
|
|
130
|
-
signer.update(`${header}.${payload}`);
|
|
131
|
-
const signature = signer.sign(privateKey, "base64url");
|
|
132
|
-
const jwtToken = `${header}.${payload}.${signature}`;
|
|
133
|
-
// Exchange for installation token
|
|
134
|
-
const requestBody = {};
|
|
135
|
-
if (config.repositories && config.repositories.length > 0) {
|
|
136
|
-
requestBody.repositories = config.repositories;
|
|
137
|
-
}
|
|
138
|
-
if (config.permissions && Object.keys(config.permissions).length > 0) {
|
|
139
|
-
requestBody.permissions = config.permissions;
|
|
140
|
-
}
|
|
141
|
-
const hasRequestBody = Object.keys(requestBody).length > 0;
|
|
142
|
-
const res = await fetch(`https://api.github.com/app/installations/${config.installationId}/access_tokens`, {
|
|
143
|
-
method: "POST",
|
|
144
|
-
headers: {
|
|
145
|
-
Authorization: `Bearer ${jwtToken}`,
|
|
146
|
-
Accept: "application/vnd.github+json",
|
|
147
|
-
...(hasRequestBody ? { "Content-Type": "application/json" } : {}),
|
|
148
|
-
},
|
|
149
|
-
body: hasRequestBody ? JSON.stringify(requestBody) : undefined,
|
|
150
|
-
});
|
|
151
|
-
if (!res.ok) {
|
|
152
|
-
const body = await res.text();
|
|
153
|
-
throw new Error(`GitHub App token request failed (${res.status}): ${body}`);
|
|
154
|
-
}
|
|
155
|
-
const data = await res.json();
|
|
156
|
-
return { token: data.token, expiresAt: data.expires_at };
|
|
157
|
-
}
|
|
158
|
-
function execGit(args) {
|
|
159
|
-
execFileSync("git", args, { stdio: "pipe" });
|
|
160
|
-
}
|
|
161
|
-
//# sourceMappingURL=git-auth.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"git-auth.js","sourceRoot":"","sources":["../../../src/engine/github/git-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAA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AAK,EAAE,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;AAC3D,CAAC;AAED,SAAS,OAAO,CAAC,IAAc;IAC7B,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Octokit } from "octokit";
|
|
2
|
-
export interface GitHubAppClientConfig {
|
|
3
|
-
appId: string;
|
|
4
|
-
privateKeyPath: string;
|
|
5
|
-
installationId: string;
|
|
6
|
-
/**
|
|
7
|
-
* Override the GitHub REST base URL (Octokit `baseUrl`). Prod leaves this
|
|
8
|
-
* unset → `api.github.com`. The evals harness points it at its mock server so
|
|
9
|
-
* harness-side writes land there. Test/eval escape hatch only — mirrors
|
|
10
|
-
* `ExecutorConfig.githubApiBaseUrl`.
|
|
11
|
-
*/
|
|
12
|
-
baseUrl?: string;
|
|
13
|
-
}
|
|
14
|
-
export declare function githubAppClient(config: GitHubAppClientConfig): Octokit;
|
|
15
|
-
/**
|
|
16
|
-
* Octokit authed with a raw bearer token (a pre-minted installation token) plus
|
|
17
|
-
* an optional `baseUrl`. This is the auth shape the evals mock and the
|
|
18
|
-
* harness-minted scoped token both use — no App JWT / installation-token
|
|
19
|
-
* minting round-trip against the REST base URL. Used by the harness-side
|
|
20
|
-
* `post-review` action so it works identically against api.github.com and the
|
|
21
|
-
* eval mock.
|
|
22
|
-
*/
|
|
23
|
-
export declare function githubTokenClient(token: string, baseUrl?: string): Octokit;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { createAppAuth } from "@octokit/auth-app";
|
|
2
|
-
import { readFileSync } from "fs";
|
|
3
|
-
import { Octokit } from "octokit";
|
|
4
|
-
import { resolve } from "path";
|
|
5
|
-
function normalizeBaseUrl(baseUrl) {
|
|
6
|
-
return baseUrl ? baseUrl.replace(/\/+$/, "") : undefined;
|
|
7
|
-
}
|
|
8
|
-
export function githubAppClient(config) {
|
|
9
|
-
const privateKey = readFileSync(resolve(config.privateKeyPath), "utf-8");
|
|
10
|
-
const baseUrl = normalizeBaseUrl(config.baseUrl);
|
|
11
|
-
return new Octokit({
|
|
12
|
-
authStrategy: createAppAuth,
|
|
13
|
-
auth: {
|
|
14
|
-
appId: config.appId,
|
|
15
|
-
privateKey,
|
|
16
|
-
installationId: config.installationId,
|
|
17
|
-
},
|
|
18
|
-
...(baseUrl ? { baseUrl } : {}),
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Octokit authed with a raw bearer token (a pre-minted installation token) plus
|
|
23
|
-
* an optional `baseUrl`. This is the auth shape the evals mock and the
|
|
24
|
-
* harness-minted scoped token both use — no App JWT / installation-token
|
|
25
|
-
* minting round-trip against the REST base URL. Used by the harness-side
|
|
26
|
-
* `post-review` action so it works identically against api.github.com and the
|
|
27
|
-
* eval mock.
|
|
28
|
-
*/
|
|
29
|
-
export function githubTokenClient(token, baseUrl) {
|
|
30
|
-
const url = normalizeBaseUrl(baseUrl);
|
|
31
|
-
return new Octokit({ auth: token, ...(url ? { baseUrl: url } : {}) });
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=github-app-client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"github-app-client.js","sourceRoot":"","sources":["../../../src/engine/github/github-app-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAe/B,SAAS,gBAAgB,CAAC,OAA2B;IACnD,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAA6B;IAC3D,MAAM,UAAU,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC;IACzE,MAAM,OAAO,GAAG,gBAAgB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACjD,OAAO,IAAI,OAAO,CAAC;QACjB,YAAY,EAAE,aAAa;QAC3B,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,UAAU;YACV,cAAc,EAAE,MAAM,CAAC,cAAc;SACtC;QACD,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAa,EAAE,OAAgB;IAC/D,MAAM,GAAG,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACtC,OAAO,IAAI,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Tool, ToolCall } from "@earendil-works/pi-ai";
|
|
2
|
-
import { type GitHubAppClientConfig } from "./github-app-client.js";
|
|
3
|
-
/**
|
|
4
|
-
* Auth for the read-only chat GitHub tools. Either a GitHub App config or a
|
|
5
|
-
* raw Personal Access Token (the PAT fallback). Both resolve to an Octokit.
|
|
6
|
-
*/
|
|
7
|
-
export type ChatGitHubAuth = GitHubAppClientConfig | {
|
|
8
|
-
token: string;
|
|
9
|
-
baseUrl?: string;
|
|
10
|
-
};
|
|
11
|
-
export interface ChatGitHubToolset {
|
|
12
|
-
tools: Tool[];
|
|
13
|
-
execute(call: ToolCall): Promise<{
|
|
14
|
-
content: string;
|
|
15
|
-
isError: boolean;
|
|
16
|
-
}>;
|
|
17
|
-
}
|
|
18
|
-
export declare function buildChatGitHubTools(auth: ChatGitHubAuth): ChatGitHubToolset;
|
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Read-only GitHub tools registered with pi-ai for the in-process Slack
|
|
3
|
-
* chat path. Severely scoped: the chat agent can look up issues / PRs /
|
|
4
|
-
* comments / repo files / commits / search, and nothing else. There are
|
|
5
|
-
* no write operations on this surface — issue creation, labels, branches,
|
|
6
|
-
* commits, merges all live in the workflow path under sandbox isolation.
|
|
7
|
-
*
|
|
8
|
-
* Returned value is a `{ tools, execute }` pair. `tools` plugs into
|
|
9
|
-
* pi-ai's `Context.tools`; `execute(toolCall)` is what the chat-runner
|
|
10
|
-
* loop calls when the model emits a tool_call.
|
|
11
|
-
*/
|
|
12
|
-
import { Type } from "@sinclair/typebox";
|
|
13
|
-
import { githubAppClient, githubTokenClient } from "./github-app-client.js";
|
|
14
|
-
function tool(name, description, parameters, handler) {
|
|
15
|
-
return {
|
|
16
|
-
name,
|
|
17
|
-
description,
|
|
18
|
-
parameters,
|
|
19
|
-
handler: handler,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export function buildChatGitHubTools(auth) {
|
|
23
|
-
const octokit = "token" in auth
|
|
24
|
-
? githubTokenClient(auth.token, auth.baseUrl)
|
|
25
|
-
: githubAppClient(auth);
|
|
26
|
-
const entries = [
|
|
27
|
-
tool("github_get_repository", "Get a repository's metadata (default branch, description, topics).", Type.Object({
|
|
28
|
-
owner: Type.String(),
|
|
29
|
-
repo: Type.String(),
|
|
30
|
-
}), async ({ owner, repo }) => {
|
|
31
|
-
const { data } = await octokit.rest.repos.get({ owner, repo });
|
|
32
|
-
return {
|
|
33
|
-
full_name: data.full_name,
|
|
34
|
-
default_branch: data.default_branch,
|
|
35
|
-
description: data.description,
|
|
36
|
-
topics: data.topics ?? [],
|
|
37
|
-
private: data.private,
|
|
38
|
-
open_issues_count: data.open_issues_count,
|
|
39
|
-
};
|
|
40
|
-
}),
|
|
41
|
-
tool("github_get_issue", "Get a single issue by number.", Type.Object({
|
|
42
|
-
owner: Type.String(),
|
|
43
|
-
repo: Type.String(),
|
|
44
|
-
issue_number: Type.Number(),
|
|
45
|
-
}), async ({ owner, repo, issue_number }) => {
|
|
46
|
-
const { data } = await octokit.rest.issues.get({ owner, repo, issue_number });
|
|
47
|
-
return {
|
|
48
|
-
number: data.number,
|
|
49
|
-
title: data.title,
|
|
50
|
-
state: data.state,
|
|
51
|
-
body: data.body,
|
|
52
|
-
labels: (data.labels || []).map((l) => (typeof l === "string" ? l : l.name)),
|
|
53
|
-
html_url: data.html_url,
|
|
54
|
-
author: data.user?.login,
|
|
55
|
-
created_at: data.created_at,
|
|
56
|
-
updated_at: data.updated_at,
|
|
57
|
-
};
|
|
58
|
-
}),
|
|
59
|
-
tool("github_list_issue_comments", "List comments on an issue or PR.", Type.Object({
|
|
60
|
-
owner: Type.String(),
|
|
61
|
-
repo: Type.String(),
|
|
62
|
-
issue_number: Type.Number(),
|
|
63
|
-
per_page: Type.Optional(Type.Number()),
|
|
64
|
-
}), async ({ owner, repo, issue_number, per_page }) => {
|
|
65
|
-
const { data } = await octokit.rest.issues.listComments({
|
|
66
|
-
owner,
|
|
67
|
-
repo,
|
|
68
|
-
issue_number,
|
|
69
|
-
per_page: per_page ?? 30,
|
|
70
|
-
});
|
|
71
|
-
return data.map((c) => ({
|
|
72
|
-
id: c.id,
|
|
73
|
-
author: c.user?.login,
|
|
74
|
-
body: c.body,
|
|
75
|
-
created_at: c.created_at,
|
|
76
|
-
}));
|
|
77
|
-
}),
|
|
78
|
-
tool("github_list_issues", "List issues on a repository.", Type.Object({
|
|
79
|
-
owner: Type.String(),
|
|
80
|
-
repo: Type.String(),
|
|
81
|
-
state: Type.Optional(Type.Union([Type.Literal("open"), Type.Literal("closed"), Type.Literal("all")])),
|
|
82
|
-
labels: Type.Optional(Type.String({ description: "Comma-separated label names." })),
|
|
83
|
-
per_page: Type.Optional(Type.Number()),
|
|
84
|
-
}), async ({ owner, repo, state, labels, per_page }) => {
|
|
85
|
-
const { data } = await octokit.rest.issues.listForRepo({
|
|
86
|
-
owner,
|
|
87
|
-
repo,
|
|
88
|
-
state: state ?? "open",
|
|
89
|
-
labels,
|
|
90
|
-
per_page: per_page ?? 30,
|
|
91
|
-
});
|
|
92
|
-
return data
|
|
93
|
-
.filter((i) => !i.pull_request)
|
|
94
|
-
.map((i) => ({
|
|
95
|
-
number: i.number,
|
|
96
|
-
title: i.title,
|
|
97
|
-
state: i.state,
|
|
98
|
-
labels: (i.labels || []).map((l) => (typeof l === "string" ? l : l.name)),
|
|
99
|
-
author: i.user?.login,
|
|
100
|
-
updated_at: i.updated_at,
|
|
101
|
-
}));
|
|
102
|
-
}),
|
|
103
|
-
tool("github_get_pull_request", "Get a single pull request by number.", Type.Object({
|
|
104
|
-
owner: Type.String(),
|
|
105
|
-
repo: Type.String(),
|
|
106
|
-
pull_number: Type.Number(),
|
|
107
|
-
}), async ({ owner, repo, pull_number }) => {
|
|
108
|
-
const { data } = await octokit.rest.pulls.get({ owner, repo, pull_number });
|
|
109
|
-
return {
|
|
110
|
-
number: data.number,
|
|
111
|
-
title: data.title,
|
|
112
|
-
state: data.state,
|
|
113
|
-
body: data.body,
|
|
114
|
-
head: data.head.ref,
|
|
115
|
-
base: data.base.ref,
|
|
116
|
-
mergeable: data.mergeable,
|
|
117
|
-
draft: data.draft,
|
|
118
|
-
html_url: data.html_url,
|
|
119
|
-
author: data.user?.login,
|
|
120
|
-
};
|
|
121
|
-
}),
|
|
122
|
-
tool("github_get_pull_request_diff", "Get the unified diff of a pull request.", Type.Object({
|
|
123
|
-
owner: Type.String(),
|
|
124
|
-
repo: Type.String(),
|
|
125
|
-
pull_number: Type.Number(),
|
|
126
|
-
}), async ({ owner, repo, pull_number }) => {
|
|
127
|
-
const { data } = await octokit.rest.pulls.get({
|
|
128
|
-
owner,
|
|
129
|
-
repo,
|
|
130
|
-
pull_number,
|
|
131
|
-
mediaType: { format: "diff" },
|
|
132
|
-
});
|
|
133
|
-
return { diff: data };
|
|
134
|
-
}),
|
|
135
|
-
tool("github_list_pull_requests", "List pull requests on a repository.", Type.Object({
|
|
136
|
-
owner: Type.String(),
|
|
137
|
-
repo: Type.String(),
|
|
138
|
-
state: Type.Optional(Type.Union([Type.Literal("open"), Type.Literal("closed"), Type.Literal("all")])),
|
|
139
|
-
per_page: Type.Optional(Type.Number()),
|
|
140
|
-
}), async ({ owner, repo, state, per_page }) => {
|
|
141
|
-
const { data } = await octokit.rest.pulls.list({
|
|
142
|
-
owner,
|
|
143
|
-
repo,
|
|
144
|
-
state: state ?? "open",
|
|
145
|
-
per_page: per_page ?? 30,
|
|
146
|
-
});
|
|
147
|
-
return data.map((p) => ({
|
|
148
|
-
number: p.number,
|
|
149
|
-
title: p.title,
|
|
150
|
-
state: p.state,
|
|
151
|
-
draft: p.draft,
|
|
152
|
-
head: p.head.ref,
|
|
153
|
-
base: p.base.ref,
|
|
154
|
-
author: p.user?.login,
|
|
155
|
-
updated_at: p.updated_at,
|
|
156
|
-
}));
|
|
157
|
-
}),
|
|
158
|
-
tool("github_get_file_contents", "Read a file from a repository at the given ref (default: default branch).", Type.Object({
|
|
159
|
-
owner: Type.String(),
|
|
160
|
-
repo: Type.String(),
|
|
161
|
-
path: Type.String(),
|
|
162
|
-
ref: Type.Optional(Type.String()),
|
|
163
|
-
}), async ({ owner, repo, path, ref }) => {
|
|
164
|
-
const { data } = await octokit.rest.repos.getContent({ owner, repo, path, ref });
|
|
165
|
-
if (Array.isArray(data)) {
|
|
166
|
-
return data.map((d) => ({ name: d.name, type: d.type, size: d.size, path: d.path }));
|
|
167
|
-
}
|
|
168
|
-
if ("content" in data && data.content) {
|
|
169
|
-
const text = Buffer.from(data.content, "base64").toString("utf-8");
|
|
170
|
-
return { path: data.path, size: data.size, encoding: "utf-8", content: text };
|
|
171
|
-
}
|
|
172
|
-
return data;
|
|
173
|
-
}),
|
|
174
|
-
tool("github_list_commits", "List commits on a repository (optionally limited to a branch or path).", Type.Object({
|
|
175
|
-
owner: Type.String(),
|
|
176
|
-
repo: Type.String(),
|
|
177
|
-
sha: Type.Optional(Type.String({ description: "Branch / commit SHA to start from." })),
|
|
178
|
-
path: Type.Optional(Type.String()),
|
|
179
|
-
per_page: Type.Optional(Type.Number()),
|
|
180
|
-
}), async ({ owner, repo, sha, path, per_page }) => {
|
|
181
|
-
const { data } = await octokit.rest.repos.listCommits({
|
|
182
|
-
owner,
|
|
183
|
-
repo,
|
|
184
|
-
sha,
|
|
185
|
-
path,
|
|
186
|
-
per_page: per_page ?? 20,
|
|
187
|
-
});
|
|
188
|
-
return data.map((c) => ({
|
|
189
|
-
sha: c.sha,
|
|
190
|
-
message: c.commit.message,
|
|
191
|
-
author: c.commit.author?.name,
|
|
192
|
-
date: c.commit.author?.date,
|
|
193
|
-
html_url: c.html_url,
|
|
194
|
-
}));
|
|
195
|
-
}),
|
|
196
|
-
tool("github_search_issues", "Search across issues and pull requests with GitHub's search syntax.", Type.Object({
|
|
197
|
-
q: Type.String({ description: "Search query, e.g. 'repo:owner/name is:open label:bug'." }),
|
|
198
|
-
per_page: Type.Optional(Type.Number()),
|
|
199
|
-
}), async ({ q, per_page }) => {
|
|
200
|
-
const { data } = await octokit.rest.search.issuesAndPullRequests({
|
|
201
|
-
q,
|
|
202
|
-
per_page: per_page ?? 20,
|
|
203
|
-
});
|
|
204
|
-
return {
|
|
205
|
-
total_count: data.total_count,
|
|
206
|
-
items: data.items.map((i) => ({
|
|
207
|
-
number: i.number,
|
|
208
|
-
title: i.title,
|
|
209
|
-
state: i.state,
|
|
210
|
-
html_url: i.html_url,
|
|
211
|
-
repository_url: i.repository_url,
|
|
212
|
-
})),
|
|
213
|
-
};
|
|
214
|
-
}),
|
|
215
|
-
tool("github_search_code", "Search code using GitHub's code search.", Type.Object({
|
|
216
|
-
q: Type.String({ description: "Code search query, e.g. 'memorystore in:file repo:owner/name'." }),
|
|
217
|
-
per_page: Type.Optional(Type.Number()),
|
|
218
|
-
}), async ({ q, per_page }) => {
|
|
219
|
-
const { data } = await octokit.rest.search.code({ q, per_page: per_page ?? 20 });
|
|
220
|
-
return {
|
|
221
|
-
total_count: data.total_count,
|
|
222
|
-
items: data.items.map((i) => ({
|
|
223
|
-
path: i.path,
|
|
224
|
-
repository: i.repository.full_name,
|
|
225
|
-
html_url: i.html_url,
|
|
226
|
-
})),
|
|
227
|
-
};
|
|
228
|
-
}),
|
|
229
|
-
];
|
|
230
|
-
const byName = new Map(entries.map((e) => [e.name, e]));
|
|
231
|
-
const tools = entries.map((e) => ({
|
|
232
|
-
name: e.name,
|
|
233
|
-
description: e.description,
|
|
234
|
-
parameters: e.parameters,
|
|
235
|
-
}));
|
|
236
|
-
return {
|
|
237
|
-
tools,
|
|
238
|
-
async execute(call) {
|
|
239
|
-
const entry = byName.get(call.name);
|
|
240
|
-
if (!entry) {
|
|
241
|
-
return {
|
|
242
|
-
content: JSON.stringify({ error: `unknown tool: ${call.name}` }),
|
|
243
|
-
isError: true,
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
try {
|
|
247
|
-
const result = await entry.handler(call.arguments);
|
|
248
|
-
return { content: JSON.stringify(result, null, 2), isError: false };
|
|
249
|
-
}
|
|
250
|
-
catch (err) {
|
|
251
|
-
const e = err;
|
|
252
|
-
return {
|
|
253
|
-
content: JSON.stringify({
|
|
254
|
-
error: e.message ?? String(err),
|
|
255
|
-
status: e.status,
|
|
256
|
-
}),
|
|
257
|
-
isError: true,
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
},
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
//# sourceMappingURL=github-tools.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"github-tools.js","sourceRoot":"","sources":["../../../src/engine/github/github-tools.ts"],"names":[],"mappings":"AAA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