@parcha/agentrun-serve 0.1.0-beta.46 → 0.1.0-beta.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +211 -1
- package/NOTICE +4 -0
- package/README.md +350 -53
- package/dist/acp-package.d.ts +53 -6
- package/dist/acp-package.js +3 -3
- package/dist/adapter-facts.d.ts +3 -4
- package/dist/adapter-facts.js +4 -4
- package/dist/adapters.d.ts +3 -5
- package/dist/adapters.js +1 -31
- package/dist/agents-store.d.ts +5 -3
- package/dist/agents-store.js +13 -8
- package/dist/answer-json.d.ts +10 -0
- package/dist/answer-json.js +24 -0
- package/dist/api-only.d.ts +11 -11
- package/dist/api-only.js +16 -11
- package/dist/archil-routes.js +2 -1
- package/dist/browser-live.d.ts +9 -4
- package/dist/browser-live.js +18 -5
- package/dist/cap.js +10 -2
- package/dist/chatgpt-plan.js +2 -1
- package/dist/cli.js +109 -41
- package/dist/composio-made.d.ts +19 -2
- package/dist/composio-made.js +17 -5
- package/dist/composio-preset.d.ts +42 -7
- package/dist/composio-preset.js +106 -70
- package/dist/composio-triggers.d.ts +9 -4
- package/dist/composio-triggers.js +20 -13
- package/dist/computer-attach.d.ts +11 -10
- package/dist/computer-attach.js +13 -14
- package/dist/computer-commands.d.ts +3 -0
- package/dist/computer-commands.js +3 -2
- package/dist/computer-lost.d.ts +4 -0
- package/dist/computer-lost.js +8 -3
- package/dist/computer-routes.d.ts +8 -5
- package/dist/computer-routes.js +7 -5
- package/dist/computer-setting.d.ts +2 -0
- package/dist/computer-setting.js +2 -0
- package/dist/computers.d.ts +14 -76
- package/dist/computers.js +24 -68
- package/dist/conformance.d.ts +4 -0
- package/dist/conformance.js +6 -0
- package/dist/console/assets/index-CTGegcKt.css +1 -0
- package/dist/console/assets/index-D1Se6mgG.js +715 -0
- package/dist/console/index.html +2 -2
- package/dist/cost-heal.d.ts +13 -0
- package/dist/cost-heal.js +27 -0
- package/dist/dial-relay.d.ts +6 -2
- package/dist/dial-relay.js +9 -12
- package/dist/email/routes.js +2 -1
- package/dist/errors.d.ts +2 -0
- package/dist/errors.js +5 -0
- package/dist/exa-keyless.d.ts +1 -1
- package/dist/exa-keyless.js +1 -1
- package/dist/faux-computers.d.ts +2 -3
- package/dist/faux-computers.js +9 -31
- package/dist/github-connection.js +2 -1
- package/dist/harness-archive.d.ts +19 -2
- package/dist/harness-archive.js +49 -15
- package/dist/harness-check.d.ts +75 -0
- package/dist/harness-check.js +518 -0
- package/dist/harness-cursor.d.ts +28 -0
- package/dist/harness-cursor.js +42 -0
- package/dist/harness-goose.d.ts +4 -29
- package/dist/harness-goose.js +6 -86
- package/dist/harness-module.d.ts +4 -0
- package/dist/harness-module.js +1 -0
- package/dist/harness-owned.d.ts +52 -0
- package/dist/harness-owned.js +92 -0
- package/dist/harness-recipe.d.ts +127 -0
- package/dist/harness-recipe.js +335 -0
- package/dist/harness-table.d.ts +120 -5
- package/dist/harness-table.js +280 -6
- package/dist/harness.d.ts +2 -0
- package/dist/harness.js +5 -4
- package/dist/host-check.d.ts +6 -0
- package/dist/host-check.js +14 -0
- package/dist/host.d.ts +10 -3
- package/dist/host.js +17 -3
- package/dist/import-sources.d.ts +2 -0
- package/dist/import-sources.js +2 -0
- package/dist/import-summary.d.ts +15 -5
- package/dist/import-summary.js +24 -8
- package/dist/import.d.ts +24 -4
- package/dist/import.js +108 -26
- package/dist/key-refusal.d.ts +3 -1
- package/dist/key-refusal.js +26 -5
- package/dist/key-words.d.ts +1 -1
- package/dist/key-words.js +4 -4
- package/dist/learn/check.d.ts +3 -0
- package/dist/learn/check.js +31 -20
- package/dist/learn/compile.js +12 -5
- package/dist/learn/promote.d.ts +80 -2
- package/dist/learn/promote.js +95 -3
- package/dist/learn/secrets.d.ts +4 -0
- package/dist/learn/secrets.js +23 -0
- package/dist/learned-nodes.d.ts +4 -3
- package/dist/learned-workflow.js +4 -1
- package/dist/learning-cost.d.ts +6 -16
- package/dist/learning-cost.js +6 -12
- package/dist/learning-model.d.ts +18 -0
- package/dist/learning-model.js +77 -0
- package/dist/learning-words.d.ts +2 -0
- package/dist/learning-words.js +1 -1
- package/dist/listen-first.d.ts +10 -0
- package/dist/listen-first.js +25 -1
- package/dist/llms.txt +2 -1
- package/dist/mcp-gateway.d.ts +2 -1
- package/dist/mcp-gateway.js +31 -15
- package/dist/mcp-probe.d.ts +18 -6
- package/dist/mcp-probe.js +41 -8
- package/dist/mcp-secret-writes.d.ts +8 -0
- package/dist/mcp-secret-writes.js +104 -4
- package/dist/mcp-servers-store.d.ts +11 -5
- package/dist/mcp-servers-store.js +46 -20
- package/dist/model-form.d.ts +2 -1
- package/dist/model-form.js +30 -16
- package/dist/model-gateway.d.ts +113 -0
- package/dist/model-gateway.js +433 -0
- package/dist/model.d.ts +5 -3
- package/dist/model.js +26 -18
- package/dist/monid.js +1 -1
- package/dist/native/binding.d.ts +4 -0
- package/dist/native/binding.js +9 -0
- package/dist/native/cli.d.ts +3 -2
- package/dist/native/cli.js +6 -5
- package/dist/openapi.d.ts +2 -0
- package/dist/openapi.js +356 -43
- package/dist/owner.d.ts +4 -2
- package/dist/owner.js +10 -4
- package/dist/page.d.ts +9 -0
- package/dist/page.js +10 -2
- package/dist/port-models.js +17 -10
- package/dist/provider.d.ts +3 -3
- package/dist/provider.js +12 -3
- package/dist/public-address.d.ts +28 -0
- package/dist/public-address.js +62 -0
- package/dist/run-launch.d.ts +1 -1
- package/dist/run-launch.js +1 -1
- package/dist/run-secrets.d.ts +3 -2
- package/dist/run-secrets.js +7 -4
- package/dist/run-trace.js +6 -3
- package/dist/runner/adapter-loop.d.ts +14 -8
- package/dist/runner/adapter-loop.js +58 -24
- package/dist/runner/adapter-run-spec.d.ts +15 -2
- package/dist/runner/adapter-run-spec.js +48 -10
- package/dist/runner/adapters/index.d.ts +4 -2
- package/dist/runner/adapters/index.js +6 -26
- package/dist/runner/adapters/pi.d.ts +5 -2
- package/dist/runner/adapters/pi.js +7 -4
- package/dist/runner/audit.d.ts +7 -0
- package/dist/runner/audit.js +15 -6
- package/dist/runner/claim-secrets.js +5 -1
- package/dist/runner/cli-run-spec.js +22 -10
- package/dist/runner/compare-end.d.ts +43 -0
- package/dist/runner/compare-end.js +95 -0
- package/dist/runner/computer-journal.d.ts +3 -0
- package/dist/runner/computer-journal.js +22 -2
- package/dist/runner/conformance/host-tools.d.ts +4 -0
- package/dist/runner/conformance/host-tools.js +14 -0
- package/dist/runner/harness-loops.d.ts +6 -1
- package/dist/runner/harness-loops.js +94 -54
- package/dist/runner/held.d.ts +5 -4
- package/dist/runner/journal-kinds.d.ts +4 -1
- package/dist/runner/journal-kinds.js +3 -0
- package/dist/runner/loop-contract.d.ts +10 -0
- package/dist/runner/main.d.ts +5 -5
- package/dist/runner/main.js +62 -11
- package/dist/runner/mcp-claim.js +40 -12
- package/dist/runner/meta-tools.js +4 -2
- package/dist/runner/metrics.d.ts +26 -0
- package/dist/runner/metrics.js +44 -1
- package/dist/runner/presence.d.ts +44 -0
- package/dist/runner/presence.js +96 -0
- package/dist/runner/promotion.d.ts +70 -7
- package/dist/runner/promotion.js +178 -28
- package/dist/runner/run-child-host.js +40 -10
- package/dist/runner/runner.d.ts +5 -0
- package/dist/runner/runner.js +8 -0
- package/dist/runner/sdk-loop.js +25 -1
- package/dist/runner/store-port.d.ts +3 -0
- package/dist/runner/store-secrets.js +19 -7
- package/dist/runner/workflow-first.d.ts +5 -2
- package/dist/runner/workflow-first.js +6 -3
- package/dist/runner/workflow-spec.js +3 -2
- package/dist/runs-over-store.d.ts +7 -2
- package/dist/runs-over-store.js +12 -4
- package/dist/sdk/check.d.ts +31 -0
- package/dist/sdk/check.js +58 -0
- package/dist/sdk/runs.d.ts +11 -3
- package/dist/sdk/runs.js +90 -15
- package/dist/sdk/schema.js +12 -4
- package/dist/secret-writes.d.ts +16 -3
- package/dist/secret-writes.js +28 -3
- package/dist/server-secrets-store.js +5 -0
- package/dist/server.d.ts +34 -2
- package/dist/server.js +437 -90
- package/dist/sign-ins-secrets.js +4 -1
- package/dist/skills/agentrun-serve/SKILL.md +11 -0
- package/dist/slack-url.d.ts +5 -0
- package/dist/slack-url.js +11 -0
- package/dist/slack.d.ts +107 -0
- package/dist/slack.js +292 -0
- package/dist/start-switches.d.ts +28 -0
- package/dist/start-switches.js +37 -0
- package/dist/stats.d.ts +1 -1
- package/dist/stats.js +2 -1
- package/dist/stop-signals.d.ts +11 -0
- package/dist/stop-signals.js +22 -0
- package/dist/store/agent-body.d.ts +1 -1
- package/dist/store/agent-body.js +2 -2
- package/dist/store/index.d.ts +3 -3
- package/dist/store/index.js +1 -1
- package/dist/store/postgres/migrations/0020_runners.sql +18 -0
- package/dist/store/postgres/store.d.ts +1 -1
- package/dist/store/postgres/store.js +4 -2
- package/dist/store/schema.d.ts +13 -5
- package/dist/store/schema.js +20 -11
- package/dist/store/seal.d.ts +16 -4
- package/dist/store/sqlite/store.d.ts +1 -1
- package/dist/store/sqlite/store.js +112 -28
- package/dist/store/store.d.ts +78 -24
- package/dist/store/store.js +11 -0
- package/dist/store-reads/analytics.js +3 -2
- package/dist/store-reads/cap.d.ts +7 -0
- package/dist/store-reads/cap.js +11 -1
- package/dist/store-reads/journal.js +27 -1
- package/dist/store-reads/learning.d.ts +23 -2
- package/dist/store-reads/learning.js +29 -8
- package/dist/store-reads/runs.d.ts +9 -0
- package/dist/store-reads/runs.js +19 -6
- package/dist/store-reads/stats.d.ts +4 -1
- package/dist/store-reads/stats.js +15 -6
- package/dist/store-view.d.ts +125 -14
- package/dist/store-view.js +156 -21
- package/dist/telemetry.d.ts +7 -7
- package/dist/telemetry.js +38 -15
- package/dist/template-eval.js +5 -2
- package/dist/template-github-permissions.d.ts +5 -1
- package/dist/template-github-permissions.js +7 -3
- package/dist/timeline/index.d.ts +1 -1
- package/dist/timeline/index.js +1 -1
- package/dist/timeline/timeline.d.ts +8 -0
- package/dist/timeline/timeline.js +30 -0
- package/dist/tool-gate.d.ts +8 -4
- package/dist/tool-gate.js +6 -7
- package/dist/tool-keys-store.js +2 -2
- package/dist/tool-keys.js +2 -1
- package/dist/tool-plane.d.ts +4 -0
- package/dist/tool-plane.js +12 -12
- package/dist/trigger-adapter.d.ts +3 -4
- package/dist/trigger-adapter.js +2 -2
- package/dist/trigger-composio.js +3 -3
- package/dist/trigger-email.js +0 -2
- package/dist/trigger-feed.js +0 -2
- package/dist/trigger-schedule.js +3 -0
- package/dist/trigger-secrets-shown.d.ts +6 -3
- package/dist/trigger-secrets-shown.js +22 -13
- package/dist/trigger-targets.d.ts +12 -3
- package/dist/trigger-targets.js +90 -10
- package/dist/triggers.d.ts +2 -2
- package/dist/validate.js +5 -1
- package/dist/viewer-credential.d.ts +25 -0
- package/dist/viewer-credential.js +51 -0
- package/dist/webhooks.d.ts +82 -8
- package/dist/webhooks.js +128 -45
- package/dist/wires.d.ts +6 -1
- package/dist/wires.js +5 -0
- package/dist/workspace/attach.d.ts +3 -2
- package/dist/workspace/attach.js +2 -1
- package/dist/workspace/attached-computers.d.ts +6 -8
- package/dist/workspace/attached-computers.js +27 -24
- package/dist/workspace/computer-deps.d.ts +2 -3
- package/dist/workspace/computer-deps.js +3 -6
- package/dist/workspace/computer-for-claim.js +72 -96
- package/dist/workspace/computer-kept.d.ts +0 -7
- package/dist/workspace/computer-kept.js +0 -17
- package/dist/workspace/resolve-computer.d.ts +23 -14
- package/dist/workspace/resolve-computer.js +66 -61
- package/dist/workspace/synced-folder.d.ts +20 -15
- package/dist/workspace/synced-folder.js +33 -43
- package/launcher/agentrun-serve +4 -1
- package/package.json +18 -10
- package/skills/agentrun-serve/SKILL.md +11 -0
- package/templates/README.md +1 -1
- package/templates/code-review/agent.md +2 -3
- package/templates/code-review/evals/mentions-defused/case.yaml +0 -1
- package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +0 -27
- package/templates/code-review/evals/other-repo/case.yaml +0 -1
- package/templates/code-review/evals/other-repo/fixtures/github-mcp.json +0 -18
- package/templates/code-review/evals/other-repo/graders/no-other-repo.md +1 -1
- package/dist/console/assets/index-C2MYaUBa.css +0 -1
- package/dist/console/assets/index-CZZeCReB.js +0 -701
|
@@ -12,24 +12,27 @@ export type ComputerViewRead = {
|
|
|
12
12
|
/** Why there is nothing to watch, in the server's words: for state off and none. */
|
|
13
13
|
readonly why?: string;
|
|
14
14
|
};
|
|
15
|
-
/** Our routes' names in serve's route table: each takes the owner's password session, never a token
|
|
15
|
+
/** Our routes' names in serve's route table: each takes the owner's password session, never a token (the server's token
|
|
16
|
+
* on an API-only server). */
|
|
16
17
|
export declare const COMPUTER_ROUTES: ReadonlySet<string>;
|
|
17
18
|
/** How long a take-over lasts with no input from the owner, in minutes, for the API's words. */
|
|
18
19
|
export declare const TAKE_OVER_MINUTES: number;
|
|
19
20
|
/** Run `runId`'s desktop or phone, from the store: its kind, whether it is up, and who drives it. */
|
|
20
21
|
export declare function computerViewOf(store: ComputerCallStore, runId: string, options?: ComputerCallOptions): Promise<ComputerViewRead>;
|
|
21
|
-
/** How a request to one of the routes came: by the owner's signed-in page, or with a token
|
|
22
|
-
*
|
|
22
|
+
/** How a request to one of the routes came: by the owner's signed-in page, or with a token (the server's, checked before
|
|
23
|
+
* this); whether this server is API-only (its token is then its backend's, and takes the routes); whether this server
|
|
24
|
+
* has accounts (for the refusal's words); its body. */
|
|
23
25
|
export type ComputerRequest = {
|
|
24
26
|
readonly ownerSession: boolean;
|
|
25
27
|
readonly token: boolean;
|
|
28
|
+
readonly apiOnly: boolean;
|
|
26
29
|
readonly accounts: boolean;
|
|
27
30
|
readonly body?: unknown;
|
|
28
31
|
};
|
|
29
32
|
/**
|
|
30
33
|
* One of our routes (COMPUTER_ROUTES, by its name in serve's route table) for run `runId`: { hold, outcome? }, or an
|
|
31
34
|
* ApiError. A token is refused (forbidden): a take-over drives the computer, so it takes the owner's signed-in page, as a
|
|
32
|
-
* run's browser does
|
|
33
|
-
* dispatch sends what this answers.
|
|
35
|
+
* run's browser does; on an API-only server, which has no owner, the server's token takes it. The take-over takes an
|
|
36
|
+
* empty body; the hand-back an `outcome` (done or cancelled) at most. Serve's dispatch sends what this answers.
|
|
34
37
|
*/
|
|
35
38
|
export declare function computerRoute(name: string, runId: string, request: ComputerRequest, store: ComputerCallStore, options?: ComputerCallOptions): Promise<ComputerHoldAnswer>;
|
package/dist/computer-routes.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// A run's desktop or phone, as its owner takes it: POST /v2/runs/{id}/computer/take-over and POST .../computer/hand-back
|
|
2
2
|
// (the hand-back for every kind: a browser's answers its agent's ask, as POST .../browser/hand-back does). Owner-only, as
|
|
3
|
-
// a run's browser is: the owner's password session in the console, never a token
|
|
3
|
+
// a run's browser is: the owner's password session in the console, never a token; on an API-only server (api-only.ts),
|
|
4
|
+
// which has no owner, the server's token, its backend's own. GET /v2/runs/{id}/computer is answered by
|
|
4
5
|
// server.ts from computerView (computer-view.ts) over computerHoldOf; computerViewOf is the store-backed read of the run's
|
|
5
6
|
// computer the take-over tests check against.
|
|
6
7
|
//
|
|
@@ -13,7 +14,8 @@ import { ApiError, invalid } from "./errors.js";
|
|
|
13
14
|
import { unknownFields } from "./validate.js";
|
|
14
15
|
import { HOLD_IDLE_MS } from "./workspace/computer-hold.js";
|
|
15
16
|
export { computerAsk, computerHoldOf, handBackComputer, runComputerKind, runViewedKind, takeOverComputer };
|
|
16
|
-
/** Our routes' names in serve's route table: each takes the owner's password session, never a token
|
|
17
|
+
/** Our routes' names in serve's route table: each takes the owner's password session, never a token (the server's token
|
|
18
|
+
* on an API-only server). */
|
|
17
19
|
export const COMPUTER_ROUTES = new Set(["takeOverRunComputer", "handBackRunComputer"]);
|
|
18
20
|
/** How long a take-over lasts with no input from the owner, in minutes, for the API's words. */
|
|
19
21
|
export const TAKE_OVER_MINUTES = HOLD_IDLE_MS / 60_000;
|
|
@@ -30,11 +32,11 @@ export async function computerViewOf(store, runId, options = {}) {
|
|
|
30
32
|
/**
|
|
31
33
|
* One of our routes (COMPUTER_ROUTES, by its name in serve's route table) for run `runId`: { hold, outcome? }, or an
|
|
32
34
|
* ApiError. A token is refused (forbidden): a take-over drives the computer, so it takes the owner's signed-in page, as a
|
|
33
|
-
* run's browser does
|
|
34
|
-
* dispatch sends what this answers.
|
|
35
|
+
* run's browser does; on an API-only server, which has no owner, the server's token takes it. The take-over takes an
|
|
36
|
+
* empty body; the hand-back an `outcome` (done or cancelled) at most. Serve's dispatch sends what this answers.
|
|
35
37
|
*/
|
|
36
38
|
export async function computerRoute(name, runId, request, store, options = {}) {
|
|
37
|
-
if (!request.ownerSession && request.token) {
|
|
39
|
+
if (!request.ownerSession && request.token && !request.apiOnly) {
|
|
38
40
|
throw new ApiError("forbidden", request.accounts ? "A run's computer takes the owner's password sign-in in the console, never a token." : "A run's computer takes the owner's password sign-in, and this server has no accounts (AGENTRUN_ACCOUNTS=0).");
|
|
39
41
|
}
|
|
40
42
|
const body = request.body ?? {};
|
|
@@ -43,6 +43,8 @@ export declare const gpuOf: (computer: {
|
|
|
43
43
|
readonly kind: string;
|
|
44
44
|
readonly gpu?: GpuSetting;
|
|
45
45
|
}) => GpuSetting | undefined;
|
|
46
|
+
/** The fields a computer of `kind` may set beside its kind and provider, in OPTIONAL's order: none for kind none. */
|
|
47
|
+
export declare const kindSettings: (kind: ComputerKind) => string[];
|
|
46
48
|
/** A place as the v2 API names it. */
|
|
47
49
|
export type PlaceView = {
|
|
48
50
|
mode: "runner";
|
package/dist/computer-setting.js
CHANGED
|
@@ -74,6 +74,8 @@ const OPTIONAL = {
|
|
|
74
74
|
},
|
|
75
75
|
},
|
|
76
76
|
};
|
|
77
|
+
/** The fields a computer of `kind` may set beside its kind and provider, in OPTIONAL's order: none for kind none. */
|
|
78
|
+
export const kindSettings = (kind) => kind === "none" ? [] : Object.entries(OPTIONAL).filter(([, { kinds }]) => kinds === undefined || kinds.includes(kind)).map(([key]) => key);
|
|
77
79
|
/** The place the setting reads as: sandbox on its provider, else the runner (no computer holds the run's folder). */
|
|
78
80
|
export const placeOfComputer = (computer) => (computer.kind === "sandbox" ? { mode: "sandbox", box: computer.provider } : { mode: "runner" });
|
|
79
81
|
/** The setting a place says: runner is no computer, a sandbox place a sandbox on its box. */
|
package/dist/computers.d.ts
CHANGED
|
@@ -1,72 +1,11 @@
|
|
|
1
|
-
import { type ComputerProvider, type GpuCapability } from "@parcha/agentrun-computer";
|
|
2
|
-
import { type KeyChoice, type KeyTable, type
|
|
3
|
-
import { type ComputerKind
|
|
1
|
+
import { type ComputerProvider, type GpuCapability, type HostCommand, type MountKind, type ProviderEntry } from "@parcha/agentrun-computer";
|
|
2
|
+
import { type KeyChoice, type KeyTable, type ProviderFactories, type ProviderSettings } from "./computer-keys.js";
|
|
3
|
+
import { type ComputerKind } from "./computer-setting.js";
|
|
4
4
|
import { type DockerDaemon } from "./docker-daemon.js";
|
|
5
5
|
import { type KeyEnv, type KeyMeta } from "./key-meta.js";
|
|
6
6
|
import type { PairedComputerRow, Store } from "./store/index.js";
|
|
7
7
|
import type { PairedView } from "./computer-attach.js";
|
|
8
|
-
import { type ComputerSettingKind, type ShellPlace } from "./workspace/resolve-computer.js";
|
|
9
|
-
/** A setting kind as the kind registry's SETTING_KINDS gives it. */
|
|
10
|
-
export interface SettingKindSpec {
|
|
11
|
-
readonly machineKinds: readonly string[];
|
|
12
|
-
readonly required: readonly string[];
|
|
13
|
-
readonly optional: readonly string[];
|
|
14
|
-
}
|
|
15
|
-
/** A provider configuration's machine kind and groups, the GPUs it gives where it declares them, whether it keeps an
|
|
16
|
-
* agent's own computer between runs (persistence), and the image a setting selects it by, where it names one, as the
|
|
17
|
-
* kind registry gives them. */
|
|
18
|
-
export type KindCapabilities = {
|
|
19
|
-
readonly kind: string;
|
|
20
|
-
readonly groups: readonly string[];
|
|
21
|
-
readonly gpu?: GpuCapability;
|
|
22
|
-
readonly persistence?: unknown;
|
|
23
|
-
readonly image?: string;
|
|
24
|
-
readonly options?: Readonly<Record<string, unknown>>;
|
|
25
|
-
};
|
|
26
|
-
/** A provider as the kind registry's PROVIDERS gives it. */
|
|
27
|
-
export interface ProviderEntry {
|
|
28
|
-
readonly id: string;
|
|
29
|
-
readonly label: string;
|
|
30
|
-
/** Whether its machines dial this server, as its descriptor declares it (the computer package's connectOf reads it
|
|
31
|
-
* with its settings' connect). Absent: they never do. */
|
|
32
|
-
readonly connect?: "dial" | "either";
|
|
33
|
-
readonly kinds: readonly ComputerKind[];
|
|
34
|
-
readonly keys: readonly {
|
|
35
|
-
readonly name: string;
|
|
36
|
-
readonly required: boolean;
|
|
37
|
-
readonly picked?: boolean;
|
|
38
|
-
}[];
|
|
39
|
-
/** The mounts its computers take; none means it cannot mount the run's folder. */
|
|
40
|
-
readonly mounts: readonly string[];
|
|
41
|
-
/** Why its computers take none of these mounts, each in one sentence (Daytona's archil), as its descriptor says. */
|
|
42
|
-
readonly unmounted?: Readonly<Partial<Record<string, string>>>;
|
|
43
|
-
/** Mounts its computers take only where the operator sets the key named, by mount (Daytona's archil, with
|
|
44
|
-
* DAYTONA_ARCHIL_EGRESS), as its descriptor says: resolve-computer.ts entryHere reads it with the keys set here. */
|
|
45
|
-
readonly mountsWith?: Readonly<Partial<Record<string, string>>>;
|
|
46
|
-
/** The server's environment variable that names the image every computer of it starts from (Daytona's
|
|
47
|
-
* AGENTRUN_DAYTONA_SNAPSHOT), as its descriptor says: set, the operator names its image here (entryHere). */
|
|
48
|
-
readonly imageEnv?: string;
|
|
49
|
-
/** Set by entryHere alone: its imageEnv has a value here. */
|
|
50
|
-
readonly imageNamed?: true;
|
|
51
|
-
/** The network forms its computers make ("none", "open", "allow"), as its descriptor declares them. Absent (a
|
|
52
|
-
* test's fixture): nothing is said of its network. */
|
|
53
|
-
readonly network?: readonly string[];
|
|
54
|
-
readonly metered: boolean;
|
|
55
|
-
readonly capabilities: readonly KindCapabilities[];
|
|
56
|
-
/** The image a computer of each kind starts from when its setting names none. */
|
|
57
|
-
readonly defaultImage?: Partial<Record<ComputerKind, string>>;
|
|
58
|
-
/** Its provider makes its image ready before the first create (its descriptor's prepareImage). */
|
|
59
|
-
readonly prepareImage?: boolean;
|
|
60
|
-
/** A program its computers need on this machine's PATH, what installs it, and the machines it is built for
|
|
61
|
-
* (`${platform}-${arch}`; absent, every one), as its descriptor declares it: the phone's adb. Absent: none. */
|
|
62
|
-
readonly hostCommand?: HostCommand;
|
|
63
|
-
}
|
|
64
|
-
/** A provider's host command, as the kind registry's entry names it. */
|
|
65
|
-
export type HostCommand = {
|
|
66
|
-
readonly command: string;
|
|
67
|
-
readonly from: string;
|
|
68
|
-
readonly builds?: readonly string[];
|
|
69
|
-
};
|
|
8
|
+
import { type ComputerSettingKind, type KindRegistry, type ShellPlace } from "./workspace/resolve-computer.js";
|
|
70
9
|
/** Why a provider whose host command is not on this machine's PATH cannot run here, in words that say how to fix it,
|
|
71
10
|
* as the server says Docker's (docker-daemon.ts). On a machine the command has no build for (adb on arm64 Linux: AgentRun's
|
|
72
11
|
* arm64 image has none either), they say which machine it needs, not how to install it. */
|
|
@@ -75,12 +14,6 @@ export declare function hostCommandWhy(label: string, { command, from, builds }:
|
|
|
75
14
|
* words: what Settings → Computers, a run's start and the claim say for it. A command is there when a folder of `path`
|
|
76
15
|
* holds an executable file of its name. */
|
|
77
16
|
export declare function hostCommandRefusals(providers: readonly Pick<ProviderEntry, "id" | "label" | "hostCommand">[], path: string | undefined, platform?: string, arch?: string): Readonly<Record<string, string>>;
|
|
78
|
-
/** The kind registry, by its own names: the computer package's module (SETTING_KINDS, PROVIDERS, servingRefusals). */
|
|
79
|
-
export interface KindRegistry {
|
|
80
|
-
readonly SETTING_KINDS: Readonly<Record<ComputerKind, SettingKindSpec>>;
|
|
81
|
-
readonly PROVIDERS: readonly ProviderEntry[];
|
|
82
|
-
servingRefusals(capabilities: KindCapabilities, kind: ComputerKind): string[];
|
|
83
|
-
}
|
|
84
17
|
/** Where the run's folder lives: on this machine (Mode 1), or on the owner's disk (Mode 2). */
|
|
85
18
|
export type FolderMode = "local" | "disk";
|
|
86
19
|
export interface ComputerRoutesOptions {
|
|
@@ -132,7 +65,10 @@ export interface ComputerRoutesOptions {
|
|
|
132
65
|
* where it offers images to choose. `picked`: the names of the secrets a person picks from the vendor's own list
|
|
133
66
|
* (GET /v2/computers/{provider}/choices) rather than pastes, where it has any. `runs_refused`: on a server whose runner
|
|
134
67
|
* runs in a process of its own, why no run here can use it and the fix, for a computer whose socket the server's
|
|
135
|
-
* process takes (a dial provider's, a paired one's); else null.
|
|
68
|
+
* process takes (a dial provider's, a paired one's); else null. `folder`: the kind of the run's folder a run of an agent
|
|
69
|
+
* with this computer holds on this server now (resolve-computer.ts runFolderOf, the claim's rule, in this server's mode
|
|
70
|
+
* and with the provider as this server has it): a bind of this machine, an Archil mount or a synced folder; null where
|
|
71
|
+
* it holds none. */
|
|
136
72
|
export type ProviderView = {
|
|
137
73
|
id: string;
|
|
138
74
|
name: string;
|
|
@@ -143,6 +79,7 @@ export type ProviderView = {
|
|
|
143
79
|
ready: boolean;
|
|
144
80
|
why?: string;
|
|
145
81
|
runs_refused: string | null;
|
|
82
|
+
folder: MountKind | null;
|
|
146
83
|
network?: string;
|
|
147
84
|
images?: string[];
|
|
148
85
|
persistent?: {
|
|
@@ -176,13 +113,15 @@ export declare const NETWORK_REFUSED_WORDS = "needs a network, which this server
|
|
|
176
113
|
* makes "none" alone, "open" alone, or "open" and "allow" but no "none" (a browser behind its own proxy); none where
|
|
177
114
|
* the allow-list applies as it is (Docker), or nothing is declared. */
|
|
178
115
|
export declare function networkWords(network: readonly string[] | undefined, kind?: ComputerKind): string | undefined;
|
|
179
|
-
/** A kind; kind none, the one "no computer" choice, carries its ShellChoice itself (it has no providers).
|
|
116
|
+
/** A kind; kind none, the one "no computer" choice, carries its ShellChoice itself (it has no providers). `settings`: the
|
|
117
|
+
* fields its computer may set beside kind and provider (computer-setting.ts kindSettings). */
|
|
180
118
|
export type KindView = {
|
|
181
119
|
kind: ComputerKind;
|
|
182
120
|
offered: boolean;
|
|
183
121
|
why?: string;
|
|
184
122
|
groups: string[];
|
|
185
123
|
tools: string[];
|
|
124
|
+
settings: string[];
|
|
186
125
|
providers: ProviderView[];
|
|
187
126
|
} & Partial<ShellChoice>;
|
|
188
127
|
export type TestView = {
|
|
@@ -226,7 +165,8 @@ export declare const COMPUTER_UNAVAILABLE = "computer_unavailable";
|
|
|
226
165
|
* mode takes it. `provider` is as this server has it (resolve-computer.ts entryHere). */
|
|
227
166
|
export declare function modeRefusal(kind: ComputerKind, provider: ProviderEntry, mode: FolderMode): string | undefined;
|
|
228
167
|
/** The routes' work over the server's store: GET /v2/computers (view), PUT /v2/computers/{provider}/keys (saveKeys), POST
|
|
229
|
-
* /v2/computers/{provider}/test (test), and the
|
|
168
|
+
* /v2/computers/{provider}/test (test), GET /v2/computers/{provider}/choices (choices), and the provider of an agent's
|
|
169
|
+
* own computer (providerFor). */
|
|
230
170
|
export declare function createComputerRoutes(options: ComputerRoutesOptions): {
|
|
231
171
|
view: () => Promise<{
|
|
232
172
|
kinds: KindView[];
|
|
@@ -237,8 +177,6 @@ export declare function createComputerRoutes(options: ComputerRoutesOptions): {
|
|
|
237
177
|
choices: (providerId: string, signal?: AbortSignal) => Promise<{
|
|
238
178
|
choices: KeyChoicesView[];
|
|
239
179
|
} | undefined>;
|
|
240
|
-
claimRefusal: (computer: ComputerSetting) => Promise<string | undefined>;
|
|
241
|
-
claimOptions: (computer: ComputerSetting) => Promise<OptionsAnswer | undefined>;
|
|
242
180
|
providerFor: (providerId: string, image: string | undefined) => Promise<Pick<ComputerProvider, "release">>;
|
|
243
181
|
};
|
|
244
182
|
export type ComputerRoutes = ReturnType<typeof createComputerRoutes>;
|
package/dist/computers.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// Settings → Computers, the serve side: which computers this server offers, each provider's keys (saved or not, never a
|
|
2
|
-
// value), saving a provider's keys sealed in the store, testing a provider's account
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
2
|
+
// value), saving a provider's keys sealed in the store, and testing a provider's account. createComputerRoutes takes the
|
|
3
|
+
// server's Store and the computer package's kind registry by its own names (SETTING_KINDS, PROVIDERS, servingRefusals);
|
|
4
|
+
// the tools each kind brings are the server's to say (server.ts kindTools: a sandbox's shell tools from the kernel's
|
|
5
|
+
// hostToolDefs, a browser's from pi-browser, a desktop's or a phone's the kernel's COMPUTER_TOOLS). Keys go by their
|
|
6
|
+
// names only: a provider declares them, Settings takes only those, and the store keeps each sealed under the server's
|
|
7
|
+
// seal key (server-keys.ts); a provider is handed its keys only for its test, or for the agent's own computer
|
|
8
|
+
// (providerFor), through computer-keys.ts (providerOptions, testConnection), which maps a key's name onto the option it
|
|
9
|
+
// fills. A run's claim is refused by the workspace's resolver (workspace/resolve-computer.ts resolveComputer).
|
|
10
10
|
import { connectOf, imagesOf } from "@parcha/agentrun-computer";
|
|
11
11
|
import { BOX_ALLOW_ENV, boxAllowOf } from "./box-settings.js";
|
|
12
12
|
import { KEY_TABLE, keyChoices, providerOptions, settingOptions, testConnection } from "./computer-keys.js";
|
|
13
|
-
import { COMPUTER_KINDS,
|
|
13
|
+
import { COMPUTER_KINDS, kindSettings } from "./computer-setting.js";
|
|
14
14
|
import { inArchilMode } from "./archil-settings.js";
|
|
15
15
|
import { daemonUp, noDockerWords } from "./docker-daemon.js";
|
|
16
16
|
import { ApiError, invalid } from "./errors.js";
|
|
@@ -18,14 +18,16 @@ import { commandOnPath } from "./host-command.js";
|
|
|
18
18
|
import { gpuRefused } from "./gpu-words.js";
|
|
19
19
|
import { redacted } from "./key-refusal.js";
|
|
20
20
|
import { keyMetaOf, envValue } from "./key-meta.js";
|
|
21
|
-
import { registerNotSecretWrite, registerSecretWrite, secretName } from "./secret-writes.js";
|
|
22
|
-
import { getSealedKey, putSealedKey, removeSealedKey
|
|
21
|
+
import { registerNotSecretWrite, registerSecretPage, registerSecretWrite, secretName } from "./secret-writes.js";
|
|
22
|
+
import { getSealedKey, putSealedKey, removeSealedKey } from "./server-keys.js";
|
|
23
23
|
import { dialApartWords, RUNNER_APART_WORDS, withPaired } from "./workspace/attached-computers.js";
|
|
24
|
-
import { aLabel, entryHere, folderKindOf, needsNetwork, shellChoiceOf } from "./workspace/resolve-computer.js";
|
|
24
|
+
import { aLabel, entryHere, folderKindOf, needsNetwork, runFolderOf, shellChoiceOf } from "./workspace/resolve-computer.js";
|
|
25
|
+
import { restartWith } from "./start-switches.js";
|
|
25
26
|
// Every request to a computer's keys is a secret write (secret-writes.ts), whatever its body (a value, a null, an empty
|
|
26
27
|
// body or none), as saveToolKey's is: the server's one dispatch check keeps it to the owner's session before any provider
|
|
27
28
|
// is looked up, so a token learns nothing of which providers exist. The view and the connection test write none.
|
|
28
29
|
registerSecretWrite("saveComputerKeys", () => true);
|
|
30
|
+
registerSecretPage("saveComputerKeys", "/#/settings/computers");
|
|
29
31
|
registerNotSecretWrite("testComputer", "A connection test reads the saved keys and writes none.");
|
|
30
32
|
const ARCH_NAMES = { x64: "x86-64", arm64: "arm64" };
|
|
31
33
|
const PLATFORM_NAMES = { linux: "Linux", darwin: "macOS", win32: "Windows" };
|
|
@@ -56,7 +58,7 @@ export const OPERATOR_LIST_WORDS = "open unless this server sets AGENTRUN_BOX_AL
|
|
|
56
58
|
* and at its claim (resolve-computer.ts noNetworkRefusal), so Settings says so and never offers it. */
|
|
57
59
|
export const NETWORK_REFUSED_WORDS = `needs a network, which this server refuses: its ${BOX_ALLOW_ENV} is none`;
|
|
58
60
|
/** Why a provider whose computers can't run with no network is not ready where this server has none. */
|
|
59
|
-
const noNetworkWhy = (provider) => `${provider.label} needs a network, and this server's ${BOX_ALLOW_ENV} is none (no network): pick a computer that runs with no network, or
|
|
61
|
+
const noNetworkWhy = (provider) => `${provider.label} needs a network, and this server's ${BOX_ALLOW_ENV} is none (no network): pick a computer that runs with no network, or ${restartWith(`${BOX_ALLOW_ENV} set to a host list`)}`;
|
|
60
62
|
/** What this server's allow-list means for a provider's computers, by the network forms it declares: words for one that
|
|
61
63
|
* makes "none" alone, "open" alone, or "open" and "allow" but no "none" (a browser behind its own proxy); none where
|
|
62
64
|
* the allow-list applies as it is (Docker), or nothing is declared. */
|
|
@@ -115,27 +117,15 @@ function gpuView(gpu, provider, mode) {
|
|
|
115
117
|
delete shown.unmounted;
|
|
116
118
|
return { ...shown, ...(refused ? { why: refused.words } : {}) };
|
|
117
119
|
}
|
|
118
|
-
/** Why `computer`'s GPUs cannot be had on `provider` in `mode`, in gpuRefused's words; undefined when they can, or it
|
|
119
|
-
* asks for none (only a sandbox does). */
|
|
120
|
-
function gpuRefusal(kinds, computer, provider, mode) {
|
|
121
|
-
const asked = gpuOf(computer);
|
|
122
|
-
if (!asked)
|
|
123
|
-
return undefined;
|
|
124
|
-
const gpu = sandboxGpu(kinds, provider);
|
|
125
|
-
const refused = gpuRefused(asked, gpu, folderMount(provider, gpu, mode), provider.label);
|
|
126
|
-
if (!refused)
|
|
127
|
-
return undefined;
|
|
128
|
-
return refused.folder ? `${refused.words} (Settings → Computers)` : `${provider.label} can't give this agent's computer its GPUs: ${refused.words} (Settings → Computers)`;
|
|
129
|
-
}
|
|
130
120
|
/** The required keys `provider` has no saved value for, by name. */
|
|
131
121
|
const missingKeys = (provider, saved) => provider.keys.filter((key) => key.required && !saved.has(key.name)).map((key) => key.name);
|
|
132
|
-
/** Why a provider with keys missing is not ready, naming the setting to fill: a person reads it (the view, the test)
|
|
133
|
-
|
|
134
|
-
const keysWhy = (provider, missing, route = false) => `${provider.label} needs ${missing.join(" and ")} saved: save ${missing.length > 1 ? "them" : "it"} in Settings → Computers${route ? ` (PUT /v2/computers/${provider.id}/keys)` : ""}`;
|
|
122
|
+
/** Why a provider with keys missing is not ready, naming the setting to fill: a person reads it (the view, the test). */
|
|
123
|
+
const keysWhy = (provider, missing) => `${provider.label} needs ${missing.join(" and ")} saved: save ${missing.length > 1 ? "them" : "it"} in Settings → Computers`;
|
|
135
124
|
/** Whether `provider` binds a folder of this machine, so its computers need this machine's Docker daemon. */
|
|
136
125
|
const local = (provider) => provider.mounts.includes("bind");
|
|
137
126
|
/** The routes' work over the server's store: GET /v2/computers (view), PUT /v2/computers/{provider}/keys (saveKeys), POST
|
|
138
|
-
* /v2/computers/{provider}/test (test), and the
|
|
127
|
+
* /v2/computers/{provider}/test (test), GET /v2/computers/{provider}/choices (choices), and the provider of an agent's
|
|
128
|
+
* own computer (providerFor). */
|
|
139
129
|
export function createComputerRoutes(options) {
|
|
140
130
|
const { store, sealKey, kinds, factories, settings = {}, keyTable = KEY_TABLE, tools, env = {}, answers = daemonUp, hostWhy = {} } = options;
|
|
141
131
|
const providerOf = (id) => kinds.PROVIDERS.find((one) => one.id === id);
|
|
@@ -171,6 +161,8 @@ export function createComputerRoutes(options) {
|
|
|
171
161
|
// Archil mount where its settings make its machines dial this server.
|
|
172
162
|
const kinds = { ...listed, PROVIDERS: listed.PROVIDERS.map((provider) => entryHere(provider, (name) => saved.has(name) || envValue(env, name) !== undefined, settingOptions(provider.id, settings, keyTable))) };
|
|
173
163
|
const choice = (setting) => shellChoiceOf(setting, mode === "disk" ? 2 : 1, kinds);
|
|
164
|
+
// The run's folder a computer of this choice holds, by the rule the claim picks it by, over the same providers.
|
|
165
|
+
const folderOf = (setting) => runFolderOf(setting, mode === "disk" ? 2 : 1, kinds) ?? null;
|
|
174
166
|
// Under this server's AGENTRUN_BOX_ALLOW none, a computer that needs a network is refused at a
|
|
175
167
|
// run's start and its claim (resolve-computer.ts noNetworkRefusal), so it is never ready here, whatever its keys.
|
|
176
168
|
const refusedOpen = (provider) => boxAllowOf(env) === "none" && needsNetwork(provider.network);
|
|
@@ -196,13 +188,13 @@ export function createComputerRoutes(options) {
|
|
|
196
188
|
const keptImages = images.filter((image) => keeping.some((one) => (one.image ?? provider.defaultImage?.[kind]) === image));
|
|
197
189
|
const persistent = keeping.length === 0 ? undefined : images.length > 0 ? { images: keptImages } : {};
|
|
198
190
|
const picked = provider.keys.filter((key) => key.picked).map((key) => secretName("computer", provider.id, key.name));
|
|
199
|
-
return { id: provider.id, name: provider.label, metered: provider.metered, secrets: provider.keys.map((key) => metas.get(secretName("computer", provider.id, key.name))), required: provider.keys.filter((key) => key.required).map((key) => secretName("computer", provider.id, key.name)), ...(picked.length > 0 ? { picked } : {}), ready: why === undefined, ...(why ? { why } : {}), runs_refused: runsRefused(provider, relays, pairedIds.has(provider.id)), ...(network ? { network } : {}), ...(images.length > 0 ? { images } : {}), ...(persistent ? { persistent } : {}), ...(gpu ? { gpu: gpuView(gpu, provider, mode) } : {}), ...choice({ kind, provider: provider.id }) };
|
|
191
|
+
return { id: provider.id, name: provider.label, metered: provider.metered, secrets: provider.keys.map((key) => metas.get(secretName("computer", provider.id, key.name))), required: provider.keys.filter((key) => key.required).map((key) => secretName("computer", provider.id, key.name)), ...(picked.length > 0 ? { picked } : {}), ready: why === undefined, ...(why ? { why } : {}), runs_refused: runsRefused(provider, relays, pairedIds.has(provider.id)), folder: folderOf({ kind, provider: provider.id }), ...(network ? { network } : {}), ...(images.length > 0 ? { images } : {}), ...(persistent ? { persistent } : {}), ...(gpu ? { gpu: gpuView(gpu, provider, mode) } : {}), ...choice({ kind, provider: provider.id }) };
|
|
200
192
|
});
|
|
201
193
|
const offered = kind === "none" || serving.some((provider) => unusable(kind, provider) === undefined);
|
|
202
194
|
const why = offered ? undefined
|
|
203
195
|
: serving.length && serving.every(refusedOpen) ? `every provider of a ${kind} computer needs a network, and this server's ${BOX_ALLOW_ENV} is none (no network)`
|
|
204
196
|
: serving.length ? `no provider of a ${kind} computer can reach this server's run folders` : `no provider serves a ${kind} computer`;
|
|
205
|
-
return { kind, offered, ...(why ? { why } : {}), groups: [...spec.required, ...spec.optional], tools: [...tools(kind)], providers, ...(kind === "none" ? choice({ kind: "none" }) : {}) };
|
|
197
|
+
return { kind, offered, ...(why ? { why } : {}), groups: [...spec.required, ...spec.optional], tools: [...tools(kind)], settings: kindSettings(kind), providers, ...(kind === "none" ? choice({ kind: "none" }) : {}) };
|
|
206
198
|
}),
|
|
207
199
|
paired,
|
|
208
200
|
};
|
|
@@ -288,42 +280,6 @@ export function createComputerRoutes(options) {
|
|
|
288
280
|
}
|
|
289
281
|
return { choices: views };
|
|
290
282
|
}
|
|
291
|
-
/** Why a run of an agent whose computer is `computer` cannot have it here, in words naming the setting to fill;
|
|
292
|
-
* undefined when it can. Checked at the claim: the provider must serve the kind (servingRefusals' words), fit this
|
|
293
|
-
* server's folder mode, give a sandbox the GPUs it asks for (checkGpu's words), have its daemon answer where it binds
|
|
294
|
-
* a folder of this machine (Docker), find what it runs on this machine (hostWhy's words), and have every required key
|
|
295
|
-
* saved; a key refusal names the route that saves them. */
|
|
296
|
-
async function claimRefusal(computer) {
|
|
297
|
-
if (computer.kind === "none")
|
|
298
|
-
return undefined;
|
|
299
|
-
const listed = providerOf(computer.provider);
|
|
300
|
-
if (!listed)
|
|
301
|
-
return `this agent's computer names the provider ${computer.provider}, which this server does not have: set its computer in Settings → Computers`;
|
|
302
|
-
// The keys set here, saved or the environment's: what the provider is made with, and what turns its mounts on.
|
|
303
|
-
const set = new Set([...(await sealedKeyNames(store)), ...listed.keys.filter((key) => envValue(env, key.name) !== undefined).map((key) => key.name)]);
|
|
304
|
-
const provider = entryHere(listed, (name) => set.has(name) || envValue(env, name) !== undefined, settingOptions(listed.id, settings, keyTable));
|
|
305
|
-
if (!provider.kinds.includes(computer.kind)) {
|
|
306
|
-
const words = [...new Set(provider.capabilities.flatMap((capabilities) => kinds.servingRefusals(capabilities, computer.kind)))];
|
|
307
|
-
return `${provider.label} does not serve a ${computer.kind} computer${words.length ? ` (${words.join("; ")})` : ""}: set this agent's computer to one it serves (Settings → Computers)`;
|
|
308
|
-
}
|
|
309
|
-
const mode = await modeNow();
|
|
310
|
-
const refused = modeRefusal(computer.kind, provider, mode) ?? gpuRefusal(kinds, computer, provider, mode) ?? (local(provider) ? daemonWhy(computer.kind, await answers(provider.id), mode) : undefined) ?? hostOf(provider);
|
|
311
|
-
if (refused)
|
|
312
|
-
return refused;
|
|
313
|
-
const missing = missingKeys(provider, set);
|
|
314
|
-
return missing.length ? keysWhy(provider, missing, true) : undefined;
|
|
315
|
-
}
|
|
316
|
-
/** What the claim makes a run's computer with: the options its provider's create() takes, from its saved keys and the
|
|
317
|
-
* server's settings (computer-keys.ts providerOptions); refused with computer_unavailable and claimRefusal's words when
|
|
318
|
-
* the computer cannot be had here. Undefined for a run with no computer. */
|
|
319
|
-
async function claimOptions(computer) {
|
|
320
|
-
if (computer.kind === "none")
|
|
321
|
-
return undefined;
|
|
322
|
-
const why = await claimRefusal(computer);
|
|
323
|
-
if (why)
|
|
324
|
-
return { ok: false, error: { code: COMPUTER_UNAVAILABLE, message: why } };
|
|
325
|
-
return providerOptions(computer.provider, await keysOf(providerOf(computer.provider)), settings, keyTable);
|
|
326
|
-
}
|
|
327
283
|
/** The provider an agent's own computer lives on (workspace/agent-computer.ts reconcileAgentComputer deletes it
|
|
328
284
|
* through it): made from its saved keys and the server's settings, with the create() options of the configuration
|
|
329
285
|
* `image` selects, and the store's ledger (the factories'). Throws, in words, when it cannot be made here. */
|
|
@@ -343,7 +299,7 @@ export function createComputerRoutes(options) {
|
|
|
343
299
|
throw new Error(`this server's ${entry.label} provider cannot release a computer`);
|
|
344
300
|
return made;
|
|
345
301
|
}
|
|
346
|
-
return { view, saveKeys, test, choices,
|
|
302
|
+
return { view, saveKeys, test, choices, providerFor };
|
|
347
303
|
}
|
|
348
304
|
/** This server's folder mode, read from the store at each call: "disk" (Mode 2) while the Archil settings row is saved
|
|
349
305
|
* (PUT /v2/workspace/archil), else "local" (Mode 1). createComputerRoutes' `mode`. */
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { MAX_RESTARTS, registerHarnessConformance, type TestFunction } from "./runner/conformance/harness.js";
|
|
2
|
+
export type { ConformanceCase, ConformanceSetup, ConformanceSubject, KernelHooks, MetaToolName, ScriptStep, SuiteTool, ToolCall, ToolName } from "./runner/conformance/subject.js";
|
|
3
|
+
export { type AdapterLoopOptions, type AdapterRunSpec, createAdapterLoop } from "./runner/adapter-loop.js";
|
|
4
|
+
export { suiteHostTools } from "./runner/conformance/host-tools.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// The harness conformance suite, as a harness's author runs it on their own adapter (`@parcha/agentrun-serve/conformance`,
|
|
2
|
+
// HARNESS.md "Prove it"): the suite itself, the kernel's adapter loop a subject's loops are, and the types a subject is
|
|
3
|
+
// written in. The same suite proves every built-in harness in this repository's tests.
|
|
4
|
+
export { MAX_RESTARTS, registerHarnessConformance } from "./runner/conformance/harness.js";
|
|
5
|
+
export { createAdapterLoop } from "./runner/adapter-loop.js";
|
|
6
|
+
export { suiteHostTools } from "./runner/conformance/host-tools.js";
|