@parcha/agentrun-serve 0.1.0-beta.52 → 0.1.0-beta.53
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 +122 -1
- package/README.md +213 -24
- package/dist/agent-delete.d.ts +5 -6
- package/dist/agent-delete.js +30 -67
- package/dist/agent-package.d.ts +71 -0
- package/dist/agent-package.js +345 -0
- package/dist/agents-store.d.ts +26 -20
- package/dist/agents-store.js +41 -33
- package/dist/api-only.d.ts +26 -6
- package/dist/api-only.js +35 -13
- package/dist/claude-login.d.ts +1 -0
- package/dist/claude-login.js +1 -1
- package/dist/cli-learning/cli.d.ts +3 -0
- package/dist/cli-learning/cli.js +17 -3
- package/dist/cli-learning/connections.js +3 -2
- package/dist/cli-learning/schema.js +2 -1
- package/dist/cli.js +70 -7
- package/dist/composio-preset.d.ts +2 -1
- package/dist/composio-preset.js +4 -3
- package/dist/composio-triggers.d.ts +4 -0
- package/dist/composio-triggers.js +4 -1
- package/dist/computer-needs.d.ts +32 -0
- package/dist/computer-needs.js +80 -0
- package/dist/computer-setting.d.ts +1 -0
- package/dist/computer-setting.js +8 -1
- package/dist/console/assets/index-BFgyZzF_.js +734 -0
- package/dist/console/assets/index-DbilxljH.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/console-links.d.ts +1 -0
- package/dist/console-links.js +2 -0
- package/dist/env-switch.d.ts +14 -0
- package/dist/env-switch.js +23 -0
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +3 -0
- package/dist/eval-previous.js +4 -3
- package/dist/fal-price.js +10 -13
- package/dist/handed-secret.d.ts +4 -0
- package/dist/handed-secret.js +10 -0
- package/dist/harness-archive.d.ts +15 -5
- package/dist/harness-archive.js +71 -34
- package/dist/harness-check.d.ts +2 -1
- package/dist/harness-check.js +36 -95
- package/dist/harness-egress.d.ts +23 -0
- package/dist/harness-egress.js +69 -0
- package/dist/harness-recipe-entry.d.ts +71 -0
- package/dist/harness-recipe-entry.js +184 -0
- package/dist/harness-recipe.d.ts +73 -6
- package/dist/harness-recipe.js +185 -31
- package/dist/harness-sign-in.d.ts +29 -0
- package/dist/harness-sign-in.js +122 -0
- package/dist/harness-table.d.ts +21 -0
- package/dist/harness-table.js +58 -3
- package/dist/harness-zip.d.ts +6 -0
- package/dist/harness-zip.js +203 -0
- package/dist/ids.d.ts +11 -0
- package/dist/ids.js +36 -0
- package/dist/learn/commit.d.ts +14 -1
- package/dist/learn/commit.js +156 -1
- package/dist/learn/compile.js +22 -8
- package/dist/learn/folder.d.ts +5 -0
- package/dist/learn/folder.js +10 -1
- package/dist/learn/learning.sh +15 -3
- package/dist/learn/promote.d.ts +2 -2
- package/dist/learn/secrets.js +30 -7
- package/dist/learning-routes.d.ts +23 -11
- package/dist/learning-routes.js +110 -20
- package/dist/learning.d.ts +9 -6
- package/dist/learning.js +9 -4
- package/dist/mcp-gateway.js +15 -2
- package/dist/mcp-probe.d.ts +3 -0
- package/dist/mcp-probe.js +7 -2
- package/dist/mcp-resources.d.ts +44 -0
- package/dist/mcp-resources.js +100 -0
- package/dist/mcp-servers-store.d.ts +16 -12
- package/dist/model.d.ts +4 -4
- package/dist/model.js +6 -6
- package/dist/native/cli.js +9 -2
- package/dist/native/connection.d.ts +2 -2
- package/dist/native/connection.js +5 -2
- package/dist/native/discovery.d.ts +2 -0
- package/dist/native/discovery.js +10 -6
- package/dist/native/remote-worker-bridge.js +36 -4
- package/dist/native/remote.d.ts +18 -1
- package/dist/native/remote.js +126 -37
- package/dist/native/schema.d.ts +6 -0
- package/dist/native/schema.js +31 -6
- package/dist/native/source-account.d.ts +13 -0
- package/dist/native/source-account.js +114 -0
- package/dist/native/source-capture-hooks.d.ts +5 -0
- package/dist/native/source-capture-hooks.js +102 -0
- package/dist/native/source-mcp-selection.d.ts +13 -0
- package/dist/native/source-mcp-selection.js +72 -0
- package/dist/native/source-runtime-tools.d.ts +19 -0
- package/dist/native/source-runtime-tools.js +103 -0
- package/dist/native/source-snapshot-types.d.ts +138 -0
- package/dist/native/source-snapshot-types.js +12 -0
- package/dist/native/source-snapshot.d.ts +8 -0
- package/dist/native/source-snapshot.js +1201 -0
- package/dist/observation/learning.js +3 -2
- package/dist/openapi.js +167 -36
- package/dist/print.js +1 -1
- package/dist/purged-workflow.d.ts +12 -0
- package/dist/purged-workflow.js +43 -0
- package/dist/run-keys.d.ts +46 -0
- package/dist/run-keys.js +109 -0
- package/dist/run-launch.d.ts +16 -1
- package/dist/run-launch.js +30 -1
- package/dist/run-learning-served.d.ts +2 -2
- package/dist/run-model-key.d.ts +2 -2
- package/dist/run-model-key.js +5 -5
- package/dist/run-secrets.d.ts +2 -0
- package/dist/run-secrets.js +7 -4
- package/dist/run-view.d.ts +17 -0
- package/dist/run-view.js +25 -1
- package/dist/runner/adapter-loop.d.ts +11 -3
- package/dist/runner/adapter-loop.js +138 -22
- package/dist/runner/adapter-run-spec.js +25 -12
- package/dist/runner/audit.d.ts +2 -0
- package/dist/runner/audit.js +9 -1
- package/dist/runner/beside.js +2 -1
- package/dist/runner/claim-secrets.d.ts +29 -3
- package/dist/runner/claim-secrets.js +38 -4
- package/dist/runner/cli-run-spec.js +23 -12
- package/dist/runner/harness-loops.d.ts +6 -0
- package/dist/runner/harness-loops.js +11 -1
- package/dist/runner/held.d.ts +4 -0
- package/dist/runner/journal-kinds.d.ts +2 -0
- package/dist/runner/learned-first.d.ts +2 -0
- package/dist/runner/learned-first.js +1 -1
- package/dist/runner/learning-end.d.ts +7 -2
- package/dist/runner/learning-end.js +22 -10
- package/dist/runner/learning-seed.d.ts +9 -3
- package/dist/runner/learning-seed.js +2 -2
- package/dist/runner/main.d.ts +1 -0
- package/dist/runner/main.js +20 -13
- package/dist/runner/mcp-claim.js +6 -1
- package/dist/runner/mcp-run.d.ts +10 -7
- package/dist/runner/mcp-run.js +3 -5
- package/dist/runner/monid-run.js +9 -11
- package/dist/runner/project-checkpoint.d.ts +35 -0
- package/dist/runner/project-checkpoint.js +116 -0
- package/dist/runner/project-drain.d.ts +8 -0
- package/dist/runner/project-drain.js +25 -0
- package/dist/runner/project-host.d.ts +10 -0
- package/dist/runner/project-host.js +52 -0
- package/dist/runner/promotion.d.ts +14 -6
- package/dist/runner/promotion.js +98 -41
- package/dist/runner/redact.d.ts +13 -0
- package/dist/runner/redact.js +67 -1
- package/dist/runner/run-channel.d.ts +9 -0
- package/dist/runner/run-channel.js +15 -2
- package/dist/runner/run-child-host.d.ts +8 -4
- package/dist/runner/run-child-host.js +171 -41
- package/dist/runner/run-errors.js +2 -2
- package/dist/runner/runner-check.js +5 -2
- package/dist/runner/runner.js +26 -9
- package/dist/runner/store-secrets.js +7 -3
- package/dist/runner/workflow-first.d.ts +4 -0
- package/dist/runner/workflow-first.js +13 -0
- package/dist/runner/workflow-loop.d.ts +2 -1
- package/dist/runner/workflow-loop.js +2 -1
- package/dist/runner/workflow-spec.js +1 -1
- package/dist/runs-over-store.d.ts +34 -6
- package/dist/runs-over-store.js +133 -25
- package/dist/sdk/runs.d.ts +11 -1
- package/dist/sdk/runs.js +117 -26
- package/dist/sdk/schema.js +12 -2
- package/dist/sdk/workflows.d.ts +1 -1
- package/dist/server.d.ts +68 -32
- package/dist/server.js +600 -110
- package/dist/skills/agentrun-serve/SKILL.md +2 -1
- package/dist/source-sync/adoption.d.ts +15 -0
- package/dist/source-sync/adoption.js +36 -0
- package/dist/source-sync/auxiliary.d.ts +23 -0
- package/dist/source-sync/auxiliary.js +64 -0
- package/dist/source-sync/capture-git.d.ts +5 -0
- package/dist/source-sync/capture-git.js +272 -0
- package/dist/source-sync/capture-project.d.ts +53 -0
- package/dist/source-sync/capture-project.js +206 -0
- package/dist/source-sync/capture-refusal.d.ts +7 -0
- package/dist/source-sync/capture-refusal.js +16 -0
- package/dist/source-sync/capture.d.ts +11 -0
- package/dist/source-sync/capture.js +22 -0
- package/dist/source-sync/checkpoint-gate.d.ts +21 -0
- package/dist/source-sync/checkpoint-gate.js +52 -0
- package/dist/source-sync/checkpoints.d.ts +66 -0
- package/dist/source-sync/checkpoints.js +168 -0
- package/dist/source-sync/claim.d.ts +11 -0
- package/dist/source-sync/claim.js +48 -0
- package/dist/source-sync/destination.d.ts +47 -0
- package/dist/source-sync/destination.js +239 -0
- package/dist/source-sync/io.d.ts +15 -0
- package/dist/source-sync/io.js +52 -0
- package/dist/source-sync/local.d.ts +43 -0
- package/dist/source-sync/local.js +229 -0
- package/dist/source-sync/prepare.d.ts +59 -0
- package/dist/source-sync/prepare.js +93 -0
- package/dist/source-sync/projects.d.ts +61 -0
- package/dist/source-sync/projects.js +130 -0
- package/dist/source-sync/registry.d.ts +95 -0
- package/dist/source-sync/registry.js +226 -0
- package/dist/source-sync/service.d.ts +33 -0
- package/dist/source-sync/service.js +118 -0
- package/dist/source-sync/skill-edits.d.ts +12 -0
- package/dist/source-sync/skill-edits.js +122 -0
- package/dist/source-sync/snapshots.d.ts +48 -0
- package/dist/source-sync/snapshots.js +448 -0
- package/dist/source-sync/types.d.ts +9 -0
- package/dist/source-sync/types.js +14 -0
- package/dist/source-sync/workspace.d.ts +66 -0
- package/dist/source-sync/workspace.js +273 -0
- package/dist/store/agent-body.d.ts +4 -0
- package/dist/store/agent-body.js +16 -5
- package/dist/store/index.d.ts +2 -2
- package/dist/store/index.js +1 -1
- package/dist/store/schema.d.ts +2 -1
- package/dist/store/schema.js +2 -1
- package/dist/store/seal.d.ts +5 -1
- package/dist/store/seal.js +12 -3
- package/dist/store/sqlite/project-checkpoints.d.ts +11 -0
- package/dist/store/sqlite/project-checkpoints.js +70 -0
- package/dist/store/sqlite/run-launch.d.ts +4 -12
- package/dist/store/sqlite/run-launch.js +5 -19
- package/dist/store/sqlite/store.js +224 -170
- package/dist/store/store.d.ts +116 -39
- package/dist/store/store.js +14 -1
- package/dist/store-reads/learning.d.ts +2 -2
- package/dist/store-view.d.ts +3 -1
- package/dist/store-view.js +17 -5
- package/dist/template-import.d.ts +10 -2
- package/dist/template-import.js +116 -13
- package/dist/templates.d.ts +26 -5
- package/dist/templates.js +62 -10
- package/dist/timeline/index.d.ts +1 -1
- package/dist/timeline/index.js +1 -1
- package/dist/timeline/timeline.d.ts +5 -0
- package/dist/timeline/timeline.js +8 -0
- package/dist/tool-plane.d.ts +12 -12
- package/dist/tools.d.ts +8 -8
- package/dist/trigger-launch-hook.d.ts +47 -0
- package/dist/trigger-launch-hook.js +90 -0
- package/dist/trigger-targets.d.ts +14 -1
- package/dist/trigger-targets.js +20 -0
- package/dist/triggers.d.ts +54 -5
- package/dist/triggers.js +143 -8
- package/dist/uploads-archil.js +1 -1
- package/dist/uploads.js +1 -1
- package/dist/validate.js +1 -2
- package/dist/workspace/computer-for-claim.d.ts +2 -0
- package/dist/workspace/computer-for-claim.js +43 -0
- package/dist/workspace/paths.d.ts +6 -0
- package/dist/workspace/paths.js +6 -0
- package/dist/workspace/resolve-computer.d.ts +1 -0
- package/dist/workspace/run-tools.d.ts +2 -0
- package/dist/workspace/run-tools.js +8 -0
- package/launcher/agentrun-serve +1 -1
- package/package.json +10 -10
- package/skills/agentrun-serve/SKILL.md +2 -1
- package/templates/README.md +5 -2
- package/dist/console/assets/index-B-D0EM3j.js +0 -733
- package/dist/console/assets/index-DlQepP2J.css +0 -1
|
@@ -149,11 +149,11 @@ export declare class McpServersOverStore {
|
|
|
149
149
|
not_metered?: string[] | undefined;
|
|
150
150
|
tools: {
|
|
151
151
|
grant_problems?: Record<string, string>;
|
|
152
|
-
default_permission: "ask" | "
|
|
153
|
-
permissions: ("ask" | "
|
|
152
|
+
default_permission: "ask" | "deny" | "allow";
|
|
153
|
+
permissions: ("ask" | "deny" | "allow")[];
|
|
154
154
|
fallback_allow_reads?: true | undefined;
|
|
155
155
|
allow_reads?: true | undefined;
|
|
156
|
-
permission: "ask" | "
|
|
156
|
+
permission: "ask" | "deny" | "allow";
|
|
157
157
|
effect: import("./tool-gate.js").ToolEffect;
|
|
158
158
|
name: string;
|
|
159
159
|
title?: string;
|
|
@@ -161,6 +161,7 @@ export declare class McpServersOverStore {
|
|
|
161
161
|
input_schema: unknown;
|
|
162
162
|
output_schema?: unknown;
|
|
163
163
|
annotations?: unknown;
|
|
164
|
+
resource?: import("./mcp-resources.js").ResourceOperation;
|
|
164
165
|
}[];
|
|
165
166
|
prices?: McpPrices | undefined;
|
|
166
167
|
instructions?: string | undefined;
|
|
@@ -190,11 +191,11 @@ export declare class McpServersOverStore {
|
|
|
190
191
|
not_metered?: string[] | undefined;
|
|
191
192
|
tools: {
|
|
192
193
|
grant_problems?: Record<string, string>;
|
|
193
|
-
default_permission: "ask" | "
|
|
194
|
-
permissions: ("ask" | "
|
|
194
|
+
default_permission: "ask" | "deny" | "allow";
|
|
195
|
+
permissions: ("ask" | "deny" | "allow")[];
|
|
195
196
|
fallback_allow_reads?: true | undefined;
|
|
196
197
|
allow_reads?: true | undefined;
|
|
197
|
-
permission: "ask" | "
|
|
198
|
+
permission: "ask" | "deny" | "allow";
|
|
198
199
|
effect: import("./tool-gate.js").ToolEffect;
|
|
199
200
|
name: string;
|
|
200
201
|
title?: string;
|
|
@@ -202,6 +203,7 @@ export declare class McpServersOverStore {
|
|
|
202
203
|
input_schema: unknown;
|
|
203
204
|
output_schema?: unknown;
|
|
204
205
|
annotations?: unknown;
|
|
206
|
+
resource?: import("./mcp-resources.js").ResourceOperation;
|
|
205
207
|
}[];
|
|
206
208
|
prices?: McpPrices | undefined;
|
|
207
209
|
instructions?: string | undefined;
|
|
@@ -261,11 +263,11 @@ export declare class McpServersOverStore {
|
|
|
261
263
|
not_metered?: string[] | undefined;
|
|
262
264
|
tools: {
|
|
263
265
|
grant_problems?: Record<string, string>;
|
|
264
|
-
default_permission: "ask" | "
|
|
265
|
-
permissions: ("ask" | "
|
|
266
|
+
default_permission: "ask" | "deny" | "allow";
|
|
267
|
+
permissions: ("ask" | "deny" | "allow")[];
|
|
266
268
|
fallback_allow_reads?: true | undefined;
|
|
267
269
|
allow_reads?: true | undefined;
|
|
268
|
-
permission: "ask" | "
|
|
270
|
+
permission: "ask" | "deny" | "allow";
|
|
269
271
|
effect: import("./tool-gate.js").ToolEffect;
|
|
270
272
|
name: string;
|
|
271
273
|
title?: string;
|
|
@@ -273,6 +275,7 @@ export declare class McpServersOverStore {
|
|
|
273
275
|
input_schema: unknown;
|
|
274
276
|
output_schema?: unknown;
|
|
275
277
|
annotations?: unknown;
|
|
278
|
+
resource?: import("./mcp-resources.js").ResourceOperation;
|
|
276
279
|
}[];
|
|
277
280
|
prices?: McpPrices | undefined;
|
|
278
281
|
instructions?: string | undefined;
|
|
@@ -306,11 +309,11 @@ export declare class McpServersOverStore {
|
|
|
306
309
|
not_metered?: string[] | undefined;
|
|
307
310
|
tools: {
|
|
308
311
|
grant_problems?: Record<string, string>;
|
|
309
|
-
default_permission: "ask" | "
|
|
310
|
-
permissions: ("ask" | "
|
|
312
|
+
default_permission: "ask" | "deny" | "allow";
|
|
313
|
+
permissions: ("ask" | "deny" | "allow")[];
|
|
311
314
|
fallback_allow_reads?: true | undefined;
|
|
312
315
|
allow_reads?: true | undefined;
|
|
313
|
-
permission: "ask" | "
|
|
316
|
+
permission: "ask" | "deny" | "allow";
|
|
314
317
|
effect: import("./tool-gate.js").ToolEffect;
|
|
315
318
|
name: string;
|
|
316
319
|
title?: string;
|
|
@@ -318,6 +321,7 @@ export declare class McpServersOverStore {
|
|
|
318
321
|
input_schema: unknown;
|
|
319
322
|
output_schema?: unknown;
|
|
320
323
|
annotations?: unknown;
|
|
324
|
+
resource?: import("./mcp-resources.js").ResourceOperation;
|
|
321
325
|
}[];
|
|
322
326
|
prices?: McpPrices | undefined;
|
|
323
327
|
instructions?: string | undefined;
|
package/dist/model.d.ts
CHANGED
|
@@ -7,11 +7,11 @@ import type { Revision } from "./agent-rows.js";
|
|
|
7
7
|
export declare const FAUX_ENV = "AGENTRUN_SERVE_FAUX";
|
|
8
8
|
/** Every test hook's name starts so (AGENTRUN_SERVE_FAUX, AGENTRUN_SERVE_FAUX_WEB, ...), but the harness table's
|
|
9
9
|
* (harness-table.ts HARNESS_TABLE_ENV), which withoutFaux drops by name, as it drops the resolved harness modules list
|
|
10
|
-
* (HARNESS_MODULES_ENV). */
|
|
10
|
+
* (HARNESS_MODULES_ENV) and recipes list (HARNESS_RECIPES_ENV). */
|
|
11
11
|
export declare const FAUX_PREFIX = "AGENTRUN_SERVE_FAUX";
|
|
12
|
-
/** `env` without a test hook's name or the resolved harness modules list: serve sets those from startServe's
|
|
13
|
-
* alone, so a name the server's own environment holds (an operator's export, a leftover) never gives its runs
|
|
14
|
-
* answers or
|
|
12
|
+
/** `env` without a test hook's name or the resolved harness modules or recipes list: serve sets those from startServe's
|
|
13
|
+
* options alone, so a name the server's own environment holds (an operator's export, a leftover) never gives its runs
|
|
14
|
+
* fake answers, loads a module or runs a recipe. */
|
|
15
15
|
export declare const withoutFaux: (env: NodeJS.ProcessEnv) => NodeJS.ProcessEnv;
|
|
16
16
|
/** Under `--faux` only: a module whose default export is the fetch the Anthropic and OpenAI providers send through (the
|
|
17
17
|
* tests' fake upstream), in place of their APIs. With it they are registered beside the faux model, for a tool's own
|
package/dist/model.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { isRouter, withLocalModels } from "./local-models.js";
|
|
9
9
|
import { pathToFileURL } from "node:url";
|
|
10
10
|
import { DEFAULT_HARNESS, PLAN_HARNESSES } from "./harness.js";
|
|
11
|
-
import { builtinHarness, factsOf, HARNESS_MODULES_ENV, HARNESS_TABLE_ENV, harnessIds, harnessOf } from "./harness-table.js";
|
|
11
|
+
import { builtinHarness, factsOf, HARNESS_MODULES_ENV, HARNESS_RECIPES_ENV, HARNESS_TABLE_ENV, harnessIds, harnessOf } from "./harness-table.js";
|
|
12
12
|
import { gatewayBase, modelGatewayBase } from "./provider.js";
|
|
13
13
|
import { modelFormWhy } from "./model-form.js";
|
|
14
14
|
// Leaves, which the key rows below read as this module loads, in any import order (wires.ts, adapter-facts.ts).
|
|
@@ -21,12 +21,12 @@ import { LOGIN_DEFAULT_MODEL, onClaudeLogin } from "./claude-login.js";
|
|
|
21
21
|
export const FAUX_ENV = "AGENTRUN_SERVE_FAUX";
|
|
22
22
|
/** Every test hook's name starts so (AGENTRUN_SERVE_FAUX, AGENTRUN_SERVE_FAUX_WEB, ...), but the harness table's
|
|
23
23
|
* (harness-table.ts HARNESS_TABLE_ENV), which withoutFaux drops by name, as it drops the resolved harness modules list
|
|
24
|
-
* (HARNESS_MODULES_ENV). */
|
|
24
|
+
* (HARNESS_MODULES_ENV) and recipes list (HARNESS_RECIPES_ENV). */
|
|
25
25
|
export const FAUX_PREFIX = "AGENTRUN_SERVE_FAUX";
|
|
26
|
-
/** `env` without a test hook's name or the resolved harness modules list: serve sets those from startServe's
|
|
27
|
-
* alone, so a name the server's own environment holds (an operator's export, a leftover) never gives its runs
|
|
28
|
-
* answers or
|
|
29
|
-
export const withoutFaux = (env) => Object.fromEntries(Object.entries(env).filter(([name]) => !name.startsWith(FAUX_PREFIX) && name !== HARNESS_TABLE_ENV && name !== HARNESS_MODULES_ENV));
|
|
26
|
+
/** `env` without a test hook's name or the resolved harness modules or recipes list: serve sets those from startServe's
|
|
27
|
+
* options alone, so a name the server's own environment holds (an operator's export, a leftover) never gives its runs
|
|
28
|
+
* fake answers, loads a module or runs a recipe. */
|
|
29
|
+
export const withoutFaux = (env) => Object.fromEntries(Object.entries(env).filter(([name]) => !name.startsWith(FAUX_PREFIX) && name !== HARNESS_TABLE_ENV && name !== HARNESS_MODULES_ENV && name !== HARNESS_RECIPES_ENV));
|
|
30
30
|
/** Under `--faux` only: a module whose default export is the fetch the Anthropic and OpenAI providers send through (the
|
|
31
31
|
* tests' fake upstream), in place of their APIs. With it they are registered beside the faux model, for a tool's own
|
|
32
32
|
* request to the provider the revision's model names (web_search's, hosted-search.ts); the run's turns stay faux. */
|
package/dist/native/cli.js
CHANGED
|
@@ -5,11 +5,13 @@ import { defaultData } from '../server-fs.js';
|
|
|
5
5
|
import { discoverNative } from './discovery.js';
|
|
6
6
|
import { nativeEnvironment } from './environment.js';
|
|
7
7
|
import { secret } from '../secrets.js';
|
|
8
|
+
import { selectedNative } from './connection.js';
|
|
9
|
+
import { sourceLocalConsent } from '../source-sync/local.js';
|
|
8
10
|
/** Source-machine handoff: discovery never launches a model; connection uses the existing local server credential.
|
|
9
11
|
* `usage`: the command's own line of the server's USAGE (cli.ts), which names every flag parsed here. */
|
|
10
12
|
export async function nativeMain(argv, usage) {
|
|
11
13
|
try {
|
|
12
|
-
const { values, positionals } = parseArgs({ args: argv, allowPositionals: true, options: { project: { type: 'string' }, runtime: { type: 'string' }, agent: { type: 'string' }, profile: { type: 'string' }, url: { type: 'string' }, data: { type: 'string' } } });
|
|
14
|
+
const { values, positionals } = parseArgs({ args: argv, allowPositionals: true, options: { project: { type: 'string' }, runtime: { type: 'string' }, agent: { type: 'string' }, profile: { type: 'string' }, url: { type: 'string' }, data: { type: 'string' }, 'no-sync': { type: 'boolean' } } });
|
|
13
15
|
const operation = positionals[0];
|
|
14
16
|
if (!values.project || !['discover', 'connect'].includes(operation ?? ''))
|
|
15
17
|
throw new Error(usage);
|
|
@@ -35,7 +37,12 @@ export async function nativeMain(argv, usage) {
|
|
|
35
37
|
if (!['localhost', '127.0.0.1', '[::1]'].includes(url.hostname))
|
|
36
38
|
throw new Error('Run AgentRun on this source machine and connect to its loopback URL; hosted native pairing is not available yet.');
|
|
37
39
|
const token = secret('AGENTRUN_API_KEY') || secret('AGENTRUN_TOKEN') || (await readFile(join(data, '.token'), 'utf8')).trim();
|
|
38
|
-
const
|
|
40
|
+
const selection = { project: values.project, runtime: values.runtime, selector: values.agent ? { kind: 'agent', name: values.agent } : values.profile ? { kind: 'profile', name: values.profile } : { kind: 'project' } };
|
|
41
|
+
const env = nativeEnvironment();
|
|
42
|
+
const sourceSync = values['no-sync'] ? undefined : await sourceLocalConsent(await selectedNative(selection, env), env);
|
|
43
|
+
if (sourceSync)
|
|
44
|
+
console.error('Setup sync copies this selected project, instructions, authored skills and assets, supported tools/settings and bounded Git history to AgentRun. Credentials stay here; future source changes keep syncing. Use --no-sync to opt out.');
|
|
45
|
+
const response = await fetch(new URL('/v2/native/connect', url), { method: 'POST', headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json' }, body: JSON.stringify({ ...selection, ...(sourceSync ? { source_sync: sourceSync } : {}) }) });
|
|
39
46
|
const body = await response.json();
|
|
40
47
|
if (!response.ok)
|
|
41
48
|
throw new Error(body.error?.message ?? `Connection failed (${response.status})`);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type AgentEntry } from '../agents-store.js';
|
|
2
|
-
import type { Store } from '../store/store.js';
|
|
2
|
+
import type { Store, SettingsGuard } from '../store/store.js';
|
|
3
3
|
import type { NativeBinding, NativeTarget } from './types.js';
|
|
4
4
|
export declare function selectedNative(input: unknown, env?: NodeJS.ProcessEnv): Promise<NativeTarget>;
|
|
5
5
|
export declare function connectNative(store: Store, input: unknown, env?: NodeJS.ProcessEnv): Promise<AgentEntry>;
|
|
6
|
-
export declare function updateNative(store: Store, entry: AgentEntry, native: NativeBinding): Promise<AgentEntry>;
|
|
6
|
+
export declare function updateNative(store: Store, entry: AgentEntry, native: NativeBinding, settingsGuards?: readonly SettingsGuard[]): Promise<AgentEntry>;
|
|
7
7
|
export declare function verifyConnection(store: Store, entry: AgentEntry, env?: NodeJS.ProcessEnv): Promise<AgentEntry>;
|
|
8
8
|
export declare function launchNative(binding: NativeBinding, env?: NodeJS.ProcessEnv): Promise<NativeBinding>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sourceSyncOf } from "../source-sync/types.js";
|
|
1
2
|
import { nativeEnvironment } from "./environment.js";
|
|
2
3
|
import { basename } from 'node:path';
|
|
3
4
|
import { ApiError, invalid } from '../errors.js';
|
|
@@ -42,7 +43,9 @@ export async function connectNative(store, input, env = nativeEnvironment()) {
|
|
|
42
43
|
throw error;
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
|
-
export async function updateNative(store, entry, native) {
|
|
46
|
+
export async function updateNative(store, entry, native, settingsGuards) {
|
|
47
|
+
if (sourceSyncOf(entry.revision?.body))
|
|
48
|
+
throw new ApiError("input_invalid", "This agent runs in AgentRun. Its source can sync setup, but reconnecting cannot take execution back.");
|
|
46
49
|
const before = definitionOf(entry.agent, entry.revision, entry.version);
|
|
47
50
|
const old = nativeOf(entry.revision?.body), execution = nativeExecutionOverrides(entry.revision?.body);
|
|
48
51
|
// Disconnect must remain possible, retaining these execution restrictions. Reconnect/conversion must never erase
|
|
@@ -59,7 +62,7 @@ export async function updateNative(store, entry, native) {
|
|
|
59
62
|
// on disconnect. Reconnect fills an absent legacy harness; managed conversion adopts the selected source harness.
|
|
60
63
|
const sourceHarness = native.runtime === 'claude-code' ? 'claude-agent' : 'codex';
|
|
61
64
|
const harness = old ? (entry.revision.body.harness ?? (native.connected ? sourceHarness : undefined)) : sourceHarness;
|
|
62
|
-
return commitAgent(store, entry, { definition: { ...definition, ...(harness ? { harness } : {}), native } }, { ifCurrent: entry.revision?.id ?? null });
|
|
65
|
+
return commitAgent(store, entry, { definition: { ...definition, ...(harness ? { harness } : {}), native } }, { ifCurrent: entry.revision?.id ?? null, ...(settingsGuards ? { settingsGuards } : {}) });
|
|
63
66
|
}
|
|
64
67
|
export async function verifyConnection(store, entry, env = nativeEnvironment()) {
|
|
65
68
|
const before = nativeOf(entry.revision?.body);
|
|
@@ -12,6 +12,8 @@ export declare function nativeMetadata(binary: string, args: string[], cwd: stri
|
|
|
12
12
|
stdout: string;
|
|
13
13
|
}>;
|
|
14
14
|
export declare function nativeIdentity(target: Pick<NativeTarget, "runtime" | "project" | "selector" | "machine_id">): string;
|
|
15
|
+
/** The existing native machine identity, shared with explicit source-consent checks before any source scan. */
|
|
16
|
+
export declare function nativeMachineId(): Promise<string>;
|
|
15
17
|
export declare function discoverNative(options: {
|
|
16
18
|
project: string;
|
|
17
19
|
runtime?: NativeRuntime;
|
package/dist/native/discovery.js
CHANGED
|
@@ -69,6 +69,15 @@ export async function nativeMetadata(binary, args, cwd, env, timeoutMs = 5_000)
|
|
|
69
69
|
export function nativeIdentity(target) {
|
|
70
70
|
return hash(JSON.stringify([target.runtime, target.project, target.selector.kind, target.selector.name ?? null, target.machine_id]));
|
|
71
71
|
}
|
|
72
|
+
/** The existing native machine identity, shared with explicit source-consent checks before any source scan. */
|
|
73
|
+
export async function nativeMachineId() {
|
|
74
|
+
let machine = hostname();
|
|
75
|
+
try {
|
|
76
|
+
machine = (await readFile("/etc/machine-id", "utf8")).trim();
|
|
77
|
+
}
|
|
78
|
+
catch { /* hostname fallback */ }
|
|
79
|
+
return hash(machine);
|
|
80
|
+
}
|
|
72
81
|
export async function discoverNative(options) {
|
|
73
82
|
const env = options.env ?? process.env, home = homeOf(env);
|
|
74
83
|
let project;
|
|
@@ -80,12 +89,7 @@ export async function discoverNative(options) {
|
|
|
80
89
|
catch {
|
|
81
90
|
throw new NativeDiscoveryError();
|
|
82
91
|
}
|
|
83
|
-
|
|
84
|
-
try {
|
|
85
|
-
machine = (await readFile("/etc/machine-id", "utf8")).trim();
|
|
86
|
-
}
|
|
87
|
-
catch { /* hostname fallback */ }
|
|
88
|
-
const machine_id = hash(machine), targets = [];
|
|
92
|
+
const machine_id = await nativeMachineId(), targets = [];
|
|
89
93
|
for (const runtime of options.runtime ? [options.runtime] : NATIVE_RUNTIMES) {
|
|
90
94
|
const binary = await nativeExecutable(runtime, env);
|
|
91
95
|
const versionResult = binary ? await nativeMetadata(binary, ["--version"], project, env) : null;
|
|
@@ -10,6 +10,8 @@ import { discoverNative, nativeIdentity, verifyNative } from './discovery.js';
|
|
|
10
10
|
import { nativeEnvironment } from './environment.js';
|
|
11
11
|
import { openNativeSession } from './runtime.js';
|
|
12
12
|
import { snapshotNativeInstructions } from './instructions.js';
|
|
13
|
+
import { exportSourceSnapshot, SourceSnapshotError } from './source-snapshot.js';
|
|
14
|
+
import { homedir } from 'node:os';
|
|
13
15
|
import { exportRemoteHistory } from '../import.js';
|
|
14
16
|
import { runnerSecrets, secretRedactor } from '../runner/redact.js';
|
|
15
17
|
import { redactedOutput } from '../key-refusal.js';
|
|
@@ -70,10 +72,15 @@ export async function runRemoteWorkerBridge(options = {}) {
|
|
|
70
72
|
const output = (value) => {
|
|
71
73
|
// These identities are generated by the connector, not native payload text. Redacting
|
|
72
74
|
// a serialized JSON line can erase them (or its braces) when a payload has a long atom.
|
|
73
|
-
|
|
75
|
+
// Export refuses secret-bearing content before digesting it. A second redaction pass would silently
|
|
76
|
+
// change authored bytes or content hashes; only this typed, local-only export can use its exact result.
|
|
77
|
+
const safe = 'result' in value ? { id: value.id, result: value.exactSnapshot ?? payload(value.result) }
|
|
74
78
|
: 'event' in value ? { session_key: value.session_key, event: payload(value.event) }
|
|
75
|
-
: { ...(value.id === undefined ? {} : { id: value.id }), error: redact(value.error) };
|
|
76
|
-
|
|
79
|
+
: { ...(value.id === undefined ? {} : { id: value.id }), error: redact(value.error), ...(value.code ? { code: value.code } : {}) };
|
|
80
|
+
const line = JSON.stringify(safe) + '\n';
|
|
81
|
+
if ('exactSnapshot' in value && value.exactSnapshot && Buffer.byteLength(line) > 128 * 1024 * 1024)
|
|
82
|
+
throw new SourceSnapshotError('limit', 'The complete source snapshot exceeds its transport limit; nothing was truncated.');
|
|
83
|
+
return process.stdout.write(line);
|
|
77
84
|
};
|
|
78
85
|
const close = async (sessionKey) => {
|
|
79
86
|
const held = sessions.get(sessionKey);
|
|
@@ -115,6 +122,25 @@ export async function runRemoteWorkerBridge(options = {}) {
|
|
|
115
122
|
const payload = message.payload === undefined ? {} : object(message.payload), type = message.type;
|
|
116
123
|
if (type === 'discover')
|
|
117
124
|
return discoverNative({ project: text(payload.project, 4096), ...(payload.runtime ? { runtime: runtime(payload.runtime) } : {}), env });
|
|
125
|
+
if (type === 'source-snapshot') {
|
|
126
|
+
// Only a local connector action can send this type; remote command dispatch never admits it.
|
|
127
|
+
const chosen = targetOf(message.target);
|
|
128
|
+
if (!Array.isArray(payload.authorized_roots) || !payload.authorized_roots.length || payload.authorized_roots.length > 32)
|
|
129
|
+
throw new Error('Source export needs locally approved source roots. Enable sync on the source machine.');
|
|
130
|
+
// Private local IPC, never an accepted network command. The connector holds a scoped credential
|
|
131
|
+
// outside this process's environment; include it in refusal without echoing it or rewriting bytes.
|
|
132
|
+
const held = payload.secret_values === undefined ? [] : payload.secret_values;
|
|
133
|
+
if (!Array.isArray(held) || held.length > 16 || held.some(value => typeof value !== 'string' || !value.length || Buffer.byteLength(value) > 8192)
|
|
134
|
+
|| held.reduce((bytes, value) => bytes + Buffer.byteLength(value), 0) > 64 * 1024)
|
|
135
|
+
throw new Error('Invalid local held-value envelope.');
|
|
136
|
+
const report = await discoverNative({ project: chosen.project, runtime: chosen.runtime, env });
|
|
137
|
+
const found = report.targets.find(target => nativeIdentity(target) === nativeIdentity(chosen));
|
|
138
|
+
if (!found)
|
|
139
|
+
throw new Error('The locally approved source target changed; discover it again.');
|
|
140
|
+
return exportSourceSnapshot({ target: found, authorizedRoots: payload.authorized_roots.map(root => text(root, 4096)),
|
|
141
|
+
home: env.HOME || homedir(), ...(env.CODEX_HOME ? { codexHome: env.CODEX_HOME } : {}),
|
|
142
|
+
...(env.CLAUDE_CONFIG_DIR ? { claudeHome: env.CLAUDE_CONFIG_DIR } : {}), secretValues: [...secrets, ...held], environment: env, signal });
|
|
143
|
+
}
|
|
118
144
|
// Local connector action only: the Python network worker never dispatches these operations.
|
|
119
145
|
if (type === 'history-preview' || type === 'history-export') {
|
|
120
146
|
const target = targetOf(message.target);
|
|
@@ -223,7 +249,13 @@ export async function runRemoteWorkerBridge(options = {}) {
|
|
|
223
249
|
}
|
|
224
250
|
const abort = new AbortController();
|
|
225
251
|
operations.set(id, abort);
|
|
226
|
-
const task = dispatch(message, abort.signal).then(result => { output({ id, result
|
|
252
|
+
const task = dispatch(message, abort.signal).then(result => { output({ id, result, ...(message.type === 'source-snapshot' ? { exactSnapshot: result } : {}) }); })
|
|
253
|
+
.catch(error => { if (message.type === 'source-snapshot') {
|
|
254
|
+
const code = error instanceof SourceSnapshotError ? (error.code === 'limit' ? 'snapshot_too_large' : error.code) : 'source_unavailable';
|
|
255
|
+
output({ id, error: 'The approved source snapshot could not be captured.', code });
|
|
256
|
+
}
|
|
257
|
+
else
|
|
258
|
+
output({ id, error: error instanceof Error ? error.message : 'Native operation failed.' }); }).finally(() => { operations.delete(id); pending.delete(task); });
|
|
227
259
|
pending.add(task);
|
|
228
260
|
}
|
|
229
261
|
await shutdown();
|
package/dist/native/remote.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/** Outbound connector transport. Credentials are scoped to one source; commands use source-approved opaque targets.
|
|
2
|
+
* The ordinary runner owns runs, journals and learning. A leased command is NEVER dispatched again after uncertainty.
|
|
3
|
+
* CAS settings rows keep this contract across API/runner processes and restarts without a second run registry. */
|
|
4
|
+
import type { AdoptionResolver } from "../source-sync/adoption.js";
|
|
5
|
+
import { type SourceAuthority } from "../source-sync/registry.js";
|
|
1
6
|
import { type AgentEntry } from '../agents-store.js';
|
|
2
7
|
import type { Store } from '../store/store.js';
|
|
3
8
|
import type { NativeBinding, NativeEvent, NativeResult, NativeSession } from './types.js';
|
|
@@ -7,6 +12,8 @@ export type RemoteCommandType = 'prepare' | 'open' | 'send' | 'close';
|
|
|
7
12
|
export declare class RemoteConnectors {
|
|
8
13
|
readonly store: Store;
|
|
9
14
|
readonly now: () => number;
|
|
15
|
+
/** One HTTP request's authenticated epoch. Reading its body can await a concurrent owner rotation. */
|
|
16
|
+
private authenticated?;
|
|
10
17
|
constructor(store: Store, now?: () => number);
|
|
11
18
|
private connector;
|
|
12
19
|
private targets;
|
|
@@ -23,12 +30,14 @@ export declare class RemoteConnectors {
|
|
|
23
30
|
observe: boolean;
|
|
24
31
|
native_execution: boolean;
|
|
25
32
|
history_import: boolean;
|
|
33
|
+
config_sync: boolean;
|
|
26
34
|
};
|
|
27
35
|
targets: {
|
|
28
36
|
target_id: string;
|
|
29
37
|
agent_id: string;
|
|
30
38
|
name: string;
|
|
31
39
|
history_only: boolean;
|
|
40
|
+
sync_only: boolean;
|
|
32
41
|
runtime: "codex" | "claude-code";
|
|
33
42
|
machine_id: string;
|
|
34
43
|
state: "ready" | "needs_verification" | "needs_attention";
|
|
@@ -60,12 +69,14 @@ export declare class RemoteConnectors {
|
|
|
60
69
|
observe: boolean;
|
|
61
70
|
native_execution: boolean;
|
|
62
71
|
history_import: boolean;
|
|
72
|
+
config_sync: boolean;
|
|
63
73
|
};
|
|
64
74
|
targets: {
|
|
65
75
|
target_id: string;
|
|
66
76
|
agent_id: string;
|
|
67
77
|
name: string;
|
|
68
78
|
history_only: boolean;
|
|
79
|
+
sync_only: boolean;
|
|
69
80
|
runtime: "codex" | "claude-code";
|
|
70
81
|
machine_id: string;
|
|
71
82
|
state: "ready" | "needs_verification" | "needs_attention";
|
|
@@ -95,12 +106,14 @@ export declare class RemoteConnectors {
|
|
|
95
106
|
observe: boolean;
|
|
96
107
|
native_execution: boolean;
|
|
97
108
|
history_import: boolean;
|
|
109
|
+
config_sync: boolean;
|
|
98
110
|
};
|
|
99
111
|
targets: {
|
|
100
112
|
target_id: string;
|
|
101
113
|
agent_id: string;
|
|
102
114
|
name: string;
|
|
103
115
|
history_only: boolean;
|
|
116
|
+
sync_only: boolean;
|
|
104
117
|
runtime: "codex" | "claude-code";
|
|
105
118
|
machine_id: string;
|
|
106
119
|
state: "ready" | "needs_verification" | "needs_attention";
|
|
@@ -117,10 +130,14 @@ export declare class RemoteConnectors {
|
|
|
117
130
|
}>;
|
|
118
131
|
assertReady(binding: NativeBinding): Promise<void>;
|
|
119
132
|
status(binding: NativeBinding): Promise<NativeBinding>;
|
|
120
|
-
importTarget(id: string, input: unknown): Promise<{
|
|
133
|
+
importTarget(id: string, input: unknown, resolveAdoption?: AdoptionResolver): Promise<{
|
|
121
134
|
agent_id: string;
|
|
122
135
|
native: NativeBinding;
|
|
123
136
|
}>;
|
|
137
|
+
syncAuthority(id: string, targetId: string): Promise<{
|
|
138
|
+
agentId: string;
|
|
139
|
+
authority: SourceAuthority;
|
|
140
|
+
}>;
|
|
124
141
|
disconnectTarget(binding: NativeBinding): Promise<void>;
|
|
125
142
|
importHistory(id: string, targetId: string, input: unknown, own?: readonly string[]): Promise<{
|
|
126
143
|
agent_id: string;
|