@finalai/final-agent-provider 0.10.1 → 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/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 +17 -14
- 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,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,eAA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chema, 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,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/harnesses/config-fields.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA
|
|
6
|
-
"names": ["MODEL_REFERENCE_PATTERN", "ReasoningLevel", "PiPermissionMode", "ClaudePermissionMode", "CodexApprovalPolicy", "
|
|
4
|
+
"sourcesContent": ["import {\n inferenceSchema,\n jsonObjectSchema,\n jsonValueSchema,\n PermissionLevel,\n SCHEMA_IDS,\n type HarnessSettingsIface,\n type InferenceSource,\n type JsonObject,\n type JsonSchema,\n type JsonValue,\n type HarnessEnvironmentIface,\n} from '@finalai/agent-provider';\nimport * as z from 'zod';\nimport { MODEL_REFERENCE_PATTERN } from \"./model-reference.mjs\";\n\nexport { MODEL_REFERENCE_PATTERN } from \"./model-reference.mjs\";\n\n// Configuration building blocks shared by the harness definitions: each\n// writes its configuration's JSON Schema (what a picker renders and the\n// platform validates settings with, $ref-ing the shared final://schemas/*\n// fragments) from these. The Zod helpers are for programs that read a\n// configuration they were handed.\n\n// Mirrors the final://schemas/reasoning fragment's enum.\nexport enum ReasoningLevel {\n None = 'none',\n Minimal = 'minimal',\n Low = 'low',\n Medium = 'medium',\n High = 'high',\n Max = 'max',\n}\n\n// The native modes each program understands. Settings carry a `PermissionLevel`;\n// each harness maps it onto its program's own mode.\n\n// Pi and the Final harness.\nexport enum PiPermissionMode {\n Auto = 'auto',\n Ask = 'ask',\n Readonly = 'readonly',\n}\n\n// Claude Code and the nanocode Claude engine.\nexport enum ClaudePermissionMode {\n Default = 'default',\n AcceptEdits = 'accept-edits',\n Plan = 'plan',\n Bypass = 'bypass',\n // The nanocode Claude engine only: a reviewer model answers what `default` would ask.\n Auto = 'auto',\n}\n\n// Codex and the nanocode Codex engine.\nexport enum CodexApprovalPolicy {\n Untrusted = 'untrusted',\n OnRequest = 'on-request',\n OnFailure = 'on-failure',\n Never = 'never',\n}\n\n// Who answers what a nanocode engine would ask: the person, or a reviewer model.\nexport enum ApprovalsReviewer {\n User = 'user',\n AutoReview = 'auto-review',\n}\n\n// The Codex CLI's OS sandbox on a host you run.\nexport enum CodexSandboxMode {\n ReadOnly = 'read-only',\n WorkspaceWrite = 'workspace-write',\n DangerFullAccess = 'danger-full-access',\n}\n\nexport interface SecretRefIface {\n secretKey: string;\n}\n\n// A permission level as the caller wrote it, enum or string.\nexport type PermissionInput = PermissionLevel | `${PermissionLevel}`;\n\n// One inference source or an ordered list of them; the first available wins.\nexport type InferenceInput = InferenceSource | readonly InferenceSource[];\n\nexport const piPermissionModeFor = (level: PermissionLevel): PiPermissionMode =>\n level === PermissionLevel.Auto ? PiPermissionMode.Auto : PiPermissionMode.Ask;\n\nexport const claudePermissionModeFor = (\n level: PermissionLevel,\n reviewer: ApprovalsReviewer = ApprovalsReviewer.User,\n): ClaudePermissionMode => {\n if (level === PermissionLevel.Auto) return ClaudePermissionMode.Bypass;\n if (reviewer === ApprovalsReviewer.AutoReview) return ClaudePermissionMode.Auto;\n return level === PermissionLevel.Review\n ? ClaudePermissionMode.AcceptEdits\n : ClaudePermissionMode.Default;\n};\n\nexport const codexApprovalPolicyFor = (level: PermissionLevel): CodexApprovalPolicy =>\n level === PermissionLevel.Auto\n ? CodexApprovalPolicy.Never\n : level === PermissionLevel.Review\n ? CodexApprovalPolicy.OnRequest\n : CodexApprovalPolicy.Untrusted;\n\nexport const configObjectJson = (args: {\n title: string;\n properties: Record<string, JsonSchema>;\n required?: string[];\n}): JsonSchema => ({\n type: 'object',\n title: args.title,\n additionalProperties: false,\n properties: args.properties,\n required: args.required ?? [],\n});\n\n// Open model references; an explicit list restricts them.\nexport const modelJson = (ids?: readonly string[], defaultId?: string): JsonSchema => ({\n $ref: SCHEMA_IDS.modelPicker,\n type: 'string',\n ...(ids == null\n ? { minLength: 1, maxLength: 200, pattern: MODEL_REFERENCE_PATTERN }\n : { enum: [...ids] }),\n ...(defaultId == null ? {} : { default: defaultId }),\n});\n\nexport const reasoningJson = (levels: readonly ReasoningLevel[]): JsonSchema => ({\n $ref: SCHEMA_IDS.reasoning,\n enum: [...levels],\n});\n\nexport const inferenceJson = (): JsonSchema => ({ $ref: SCHEMA_IDS.inference });\n\nexport const permissionModeJson = (): JsonSchema => ({\n $ref: SCHEMA_IDS.permissionMode,\n enum: Object.values(PermissionLevel),\n});\n\nexport const approvalsReviewerJson = (): JsonSchema => ({\n type: 'string',\n title: 'Approvals reviewer',\n enum: Object.values(ApprovalsReviewer),\n default: ApprovalsReviewer.User,\n});\n\nexport const secretRefJson = (): JsonSchema => ({ $ref: SCHEMA_IDS.secretRef });\n\nexport const urlJson = (title: string, schemes: readonly string[]): JsonSchema => ({\n type: 'string',\n title,\n format: 'uri',\n pattern: `^(${schemes.join('|')})://`,\n});\n\nexport const absolutePathJson = (title: string): JsonSchema => ({\n type: 'string',\n title,\n pattern: '^/',\n});\n\nexport const modelZod = (ids?: readonly string[]) => {\n if (ids != null)\n return z.string().refine((id) => ids.includes(id), {\n message: `model must be one of: ${ids.join(', ')}`,\n });\n const pattern = new RegExp(MODEL_REFERENCE_PATTERN);\n return z.string().min(1).max(200).regex(pattern, {\n message: 'model must be a printable ASCII reference without empty path segments',\n });\n};\n\nexport const reasoningZod = (levels: readonly ReasoningLevel[]) =>\n z.nativeEnum(ReasoningLevel).refine((level) => levels.includes(level), {\n message: `reasoning must be one of: ${levels.join(', ')}`,\n });\n\nexport const inferenceZod = () => inferenceSchema;\nexport const permissionModeZod = () => z.nativeEnum(PermissionLevel);\nexport const approvalsReviewerZod = () => z.nativeEnum(ApprovalsReviewer);\nexport const secretRefZod = () => z.object({ secretKey: z.string().min(1) });\n\nexport const urlZod = (schemes: readonly string[]) =>\n z\n .string()\n .url()\n .refine((value) => schemes.some((scheme) => value.startsWith(`${scheme}://`)), {\n message: `url must use one of: ${schemes.join(', ')}`,\n });\n\nexport const absolutePathZod = () => z.string().startsWith('/');\n\n// Throws a readable error naming the harness; open() surfaces it as the\n// session's open failure.\nexport const parseHarnessConfig = <T extends z.ZodType>(args: {\n harness: string;\n schema: T;\n config: unknown;\n}): z.output<T> => {\n const parsed = args.schema.safeParse(args.config);\n if (parsed.success) return parsed.data;\n const issues = parsed.error.issues\n .map((issue) => `${issue.path.join('.') || '(root)'}: ${issue.message}`)\n .join('; ');\n throw new Error(`invalid configuration for ${args.harness}: ${issues}`);\n};\n\n// Typed objects to JSON: a round trip drops undefined fields and the schema\n// proves the result is JSON.\nexport const toJsonValue = <Value>(value: Value): JsonValue =>\n jsonValueSchema.parse(JSON.parse(JSON.stringify(value)));\n\nexport const toJsonObject = <Value>(value: Value): JsonObject =>\n jsonObjectSchema.parse(JSON.parse(JSON.stringify(value)));\n\nconst inferenceList = (inference: InferenceInput | undefined): InferenceSource[] | undefined => {\n if (inference == null) return undefined;\n const list = Array.isArray(inference) ? [...inference] : [inference];\n if (list.length === 0) throw new Error('inference lists at least one source');\n return list;\n};\n\n// What every settings builder returns: plain harness settings, the wire form\n// a caller passes as `provide.harness`. A single inference source becomes a\n// one-item list, as it is stored.\nexport const harnessSettings = (args: {\n harness: string;\n adapter?: string;\n configuration: { inference?: InferenceInput } & Record<string, unknown>;\n environment?: HarnessEnvironmentIface;\n}): HarnessSettingsIface => {\n const { inference, ...rest } = args.configuration;\n const list = inferenceList(inference);\n const environment = args.environment;\n return {\n harness: args.harness,\n ...(args.adapter == null ? {} : { adapter: args.adapter }),\n configuration: toJsonObject({ ...rest, ...(list == null ? {} : { inference: list }) }),\n ...(environment == null\n ? {}\n : { environment: typeof environment === 'string' ? environment : { ...environment } }),\n };\n};\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAOK;AACP,YAAY,OAAO;AACnB,SAAS,+BAA+B;AAExC,SAAS,2BAAAA,gCAA+B;AASjC,IAAK,iBAAL,kBAAKC,oBAAL;AACL,EAAAA,gBAAA,UAAO;AACP,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,SAAM;AACN,EAAAA,gBAAA,YAAS;AACT,EAAAA,gBAAA,UAAO;AACP,EAAAA,gBAAA,SAAM;AANI,SAAAA;AAAA,GAAA;AAaL,IAAK,mBAAL,kBAAKC,sBAAL;AACL,EAAAA,kBAAA,UAAO;AACP,EAAAA,kBAAA,SAAM;AACN,EAAAA,kBAAA,cAAW;AAHD,SAAAA;AAAA,GAAA;AAOL,IAAK,uBAAL,kBAAKC,0BAAL;AACL,EAAAA,sBAAA,aAAU;AACV,EAAAA,sBAAA,iBAAc;AACd,EAAAA,sBAA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;AACpC,QAAM,cAAc,KAAK;AACzB,SAAO;AAAA,IACL,SAAS,KAAK;AAAA,IACd,GAAI,KAAK,WAAW,OAAO,CAAC,IAAI,EAAE,SAAS,KAAK,QAAQ;AAAA,IACxD,eAAe,aAAa,EAAE,GAAG,MAAM,GAAI,QAAQ,OAAO,CAAC,IAAI,EAAE,WAAW,KAAK,EAAG,CAAC;AAAA,IACrF,GAAI,eAAe,OACf,CAAC,IACD,EAAE,aAAa,OAAO,gBAAgB,WAAW,cAAc,EAAE,GAAG,YAAY,EAAE;AAAA,EACxF;AACF;",
|
|
6
|
+
"names": ["MODEL_REFERENCE_PATTERN", "ReasoningLevel", "PiPermissionMode", "ClaudePermissionMode", "CodexApprovalPolicy", "ApprovalsReviewer", "CodexSandboxMode"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ACP_AGENT_HARNESS } from "./acp-agent.mjs";
|
|
2
|
+
import { CLAUDE_CODE_HARNESS } from "./claude-code.mjs";
|
|
3
|
+
import { CODEX_HARNESS } from "./codex.mjs";
|
|
4
|
+
import { FINAL_HARNESS } from "./final.mjs";
|
|
5
|
+
import { FinalHarness } from "./names.mjs";
|
|
6
|
+
import { NANOCODE_CLAUDE_HARNESS } from "./nanocode-claude.mjs";
|
|
7
|
+
import { NANOCODE_CODEX_HARNESS } from "./nanocode-codex.mjs";
|
|
8
|
+
import { PI_HARNESS } from "./pi.mjs";
|
|
9
|
+
const FINAL_HARNESS_DEFINITIONS = {
|
|
10
|
+
[FinalHarness.Final]: FINAL_HARNESS,
|
|
11
|
+
[FinalHarness.Pi]: PI_HARNESS,
|
|
12
|
+
[FinalHarness.NanocodeClaude]: NANOCODE_CLAUDE_HARNESS,
|
|
13
|
+
[FinalHarness.NanocodeCodex]: NANOCODE_CODEX_HARNESS,
|
|
14
|
+
[FinalHarness.ClaudeCode]: CLAUDE_CODE_HARNESS,
|
|
15
|
+
[FinalHarness.Codex]: CODEX_HARNESS,
|
|
16
|
+
[FinalHarness.AcpAgent]: ACP_AGENT_HARNESS
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
FINAL_HARNESS_DEFINITIONS
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=definitions.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/harnesses/definitions.ts"],
|
|
4
|
+
"sourcesContent": ["import type { HarnessDefinitionIface } from '@finalai/agent-provider';\nimport { ACP_AGENT_HARNESS } from \"./acp-agent.mjs\";\nimport { CLAUDE_CODE_HARNESS } from \"./claude-code.mjs\";\nimport { CODEX_HARNESS } from \"./codex.mjs\";\nimport { FINAL_HARNESS } from \"./final.mjs\";\nimport { FinalHarness } from \"./names.mjs\";\nimport { NANOCODE_CLAUDE_HARNESS } from \"./nanocode-claude.mjs\";\nimport { NANOCODE_CODEX_HARNESS } from \"./nanocode-codex.mjs\";\nimport { PI_HARNESS } from \"./pi.mjs\";\n\n// Every Final harness definition by the qualified name harness settings give it.\nexport const FINAL_HARNESS_DEFINITIONS: Record<FinalHarness, HarnessDefinitionIface> = {\n [FinalHarness.Final]: FINAL_HARNESS,\n [FinalHarness.Pi]: PI_HARNESS,\n [FinalHarness.NanocodeClaude]: NANOCODE_CLAUDE_HARNESS,\n [FinalHarness.NanocodeCodex]: NANOCODE_CODEX_HARNESS,\n [FinalHarness.ClaudeCode]: CLAUDE_CODE_HARNESS,\n [FinalHarness.Codex]: CODEX_HARNESS,\n [FinalHarness.AcpAgent]: ACP_AGENT_HARNESS,\n};\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AACpC,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAC7B,SAAS,+BAA+B;AACxC,SAAS,8BAA8B;AACvC,SAAS,kBAAkB;AAGpB,MAAM,4BAA0E;AAAA,EACrF,CAAC,aAAa,KAAK,GAAG;AAAA,EACtB,CAAC,aAAa,EAAE,GAAG;AAAA,EACnB,CAAC,aAAa,cAAc,GAAG;AAAA,EAC/B,CAAC,aAAa,aAAa,GAAG;AAAA,EAC9B,CAAC,aAAa,UAAU,GAAG;AAAA,EAC3B,CAAC,aAAa,KAAK,GAAG;AAAA,EACtB,CAAC,aAAa,QAAQ,GAAG;AAC3B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|