@elie-laloum/outpost 5.0.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/README.md +11 -11
- package/SECURITY.md +2 -0
- package/dist/adapters/agents/antigravity-adapter.d.ts +3 -0
- package/dist/adapters/agents/antigravity-adapter.js +39 -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 +66 -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 +29 -0
- package/dist/adapters/agents/antigravity-request.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/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 +11 -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/copilot-adapter.d.ts +3 -0
- package/dist/adapters/agents/copilot-adapter.js +39 -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 +45 -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 +50 -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 +19 -0
- package/dist/adapters/agents/copilot-request.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 +35 -0
- package/dist/adapters/agents/kimi-adapter.js.map +1 -0
- package/dist/adapters/agents/kimi-authentication.d.ts +2 -0
- package/dist/adapters/agents/kimi-authentication.js +48 -0
- package/dist/adapters/agents/kimi-authentication.js.map +1 -0
- package/dist/adapters/agents/kimi-diagnostics.d.ts +1 -0
- package/dist/adapters/agents/kimi-diagnostics.js +6 -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 +51 -0
- package/dist/adapters/agents/kimi-events.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 +28 -0
- package/dist/adapters/agents/kimi-request.js.map +1 -0
- package/dist/adapters/agents/kimi.types.d.ts +6 -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 +135 -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/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 +29 -4
- package/dist/application/agent-bootstrap.constants.js.map +1 -1
- package/dist/application/agent-bootstrap.js +33 -12
- package/dist/application/agent-bootstrap.js.map +1 -1
- package/dist/application/agent-bootstrap.types.d.ts +20 -0
- package/dist/application/agent-bootstrap.types.js +2 -0
- package/dist/application/agent-bootstrap.types.js.map +1 -0
- 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/doctor-agent.constants.d.ts +2 -8
- package/dist/application/doctor-agent.constants.js +40 -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 +11 -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 +2 -4
- package/dist/application/doctor.js.map +1 -1
- package/dist/application/doctor.types.d.ts +9 -1
- package/dist/application/doctor.types.js.map +1 -1
- package/dist/application/outpost.types.d.ts +0 -1
- package/dist/application/outpost.types.js.map +1 -1
- package/dist/application/recovery-retention.js +65 -24
- package/dist/application/recovery-retention.js.map +1 -1
- package/dist/application/sandbox-agents.js +9 -8
- package/dist/application/sandbox-agents.js.map +1 -1
- package/dist/application/sandbox-dispatch.js +0 -2
- package/dist/application/sandbox-dispatch.js.map +1 -1
- package/dist/application/sandbox-session.types.d.ts +5 -0
- package/dist/application/sandbox-session.types.js.map +1 -1
- package/dist/application/startup-recovery.js +1 -1
- package/dist/application/startup-recovery.js.map +1 -1
- package/dist/application/storage-reservation.js +9 -2
- package/dist/application/storage-reservation.js.map +1 -1
- package/dist/cli/doctor-command.js +5 -1
- 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/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 +5 -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.types.d.ts +47 -11
- 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.map +1 -1
- package/dist/domain/harness.types.d.ts +2 -2
- package/dist/domain/harness.types.js.map +1 -1
- package/dist/index.d.ts +4 -8
- package/dist/index.js +1 -3
- package/dist/index.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/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.js +7 -74
- package/dist/infrastructure/journal.js.map +1 -1
- package/dist/infrastructure/journal.types.d.ts +0 -2
- 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/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/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/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/providers/agents.d.ts +7 -2
- package/dist/providers/agents.js +4 -1
- package/dist/providers/agents.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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../../src/adapters/agents/authentication.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../../src/adapters/agents/authentication.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AASlE,MAAM,UAAU,cAAc,CAC5B,OAAgC,EAAE;IAElC,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAC/C,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;QAC3C,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;QAC7C,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC;KACpD,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,WAAW,CACzB,MAAc,EACd,IAAuB,EACvB,UAAi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M,UAAU,iBAAiB,CAC/B,KAAa,EACb,QAA4B,EAC5B,cAA+C,EAC/C,KAAkB;IAElB,IAAI,cAAc,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACnD,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC;IAChE,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1E,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvC,SAAS,CACP,MAAM,EACN,GAAG,KAAK,qBAAqB,IAAI,oCAAoC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CACtH,CAAC;IACF,OAAO,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;AACpE,CAAC","sourcesContent":["import type {\n AgentAdapter,\n AgentAuthentication,\n CredentialPlan,\n HostCredentialPath,\n} from \"../../domain/agent.types.ts\";\nimport { authenticationForm } from \"../../domain/authentication.ts\";\nimport type { Command, Variables } from \"../../domain/command.types.ts\";\nimport { invariant } from \"../../domain/errors.ts\";\nimport type { AgentModel } from \"../../domain/model.types.ts\";\nimport { credentialRecipes } from \"./authentication.constants.ts\";\nimport type {\n CredentialPlanner,\n CredentialRecipe,\n CredentialStrategy,\n HostFileOptions,\n VariableCredentialOptions,\n} from \"./authentication.types.ts\";\n\nexport function credentialPlan(\n plan: Partial<CredentialPlan> = {},\n): CredentialPlan {\n return Object.freeze({\n variables: Object.freeze({ ...plan.variables }),\n host: Object.freeze([...(plan.host ?? [])]),\n files: Object.freeze([...(plan.files ?? [])]),\n commands: Object.freeze([...(plan.commands ?? [])]),\n });\n}\n\nexport function toolCommand(\n binary: string,\n args: readonly string[],\n options: Pick<Command, \"stdin\" | \"deadlineMs\"> = {},\n): Command {\n return {\n executable: \"node\",\n arguments: [\"-e\", credentialRecipes.tool, binary, ...args],\n ...options,\n };\n}\n\nexport function requiredVariable(variables: Variables, name: string): string {\n const value = variables[name];\n invariant(\n value,\n `Missing ${name}. Declare the selected credential explicitly.`,\n );\n return value;\n}\n\nexport function variableCredential(\n options: VariableCredentialOptions,\n): Readonly<Record<\"preset\" | \"key\" | \"variable\", CredentialRecipe>> {\n const recipe =\n (read: (value: string, variables: Variables) => string): CredentialRecipe =>\n (input) => {\n options.bind?.(input);\n return (variables) => {\n const secret = read(input.value, variables);\n options.accept?.(secret);\n const exposed = options.expose?.(secret, input) ?? {};\n return credentialPlan({\n ...exposed,\n variables: { [options.variable]: secret, ...exposed.variables },\n });\n };\n };\n return {\n preset: recipe((_, variables) =>\n requiredVariable(variables, options.variable),\n ),\n key: (input) => {\n options.accept?.(input.value);\n return recipe((value) => value)(input);\n },\n variable: recipe((value, variables) => requiredVariable(variables, value)),\n };\n}\n\nexport function hostFile(\n options: HostFileOptions,\n): Readonly<Record<\"preset\" | \"file\", CredentialRecipe>> {\n const { files, source, ...credential } = options;\n const recipe =\n (path: HostCredentialPath): CredentialPlanner =>\n () =>\n credentialPlan({\n host: [{ ...credential, source: path }],\n ...(files ? { files } : {}),\n });\n return {\n preset: () => recipe(source),\n file: (input) => recipe({ path: input.value }),\n };\n}\n\nexport function excluding(\n recipe: CredentialRecipe,\n variable: string,\n message: string,\n): CredentialRecipe {\n return (input) => {\n const planFor = recipe(input);\n return (variables) => {\n invariant(!variables[variable], message);\n return planFor(variables);\n };\n };\n}\n\nexport function credentialPlanner(\n agent: string,\n strategy: CredentialStrategy,\n authentication: AgentAuthentication | undefined,\n model?: AgentModel,\n): AgentAdapter[\"credentials\"] {\n if (authentication === undefined) return undefined;\n const { form, value = \"\" } = authenticationForm(authentication);\n const recipe = Object.hasOwn(strategy, form) ? strategy[form] : undefined;\n const accepted = Object.keys(strategy);\n invariant(\n recipe,\n `${agent} does not support ${form} authentication. Accepted forms: ${accepted.length ? accepted.join(\", \") : \"none\"}`,\n );\n return recipe(model === undefined ? { value } : { value, model });\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CredentialPlan, HostCredential } from "../../domain/agent.types.ts";
|
|
2
|
+
import type { AuthenticationForm } from "../../domain/authentication.types.ts";
|
|
3
|
+
import type { Variables } from "../../domain/command.types.ts";
|
|
4
|
+
import type { AgentModel } from "../../domain/model.types.ts";
|
|
5
|
+
export interface CredentialInput {
|
|
6
|
+
readonly value: string;
|
|
7
|
+
readonly model?: AgentModel;
|
|
8
|
+
}
|
|
9
|
+
export type CredentialPlanner = (variables: Variables) => CredentialPlan;
|
|
10
|
+
export type CredentialRecipe = (input: CredentialInput) => CredentialPlanner;
|
|
11
|
+
export type CredentialStrategy = Readonly<Partial<Record<AuthenticationForm, CredentialRecipe>>>;
|
|
12
|
+
export interface VariableCredentialOptions {
|
|
13
|
+
readonly variable: string;
|
|
14
|
+
accept?(secret: string): void;
|
|
15
|
+
bind?(input: CredentialInput): void;
|
|
16
|
+
expose?(secret: string, input: CredentialInput): Partial<CredentialPlan>;
|
|
17
|
+
}
|
|
18
|
+
export interface HostFileOptions extends HostCredential {
|
|
19
|
+
readonly files?: CredentialPlan["files"];
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication.types.js","sourceRoot":"","sources":["../../../src/adapters/agents/authentication.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n CredentialPlan,\n HostCredential,\n} from \"../../domain/agent.types.ts\";\nimport type { AuthenticationForm } from \"../../domain/authentication.types.ts\";\nimport type { Variables } from \"../../domain/command.types.ts\";\nimport type { AgentModel } from \"../../domain/model.types.ts\";\n\nexport interface CredentialInput {\n readonly value: string;\n readonly model?: AgentModel;\n}\n\nexport type CredentialPlanner = (variables: Variables) => CredentialPlan;\n\nexport type CredentialRecipe = (input: CredentialInput) => CredentialPlanner;\n\nexport type CredentialStrategy = Readonly<\n Partial<Record<AuthenticationForm, CredentialRecipe>>\n>;\n\nexport interface VariableCredentialOptions {\n readonly variable: string;\n accept?(secret: string): void;\n bind?(input: CredentialInput): void;\n expose?(secret: string, input: CredentialInput): Partial<CredentialPlan>;\n}\n\nexport interface HostFileOptions extends HostCredential {\n readonly files?: CredentialPlan[\"files\"];\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { invariant } from "../../domain/errors.js";
|
|
2
|
-
import {
|
|
2
|
+
import { credentialPlanner } from "./authentication.js";
|
|
3
|
+
import { claudeCredentials } from "./claude-authentication.js";
|
|
3
4
|
import { claudeEvents, claudeTranscriptUsage } from "./claude-events.js";
|
|
4
5
|
import { claudeRequest } from "./claude-request.js";
|
|
5
6
|
import { CLAUDE_MAX_OUTPUT_VARIABLE, claudeModelSupport, } from "./model-support.constants.js";
|
|
@@ -9,9 +10,10 @@ function bindClaude(settings) {
|
|
|
9
10
|
const maxOutputTokens = settings.model?.maxOutputTokens;
|
|
10
11
|
invariant(maxOutputTokens === undefined ||
|
|
11
12
|
!Object.hasOwn(settings.variables ?? {}, CLAUDE_MAX_OUTPUT_VARIABLE), `Set maxOutputTokens on the agent model or ${CLAUDE_MAX_OUTPUT_VARIABLE}, not both`);
|
|
13
|
+
const credentials = credentialPlanner("Claude Code", claudeCredentials, settings.authentication, settings.model);
|
|
12
14
|
return Object.freeze({
|
|
13
15
|
name: "claude",
|
|
14
|
-
|
|
16
|
+
...(credentials ? { credentials } : {}),
|
|
15
17
|
conversations: "claude",
|
|
16
18
|
resumable: true,
|
|
17
19
|
capture: settings.saveConversations ?? true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-adapter.js","sourceRoot":"","sources":["../../../src/adapters/agents/claude-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"claude-adapter.js","sourceRoot":"","sources":["../../../src/adapters/agents/claude-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGnE,SAAS,UAAU,CAAC,QAA+B;IACjD,YAAY,CAAC,kBAAkB,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IACjD,MAAM,eAAe,GAAG,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IACxD,SAAS,CACP,eAAe,KAAK,SAAS;QAC3B,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,IAAI,EAAE,EAAE,0BAA0B,CAAC,EACtE,6CAA6C,0BAA0B,YAAY,CACpF,CAAC;IACF,MAAM,WAAW,GAAG,iBAAiB,CACnC,aAAa,EACb,iBAAiB,EACjB,QAAQ,CAAC,cAAc,EACvB,QAAQ,CAAC,KAAK,CACf,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,QAAQ;QACd,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvC,aAAa,EAAE,QAAQ;QACvB,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,QAAQ,CAAC,iBAAiB,IAAI,IAAI;QAC3C,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;YACvB,GAAG,QAAQ,CAAC,SAAS;YACrB,GAAG,CAAC,eAAe,KAAK,SAAS;gBAC/B,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,EAAE,CAAC,0BAA0B,CAAC,EAAE,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC;SAC/D,CAAC;QACF,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC;QAClD,MAAM,EAAE,YAAY;QACpB,eAAe,EAAE,qBAAqB;KAChB,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,WAA2B,EAAE;IACzD,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC1B,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,UAAU,CAAC;YACT,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 { invariant } from \"../../domain/errors.ts\";\nimport type { AgentModel } from \"../../domain/model.types.ts\";\nimport { credentialPlanner } from \"./authentication.ts\";\nimport { claudeCredentials } from \"./claude-authentication.ts\";\nimport type { AgentAdapter, CliHarness } from \"../../domain/agent.types.ts\";\nimport { claudeEvents, claudeTranscriptUsage } from \"./claude-events.ts\";\nimport { claudeRequest } from \"./claude-request.ts\";\nimport {\n CLAUDE_MAX_OUTPUT_VARIABLE,\n claudeModelSupport,\n} from \"./model-support.constants.ts\";\nimport { harnessSettings, supportModel } from \"./model-support.ts\";\nimport type { Bound, ClaudeSettings } from \"./settings.types.ts\";\n\nfunction bindClaude(settings: Bound<ClaudeSettings>): AgentAdapter {\n supportModel(claudeModelSupport, settings.model);\n const maxOutputTokens = settings.model?.maxOutputTokens;\n invariant(\n maxOutputTokens === undefined ||\n !Object.hasOwn(settings.variables ?? {}, CLAUDE_MAX_OUTPUT_VARIABLE),\n `Set maxOutputTokens on the agent model or ${CLAUDE_MAX_OUTPUT_VARIABLE}, not both`,\n );\n const credentials = credentialPlanner(\n \"Claude Code\",\n claudeCredentials,\n settings.authentication,\n settings.model,\n );\n return Object.freeze({\n name: \"claude\",\n ...(credentials ? { credentials } : {}),\n conversations: \"claude\",\n resumable: true,\n capture: settings.saveConversations ?? true,\n variables: Object.freeze({\n ...settings.variables,\n ...(maxOutputTokens === undefined\n ? {}\n : { [CLAUDE_MAX_OUTPUT_VARIABLE]: String(maxOutputTokens) }),\n }),\n request: (input) => claudeRequest(settings, input),\n events: claudeEvents,\n transcriptUsage: claudeTranscriptUsage,\n } satisfies AgentAdapter);\n}\n\nexport function claudeHarness(settings: ClaudeSettings = {}): 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 bindClaude({\n ...configured,\n ...(model === undefined ? {} : { model }),\n }),\n });\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { invariant } from "../../domain/errors.js";
|
|
2
|
+
import { credentialVariables } from "./authentication.constants.js";
|
|
3
|
+
import { excluding, hostFile, variableCredential } from "./authentication.js";
|
|
4
|
+
import { asRecord, parseCredential } from "./protocol.js";
|
|
5
|
+
const { account: tokenVariable, usage: keyVariable } = credentialVariables.claude;
|
|
6
|
+
const token = variableCredential({ variable: tokenVariable });
|
|
7
|
+
const key = variableCredential({ variable: keyVariable });
|
|
8
|
+
function subscription(content) {
|
|
9
|
+
const login = asRecord(parseCredential(content, "Claude")).claudeAiOauth;
|
|
10
|
+
invariant(login && typeof login === "object", "The Claude credential file has no claudeAiOauth subscription login");
|
|
11
|
+
return JSON.stringify({ claudeAiOauth: login });
|
|
12
|
+
}
|
|
13
|
+
const file = hostFile({
|
|
14
|
+
source: {
|
|
15
|
+
path: "~/.claude/.credentials.json",
|
|
16
|
+
home: { variable: "CLAUDE_CONFIG_DIR", path: ".credentials.json" },
|
|
17
|
+
},
|
|
18
|
+
destination: { file: ".claude/.credentials.json" },
|
|
19
|
+
login: "claude and /login",
|
|
20
|
+
alternative: `{ account: { variable: "${tokenVariable}" } } with a token from claude setup-token`,
|
|
21
|
+
select: subscription,
|
|
22
|
+
});
|
|
23
|
+
const account = (recipe) => excluding(recipe, keyVariable, `Conflicting Claude authentication: ${keyVariable} takes precedence over account credentials. Remove it or select usage authentication.`);
|
|
24
|
+
const usage = (recipe) => excluding(recipe, tokenVariable, `Conflicting Claude authentication: remove ${tokenVariable} or select account authentication.`);
|
|
25
|
+
export const claudeCredentials = Object.freeze({
|
|
26
|
+
account: account(file.preset),
|
|
27
|
+
"account.file": account(file.file),
|
|
28
|
+
"account.key": account(token.key),
|
|
29
|
+
"account.variable": account(token.variable),
|
|
30
|
+
usage: usage(key.preset),
|
|
31
|
+
"usage.key": usage(key.key),
|
|
32
|
+
"usage.variable": usage(key.variable),
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=claude-authentication.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-authentication.js","sourceRoot":"","sources":["../../../src/adapters/agents/claude-authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,SAAS,E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CAAoC,CAC/F,CAAC;AAEJ,MAAM,CAAC,MAAM,iBAAiB,GAAuB,MAAM,CAAC,MAAM,CAAC;IACjE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;IAC7B,cAAc,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;IAClC,aAAa,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;IACjC,kBAAkB,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC3C,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;IACxB,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;IAC3B,gBAAgB,EAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC;CACtC,CAAC,CAAC","sourcesContent":["import { invariant } from \"../../domain/errors.ts\";\nimport { credentialVariables } from \"./authentication.constants.ts\";\nimport { excluding, hostFile, variableCredential } from \"./authentication.ts\";\nimport type {\n CredentialRecipe,\n CredentialStrategy,\n} from \"./authentication.types.ts\";\nimport { asRecord, parseCredential } from \"./protocol.ts\";\n\nconst { account: tokenVariable, usage: keyVariable } =\n credentialVariables.claude;\nconst token = variableCredential({ variable: tokenVariable });\nconst key = variableCredential({ variable: keyVariable });\n\nfunction subscription(content: string): string {\n const login = asRecord(parseCredential(content, \"Claude\")).claudeAiOauth;\n invariant(\n login && typeof login === \"object\",\n \"The Claude credential file has no claudeAiOauth subscription login\",\n );\n return JSON.stringify({ claudeAiOauth: login });\n}\n\nconst file = hostFile({\n source: {\n path: \"~/.claude/.credentials.json\",\n home: { variable: \"CLAUDE_CONFIG_DIR\", path: \".credentials.json\" },\n },\n destination: { file: \".claude/.credentials.json\" },\n login: \"claude and /login\",\n alternative: `{ account: { variable: \"${tokenVariable}\" } } with a token from claude setup-token`,\n select: subscription,\n});\n\nconst account = (recipe: CredentialRecipe) =>\n excluding(\n recipe,\n keyVariable,\n `Conflicting Claude authentication: ${keyVariable} takes precedence over account credentials. Remove it or select usage authentication.`,\n );\nconst usage = (recipe: CredentialRecipe) =>\n excluding(\n recipe,\n tokenVariable,\n `Conflicting Claude authentication: remove ${tokenVariable} or select account authentication.`,\n );\n\nexport const claudeCredentials: CredentialStrategy = Object.freeze({\n account: account(file.preset),\n \"account.file\": account(file.file),\n \"account.key\": account(token.key),\n \"account.variable\": account(token.variable),\n usage: usage(key.preset),\n \"usage.key\": usage(key.key),\n \"usage.variable\": usage(key.variable),\n});\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { AgentCliScenario } from "./cli-diagnostics.types.ts";
|
|
2
2
|
export declare const cliDiagnosticScenarios: readonly AgentCliScenario[];
|
|
3
3
|
export declare const codexDiagnosticUsage: {
|
|
4
|
-
readonly start: "codex exec";
|
|
5
|
-
readonly resume: "codex exec resume";
|
|
6
|
-
readonly fork: "codex exec fork";
|
|
4
|
+
readonly start: "Usage: codex exec [";
|
|
5
|
+
readonly resume: "Usage: codex exec resume [";
|
|
6
|
+
readonly fork: "Usage: codex exec fork [";
|
|
7
7
|
};
|
|
8
8
|
export declare const claudeDiagnosticUsage: {
|
|
9
|
-
readonly start: "claude";
|
|
10
|
-
readonly resume: "claude";
|
|
11
|
-
readonly fork: "claude";
|
|
9
|
+
readonly start: "Usage: claude [";
|
|
10
|
+
readonly resume: "Usage: claude [";
|
|
11
|
+
readonly fork: "Usage: claude [";
|
|
12
12
|
};
|
|
@@ -12,13 +12,13 @@ export const cliDiagnosticScenarios = [
|
|
|
12
12
|
},
|
|
13
13
|
];
|
|
14
14
|
export const codexDiagnosticUsage = {
|
|
15
|
-
start: "codex exec",
|
|
16
|
-
resume: "codex exec resume",
|
|
17
|
-
fork: "codex exec fork",
|
|
15
|
+
start: "Usage: codex exec [",
|
|
16
|
+
resume: "Usage: codex exec resume [",
|
|
17
|
+
fork: "Usage: codex exec fork [",
|
|
18
18
|
};
|
|
19
19
|
export const claudeDiagnosticUsage = {
|
|
20
|
-
start: "claude",
|
|
21
|
-
resume: "claude",
|
|
22
|
-
fork: "claude",
|
|
20
|
+
start: "Usage: claude [",
|
|
21
|
+
resume: "Usage: claude [",
|
|
22
|
+
fork: "Usage: claude [",
|
|
23
23
|
};
|
|
24
24
|
//# sourceMappingURL=cli-diagnostics.constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-diagnostics.constants.js","sourceRoot":"","sources":["../../../src/adapters/agents/cli-diagnostics.constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,sBAAsB,GAAgC;IACjE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;IAC5B;QACE,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE,EAAE;KACxE;IACD;QACE,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE;YACL,YAAY,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE,IAAI,EAAE,IAAI,EAAE;SACzE;KACF;CACF,CAAC;AACF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"cli-diagnostics.constants.js","sourceRoot":"","sources":["../../../src/adapters/agents/cli-diagnostics.constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,sBAAsB,GAAgC;IACjE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;IAC5B;QACE,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE,EAAE;KACxE;IACD;QACE,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE;YACL,YAAY,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE,IAAI,EAAE,IAAI,EAAE;SACzE;KACF;CACF,CAAC;AACF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,qBAAqB;IAC5B,MAAM,EAAE,4BAA4B;IACpC,IAAI,EAAE,0BAA0B;CACxB,CAAC;AACX,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,KAAK,EAAE,iBAAiB;IACxB,MAAM,EAAE,iBAAiB;IACzB,IAAI,EAAE,iBAAiB;CACf,CAAC","sourcesContent":["import type { AgentCliScenario } from \"./cli-diagnostics.types.ts\";\n\nexport const cliDiagnosticScenarios: readonly AgentCliScenario[] = [\n { mode: \"start\", input: {} },\n {\n mode: \"resume\",\n input: { continuation: { id: \"00000000-0000-0000-0000-000000000000\" } },\n },\n {\n mode: \"fork\",\n input: {\n continuation: { id: \"00000000-0000-0000-0000-000000000000\", fork: true },\n },\n },\n];\nexport const codexDiagnosticUsage = {\n start: \"Usage: codex exec [\",\n resume: \"Usage: codex exec resume [\",\n fork: \"Usage: codex exec fork [\",\n} as const;\nexport const claudeDiagnosticUsage = {\n start: \"Usage: claude [\",\n resume: \"Usage: claude [\",\n fork: \"Usage: claude [\",\n} as const;\n"]}
|
|
@@ -2,3 +2,4 @@ import type { AgentInput } from "../../domain/agent.types.ts";
|
|
|
2
2
|
import type { Command } from "../../domain/command.types.ts";
|
|
3
3
|
import type { AgentCliDiagnostic, AgentCliMode } from "./cli-diagnostics.types.ts";
|
|
4
4
|
export declare function cliDiagnostics(request: (input: AgentInput) => Command, usage: Readonly<Record<AgentCliMode, string>>): readonly AgentCliDiagnostic[];
|
|
5
|
+
export declare function helpDiagnostics(request: (input: AgentInput) => Command, usage: string): readonly AgentCliDiagnostic[];
|
|
@@ -11,4 +11,15 @@ export function cliDiagnostics(request, usage) {
|
|
|
11
11
|
};
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
+
export function helpDiagnostics(request, usage) {
|
|
15
|
+
const command = request({});
|
|
16
|
+
return [
|
|
17
|
+
{
|
|
18
|
+
mode: "start",
|
|
19
|
+
usage,
|
|
20
|
+
options: (command.arguments ?? []).filter((argument) => argument.startsWith("--")),
|
|
21
|
+
command: { executable: command.executable, arguments: ["--help"] },
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
}
|
|
14
25
|
//# sourceMappingURL=cli-diagnostics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-diagnostics.js","sourceRoot":"","sources":["../../../src/adapters/agents/cli-diagnostics.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAMxE,MAAM,UAAU,cAAc,CAC5B,OAAuC,EACvC,KAA6C;IAE7C,OAAO,sBAAsB,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;QACpD,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;QAC/B,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;QACrC,OAAO;YACL,IAAI;YACJ,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC;YAClB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAC7D,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,CAAC,GAAG,IAAI,EAAE,QAAQ,CAAC,EAAE;SACxD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { AgentInput } from \"../../domain/agent.types.ts\";\nimport type { Command } from \"../../domain/command.types.ts\";\nimport { cliDiagnosticScenarios } from \"./cli-diagnostics.constants.ts\";\nimport type {\n AgentCliDiagnostic,\n AgentCliMode,\n} from \"./cli-diagnostics.types.ts\";\n\nexport function cliDiagnostics(\n request: (input: AgentInput) => Command,\n usage: Readonly<Record<AgentCliMode, string>>,\n): readonly AgentCliDiagnostic[] {\n return cliDiagnosticScenarios.map(({ mode, input }) => {\n const command = request(input);\n const args = command.arguments ?? [];\n return {\n mode,\n usage: usage[mode],\n options: args.filter((argument) => argument.startsWith(\"--\")),\n command: { ...command, arguments: [...args, \"--help\"] },\n };\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"cli-diagnostics.js","sourceRoot":"","sources":["../../../src/adapters/agents/cli-diagnostics.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAMxE,MAAM,UAAU,cAAc,CAC5B,OAAuC,EACvC,KAA6C;IAE7C,OAAO,sBAAsB,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;QACpD,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;QAC/B,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;QACrC,OAAO;YACL,IAAI;YACJ,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC;YAClB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAC7D,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,CAAC,GAAG,IAAI,EAAE,QAAQ,CAAC,EAAE;SACxD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,OAAuC,EACvC,KAAa;IAEb,MAAM,OAAO,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC;IAC5B,OAAO;QACL;YACE,IAAI,EAAE,OAAO;YACb,KAAK;YACL,OAAO,EAAE,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CACrD,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAC1B;YACD,OAAO,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE;SACnE;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { AgentInput } from \"../../domain/agent.types.ts\";\nimport type { Command } from \"../../domain/command.types.ts\";\nimport { cliDiagnosticScenarios } from \"./cli-diagnostics.constants.ts\";\nimport type {\n AgentCliDiagnostic,\n AgentCliMode,\n} from \"./cli-diagnostics.types.ts\";\n\nexport function cliDiagnostics(\n request: (input: AgentInput) => Command,\n usage: Readonly<Record<AgentCliMode, string>>,\n): readonly AgentCliDiagnostic[] {\n return cliDiagnosticScenarios.map(({ mode, input }) => {\n const command = request(input);\n const args = command.arguments ?? [];\n return {\n mode,\n usage: usage[mode],\n options: args.filter((argument) => argument.startsWith(\"--\")),\n command: { ...command, arguments: [...args, \"--help\"] },\n };\n });\n}\n\nexport function helpDiagnostics(\n request: (input: AgentInput) => Command,\n usage: string,\n): readonly AgentCliDiagnostic[] {\n const command = request({});\n return [\n {\n mode: \"start\",\n usage,\n options: (command.arguments ?? []).filter((argument) =>\n argument.startsWith(\"--\"),\n ),\n command: { executable: command.executable, arguments: [\"--help\"] },\n },\n ];\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { credentialPlanner } from "./authentication.js";
|
|
2
|
+
import { codexCredentials } from "./codex-authentication.js";
|
|
2
3
|
import { codexProvider } from "./codex-provider.js";
|
|
3
4
|
import { codexEvents } from "./codex-events.js";
|
|
4
5
|
import { codexRequest } from "./codex-request.js";
|
|
@@ -7,9 +8,10 @@ import { harnessSettings, supportModel } from "./model-support.js";
|
|
|
7
8
|
function bindCodex(settings) {
|
|
8
9
|
supportModel(codexModelSupport, settings.model);
|
|
9
10
|
codexProvider(settings);
|
|
11
|
+
const credentials = credentialPlanner("Codex", codexCredentials(settings.modelProvider), settings.authentication, settings.model);
|
|
10
12
|
return Object.freeze({
|
|
11
13
|
name: "codex",
|
|
12
|
-
|
|
14
|
+
...(credentials ? { credentials } : {}),
|
|
13
15
|
conversations: "codex",
|
|
14
16
|
resumable: true,
|
|
15
17
|
capture: settings.saveConversations ?? true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex-adapter.js","sourceRoot":"","sources":["../../../src/adapters/agents/codex-adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"codex-adapter.js","sourceRoot":"","sources":["../../../src/adapters/agents/codex-adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGnE,SAAS,SAAS,CAAC,QAA8B;IAC/C,YAAY,CAAC,iBAAiB,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,aAAa,CAAC,QAAQ,CAAC,CAAC;IACxB,MAAM,WAAW,GAAG,iBAAiB,CACnC,OAAO,EACP,gBAAgB,CAAC,QAAQ,CAAC,aAAa,CAAC,EACxC,QAAQ,CAAC,cAAc,EACvB,QAAQ,CAAC,KAAK,CACf,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,OAAO;QACb,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvC,aAAa,EAAE,OAAO;QACtB,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,QAAQ,CAAC,iBAAiB,IAAI,IAAI;QAC3C,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;QACnD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC;QACjD,MAAM,EAAE,WAAW;KACG,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,WAA0B,EAAE;IACvD,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC1B,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,SAAS,CAAC,EAAE,GAAG,UAAU,EAAE,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;KAC1E,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { AgentModel } from \"../../domain/model.types.ts\";\nimport { credentialPlanner } from \"./authentication.ts\";\nimport { codexCredentials } from \"./codex-authentication.ts\";\nimport type { AgentAdapter, CliHarness } from \"../../domain/agent.types.ts\";\nimport { codexProvider } from \"./codex-provider.ts\";\nimport { codexEvents } from \"./codex-events.ts\";\nimport { codexRequest } from \"./codex-request.ts\";\nimport { codexModelSupport } from \"./model-support.constants.ts\";\nimport { harnessSettings, supportModel } from \"./model-support.ts\";\nimport type { Bound, CodexSettings } from \"./settings.types.ts\";\n\nfunction bindCodex(settings: Bound<CodexSettings>): AgentAdapter {\n supportModel(codexModelSupport, settings.model);\n codexProvider(settings);\n const credentials = credentialPlanner(\n \"Codex\",\n codexCredentials(settings.modelProvider),\n settings.authentication,\n settings.model,\n );\n return Object.freeze({\n name: \"codex\",\n ...(credentials ? { credentials } : {}),\n conversations: \"codex\",\n resumable: true,\n capture: settings.saveConversations ?? true,\n variables: Object.freeze({ ...settings.variables }),\n request: (input) => codexRequest(settings, input),\n events: codexEvents,\n } satisfies AgentAdapter);\n}\n\nexport function codexHarness(settings: CodexSettings = {}): 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 bindCodex({ ...configured, ...(model === undefined ? {} : { model }) }),\n });\n}\n"]}
|
|
@@ -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,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE;KACpD;IACD,WAAW,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE;IACzC,KAAK,EAAE,sDAAsD;IAC7D,WAAW,EAAE,gBAAgB,mBAAmB,CAAC,KAAK,CAAC,KAAK,EAAE;IAC9D,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAClC,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,GAAG,GAAG,kBAAkB,CAAC;IAC7B,QAAQ,EAAE,mBAAmB,CAAC,KAAK,CAAC,KAAK;IACzC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACnB,QAAQ,EAAE;YACR,WAAW,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,gBAAgB,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;SACrE;KACF,CAAC;CACH,CAAC,CAAC;AAEH,SAAS,mBAAmB,CAAC,QAA4B;IACvD,MAAM,QAAQ,GACZ,QAAQ,CAAC,iBAAiB,IAAI,mBAAmB,CAAC,KAAK,CAAC,KAAK,CAAC;IAChE,IAAI,QAAQ,KAAK,KAAK;QAAE,OAAO,EAAE,CAAC;IAClC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,KAAK,EAAE,QAAQ,CAAC,MAAM;QACtB,WAAW,EAAE,QAAQ,CAAC,GAAG;QACzB,gBAAgB,EAAE,QAAQ,CAAC,QAAQ;KACpC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,QAAwC;IAExC,IAAI,QAAQ;QAAE,OAAO,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACnD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,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"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { credentialPlanner } from "./authentication.js";
|
|
2
|
+
import { copilotCredentials } from "./copilot-authentication.js";
|
|
3
|
+
import { copilotEvents } from "./copilot-events.js";
|
|
4
|
+
import { copilotRequest } from "./copilot-request.js";
|
|
5
|
+
import { copilotModelSupport } from "./model-support.constants.js";
|
|
6
|
+
import { harnessSettings, supportModel } from "./model-support.js";
|
|
7
|
+
function bindCopilot(settings) {
|
|
8
|
+
supportModel(copilotModelSupport, settings.model);
|
|
9
|
+
const credentials = credentialPlanner("GitHub Copilot CLI", copilotCredentials, settings.authentication, settings.model);
|
|
10
|
+
return Object.freeze({
|
|
11
|
+
name: "copilot",
|
|
12
|
+
...(credentials ? { credentials } : {}),
|
|
13
|
+
bootstrap: "copilot",
|
|
14
|
+
resumable: false,
|
|
15
|
+
capture: false,
|
|
16
|
+
requiresFinishedEvent: true,
|
|
17
|
+
variables: Object.freeze({
|
|
18
|
+
COPILOT_AUTO_UPDATE: "false",
|
|
19
|
+
...settings.variables,
|
|
20
|
+
}),
|
|
21
|
+
request: (input) => copilotRequest(settings, input),
|
|
22
|
+
events: copilotEvents,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export function copilotHarness(settings = {}) {
|
|
26
|
+
harnessSettings(settings);
|
|
27
|
+
const configured = Object.freeze({
|
|
28
|
+
...settings,
|
|
29
|
+
variables: Object.freeze({ ...settings.variables }),
|
|
30
|
+
});
|
|
31
|
+
return Object.freeze({
|
|
32
|
+
kind: "cli",
|
|
33
|
+
bind: (model) => bindCopilot({
|
|
34
|
+
...configured,
|
|
35
|
+
...(model === undefined ? {} : { model }),
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//# 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":"AAEA,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,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGnE,SAAS,WAAW,CAAC,QAAgC;IACnD,YAAY,CAAC,mBAAmB,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,WAAW,GAAG,iBAAiB,CACnC,oBAAoB,EACpB,kBAAkB,EAClB,QAAQ,CAAC,cAAc,EACvB,QAAQ,CAAC,KAAK,CACf,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,SAAS;QACf,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvC,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE,KAAK;QAChB,OAAO,EAAE,KAAK;QACd,qBAAqB,EAAE,IAAI;QAC3B,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;YACvB,mBAAmB,EAAE,OAAO;YAC5B,GAAG,QAAQ,CAAC,SAAS;SACtB,CAAC;QACF,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC;QACnD,MAAM,EAAE,aAAa;KACC,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,WAA4B,EAAE;IAC3D,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC1B,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,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 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: false,\n capture: false,\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 } 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,45 @@
|
|
|
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 token = typeof user.host === "string" && typeof user.login === "string"
|
|
22
|
+
? asRecord(configuration.authTokens)[`${user.host}:${user.login}`]
|
|
23
|
+
: undefined;
|
|
24
|
+
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.`);
|
|
25
|
+
acceptToken(token);
|
|
26
|
+
return token;
|
|
27
|
+
}
|
|
28
|
+
const file = hostFile({
|
|
29
|
+
source: {
|
|
30
|
+
path: "~/.copilot/config.json",
|
|
31
|
+
home: { variable: "COPILOT_HOME", path: "config.json" },
|
|
32
|
+
},
|
|
33
|
+
destination: { variable },
|
|
34
|
+
login: "copilot login",
|
|
35
|
+
alternative: `{ account: { variable: "${variable}" } }`,
|
|
36
|
+
select: storedToken,
|
|
37
|
+
});
|
|
38
|
+
const token = variableCredential({ variable, accept: acceptToken });
|
|
39
|
+
export const copilotCredentials = Object.freeze({
|
|
40
|
+
account: file.preset,
|
|
41
|
+
"account.file": file.file,
|
|
42
|
+
"account.key": token.key,
|
|
43
|
+
"account.variable": token.variable,
|
|
44
|
+
});
|
|
45
|
+
//# 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,QA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BAA2B,QAAQ,OAAO;IACvD,MAAM,EAAE,WAAW;CACpB,CAAC,CAAC;AAEH,MAAM,KAAK,GAAG,kBAAkB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;AAEpE,MAAM,CAAC,MAAM,kBAAkB,GAAuB,MAAM,CAAC,MAAM,CAAC;IAClE,OAAO,EAAE,IAAI,CAAC,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 token =\n typeof user.host === \"string\" && typeof user.login === \"string\"\n ? asRecord(configuration.authTokens)[`${user.host}:${user.login}`]\n : undefined;\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 [");
|
|
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,CACnB,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 );\n}\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { decodeLine } from "./event-decoder.js";
|
|
2
|
+
import { asRecord } from "./protocol.js";
|
|
3
|
+
function message(event) {
|
|
4
|
+
const data = asRecord(event.data);
|
|
5
|
+
const requests = Array.isArray(data.toolRequests) ? data.toolRequests : [];
|
|
6
|
+
const tools = requests.map(asRecord).flatMap((request) => typeof request.name === "string"
|
|
7
|
+
? [
|
|
8
|
+
{
|
|
9
|
+
kind: "tool",
|
|
10
|
+
name: request.name,
|
|
11
|
+
input: request.arguments,
|
|
12
|
+
...(typeof request.toolCallId === "string"
|
|
13
|
+
? { callId: request.toolCallId }
|
|
14
|
+
: {}),
|
|
15
|
+
},
|
|
16
|
+
]
|
|
17
|
+
: []);
|
|
18
|
+
return typeof data.content === "string" && data.content
|
|
19
|
+
? [{ kind: "text", text: data.content }, ...tools]
|
|
20
|
+
: tools;
|
|
21
|
+
}
|
|
22
|
+
function result(event) {
|
|
23
|
+
const conversation = typeof event.sessionId === "string"
|
|
24
|
+
? [{ kind: "conversation", id: event.sessionId }]
|
|
25
|
+
: [];
|
|
26
|
+
if (event.exitCode === 0 && event.outcome !== "blocked")
|
|
27
|
+
return [...conversation, { kind: "finished" }];
|
|
28
|
+
return [
|
|
29
|
+
...conversation,
|
|
30
|
+
{
|
|
31
|
+
kind: "failure",
|
|
32
|
+
message: event.outcome === "blocked"
|
|
33
|
+
? "GitHub Copilot CLI was blocked before completing the prompt"
|
|
34
|
+
: `GitHub Copilot CLI ended with exit code ${String(event.exitCode ?? "unknown")}`,
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
export function copilotEvents(line) {
|
|
39
|
+
return decodeLine(line, {
|
|
40
|
+
"assistant.message": message,
|
|
41
|
+
"session.error": (event) => {
|
|
42
|
+
const data = asRecord(event.data);
|
|
43
|
+
return typeof data.message === "string"
|
|
44
|
+
? [{ kind: "warning", message: data.message }]
|
|
45
|
+
: [];
|
|
46
|
+
},
|
|
47
|
+
result,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=copilot-events.js.map
|
|
@@ -0,0 +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,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;QACjD,CAAC,CAAC,EAAE,CAAC;IACT,IAAI,KAAK,CAAC,QAAQ,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS;QACrD,OAAO,CAAC,GAAG,YAAY,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;IACjD,OAAO;QACL,GAAG,YAAY;QACf;YACE,IAAI,EAAE,SAAS;YACf,OAAO,EACL,KAAK,CAAC,OAAO,KAAK,SAAS;gBACzB,CAAC,CAAC,6DAA6D;gBAC/D,CAAC,CAAC,2CAA2C,MAAM,CAAC,KAAK,CAAC,QAAQ,IAAI,SAAS,CAAC,EAAE;SACvF;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,UAAU,CAAC,IAAI,EAAE;QACtB,mBAAmB,EAAE,OAAO;QAC5B,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 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 \"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,19 @@
|
|
|
1
|
+
import { invariant } from "../../domain/errors.js";
|
|
2
|
+
export function copilotRequest(settings, input) {
|
|
3
|
+
invariant(!input.continuation, "GitHub Copilot CLI does not support continuation or fork in Outpost");
|
|
4
|
+
const args = [];
|
|
5
|
+
if (settings.model)
|
|
6
|
+
args.push("--model", settings.model.name);
|
|
7
|
+
if (input.interactive)
|
|
8
|
+
return {
|
|
9
|
+
executable: "copilot",
|
|
10
|
+
arguments: [
|
|
11
|
+
...args,
|
|
12
|
+
...(input.text === undefined ? [] : ["--interactive", input.text]),
|
|
13
|
+
],
|
|
14
|
+
interactive: true,
|
|
15
|
+
};
|
|
16
|
+
args.push("--output-format", "json", "--allow-all", "--no-ask-user");
|
|
17
|
+
return { executable: "copilot", arguments: args, stdin: input.text ?? "" };
|
|
18
|
+
}
|
|
19
|
+
//# 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":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAInD,MAAM,UAAU,cAAc,CAC5B,QAAgC,EAChC,KAAiB;IAEjB,SAAS,CACP,CAAC,KAAK,CAAC,YAAY,EACnB,qEAAqE,CACtE,CAAC;IACF,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,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 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,\n \"GitHub Copilot CLI does not support continuation or fork in Outpost\",\n );\n const args: string[] = [];\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"]}
|