lastlight 0.16.0 → 0.16.2
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} +39 -1
- package/dist/{cli/cli-server.js → cli-server.js} +105 -5
- package/dist/cli-server.js.map +1 -0
- package/dist/cli-timeline.js.map +1 -0
- package/dist/{cli/cli.js → cli.js} +9 -7
- 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,81 +0,0 @@
|
|
|
1
|
-
import { type SandboxBackend } from "../../config/config.js";
|
|
2
|
-
import { type EgressPolicy, type PrePopulateSpec, type ProvisionResult, type Sandbox, type SandboxFactory } from "../../sandbox/sandbox.js";
|
|
3
|
-
import { type ExecutorConfig, type ExecutionResult, type GitSandboxAccess } from "../github/profiles.js";
|
|
4
|
-
/**
|
|
5
|
-
* The **Sandbox orchestrator** — the deep module that owns one agent/command
|
|
6
|
-
* run end-to-end behind the {@link Sandbox} port. It is written ONCE and is
|
|
7
|
-
* identical for every backend; the per-backend `executeDocker` / `executeSmol`
|
|
8
|
-
* / `executeInProcess` twins it replaced are gone.
|
|
9
|
-
*
|
|
10
|
-
* - {@link withSandbox} is the bracket: build the adapter → provision →
|
|
11
|
-
* (work) → dispose. Errors from provision (e.g. docker unavailable)
|
|
12
|
-
* propagate; dispose always runs once provisioned.
|
|
13
|
-
* - {@link runSandboxedAgent} runs one agent turn: skill staging,
|
|
14
|
-
* build-artifact stage/harvest, the `RunResultAccumulator` + shim +
|
|
15
|
-
* `recordPiEvent` event loop, session-id notify, and the single converged
|
|
16
|
-
* fallback path.
|
|
17
|
-
* - {@link runSandboxedCommand} runs a deterministic command/script and
|
|
18
|
-
* mirrors it to a session jsonl.
|
|
19
|
-
*
|
|
20
|
-
* Egress is computed once here as an intent-only {@link EgressPolicy} and
|
|
21
|
-
* handed to the adapter at construction.
|
|
22
|
-
*/
|
|
23
|
-
/** Shared run context threaded into the orchestrator by the executors. */
|
|
24
|
-
export interface SandboxRunContext {
|
|
25
|
-
config: ExecutorConfig;
|
|
26
|
-
taskId: string;
|
|
27
|
-
stateDir: string;
|
|
28
|
-
backend: SandboxBackend;
|
|
29
|
-
/** Env forwarded into the sandbox (provider keys, minted GITHUB_TOKEN, …). */
|
|
30
|
-
env: Record<string, string>;
|
|
31
|
-
prePopulate?: PrePopulateSpec;
|
|
32
|
-
access?: GitSandboxAccess;
|
|
33
|
-
onSessionId?: (sessionId: string) => void;
|
|
34
|
-
/** Test seam — substitute a FakeSandbox. Defaults to {@link sandboxFor}. */
|
|
35
|
-
sandboxFactory?: SandboxFactory;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Compute the run's intent-only egress policy once: `unrestricted` for a phase
|
|
39
|
-
* that opted out, otherwise the default allowlist merged with any OTEL
|
|
40
|
-
* collector hosts. Each adapter translates this to its own mechanism.
|
|
41
|
-
*/
|
|
42
|
-
export declare function egressPolicyFor(config: ExecutorConfig): EgressPolicy;
|
|
43
|
-
/**
|
|
44
|
-
* The provision → work → dispose bracket. Builds the adapter via the factory
|
|
45
|
-
* (or the injected one), provisions the workspace, runs `fn`, and disposes in a
|
|
46
|
-
* `finally` once provisioned. A provision failure propagates to the caller (it
|
|
47
|
-
* is not a workspace we ever provisioned, so there is nothing to dispose).
|
|
48
|
-
*/
|
|
49
|
-
export declare function withSandbox<T>(ctx: SandboxRunContext, fn: (sandbox: Sandbox, provisioned: ProvisionResult) => Promise<T>): Promise<T>;
|
|
50
|
-
/**
|
|
51
|
-
* Run one agent turn through any backend. Replaces `executeDocker` /
|
|
52
|
-
* `executeSmol` / `executeInProcess` — the three slightly-different fallback
|
|
53
|
-
* paths are converged into the single catch below.
|
|
54
|
-
*/
|
|
55
|
-
export declare function runSandboxedAgent(prompt: string, ctx: SandboxRunContext): Promise<ExecutionResult>;
|
|
56
|
-
/** What a command phase runs. */
|
|
57
|
-
export type CommandSpec = {
|
|
58
|
-
kind: "bash";
|
|
59
|
-
command: string;
|
|
60
|
-
} | {
|
|
61
|
-
kind: "script";
|
|
62
|
-
script: string;
|
|
63
|
-
runtime: "js" | "ts" | "python";
|
|
64
|
-
name: string;
|
|
65
|
-
};
|
|
66
|
-
/** Options for {@link runSandboxedCommand}. */
|
|
67
|
-
export interface CommandRunOpts {
|
|
68
|
-
/** Per-step timeout in seconds (default 300). */
|
|
69
|
-
timeoutSeconds?: number;
|
|
70
|
-
/** Extra env forwarded into the command (e.g. upstream phase outputs). */
|
|
71
|
-
sandboxEnv?: Record<string, string>;
|
|
72
|
-
/** Mirror output to a session jsonl (default true; false for internal checks). */
|
|
73
|
-
writeSession?: boolean;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Execute a deterministic command/script in the same workspace an agent phase
|
|
77
|
-
* would use — no LLM. Replaces the three-way fork that lived in
|
|
78
|
-
* `executeCommand`. Writes a session jsonl so the output is visible in the
|
|
79
|
-
* dashboard + CLI.
|
|
80
|
-
*/
|
|
81
|
-
export declare function runSandboxedCommand(spec: CommandSpec, ctx: SandboxRunContext, cmdOpts: CommandRunOpts): Promise<ExecutionResult>;
|
|
@@ -1,365 +0,0 @@
|
|
|
1
|
-
import { basename, join } from "path";
|
|
2
|
-
import { existsSync, mkdirSync, writeFileSync } from "fs";
|
|
3
|
-
import { resolveAuthFile } from "../oauth.js";
|
|
4
|
-
import { randomUUID } from "crypto";
|
|
5
|
-
import { getBotName, getRuntimeConfig } from "../../config/config.js";
|
|
6
|
-
import { agentGitIdentityEnv, sandboxFor, } from "../../sandbox/sandbox.js";
|
|
7
|
-
import { SANDBOX_IMAGE_QA } from "../../sandbox/index.js";
|
|
8
|
-
import { DEFAULT_ALLOWLIST, mergeAllowlist } from "../../sandbox/egress-allowlist.js";
|
|
9
|
-
import { AGENTIC_PROFILE_FOR, loadAgentContext, } from "../github/profiles.js";
|
|
10
|
-
import { AgenticShim } from "../event-shim.js";
|
|
11
|
-
import { projectSlugForCwd } from "../../session-log.js";
|
|
12
|
-
import { recordError, recordExecutionMetrics } from "../../telemetry/index.js";
|
|
13
|
-
import { recordPiEvent } from "../../telemetry/pi-events.js";
|
|
14
|
-
import { DEFAULT_MODEL, RunResultAccumulator, coerceThinking, emptyResult, finalizeFromRunResult, harvestArtifactsOut, resolveSessionsDir, serverArtifacts, skillBundleKey, stageArtifactsIn, } from "./shared.js";
|
|
15
|
-
/**
|
|
16
|
-
* Compute the run's intent-only egress policy once: `unrestricted` for a phase
|
|
17
|
-
* that opted out, otherwise the default allowlist merged with any OTEL
|
|
18
|
-
* collector hosts. Each adapter translates this to its own mechanism.
|
|
19
|
-
*/
|
|
20
|
-
export function egressPolicyFor(config) {
|
|
21
|
-
if (config.unrestrictedEgress)
|
|
22
|
-
return { unrestricted: true, hosts: [] };
|
|
23
|
-
const extraHosts = config.otel?.enabled && config.otel.forwardToSandbox ? config.otel.collectorHosts : [];
|
|
24
|
-
return { unrestricted: false, hosts: mergeAllowlist(DEFAULT_ALLOWLIST, extraHosts) };
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* The provision → work → dispose bracket. Builds the adapter via the factory
|
|
28
|
-
* (or the injected one), provisions the workspace, runs `fn`, and disposes in a
|
|
29
|
-
* `finally` once provisioned. A provision failure propagates to the caller (it
|
|
30
|
-
* is not a workspace we ever provisioned, so there is nothing to dispose).
|
|
31
|
-
*/
|
|
32
|
-
export async function withSandbox(ctx, fn) {
|
|
33
|
-
const factory = ctx.sandboxFactory ?? sandboxFor;
|
|
34
|
-
const sandbox = factory(ctx.backend, {
|
|
35
|
-
taskId: ctx.taskId,
|
|
36
|
-
egress: egressPolicyFor(ctx.config),
|
|
37
|
-
env: ctx.env,
|
|
38
|
-
stateDir: ctx.stateDir,
|
|
39
|
-
sandboxDir: ctx.config.sandboxDir,
|
|
40
|
-
repoSubdir: ctx.config.repoSubdir,
|
|
41
|
-
imageName: ctx.config.sandboxImage === "qa" ? SANDBOX_IMAGE_QA : undefined,
|
|
42
|
-
otel: ctx.config.otel,
|
|
43
|
-
});
|
|
44
|
-
let provisioned;
|
|
45
|
-
try {
|
|
46
|
-
provisioned = await sandbox.provision(ctx.prePopulate);
|
|
47
|
-
return await fn(sandbox, provisioned);
|
|
48
|
-
}
|
|
49
|
-
finally {
|
|
50
|
-
if (provisioned)
|
|
51
|
-
await sandbox.dispose();
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
/** Drop AGENTS.md into the workspace — agentic-pi reads it as system context. */
|
|
55
|
-
function writeAgentsMd(hostWorkspaceDir, config) {
|
|
56
|
-
try {
|
|
57
|
-
const md = loadAgentContext(config.agentContextDir);
|
|
58
|
-
if (md)
|
|
59
|
-
writeFileSync(join(hostWorkspaceDir, "AGENTS.md"), md);
|
|
60
|
-
}
|
|
61
|
-
catch (err) {
|
|
62
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
63
|
-
console.warn(`[executor] Could not write AGENTS.md: ${msg}`);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/** Host path of the repo checkout (for build-artifact stage/harvest). */
|
|
67
|
-
function hostRepoDirFor(prov, prePopulate) {
|
|
68
|
-
return prePopulate ? join(prov.hostWorkspaceDir, prePopulate.repo) : prov.hostWorkspaceDir;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Run one agent turn through any backend. Replaces `executeDocker` /
|
|
72
|
-
* `executeSmol` / `executeInProcess` — the three slightly-different fallback
|
|
73
|
-
* paths are converged into the single catch below.
|
|
74
|
-
*/
|
|
75
|
-
export async function runSandboxedAgent(prompt, ctx) {
|
|
76
|
-
const { config, access } = ctx;
|
|
77
|
-
const startTime = Date.now();
|
|
78
|
-
const model = config.model || DEFAULT_MODEL;
|
|
79
|
-
const thinking = coerceThinking(config.variant);
|
|
80
|
-
const profile = access ? AGENTIC_PROFILE_FOR[access.profile] : undefined;
|
|
81
|
-
const sessionsDir = resolveSessionsDir(config);
|
|
82
|
-
return withSandbox(ctx, async (sandbox, prov) => {
|
|
83
|
-
console.log(` [executor] Running agent (task: ${ctx.taskId}, sandbox: ${ctx.backend})`);
|
|
84
|
-
writeAgentsMd(prov.hostWorkspaceDir, config);
|
|
85
|
-
// Stage this phase's skills (adapter decides symlink/copy + path mapping).
|
|
86
|
-
let skillDirs;
|
|
87
|
-
try {
|
|
88
|
-
skillDirs = sandbox.stageSkills(skillBundleKey(config), config.skillPaths);
|
|
89
|
-
}
|
|
90
|
-
catch (err) {
|
|
91
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
92
|
-
console.warn(`[executor] Could not stage skills: ${msg}`);
|
|
93
|
-
}
|
|
94
|
-
// Server-mode build assets: stage in before, harvest after (even on error).
|
|
95
|
-
const artifacts = serverArtifacts(config, hostRepoDirFor(prov, ctx.prePopulate));
|
|
96
|
-
stageArtifactsIn(artifacts);
|
|
97
|
-
const shim = new AgenticShim({
|
|
98
|
-
homeDir: sessionsDir,
|
|
99
|
-
projectSlug: projectSlugForCwd(prov.agentCwd),
|
|
100
|
-
model,
|
|
101
|
-
initialPrompt: prompt,
|
|
102
|
-
});
|
|
103
|
-
const acc = new RunResultAccumulator();
|
|
104
|
-
let notifiedSessionId = false;
|
|
105
|
-
const onEvent = (record) => {
|
|
106
|
-
acc.feed(record);
|
|
107
|
-
shim.feed(record);
|
|
108
|
-
recordPiEvent(record, {
|
|
109
|
-
includeContent: config.otel?.includeContent === true,
|
|
110
|
-
surface: "agent",
|
|
111
|
-
workflowName: config.telemetry?.workflowName,
|
|
112
|
-
phaseName: config.telemetry?.phaseName,
|
|
113
|
-
model,
|
|
114
|
-
});
|
|
115
|
-
if (!notifiedSessionId && ctx.onSessionId && record.type === "session" && typeof record.id === "string") {
|
|
116
|
-
notifiedSessionId = true;
|
|
117
|
-
ctx.onSessionId(record.id);
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
// OAuth credential store for model auth. Only the in-process adapters
|
|
121
|
-
// (none/gondolin) run the model call host-side, so a host path resolves
|
|
122
|
-
// there; the docker adapter ignores authFile (its model call is
|
|
123
|
-
// in-container) and relies on the OAuth env tokens spliced in by the
|
|
124
|
-
// executor. Pass the path only when the store actually exists so pure
|
|
125
|
-
// API-key deployments never point agentic-pi at a phantom file.
|
|
126
|
-
let authFile;
|
|
127
|
-
if (ctx.backend === "none" || ctx.backend === "gondolin") {
|
|
128
|
-
const candidate = resolveAuthFile(undefined, ctx.stateDir);
|
|
129
|
-
if (existsSync(candidate))
|
|
130
|
-
authFile = candidate;
|
|
131
|
-
}
|
|
132
|
-
let returned;
|
|
133
|
-
try {
|
|
134
|
-
returned = await sandbox.runAgent(ctx.taskId, prompt, {
|
|
135
|
-
model,
|
|
136
|
-
thinking,
|
|
137
|
-
profile,
|
|
138
|
-
authFile,
|
|
139
|
-
sandboxEnv: agentGitIdentityEnv(getRuntimeConfig()?.botLogin ?? `${getBotName()}[bot]`),
|
|
140
|
-
agentCwd: prov.agentCwd,
|
|
141
|
-
skillDirs,
|
|
142
|
-
webSearch: config.webSearch === true,
|
|
143
|
-
webSearchProvider: config.webSearchProvider,
|
|
144
|
-
githubApiBaseUrl: config.githubApiBaseUrl,
|
|
145
|
-
}, onEvent);
|
|
146
|
-
}
|
|
147
|
-
catch (err) {
|
|
148
|
-
// The single converged fallback path (was three near-identical catches).
|
|
149
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
150
|
-
const durationMs = Date.now() - startTime;
|
|
151
|
-
const tags = {
|
|
152
|
-
"sandbox.backend": ctx.backend,
|
|
153
|
-
model,
|
|
154
|
-
success: false,
|
|
155
|
-
stop_reason: "error_sandbox",
|
|
156
|
-
"workflow.name": config.telemetry?.workflowName,
|
|
157
|
-
"phase.name": config.telemetry?.phaseName,
|
|
158
|
-
};
|
|
159
|
-
recordError("agent", err, tags);
|
|
160
|
-
recordExecutionMetrics("agent", { ...tags, durationMs });
|
|
161
|
-
const synthesizedId = await shim
|
|
162
|
-
.finalizeWithFallback(emptyResult("error_sandbox", durationMs), `exec-${basename(ctx.taskId)}`, msg)
|
|
163
|
-
.catch(() => null);
|
|
164
|
-
harvestArtifactsOut(artifacts);
|
|
165
|
-
return {
|
|
166
|
-
success: false,
|
|
167
|
-
output: "",
|
|
168
|
-
turns: 0,
|
|
169
|
-
error: msg,
|
|
170
|
-
durationMs,
|
|
171
|
-
sessionId: synthesizedId ?? undefined,
|
|
172
|
-
stopReason: "error_sandbox",
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
harvestArtifactsOut(artifacts);
|
|
176
|
-
// Reconstruct the RunResult: the in-process adapter returns its
|
|
177
|
-
// authoritative one; docker/smol return undefined → build from the
|
|
178
|
-
// accumulated events. Either way prefer our compaction-proof per-message
|
|
179
|
-
// accumulation when it carries token data.
|
|
180
|
-
const result = returned ?? acc.build(0);
|
|
181
|
-
const better = acc.bestStats();
|
|
182
|
-
if (better && (better.tokens?.total ?? 0) > 0)
|
|
183
|
-
result.stats = better;
|
|
184
|
-
const finalResult = finalizeFromRunResult(result, prompt, shim, startTime, acc.extensions(), acc.skills(), acc.toolError(), acc.endedOnToolCall());
|
|
185
|
-
recordExecutionMetrics("agent", {
|
|
186
|
-
"sandbox.backend": ctx.backend,
|
|
187
|
-
model,
|
|
188
|
-
success: finalResult.success,
|
|
189
|
-
stop_reason: finalResult.stopReason,
|
|
190
|
-
durationMs: finalResult.durationMs,
|
|
191
|
-
costUsd: finalResult.costUsd,
|
|
192
|
-
inputTokens: finalResult.inputTokens,
|
|
193
|
-
outputTokens: finalResult.outputTokens,
|
|
194
|
-
"workflow.name": config.telemetry?.workflowName,
|
|
195
|
-
"phase.name": config.telemetry?.phaseName,
|
|
196
|
-
});
|
|
197
|
-
return finalResult;
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
const SCRIPT_EXT = { js: "mjs", ts: "mts", python: "py" };
|
|
201
|
-
/**
|
|
202
|
-
* Where a `type: script` source file is staged. A workspace-root sibling of the
|
|
203
|
-
* skill bundle, keyed per phase (`<root>/<phase>/script.<ext>`) — so it sits
|
|
204
|
-
* beside the skills and is never written inside any checked-out repo's git tree.
|
|
205
|
-
*/
|
|
206
|
-
const SCRIPT_BUNDLE_ROOT = ".lastlight-scripts";
|
|
207
|
-
/** Build the shell invocation + on-disk filename for a script spec. */
|
|
208
|
-
function scriptInvocation(spec) {
|
|
209
|
-
const fileName = `script.${SCRIPT_EXT[spec.runtime]}`;
|
|
210
|
-
const run = (path) => {
|
|
211
|
-
switch (spec.runtime) {
|
|
212
|
-
case "js":
|
|
213
|
-
return `node ${path}`;
|
|
214
|
-
case "ts":
|
|
215
|
-
return `node --experimental-strip-types ${path}`;
|
|
216
|
-
case "python":
|
|
217
|
-
return `uv run ${path}`;
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
return { fileName, run };
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Execute a deterministic command/script in the same workspace an agent phase
|
|
224
|
-
* would use — no LLM. Replaces the three-way fork that lived in
|
|
225
|
-
* `executeCommand`. Writes a session jsonl so the output is visible in the
|
|
226
|
-
* dashboard + CLI.
|
|
227
|
-
*/
|
|
228
|
-
export async function runSandboxedCommand(spec, ctx, cmdOpts) {
|
|
229
|
-
const { config } = ctx;
|
|
230
|
-
const model = config.model || DEFAULT_MODEL;
|
|
231
|
-
const sessionsDir = resolveSessionsDir(config);
|
|
232
|
-
const timeoutSeconds = cmdOpts.timeoutSeconds ?? 300;
|
|
233
|
-
const startTime = Date.now();
|
|
234
|
-
const displayPrompt = spec.kind === "bash" ? `$ ${spec.command}` : `${spec.runtime} script: ${spec.name}\n\n${spec.script}`;
|
|
235
|
-
return withSandbox(ctx, async (sandbox, prov) => {
|
|
236
|
-
// Per-phase script-bundle dir, a workspace-root sibling of the skill bundle.
|
|
237
|
-
const scriptDir = spec.kind === "script" ? `${SCRIPT_BUNDLE_ROOT}/${spec.name}` : SCRIPT_BUNDLE_ROOT;
|
|
238
|
-
let command;
|
|
239
|
-
let toolInput;
|
|
240
|
-
if (spec.kind === "bash") {
|
|
241
|
-
command = spec.command;
|
|
242
|
-
toolInput = { command: spec.command };
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
const { fileName, run } = scriptInvocation(spec);
|
|
246
|
-
mkdirSync(join(prov.hostWorkspaceDir, scriptDir), { recursive: true });
|
|
247
|
-
writeFileSync(join(prov.hostWorkspaceDir, scriptDir, fileName), spec.script);
|
|
248
|
-
command = run(sandbox.sandboxPathFor(`${scriptDir}/${fileName}`));
|
|
249
|
-
toolInput = { command, runtime: spec.runtime };
|
|
250
|
-
}
|
|
251
|
-
// Forward the GitHub API base-url override (evals fake) into the command env.
|
|
252
|
-
// The agent path already threads `githubApiBaseUrl` (see runSandboxedAgent);
|
|
253
|
-
// command/script phases need the same so a GitHub-mutating script (e.g.
|
|
254
|
-
// pr-review's post-review step) hits the fake in evals. Prod-inert:
|
|
255
|
-
// `githubApiBaseUrl` is undefined outside the eval harness, so nothing is
|
|
256
|
-
// injected and the script falls back to api.github.com with its minted token.
|
|
257
|
-
const sandboxEnv = config.githubApiBaseUrl
|
|
258
|
-
? { ...(cmdOpts.sandboxEnv ?? {}), GITHUB_API_URL: config.githubApiBaseUrl }
|
|
259
|
-
: cmdOpts.sandboxEnv;
|
|
260
|
-
const res = await sandbox.runCommand(ctx.taskId, command, {
|
|
261
|
-
cwd: prov.agentCwd,
|
|
262
|
-
sandboxEnv,
|
|
263
|
-
timeoutSeconds,
|
|
264
|
-
});
|
|
265
|
-
const durationMs = Date.now() - startTime;
|
|
266
|
-
const sessionId = cmdOpts.writeSession === false
|
|
267
|
-
? null
|
|
268
|
-
: await writeCommandSession({
|
|
269
|
-
sessionsDir,
|
|
270
|
-
projectSlug: projectSlugForCwd(prov.agentCwd),
|
|
271
|
-
model,
|
|
272
|
-
displayPrompt,
|
|
273
|
-
toolName: "bash",
|
|
274
|
-
toolInput,
|
|
275
|
-
stdout: res.stdout,
|
|
276
|
-
stderr: res.stderr,
|
|
277
|
-
exitCode: res.exitCode,
|
|
278
|
-
durationMs,
|
|
279
|
-
});
|
|
280
|
-
if (sessionId && ctx.onSessionId)
|
|
281
|
-
ctx.onSessionId(sessionId);
|
|
282
|
-
return buildCommandResult(res, durationMs, sessionId);
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* Mirror a finished command into a session jsonl via the shim. Synthesizes a
|
|
287
|
-
* minimal agentic-pi event stream: session → assistant(tool_use bash) →
|
|
288
|
-
* user(tool_result) → assistant(text summary) → result. Returns the session id
|
|
289
|
-
* the shim wrote under (so the executions row can link to it).
|
|
290
|
-
*/
|
|
291
|
-
async function writeCommandSession(opts) {
|
|
292
|
-
const shim = new AgenticShim({
|
|
293
|
-
homeDir: opts.sessionsDir,
|
|
294
|
-
projectSlug: opts.projectSlug,
|
|
295
|
-
model: opts.model,
|
|
296
|
-
initialPrompt: opts.displayPrompt,
|
|
297
|
-
});
|
|
298
|
-
const sessionId = randomUUID();
|
|
299
|
-
const ts = Date.now();
|
|
300
|
-
const toolCallId = `cmd_${randomUUID().slice(0, 8)}`;
|
|
301
|
-
const feed = (record) => shim.feed(record);
|
|
302
|
-
feed({ type: "session", id: sessionId, timestamp: ts });
|
|
303
|
-
feed({
|
|
304
|
-
type: "message_end",
|
|
305
|
-
sessionId,
|
|
306
|
-
timestamp: ts,
|
|
307
|
-
message: { role: "assistant", content: [{ type: "toolCall", id: toolCallId, name: opts.toolName, arguments: opts.toolInput }] },
|
|
308
|
-
});
|
|
309
|
-
const combined = opts.stderr
|
|
310
|
-
? `${opts.stdout}${opts.stdout && !opts.stdout.endsWith("\n") ? "\n" : ""}${opts.stderr}`
|
|
311
|
-
: opts.stdout;
|
|
312
|
-
feed({
|
|
313
|
-
type: "tool_execution_end",
|
|
314
|
-
sessionId,
|
|
315
|
-
timestamp: ts,
|
|
316
|
-
toolCallId,
|
|
317
|
-
result: combined || `(no output, exit ${opts.exitCode})`,
|
|
318
|
-
isError: opts.exitCode !== 0,
|
|
319
|
-
});
|
|
320
|
-
const summary = opts.exitCode === 0 ? "Command succeeded (exit 0)." : `Command failed (exit ${opts.exitCode}).`;
|
|
321
|
-
feed({
|
|
322
|
-
type: "message_end",
|
|
323
|
-
sessionId,
|
|
324
|
-
timestamp: ts,
|
|
325
|
-
message: { role: "assistant", content: [{ type: "text", text: summary }] },
|
|
326
|
-
});
|
|
327
|
-
shim.finalize({
|
|
328
|
-
finalText: summary,
|
|
329
|
-
turns: 1,
|
|
330
|
-
costUsd: 0,
|
|
331
|
-
inputTokens: 0,
|
|
332
|
-
outputTokens: 0,
|
|
333
|
-
cacheReadInputTokens: 0,
|
|
334
|
-
cacheCreationInputTokens: 0,
|
|
335
|
-
stopReason: opts.exitCode === 0 ? "success" : "error_bash",
|
|
336
|
-
durationMs: opts.durationMs,
|
|
337
|
-
});
|
|
338
|
-
await shim.flush();
|
|
339
|
-
return shim.isInitialized ? sessionId : null;
|
|
340
|
-
}
|
|
341
|
-
/** Map a raw command result onto the ExecutionResult contract (turns 0, no cost). */
|
|
342
|
-
function buildCommandResult(res, durationMs, sessionId) {
|
|
343
|
-
const success = res.exitCode === 0;
|
|
344
|
-
const combined = res.stderr
|
|
345
|
-
? `${res.stdout}${res.stdout && !res.stdout.endsWith("\n") ? "\n" : ""}${res.stderr}`
|
|
346
|
-
: res.stdout;
|
|
347
|
-
// Strip the trailing newline so the value substitutes cleanly into a
|
|
348
|
-
// downstream command / `{{phaseOutputs.<name>}}` and can be forwarded as an
|
|
349
|
-
// `LL_OUT_<PHASE>` env var. The raw stdout/stderr is preserved in the jsonl.
|
|
350
|
-
const output = combined.replace(/\n+$/, "");
|
|
351
|
-
return {
|
|
352
|
-
success,
|
|
353
|
-
output,
|
|
354
|
-
turns: 0,
|
|
355
|
-
durationMs,
|
|
356
|
-
sessionId: sessionId ?? undefined,
|
|
357
|
-
error: success
|
|
358
|
-
? undefined
|
|
359
|
-
: res.timedOut
|
|
360
|
-
? `command timed out after ${Math.round(durationMs / 1000)}s`
|
|
361
|
-
: `command exited ${res.exitCode}`,
|
|
362
|
-
stopReason: success ? "success" : res.timedOut ? "error_timeout" : "error_bash",
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
//# sourceMappingURL=orchestrator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../../../src/engine/executors/orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAuB,MAAM,wBAAwB,CAAC;AAC3F,OAAO,EACL,mBAAmB,EACnB,UAAU,GAOX,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAA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zB,GAA4E,EAC5E,UAAkB,EAClB,SAAwB;IAExB,MAAM,OAAO,GAAG,GAAG,CAAC,QAAQ,KAAK,CAAC,CAAC;IACnC,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM;QACzB,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE;QACrF,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;IACf,qEAAqE;IACrE,4EAA4E;IAC5E,6EAA6E;IAC7E,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC5C,OAAO;QACL,OAAO;QACP,MAAM;QACN,KAAK,EAAE,CAAC;QACR,UAAU;QACV,SAAS,EAAE,SAAS,IAAI,SAAS;QACjC,KAAK,EAAE,OAAO;YACZ,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,GAAG,CAAC,QAAQ;gBACZ,CAAC,CAAC,2BAA2B,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG;gBAC7D,CAAC,CAAC,kBAAkB,GAAG,CAAC,QAAQ,EAAE;QACtC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,YAAY;KAChF,CAAC;AACJ,CAAC"}
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import type { RunResult, ThinkingLevel } from "agentic-pi";
|
|
2
|
-
import { type ExecutorConfig, type ExecutionResult, type ExtensionStatusMap, type SkillsStatus } from "../github/profiles.js";
|
|
3
|
-
import { AgenticShim } from "../event-shim.js";
|
|
4
|
-
import { BuildAssetStore, type BuildAssetRef } from "../../state/build-assets.js";
|
|
5
|
-
/**
|
|
6
|
-
* Shared building blocks for the per-backend executors
|
|
7
|
-
* ({@link ../executors/backends.ts}). These have NO dependency on the
|
|
8
|
-
* executors or the dispatcher, so the import DAG stays acyclic:
|
|
9
|
-
* shared → backends → agent-executor.
|
|
10
|
-
*/
|
|
11
|
-
export declare const DEFAULT_MODEL = "anthropic/claude-sonnet-4-6";
|
|
12
|
-
export declare const DOCKER_WORKSPACE_DIR = "/home/agent/workspace";
|
|
13
|
-
export declare const SKILL_BUNDLE_ROOT = ".lastlight-skills";
|
|
14
|
-
export declare const THINKING_LEVELS: ReadonlySet<string>;
|
|
15
|
-
/**
|
|
16
|
-
* Stage this phase's declared skills into a per-phase bundle directory at
|
|
17
|
-
* `<workspaceRoot>/.lastlight-skills/<phaseKey>/<basename>/` and return the
|
|
18
|
-
* staged skill dirs, so the caller can point pi at them explicitly (via
|
|
19
|
-
* `--skill` for docker or `skillPaths` for the in-process backends). Each
|
|
20
|
-
* skill is a directory containing SKILL.md plus any `scripts/` / `references/`
|
|
21
|
-
* / `assets/` — the whole tree comes along.
|
|
22
|
-
*
|
|
23
|
-
* Keyed by phase so concurrent phases in one workspace never touch each
|
|
24
|
-
* other's bundle: only the phase's own `<phaseKey>` subtree is cleared, so a
|
|
25
|
-
* clean slate per phase doesn't disturb a sibling phase mid-run.
|
|
26
|
-
*
|
|
27
|
-
* `mode` controls how each skill lands:
|
|
28
|
-
* - "symlink": one symlink per skill → host source. gondolin/none, where pi
|
|
29
|
-
* reads skill files host-side / through the cwd mount. Zero-copy.
|
|
30
|
-
* - "copy": recursive copy. docker, where the agent's tools run inside the
|
|
31
|
-
* container and host symlink targets wouldn't resolve; the copy lands
|
|
32
|
-
* under the bind-mounted workspace.
|
|
33
|
-
*
|
|
34
|
-
* Returns `undefined` when the phase declares no skills (after clearing its
|
|
35
|
-
* bundle), so a phase with no `skills:` gets no catalogue at all.
|
|
36
|
-
*/
|
|
37
|
-
export declare function stageSkillBundle(workspaceRoot: string, phaseKey: string, skillPaths: string[] | undefined, mode: "symlink" | "copy"): string[] | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* Sanitized per-phase key for the skill bundle directory. Phase name first
|
|
40
|
-
* (unique even for loop iterations like `reviewer_fix_1`), then workflow name,
|
|
41
|
-
* then a constant fallback — so the bundle is always isolated per phase.
|
|
42
|
-
*/
|
|
43
|
-
export declare function skillBundleKey(config: ExecutorConfig): string;
|
|
44
|
-
/**
|
|
45
|
-
* Add `entry` to a checkout's local `.git/info/exclude` (idempotent) so the
|
|
46
|
-
* agent's own `git add`/`commit` can never pick it up. This file lives inside
|
|
47
|
-
* `.git/` — it is never tracked, committed, or pushed, and it leaves the repo's
|
|
48
|
-
* real `.gitignore` untouched; the exclusion applies only to this ephemeral
|
|
49
|
-
* sandbox checkout. Used for the gondolin backend, where the skill bundle must
|
|
50
|
-
* be staged under cwd (the only mounted dir) rather than as an out-of-repo
|
|
51
|
-
* sibling. No-op when `repoDir` isn't a git checkout (e.g. the workspace root).
|
|
52
|
-
*/
|
|
53
|
-
export declare function excludeFromGit(repoDir: string, entry: string): void;
|
|
54
|
-
export interface ServerArtifacts {
|
|
55
|
-
store: BuildAssetStore;
|
|
56
|
-
ref: BuildAssetRef;
|
|
57
|
-
/** Host path to `<repo>/.lastlight/<issueKey>` (the staged doc dir). */
|
|
58
|
-
dir: string;
|
|
59
|
-
/** Host path to the repo checkout root. */
|
|
60
|
-
repoDir: string;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Resolve the server-mode artifact context for a run, or undefined when not in
|
|
64
|
-
* server mode (the default — the whole seam is then skipped and behaviour is
|
|
65
|
-
* byte-for-byte repo mode). `hostRepoDir` is the host-visible repo checkout
|
|
66
|
-
* (for docker that's the bind-mounted workspace path, not the in-container one).
|
|
67
|
-
*/
|
|
68
|
-
export declare function serverArtifacts(config: ExecutorConfig, hostRepoDir: string): ServerArtifacts | undefined;
|
|
69
|
-
/** Stage stored docs into the workspace + exclude the dir from git (server mode). */
|
|
70
|
-
export declare function stageArtifactsIn(art: ServerArtifacts | undefined): void;
|
|
71
|
-
/** Persist docs the phase wrote back to the store (server mode). */
|
|
72
|
-
export declare function harvestArtifactsOut(art: ServerArtifacts | undefined): void;
|
|
73
|
-
export declare class RunResultAccumulator {
|
|
74
|
-
private sessionId?;
|
|
75
|
-
private finalText;
|
|
76
|
-
private agentEnded;
|
|
77
|
-
private toolErrors;
|
|
78
|
-
private maxStepsReached;
|
|
79
|
-
private lastToolError?;
|
|
80
|
-
private lastAssistantHadToolCall;
|
|
81
|
-
private fatalError?;
|
|
82
|
-
private snapshotStats?;
|
|
83
|
-
private messages;
|
|
84
|
-
private assistantMessages;
|
|
85
|
-
private userMessages;
|
|
86
|
-
private toolCalls;
|
|
87
|
-
private toolResults;
|
|
88
|
-
private msgInput;
|
|
89
|
-
private msgOutput;
|
|
90
|
-
private msgCacheRead;
|
|
91
|
-
private msgCacheWrite;
|
|
92
|
-
private msgCost;
|
|
93
|
-
private ext;
|
|
94
|
-
private skillsRaw?;
|
|
95
|
-
feed(r: Record<string, unknown>): void;
|
|
96
|
-
private accumulateUsage;
|
|
97
|
-
/** Stats summed from per-message usage, or undefined if none was seen. */
|
|
98
|
-
private accumulatedStats;
|
|
99
|
-
/**
|
|
100
|
-
* Prefer the per-message accumulation (compaction-proof) over pi's
|
|
101
|
-
* terminal `usage_snapshot`. Fall back to the snapshot only when the
|
|
102
|
-
* accumulation carries no token data — e.g. a provider that doesn't
|
|
103
|
-
* report per-message usage — so a non-compacted snapshot still wins.
|
|
104
|
-
*/
|
|
105
|
-
bestStats(): RunResult["stats"] | undefined;
|
|
106
|
-
build(exitCode: 0 | 1 | 2): RunResult;
|
|
107
|
-
/**
|
|
108
|
-
* Normalized extension status captured from `extension_status` events
|
|
109
|
-
* (file-search / github / web-search), or undefined if none reported.
|
|
110
|
-
* Decoupled from agentic-pi's `RunResult` type, which lags the runtime —
|
|
111
|
-
* the docker sandbox's agentic-pi emits file-search even when the harness's
|
|
112
|
-
* pinned `RunResult` type doesn't yet declare it.
|
|
113
|
-
*/
|
|
114
|
-
extensions(): ExtensionStatusMap | undefined;
|
|
115
|
-
/**
|
|
116
|
-
* Normalized skill-loading status from the gated `skills_status` event, or
|
|
117
|
-
* undefined if none was reported (agentic-pi suppresses it on a run that
|
|
118
|
-
* configured no skills and discovered none). The skill-loading counterpart
|
|
119
|
-
* to {@link extensions}.
|
|
120
|
-
*/
|
|
121
|
-
skills(): SkillsStatus | undefined;
|
|
122
|
-
/**
|
|
123
|
-
* The last tool result that came back with `isError: true`, including the
|
|
124
|
-
* failure text — or undefined if no tool errored. This is what turns a
|
|
125
|
-
* bare `error_tool` stop reason into a human-readable cause.
|
|
126
|
-
*/
|
|
127
|
-
toolError(): {
|
|
128
|
-
tool?: string;
|
|
129
|
-
message: string;
|
|
130
|
-
} | undefined;
|
|
131
|
-
/**
|
|
132
|
-
* True iff the run's final assistant turn ended on a tool call — meaning
|
|
133
|
-
* the agent intended to keep going but the loop stopped before it could
|
|
134
|
-
* respond to the tool result and write its answer. The signal a run was
|
|
135
|
-
* truncated (step-limit) rather than genuinely finished.
|
|
136
|
-
*/
|
|
137
|
-
endedOnToolCall(): boolean;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Detect a provider account error (out of credit, quota, rate-limited, bad key)
|
|
141
|
-
* that pi may have surfaced as plain text rather than a hard failure.
|
|
142
|
-
*
|
|
143
|
-
* Critically, on a **successful** run we scan ONLY the genuine provider-error
|
|
144
|
-
* channel (`agentErrorMessage`, which `extractAgentError` already turns into a
|
|
145
|
-
* non-success stopReason when set — so it's empty here). The agent's own output
|
|
146
|
-
* (`finalText`) and tool results (`fatalError`, `toolError`) are NOT scanned on
|
|
147
|
-
* success: a legitimate `verify`/`qa-test` report or a `curl` probing a 401
|
|
148
|
-
* endpoint routinely contains "unauthorized" / "rate limit" as part of the task
|
|
149
|
-
* itself, and folding that in would wrongly fail a genuinely successful run
|
|
150
|
-
* (and drop its report). Only on a failed run do we fold those in to label why.
|
|
151
|
-
*/
|
|
152
|
-
export declare function detectAccountError(opts: {
|
|
153
|
-
success: boolean;
|
|
154
|
-
fatalErrorMessage?: string;
|
|
155
|
-
agentErrorMessage?: string;
|
|
156
|
-
finalText?: string;
|
|
157
|
-
toolErrorText?: string;
|
|
158
|
-
}): boolean;
|
|
159
|
-
export declare function finalizeFromRunResult(result: RunResult, _prompt: string, shim: AgenticShim, startTime: number, extensions?: ExtensionStatusMap, skills?: SkillsStatus, toolError?: {
|
|
160
|
-
tool?: string;
|
|
161
|
-
message: string;
|
|
162
|
-
}, endedOnToolCall?: boolean): ExecutionResult;
|
|
163
|
-
export declare function mapStopReason(result: RunResult): string;
|
|
164
|
-
/**
|
|
165
|
-
* Scan agent_end's messages for a failed assistant turn. pi-agent-core's
|
|
166
|
-
* `handleRunFailure` catches provider errors, synthesizes an assistant
|
|
167
|
-
* message with stopReason "error"/"aborted" + errorMessage, and emits a
|
|
168
|
-
* normal agent_end — so the only signal that the run actually failed
|
|
169
|
-
* lives on the last assistant message.
|
|
170
|
-
*/
|
|
171
|
-
export declare function extractAgentError(result: RunResult): {
|
|
172
|
-
stopReason: string;
|
|
173
|
-
errorMessage: string;
|
|
174
|
-
} | undefined;
|
|
175
|
-
export declare function coerceThinking(raw: string | undefined): ThinkingLevel | undefined;
|
|
176
|
-
export declare function resolveSessionsDir(config: ExecutorConfig): string;
|
|
177
|
-
export declare function emptyResult(stopReason: string, durationMs: number): {
|
|
178
|
-
finalText: string;
|
|
179
|
-
turns: number;
|
|
180
|
-
costUsd: number;
|
|
181
|
-
inputTokens: number;
|
|
182
|
-
outputTokens: number;
|
|
183
|
-
cacheReadInputTokens: number;
|
|
184
|
-
cacheCreationInputTokens: number;
|
|
185
|
-
stopReason: string;
|
|
186
|
-
durationMs: number;
|
|
187
|
-
};
|
|
188
|
-
/** Splice values into process.env for the duration of a sync block. */
|
|
189
|
-
export declare function applyEnv(env: Record<string, string>): () => void;
|