@finalai/final-agent-provider 0.10.0 → 0.11.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/HOSTING.md +334 -245
- package/README.md +126 -40
- package/WORKSPACE-EGRESS.md +11 -11
- package/dist/modules/catalog.d.mts +9 -0
- package/dist/modules/catalog.mjs +21 -0
- package/dist/modules/catalog.mjs.map +7 -0
- package/dist/modules/channels/projection.mjs +15 -8
- package/dist/modules/channels/projection.mjs.map +2 -2
- package/dist/modules/harnesses/acp-agent.d.mts +4 -0
- package/dist/modules/harnesses/acp-agent.mjs +35 -0
- package/dist/modules/harnesses/acp-agent.mjs.map +7 -0
- package/dist/modules/harnesses/adapters.d.mts +7 -0
- package/dist/modules/harnesses/adapters.mjs +74 -0
- package/dist/modules/harnesses/adapters.mjs.map +7 -0
- package/dist/modules/harnesses/claude-code.d.mts +14 -0
- package/dist/modules/harnesses/claude-code.mjs +79 -0
- package/dist/modules/harnesses/claude-code.mjs.map +7 -0
- package/dist/modules/harnesses/codex.d.mts +12 -0
- package/dist/modules/harnesses/codex.mjs +90 -0
- package/dist/modules/harnesses/codex.mjs.map +7 -0
- package/dist/modules/harnesses/config-fields.d.mts +98 -57
- package/dist/modules/harnesses/config-fields.mjs +58 -35
- package/dist/modules/harnesses/config-fields.mjs.map +3 -3
- package/dist/modules/harnesses/definitions.d.mts +3 -0
- package/dist/modules/harnesses/definitions.mjs +21 -0
- package/dist/modules/harnesses/definitions.mjs.map +7 -0
- package/dist/modules/harnesses/fidelity.d.mts +1 -1
- package/dist/modules/harnesses/fidelity.mjs +19 -16
- package/dist/modules/harnesses/fidelity.mjs.map +2 -2
- package/dist/modules/harnesses/final.d.mts +12 -0
- package/dist/modules/harnesses/final.mjs +70 -0
- package/dist/modules/harnesses/final.mjs.map +7 -0
- package/dist/modules/harnesses/index.d.mts +13 -12
- package/dist/modules/harnesses/index.mjs +86 -45
- package/dist/modules/harnesses/index.mjs.map +3 -3
- package/dist/modules/harnesses/names.d.mts +43 -0
- package/dist/modules/harnesses/names.mjs +59 -0
- package/dist/modules/harnesses/names.mjs.map +7 -0
- package/dist/modules/harnesses/nanocode-claude.d.mts +18 -0
- package/dist/modules/harnesses/nanocode-claude.mjs +101 -0
- package/dist/modules/harnesses/nanocode-claude.mjs.map +7 -0
- package/dist/modules/harnesses/nanocode-codex.d.mts +13 -0
- package/dist/modules/harnesses/nanocode-codex.mjs +64 -0
- package/dist/modules/harnesses/nanocode-codex.mjs.map +7 -0
- package/dist/modules/harnesses/pi.d.mts +12 -0
- package/dist/modules/harnesses/pi.mjs +71 -0
- package/dist/modules/harnesses/pi.mjs.map +7 -0
- package/dist/modules/integrations.d.mts +9 -0
- package/dist/modules/integrations.mjs +29 -0
- package/dist/modules/integrations.mjs.map +7 -0
- package/dist/modules/provider/general.bundle.d.mts +1 -0
- package/dist/modules/provider/general.bundle.mjs +5 -0
- package/dist/modules/provider/general.bundle.mjs.map +7 -0
- package/dist/modules/provider/general.d.mts +11 -0
- package/dist/modules/provider/general.mjs +130 -0
- package/dist/modules/provider/general.mjs.map +7 -0
- package/dist/modules/provider/index.d.mts +3 -0
- package/dist/modules/provider/index.mjs +13 -0
- package/dist/modules/provider/index.mjs.map +7 -0
- package/dist/modules/sandboxes/access.d.mts +34 -0
- package/dist/modules/sandboxes/access.mjs +15 -0
- package/dist/modules/sandboxes/access.mjs.map +7 -0
- package/dist/modules/sandboxes/computer.d.mts +24 -51
- package/dist/modules/sandboxes/computer.mjs +523 -888
- package/dist/modules/sandboxes/computer.mjs.map +3 -3
- package/dist/modules/sandboxes/computers-api.d.mts +3 -2
- package/dist/modules/sandboxes/computers-api.mjs +2 -4
- package/dist/modules/sandboxes/computers-api.mjs.map +2 -2
- package/dist/modules/sandboxes/device-api.d.mts +4 -3
- package/dist/modules/sandboxes/device-api.mjs +2 -4
- package/dist/modules/sandboxes/device-api.mjs.map +2 -2
- package/dist/modules/sandboxes/device.d.mts +6 -6
- package/dist/modules/sandboxes/device.mjs +126 -121
- package/dist/modules/sandboxes/device.mjs.map +3 -3
- package/dist/modules/sandboxes/egress.d.mts +10 -9
- package/dist/modules/sandboxes/egress.mjs +73 -56
- package/dist/modules/sandboxes/egress.mjs.map +2 -2
- package/dist/modules/sandboxes/environment.d.mts +35 -269
- package/dist/modules/sandboxes/environment.mjs +27 -104
- package/dist/modules/sandboxes/environment.mjs.map +3 -3
- package/dist/modules/sandboxes/index.d.mts +9 -69
- package/dist/modules/sandboxes/index.mjs +35 -95
- package/dist/modules/sandboxes/index.mjs.map +3 -3
- package/dist/modules/sandboxes/local.d.mts +28 -0
- package/dist/modules/sandboxes/local.mjs +499 -0
- package/dist/modules/sandboxes/local.mjs.map +7 -0
- package/dist/modules/sandboxes/session.d.mts +0 -3
- package/dist/modules/sandboxes/session.mjs +2 -22
- package/dist/modules/sandboxes/session.mjs.map +2 -2
- package/dist/modules/sandboxes/testing/fake-machine.mjs +0 -28
- package/dist/modules/sandboxes/testing/fake-machine.mjs.map +2 -2
- package/package.json +76 -104
- package/dist/modules/connections.d.mts +0 -11
- package/dist/modules/connections.mjs +0 -16
- package/dist/modules/connections.mjs.map +0 -7
- package/dist/modules/harnesses/acp-describe.d.mts +0 -20
- package/dist/modules/harnesses/acp-describe.mjs +0 -110
- package/dist/modules/harnesses/acp-describe.mjs.map +0 -7
- package/dist/modules/harnesses/local-stdio.d.mts +0 -47
- package/dist/modules/harnesses/local-stdio.mjs +0 -41
- package/dist/modules/harnesses/local-stdio.mjs.map +0 -7
- package/dist/modules/harnesses/remote-acp.d.mts +0 -76
- package/dist/modules/harnesses/remote-acp.mjs +0 -83
- package/dist/modules/harnesses/remote-acp.mjs.map +0 -7
- package/dist/modules/harnesses/remote-claude-code.d.mts +0 -88
- package/dist/modules/harnesses/remote-claude-code.mjs +0 -113
- package/dist/modules/harnesses/remote-claude-code.mjs.map +0 -7
- package/dist/modules/harnesses/remote-client-tls.d.mts +0 -35
- package/dist/modules/harnesses/remote-client-tls.mjs +0 -37
- package/dist/modules/harnesses/remote-client-tls.mjs.map +0 -7
- package/dist/modules/harnesses/remote-codex.d.mts +0 -98
- package/dist/modules/harnesses/remote-codex.mjs +0 -128
- package/dist/modules/harnesses/remote-codex.mjs.map +0 -7
- package/dist/modules/harnesses/remote-pi.d.mts +0 -78
- package/dist/modules/harnesses/remote-pi.mjs +0 -104
- package/dist/modules/harnesses/remote-pi.mjs.map +0 -7
- package/dist/modules/harnesses/remote-url.d.mts +0 -5
- package/dist/modules/harnesses/remote-url.mjs +0 -19
- package/dist/modules/harnesses/remote-url.mjs.map +0 -7
- package/dist/modules/harnesses/serverless-final.d.mts +0 -63
- package/dist/modules/harnesses/serverless-final.mjs +0 -88
- package/dist/modules/harnesses/serverless-final.mjs.map +0 -7
- package/dist/modules/harnesses/serverless-nanocode-claude.d.mts +0 -64
- package/dist/modules/harnesses/serverless-nanocode-claude.mjs +0 -105
- package/dist/modules/harnesses/serverless-nanocode-claude.mjs.map +0 -7
- package/dist/modules/harnesses/serverless-nanocode-codex.d.mts +0 -66
- package/dist/modules/harnesses/serverless-nanocode-codex.mjs +0 -113
- package/dist/modules/harnesses/serverless-nanocode-codex.mjs.map +0 -7
- package/dist/modules/harnesses/serverless-pi.d.mts +0 -64
- package/dist/modules/harnesses/serverless-pi.mjs +0 -98
- package/dist/modules/harnesses/serverless-pi.mjs.map +0 -7
- package/dist/modules/runtime/index.d.mts +0 -7
- package/dist/modules/runtime/index.mjs +0 -18
- package/dist/modules/runtime/index.mjs.map +0 -7
- package/dist/modules/runtime/local-stdio.d.mts +0 -10
- package/dist/modules/runtime/local-stdio.mjs +0 -106
- package/dist/modules/runtime/local-stdio.mjs.map +0 -7
- package/dist/modules/runtime/remote-acp.d.mts +0 -16
- package/dist/modules/runtime/remote-acp.mjs +0 -152
- package/dist/modules/runtime/remote-acp.mjs.map +0 -7
- package/dist/modules/runtime/remote-claude-code.d.mts +0 -5
- package/dist/modules/runtime/remote-claude-code.mjs +0 -47
- package/dist/modules/runtime/remote-claude-code.mjs.map +0 -7
- package/dist/modules/runtime/remote-codex.d.mts +0 -5
- package/dist/modules/runtime/remote-codex.mjs +0 -47
- package/dist/modules/runtime/remote-codex.mjs.map +0 -7
- package/dist/modules/runtime/remote-host.d.mts +0 -127
- package/dist/modules/runtime/remote-host.mjs +0 -387
- package/dist/modules/runtime/remote-host.mjs.map +0 -7
- package/dist/modules/runtime/remote-pi.d.mts +0 -5
- package/dist/modules/runtime/remote-pi.mjs +0 -44
- package/dist/modules/runtime/remote-pi.mjs.map +0 -7
- package/dist/modules/sandboxes/guide.d.mts +0 -35
- package/dist/modules/sandboxes/guide.mjs +0 -119
- package/dist/modules/sandboxes/guide.mjs.map +0 -7
- package/dist/modules/sandboxes/workspace-setup.d.mts +0 -42
- package/dist/modules/sandboxes/workspace-setup.mjs +0 -242
- package/dist/modules/sandboxes/workspace-setup.mjs.map +0 -7
- package/dist/modules/testing/harness.d.mts +0 -9
- package/dist/modules/testing/harness.mjs +0 -123
- package/dist/modules/testing/harness.mjs.map +0 -7
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/harnesses/adapters.ts"],
|
|
4
|
+
"sourcesContent": ["import { defineAcpAdapter } from '@finalai/agent-definition/authoring';\nimport { FinalExtension, type AcpAdapterDefinitionIface } from '@finalai/agent-provider';\nimport { REQUIRED_FINAL_EXTENSIONS } from \"../provider/general.mjs\";\nimport { FinalAcpAdapter, FinalHarnessInterface } from \"./names.mjs\";\n\n// Final's ACP adapters. Each implements ACP v2 and Final's ACP extensions and\n// advertises them in `initialize`; the general harness provider refuses an\n// adapter that does not (../provider/general.ts). Fork is optional.\n\n// The worker runtime's engines that map a harness program to ACP v2. The\n// worker program started is the engine; the harness's own program comes in\n// its input (`{ harness: { program }, configuration }`).\nexport const PI_ACP_ADAPTER: AcpAdapterDefinitionIface = defineAcpAdapter({\n title: 'Pi ACP adapter',\n description: 'Maps the Pi agent loop (Pi and the Final harness) to ACP v2 on a worker runtime.',\n adapts: [FinalHarnessInterface.PiAgent],\n run: { worker: { program: 'pi' } },\n extensions: [...REQUIRED_FINAL_EXTENSIONS],\n});\n\nexport const NANOCODE_ACP_ADAPTER: AcpAdapterDefinitionIface = defineAcpAdapter({\n title: 'nanocode ACP adapter',\n description: \"Maps nanocode's Claude and Codex engines to ACP v2 on a worker runtime.\",\n adapts: [FinalHarnessInterface.Nanocode],\n run: { worker: { program: 'nanocode' } },\n extensions: [...REQUIRED_FINAL_EXTENSIONS],\n});\n\n// The process adapters are published packages. Each takes the harness's\n// command line after `--` and launches it as the program it adapts; the\n// permission level is Final's (`ask`, `review`, `auto`), mapped by the\n// adapter onto the program's own modes.\nconst permissionArgs = {\n when: 'configuration.permissionMode',\n args: ['--permission-mode', '{{configuration.permissionMode}}'],\n};\n\nexport const CLAUDE_CODE_ACP_ADAPTER: AcpAdapterDefinitionIface = defineAcpAdapter({\n title: 'Claude Code ACP adapter',\n description: 'Runs Claude Code through the Claude Agent SDK and speaks ACP v2 on stdio.',\n adapts: [FinalHarnessInterface.ClaudeAgentSdk],\n run: {\n process: {\n command: 'npx',\n args: [\n '-y',\n '@finalai/acp-adapter-claude-code',\n permissionArgs,\n '--',\n '{{harness.command}}',\n { spread: 'harness.args' },\n ],\n },\n },\n extensions: [...REQUIRED_FINAL_EXTENSIONS, FinalExtension.Fork],\n});\n\nexport const CODEX_ACP_ADAPTER: AcpAdapterDefinitionIface = defineAcpAdapter({\n title: 'Codex ACP adapter',\n description: 'Runs the Codex app-server and speaks ACP v2 on stdio.',\n adapts: [FinalHarnessInterface.CodexAppServer],\n run: {\n process: {\n command: 'npx',\n args: [\n '-y',\n '@finalai/acp-adapter-codex',\n permissionArgs,\n '--',\n '{{harness.command}}',\n { spread: 'harness.args' },\n ],\n },\n },\n extensions: [...REQUIRED_FINAL_EXTENSIONS],\n});\n\nexport const FINAL_ACP_ADAPTERS: Record<FinalAcpAdapter, AcpAdapterDefinitionIface> = {\n [FinalAcpAdapter.Pi]: PI_ACP_ADAPTER,\n [FinalAcpAdapter.Nanocode]: NANOCODE_ACP_ADAPTER,\n [FinalAcpAdapter.ClaudeCode]: CLAUDE_CODE_ACP_ADAPTER,\n [FinalAcpAdapter.Codex]: CODEX_ACP_ADAPTER,\n};\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,wBAAwB;AACjC,SAAS,sBAAsD;AAC/D,SAAS,iCAAiC;AAC1C,SAAS,iBAAiB,6BAA6B;AAShD,MAAM,iBAA4C,iBAAiB;AAAA,EACxE,OAAO;AAAA,EACP,aAAa;AAAA,EACb,QAAQ,CAAC,sBAAsB,OAAO;AAAA,EACtC,KAAK,EAAE,QAAQ,EAAE,SAAS,KAAK,EAAE;AAAA,EACjC,YAAY,CAAC,GAAG,yBAAyB;AAC3C,CAAC;AAEM,MAAM,uBAAkD,iBAAiB;AAAA,EAC9E,OAAO;AAAA,EACP,aAAa;AAAA,EACb,QAAQ,CAAC,sBAAsB,QAAQ;AAAA,EACvC,KAAK,EAAE,QAAQ,EAAE,SAAS,WAAW,EAAE;AAAA,EACvC,YAAY,CAAC,GAAG,yBAAyB;AAC3C,CAAC;AAMD,MAAM,iBAAiB;AAAA,EACrB,MAAM;AAAA,EACN,MAAM,CAAC,qBAAqB,kCAAkC;AAChE;AAEO,MAAM,0BAAqD,iBAAiB;AAAA,EACjF,OAAO;AAAA,EACP,aAAa;AAAA,EACb,QAAQ,CAAC,sBAAsB,cAAc;AAAA,EAC7C,KAAK;AAAA,IACH,SAAS;AAAA,MACP,SAAS;AAAA,MACT,MAAM;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,EAAE,QAAQ,eAAe;AAAA,MAC3B;AAAA,IACF;AAAA,EACF;AAAA,EACA,YAAY,CAAC,GAAG,2BAA2B,eAAe,IAAI;AAChE,CAAC;AAEM,MAAM,oBAA+C,iBAAiB;AAAA,EAC3E,OAAO;AAAA,EACP,aAAa;AAAA,EACb,QAAQ,CAAC,sBAAsB,cAAc;AAAA,EAC7C,KAAK;AAAA,IACH,SAAS;AAAA,MACP,SAAS;AAAA,MACT,MAAM;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,EAAE,QAAQ,eAAe;AAAA,MAC3B;AAAA,IACF;AAAA,EACF;AAAA,EACA,YAAY,CAAC,GAAG,yBAAyB;AAC3C,CAAC;AAEM,MAAM,qBAAyE;AAAA,EACpF,CAAC,gBAAgB,EAAE,GAAG;AAAA,EACtB,CAAC,gBAAgB,QAAQ,GAAG;AAAA,EAC5B,CAAC,gBAAgB,UAAU,GAAG;AAAA,EAC9B,CAAC,gBAAgB,KAAK,GAAG;AAC3B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type HarnessDefinitionIface, type HarnessEnvironmentIface, type HarnessSettingsIface } from '@finalai/agent-provider';
|
|
2
|
+
import { type InferenceInput, type PermissionInput } from "./config-fields.mjs";
|
|
3
|
+
export declare const CLAUDE_CODE_NATIVE_TOOLS: {
|
|
4
|
+
files: string[];
|
|
5
|
+
shell: string[];
|
|
6
|
+
};
|
|
7
|
+
export declare const CLAUDE_CODE_HARNESS: HarnessDefinitionIface;
|
|
8
|
+
export interface ClaudeCodeInputIface {
|
|
9
|
+
model?: string;
|
|
10
|
+
inference?: InferenceInput;
|
|
11
|
+
permissionMode?: PermissionInput;
|
|
12
|
+
environment?: HarnessEnvironmentIface;
|
|
13
|
+
}
|
|
14
|
+
export declare const claudeCode: ({ environment, ...configuration }?: ClaudeCodeInputIface) => HarnessSettingsIface;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { defineHarness } from "@finalai/agent-definition/authoring";
|
|
2
|
+
import {
|
|
3
|
+
CredentialDelivery,
|
|
4
|
+
HarnessFeature,
|
|
5
|
+
InferenceSourceKind,
|
|
6
|
+
McpTransportKind,
|
|
7
|
+
PermissionLevel,
|
|
8
|
+
PromptWhileRunning,
|
|
9
|
+
SandboxWire
|
|
10
|
+
} from "@finalai/agent-provider";
|
|
11
|
+
import {
|
|
12
|
+
configObjectJson,
|
|
13
|
+
harnessSettings,
|
|
14
|
+
inferenceJson,
|
|
15
|
+
permissionModeJson
|
|
16
|
+
} from "./config-fields.mjs";
|
|
17
|
+
import { ModelVendor } from "./model-reference.mjs";
|
|
18
|
+
import { FinalAcpAdapter, FinalHarness, FinalHarnessInterface } from "./names.mjs";
|
|
19
|
+
const CLAUDE_CODE_NATIVE_TOOLS = {
|
|
20
|
+
files: ["Read", "Write", "Edit", "Glob", "Grep", "NotebookEdit"],
|
|
21
|
+
shell: ["Bash", "BashOutput", "KillShell"]
|
|
22
|
+
};
|
|
23
|
+
const CLAUDE_CODE_HARNESS = defineHarness({
|
|
24
|
+
title: "Claude Code",
|
|
25
|
+
description: "Claude Code, run as a process on the machine it works on.",
|
|
26
|
+
configurationSchema: configObjectJson({
|
|
27
|
+
title: "Claude Code",
|
|
28
|
+
properties: {
|
|
29
|
+
model: { $ref: "final://schemas/model-picker", type: "string", minLength: 1 },
|
|
30
|
+
inference: inferenceJson(),
|
|
31
|
+
permissionMode: permissionModeJson()
|
|
32
|
+
}
|
|
33
|
+
}),
|
|
34
|
+
// Claude Code takes no skills, and its allow-lists cannot carry an agent's
|
|
35
|
+
// per-tool approvals.
|
|
36
|
+
features: [HarnessFeature.McpTools, HarnessFeature.SystemInstructions],
|
|
37
|
+
lowestPermission: PermissionLevel.Ask,
|
|
38
|
+
inference: {
|
|
39
|
+
vendors: [ModelVendor.Anthropic],
|
|
40
|
+
kinds: [
|
|
41
|
+
InferenceSourceKind.Harness,
|
|
42
|
+
InferenceSourceKind.Subscription,
|
|
43
|
+
InferenceSourceKind.ApiKey,
|
|
44
|
+
InferenceSourceKind.Final
|
|
45
|
+
],
|
|
46
|
+
delivery: CredentialDelivery.AtOpen
|
|
47
|
+
},
|
|
48
|
+
native: {
|
|
49
|
+
files: { tools: CLAUDE_CODE_NATIVE_TOOLS.files },
|
|
50
|
+
shell: { tools: CLAUDE_CODE_NATIVE_TOOLS.shell }
|
|
51
|
+
},
|
|
52
|
+
interface: FinalHarnessInterface.ClaudeAgentSdk,
|
|
53
|
+
adapter: FinalAcpAdapter.ClaudeCode,
|
|
54
|
+
run: {
|
|
55
|
+
process: {
|
|
56
|
+
command: "claude",
|
|
57
|
+
args: [{ when: "configuration.model", args: ["--model", "{{configuration.model}}"] }]
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
// The adapter proxies every MCP server it is handed (acp ones over the ACP connection)
|
|
61
|
+
// and reports full tool results.
|
|
62
|
+
mcp: [McpTransportKind.Acp, McpTransportKind.Http, McpTransportKind.Stdio],
|
|
63
|
+
consumes: [SandboxWire.Mcp],
|
|
64
|
+
supports: { observe: true, resumeReplay: true, fork: true, authorMeta: true },
|
|
65
|
+
// The adapter pushes it into the running query; Claude Code takes it at its next step; one idle ends both.
|
|
66
|
+
promptWhileRunning: PromptWhileRunning.Inject,
|
|
67
|
+
// Its stdio belongs to the session service's connection to the sandbox.
|
|
68
|
+
sessionSurvivesDisconnect: false
|
|
69
|
+
});
|
|
70
|
+
const claudeCode = ({
|
|
71
|
+
environment,
|
|
72
|
+
...configuration
|
|
73
|
+
} = {}) => harnessSettings({ harness: FinalHarness.ClaudeCode, configuration, environment });
|
|
74
|
+
export {
|
|
75
|
+
CLAUDE_CODE_HARNESS,
|
|
76
|
+
CLAUDE_CODE_NATIVE_TOOLS,
|
|
77
|
+
claudeCode
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=claude-code.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/harnesses/claude-code.ts"],
|
|
4
|
+
"sourcesContent": ["import { defineHarness } from '@finalai/agent-definition/authoring';\nimport {\n CredentialDelivery,\n HarnessFeature,\n InferenceSourceKind,\n McpTransportKind,\n PermissionLevel,\n PromptWhileRunning,\n SandboxWire,\n type HarnessDefinitionIface,\n type HarnessEnvironmentIface,\n type HarnessSettingsIface,\n} from '@finalai/agent-provider';\nimport {\n configObjectJson,\n harnessSettings,\n inferenceJson,\n permissionModeJson,\n type InferenceInput,\n type PermissionInput,\n} from \"./config-fields.mjs\";\nimport { ModelVendor } from \"./model-reference.mjs\";\nimport { FinalAcpAdapter, FinalHarness, FinalHarnessInterface } from \"./names.mjs\";\n\n// Claude Code as a process on a machine (a computer, a device, your own host),\n// behind Final's ACP adapter on the Claude Agent SDK. Its own file and shell\n// tools work on the machine it runs on, which is therefore the sandbox\n// provided for `files` and `shell`; provided screens reach it as the sandbox\n// MCP projection.\n\nexport const CLAUDE_CODE_NATIVE_TOOLS = {\n files: ['Read', 'Write', 'Edit', 'Glob', 'Grep', 'NotebookEdit'],\n shell: ['Bash', 'BashOutput', 'KillShell'],\n};\n\nexport const CLAUDE_CODE_HARNESS: HarnessDefinitionIface = defineHarness({\n title: 'Claude Code',\n description: 'Claude Code, run as a process on the machine it works on.',\n configurationSchema: configObjectJson({\n title: 'Claude Code',\n properties: {\n model: { $ref: 'final://schemas/model-picker', type: 'string', minLength: 1 },\n inference: inferenceJson(),\n permissionMode: permissionModeJson(),\n },\n }),\n // Claude Code takes no skills, and its allow-lists cannot carry an agent's\n // per-tool approvals.\n features: [HarnessFeature.McpTools, HarnessFeature.SystemInstructions],\n lowestPermission: PermissionLevel.Ask,\n inference: {\n vendors: [ModelVendor.Anthropic],\n kinds: [\n InferenceSourceKind.Harness,\n InferenceSourceKind.Subscription,\n InferenceSourceKind.ApiKey,\n InferenceSourceKind.Final,\n ],\n delivery: CredentialDelivery.AtOpen,\n },\n native: {\n files: { tools: CLAUDE_CODE_NATIVE_TOOLS.files },\n shell: { tools: CLAUDE_CODE_NATIVE_TOOLS.shell },\n },\n interface: FinalHarnessInterface.ClaudeAgentSdk,\n adapter: FinalAcpAdapter.ClaudeCode,\n run: {\n process: {\n command: 'claude',\n args: [{ when: 'configuration.model', args: ['--model', '{{configuration.model}}'] }],\n },\n },\n // The adapter proxies every MCP server it is handed (acp ones over the ACP connection)\n // and reports full tool results.\n mcp: [McpTransportKind.Acp, McpTransportKind.Http, McpTransportKind.Stdio],\n consumes: [SandboxWire.Mcp],\n supports: { observe: true, resumeReplay: true, fork: true, authorMeta: true },\n // The adapter pushes it into the running query; Claude Code takes it at its next step; one idle ends both.\n promptWhileRunning: PromptWhileRunning.Inject,\n // Its stdio belongs to the session service's connection to the sandbox.\n sessionSurvivesDisconnect: false,\n});\n\nexport interface ClaudeCodeInputIface {\n model?: string;\n // Absent: only the CLI's own login on the machine.\n inference?: InferenceInput;\n permissionMode?: PermissionInput;\n // The sandbox it runs in (absent: the one provided for `shell`), or an ACP\n // endpoint already running it: `atUrl({ url, hop })`.\n environment?: HarnessEnvironmentIface;\n}\n\nexport const claudeCode = ({\n environment,\n ...configuration\n}: ClaudeCodeInputIface = {}): HarnessSettingsIface =>\n harnessSettings({ harness: FinalHarness.ClaudeCode, configuration, environment });\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB,cAAc,6BAA6B;AAQ9D,MAAM,2BAA2B;AAAA,EACtC,OAAO,CAAC,QAAQ,SAAS,QAAQ,QAAQ,QAAQ,cAAc;AAAA,EAC/D,OAAO,CAAC,QAAQ,cAAc,WAAW;AAC3C;AAEO,MAAM,sBAA8C,cAAc;AAAA,EACvE,OAAO;AAAA,EACP,aAAa;AAAA,EACb,qBAAqB,iBAAiB;AAAA,IACpC,OAAO;AAAA,IACP,YAAY;AAAA,MACV,OAAO,EAAE,MAAM,gCAAgC,MAAM,UAAU,WAAW,EAAE;AAAA,MAC5E,WAAW,cAAc;AAAA,MACzB,gBAAgB,mBAAmB;AAAA,IACrC;AAAA,EACF,CAAC;AAAA;AAAA;AAAA,EAGD,UAAU,CAAC,eAAe,UAAU,eAAe,kBAAkB;AAAA,EACrE,kBAAkB,gBAAgB;AAAA,EAClC,WAAW;AAAA,IACT,SAAS,CAAC,YAAY,SAAS;AAAA,IAC/B,OAAO;AAAA,MACL,oBAAoB;AAAA,MACpB,oBAAoB;AAAA,MACpB,oBAAoB;AAAA,MACpB,oBAAoB;AAAA,IACtB;AAAA,IACA,UAAU,mBAAmB;AAAA,EAC/B;AAAA,EACA,QAAQ;AAAA,IACN,OAAO,EAAE,OAAO,yBAAyB,MAAM;AAAA,IAC/C,OAAO,EAAE,OAAO,yBAAyB,MAAM;AAAA,EACjD;AAAA,EACA,WAAW,sBAAsB;AAAA,EACjC,SAAS,gBAAgB;AAAA,EACzB,KAAK;AAAA,IACH,SAAS;AAAA,MACP,SAAS;AAAA,MACT,MAAM,CAAC,EAAE,MAAM,uBAAuB,MAAM,CAAC,WAAW,yBAAyB,EAAE,CAAC;AAAA,IACtF;AAAA,EACF;AAAA;AAAA;AAAA,EAGA,KAAK,CAAC,iBAAiB,KAAK,iBAAiB,MAAM,iBAAiB,KAAK;AAAA,EACzE,UAAU,CAAC,YAAY,GAAG;AAAA,EAC1B,UAAU,EAAE,SAAS,MAAM,cAAc,MAAM,MAAM,MAAM,YAAY,KAAK;AAAA;AAAA,EAE5E,oBAAoB,mBAAmB;AAAA;AAAA,EAEvC,2BAA2B;AAC7B,CAAC;AAYM,MAAM,aAAa,CAAC;AAAA,EACzB;AAAA,EACA,GAAG;AACL,IAA0B,CAAC,MACzB,gBAAgB,EAAE,SAAS,aAAa,YAAY,eAAe,YAAY,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type HarnessDefinitionIface, type HarnessEnvironmentIface, type HarnessSettingsIface } from '@finalai/agent-provider';
|
|
2
|
+
import { ReasoningLevel, type InferenceInput, type PermissionInput } from "./config-fields.mjs";
|
|
3
|
+
export declare const CODEX_APP_SERVER_REASONING_LEVELS: readonly [ReasoningLevel.Minimal, ReasoningLevel.Low, ReasoningLevel.Medium, ReasoningLevel.High];
|
|
4
|
+
export declare const CODEX_HARNESS: HarnessDefinitionIface;
|
|
5
|
+
export interface CodexInputIface {
|
|
6
|
+
model?: string;
|
|
7
|
+
reasoning?: (typeof CODEX_APP_SERVER_REASONING_LEVELS)[number] | `${(typeof CODEX_APP_SERVER_REASONING_LEVELS)[number]}`;
|
|
8
|
+
inference?: InferenceInput;
|
|
9
|
+
permissionMode?: PermissionInput;
|
|
10
|
+
environment?: HarnessEnvironmentIface;
|
|
11
|
+
}
|
|
12
|
+
export declare const codex: ({ environment, ...configuration }?: CodexInputIface) => HarnessSettingsIface;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { defineHarness } from "@finalai/agent-definition/authoring";
|
|
2
|
+
import {
|
|
3
|
+
CredentialDelivery,
|
|
4
|
+
HarnessFeature,
|
|
5
|
+
InferenceSourceKind,
|
|
6
|
+
McpTransportKind,
|
|
7
|
+
PermissionLevel,
|
|
8
|
+
PromptWhileRunning,
|
|
9
|
+
SandboxWire
|
|
10
|
+
} from "@finalai/agent-provider";
|
|
11
|
+
import {
|
|
12
|
+
configObjectJson,
|
|
13
|
+
harnessSettings,
|
|
14
|
+
inferenceJson,
|
|
15
|
+
permissionModeJson,
|
|
16
|
+
reasoningJson,
|
|
17
|
+
ReasoningLevel
|
|
18
|
+
} from "./config-fields.mjs";
|
|
19
|
+
import { ModelVendor } from "./model-reference.mjs";
|
|
20
|
+
import { FinalAcpAdapter, FinalHarness, FinalHarnessInterface } from "./names.mjs";
|
|
21
|
+
const CODEX_APP_SERVER_REASONING_LEVELS = [
|
|
22
|
+
ReasoningLevel.Minimal,
|
|
23
|
+
ReasoningLevel.Low,
|
|
24
|
+
ReasoningLevel.Medium,
|
|
25
|
+
ReasoningLevel.High
|
|
26
|
+
];
|
|
27
|
+
const CODEX_HARNESS = defineHarness({
|
|
28
|
+
title: "Codex",
|
|
29
|
+
description: "The Codex app-server, run as a process on the machine it works on.",
|
|
30
|
+
configurationSchema: configObjectJson({
|
|
31
|
+
title: "Codex",
|
|
32
|
+
properties: {
|
|
33
|
+
model: { $ref: "final://schemas/model-picker", type: "string", minLength: 1 },
|
|
34
|
+
reasoning: reasoningJson(CODEX_APP_SERVER_REASONING_LEVELS),
|
|
35
|
+
inference: inferenceJson(),
|
|
36
|
+
permissionMode: permissionModeJson()
|
|
37
|
+
}
|
|
38
|
+
}),
|
|
39
|
+
// The app-server's approvals cannot carry an agent's per-tool policy.
|
|
40
|
+
features: [HarnessFeature.Skills, HarnessFeature.McpTools, HarnessFeature.SystemInstructions],
|
|
41
|
+
lowestPermission: PermissionLevel.Ask,
|
|
42
|
+
inference: {
|
|
43
|
+
vendors: [ModelVendor.OpenAI],
|
|
44
|
+
kinds: [
|
|
45
|
+
InferenceSourceKind.Harness,
|
|
46
|
+
InferenceSourceKind.Subscription,
|
|
47
|
+
InferenceSourceKind.ApiKey,
|
|
48
|
+
InferenceSourceKind.Final
|
|
49
|
+
],
|
|
50
|
+
delivery: CredentialDelivery.AtOpen
|
|
51
|
+
},
|
|
52
|
+
native: {
|
|
53
|
+
files: { tools: ["apply_patch"] },
|
|
54
|
+
shell: { tools: ["exec_command", "write_stdin"] }
|
|
55
|
+
},
|
|
56
|
+
interface: FinalHarnessInterface.CodexAppServer,
|
|
57
|
+
adapter: FinalAcpAdapter.Codex,
|
|
58
|
+
run: {
|
|
59
|
+
process: {
|
|
60
|
+
command: "codex",
|
|
61
|
+
args: [
|
|
62
|
+
"app-server",
|
|
63
|
+
{ when: "configuration.model", args: ["-c", "model={{configuration.model}}"] },
|
|
64
|
+
{
|
|
65
|
+
when: "configuration.reasoning",
|
|
66
|
+
args: ["-c", "model_reasoning_effort={{configuration.reasoning}}"]
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
// The adapter proxies every MCP server it is handed (acp ones over the ACP connection)
|
|
72
|
+
// and reports full tool results.
|
|
73
|
+
mcp: [McpTransportKind.Acp, McpTransportKind.Http, McpTransportKind.Stdio],
|
|
74
|
+
consumes: [SandboxWire.Mcp],
|
|
75
|
+
supports: { observe: true, resumeReplay: true, fork: true, authorMeta: true },
|
|
76
|
+
// The adapter steers it into the running turn (turn/steer); one idle ends both.
|
|
77
|
+
promptWhileRunning: PromptWhileRunning.Inject,
|
|
78
|
+
// Its stdio belongs to the session service's connection to the sandbox.
|
|
79
|
+
sessionSurvivesDisconnect: false
|
|
80
|
+
});
|
|
81
|
+
const codex = ({
|
|
82
|
+
environment,
|
|
83
|
+
...configuration
|
|
84
|
+
} = {}) => harnessSettings({ harness: FinalHarness.Codex, configuration, environment });
|
|
85
|
+
export {
|
|
86
|
+
CODEX_APP_SERVER_REASONING_LEVELS,
|
|
87
|
+
CODEX_HARNESS,
|
|
88
|
+
codex
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=codex.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/harnesses/codex.ts"],
|
|
4
|
+
"sourcesContent": ["import { defineHarness } from '@finalai/agent-definition/authoring';\nimport {\n CredentialDelivery,\n HarnessFeature,\n InferenceSourceKind,\n McpTransportKind,\n PermissionLevel,\n PromptWhileRunning,\n SandboxWire,\n type HarnessDefinitionIface,\n type HarnessEnvironmentIface,\n type HarnessSettingsIface,\n} from '@finalai/agent-provider';\nimport {\n configObjectJson,\n harnessSettings,\n inferenceJson,\n permissionModeJson,\n reasoningJson,\n ReasoningLevel,\n type InferenceInput,\n type PermissionInput,\n} from \"./config-fields.mjs\";\nimport { ModelVendor } from \"./model-reference.mjs\";\nimport { FinalAcpAdapter, FinalHarness, FinalHarnessInterface } from \"./names.mjs\";\n\n// The Codex app-server as a process on a machine, behind Final's ACP adapter.\n// Its own file and shell tools work on the machine it runs on, which is\n// therefore the sandbox provided for `files` and `shell`.\n\n// What the app-server takes as model_reasoning_effort.\nexport const CODEX_APP_SERVER_REASONING_LEVELS = [\n ReasoningLevel.Minimal,\n ReasoningLevel.Low,\n ReasoningLevel.Medium,\n ReasoningLevel.High,\n] as const;\n\nexport const CODEX_HARNESS: HarnessDefinitionIface = defineHarness({\n title: 'Codex',\n description: 'The Codex app-server, run as a process on the machine it works on.',\n configurationSchema: configObjectJson({\n title: 'Codex',\n properties: {\n model: { $ref: 'final://schemas/model-picker', type: 'string', minLength: 1 },\n reasoning: reasoningJson(CODEX_APP_SERVER_REASONING_LEVELS),\n inference: inferenceJson(),\n permissionMode: permissionModeJson(),\n },\n }),\n // The app-server's approvals cannot carry an agent's per-tool policy.\n features: [HarnessFeature.Skills, HarnessFeature.McpTools, HarnessFeature.SystemInstructions],\n lowestPermission: PermissionLevel.Ask,\n inference: {\n vendors: [ModelVendor.OpenAI],\n kinds: [\n InferenceSourceKind.Harness,\n InferenceSourceKind.Subscription,\n InferenceSourceKind.ApiKey,\n InferenceSourceKind.Final,\n ],\n delivery: CredentialDelivery.AtOpen,\n },\n native: {\n files: { tools: ['apply_patch'] },\n shell: { tools: ['exec_command', 'write_stdin'] },\n },\n interface: FinalHarnessInterface.CodexAppServer,\n adapter: FinalAcpAdapter.Codex,\n run: {\n process: {\n command: 'codex',\n args: [\n 'app-server',\n { when: 'configuration.model', args: ['-c', 'model={{configuration.model}}'] },\n {\n when: 'configuration.reasoning',\n args: ['-c', 'model_reasoning_effort={{configuration.reasoning}}'],\n },\n ],\n },\n },\n // The adapter proxies every MCP server it is handed (acp ones over the ACP connection)\n // and reports full tool results.\n mcp: [McpTransportKind.Acp, McpTransportKind.Http, McpTransportKind.Stdio],\n consumes: [SandboxWire.Mcp],\n supports: { observe: true, resumeReplay: true, fork: true, authorMeta: true },\n // The adapter steers it into the running turn (turn/steer); one idle ends both.\n promptWhileRunning: PromptWhileRunning.Inject,\n // Its stdio belongs to the session service's connection to the sandbox.\n sessionSurvivesDisconnect: false,\n});\n\nexport interface CodexInputIface {\n model?: string;\n reasoning?:\n | (typeof CODEX_APP_SERVER_REASONING_LEVELS)[number]\n | `${(typeof CODEX_APP_SERVER_REASONING_LEVELS)[number]}`;\n // Absent: only the CLI's own login on the machine.\n inference?: InferenceInput;\n permissionMode?: PermissionInput;\n // The sandbox it runs in (absent: the one provided for `shell`), or an ACP\n // endpoint already running it: `atUrl({ url, hop })`.\n environment?: HarnessEnvironmentIface;\n}\n\nexport const codex = ({\n environment,\n ...configuration\n}: CodexInputIface = {}): HarnessSettingsIface =>\n harnessSettings({ harness: FinalHarness.Codex, configuration, environment });\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB,cAAc,6BAA6B;AAO9D,MAAM,oCAAoC;AAAA,EAC/C,eAAe;AAAA,EACf,eAAe;AAAA,EACf,eAAe;AAAA,EACf,eAAe;AACjB;AAEO,MAAM,gBAAwC,cAAc;AAAA,EACjE,OAAO;AAAA,EACP,aAAa;AAAA,EACb,qBAAqB,iBAAiB;AAAA,IACpC,OAAO;AAAA,IACP,YAAY;AAAA,MACV,OAAO,EAAE,MAAM,gCAAgC,MAAM,UAAU,WAAW,EAAE;AAAA,MAC5E,WAAW,cAAc,iCAAiC;AAAA,MAC1D,WAAW,cAAc;AAAA,MACzB,gBAAgB,mBAAmB;AAAA,IACrC;AAAA,EACF,CAAC;AAAA;AAAA,EAED,UAAU,CAAC,eAAe,QAAQ,eAAe,UAAU,eAAe,kBAAkB;AAAA,EAC5F,kBAAkB,gBAAgB;AAAA,EAClC,WAAW;AAAA,IACT,SAAS,CAAC,YAAY,MAAM;AAAA,IAC5B,OAAO;AAAA,MACL,oBAAoB;AAAA,MACpB,oBAAoB;AAAA,MACpB,oBAAoB;AAAA,MACpB,oBAAoB;AAAA,IACtB;AAAA,IACA,UAAU,mBAAmB;AAAA,EAC/B;AAAA,EACA,QAAQ;AAAA,IACN,OAAO,EAAE,OAAO,CAAC,aAAa,EAAE;AAAA,IAChC,OAAO,EAAE,OAAO,CAAC,gBAAgB,aAAa,EAAE;AAAA,EAClD;AAAA,EACA,WAAW,sBAAsB;AAAA,EACjC,SAAS,gBAAgB;AAAA,EACzB,KAAK;AAAA,IACH,SAAS;AAAA,MACP,SAAS;AAAA,MACT,MAAM;AAAA,QACJ;AAAA,QACA,EAAE,MAAM,uBAAuB,MAAM,CAAC,MAAM,+BAA+B,EAAE;AAAA,QAC7E;AAAA,UACE,MAAM;AAAA,UACN,MAAM,CAAC,MAAM,oDAAoD;AAAA,QACnE;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA,EAGA,KAAK,CAAC,iBAAiB,KAAK,iBAAiB,MAAM,iBAAiB,KAAK;AAAA,EACzE,UAAU,CAAC,YAAY,GAAG;AAAA,EAC1B,UAAU,EAAE,SAAS,MAAM,cAAc,MAAM,MAAM,MAAM,YAAY,KAAK;AAAA;AAAA,EAE5E,oBAAoB,mBAAmB;AAAA;AAAA,EAEvC,2BAA2B;AAC7B,CAAC;AAeM,MAAM,QAAQ,CAAC;AAAA,EACpB;AAAA,EACA,GAAG;AACL,IAAqB,CAAC,MACpB,gBAAgB,EAAE,SAAS,aAAa,OAAO,eAAe,YAAY,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PermissionLevel, type HarnessSettingsIface, type InferenceSource, type JsonObject, type JsonSchema, type JsonValue, type HarnessEnvironmentIface } from '@finalai/agent-provider';
|
|
2
2
|
import * as z from 'zod';
|
|
3
3
|
export { MODEL_REFERENCE_PATTERN } from "./model-reference.mjs";
|
|
4
4
|
export declare enum ReasoningLevel {
|
|
@@ -27,7 +27,7 @@ export declare enum CodexApprovalPolicy {
|
|
|
27
27
|
OnFailure = "on-failure",
|
|
28
28
|
Never = "never"
|
|
29
29
|
}
|
|
30
|
-
export declare enum
|
|
30
|
+
export declare enum ApprovalsReviewer {
|
|
31
31
|
User = "user",
|
|
32
32
|
AutoReview = "auto-review"
|
|
33
33
|
}
|
|
@@ -39,8 +39,11 @@ export declare enum CodexSandboxMode {
|
|
|
39
39
|
export interface SecretRefIface {
|
|
40
40
|
secretKey: string;
|
|
41
41
|
}
|
|
42
|
-
export type
|
|
43
|
-
export type
|
|
42
|
+
export type PermissionInput = PermissionLevel | `${PermissionLevel}`;
|
|
43
|
+
export type InferenceInput = InferenceSource | readonly InferenceSource[];
|
|
44
|
+
export declare const piPermissionModeFor: (level: PermissionLevel) => PiPermissionMode;
|
|
45
|
+
export declare const claudePermissionModeFor: (level: PermissionLevel, reviewer?: ApprovalsReviewer) => ClaudePermissionMode;
|
|
46
|
+
export declare const codexApprovalPolicyFor: (level: PermissionLevel) => CodexApprovalPolicy;
|
|
44
47
|
export declare const configObjectJson: (args: {
|
|
45
48
|
title: string;
|
|
46
49
|
properties: Record<string, JsonSchema>;
|
|
@@ -48,71 +51,109 @@ export declare const configObjectJson: (args: {
|
|
|
48
51
|
}) => JsonSchema;
|
|
49
52
|
export declare const modelJson: (ids?: readonly string[], defaultId?: string) => JsonSchema;
|
|
50
53
|
export declare const reasoningJson: (levels: readonly ReasoningLevel[]) => JsonSchema;
|
|
51
|
-
export declare const
|
|
52
|
-
export declare const permissionModeJson: (
|
|
53
|
-
export declare const
|
|
54
|
-
export declare const skillsJson: () => JsonSchema;
|
|
54
|
+
export declare const inferenceJson: () => JsonSchema;
|
|
55
|
+
export declare const permissionModeJson: () => JsonSchema;
|
|
56
|
+
export declare const approvalsReviewerJson: () => JsonSchema;
|
|
55
57
|
export declare const secretRefJson: () => JsonSchema;
|
|
56
58
|
export declare const urlJson: (title: string, schemes: readonly string[]) => JsonSchema;
|
|
57
59
|
export declare const absolutePathJson: (title: string) => JsonSchema;
|
|
58
60
|
export declare const modelZod: (ids?: readonly string[]) => z.ZodString;
|
|
59
61
|
export declare const reasoningZod: (levels: readonly ReasoningLevel[]) => z.ZodEnum<typeof ReasoningLevel>;
|
|
60
|
-
export declare const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
source:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
62
|
+
export declare const inferenceZod: () => z.ZodPipe<z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
63
|
+
source: z.ZodLiteral<import("@finalai/agent-provider").InferenceSourceKind.Subscription>;
|
|
64
|
+
credential: z.ZodDefault<z.ZodEnum<typeof import("@finalai/agent-provider").CredentialScope>>;
|
|
65
|
+
vendor: z.ZodOptional<z.ZodString>;
|
|
66
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
67
|
+
source: z.ZodLiteral<import("@finalai/agent-provider").InferenceSourceKind.ApiKey>;
|
|
68
|
+
secret: z.ZodString;
|
|
69
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
70
|
+
vendor: z.ZodOptional<z.ZodString>;
|
|
71
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
72
|
+
source: z.ZodLiteral<import("@finalai/agent-provider").InferenceSourceKind.Final>;
|
|
73
|
+
billTo: z.ZodDefault<z.ZodEnum<typeof import("@finalai/agent-provider").InferenceBillTo>>;
|
|
74
|
+
budget: z.ZodOptional<z.ZodString>;
|
|
75
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
76
|
+
source: z.ZodLiteral<import("@finalai/agent-provider").InferenceSourceKind.Harness>;
|
|
77
|
+
}, z.core.$strict>], "source">, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
78
|
+
source: z.ZodLiteral<import("@finalai/agent-provider").InferenceSourceKind.Subscription>;
|
|
79
|
+
credential: z.ZodDefault<z.ZodEnum<typeof import("@finalai/agent-provider").CredentialScope>>;
|
|
80
|
+
vendor: z.ZodOptional<z.ZodString>;
|
|
81
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
82
|
+
source: z.ZodLiteral<import("@finalai/agent-provider").InferenceSourceKind.ApiKey>;
|
|
83
|
+
secret: z.ZodString;
|
|
84
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
85
|
+
vendor: z.ZodOptional<z.ZodString>;
|
|
86
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
87
|
+
source: z.ZodLiteral<import("@finalai/agent-provider").InferenceSourceKind.Final>;
|
|
88
|
+
billTo: z.ZodDefault<z.ZodEnum<typeof import("@finalai/agent-provider").InferenceBillTo>>;
|
|
89
|
+
budget: z.ZodOptional<z.ZodString>;
|
|
90
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
91
|
+
source: z.ZodLiteral<import("@finalai/agent-provider").InferenceSourceKind.Harness>;
|
|
92
|
+
}, z.core.$strict>], "source">>]>, z.ZodTransform<({
|
|
93
|
+
source: import("@finalai/agent-provider").InferenceSourceKind.Subscription;
|
|
94
|
+
credential: import("@finalai/agent-provider").CredentialScope;
|
|
95
|
+
vendor?: string | undefined;
|
|
96
|
+
} | {
|
|
97
|
+
source: import("@finalai/agent-provider").InferenceSourceKind.ApiKey;
|
|
98
|
+
secret: string;
|
|
99
|
+
baseUrl?: string | undefined;
|
|
100
|
+
vendor?: string | undefined;
|
|
101
|
+
} | {
|
|
102
|
+
source: import("@finalai/agent-provider").InferenceSourceKind.Final;
|
|
103
|
+
billTo: import("@finalai/agent-provider").InferenceBillTo;
|
|
104
|
+
budget?: string | undefined;
|
|
105
|
+
} | {
|
|
106
|
+
source: import("@finalai/agent-provider").InferenceSourceKind.Harness;
|
|
107
|
+
})[], {
|
|
108
|
+
source: import("@finalai/agent-provider").InferenceSourceKind.Subscription;
|
|
109
|
+
credential: import("@finalai/agent-provider").CredentialScope;
|
|
110
|
+
vendor?: string | undefined;
|
|
111
|
+
} | {
|
|
112
|
+
source: import("@finalai/agent-provider").InferenceSourceKind.ApiKey;
|
|
113
|
+
secret: string;
|
|
114
|
+
baseUrl?: string | undefined;
|
|
115
|
+
vendor?: string | undefined;
|
|
116
|
+
} | {
|
|
117
|
+
source: import("@finalai/agent-provider").InferenceSourceKind.Final;
|
|
118
|
+
billTo: import("@finalai/agent-provider").InferenceBillTo;
|
|
119
|
+
budget?: string | undefined;
|
|
120
|
+
} | {
|
|
121
|
+
source: import("@finalai/agent-provider").InferenceSourceKind.Harness;
|
|
122
|
+
} | ({
|
|
123
|
+
source: import("@finalai/agent-provider").InferenceSourceKind.Subscription;
|
|
124
|
+
credential: import("@finalai/agent-provider").CredentialScope;
|
|
125
|
+
vendor?: string | undefined;
|
|
126
|
+
} | {
|
|
127
|
+
source: import("@finalai/agent-provider").InferenceSourceKind.ApiKey;
|
|
128
|
+
secret: string;
|
|
129
|
+
baseUrl?: string | undefined;
|
|
130
|
+
vendor?: string | undefined;
|
|
131
|
+
} | {
|
|
132
|
+
source: import("@finalai/agent-provider").InferenceSourceKind.Final;
|
|
133
|
+
billTo: import("@finalai/agent-provider").InferenceBillTo;
|
|
134
|
+
budget?: string | undefined;
|
|
135
|
+
} | {
|
|
136
|
+
source: import("@finalai/agent-provider").InferenceSourceKind.Harness;
|
|
137
|
+
})[]>>;
|
|
138
|
+
export declare const permissionModeZod: () => z.ZodEnum<typeof PermissionLevel>;
|
|
139
|
+
export declare const approvalsReviewerZod: () => z.ZodEnum<typeof ApprovalsReviewer>;
|
|
101
140
|
export declare const secretRefZod: () => z.ZodObject<{
|
|
102
141
|
secretKey: z.ZodString;
|
|
103
142
|
}, z.core.$strip>;
|
|
104
143
|
export declare const urlZod: (schemes: readonly string[]) => z.ZodString;
|
|
105
144
|
export declare const absolutePathZod: () => z.ZodString;
|
|
106
145
|
export declare const parseHarnessConfig: <T extends z.ZodType>(args: {
|
|
107
|
-
|
|
146
|
+
harness: string;
|
|
108
147
|
schema: T;
|
|
109
|
-
config:
|
|
148
|
+
config: unknown;
|
|
110
149
|
}) => z.output<T>;
|
|
111
150
|
export declare const toJsonValue: <Value>(value: Value) => JsonValue;
|
|
112
151
|
export declare const toJsonObject: <Value>(value: Value) => JsonObject;
|
|
113
|
-
export
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
152
|
+
export declare const harnessSettings: (args: {
|
|
153
|
+
harness: string;
|
|
154
|
+
adapter?: string;
|
|
155
|
+
configuration: {
|
|
156
|
+
inference?: InferenceInput;
|
|
157
|
+
} & Record<string, unknown>;
|
|
158
|
+
environment?: HarnessEnvironmentIface;
|
|
159
|
+
}) => HarnessSettingsIface;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { MODEL_REFERENCE_PATTERN } from "./model-reference.mjs";
|
|
2
1
|
import {
|
|
3
|
-
|
|
4
|
-
instructionFragmentSchema,
|
|
2
|
+
inferenceSchema,
|
|
5
3
|
jsonObjectSchema,
|
|
6
4
|
jsonValueSchema,
|
|
7
|
-
|
|
8
|
-
SCHEMA_IDS
|
|
9
|
-
skillBundleSchema
|
|
5
|
+
PermissionLevel,
|
|
6
|
+
SCHEMA_IDS
|
|
10
7
|
} from "@finalai/agent-provider";
|
|
11
8
|
import * as z from "zod";
|
|
9
|
+
import { MODEL_REFERENCE_PATTERN } from "./model-reference.mjs";
|
|
12
10
|
import { MODEL_REFERENCE_PATTERN as MODEL_REFERENCE_PATTERN2 } from "./model-reference.mjs";
|
|
13
11
|
var ReasoningLevel = /* @__PURE__ */ ((ReasoningLevel2) => {
|
|
14
12
|
ReasoningLevel2["None"] = "none";
|
|
@@ -40,17 +38,24 @@ var CodexApprovalPolicy = /* @__PURE__ */ ((CodexApprovalPolicy2) => {
|
|
|
40
38
|
CodexApprovalPolicy2["Never"] = "never";
|
|
41
39
|
return CodexApprovalPolicy2;
|
|
42
40
|
})(CodexApprovalPolicy || {});
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return
|
|
47
|
-
})(
|
|
41
|
+
var ApprovalsReviewer = /* @__PURE__ */ ((ApprovalsReviewer2) => {
|
|
42
|
+
ApprovalsReviewer2["User"] = "user";
|
|
43
|
+
ApprovalsReviewer2["AutoReview"] = "auto-review";
|
|
44
|
+
return ApprovalsReviewer2;
|
|
45
|
+
})(ApprovalsReviewer || {});
|
|
48
46
|
var CodexSandboxMode = /* @__PURE__ */ ((CodexSandboxMode2) => {
|
|
49
47
|
CodexSandboxMode2["ReadOnly"] = "read-only";
|
|
50
48
|
CodexSandboxMode2["WorkspaceWrite"] = "workspace-write";
|
|
51
49
|
CodexSandboxMode2["DangerFullAccess"] = "danger-full-access";
|
|
52
50
|
return CodexSandboxMode2;
|
|
53
51
|
})(CodexSandboxMode || {});
|
|
52
|
+
const piPermissionModeFor = (level) => level === PermissionLevel.Auto ? "auto" /* Auto */ : "ask" /* Ask */;
|
|
53
|
+
const claudePermissionModeFor = (level, reviewer = "user" /* User */) => {
|
|
54
|
+
if (level === PermissionLevel.Auto) return "bypass" /* Bypass */;
|
|
55
|
+
if (reviewer === "auto-review" /* AutoReview */) return "auto" /* Auto */;
|
|
56
|
+
return level === PermissionLevel.Review ? "accept-edits" /* AcceptEdits */ : "default" /* Default */;
|
|
57
|
+
};
|
|
58
|
+
const codexApprovalPolicyFor = (level) => level === PermissionLevel.Auto ? "never" /* Never */ : level === PermissionLevel.Review ? "on-request" /* OnRequest */ : "untrusted" /* Untrusted */;
|
|
54
59
|
const configObjectJson = (args) => ({
|
|
55
60
|
type: "object",
|
|
56
61
|
title: args.title,
|
|
@@ -68,14 +73,17 @@ const reasoningJson = (levels) => ({
|
|
|
68
73
|
$ref: SCHEMA_IDS.reasoning,
|
|
69
74
|
enum: [...levels]
|
|
70
75
|
});
|
|
71
|
-
const
|
|
72
|
-
const permissionModeJson = (
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
const inferenceJson = () => ({ $ref: SCHEMA_IDS.inference });
|
|
77
|
+
const permissionModeJson = () => ({
|
|
78
|
+
$ref: SCHEMA_IDS.permissionMode,
|
|
79
|
+
enum: Object.values(PermissionLevel)
|
|
80
|
+
});
|
|
81
|
+
const approvalsReviewerJson = () => ({
|
|
82
|
+
type: "string",
|
|
83
|
+
title: "Approvals reviewer",
|
|
84
|
+
enum: Object.values(ApprovalsReviewer),
|
|
85
|
+
default: "user" /* User */
|
|
86
|
+
});
|
|
79
87
|
const secretRefJson = () => ({ $ref: SCHEMA_IDS.secretRef });
|
|
80
88
|
const urlJson = (title, schemes) => ({
|
|
81
89
|
type: "string",
|
|
@@ -101,9 +109,9 @@ const modelZod = (ids) => {
|
|
|
101
109
|
const reasoningZod = (levels) => z.nativeEnum(ReasoningLevel).refine((level) => levels.includes(level), {
|
|
102
110
|
message: `reasoning must be one of: ${levels.join(", ")}`
|
|
103
111
|
});
|
|
104
|
-
const
|
|
105
|
-
const
|
|
106
|
-
const
|
|
112
|
+
const inferenceZod = () => inferenceSchema;
|
|
113
|
+
const permissionModeZod = () => z.nativeEnum(PermissionLevel);
|
|
114
|
+
const approvalsReviewerZod = () => z.nativeEnum(ApprovalsReviewer);
|
|
107
115
|
const secretRefZod = () => z.object({ secretKey: z.string().min(1) });
|
|
108
116
|
const urlZod = (schemes) => z.string().url().refine((value) => schemes.some((scheme) => value.startsWith(`${scheme}://`)), {
|
|
109
117
|
message: `url must use one of: ${schemes.join(", ")}`
|
|
@@ -113,40 +121,55 @@ const parseHarnessConfig = (args) => {
|
|
|
113
121
|
const parsed = args.schema.safeParse(args.config);
|
|
114
122
|
if (parsed.success) return parsed.data;
|
|
115
123
|
const issues = parsed.error.issues.map((issue) => `${issue.path.join(".") || "(root)"}: ${issue.message}`).join("; ");
|
|
116
|
-
throw new Error(`invalid
|
|
124
|
+
throw new Error(`invalid configuration for ${args.harness}: ${issues}`);
|
|
117
125
|
};
|
|
118
126
|
const toJsonValue = (value) => jsonValueSchema.parse(JSON.parse(JSON.stringify(value)));
|
|
119
127
|
const toJsonObject = (value) => jsonObjectSchema.parse(JSON.parse(JSON.stringify(value)));
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
128
|
+
const inferenceList = (inference) => {
|
|
129
|
+
if (inference == null) return void 0;
|
|
130
|
+
const list = Array.isArray(inference) ? [...inference] : [inference];
|
|
131
|
+
if (list.length === 0) throw new Error("inference lists at least one source");
|
|
132
|
+
return list;
|
|
133
|
+
};
|
|
134
|
+
const harnessSettings = (args) => {
|
|
135
|
+
const { inference, ...rest } = args.configuration;
|
|
136
|
+
const list = inferenceList(inference);
|
|
137
|
+
const environment = args.environment;
|
|
138
|
+
return {
|
|
139
|
+
harness: args.harness,
|
|
140
|
+
...args.adapter == null ? {} : { adapter: args.adapter },
|
|
141
|
+
configuration: toJsonObject({ ...rest, ...list == null ? {} : { inference: list } }),
|
|
142
|
+
...environment == null ? {} : { environment: typeof environment === "string" ? environment : { ...environment } }
|
|
143
|
+
};
|
|
144
|
+
};
|
|
124
145
|
export {
|
|
146
|
+
ApprovalsReviewer,
|
|
125
147
|
ClaudePermissionMode,
|
|
126
148
|
CodexApprovalPolicy,
|
|
127
|
-
CodexApprovalsReviewer,
|
|
128
149
|
CodexSandboxMode,
|
|
129
150
|
MODEL_REFERENCE_PATTERN2 as MODEL_REFERENCE_PATTERN,
|
|
130
151
|
PiPermissionMode,
|
|
131
152
|
ReasoningLevel,
|
|
132
153
|
absolutePathJson,
|
|
133
154
|
absolutePathZod,
|
|
155
|
+
approvalsReviewerJson,
|
|
156
|
+
approvalsReviewerZod,
|
|
157
|
+
claudePermissionModeFor,
|
|
158
|
+
codexApprovalPolicyFor,
|
|
134
159
|
configObjectJson,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
instructionsJson,
|
|
139
|
-
instructionsZod,
|
|
160
|
+
harnessSettings,
|
|
161
|
+
inferenceJson,
|
|
162
|
+
inferenceZod,
|
|
140
163
|
modelJson,
|
|
141
164
|
modelZod,
|
|
142
165
|
parseHarnessConfig,
|
|
143
166
|
permissionModeJson,
|
|
167
|
+
permissionModeZod,
|
|
168
|
+
piPermissionModeFor,
|
|
144
169
|
reasoningJson,
|
|
145
170
|
reasoningZod,
|
|
146
171
|
secretRefJson,
|
|
147
172
|
secretRefZod,
|
|
148
|
-
skillsJson,
|
|
149
|
-
skillsZod,
|
|
150
173
|
toJsonObject,
|
|
151
174
|
toJsonValue,
|
|
152
175
|
urlJson,
|