lastlight 0.1.15 → 0.2.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 +265 -118
- package/agent-context/rules.md +62 -9
- package/agent-context/security.md +69 -0
- package/config/default.yaml +89 -0
- package/deploy/.env.production.example +20 -2
- package/deploy/entrypoint.sh +16 -17
- package/deploy/native/README.md +160 -0
- package/deploy/native/install.sh +110 -0
- package/deploy/native/lastlight.env.example +95 -0
- package/deploy/native/lastlight.service +50 -0
- package/deploy/sandbox-entrypoint.sh +59 -42
- package/dist/admin/auth.d.ts +1 -1
- package/dist/admin/auth.js +3 -1
- package/dist/admin/auth.js.map +1 -1
- package/dist/admin/chat-session-reader.d.ts +11 -14
- package/dist/admin/chat-session-reader.js +27 -51
- package/dist/admin/chat-session-reader.js.map +1 -1
- package/dist/admin/docker.d.ts +37 -0
- package/dist/admin/docker.js +86 -1
- package/dist/admin/docker.js.map +1 -1
- package/dist/admin/index.js +38 -3
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/log-search.test.d.ts +1 -0
- package/dist/admin/log-search.test.js +78 -0
- package/dist/admin/log-search.test.js.map +1 -0
- package/dist/admin/routes.d.ts +52 -3
- package/dist/admin/routes.js +780 -63
- package/dist/admin/routes.js.map +1 -1
- package/dist/admin/routes.test.js +680 -14
- package/dist/admin/routes.test.js.map +1 -1
- package/dist/admin/server-logs.test.d.ts +1 -0
- package/dist/admin/server-logs.test.js +58 -0
- package/dist/admin/server-logs.test.js.map +1 -0
- package/dist/admin/sessions.d.ts +26 -39
- package/dist/admin/sessions.js +86 -310
- package/dist/admin/sessions.js.map +1 -1
- package/dist/admin/sessions.test.d.ts +1 -0
- package/dist/admin/sessions.test.js +78 -0
- package/dist/admin/sessions.test.js.map +1 -0
- package/dist/admin/version.d.ts +15 -0
- package/dist/admin/version.js +73 -0
- package/dist/admin/version.js.map +1 -0
- package/dist/admin/version.test.d.ts +1 -0
- package/dist/admin/version.test.js +71 -0
- package/dist/admin/version.test.js.map +1 -0
- package/dist/cli-config.d.ts +55 -0
- package/dist/cli-config.js +119 -0
- package/dist/cli-config.js.map +1 -0
- package/dist/cli-config.test.d.ts +1 -0
- package/dist/cli-config.test.js +92 -0
- package/dist/cli-config.test.js.map +1 -0
- package/dist/cli-format.d.ts +19 -0
- package/dist/cli-format.js +107 -0
- package/dist/cli-format.js.map +1 -0
- package/dist/cli-server.d.ts +73 -0
- package/dist/cli-server.js +347 -0
- package/dist/cli-server.js.map +1 -0
- package/dist/cli-server.test.d.ts +1 -0
- package/dist/cli-server.test.js +38 -0
- package/dist/cli-server.test.js.map +1 -0
- package/dist/cli-timeline.d.ts +35 -0
- package/dist/cli-timeline.js +373 -0
- package/dist/cli-timeline.js.map +1 -0
- package/dist/cli-timeline.test.d.ts +1 -0
- package/dist/cli-timeline.test.js +104 -0
- package/dist/cli-timeline.test.js.map +1 -0
- package/dist/cli.d.ts +0 -19
- package/dist/cli.js +910 -194
- package/dist/cli.js.map +1 -1
- package/dist/config-overlay.test.d.ts +1 -0
- package/dist/config-overlay.test.js +112 -0
- package/dist/config-overlay.test.js.map +1 -0
- package/dist/config-resolve.d.ts +28 -0
- package/dist/config-resolve.js +47 -0
- package/dist/config-resolve.js.map +1 -0
- package/dist/config-resolve.test.d.ts +1 -0
- package/dist/config-resolve.test.js +68 -0
- package/dist/config-resolve.test.js.map +1 -0
- package/dist/config.d.ts +62 -49
- package/dist/config.js +452 -76
- package/dist/config.js.map +1 -1
- package/dist/config.test.js +201 -32
- package/dist/config.test.js.map +1 -1
- package/dist/connectors/github-webhook.js +83 -5
- package/dist/connectors/github-webhook.js.map +1 -1
- package/dist/connectors/github-webhook.test.d.ts +1 -0
- package/dist/connectors/github-webhook.test.js +156 -0
- package/dist/connectors/github-webhook.test.js.map +1 -0
- package/dist/connectors/messaging/session-manager.d.ts +18 -0
- package/dist/connectors/messaging/session-manager.js +83 -2
- package/dist/connectors/messaging/session-manager.js.map +1 -1
- package/dist/connectors/messaging/session-manager.test.d.ts +1 -0
- package/dist/connectors/messaging/session-manager.test.js +144 -0
- package/dist/connectors/messaging/session-manager.test.js.map +1 -0
- package/dist/connectors/slack/connector.d.ts +9 -0
- package/dist/connectors/slack/connector.js +15 -0
- package/dist/connectors/slack/connector.js.map +1 -1
- package/dist/connectors/slack/mrkdwn.js +81 -0
- package/dist/connectors/slack/mrkdwn.js.map +1 -1
- package/dist/connectors/slack/mrkdwn.test.js +49 -0
- package/dist/connectors/slack/mrkdwn.test.js.map +1 -1
- package/dist/connectors/types.d.ts +1 -1
- package/dist/cron/fanout.d.ts +33 -0
- package/dist/cron/fanout.js +55 -0
- package/dist/cron/fanout.js.map +1 -0
- package/dist/cron/fanout.test.d.ts +1 -0
- package/dist/cron/fanout.test.js +73 -0
- package/dist/cron/fanout.test.js.map +1 -0
- package/dist/cron/jobs.d.ts +5 -0
- package/dist/cron/jobs.js +10 -3
- package/dist/cron/jobs.js.map +1 -1
- package/dist/cron/scheduler.d.ts +12 -0
- package/dist/cron/scheduler.js +27 -1
- package/dist/cron/scheduler.js.map +1 -1
- package/dist/engine/agent-executor.d.ts +158 -0
- package/dist/engine/agent-executor.js +1140 -0
- package/dist/engine/agent-executor.js.map +1 -0
- package/dist/engine/agent-executor.test.d.ts +1 -0
- package/dist/engine/agent-executor.test.js +395 -0
- package/dist/engine/agent-executor.test.js.map +1 -0
- package/dist/engine/chat-runner.d.ts +123 -0
- package/dist/engine/chat-runner.js +379 -0
- package/dist/engine/chat-runner.js.map +1 -0
- package/dist/engine/chat-runner.test.d.ts +1 -0
- package/dist/engine/chat-runner.test.js +104 -0
- package/dist/engine/chat-runner.test.js.map +1 -0
- package/dist/engine/chat-skills.d.ts +45 -0
- package/dist/engine/chat-skills.js +184 -0
- package/dist/engine/chat-skills.js.map +1 -0
- package/dist/engine/chat-skills.test.d.ts +1 -0
- package/dist/engine/chat-skills.test.js +20 -0
- package/dist/engine/chat-skills.test.js.map +1 -0
- package/dist/engine/chat.d.ts +20 -23
- package/dist/engine/chat.js +251 -155
- package/dist/engine/chat.js.map +1 -1
- package/dist/engine/chat.test.d.ts +1 -0
- package/dist/engine/chat.test.js +42 -0
- package/dist/engine/chat.test.js.map +1 -0
- package/dist/engine/classifier.d.ts +35 -2
- package/dist/engine/classifier.js +170 -31
- package/dist/engine/classifier.js.map +1 -1
- package/dist/engine/classifier.test.d.ts +1 -0
- package/dist/engine/classifier.test.js +115 -0
- package/dist/engine/classifier.test.js.map +1 -0
- package/dist/engine/dispatcher.d.ts +60 -0
- package/dist/engine/dispatcher.js +601 -0
- package/dist/engine/dispatcher.js.map +1 -0
- package/dist/engine/dispatcher.test.d.ts +1 -0
- package/dist/engine/dispatcher.test.js +511 -0
- package/dist/engine/dispatcher.test.js.map +1 -0
- package/dist/engine/event-shim.d.ts +117 -0
- package/dist/engine/event-shim.js +435 -0
- package/dist/engine/event-shim.js.map +1 -0
- package/dist/engine/event-shim.test.d.ts +1 -0
- package/dist/engine/event-shim.test.js +194 -0
- package/dist/engine/event-shim.test.js.map +1 -0
- package/dist/engine/git-auth.d.ts +13 -17
- package/dist/engine/git-auth.js +99 -42
- package/dist/engine/git-auth.js.map +1 -1
- package/dist/engine/git-auth.test.d.ts +1 -0
- package/dist/engine/git-auth.test.js +117 -0
- package/dist/engine/git-auth.test.js.map +1 -0
- package/dist/engine/github-app-client.d.ts +7 -0
- package/dist/engine/github-app-client.js +16 -0
- package/dist/engine/github-app-client.js.map +1 -0
- package/dist/engine/github-app-client.test.d.ts +1 -0
- package/dist/engine/github-app-client.test.js +44 -0
- package/dist/engine/github-app-client.test.js.map +1 -0
- package/dist/engine/github-tools.d.ts +12 -0
- package/dist/engine/github-tools.js +261 -0
- package/dist/engine/github-tools.js.map +1 -0
- package/dist/engine/github.d.ts +1027 -43
- package/dist/engine/github.js +153 -14
- package/dist/engine/github.js.map +1 -1
- package/dist/engine/llm.d.ts +47 -0
- package/dist/engine/llm.js +221 -0
- package/dist/engine/llm.js.map +1 -0
- package/dist/engine/llm.test.d.ts +1 -0
- package/dist/engine/llm.test.js +189 -0
- package/dist/engine/llm.test.js.map +1 -0
- package/dist/engine/profiles.d.ts +249 -0
- package/dist/engine/profiles.js +42 -0
- package/dist/engine/profiles.js.map +1 -0
- package/dist/engine/router.d.ts +12 -6
- package/dist/engine/router.js +339 -81
- package/dist/engine/router.js.map +1 -1
- package/dist/engine/router.test.js +428 -78
- package/dist/engine/router.test.js.map +1 -1
- package/dist/engine/screen.d.ts +41 -0
- package/dist/engine/screen.js +93 -0
- package/dist/engine/screen.js.map +1 -0
- package/dist/engine/screen.test.d.ts +1 -0
- package/dist/engine/screen.test.js +82 -0
- package/dist/engine/screen.test.js.map +1 -0
- package/dist/index.js +377 -432
- package/dist/index.js.map +1 -1
- package/dist/managed-repos.d.ts +7 -9
- package/dist/managed-repos.js +12 -15
- package/dist/managed-repos.js.map +1 -1
- package/dist/managed-repos.test.js +24 -19
- package/dist/managed-repos.test.js.map +1 -1
- package/dist/notify/index.d.ts +15 -0
- package/dist/notify/index.js +6 -0
- package/dist/notify/index.js.map +1 -0
- package/dist/notify/model.d.ts +57 -0
- package/dist/notify/model.js +89 -0
- package/dist/notify/model.js.map +1 -0
- package/dist/notify/model.test.d.ts +1 -0
- package/dist/notify/model.test.js +109 -0
- package/dist/notify/model.test.js.map +1 -0
- package/dist/notify/notifier.d.ts +17 -0
- package/dist/notify/notifier.js +87 -0
- package/dist/notify/notifier.js.map +1 -0
- package/dist/notify/notifier.test.d.ts +1 -0
- package/dist/notify/notifier.test.js +100 -0
- package/dist/notify/notifier.test.js.map +1 -0
- package/dist/notify/render.d.ts +21 -0
- package/dist/notify/render.js +59 -0
- package/dist/notify/render.js.map +1 -0
- package/dist/notify/render.test.d.ts +1 -0
- package/dist/notify/render.test.js +65 -0
- package/dist/notify/render.test.js.map +1 -0
- package/dist/notify/transports/github.d.ts +26 -0
- package/dist/notify/transports/github.js +26 -0
- package/dist/notify/transports/github.js.map +1 -0
- package/dist/notify/transports/slack.d.ts +26 -0
- package/dist/notify/transports/slack.js +28 -0
- package/dist/notify/transports/slack.js.map +1 -0
- package/dist/notify/transports.test.d.ts +1 -0
- package/dist/notify/transports.test.js +71 -0
- package/dist/notify/transports.test.js.map +1 -0
- package/dist/notify/types.d.ts +95 -0
- package/dist/notify/types.js +16 -0
- package/dist/notify/types.js.map +1 -0
- package/dist/sandbox/docker-compose.test.d.ts +1 -0
- package/dist/sandbox/docker-compose.test.js +128 -0
- package/dist/sandbox/docker-compose.test.js.map +1 -0
- package/dist/sandbox/docker.d.ts +97 -9
- package/dist/sandbox/docker.js +192 -41
- package/dist/sandbox/docker.js.map +1 -1
- package/dist/sandbox/docker.test.d.ts +1 -0
- package/dist/sandbox/docker.test.js +137 -0
- package/dist/sandbox/docker.test.js.map +1 -0
- package/dist/sandbox/egress-allowlist.d.ts +69 -0
- package/dist/sandbox/egress-allowlist.js +164 -0
- package/dist/sandbox/egress-allowlist.js.map +1 -0
- package/dist/sandbox/egress-allowlist.test.d.ts +1 -0
- package/dist/sandbox/egress-allowlist.test.js +65 -0
- package/dist/sandbox/egress-allowlist.test.js.map +1 -0
- package/dist/sandbox/egress-firewall-config.d.ts +127 -0
- package/dist/sandbox/egress-firewall-config.js +434 -0
- package/dist/sandbox/egress-firewall-config.js.map +1 -0
- package/dist/sandbox/egress-firewall-config.test.d.ts +1 -0
- package/dist/sandbox/egress-firewall-config.test.js +244 -0
- package/dist/sandbox/egress-firewall-config.test.js.map +1 -0
- package/dist/sandbox/images.d.ts +23 -0
- package/dist/sandbox/images.js +55 -0
- package/dist/sandbox/images.js.map +1 -0
- package/dist/sandbox/index.d.ts +82 -3
- package/dist/sandbox/index.js +223 -93
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/index.test.d.ts +1 -0
- package/dist/sandbox/index.test.js +157 -0
- package/dist/sandbox/index.test.js.map +1 -0
- package/dist/session-log.d.ts +63 -0
- package/dist/session-log.js +290 -0
- package/dist/session-log.js.map +1 -0
- package/dist/session-log.test.d.ts +1 -0
- package/dist/session-log.test.js +85 -0
- package/dist/session-log.test.js.map +1 -0
- package/dist/setup.d.ts +30 -1
- package/dist/setup.js +241 -25
- package/dist/setup.js.map +1 -1
- package/dist/setup.test.js +138 -6
- package/dist/setup.test.js.map +1 -1
- package/dist/state/approval-store.d.ts +86 -0
- package/dist/state/approval-store.js +140 -0
- package/dist/state/approval-store.js.map +1 -0
- package/dist/state/build-assets.d.ts +50 -0
- package/dist/state/build-assets.js +154 -0
- package/dist/state/build-assets.js.map +1 -0
- package/dist/state/build-assets.test.d.ts +1 -0
- package/dist/state/build-assets.test.js +106 -0
- package/dist/state/build-assets.test.js.map +1 -0
- package/dist/state/db.d.ts +65 -333
- package/dist/state/db.js +112 -835
- package/dist/state/db.js.map +1 -1
- package/dist/state/db.test.js +127 -91
- package/dist/state/db.test.js.map +1 -1
- package/dist/state/execution-store.d.ts +257 -0
- package/dist/state/execution-store.js +527 -0
- package/dist/state/execution-store.js.map +1 -0
- package/dist/state/migrate.d.ts +15 -0
- package/dist/state/migrate.js +175 -0
- package/dist/state/migrate.js.map +1 -0
- package/dist/state/workflow-run-store.d.ts +195 -0
- package/dist/state/workflow-run-store.js +363 -0
- package/dist/state/workflow-run-store.js.map +1 -0
- package/dist/state/workflow-run-store.test.d.ts +1 -0
- package/dist/state/workflow-run-store.test.js +264 -0
- package/dist/state/workflow-run-store.test.js.map +1 -0
- package/dist/telemetry/index.d.ts +38 -0
- package/dist/telemetry/index.js +253 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/index.test.d.ts +1 -0
- package/dist/telemetry/index.test.js +73 -0
- package/dist/telemetry/index.test.js.map +1 -0
- package/dist/telemetry/pi-events.d.ts +12 -0
- package/dist/telemetry/pi-events.js +134 -0
- package/dist/telemetry/pi-events.js.map +1 -0
- package/dist/telemetry/pi-events.test.d.ts +1 -0
- package/dist/telemetry/pi-events.test.js +69 -0
- package/dist/telemetry/pi-events.test.js.map +1 -0
- package/dist/workflows/dag.d.ts +13 -1
- package/dist/workflows/dag.js +7 -3
- package/dist/workflows/dag.js.map +1 -1
- package/dist/workflows/dag.test.js +22 -0
- package/dist/workflows/dag.test.js.map +1 -1
- package/dist/workflows/golden-build.test.d.ts +1 -0
- package/dist/workflows/golden-build.test.js +45 -0
- package/dist/workflows/golden-build.test.js.map +1 -0
- package/dist/workflows/loader-overlay.test.d.ts +1 -0
- package/dist/workflows/loader-overlay.test.js +101 -0
- package/dist/workflows/loader-overlay.test.js.map +1 -0
- package/dist/workflows/loader.d.ts +36 -11
- package/dist/workflows/loader.js +311 -87
- package/dist/workflows/loader.js.map +1 -1
- package/dist/workflows/loader.test.js +114 -10
- package/dist/workflows/loader.test.js.map +1 -1
- package/dist/workflows/loop-eval.js +2 -0
- package/dist/workflows/loop-eval.js.map +1 -1
- package/dist/workflows/loop-eval.test.js +14 -0
- package/dist/workflows/loop-eval.test.js.map +1 -1
- package/dist/workflows/phase-executor.d.ts +145 -0
- package/dist/workflows/phase-executor.js +691 -0
- package/dist/workflows/phase-executor.js.map +1 -0
- package/dist/workflows/phase-executor.test.d.ts +1 -0
- package/dist/workflows/phase-executor.test.js +434 -0
- package/dist/workflows/phase-executor.test.js.map +1 -0
- package/dist/workflows/phase-ref.d.ts +44 -0
- package/dist/workflows/phase-ref.js +78 -0
- package/dist/workflows/phase-ref.js.map +1 -0
- package/dist/workflows/phase-ref.test.d.ts +1 -0
- package/dist/workflows/phase-ref.test.js +24 -0
- package/dist/workflows/phase-ref.test.js.map +1 -0
- package/dist/workflows/resume.d.ts +5 -11
- package/dist/workflows/resume.js +88 -7
- package/dist/workflows/resume.js.map +1 -1
- package/dist/workflows/runner.d.ts +34 -27
- package/dist/workflows/runner.js +252 -930
- package/dist/workflows/runner.js.map +1 -1
- package/dist/workflows/runner.test.js +346 -35
- package/dist/workflows/runner.test.js.map +1 -1
- package/dist/workflows/schema.d.ts +52 -10
- package/dist/workflows/schema.js +147 -7
- package/dist/workflows/schema.js.map +1 -1
- package/dist/workflows/simple.d.ts +67 -3
- package/dist/workflows/simple.js +248 -87
- package/dist/workflows/simple.js.map +1 -1
- package/dist/workflows/simple.test.d.ts +1 -0
- package/dist/workflows/simple.test.js +107 -0
- package/dist/workflows/simple.test.js.map +1 -0
- package/dist/workflows/templates.d.ts +29 -0
- package/dist/workflows/templates.js +42 -4
- package/dist/workflows/templates.js.map +1 -1
- package/dist/workflows/templates.test.js +103 -0
- package/dist/workflows/templates.test.js.map +1 -1
- package/dist/workflows/triggers.d.ts +21 -0
- package/dist/workflows/triggers.js +44 -0
- package/dist/workflows/triggers.js.map +1 -0
- package/dist/workflows/verdict.d.ts +19 -0
- package/dist/workflows/verdict.js +30 -0
- package/dist/workflows/verdict.js.map +1 -0
- package/dist/workflows/verdict.test.d.ts +1 -0
- package/dist/workflows/verdict.test.js +44 -0
- package/dist/workflows/verdict.test.js.map +1 -0
- package/dist/worktree/manager.d.ts +1 -1
- package/dist/worktree/manager.js +14 -14
- package/dist/worktree/manager.js.map +1 -1
- package/dist/worktree/manager.test.d.ts +1 -0
- package/dist/worktree/manager.test.js +87 -0
- package/dist/worktree/manager.test.js.map +1 -0
- package/docker-compose.yml +206 -5
- package/package.json +19 -9
- package/sandbox.Dockerfile +97 -18
- package/skills/README.md +40 -0
- package/skills/browser-qa/SKILL.md +193 -0
- package/skills/browser-qa/scripts/agent-browser.mjs +380 -0
- package/skills/building/SKILL.md +95 -0
- package/skills/chat/SKILL.md +30 -11
- package/skills/code-review/SKILL.md +59 -0
- package/skills/debug-production/SKILL.md +108 -0
- package/skills/demo/SKILL.md +194 -0
- package/skills/demo/scripts/compose-demo.sh +205 -0
- package/skills/issue-answer/SKILL.md +90 -0
- package/skills/issue-comment/SKILL.md +38 -24
- package/skills/issue-triage/SKILL.md +103 -37
- package/skills/issue-triage/references/AGENT-BRIEF.md +61 -0
- package/skills/pr-comment/SKILL.md +64 -0
- package/skills/pr-review/SKILL.md +65 -49
- package/skills/qa-test/SKILL.md +97 -0
- package/skills/repo-health/SKILL.md +48 -45
- package/skills/security-feedback/SKILL.md +173 -0
- package/skills/security-feedback/references/templates.md +77 -0
- package/skills/security-review/SKILL.md +213 -0
- package/skills/security-review/references/issue-format.md +302 -0
- package/skills/verify/SKILL.md +118 -0
- package/workflows/answer.yaml +37 -0
- package/workflows/build.yaml +32 -22
- package/workflows/cron-security.yaml +6 -0
- package/workflows/demo.yaml +55 -0
- package/workflows/explore.yaml +9 -0
- package/workflows/pr-comment.yaml +16 -0
- package/workflows/pr-fix.yaml +3 -0
- package/workflows/pr-review.yaml +4 -1
- package/workflows/prompts/answer.md +67 -0
- package/workflows/prompts/architect.md +24 -7
- package/workflows/prompts/demo.md +100 -0
- package/workflows/prompts/executor.md +29 -20
- package/workflows/prompts/explore-ask.md +51 -22
- package/workflows/prompts/explore-publish.md +2 -2
- package/workflows/prompts/explore-read.md +24 -10
- package/workflows/prompts/explore-synthesize.md +15 -8
- package/workflows/prompts/fix.md +9 -10
- package/workflows/prompts/guardrails.md +26 -8
- package/workflows/prompts/pr-fix.md +6 -7
- package/workflows/prompts/pr.md +11 -10
- package/workflows/prompts/qa-browser.md +95 -0
- package/workflows/prompts/qa-synth.md +44 -0
- package/workflows/prompts/qa-test.md +60 -0
- package/workflows/prompts/re-reviewer.md +8 -9
- package/workflows/prompts/reviewer.md +10 -9
- package/workflows/prompts/verify-browser.md +93 -0
- package/workflows/prompts/verify-synth.md +44 -0
- package/workflows/prompts/verify.md +63 -0
- package/workflows/qa-test.yaml +87 -0
- package/workflows/security-feedback.yaml +25 -0
- package/workflows/security-review.yaml +29 -0
- package/workflows/verify.yaml +85 -0
- package/deploy/mcp-config.tmpl.json +0 -14
- package/dist/cron/rate-limits.d.ts +0 -26
- package/dist/cron/rate-limits.js +0 -193
- package/dist/cron/rate-limits.js.map +0 -1
- package/dist/engine/executor.d.ts +0 -75
- package/dist/engine/executor.js +0 -292
- package/dist/engine/executor.js.map +0 -1
- package/mcp-github-app/package.json +0 -18
- package/mcp-github-app/src/auth.js +0 -66
- package/mcp-github-app/src/github.js +0 -371
- package/mcp-github-app/src/index.js +0 -534
- package/skills/devops/webhook-subscriptions/SKILL.md +0 -180
- package/skills/github/DESCRIPTION.md +0 -3
- package/skills/github/codebase-inspection/SKILL.md +0 -115
- package/skills/github/github-auth/SKILL.md +0 -54
- package/skills/github/github-auth/scripts/gh-env.sh +0 -66
- package/skills/github/github-code-review/SKILL.md +0 -480
- package/skills/github/github-code-review/references/review-output-template.md +0 -74
- package/skills/github/github-issues/SKILL.md +0 -369
- package/skills/github/github-issues/templates/bug-report.md +0 -35
- package/skills/github/github-issues/templates/feature-request.md +0 -31
- package/skills/github/github-pr-workflow/SKILL.md +0 -395
- package/skills/github/github-pr-workflow/references/ci-troubleshooting.md +0 -183
- package/skills/github/github-pr-workflow/references/conventional-commits.md +0 -71
- package/skills/github/github-pr-workflow/templates/pr-body-bugfix.md +0 -35
- package/skills/github/github-pr-workflow/templates/pr-body-feature.md +0 -33
- package/skills/github/github-repo-management/SKILL.md +0 -515
- package/skills/github/github-repo-management/references/github-api-cheatsheet.md +0 -161
- package/skills/github-orchestrator/SKILL.md +0 -103
- package/skills/mcp/DESCRIPTION.md +0 -3
- package/skills/mcp/mcporter/SKILL.md +0 -122
- package/skills/mcp/native-mcp/SKILL.md +0 -356
- package/skills/software-development/architect/SKILL.md +0 -154
- package/skills/software-development/assure-guardrails/SKILL.md +0 -239
- package/skills/software-development/plan/SKILL.md +0 -64
- package/skills/software-development/requesting-code-review/SKILL.md +0 -291
- package/skills/software-development/subagent-driven-development/SKILL.md +0 -433
- package/skills/software-development/systematic-debugging/SKILL.md +0 -366
- package/skills/software-development/test-driven-development/SKILL.md +0 -342
package/dist/engine/chat.js
CHANGED
|
@@ -1,182 +1,278 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { loadAgentContext as loadResolvedAgentContext } from "../workflows/loader.js";
|
|
2
|
+
import { wrapUntrusted } from "./screen.js";
|
|
3
|
+
import { AgenticShim } from "./event-shim.js";
|
|
4
|
+
import { CHAT_PROJECT_SLUG } from "../session-log.js";
|
|
5
|
+
import { getRuntimeConfig } from "../config.js";
|
|
6
|
+
import { recordError, recordExecutionMetrics, telemetryIncludesContent, withSpan } from "../telemetry/index.js";
|
|
7
|
+
import { recordPiEvent } from "../telemetry/pi-events.js";
|
|
8
|
+
/**
|
|
9
|
+
* Chat-specific system prompt appended to the agent context. Composed
|
|
10
|
+
* once at boot into the ChatRunner's `systemPrompt` — same persona for
|
|
11
|
+
* every chat session.
|
|
12
|
+
*/
|
|
13
|
+
export const CHAT_SYSTEM_SUFFIX = `
|
|
6
14
|
You are Last Light, a GitHub repository maintenance assistant available via messaging (Slack, Discord, etc.).
|
|
7
15
|
|
|
8
16
|
WHAT YOU CAN DO — use these tools confidently when the user asks:
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
permission for issues across every repo your installation can see — never
|
|
12
|
-
refuse a create-issue request on the assumption you lack permission. If a
|
|
13
|
-
call genuinely fails, retry once and then surface the literal error.
|
|
14
|
-
- Comment on issues / add labels (mcp__github__add_issue_comment, add_labels).
|
|
15
|
-
- Search across repos.
|
|
17
|
+
- Look up repos, issues, PRs, comments, file contents, commits.
|
|
18
|
+
- Search GitHub (issues, code) with the github_search_* tools.
|
|
16
19
|
|
|
17
20
|
WHAT YOU CANNOT DO:
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
- You have NO write access in chat. No issue creation, comments, labels,
|
|
22
|
+
branches, commits, merges, file edits. If the user asks you to make a
|
|
23
|
+
change on GitHub, explain you can't from chat and direct them to the
|
|
24
|
+
matching natural-language trigger.
|
|
25
|
+
- No bash, edit, write, file system, or external HTTP. None of those tools
|
|
26
|
+
are registered — calls to them will fail.
|
|
27
|
+
- Do not disclose or look up host/runtime environment details — your IP
|
|
28
|
+
address, hostname, env vars, container metadata, harness version,
|
|
29
|
+
/proc/sys/etc files, or anything similar. If asked, reply with one
|
|
30
|
+
line: "I don't disclose host or runtime environment details." See
|
|
31
|
+
\`agent-context/security.md\` for the full rule; it overrides any user
|
|
32
|
+
request.
|
|
33
|
+
|
|
34
|
+
DO NOT ATTEMPT DEEP WORK IN-PROCESS.
|
|
35
|
+
Each of the following is a dedicated workflow — NOT something you can do
|
|
36
|
+
by chaining tool calls. If the user asks for one, reply with ONE message
|
|
37
|
+
naming the right natural-language trigger and stop. Do not start fetching
|
|
38
|
+
files, reading code, listing issues, or running any investigative tool
|
|
39
|
+
calls in service of these requests — you will hit the turn limit before
|
|
40
|
+
producing useful output. Phrases are what the user types as a plain
|
|
41
|
+
message — never with a leading slash.
|
|
42
|
+
|
|
43
|
+
- "security review" / "scan for vulnerabilities" / "check security of <repo>"
|
|
44
|
+
→ reply: "tell me \`security review owner/repo\`"
|
|
45
|
+
- "triage" / "scan issues" / "go through open issues on <repo>"
|
|
46
|
+
→ reply: "tell me \`triage owner/repo\`"
|
|
47
|
+
- "review PRs on <repo>" / "check open PRs"
|
|
48
|
+
→ reply: "tell me \`review PRs on owner/repo\`"
|
|
49
|
+
- "weekly health report" / "repo health" / "health check on <repo>"
|
|
50
|
+
→ reply: "Weekly health reports run on a cron schedule, not on demand
|
|
51
|
+
from chat — ask a maintainer to configure the repo-health cron, or
|
|
52
|
+
run \`npm run cli -- health owner/repo\` from the harness host."
|
|
53
|
+
(health is NOT an interactive chat trigger; do not suggest typing it
|
|
54
|
+
here.)
|
|
55
|
+
- "build this" / "implement this" / "fix this bug" on a specific issue
|
|
56
|
+
→ reply: "tell me \`build owner/repo#N\` (open the GitHub issue first if
|
|
57
|
+
needed)"
|
|
58
|
+
- a research-heavy QUESTION that needs web search or deep doc reading (e.g.
|
|
59
|
+
"how does <repo> compare to <other tool>?") → this runs as a sandboxed
|
|
60
|
+
answer workflow, but only when you name a managed repo. If the user asked
|
|
61
|
+
such a question without a repo, ask them to include it (e.g. "how does
|
|
62
|
+
cliftonc/lastlight compare to X?") and the answer will be researched and
|
|
63
|
+
posted back here. Don't attempt the deep research yourself in-process.
|
|
64
|
+
|
|
65
|
+
Only exception: if the user is asking a narrow *question* that you can
|
|
66
|
+
answer with one or two reads (e.g. "what does this file do?", "what labels
|
|
67
|
+
does this issue have?"), just do it. The rule is about full-repo scans and
|
|
68
|
+
multi-phase workflows, not about one-off lookups.
|
|
23
69
|
|
|
24
70
|
STYLE:
|
|
25
71
|
- Reach for tools immediately. Don't pre-explain what you're about to do.
|
|
26
72
|
- Keep replies concise — this is chat, not a document.
|
|
27
|
-
- The conversation history is
|
|
73
|
+
- The conversation history is rehydrated server-side per session — don't
|
|
28
74
|
re-summarize it; just respond to the latest message.
|
|
75
|
+
- Never suggest commands with a leading \`/\` — Slack intercepts them
|
|
76
|
+
before they reach Last Light and they will fail. Always phrase triggers
|
|
77
|
+
as natural language the user can type as a plain message.
|
|
29
78
|
|
|
30
|
-
|
|
31
|
-
|
|
79
|
+
Natural-language triggers you can suggest:
|
|
80
|
+
\`build owner/repo#N\`, \`triage owner/repo\`, \`review PRs on owner/repo\`,
|
|
81
|
+
\`security review owner/repo\`, \`explore owner/repo\`, \`status\`,
|
|
82
|
+
\`reset\`, \`approve\`, \`reject\`
|
|
32
83
|
`;
|
|
33
84
|
/**
|
|
34
|
-
*
|
|
35
|
-
* Read-only tools
|
|
36
|
-
*/
|
|
37
|
-
const ALLOWED_MCP_TOOLS = [
|
|
38
|
-
// Read-only
|
|
39
|
-
"mcp__github__get_repository",
|
|
40
|
-
"mcp__github__get_file_contents",
|
|
41
|
-
"mcp__github__list_branches",
|
|
42
|
-
"mcp__github__list_issues",
|
|
43
|
-
"mcp__github__get_issue",
|
|
44
|
-
"mcp__github__list_issue_comments",
|
|
45
|
-
"mcp__github__list_labels",
|
|
46
|
-
"mcp__github__list_pull_requests",
|
|
47
|
-
"mcp__github__get_pull_request",
|
|
48
|
-
"mcp__github__list_pull_request_files",
|
|
49
|
-
"mcp__github__get_pull_request_diff",
|
|
50
|
-
"mcp__github__list_commits",
|
|
51
|
-
"mcp__github__search_repositories",
|
|
52
|
-
"mcp__github__search_issues",
|
|
53
|
-
"mcp__github__search_code",
|
|
54
|
-
// Write — issue creation only
|
|
55
|
-
"mcp__github__create_issue",
|
|
56
|
-
"mcp__github__add_issue_comment",
|
|
57
|
-
"mcp__github__add_labels",
|
|
58
|
-
];
|
|
59
|
-
/**
|
|
60
|
-
* Handle a conversational chat message.
|
|
61
|
-
* Runs the Agent SDK directly (no Docker sandbox) for low-latency responses.
|
|
62
|
-
* Strictly read-only except for issue creation.
|
|
63
|
-
*
|
|
64
|
-
* Conversation continuity is provided by the SDK's `resume` option: the
|
|
65
|
-
* caller passes the agent session id from the previous turn (stored on the
|
|
66
|
-
* messaging-session row), and the SDK appends to the same jsonl. The first
|
|
67
|
-
* turn passes `undefined` and we capture the new session id from the result.
|
|
85
|
+
* Handle a conversational chat message using the in-process pi-ai
|
|
86
|
+
* runner. Read-only github tools, no shell / write surface.
|
|
68
87
|
*/
|
|
69
|
-
export async function handleChatMessage(message,
|
|
88
|
+
export async function handleChatMessage(message, messagingSessionId, sender, _sessionManager, deps, _config) {
|
|
70
89
|
const startTime = Date.now();
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
+
return withSpan("lastlight.chat.turn", { "messaging.session_id": messagingSessionId, "messaging.sender": sender, model: _config.model }, async () => {
|
|
91
|
+
try {
|
|
92
|
+
const wrapped = wrapUntrusted(message, {
|
|
93
|
+
source: "messaging-user",
|
|
94
|
+
author: sender,
|
|
95
|
+
});
|
|
96
|
+
const turn = await deps.chatRunner.turn(messagingSessionId, wrapped);
|
|
97
|
+
const success = turn.finish === "stop" && turn.errors.length === 0;
|
|
98
|
+
const result = {
|
|
99
|
+
text: turn.text || (success
|
|
100
|
+
? "I wasn't able to generate a response. Please try again."
|
|
101
|
+
: formatChatFailure(turn.finish, turn.errors)),
|
|
102
|
+
agentSessionId: turn.agentSessionId,
|
|
103
|
+
dashboardSessionId: turn.agentSessionId,
|
|
104
|
+
success,
|
|
105
|
+
durationMs: Date.now() - startTime,
|
|
106
|
+
turns: turn.modelTurns,
|
|
107
|
+
costUsd: turn.costUsd > 0 ? turn.costUsd : undefined,
|
|
108
|
+
inputTokens: turn.tokens.input || undefined,
|
|
109
|
+
outputTokens: turn.tokens.output || undefined,
|
|
110
|
+
cacheReadInputTokens: turn.tokens.cacheRead || undefined,
|
|
111
|
+
cacheCreationInputTokens: turn.tokens.cacheWrite || undefined,
|
|
112
|
+
stopReason: success ? "success" : `error_${turn.finish.replace(/-/g, "_")}`,
|
|
113
|
+
error: success ? undefined : turn.errors.join("\n") || turn.finish,
|
|
114
|
+
};
|
|
90
115
|
try {
|
|
91
|
-
|
|
92
|
-
|
|
116
|
+
await writeChatShim({
|
|
117
|
+
sessionsHomeDir: deps.sessionsHomeDir,
|
|
118
|
+
model: turn.modelId,
|
|
119
|
+
prompt: message,
|
|
120
|
+
turn,
|
|
121
|
+
stopReason: result.stopReason ?? "unknown",
|
|
122
|
+
durationMs: result.durationMs,
|
|
123
|
+
includeContent: getRuntimeConfig()?.otel.includeContent ?? telemetryIncludesContent(),
|
|
124
|
+
});
|
|
93
125
|
}
|
|
94
|
-
catch {
|
|
95
|
-
|
|
126
|
+
catch (err) {
|
|
127
|
+
const m = err instanceof Error ? err.message : String(err);
|
|
128
|
+
console.warn(`[chat] failed to write dashboard shim: ${m}`);
|
|
96
129
|
}
|
|
130
|
+
const costStr = result.costUsd !== undefined ? `, $${result.costUsd.toFixed(4)}` : "";
|
|
131
|
+
console.log(`[chat] ${sender} → ${result.stopReason ?? "?"} (${result.turns ?? "?"} turns, ${Math.round(result.durationMs / 1000)}s${costStr}) [session ${turn.agentSessionId.slice(0, 8)}…]`);
|
|
132
|
+
recordExecutionMetrics("chat", { model: turn.modelId, success: result.success, stop_reason: result.stopReason, durationMs: result.durationMs, costUsd: result.costUsd, inputTokens: result.inputTokens, outputTokens: result.outputTokens });
|
|
133
|
+
return result;
|
|
97
134
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
turns = m.num_turns;
|
|
119
|
-
if (typeof m.subtype === "string")
|
|
120
|
-
stopReason = m.subtype;
|
|
121
|
-
if (typeof m.total_cost_usd === "number")
|
|
122
|
-
costUsd = m.total_cost_usd;
|
|
123
|
-
if (typeof m.duration_api_ms === "number")
|
|
124
|
-
apiDurationMs = m.duration_api_ms;
|
|
125
|
-
const u = m.usage;
|
|
126
|
-
if (u) {
|
|
127
|
-
if (typeof u.input_tokens === "number")
|
|
128
|
-
inputTokens = u.input_tokens;
|
|
129
|
-
if (typeof u.cache_creation_input_tokens === "number")
|
|
130
|
-
cacheCreationInputTokens = u.cache_creation_input_tokens;
|
|
131
|
-
if (typeof u.cache_read_input_tokens === "number")
|
|
132
|
-
cacheReadInputTokens = u.cache_read_input_tokens;
|
|
133
|
-
if (typeof u.output_tokens === "number")
|
|
134
|
-
outputTokens = u.output_tokens;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
135
|
+
catch (err) {
|
|
136
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
137
|
+
console.error(`[chat] Error handling message from ${sender}:`, errMsg);
|
|
138
|
+
const dashboardSessionId = await writeChatFailureShim({
|
|
139
|
+
sessionsHomeDir: deps.sessionsHomeDir,
|
|
140
|
+
prompt: message,
|
|
141
|
+
messagingSessionId,
|
|
142
|
+
errorMessage: errMsg,
|
|
143
|
+
durationMs: Date.now() - startTime,
|
|
144
|
+
}).catch(() => undefined);
|
|
145
|
+
const durationMs = Date.now() - startTime;
|
|
146
|
+
recordError("chat", err, { success: false, stop_reason: "error_exception", model: _config.model });
|
|
147
|
+
recordExecutionMetrics("chat", { model: _config.model, success: false, stop_reason: "error_exception", durationMs });
|
|
148
|
+
return {
|
|
149
|
+
text: "Sorry, I encountered an error processing your message. Please try again.",
|
|
150
|
+
success: false,
|
|
151
|
+
durationMs,
|
|
152
|
+
error: errMsg,
|
|
153
|
+
dashboardSessionId,
|
|
154
|
+
};
|
|
137
155
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Pick a useful Slack message for a failed chat turn. Provider errors
|
|
160
|
+
* (insufficient_quota, rate limit, auth) get a dedicated line — the
|
|
161
|
+
* raw error string was previously dropped, leaving users with just
|
|
162
|
+
* "(error)".
|
|
163
|
+
*/
|
|
164
|
+
function formatChatFailure(finish, errors) {
|
|
165
|
+
const first = errors.find((e) => e && e.trim().length > 0)?.trim();
|
|
166
|
+
if (first) {
|
|
167
|
+
const lower = first.toLowerCase();
|
|
168
|
+
if (lower.includes("credit balance") ||
|
|
169
|
+
lower.includes("insufficient_quota") ||
|
|
170
|
+
lower.includes("insufficient quota")) {
|
|
171
|
+
return `Sorry — the model provider rejected the request: out of credits / quota.\n> ${truncate(first, 300)}`;
|
|
172
|
+
}
|
|
173
|
+
if (lower.includes("rate limit") || lower.includes("rate_limit")) {
|
|
174
|
+
return `Sorry — the model provider is rate-limiting us right now. Try again in a moment.\n> ${truncate(first, 300)}`;
|
|
175
|
+
}
|
|
176
|
+
if (lower.includes("unauthorized") || lower.includes("invalid_api_key") || lower.includes("api key")) {
|
|
177
|
+
return `Sorry — the model provider rejected our API key.\n> ${truncate(first, 300)}`;
|
|
178
|
+
}
|
|
179
|
+
return `Sorry — chat failed (${finish}): ${truncate(first, 400)}`;
|
|
180
|
+
}
|
|
181
|
+
return `Sorry — chat failed (${finish}).`;
|
|
182
|
+
}
|
|
183
|
+
function truncate(s, n) {
|
|
184
|
+
return s.length <= n ? s : s.slice(0, n - 1) + "…";
|
|
185
|
+
}
|
|
186
|
+
async function writeChatShim(opts) {
|
|
187
|
+
const shim = new AgenticShim({
|
|
188
|
+
homeDir: opts.sessionsHomeDir,
|
|
189
|
+
projectSlug: CHAT_PROJECT_SLUG, // Chat project slug is centralized in SessionLog
|
|
190
|
+
model: opts.model,
|
|
191
|
+
initialPrompt: opts.prompt,
|
|
192
|
+
});
|
|
193
|
+
const sessionId = opts.turn.agentSessionId;
|
|
194
|
+
const now = new Date().toISOString();
|
|
195
|
+
// Synthesise a session header so the shim opens the right file.
|
|
196
|
+
const sessionRecord = { type: "session", id: sessionId, timestamp: now, cwd: "/app" };
|
|
197
|
+
shim.feed(sessionRecord);
|
|
198
|
+
recordPiEvent(sessionRecord, { surface: "chat", includeContent: opts.includeContent === true, model: opts.model });
|
|
199
|
+
// Replay each assistant turn + paired tool results as message_end /
|
|
200
|
+
// tool_execution_end events the shim already knows how to translate.
|
|
201
|
+
for (const am of opts.turn.assistantMessages) {
|
|
202
|
+
const content = am.content
|
|
203
|
+
.map((c) => {
|
|
204
|
+
if (c.type === "text")
|
|
205
|
+
return { type: "text", text: c.text };
|
|
206
|
+
if (c.type === "thinking")
|
|
207
|
+
return { type: "thinking", thinking: c.thinking };
|
|
208
|
+
if (c.type === "toolCall") {
|
|
209
|
+
return {
|
|
210
|
+
type: "toolCall",
|
|
211
|
+
id: c.id,
|
|
212
|
+
name: c.name,
|
|
213
|
+
arguments: c.arguments,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
return null;
|
|
217
|
+
})
|
|
218
|
+
.filter(Boolean);
|
|
219
|
+
const record = {
|
|
220
|
+
type: "message_end",
|
|
221
|
+
sessionId,
|
|
222
|
+
timestamp: now,
|
|
223
|
+
message: { role: "assistant", content },
|
|
156
224
|
};
|
|
225
|
+
shim.feed(record);
|
|
226
|
+
recordPiEvent(record, { surface: "chat", includeContent: opts.includeContent === true, model: opts.model });
|
|
157
227
|
}
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
228
|
+
for (const tr of opts.turn.toolResults) {
|
|
229
|
+
const text = tr.content.find((c) => c.type === "text");
|
|
230
|
+
const record = {
|
|
231
|
+
type: "tool_execution_end",
|
|
232
|
+
sessionId,
|
|
233
|
+
timestamp: now,
|
|
234
|
+
toolCallId: tr.toolCallId,
|
|
235
|
+
toolName: tr.toolName,
|
|
236
|
+
result: text && "text" in text ? text.text : "",
|
|
237
|
+
isError: tr.isError,
|
|
166
238
|
};
|
|
239
|
+
shim.feed(record);
|
|
240
|
+
recordPiEvent(record, { surface: "chat", includeContent: opts.includeContent === true, model: opts.model });
|
|
167
241
|
}
|
|
242
|
+
shim.finalize({
|
|
243
|
+
finalText: opts.turn.text,
|
|
244
|
+
turns: opts.turn.modelTurns,
|
|
245
|
+
costUsd: opts.turn.costUsd,
|
|
246
|
+
inputTokens: opts.turn.tokens.input,
|
|
247
|
+
outputTokens: opts.turn.tokens.output,
|
|
248
|
+
cacheReadInputTokens: opts.turn.tokens.cacheRead,
|
|
249
|
+
cacheCreationInputTokens: opts.turn.tokens.cacheWrite,
|
|
250
|
+
stopReason: opts.stopReason,
|
|
251
|
+
durationMs: opts.durationMs,
|
|
252
|
+
});
|
|
253
|
+
await shim.flush();
|
|
168
254
|
}
|
|
169
|
-
function
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
255
|
+
async function writeChatFailureShim(opts) {
|
|
256
|
+
const shim = new AgenticShim({
|
|
257
|
+
homeDir: opts.sessionsHomeDir,
|
|
258
|
+
projectSlug: CHAT_PROJECT_SLUG,
|
|
259
|
+
initialPrompt: opts.prompt,
|
|
260
|
+
});
|
|
261
|
+
const safe = opts.messagingSessionId.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
262
|
+
const synthesizedId = await shim.finalizeWithFallback({
|
|
263
|
+
finalText: "",
|
|
264
|
+
turns: 0,
|
|
265
|
+
costUsd: 0,
|
|
266
|
+
inputTokens: 0,
|
|
267
|
+
outputTokens: 0,
|
|
268
|
+
cacheReadInputTokens: 0,
|
|
269
|
+
cacheCreationInputTokens: 0,
|
|
270
|
+
stopReason: "error_chat",
|
|
271
|
+
durationMs: opts.durationMs,
|
|
272
|
+
}, `exec-chat-${safe}-${Date.now()}`, opts.errorMessage);
|
|
273
|
+
return synthesizedId ?? undefined;
|
|
274
|
+
}
|
|
275
|
+
export function loadAgentContext(_dir) {
|
|
276
|
+
return loadResolvedAgentContext();
|
|
181
277
|
}
|
|
182
278
|
//# sourceMappingURL=chat.js.map
|
package/dist/engine/chat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/engine/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/engine/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,IAAI,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAGtF,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,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0 +1,42 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import { CHAT_SYSTEM_SUFFIX } from "./chat.js";
|
|
5
|
+
describe("CHAT_SYSTEM_SUFFIX", () => {
|
|
6
|
+
it("does not advertise leading-slash command tokens", () => {
|
|
7
|
+
// Slack intercepts any message starting with `/` before it reaches
|
|
8
|
+
// Last Light, so the prompt must never suggest slash commands. The
|
|
9
|
+
// regex catches a backtick-or-start-of-line-anchored `/word` command
|
|
10
|
+
// token (the shape the old prompt used), scoped to the exact command
|
|
11
|
+
// words so prose like `/proc` or `agent-context/security.md` does
|
|
12
|
+
// not trip it.
|
|
13
|
+
expect(CHAT_SYSTEM_SUFFIX).not.toMatch(/(^|`)\/(build|triage|review|security|health|status)\b/);
|
|
14
|
+
});
|
|
15
|
+
it("advertises the natural-language triggers", () => {
|
|
16
|
+
expect(CHAT_SYSTEM_SUFFIX).toContain("build owner/repo#N");
|
|
17
|
+
expect(CHAT_SYSTEM_SUFFIX).toContain("triage owner/repo");
|
|
18
|
+
expect(CHAT_SYSTEM_SUFFIX).toContain("review PRs on owner/repo");
|
|
19
|
+
expect(CHAT_SYSTEM_SUFFIX).toContain("security review owner/repo");
|
|
20
|
+
expect(CHAT_SYSTEM_SUFFIX).toContain("status");
|
|
21
|
+
});
|
|
22
|
+
it("includes the never-suggest-leading-slash rule", () => {
|
|
23
|
+
expect(CHAT_SYSTEM_SUFFIX).toMatch(/never suggest.*leading/i);
|
|
24
|
+
});
|
|
25
|
+
it("does not advertise health as an interactive trigger", () => {
|
|
26
|
+
// `health` runs via cron/CLI only — it must not be listed among the
|
|
27
|
+
// interactive natural-language triggers.
|
|
28
|
+
const triggersBlock = CHAT_SYSTEM_SUFFIX.match(/Natural-language triggers you can suggest:[\s\S]*?(?=\n\n|\n[A-Z]|\n`|$)/);
|
|
29
|
+
expect(triggersBlock).not.toBeNull();
|
|
30
|
+
expect(triggersBlock[0]).not.toMatch(/\bhealth\b/i);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
describe("skills/chat/SKILL.md frontmatter", () => {
|
|
34
|
+
// The chat skill description is surfaced to the agent at boot via
|
|
35
|
+
// the chat skill catalogue, so it must be slash-free too.
|
|
36
|
+
const md = readFileSync(resolve("skills/chat/SKILL.md"), "utf-8");
|
|
37
|
+
const frontmatter = md.match(/^---\n([\s\S]*?)\n---/)?.[1] ?? "";
|
|
38
|
+
it("does not advertise leading-slash command tokens", () => {
|
|
39
|
+
expect(frontmatter).not.toMatch(/\/(build|triage|review|security|health|status)\b/);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=chat.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.test.js","sourceRoot":"","sources":["../../src/engine/chat.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,mEAAmE;QACnE,mEAAmE;QACnE,qEAAqE;QACrE,qEAAqE;QACrE,kEAAkE;QAClE,eAAe;QACf,MAAM,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC,OAAO,CACpC,uDAAuD,CACxD,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAClD,MAAM,CAAC,kBAAkB,CAAC,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;QAC3D,MAAM,CAAC,kBAAkB,CAAC,CAAC,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@
|
|
|
5
5
|
* a GitHub comment is requesting a code change (build/fix), an idea
|
|
6
6
|
* exploration, or a lightweight action (close, label, question, etc.).
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
import { type ChatFunction } from "./llm.js";
|
|
9
|
+
export type CommentIntent = "build" | "explore" | "question" | "triage" | "review" | "security" | "verify" | "qa-test" | "demo" | "approve" | "reject" | "status" | "reset" | "chat";
|
|
9
10
|
export interface ClassificationResult {
|
|
10
11
|
intent: CommentIntent;
|
|
11
12
|
/** Repository mentioned in the message, if any (e.g. "cliftonc/lastlight"). */
|
|
@@ -15,8 +16,40 @@ export interface ClassificationResult {
|
|
|
15
16
|
/** Reason given for a reject intent. */
|
|
16
17
|
reason?: string;
|
|
17
18
|
}
|
|
19
|
+
/** Optional surrounding context for a comment classification. */
|
|
20
|
+
export interface ClassifierContext {
|
|
21
|
+
/** Title of the issue/PR the comment is on (when applicable). */
|
|
22
|
+
issueTitle?: string;
|
|
23
|
+
/** True when the comment is on a PR rather than an issue. */
|
|
24
|
+
isPullRequest?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface ClassifierOptions {
|
|
27
|
+
model?: string;
|
|
28
|
+
chat?: ChatFunction;
|
|
29
|
+
defaultFastModel?: (taskType?: string) => string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Extract owner/repo and optional issue/PR number from any github.com URL
|
|
33
|
+
* in the text. Belt-and-suspenders for the LLM — if the classifier forgets
|
|
34
|
+
* to normalize a URL to owner/name, this fallback still recovers the repo.
|
|
35
|
+
* Returns undefined when no github.com URL is present.
|
|
36
|
+
*/
|
|
37
|
+
export declare function extractGithubRefFromText(text: string): {
|
|
38
|
+
repo: string;
|
|
39
|
+
issueNumber?: number;
|
|
40
|
+
} | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Classify whether a newly-opened issue is a pure question (wants an answer)
|
|
43
|
+
* versus a work item (wants a code change). Used by the router to send
|
|
44
|
+
* question issues down the dedicated answer path instead of triage.
|
|
45
|
+
*
|
|
46
|
+
* Falls back to `false` (WORK → triage) on any error — triage is the safe
|
|
47
|
+
* default, and a question that slips through still hits the issue-triage
|
|
48
|
+
* skill's question safety net.
|
|
49
|
+
*/
|
|
50
|
+
export declare function classifyIssueIsQuestion(title: string, body: string, options?: ClassifierOptions): Promise<boolean>;
|
|
18
51
|
/**
|
|
19
52
|
* Classify a GitHub/Slack comment's intent and extract a repo reference.
|
|
20
53
|
* Falls back to intent=action on any error (safe default).
|
|
21
54
|
*/
|
|
22
|
-
export declare function classifyComment(commentBody: string,
|
|
55
|
+
export declare function classifyComment(commentBody: string, context?: ClassifierContext, options?: string | ClassifierOptions): Promise<ClassificationResult>;
|