@elie-laloum/outpost 5.0.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +54 -0
- package/README.md +11 -11
- package/SECURITY.md +10 -0
- package/dist/adapters/agents/antigravity-adapter.d.ts +3 -0
- package/dist/adapters/agents/antigravity-adapter.js +41 -0
- package/dist/adapters/agents/antigravity-adapter.js.map +1 -0
- package/dist/adapters/agents/antigravity-authentication.d.ts +2 -0
- package/dist/adapters/agents/antigravity-authentication.js +27 -0
- package/dist/adapters/agents/antigravity-authentication.js.map +1 -0
- package/dist/adapters/agents/antigravity-diagnostics.d.ts +1 -0
- package/dist/adapters/agents/antigravity-diagnostics.js +6 -0
- package/dist/adapters/agents/antigravity-diagnostics.js.map +1 -0
- package/dist/adapters/agents/antigravity-events.d.ts +2 -0
- package/dist/adapters/agents/antigravity-events.js +75 -0
- package/dist/adapters/agents/antigravity-events.js.map +1 -0
- package/dist/adapters/agents/antigravity-request.d.ts +5 -0
- package/dist/adapters/agents/antigravity-request.js +37 -0
- package/dist/adapters/agents/antigravity-request.js.map +1 -0
- package/dist/adapters/agents/antigravity.constants.d.ts +3 -0
- package/dist/adapters/agents/antigravity.constants.js +4 -0
- package/dist/adapters/agents/antigravity.constants.js.map +1 -0
- package/dist/adapters/agents/{gemini.types.d.ts → antigravity.types.d.ts} +2 -2
- package/dist/adapters/agents/antigravity.types.js +2 -0
- package/dist/adapters/agents/antigravity.types.js.map +1 -0
- package/dist/adapters/agents/authentication.constants.d.ts +19 -9
- package/dist/adapters/agents/authentication.constants.js +12 -9
- package/dist/adapters/agents/authentication.constants.js.map +1 -1
- package/dist/adapters/agents/authentication.d.ts +11 -2
- package/dist/adapters/agents/authentication.js +70 -47
- package/dist/adapters/agents/authentication.js.map +1 -1
- package/dist/adapters/agents/authentication.types.d.ts +20 -0
- package/dist/adapters/agents/authentication.types.js +2 -0
- package/dist/adapters/agents/authentication.types.js.map +1 -0
- package/dist/adapters/agents/claude-adapter.js +4 -2
- package/dist/adapters/agents/claude-adapter.js.map +1 -1
- package/dist/adapters/agents/claude-authentication.d.ts +2 -0
- package/dist/adapters/agents/claude-authentication.js +34 -0
- package/dist/adapters/agents/claude-authentication.js.map +1 -0
- package/dist/adapters/agents/claude-events.js +52 -9
- package/dist/adapters/agents/claude-events.js.map +1 -1
- package/dist/adapters/agents/claude-request.js +2 -0
- package/dist/adapters/agents/claude-request.js.map +1 -1
- package/dist/adapters/agents/cli-diagnostics.constants.d.ts +6 -6
- package/dist/adapters/agents/cli-diagnostics.constants.js +6 -6
- package/dist/adapters/agents/cli-diagnostics.constants.js.map +1 -1
- package/dist/adapters/agents/cli-diagnostics.d.ts +1 -0
- package/dist/adapters/agents/cli-diagnostics.js +18 -0
- package/dist/adapters/agents/cli-diagnostics.js.map +1 -1
- package/dist/adapters/agents/codex-adapter.js +4 -2
- package/dist/adapters/agents/codex-adapter.js.map +1 -1
- package/dist/adapters/agents/codex-authentication.d.ts +3 -0
- package/dist/adapters/agents/codex-authentication.js +47 -0
- package/dist/adapters/agents/codex-authentication.js.map +1 -0
- package/dist/adapters/agents/codex-events.js +28 -2
- package/dist/adapters/agents/codex-events.js.map +1 -1
- package/dist/adapters/agents/copilot-adapter.d.ts +3 -0
- package/dist/adapters/agents/copilot-adapter.js +45 -0
- package/dist/adapters/agents/copilot-adapter.js.map +1 -0
- package/dist/adapters/agents/copilot-authentication.d.ts +2 -0
- package/dist/adapters/agents/copilot-authentication.js +46 -0
- package/dist/adapters/agents/copilot-authentication.js.map +1 -0
- package/dist/adapters/agents/copilot-diagnostics.d.ts +1 -0
- package/dist/adapters/agents/copilot-diagnostics.js +6 -0
- package/dist/adapters/agents/copilot-diagnostics.js.map +1 -0
- package/dist/adapters/agents/copilot-events.d.ts +2 -0
- package/dist/adapters/agents/copilot-events.js +66 -0
- package/dist/adapters/agents/copilot-events.js.map +1 -0
- package/dist/adapters/agents/copilot-request.d.ts +5 -0
- package/dist/adapters/agents/copilot-request.js +24 -0
- package/dist/adapters/agents/copilot-request.js.map +1 -0
- package/dist/adapters/agents/copilot-usage.d.ts +3 -0
- package/dist/adapters/agents/copilot-usage.js +19 -0
- package/dist/adapters/agents/copilot-usage.js.map +1 -0
- package/dist/adapters/agents/copilot.types.d.ts +6 -0
- package/dist/adapters/agents/copilot.types.js +2 -0
- package/dist/adapters/agents/copilot.types.js.map +1 -0
- package/dist/adapters/agents/event-decoder.d.ts +2 -2
- package/dist/adapters/agents/event-decoder.js +6 -5
- package/dist/adapters/agents/event-decoder.js.map +1 -1
- package/dist/adapters/agents/kimi-adapter.d.ts +3 -0
- package/dist/adapters/agents/kimi-adapter.js +51 -0
- package/dist/adapters/agents/kimi-adapter.js.map +1 -0
- package/dist/adapters/agents/kimi-authentication.d.ts +3 -0
- package/dist/adapters/agents/kimi-authentication.js +63 -0
- package/dist/adapters/agents/kimi-authentication.js.map +1 -0
- package/dist/adapters/agents/kimi-diagnostics.d.ts +2 -0
- package/dist/adapters/agents/kimi-diagnostics.js +14 -0
- package/dist/adapters/agents/kimi-diagnostics.js.map +1 -0
- package/dist/adapters/agents/kimi-events.d.ts +2 -0
- package/dist/adapters/agents/kimi-events.js +55 -0
- package/dist/adapters/agents/kimi-events.js.map +1 -0
- package/dist/adapters/agents/kimi-fork.d.ts +2 -0
- package/dist/adapters/agents/kimi-fork.js +11 -0
- package/dist/adapters/agents/kimi-fork.js.map +1 -0
- package/dist/adapters/agents/{gemini-request.d.ts → kimi-request.d.ts} +2 -2
- package/dist/adapters/agents/kimi-request.js +33 -0
- package/dist/adapters/agents/kimi-request.js.map +1 -0
- package/dist/adapters/agents/kimi-usage.d.ts +2 -0
- package/dist/adapters/agents/kimi-usage.js +7 -0
- package/dist/adapters/agents/kimi-usage.js.map +1 -0
- package/dist/adapters/agents/kimi.constants.d.ts +13 -0
- package/dist/adapters/agents/kimi.constants.js +14 -0
- package/dist/adapters/agents/kimi.constants.js.map +1 -0
- package/dist/adapters/agents/kimi.types.d.ts +7 -0
- package/dist/adapters/agents/kimi.types.js +2 -0
- package/dist/adapters/agents/kimi.types.js.map +1 -0
- package/dist/adapters/agents/model-support.constants.d.ts +3 -1
- package/dist/adapters/agents/model-support.constants.js +12 -2
- package/dist/adapters/agents/model-support.constants.js.map +1 -1
- package/dist/adapters/agents/protocol-fixtures.constants.d.ts +2 -2
- package/dist/adapters/agents/protocol-fixtures.constants.js +131 -9
- package/dist/adapters/agents/protocol-fixtures.constants.js.map +1 -1
- package/dist/adapters/agents/protocol-fixtures.types.d.ts +1 -0
- package/dist/adapters/agents/protocol-fixtures.types.js.map +1 -1
- package/dist/adapters/agents/protocol.d.ts +1 -0
- package/dist/adapters/agents/protocol.js +9 -0
- package/dist/adapters/agents/protocol.js.map +1 -1
- package/dist/adapters/agents/session-usage.constants.d.ts +10 -0
- package/dist/adapters/agents/session-usage.constants.js +110 -0
- package/dist/adapters/agents/session-usage.constants.js.map +1 -0
- package/dist/adapters/agents/session-usage.d.ts +5 -0
- package/dist/adapters/agents/session-usage.js +45 -0
- package/dist/adapters/agents/session-usage.js.map +1 -0
- package/dist/adapters/agents/settings.types.d.ts +1 -0
- package/dist/adapters/agents/settings.types.js.map +1 -1
- package/dist/adapters/agents/tool-result.d.ts +2 -0
- package/dist/adapters/agents/tool-result.js +17 -0
- package/dist/adapters/agents/tool-result.js.map +1 -0
- package/dist/adapters/models/anthropic-response.js +3 -0
- package/dist/adapters/models/anthropic-response.js.map +1 -1
- package/dist/adapters/models/http-provider.js +6 -1
- package/dist/adapters/models/http-provider.js.map +1 -1
- package/dist/adapters/models/openai-responses.js +10 -0
- package/dist/adapters/models/openai-responses.js.map +1 -1
- package/dist/adapters/models/retry-after.d.ts +1 -0
- package/dist/adapters/models/retry-after.js +16 -0
- package/dist/adapters/models/retry-after.js.map +1 -0
- package/dist/application/activity-watchdog.js +1 -2
- package/dist/application/activity-watchdog.js.map +1 -1
- package/dist/application/agent-authentication.d.ts +4 -0
- package/dist/application/agent-authentication.js +32 -0
- package/dist/application/agent-authentication.js.map +1 -0
- package/dist/application/agent-bootstrap.constants.d.ts +2 -5
- package/dist/application/agent-bootstrap.constants.js +27 -4
- package/dist/application/agent-bootstrap.constants.js.map +1 -1
- package/dist/application/agent-bootstrap.js +39 -12
- package/dist/application/agent-bootstrap.js.map +1 -1
- package/dist/application/agent-bootstrap.types.d.ts +19 -0
- package/dist/application/agent-bootstrap.types.js +2 -0
- package/dist/application/agent-bootstrap.types.js.map +1 -0
- package/dist/application/agent-output.js +74 -8
- package/dist/application/agent-output.js.map +1 -1
- package/dist/application/agent-request.d.ts +3 -0
- package/dist/application/agent-request.js +11 -0
- package/dist/application/agent-request.js.map +1 -0
- package/dist/application/agent-turn.js +74 -6
- package/dist/application/agent-turn.js.map +1 -1
- package/dist/application/agent-usage.d.ts +6 -0
- package/dist/application/agent-usage.js +57 -0
- package/dist/application/agent-usage.js.map +1 -0
- package/dist/application/attach.js +2 -0
- package/dist/application/attach.js.map +1 -1
- package/dist/application/credential-installer.constants.d.ts +1 -0
- package/dist/application/credential-installer.constants.js +22 -0
- package/dist/application/credential-installer.constants.js.map +1 -0
- package/dist/application/custom-turn.js +44 -49
- package/dist/application/custom-turn.js.map +1 -1
- package/dist/application/dispatch-observation.d.ts +1 -1
- package/dist/application/dispatch-observation.js +141 -21
- package/dist/application/dispatch-observation.js.map +1 -1
- package/dist/application/dispatch-observation.types.d.ts +2 -0
- package/dist/application/dispatch-observation.types.js.map +1 -1
- package/dist/application/dispatch-validation.js +2 -0
- package/dist/application/dispatch-validation.js.map +1 -1
- package/dist/application/dispatch.js +1 -1
- package/dist/application/dispatch.js.map +1 -1
- package/dist/application/doctor-agent.constants.d.ts +2 -8
- package/dist/application/doctor-agent.constants.js +43 -6
- package/dist/application/doctor-agent.constants.js.map +1 -1
- package/dist/application/doctor-agent.d.ts +2 -1
- package/dist/application/doctor-agent.js +15 -3
- package/dist/application/doctor-agent.js.map +1 -1
- package/dist/application/doctor-image.js +4 -6
- package/dist/application/doctor-image.js.map +1 -1
- package/dist/application/doctor-protocol.js +6 -11
- package/dist/application/doctor-protocol.js.map +1 -1
- package/dist/application/doctor-protocol.types.d.ts +1 -1
- package/dist/application/doctor-protocol.types.js.map +1 -1
- package/dist/application/doctor-sandbox.js +2 -5
- package/dist/application/doctor-sandbox.js.map +1 -1
- package/dist/application/doctor.js +28 -10
- package/dist/application/doctor.js.map +1 -1
- package/dist/application/doctor.types.d.ts +10 -1
- package/dist/application/doctor.types.js.map +1 -1
- package/dist/application/execution.constants.d.ts +2 -0
- package/dist/application/execution.constants.js +2 -0
- package/dist/application/execution.constants.js.map +1 -1
- package/dist/application/execution.types.d.ts +8 -0
- package/dist/application/execution.types.js.map +1 -1
- package/dist/application/harness-budget.d.ts +3 -0
- package/dist/application/harness-budget.js +42 -0
- package/dist/application/harness-budget.js.map +1 -0
- package/dist/application/harness-budget.types.d.ts +5 -0
- package/dist/application/harness-budget.types.js +2 -0
- package/dist/application/harness-budget.types.js.map +1 -0
- package/dist/application/harness-hooks.js +34 -3
- package/dist/application/harness-hooks.js.map +1 -1
- package/dist/application/harness-loop.js +52 -24
- package/dist/application/harness-loop.js.map +1 -1
- package/dist/application/harness-model-provider.d.ts +3 -0
- package/dist/application/harness-model-provider.js +49 -0
- package/dist/application/harness-model-provider.js.map +1 -0
- package/dist/application/harness-model-provider.types.d.ts +10 -0
- package/dist/application/harness-model-provider.types.js +2 -0
- package/dist/application/harness-model-provider.types.js.map +1 -0
- package/dist/application/harness-subagent.d.ts +4 -0
- package/dist/application/harness-subagent.js +110 -0
- package/dist/application/harness-subagent.js.map +1 -0
- package/dist/application/harness.types.d.ts +11 -0
- package/dist/application/harness.types.js.map +1 -1
- package/dist/application/lifecycle-hooks.d.ts +1 -1
- package/dist/application/lifecycle-hooks.js +5 -4
- package/dist/application/lifecycle-hooks.js.map +1 -1
- package/dist/application/observed-lease.d.ts +3 -0
- package/dist/application/observed-lease.js +26 -0
- package/dist/application/observed-lease.js.map +1 -0
- package/dist/application/outpost.types.d.ts +3 -1
- package/dist/application/outpost.types.js.map +1 -1
- package/dist/application/output-lines.d.ts +4 -0
- package/dist/application/output-lines.js +28 -0
- package/dist/application/output-lines.js.map +1 -0
- package/dist/application/queue-worker.js +1 -1
- package/dist/application/queue-worker.js.map +1 -1
- package/dist/application/queue-worker.types.d.ts +1 -0
- package/dist/application/queue-worker.types.js.map +1 -1
- package/dist/application/queued-task.js +24 -5
- package/dist/application/queued-task.js.map +1 -1
- package/dist/application/recovery-archive.d.ts +3 -2
- package/dist/application/recovery-archive.js +9 -2
- package/dist/application/recovery-archive.js.map +1 -1
- package/dist/application/recovery-restore.d.ts +3 -2
- package/dist/application/recovery-restore.js +9 -2
- package/dist/application/recovery-restore.js.map +1 -1
- package/dist/application/recovery-retention.d.ts +3 -2
- package/dist/application/recovery-retention.js +74 -26
- package/dist/application/recovery-retention.js.map +1 -1
- package/dist/application/remote-workspace.js +5 -4
- package/dist/application/remote-workspace.js.map +1 -1
- package/dist/application/remote-workspace.types.d.ts +1 -0
- package/dist/application/remote-workspace.types.js.map +1 -1
- package/dist/application/sandbox-agents.js +19 -19
- package/dist/application/sandbox-agents.js.map +1 -1
- package/dist/application/sandbox-attach.js +12 -3
- package/dist/application/sandbox-attach.js.map +1 -1
- package/dist/application/sandbox-dispatch.js +13 -27
- package/dist/application/sandbox-dispatch.js.map +1 -1
- package/dist/application/sandbox-provision.js +15 -9
- package/dist/application/sandbox-provision.js.map +1 -1
- package/dist/application/sandbox-session.types.d.ts +7 -2
- package/dist/application/sandbox-session.types.js.map +1 -1
- package/dist/application/sandbox.js +13 -6
- package/dist/application/sandbox.js.map +1 -1
- package/dist/application/speculation-checkpoint.d.ts +6 -0
- package/dist/application/speculation-checkpoint.js +206 -0
- package/dist/application/speculation-checkpoint.js.map +1 -0
- package/dist/application/speculation-checkpoint.types.d.ts +24 -0
- package/dist/application/speculation-checkpoint.types.js +2 -0
- package/dist/application/speculation-checkpoint.types.js.map +1 -0
- package/dist/application/speculation-integration.constants.d.ts +4 -0
- package/dist/application/speculation-integration.constants.js +5 -0
- package/dist/application/speculation-integration.constants.js.map +1 -0
- package/dist/application/speculation-integration.d.ts +2 -0
- package/dist/application/speculation-integration.js +67 -0
- package/dist/application/speculation-integration.js.map +1 -0
- package/dist/application/speculation-resume.d.ts +4 -0
- package/dist/application/speculation-resume.js +71 -0
- package/dist/application/speculation-resume.js.map +1 -0
- package/dist/application/speculation-run.d.ts +4 -0
- package/dist/application/speculation-run.js +320 -0
- package/dist/application/speculation-run.js.map +1 -0
- package/dist/application/speculation-timeout.d.ts +1 -0
- package/dist/application/speculation-timeout.js +15 -0
- package/dist/application/speculation-timeout.js.map +1 -0
- package/dist/application/speculation.constants.d.ts +1 -0
- package/dist/application/speculation.constants.js +5 -1
- package/dist/application/speculation.constants.js.map +1 -1
- package/dist/application/speculation.js +41 -149
- package/dist/application/speculation.js.map +1 -1
- package/dist/application/speculation.types.d.ts +23 -0
- package/dist/application/speculation.types.js.map +1 -1
- package/dist/application/startup-recovery.js +14 -1
- package/dist/application/startup-recovery.js.map +1 -1
- package/dist/application/startup-recovery.types.d.ts +1 -0
- package/dist/application/startup-recovery.types.js.map +1 -1
- package/dist/application/stop-reason.d.ts +2 -0
- package/dist/application/stop-reason.js +21 -0
- package/dist/application/stop-reason.js.map +1 -0
- package/dist/application/stop-reason.types.d.ts +4 -0
- package/dist/application/stop-reason.types.js +2 -0
- package/dist/application/stop-reason.types.js.map +1 -0
- package/dist/application/storage-reservation.js +9 -2
- package/dist/application/storage-reservation.js.map +1 -1
- package/dist/application/task-observation.d.ts +3 -0
- package/dist/application/task-observation.js +22 -0
- package/dist/application/task-observation.js.map +1 -0
- package/dist/application/task-usage.js +5 -12
- package/dist/application/task-usage.js.map +1 -1
- package/dist/application/tasks.js +41 -16
- package/dist/application/tasks.js.map +1 -1
- package/dist/application/tool-execution.js +42 -19
- package/dist/application/tool-execution.js.map +1 -1
- package/dist/application/workspace.js +6 -4
- package/dist/application/workspace.js.map +1 -1
- package/dist/cli/doctor-command.js +6 -2
- package/dist/cli/doctor-command.js.map +1 -1
- package/dist/cli/init-authentication.d.ts +4 -1
- package/dist/cli/init-authentication.js +28 -33
- package/dist/cli/init-authentication.js.map +1 -1
- package/dist/cli/init-command.js +3 -3
- package/dist/cli/init-command.js.map +1 -1
- package/dist/cli/main.constants.d.ts +50 -13
- package/dist/cli/main.constants.js +70 -8
- package/dist/cli/main.constants.js.map +1 -1
- package/dist/cli/main.js +2 -1
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/scaffold-files.js +1 -1
- package/dist/cli/scaffold-files.js.map +1 -1
- package/dist/cli/scaffold-validation.js +29 -22
- package/dist/cli/scaffold-validation.js.map +1 -1
- package/dist/cli/scaffold.constants.d.ts +0 -1
- package/dist/cli/scaffold.constants.js +6 -2
- package/dist/cli/scaffold.constants.js.map +1 -1
- package/dist/cli/scaffold.types.d.ts +8 -2
- package/dist/cli/scaffold.types.js.map +1 -1
- package/dist/cli/starters.js +1 -3
- package/dist/cli/starters.js.map +1 -1
- package/dist/domain/agent-observation.d.ts +4 -0
- package/dist/domain/agent-observation.js +27 -0
- package/dist/domain/agent-observation.js.map +1 -0
- package/dist/domain/agent.types.d.ts +122 -14
- package/dist/domain/agent.types.js.map +1 -1
- package/dist/domain/authentication.constants.d.ts +3 -0
- package/dist/domain/authentication.constants.js +11 -0
- package/dist/domain/authentication.constants.js.map +1 -0
- package/dist/domain/authentication.d.ts +3 -0
- package/dist/domain/authentication.js +22 -0
- package/dist/domain/authentication.js.map +1 -0
- package/dist/domain/authentication.types.d.ts +5 -0
- package/dist/domain/authentication.types.js +2 -0
- package/dist/domain/authentication.types.js.map +1 -0
- package/dist/domain/harness.d.ts +2 -2
- package/dist/domain/harness.js +6 -0
- package/dist/domain/harness.js.map +1 -1
- package/dist/domain/harness.types.d.ts +4 -3
- package/dist/domain/harness.types.js.map +1 -1
- package/dist/domain/model.types.d.ts +8 -0
- package/dist/domain/model.types.js.map +1 -1
- package/dist/domain/observation.constants.d.ts +8 -0
- package/dist/domain/observation.constants.js +9 -0
- package/dist/domain/observation.constants.js.map +1 -0
- package/dist/domain/observation.d.ts +2 -0
- package/dist/domain/observation.js +190 -0
- package/dist/domain/observation.js.map +1 -0
- package/dist/domain/observation.types.d.ts +84 -0
- package/dist/domain/observation.types.js +2 -0
- package/dist/domain/observation.types.js.map +1 -0
- package/dist/domain/observed-operation.d.ts +2 -0
- package/dist/domain/observed-operation.js +30 -0
- package/dist/domain/observed-operation.js.map +1 -0
- package/dist/domain/sandbox.types.d.ts +2 -0
- package/dist/domain/sandbox.types.js.map +1 -1
- package/dist/domain/subagent.constants.d.ts +13 -0
- package/dist/domain/subagent.constants.js +9 -0
- package/dist/domain/subagent.constants.js.map +1 -0
- package/dist/domain/subagent.d.ts +4 -0
- package/dist/domain/subagent.js +28 -0
- package/dist/domain/subagent.js.map +1 -0
- package/dist/domain/subagent.types.d.ts +13 -0
- package/dist/domain/subagent.types.js +2 -0
- package/dist/domain/subagent.types.js.map +1 -0
- package/dist/domain/transcript.types.d.ts +2 -0
- package/dist/domain/transcript.types.js.map +1 -1
- package/dist/domain/usage.d.ts +1 -0
- package/dist/domain/usage.js +16 -0
- package/dist/domain/usage.js.map +1 -1
- package/dist/domain/workflow/budget.d.ts +7 -3
- package/dist/domain/workflow/budget.js +26 -0
- package/dist/domain/workflow/budget.js.map +1 -1
- package/dist/domain/workflow/budget.types.d.ts +1 -1
- package/dist/domain/workflow/budget.types.js.map +1 -1
- package/dist/domain/workflow/checkpoint-validation.js +7 -1
- package/dist/domain/workflow/checkpoint-validation.js.map +1 -1
- package/dist/domain/workflow/checkpoint.js +3 -0
- package/dist/domain/workflow/checkpoint.js.map +1 -1
- package/dist/domain/workflow/gate-validation.js +14 -1
- package/dist/domain/workflow/gate-validation.js.map +1 -1
- package/dist/domain/workflow/gates.d.ts +1 -1
- package/dist/domain/workflow/gates.js +52 -4
- package/dist/domain/workflow/gates.js.map +1 -1
- package/dist/domain/workflow/gates.types.d.ts +15 -1
- package/dist/domain/workflow/gates.types.js.map +1 -1
- package/dist/domain/workflow/idempotency.d.ts +1 -0
- package/dist/domain/workflow/idempotency.js +7 -0
- package/dist/domain/workflow/idempotency.js.map +1 -0
- package/dist/domain/workflow/retry.constants.d.ts +2 -0
- package/dist/domain/workflow/retry.constants.js +3 -0
- package/dist/domain/workflow/retry.constants.js.map +1 -0
- package/dist/domain/workflow/retry.d.ts +4 -0
- package/dist/domain/workflow/retry.js +49 -0
- package/dist/domain/workflow/retry.js.map +1 -0
- package/dist/domain/workflow/task-runner.js +9 -5
- package/dist/domain/workflow/task-runner.js.map +1 -1
- package/dist/domain/workflow/task.js +6 -6
- package/dist/domain/workflow/task.js.map +1 -1
- package/dist/domain/workflow/workflow-scheduler.js +110 -72
- package/dist/domain/workflow/workflow-scheduler.js.map +1 -1
- package/dist/domain/workflow/workflow-state.js +28 -12
- package/dist/domain/workflow/workflow-state.js.map +1 -1
- package/dist/domain/workflow.d.ts +1 -1
- package/dist/domain/workflow.js +1 -1
- package/dist/domain/workflow.js.map +1 -1
- package/dist/domain/workflow.types.d.ts +13 -2
- package/dist/domain/workflow.types.js.map +1 -1
- package/dist/index.d.ts +16 -11
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/conversations/capture.js +10 -0
- package/dist/infrastructure/conversations/capture.js.map +1 -1
- package/dist/infrastructure/conversations/harness-transcript.js +6 -0
- package/dist/infrastructure/conversations/harness-transcript.js.map +1 -1
- package/dist/infrastructure/conversations/harness-transcript.types.d.ts +2 -0
- package/dist/infrastructure/conversations/harness-transcript.types.js.map +1 -1
- package/dist/infrastructure/conversations/layout.js +2 -0
- package/dist/infrastructure/conversations/layout.js.map +1 -1
- package/dist/infrastructure/conversations/locate.js +7 -1
- package/dist/infrastructure/conversations/locate.js.map +1 -1
- package/dist/infrastructure/conversations/native-store.js +8 -1
- package/dist/infrastructure/conversations/native-store.js.map +1 -1
- package/dist/infrastructure/conversations/paths.js +3 -0
- package/dist/infrastructure/conversations/paths.js.map +1 -1
- package/dist/infrastructure/conversations/restore.js +7 -0
- package/dist/infrastructure/conversations/restore.js.map +1 -1
- package/dist/infrastructure/conversations/session-bundle.constants.d.ts +5 -0
- package/dist/infrastructure/conversations/session-bundle.constants.js +173 -0
- package/dist/infrastructure/conversations/session-bundle.constants.js.map +1 -0
- package/dist/infrastructure/conversations/session-bundle.d.ts +6 -0
- package/dist/infrastructure/conversations/session-bundle.js +98 -0
- package/dist/infrastructure/conversations/session-bundle.js.map +1 -0
- package/dist/infrastructure/conversations/session-bundle.types.d.ts +1 -0
- package/dist/infrastructure/conversations/session-bundle.types.js +2 -0
- package/dist/infrastructure/conversations/session-bundle.types.js.map +1 -0
- package/dist/infrastructure/conversations.js +4 -2
- package/dist/infrastructure/conversations.js.map +1 -1
- package/dist/infrastructure/conversations.types.d.ts +1 -1
- package/dist/infrastructure/conversations.types.js.map +1 -1
- package/dist/infrastructure/custom-reporter.js +32 -24
- package/dist/infrastructure/custom-reporter.js.map +1 -1
- package/dist/infrastructure/custom-reporter.types.d.ts +2 -0
- package/dist/infrastructure/custom-reporter.types.js.map +1 -1
- package/dist/infrastructure/git/git.constants.d.ts +1 -1
- package/dist/infrastructure/git/git.constants.js +1 -0
- package/dist/infrastructure/git/git.constants.js.map +1 -1
- package/dist/infrastructure/git/workspace-lease.js +4 -3
- package/dist/infrastructure/git/workspace-lease.js.map +1 -1
- package/dist/infrastructure/git/workspace.js +7 -6
- package/dist/infrastructure/git/workspace.js.map +1 -1
- package/dist/infrastructure/git/workspace.types.d.ts +1 -0
- package/dist/infrastructure/git/workspace.types.js.map +1 -1
- package/dist/infrastructure/host-credentials.constants.d.ts +1 -0
- package/dist/infrastructure/host-credentials.constants.js +2 -0
- package/dist/infrastructure/host-credentials.constants.js.map +1 -0
- package/dist/infrastructure/host-credentials.d.ts +4 -0
- package/dist/infrastructure/host-credentials.js +89 -0
- package/dist/infrastructure/host-credentials.js.map +1 -0
- package/dist/infrastructure/inspection-path.js +4 -3
- package/dist/infrastructure/inspection-path.js.map +1 -1
- package/dist/infrastructure/journal.constants.js +10 -1
- package/dist/infrastructure/journal.constants.js.map +1 -1
- package/dist/infrastructure/journal.d.ts +1 -1
- package/dist/infrastructure/journal.js +8 -75
- package/dist/infrastructure/journal.js.map +1 -1
- package/dist/infrastructure/journal.types.d.ts +2 -4
- package/dist/infrastructure/journal.types.js.map +1 -1
- package/dist/infrastructure/local-transport.js +9 -4
- package/dist/infrastructure/local-transport.js.map +1 -1
- package/dist/infrastructure/opentelemetry-dispatch.d.ts +3 -3
- package/dist/infrastructure/opentelemetry-dispatch.js +5 -4
- package/dist/infrastructure/opentelemetry-dispatch.js.map +1 -1
- package/dist/infrastructure/opentelemetry-observation.d.ts +5 -0
- package/dist/infrastructure/opentelemetry-observation.js +59 -0
- package/dist/infrastructure/opentelemetry-observation.js.map +1 -0
- package/dist/infrastructure/opentelemetry.js +15 -1
- package/dist/infrastructure/opentelemetry.js.map +1 -1
- package/dist/infrastructure/opentelemetry.types.d.ts +9 -1
- package/dist/infrastructure/opentelemetry.types.js.map +1 -1
- package/dist/infrastructure/reporter.d.ts +2 -2
- package/dist/infrastructure/reporter.js +5 -1
- package/dist/infrastructure/reporter.js.map +1 -1
- package/dist/infrastructure/repository-transport.constants.d.ts +1 -0
- package/dist/infrastructure/repository-transport.constants.js +2 -0
- package/dist/infrastructure/repository-transport.constants.js.map +1 -0
- package/dist/infrastructure/repository-transport.d.ts +2 -0
- package/dist/infrastructure/repository-transport.js +9 -0
- package/dist/infrastructure/repository-transport.js.map +1 -0
- package/dist/infrastructure/resource-activity-inspection.js +19 -24
- package/dist/infrastructure/resource-activity-inspection.js.map +1 -1
- package/dist/infrastructure/resource-activity.constants.d.ts +0 -1
- package/dist/infrastructure/resource-activity.constants.js +0 -1
- package/dist/infrastructure/resource-activity.constants.js.map +1 -1
- package/dist/infrastructure/resource-activity.js +20 -83
- package/dist/infrastructure/resource-activity.js.map +1 -1
- package/dist/infrastructure/s3-transport.constants.d.ts +2 -0
- package/dist/infrastructure/s3-transport.constants.js +3 -0
- package/dist/infrastructure/s3-transport.constants.js.map +1 -0
- package/dist/infrastructure/s3-transport.js +57 -3
- package/dist/infrastructure/s3-transport.js.map +1 -1
- package/dist/infrastructure/s3-transport.types.d.ts +1 -0
- package/dist/infrastructure/s3-transport.types.js.map +1 -1
- package/dist/infrastructure/speculation-store.constants.d.ts +3 -0
- package/dist/infrastructure/speculation-store.constants.js +2 -0
- package/dist/infrastructure/speculation-store.constants.js.map +1 -0
- package/dist/infrastructure/speculation-store.d.ts +4 -0
- package/dist/infrastructure/speculation-store.js +73 -0
- package/dist/infrastructure/speculation-store.js.map +1 -0
- package/dist/infrastructure/speculation-store.types.d.ts +12 -0
- package/dist/infrastructure/speculation-store.types.js +2 -0
- package/dist/infrastructure/speculation-store.types.js.map +1 -0
- package/dist/infrastructure/storage-inventory.constants.js +1 -0
- package/dist/infrastructure/storage-inventory.constants.js.map +1 -1
- package/dist/infrastructure/storage-inventory.types.d.ts +1 -1
- package/dist/infrastructure/storage-inventory.types.js.map +1 -1
- package/dist/infrastructure/storage-reservations.types.d.ts +0 -8
- package/dist/infrastructure/storage-reservations.types.js.map +1 -1
- package/dist/infrastructure/task-queue-bullmq-resources.js +3 -0
- package/dist/infrastructure/task-queue-bullmq-resources.js.map +1 -1
- package/dist/infrastructure/task-queue-http.js +29 -4
- package/dist/infrastructure/task-queue-http.js.map +1 -1
- package/dist/infrastructure/task-queue-http.types.d.ts +2 -2
- package/dist/infrastructure/task-queue-http.types.js.map +1 -1
- package/dist/infrastructure/transport-conversations.js +2 -0
- package/dist/infrastructure/transport-conversations.js.map +1 -1
- package/dist/infrastructure/transport-journal.d.ts +1 -1
- package/dist/infrastructure/transport-journal.js +8 -2
- package/dist/infrastructure/transport-journal.js.map +1 -1
- package/dist/infrastructure/transport-reservations.d.ts +1 -1
- package/dist/infrastructure/transport-reservations.js +14 -8
- package/dist/infrastructure/transport-reservations.js.map +1 -1
- package/dist/infrastructure/workflow-decision-signature.constants.d.ts +4 -0
- package/dist/infrastructure/workflow-decision-signature.constants.js +5 -0
- package/dist/infrastructure/workflow-decision-signature.constants.js.map +1 -0
- package/dist/infrastructure/workflow-decision-signature.d.ts +4 -0
- package/dist/infrastructure/workflow-decision-signature.js +83 -0
- package/dist/infrastructure/workflow-decision-signature.js.map +1 -0
- package/dist/infrastructure/workflow-decision-signature.types.d.ts +16 -0
- package/dist/infrastructure/workflow-decision-signature.types.js +2 -0
- package/dist/infrastructure/workflow-decision-signature.types.js.map +1 -0
- package/dist/providers/agents.d.ts +7 -2
- package/dist/providers/agents.js +4 -1
- package/dist/providers/agents.js.map +1 -1
- package/dist/providers/antigravity-install.constants.d.ts +2 -0
- package/dist/providers/antigravity-install.constants.js +28 -0
- package/dist/providers/antigravity-install.constants.js.map +1 -0
- package/dist/providers/antigravity-install.d.ts +2 -0
- package/dist/providers/antigravity-install.js +29 -0
- package/dist/providers/antigravity-install.js.map +1 -0
- package/dist/providers/antigravity-install.types.d.ts +4 -0
- package/dist/providers/antigravity-install.types.js +2 -0
- package/dist/providers/antigravity-install.types.js.map +1 -0
- package/dist/providers/container-recovery.d.ts +4 -0
- package/dist/providers/container-recovery.js +28 -0
- package/dist/providers/container-recovery.js.map +1 -0
- package/dist/providers/container.js +8 -0
- package/dist/providers/container.js.map +1 -1
- package/dist/providers/daytona-network.constants.d.ts +5 -0
- package/dist/providers/daytona-network.constants.js +8 -0
- package/dist/providers/daytona-network.constants.js.map +1 -0
- package/dist/providers/daytona-network.d.ts +4 -0
- package/dist/providers/daytona-network.js +33 -0
- package/dist/providers/daytona-network.js.map +1 -0
- package/dist/providers/daytona.d.ts +1 -0
- package/dist/providers/daytona.js +9 -3
- package/dist/providers/daytona.js.map +1 -1
- package/dist/providers/daytona.types.d.ts +2 -0
- package/dist/providers/daytona.types.js.map +1 -1
- package/dist/providers/firecracker-command.js +1 -1
- package/dist/providers/firecracker-command.js.map +1 -1
- package/dist/providers/firecracker-jailer.constants.d.ts +9 -0
- package/dist/providers/firecracker-jailer.constants.js +10 -0
- package/dist/providers/firecracker-jailer.constants.js.map +1 -0
- package/dist/providers/firecracker-jailer.d.ts +4 -0
- package/dist/providers/firecracker-jailer.js +171 -0
- package/dist/providers/firecracker-jailer.js.map +1 -0
- package/dist/providers/firecracker-machine.js +30 -8
- package/dist/providers/firecracker-machine.js.map +1 -1
- package/dist/providers/firecracker.types.d.ts +16 -0
- package/dist/providers/firecracker.types.js.map +1 -1
- package/dist/providers/vercel-network.js +1 -1
- package/dist/providers/vercel-network.js.map +1 -1
- package/dist/providers/vercel.js +6 -3
- package/dist/providers/vercel.js.map +1 -1
- package/dist/providers/versions.constants.d.ts +3 -1
- package/dist/providers/versions.constants.js +3 -1
- package/dist/providers/versions.constants.js.map +1 -1
- package/package.json +3 -3
- package/dist/adapters/agents/gemini-adapter.d.ts +0 -3
- package/dist/adapters/agents/gemini-adapter.js +0 -34
- package/dist/adapters/agents/gemini-adapter.js.map +0 -1
- package/dist/adapters/agents/gemini-diagnostics.d.ts +0 -2
- package/dist/adapters/agents/gemini-diagnostics.js +0 -15
- package/dist/adapters/agents/gemini-diagnostics.js.map +0 -1
- package/dist/adapters/agents/gemini-events.d.ts +0 -2
- package/dist/adapters/agents/gemini-events.js +0 -50
- package/dist/adapters/agents/gemini-events.js.map +0 -1
- package/dist/adapters/agents/gemini-request.js +0 -23
- package/dist/adapters/agents/gemini-request.js.map +0 -1
- package/dist/adapters/agents/gemini.types.js +0 -2
- package/dist/adapters/agents/gemini.types.js.map +0 -1
- package/dist/infrastructure/artifact-store.d.ts +0 -3
- package/dist/infrastructure/artifact-store.js +0 -110
- package/dist/infrastructure/artifact-store.js.map +0 -1
- package/dist/infrastructure/artifact-store.types.d.ts +0 -6
- package/dist/infrastructure/artifact-store.types.js +0 -2
- package/dist/infrastructure/artifact-store.types.js.map +0 -1
- package/dist/infrastructure/journal-retention.constants.d.ts +0 -4
- package/dist/infrastructure/journal-retention.constants.js +0 -5
- package/dist/infrastructure/journal-retention.constants.js.map +0 -1
- package/dist/infrastructure/journal-retention.d.ts +0 -2
- package/dist/infrastructure/journal-retention.js +0 -51
- package/dist/infrastructure/journal-retention.js.map +0 -1
- package/dist/infrastructure/storage-mutation-lock.constants.d.ts +0 -5
- package/dist/infrastructure/storage-mutation-lock.constants.js +0 -6
- package/dist/infrastructure/storage-mutation-lock.constants.js.map +0 -1
- package/dist/infrastructure/storage-mutation-lock.d.ts +0 -1
- package/dist/infrastructure/storage-mutation-lock.js +0 -21
- package/dist/infrastructure/storage-mutation-lock.js.map +0 -1
- package/dist/infrastructure/storage-reservations.constants.d.ts +0 -4
- package/dist/infrastructure/storage-reservations.constants.js +0 -5
- package/dist/infrastructure/storage-reservations.constants.js.map +0 -1
- package/dist/infrastructure/storage-reservations.d.ts +0 -2
- package/dist/infrastructure/storage-reservations.js +0 -150
- package/dist/infrastructure/storage-reservations.js.map +0 -1
- package/dist/infrastructure/workflow-checkpoint.d.ts +0 -3
- package/dist/infrastructure/workflow-checkpoint.js +0 -84
- package/dist/infrastructure/workflow-checkpoint.js.map +0 -1
- package/dist/infrastructure/workflow-checkpoint.types.d.ts +0 -6
- package/dist/infrastructure/workflow-checkpoint.types.js +0 -2
- package/dist/infrastructure/workflow-checkpoint.types.js.map +0 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { credentialVariables } from "./authentication.constants.js";
|
|
2
|
+
import { hostFile, toolCommand, variableCredential } from "./authentication.js";
|
|
3
|
+
import { parseCredential } from "./protocol.js";
|
|
4
|
+
const file = hostFile({
|
|
5
|
+
source: {
|
|
6
|
+
path: "~/.codex/auth.json",
|
|
7
|
+
home: { variable: "CODEX_HOME", path: "auth.json" },
|
|
8
|
+
},
|
|
9
|
+
destination: { file: ".codex/auth.json" },
|
|
10
|
+
login: 'codex login with cli_auth_credentials_store = "file"',
|
|
11
|
+
alternative: `"usage" with ${credentialVariables.codex.usage}`,
|
|
12
|
+
select: (content) => {
|
|
13
|
+
parseCredential(content, "Codex");
|
|
14
|
+
return content;
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
const key = variableCredential({
|
|
18
|
+
variable: credentialVariables.codex.usage,
|
|
19
|
+
expose: (secret) => ({
|
|
20
|
+
commands: [
|
|
21
|
+
toolCommand("codex", ["login", "--with-api-key"], { stdin: secret }),
|
|
22
|
+
],
|
|
23
|
+
}),
|
|
24
|
+
});
|
|
25
|
+
function providerCredentials(provider) {
|
|
26
|
+
const variable = provider.apiKeyEnvironment ?? credentialVariables.codex.usage;
|
|
27
|
+
if (variable === false)
|
|
28
|
+
return {};
|
|
29
|
+
const external = variableCredential({ variable });
|
|
30
|
+
return Object.freeze({
|
|
31
|
+
usage: external.preset,
|
|
32
|
+
"usage.key": external.key,
|
|
33
|
+
"usage.variable": external.variable,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export function codexCredentials(provider) {
|
|
37
|
+
if (provider)
|
|
38
|
+
return providerCredentials(provider);
|
|
39
|
+
return Object.freeze({
|
|
40
|
+
account: file.preset,
|
|
41
|
+
"account.file": file.file,
|
|
42
|
+
usage: key.preset,
|
|
43
|
+
"usage.key": key.key,
|
|
44
|
+
"usage.variable": key.variable,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=codex-authentication.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex-authentication.js","sourceRoot":"","sources":["../../../src/adapters/agents/codex-authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEhF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD,MAAM,IAAI,GAAG,QAAQ,CAAC;IACpB,MAAM,EAAE;QACN,IAAI,EAAE,oBAAoB;QAC1B,IAAI,E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,OAAO,EAAE,IAAI,CAAC,MAAM;QACpB,cAAc,EAAE,IAAI,CAAC,IAAI;QACzB,KAAK,EAAE,GAAG,CAAC,MAAM;QACjB,WAAW,EAAE,GAAG,CAAC,GAAG;QACpB,gBAAgB,EAAE,GAAG,CAAC,QAAQ;KAC/B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { credentialVariables } from \"./authentication.constants.ts\";\nimport { hostFile, toolCommand, variableCredential } from \"./authentication.ts\";\nimport type { CredentialStrategy } from \"./authentication.types.ts\";\nimport { parseCredential } from \"./protocol.ts\";\nimport type { CodexModelProvider } from \"./settings.types.ts\";\n\nconst file = hostFile({\n source: {\n path: \"~/.codex/auth.json\",\n home: { variable: \"CODEX_HOME\", path: \"auth.json\" },\n },\n destination: { file: \".codex/auth.json\" },\n login: 'codex login with cli_auth_credentials_store = \"file\"',\n alternative: `\"usage\" with ${credentialVariables.codex.usage}`,\n select: (content) => {\n parseCredential(content, \"Codex\");\n return content;\n },\n});\n\nconst key = variableCredential({\n variable: credentialVariables.codex.usage,\n expose: (secret) => ({\n commands: [\n toolCommand(\"codex\", [\"login\", \"--with-api-key\"], { stdin: secret }),\n ],\n }),\n});\n\nfunction providerCredentials(provider: CodexModelProvider): CredentialStrategy {\n const variable =\n provider.apiKeyEnvironment ?? credentialVariables.codex.usage;\n if (variable === false) return {};\n const external = variableCredential({ variable });\n return Object.freeze({\n usage: external.preset,\n \"usage.key\": external.key,\n \"usage.variable\": external.variable,\n });\n}\n\nexport function codexCredentials(\n provider: CodexModelProvider | undefined,\n): CredentialStrategy {\n if (provider) return providerCredentials(provider);\n return Object.freeze({\n account: file.preset,\n \"account.file\": file.file,\n usage: key.preset,\n \"usage.key\": key.key,\n \"usage.variable\": key.variable,\n });\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { toolResult } from "./tool-result.js";
|
|
1
2
|
import { decodeEvent, decodeLine } from "./event-decoder.js";
|
|
2
3
|
import { asRecord, numberOrZero } from "./protocol.js";
|
|
3
4
|
function conversation(event) {
|
|
@@ -7,16 +8,38 @@ function conversation(event) {
|
|
|
7
8
|
}
|
|
8
9
|
function completedItem(event) {
|
|
9
10
|
return decodeEvent(asRecord(event.item), {
|
|
11
|
+
reasoning: (item) => typeof item.text === "string"
|
|
12
|
+
? [{ kind: "reasoning", text: item.text }]
|
|
13
|
+
: [],
|
|
14
|
+
command_execution: (item) => toolResult(item.id, "command", item.aggregated_output, typeof item.exit_code === "number" && item.exit_code !== 0),
|
|
15
|
+
mcp_tool_call: (item) => toolResult(item.id, item.tool, item.result ?? item.error, item.error !== undefined && item.error !== null),
|
|
16
|
+
file_change: (item) => [
|
|
17
|
+
{
|
|
18
|
+
kind: "file-change",
|
|
19
|
+
changes: item.changes,
|
|
20
|
+
...(typeof item.id === "string" ? { callId: item.id } : {}),
|
|
21
|
+
},
|
|
22
|
+
],
|
|
10
23
|
agent_message: (item) => typeof item.text === "string" ? [{ kind: "text", text: item.text }] : [],
|
|
11
24
|
});
|
|
12
25
|
}
|
|
13
26
|
function startedItem(event) {
|
|
14
27
|
return decodeEvent(asRecord(event.item), {
|
|
15
28
|
command_execution: (item) => [
|
|
16
|
-
{
|
|
29
|
+
{
|
|
30
|
+
kind: "tool",
|
|
31
|
+
name: "command",
|
|
32
|
+
input: item.command,
|
|
33
|
+
...(typeof item.id === "string" ? { callId: item.id } : {}),
|
|
34
|
+
},
|
|
17
35
|
],
|
|
18
36
|
mcp_tool_call: (item) => [
|
|
19
|
-
{
|
|
37
|
+
{
|
|
38
|
+
kind: "tool",
|
|
39
|
+
name: String(item.tool),
|
|
40
|
+
input: item.arguments,
|
|
41
|
+
...(typeof item.id === "string" ? { callId: item.id } : {}),
|
|
42
|
+
},
|
|
20
43
|
],
|
|
21
44
|
});
|
|
22
45
|
}
|
|
@@ -28,6 +51,9 @@ function completedTurn(event) {
|
|
|
28
51
|
tokens: {
|
|
29
52
|
input: numberOrZero(usage.input_tokens),
|
|
30
53
|
cached: numberOrZero(usage.cached_input_tokens),
|
|
54
|
+
...(typeof usage.cache_creation_input_tokens === "number"
|
|
55
|
+
? { cacheCreated: numberOrZero(usage.cache_creation_input_tokens) }
|
|
56
|
+
: {}),
|
|
31
57
|
output: numberOrZero(usage.output_tokens),
|
|
32
58
|
},
|
|
33
59
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex-events.js","sourceRoot":"","sources":["../../../src/adapters/agents/codex-events.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"codex-events.js","sourceRoot":"","sources":["../../../src/adapters/agents/codex-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGvD,SAAS,YAAY,CAAC,KAAqB;IACzC,OAAO,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ;QACxC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;QACjD,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAED,SAAS,aAAa,CAAC,KAAqB;IAC1C,OAAO,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QACvC,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAClB,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ;YAC3B,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;YAC1C,CAAC,CAAC,EAAE;QACR,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAC1B,UAAU,CACR,IAAI,CAAC,EAAE,EACP,SAAS,EACT,IAAI,CAAC,iBAAiB,EACtB,OAAO,IAAI,CAAC,SAAS,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M,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,UAAU,CAAC,IAAI,EAAE;QACtB,gBAAgB,EAAE,YAAY;QAC9B,gBAAgB,EAAE,aAAa;QAC/B,cAAc,EAAE,WAAW;QAC3B,gBAAgB,EAAE,aAAa;QAC/B,KAAK,EAAE,OAAO;QACd,aAAa,EAAE,OAAO;KACvB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { toolResult } from \"./tool-result.ts\";\nimport type { AgentEvent } from \"../../domain/agent.types.ts\";\nimport { decodeEvent, decodeLine } from \"./event-decoder.ts\";\nimport { asRecord, numberOrZero } from \"./protocol.ts\";\nimport type { ProtocolRecord } from \"./protocol.types.ts\";\n\nfunction conversation(event: ProtocolRecord): AgentEvent[] {\n return typeof event.thread_id === \"string\"\n ? [{ kind: \"conversation\", id: event.thread_id }]\n : [];\n}\n\nfunction completedItem(event: ProtocolRecord): AgentEvent[] {\n return decodeEvent(asRecord(event.item), {\n reasoning: (item) =>\n typeof item.text === \"string\"\n ? [{ kind: \"reasoning\", text: item.text }]\n : [],\n command_execution: (item) =>\n toolResult(\n item.id,\n \"command\",\n item.aggregated_output,\n typeof item.exit_code === \"number\" && item.exit_code !== 0,\n ),\n mcp_tool_call: (item) =>\n toolResult(\n item.id,\n item.tool,\n item.result ?? item.error,\n item.error !== undefined && item.error !== null,\n ),\n file_change: (item) => [\n {\n kind: \"file-change\",\n changes: item.changes,\n ...(typeof item.id === \"string\" ? { callId: item.id } : {}),\n },\n ],\n agent_message: (item) =>\n typeof item.text === \"string\" ? [{ kind: \"text\", text: item.text }] : [],\n });\n}\n\nfunction startedItem(event: ProtocolRecord): AgentEvent[] {\n return decodeEvent(asRecord(event.item), {\n command_execution: (item) => [\n {\n kind: \"tool\",\n name: \"command\",\n input: item.command,\n ...(typeof item.id === \"string\" ? { callId: item.id } : {}),\n },\n ],\n mcp_tool_call: (item) => [\n {\n kind: \"tool\",\n name: String(item.tool),\n input: item.arguments,\n ...(typeof item.id === \"string\" ? { callId: item.id } : {}),\n },\n ],\n });\n}\n\nfunction completedTurn(event: ProtocolRecord): AgentEvent[] {\n const usage = asRecord(event.usage);\n return [\n {\n kind: \"usage\",\n tokens: {\n input: numberOrZero(usage.input_tokens),\n cached: numberOrZero(usage.cached_input_tokens),\n ...(typeof usage.cache_creation_input_tokens === \"number\"\n ? { cacheCreated: numberOrZero(usage.cache_creation_input_tokens) }\n : {}),\n output: numberOrZero(usage.output_tokens),\n },\n },\n { kind: \"finished\" },\n ];\n}\n\nfunction failure(event: ProtocolRecord): AgentEvent[] {\n const error =\n typeof event.error === \"string\"\n ? event.error\n : asRecord(event.error).message;\n return [\n {\n kind: \"failure\",\n message: String(event.message ?? error ?? \"Agent failed\"),\n },\n ];\n}\n\nexport function codexEvents(line: string): AgentEvent[] {\n return decodeLine(line, {\n \"thread.started\": conversation,\n \"item.completed\": completedItem,\n \"item.started\": startedItem,\n \"turn.completed\": completedTurn,\n error: failure,\n \"turn.failed\": failure,\n });\n}\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { copilotUsage } from "./copilot-usage.js";
|
|
2
|
+
import { sessionUsageCommand, sessionUsageResult } from "./session-usage.js";
|
|
3
|
+
import { credentialPlanner } from "./authentication.js";
|
|
4
|
+
import { copilotCredentials } from "./copilot-authentication.js";
|
|
5
|
+
import { copilotEvents } from "./copilot-events.js";
|
|
6
|
+
import { copilotRequest } from "./copilot-request.js";
|
|
7
|
+
import { copilotModelSupport } from "./model-support.constants.js";
|
|
8
|
+
import { harnessSettings, supportModel } from "./model-support.js";
|
|
9
|
+
function bindCopilot(settings) {
|
|
10
|
+
supportModel(copilotModelSupport, settings.model);
|
|
11
|
+
const credentials = credentialPlanner("GitHub Copilot CLI", copilotCredentials, settings.authentication, settings.model);
|
|
12
|
+
return Object.freeze({
|
|
13
|
+
name: "copilot",
|
|
14
|
+
...(credentials ? { credentials } : {}),
|
|
15
|
+
bootstrap: "copilot",
|
|
16
|
+
resumable: true,
|
|
17
|
+
forkable: false,
|
|
18
|
+
conversations: "copilot",
|
|
19
|
+
requiresFinishedEvent: true,
|
|
20
|
+
variables: Object.freeze({
|
|
21
|
+
COPILOT_AUTO_UPDATE: "false",
|
|
22
|
+
...settings.variables,
|
|
23
|
+
}),
|
|
24
|
+
request: (input) => copilotRequest(settings, input),
|
|
25
|
+
events: copilotEvents,
|
|
26
|
+
usage: "session",
|
|
27
|
+
usageCommand: (conversation) => sessionUsageCommand("copilot", conversation),
|
|
28
|
+
usageResult: (text) => sessionUsageResult(text, copilotUsage),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export function copilotHarness(settings = {}) {
|
|
32
|
+
harnessSettings(settings);
|
|
33
|
+
const configured = Object.freeze({
|
|
34
|
+
...settings,
|
|
35
|
+
variables: Object.freeze({ ...settings.variables }),
|
|
36
|
+
});
|
|
37
|
+
return Object.freeze({
|
|
38
|
+
kind: "cli",
|
|
39
|
+
bind: (model) => bindCopilot({
|
|
40
|
+
...configured,
|
|
41
|
+
...(model === undefined ? {} : { model }),
|
|
42
|
+
}),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=copilot-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-adapter.js","sourceRoot":"","sources":["../../../src/adapters/agents/copilot-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAG7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,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;KACpD,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,CAAC,KAAkB,EAAE,EAAE,CAC3B,WAAW,CAAC;YACV,GAAG,UAAU;YACb,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;SAC1C,CAAC;KACL,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { copilotUsage } from \"./copilot-usage.ts\";\nimport { sessionUsageCommand, sessionUsageResult } from \"./session-usage.ts\";\nimport type { AgentAdapter, CliHarness } from \"../../domain/agent.types.ts\";\nimport type { AgentModel } from \"../../domain/model.types.ts\";\nimport { credentialPlanner } from \"./authentication.ts\";\nimport { copilotCredentials } from \"./copilot-authentication.ts\";\nimport { copilotEvents } from \"./copilot-events.ts\";\nimport { copilotRequest } from \"./copilot-request.ts\";\nimport type { CopilotSettings } from \"./copilot.types.ts\";\nimport { copilotModelSupport } from \"./model-support.constants.ts\";\nimport { harnessSettings, supportModel } from \"./model-support.ts\";\nimport type { Bound } from \"./settings.types.ts\";\n\nfunction bindCopilot(settings: Bound<CopilotSettings>): AgentAdapter {\n supportModel(copilotModelSupport, settings.model);\n const credentials = credentialPlanner(\n \"GitHub Copilot CLI\",\n copilotCredentials,\n settings.authentication,\n settings.model,\n );\n return Object.freeze({\n name: \"copilot\",\n ...(credentials ? { credentials } : {}),\n bootstrap: \"copilot\",\n resumable: true,\n forkable: false,\n conversations: \"copilot\",\n requiresFinishedEvent: true,\n variables: Object.freeze({\n COPILOT_AUTO_UPDATE: \"false\",\n ...settings.variables,\n }),\n request: (input) => copilotRequest(settings, input),\n events: copilotEvents,\n usage: \"session\",\n usageCommand: (conversation) =>\n sessionUsageCommand(\"copilot\", conversation),\n usageResult: (text) => sessionUsageResult(text, copilotUsage),\n } satisfies AgentAdapter);\n}\n\nexport function copilotHarness(settings: CopilotSettings = {}): CliHarness {\n harnessSettings(settings);\n const configured = Object.freeze({\n ...settings,\n variables: Object.freeze({ ...settings.variables }),\n });\n return Object.freeze({\n kind: \"cli\",\n bind: (model?: AgentModel) =>\n bindCopilot({\n ...configured,\n ...(model === undefined ? {} : { model }),\n }),\n });\n}\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { invariant, OutpostError } from "../../domain/errors.js";
|
|
2
|
+
import { parseJsonc } from "../../infrastructure/host-credentials.js";
|
|
3
|
+
import { credentialVariables } from "./authentication.constants.js";
|
|
4
|
+
import { hostFile, variableCredential } from "./authentication.js";
|
|
5
|
+
import { asRecord } from "./protocol.js";
|
|
6
|
+
const variable = credentialVariables.copilot.account;
|
|
7
|
+
function acceptToken(token) {
|
|
8
|
+
invariant(!token.startsWith("ghp_"), "GitHub Copilot CLI rejects classic personal access tokens (ghp_). Use copilot login or a fine-grained token with the Copilot Requests permission.");
|
|
9
|
+
}
|
|
10
|
+
function parseConfiguration(content) {
|
|
11
|
+
try {
|
|
12
|
+
return asRecord(parseJsonc(content));
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
throw new OutpostError("configuration", "The Copilot config.json file is not valid JSON");
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function storedToken(content) {
|
|
19
|
+
const configuration = parseConfiguration(content);
|
|
20
|
+
const user = asRecord(configuration.lastLoggedInUser);
|
|
21
|
+
const stored = typeof user.host === "string" && typeof user.login === "string"
|
|
22
|
+
? asRecord(configuration.authTokens)[`${user.host}:${user.login}`]
|
|
23
|
+
: undefined;
|
|
24
|
+
const token = typeof stored === "string" ? stored : asRecord(stored).token;
|
|
25
|
+
invariant(typeof token === "string" && token !== "", `Copilot config.json stores no token for the last logged-in user. Copilot keeps tokens in the system keychain by default, which Outpost never reads: pass { account: { variable: "${variable}" } } instead.`);
|
|
26
|
+
acceptToken(token);
|
|
27
|
+
return token;
|
|
28
|
+
}
|
|
29
|
+
const file = hostFile({
|
|
30
|
+
source: {
|
|
31
|
+
path: "~/.copilot/config.json",
|
|
32
|
+
home: { variable: "COPILOT_HOME", path: "config.json" },
|
|
33
|
+
},
|
|
34
|
+
destination: { variable },
|
|
35
|
+
login: "copilot login",
|
|
36
|
+
alternative: `{ account: { variable: "${variable}" } }`,
|
|
37
|
+
select: storedToken,
|
|
38
|
+
});
|
|
39
|
+
const token = variableCredential({ variable, accept: acceptToken });
|
|
40
|
+
export const copilotCredentials = Object.freeze({
|
|
41
|
+
account: file.preset,
|
|
42
|
+
"account.file": file.file,
|
|
43
|
+
"account.key": token.key,
|
|
44
|
+
"account.variable": token.variable,
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=copilot-authentication.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-authentication.js","sourceRoot":"","sources":["../../../src/adapters/agents/copilot-authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,QAAQ,GAAG,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC;AAErD,SAAS,WAAW,CAAC,KAAa;IAChC,SAAS,CACP,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EACzB,mJAAmJ,CACpJ,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,OAAe;IACzC,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,YAAY,CACpB,eAAe,EACf,gDAAgD,CACjD,CAAC;IACJ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AC,MAAM;IACpB,cAAc,EAAE,IAAI,CAAC,IAAI;IACzB,aAAa,EAAE,KAAK,CAAC,GAAG;IACxB,kBAAkB,EAAE,KAAK,CAAC,QAAQ;CACnC,CAAC,CAAC","sourcesContent":["import { invariant, OutpostError } from \"../../domain/errors.ts\";\nimport { parseJsonc } from \"../../infrastructure/host-credentials.ts\";\nimport { credentialVariables } from \"./authentication.constants.ts\";\nimport { hostFile, variableCredential } from \"./authentication.ts\";\nimport type { CredentialStrategy } from \"./authentication.types.ts\";\nimport { asRecord } from \"./protocol.ts\";\n\nconst variable = credentialVariables.copilot.account;\n\nfunction acceptToken(token: string): void {\n invariant(\n !token.startsWith(\"ghp_\"),\n \"GitHub Copilot CLI rejects classic personal access tokens (ghp_). Use copilot login or a fine-grained token with the Copilot Requests permission.\",\n );\n}\n\nfunction parseConfiguration(content: string): Record<string, unknown> {\n try {\n return asRecord(parseJsonc(content));\n } catch {\n throw new OutpostError(\n \"configuration\",\n \"The Copilot config.json file is not valid JSON\",\n );\n }\n}\n\nfunction storedToken(content: string): string {\n const configuration = parseConfiguration(content);\n const user = asRecord(configuration.lastLoggedInUser);\n const stored =\n typeof user.host === \"string\" && typeof user.login === \"string\"\n ? asRecord(configuration.authTokens)[`${user.host}:${user.login}`]\n : undefined;\n const token = typeof stored === \"string\" ? stored : asRecord(stored).token;\n invariant(\n typeof token === \"string\" && token !== \"\",\n `Copilot config.json stores no token for the last logged-in user. Copilot keeps tokens in the system keychain by default, which Outpost never reads: pass { account: { variable: \"${variable}\" } } instead.`,\n );\n acceptToken(token);\n return token;\n}\n\nconst file = hostFile({\n source: {\n path: \"~/.copilot/config.json\",\n home: { variable: \"COPILOT_HOME\", path: \"config.json\" },\n },\n destination: { variable },\n login: \"copilot login\",\n alternative: `{ account: { variable: \"${variable}\" } }`,\n select: storedToken,\n});\n\nconst token = variableCredential({ variable, accept: acceptToken });\n\nexport const copilotCredentials: CredentialStrategy = Object.freeze({\n account: file.preset,\n \"account.file\": file.file,\n \"account.key\": token.key,\n \"account.variable\": token.variable,\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function copilotDiagnostics(): readonly import("./cli-diagnostics.types.ts").AgentCliDiagnostic[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { helpDiagnostics } from "./cli-diagnostics.js";
|
|
2
|
+
import { copilotRequest } from "./copilot-request.js";
|
|
3
|
+
export function copilotDiagnostics() {
|
|
4
|
+
return helpDiagnostics((input) => copilotRequest({}, input), "Usage: copilot [", true);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=copilot-diagnostics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-diagnostics.js","sourceRoot":"","sources":["../../../src/adapters/agents/copilot-diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,UAAU,kBAAkB;IAChC,OAAO,eAAe,CACpB,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC,EACpC,kBAAkB,EAClB,IAAI,CACL,CAAC;AACJ,CAAC","sourcesContent":["import { helpDiagnostics } from \"./cli-diagnostics.ts\";\nimport { copilotRequest } from \"./copilot-request.ts\";\n\nexport function copilotDiagnostics() {\n return helpDiagnostics(\n (input) => copilotRequest({}, input),\n \"Usage: copilot [\",\n true,\n );\n}\n"]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { copilotShutdown, copilotUsage } from "./copilot-usage.js";
|
|
2
|
+
import { toolResult } from "./tool-result.js";
|
|
3
|
+
import { decodeLine } from "./event-decoder.js";
|
|
4
|
+
import { asRecord } from "./protocol.js";
|
|
5
|
+
function message(event) {
|
|
6
|
+
const data = asRecord(event.data);
|
|
7
|
+
const requests = Array.isArray(data.toolRequests) ? data.toolRequests : [];
|
|
8
|
+
const tools = requests.map(asRecord).flatMap((request) => typeof request.name === "string"
|
|
9
|
+
? [
|
|
10
|
+
{
|
|
11
|
+
kind: "tool",
|
|
12
|
+
name: request.name,
|
|
13
|
+
input: request.arguments,
|
|
14
|
+
...(typeof request.toolCallId === "string"
|
|
15
|
+
? { callId: request.toolCallId }
|
|
16
|
+
: {}),
|
|
17
|
+
},
|
|
18
|
+
]
|
|
19
|
+
: []);
|
|
20
|
+
return typeof data.content === "string" && data.content
|
|
21
|
+
? [{ kind: "text", text: data.content }, ...tools]
|
|
22
|
+
: tools;
|
|
23
|
+
}
|
|
24
|
+
function result(event) {
|
|
25
|
+
const conversation = typeof event.sessionId === "string"
|
|
26
|
+
? [{ kind: "conversation", id: event.sessionId }]
|
|
27
|
+
: [];
|
|
28
|
+
if (event.exitCode === 0 && event.outcome !== "blocked")
|
|
29
|
+
return [...conversation, { kind: "finished" }];
|
|
30
|
+
return [
|
|
31
|
+
...conversation,
|
|
32
|
+
{
|
|
33
|
+
kind: "failure",
|
|
34
|
+
message: event.outcome === "blocked"
|
|
35
|
+
? "GitHub Copilot CLI was blocked before completing the prompt"
|
|
36
|
+
: `GitHub Copilot CLI ended with exit code ${String(event.exitCode ?? "unknown")}`,
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
export function copilotEvents(line) {
|
|
41
|
+
return decodeLine(line, {
|
|
42
|
+
"assistant.message": message,
|
|
43
|
+
"assistant.usage": (event) => [
|
|
44
|
+
{ kind: "usage", tokens: copilotUsage(event.data) },
|
|
45
|
+
],
|
|
46
|
+
"session.shutdown": copilotShutdown,
|
|
47
|
+
"assistant.reasoning": (event) => {
|
|
48
|
+
const data = asRecord(event.data);
|
|
49
|
+
return typeof data.content === "string"
|
|
50
|
+
? [{ kind: "reasoning", text: data.content }]
|
|
51
|
+
: [];
|
|
52
|
+
},
|
|
53
|
+
"tool.execution_complete": (event) => {
|
|
54
|
+
const data = asRecord(event.data);
|
|
55
|
+
return toolResult(data.toolCallId, undefined, data.result ?? data.error, data.success === false);
|
|
56
|
+
},
|
|
57
|
+
"session.error": (event) => {
|
|
58
|
+
const data = asRecord(event.data);
|
|
59
|
+
return typeof data.message === "string"
|
|
60
|
+
? [{ kind: "warning", message: data.message }]
|
|
61
|
+
: [];
|
|
62
|
+
},
|
|
63
|
+
result,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=copilot-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-events.js","sourceRoot":"","sources":["../../../src/adapters/agents/copilot-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,SAAS,OAAO,CAAC,KAAqB;IACpC,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3E,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAgB,EAAE,CACrE,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ;QAC9B,CAAC,CAAC;YACE;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK,EAAE,OAAO,CAAC,SAAS;gBACxB,GAAG,CAAC,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ;oBACxC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,UAAU,EAAE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EAAE;YAC/B,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAClC,OAAO,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ;gBACrC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;gBAC7C,CAAC,CAAC,EAAE,CAAC;QACT,CAAC;QACD,yBAAyB,EAAE,CAAC,KAAK,EAAE,EAAE;YACnC,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAClC,OAAO,UAAU,CACf,IAAI,CAAC,UAAU,EACf,SAAS,EACT,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,EACzB,IAAI,CAAC,OAAO,KAAK,KAAK,CACvB,CAAC;QACJ,CAAC;QACD,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE;YACzB,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAClC,OAAO,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ;gBACrC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;gBAC9C,CAAC,CAAC,EAAE,CAAC;QACT,CAAC;QACD,MAAM;KACP,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { copilotShutdown, copilotUsage } from \"./copilot-usage.ts\";\nimport { toolResult } from \"./tool-result.ts\";\nimport type { AgentEvent } from \"../../domain/agent.types.ts\";\nimport { decodeLine } from \"./event-decoder.ts\";\nimport { asRecord } from \"./protocol.ts\";\nimport type { ProtocolRecord } from \"./protocol.types.ts\";\n\nfunction message(event: ProtocolRecord): AgentEvent[] {\n const data = asRecord(event.data);\n const requests = Array.isArray(data.toolRequests) ? data.toolRequests : [];\n const tools = requests.map(asRecord).flatMap((request): AgentEvent[] =>\n typeof request.name === \"string\"\n ? [\n {\n kind: \"tool\",\n name: request.name,\n input: request.arguments,\n ...(typeof request.toolCallId === \"string\"\n ? { callId: request.toolCallId }\n : {}),\n },\n ]\n : [],\n );\n return typeof data.content === \"string\" && data.content\n ? [{ kind: \"text\", text: data.content }, ...tools]\n : tools;\n}\n\nfunction result(event: ProtocolRecord): AgentEvent[] {\n const conversation: AgentEvent[] =\n typeof event.sessionId === \"string\"\n ? [{ kind: \"conversation\", id: event.sessionId }]\n : [];\n if (event.exitCode === 0 && event.outcome !== \"blocked\")\n return [...conversation, { kind: \"finished\" }];\n return [\n ...conversation,\n {\n kind: \"failure\",\n message:\n event.outcome === \"blocked\"\n ? \"GitHub Copilot CLI was blocked before completing the prompt\"\n : `GitHub Copilot CLI ended with exit code ${String(event.exitCode ?? \"unknown\")}`,\n },\n ];\n}\n\nexport function copilotEvents(line: string): AgentEvent[] {\n return decodeLine(line, {\n \"assistant.message\": message,\n \"assistant.usage\": (event) => [\n { kind: \"usage\", tokens: copilotUsage(event.data) },\n ],\n \"session.shutdown\": copilotShutdown,\n \"assistant.reasoning\": (event) => {\n const data = asRecord(event.data);\n return typeof data.content === \"string\"\n ? [{ kind: \"reasoning\", text: data.content }]\n : [];\n },\n \"tool.execution_complete\": (event) => {\n const data = asRecord(event.data);\n return toolResult(\n data.toolCallId,\n undefined,\n data.result ?? data.error,\n data.success === false,\n );\n },\n \"session.error\": (event) => {\n const data = asRecord(event.data);\n return typeof data.message === \"string\"\n ? [{ kind: \"warning\", message: data.message }]\n : [];\n },\n result,\n });\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AgentInput } from "../../domain/agent.types.ts";
|
|
2
|
+
import type { Command } from "../../domain/command.types.ts";
|
|
3
|
+
import type { CopilotSettings } from "./copilot.types.ts";
|
|
4
|
+
import type { Bound } from "./settings.types.ts";
|
|
5
|
+
export declare function copilotRequest(settings: Bound<CopilotSettings>, input: AgentInput): Command;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { validId } from "../../infrastructure/conversations/identity.js";
|
|
2
|
+
import { invariant } from "../../domain/errors.js";
|
|
3
|
+
export function copilotRequest(settings, input) {
|
|
4
|
+
invariant(!input.continuation?.fork, "GitHub Copilot CLI does not support automated fork in Outpost");
|
|
5
|
+
const args = [];
|
|
6
|
+
if (input.continuation) {
|
|
7
|
+
validId(input.continuation.id);
|
|
8
|
+
args.push("--resume", input.continuation.id);
|
|
9
|
+
}
|
|
10
|
+
if (settings.model)
|
|
11
|
+
args.push("--model", settings.model.name);
|
|
12
|
+
if (input.interactive)
|
|
13
|
+
return {
|
|
14
|
+
executable: "copilot",
|
|
15
|
+
arguments: [
|
|
16
|
+
...args,
|
|
17
|
+
...(input.text === undefined ? [] : ["--interactive", input.text]),
|
|
18
|
+
],
|
|
19
|
+
interactive: true,
|
|
20
|
+
};
|
|
21
|
+
args.push("--output-format", "json", "--allow-all", "--no-ask-user");
|
|
22
|
+
return { executable: "copilot", arguments: args, stdin: input.text ?? "" };
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=copilot-request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-request.js","sourceRoot":"","sources":["../../../src/adapters/agents/copilot-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gDAAgD,CAAC;AAGzE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAInD,MAAM,UAAU,cAAc,CAC5B,QAAgC,EAChC,KAAiB;IAEjB,SAAS,CACP,CAAC,KAAK,CAAC,YAAY,EAAE,IAAI,EACzB,+DAA+D,CAChE,CAAC;IACF,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;QACvB,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC;IACD,IAAI,QAAQ,CAAC,KAAK;QAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9D,IAAI,KAAK,CAAC,WAAW;QACnB,OAAO;YACL,UAAU,EAAE,SAAS;YACrB,SAAS,EAAE;gBACT,GAAG,IAAI;gBACP,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,eAAe,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;aACnE;YACD,WAAW,EAAE,IAAI;SAClB,CAAC;IACJ,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC;IACrE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;AAC7E,CAAC","sourcesContent":["import { validId } from \"../../infrastructure/conversations/identity.ts\";\nimport type { AgentInput } from \"../../domain/agent.types.ts\";\nimport type { Command } from \"../../domain/command.types.ts\";\nimport { invariant } from \"../../domain/errors.ts\";\nimport type { CopilotSettings } from \"./copilot.types.ts\";\nimport type { Bound } from \"./settings.types.ts\";\n\nexport function copilotRequest(\n settings: Bound<CopilotSettings>,\n input: AgentInput,\n): Command {\n invariant(\n !input.continuation?.fork,\n \"GitHub Copilot CLI does not support automated fork in Outpost\",\n );\n const args: string[] = [];\n if (input.continuation) {\n validId(input.continuation.id);\n args.push(\"--resume\", input.continuation.id);\n }\n if (settings.model) args.push(\"--model\", settings.model.name);\n if (input.interactive)\n return {\n executable: \"copilot\",\n arguments: [\n ...args,\n ...(input.text === undefined ? [] : [\"--interactive\", input.text]),\n ],\n interactive: true,\n };\n args.push(\"--output-format\", \"json\", \"--allow-all\", \"--no-ask-user\");\n return { executable: \"copilot\", arguments: args, stdin: input.text ?? \"\" };\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { addUsage } from "../../domain/usage.js";
|
|
2
|
+
import { asRecord } from "./protocol.js";
|
|
3
|
+
import { usageCounts } from "./session-usage.js";
|
|
4
|
+
export function copilotUsage(value) {
|
|
5
|
+
const usage = asRecord(value);
|
|
6
|
+
return usageCounts(usage.inputTokens, usage.outputTokens, usage.cacheReadTokens, usage.cacheWriteTokens);
|
|
7
|
+
}
|
|
8
|
+
export function copilotShutdown(event) {
|
|
9
|
+
const metrics = asRecord(asRecord(event.data).modelMetrics);
|
|
10
|
+
const values = Object.values(metrics);
|
|
11
|
+
const tokens = values.reduce((total, metric) => addUsage(total, copilotUsage(asRecord(metric).usage)), {
|
|
12
|
+
input: 0,
|
|
13
|
+
cached: 0,
|
|
14
|
+
output: 0,
|
|
15
|
+
...(values.length ? {} : { complete: false }),
|
|
16
|
+
});
|
|
17
|
+
return [{ kind: "usage", tokens, cumulative: true }];
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=copilot-usage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-usage.js","sourceRoot":"","sources":["../../../src/adapters/agents/copilot-usage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO,WAAW,CAChB,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,eAAe,EACrB,KAAK,CAAC,gBAAgB,CACvB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAA8B;IAC5D,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC;IAC5D,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACtC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAC1B,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,EACxE;QACE,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,MAAM,EAAE,CAAC;QACT,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;KAC9C,CACF,CAAC;IACF,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;AACvD,CAAC","sourcesContent":["import type { AgentEvent, Usage } from \"../../domain/agent.types.ts\";\nimport { addUsage } from \"../../domain/usage.ts\";\nimport { asRecord } from \"./protocol.ts\";\nimport { usageCounts } from \"./session-usage.ts\";\n\nexport function copilotUsage(value: unknown): Usage {\n const usage = asRecord(value);\n return usageCounts(\n usage.inputTokens,\n usage.outputTokens,\n usage.cacheReadTokens,\n usage.cacheWriteTokens,\n );\n}\n\nexport function copilotShutdown(event: Record<string, unknown>): AgentEvent[] {\n const metrics = asRecord(asRecord(event.data).modelMetrics);\n const values = Object.values(metrics);\n const tokens = values.reduce<Usage>(\n (total, metric) => addUsage(total, copilotUsage(asRecord(metric).usage)),\n {\n input: 0,\n cached: 0,\n output: 0,\n ...(values.length ? {} : { complete: false }),\n },\n );\n return [{ kind: \"usage\", tokens, cumulative: true }];\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot.types.js","sourceRoot":"","sources":["../../../src/adapters/agents/copilot.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AgentAuthentication } from \"../../domain/agent.types.ts\";\nimport type { Variables } from \"../../domain/command.types.ts\";\n\nexport interface CopilotSettings {\n readonly authentication?: AgentAuthentication;\n readonly variables?: Variables;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AgentEvent } from "../../domain/agent.types.ts";
|
|
2
2
|
import type { EventDecoders, ProtocolRecord } from "./protocol.types.ts";
|
|
3
|
-
export declare function decodeEvent(event: ProtocolRecord, handlers: EventDecoders): AgentEvent[];
|
|
4
|
-
export declare function decodeLine(line: string, handlers: EventDecoders): AgentEvent[];
|
|
3
|
+
export declare function decodeEvent(event: ProtocolRecord, handlers: EventDecoders, discriminant?: string): AgentEvent[];
|
|
4
|
+
export declare function decodeLine(line: string, handlers: EventDecoders, discriminant?: string): AgentEvent[];
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { decodeRecord } from "./protocol.js";
|
|
2
|
-
export function decodeEvent(event, handlers) {
|
|
3
|
-
const
|
|
4
|
-
|
|
2
|
+
export function decodeEvent(event, handlers, discriminant = "type") {
|
|
3
|
+
const kind = event[discriminant];
|
|
4
|
+
const handler = typeof kind === "string" && Object.hasOwn(handlers, kind)
|
|
5
|
+
? handlers[kind]
|
|
5
6
|
: undefined;
|
|
6
7
|
return handler?.(event) ?? [];
|
|
7
8
|
}
|
|
8
|
-
export function decodeLine(line, handlers) {
|
|
9
|
+
export function decodeLine(line, handlers, discriminant = "type") {
|
|
9
10
|
const event = decodeRecord(line);
|
|
10
11
|
if (!event)
|
|
11
12
|
return [{ kind: "raw", value: line }];
|
|
12
|
-
const events = decodeEvent(event, handlers);
|
|
13
|
+
const events = decodeEvent(event, handlers, discriminant);
|
|
13
14
|
return events.length ? events : [{ kind: "raw", value: event }];
|
|
14
15
|
}
|
|
15
16
|
//# sourceMappingURL=event-decoder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-decoder.js","sourceRoot":"","sources":["../../../src/adapters/agents/event-decoder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,MAAM,UAAU,WAAW,CACzB,KAAqB,EACrB,QAAuB;
|
|
1
|
+
{"version":3,"file":"event-decoder.js","sourceRoot":"","sources":["../../../src/adapters/agents/event-decoder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,MAAM,UAAU,WAAW,CACzB,KAAqB,EACrB,QAAuB,EACvB,YAAY,GAAG,MAAM;IAErB,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;IACjC,MAAM,OAAO,GACX,OAAO,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC;QACvD,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;QAChB,CAAC,CAAC,SAAS,CAAC;IAChB,OAAO,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,IAAY,EACZ,QAAuB,EACvB,YAAY,GAAG,MAAM;IAErB,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,CAAC,KAAK;QAAE,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;IAC1D,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import type { AgentEvent } from \"../../domain/agent.types.ts\";\nimport { decodeRecord } from \"./protocol.ts\";\nimport type { EventDecoders, ProtocolRecord } from \"./protocol.types.ts\";\n\nexport function decodeEvent(\n event: ProtocolRecord,\n handlers: EventDecoders,\n discriminant = \"type\",\n): AgentEvent[] {\n const kind = event[discriminant];\n const handler =\n typeof kind === \"string\" && Object.hasOwn(handlers, kind)\n ? handlers[kind]\n : undefined;\n return handler?.(event) ?? [];\n}\n\nexport function decodeLine(\n line: string,\n handlers: EventDecoders,\n discriminant = \"type\",\n): AgentEvent[] {\n const event = decodeRecord(line);\n if (!event) return [{ kind: \"raw\", value: line }];\n const events = decodeEvent(event, handlers, discriminant);\n return events.length ? events : [{ kind: \"raw\", value: event }];\n}\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { kimiUsage } from "./kimi-usage.js";
|
|
2
|
+
import { sessionUsageCommand, sessionUsageResult } from "./session-usage.js";
|
|
3
|
+
import { forkKimi } from "./kimi-fork.js";
|
|
4
|
+
import { invariant } from "../../domain/errors.js";
|
|
5
|
+
import { authenticationForm } from "../../domain/authentication.js";
|
|
6
|
+
import { kimiRegions } from "./kimi.constants.js";
|
|
7
|
+
import { credentialPlanner } from "./authentication.js";
|
|
8
|
+
import { kimiCredentials } from "./kimi-authentication.js";
|
|
9
|
+
import { kimiEvents } from "./kimi-events.js";
|
|
10
|
+
import { kimiRequest } from "./kimi-request.js";
|
|
11
|
+
import { kimiModelSupport } from "./model-support.constants.js";
|
|
12
|
+
import { harnessSettings, supportModel } from "./model-support.js";
|
|
13
|
+
function bindKimi(settings) {
|
|
14
|
+
supportModel(kimiModelSupport, settings.model);
|
|
15
|
+
const credentials = credentialPlanner("Kimi Code", kimiCredentials(settings.region), settings.authentication, settings.model);
|
|
16
|
+
return Object.freeze({
|
|
17
|
+
name: "kimi",
|
|
18
|
+
...(credentials ? { credentials } : {}),
|
|
19
|
+
bootstrap: "kimi",
|
|
20
|
+
resumable: true,
|
|
21
|
+
forkable: true,
|
|
22
|
+
fork: forkKimi,
|
|
23
|
+
conversations: "kimi",
|
|
24
|
+
variables: Object.freeze({
|
|
25
|
+
KIMI_CODE_NO_AUTO_UPDATE: "1",
|
|
26
|
+
...settings.variables,
|
|
27
|
+
}),
|
|
28
|
+
request: (input) => kimiRequest(settings, input),
|
|
29
|
+
events: kimiEvents,
|
|
30
|
+
usage: "session",
|
|
31
|
+
usageCommand: (conversation) => sessionUsageCommand("kimi", conversation),
|
|
32
|
+
usageResult: (text) => sessionUsageResult(text, kimiUsage),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export function kimiHarness(settings = {}) {
|
|
36
|
+
harnessSettings(settings);
|
|
37
|
+
invariant(settings.region === undefined ||
|
|
38
|
+
Object.hasOwn(kimiRegions, settings.region), 'Kimi region must be "mainland-cn" or "global"');
|
|
39
|
+
invariant(settings.region === undefined ||
|
|
40
|
+
settings.authentication === undefined ||
|
|
41
|
+
!authenticationForm(settings.authentication).form.startsWith("usage"), "Kimi region selects account authentication; configure the API endpoint through variables for usage authentication");
|
|
42
|
+
const configured = Object.freeze({
|
|
43
|
+
...settings,
|
|
44
|
+
variables: Object.freeze({ ...settings.variables }),
|
|
45
|
+
});
|
|
46
|
+
return Object.freeze({
|
|
47
|
+
kind: "cli",
|
|
48
|
+
bind: (model) => bindKimi({ ...configured, ...(model === undefined ? {} : { model }) }),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=kimi-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kimi-adapter.js","sourceRoot":"","sources":["../../../src/adapters/agents/kimi-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,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AAC;QACzE,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,kBAAkB,CAAC,IAAI,EAAE,SAAS,CAAC;KACpC,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,WAAyB,EAAE;IACrD,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC1B,SAAS,CACP,QAAQ,CAAC,MAAM,KAAK,SAAS;QAC3B,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,EAC7C,+CAA+C,CAChD,CAAC;IACF,SAAS,CACP,QAAQ,CAAC,MAAM,KAAK,SAAS;QAC3B,QAAQ,CAAC,cAAc,KAAK,SAAS;QACrC,CAAC,kBAAkB,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EACvE,mHAAmH,CACpH,CAAC;IACF,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;QAC/B,GAAG,QAAQ;QACX,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;KACpD,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,CAAC,KAAkB,EAAE,EAAE,CAC3B,QAAQ,CAAC,EAAE,GAAG,UAAU,EAAE,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;KACzE,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { kimiUsage } from \"./kimi-usage.ts\";\nimport { sessionUsageCommand, sessionUsageResult } from \"./session-usage.ts\";\nimport { forkKimi } from \"./kimi-fork.ts\";\nimport type { AgentAdapter, CliHarness } from \"../../domain/agent.types.ts\";\nimport { invariant } from \"../../domain/errors.ts\";\nimport { authenticationForm } from \"../../domain/authentication.ts\";\nimport { kimiRegions } from \"./kimi.constants.ts\";\nimport type { AgentModel } from \"../../domain/model.types.ts\";\nimport { credentialPlanner } from \"./authentication.ts\";\nimport { kimiCredentials } from \"./kimi-authentication.ts\";\nimport { kimiEvents } from \"./kimi-events.ts\";\nimport { kimiRequest } from \"./kimi-request.ts\";\nimport type { KimiSettings } from \"./kimi.types.ts\";\nimport { kimiModelSupport } from \"./model-support.constants.ts\";\nimport { harnessSettings, supportModel } from \"./model-support.ts\";\nimport type { Bound } from \"./settings.types.ts\";\n\nfunction bindKimi(settings: Bound<KimiSettings>): AgentAdapter {\n supportModel(kimiModelSupport, settings.model);\n const credentials = credentialPlanner(\n \"Kimi Code\",\n kimiCredentials(settings.region),\n settings.authentication,\n settings.model,\n );\n return Object.freeze({\n name: \"kimi\",\n ...(credentials ? { credentials } : {}),\n bootstrap: \"kimi\",\n resumable: true,\n forkable: true,\n fork: forkKimi,\n conversations: \"kimi\",\n variables: Object.freeze({\n KIMI_CODE_NO_AUTO_UPDATE: \"1\",\n ...settings.variables,\n }),\n request: (input) => kimiRequest(settings, input),\n events: kimiEvents,\n usage: \"session\",\n usageCommand: (conversation) => sessionUsageCommand(\"kimi\", conversation),\n usageResult: (text) => sessionUsageResult(text, kimiUsage),\n } satisfies AgentAdapter);\n}\n\nexport function kimiHarness(settings: KimiSettings = {}): CliHarness {\n harnessSettings(settings);\n invariant(\n settings.region === undefined ||\n Object.hasOwn(kimiRegions, settings.region),\n 'Kimi region must be \"mainland-cn\" or \"global\"',\n );\n invariant(\n settings.region === undefined ||\n settings.authentication === undefined ||\n !authenticationForm(settings.authentication).form.startsWith(\"usage\"),\n \"Kimi region selects account authentication; configure the API endpoint through variables for usage authentication\",\n );\n const configured = Object.freeze({\n ...settings,\n variables: Object.freeze({ ...settings.variables }),\n });\n return Object.freeze({\n kind: \"cli\",\n bind: (model?: AgentModel) =>\n bindKimi({ ...configured, ...(model === undefined ? {} : { model }) }),\n });\n}\n"]}
|