@parcha/agentrun-serve 0.1.0-beta.56 → 0.1.0-beta.58
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 +281 -0
- package/README.md +246 -66
- package/dist/acp-package.d.ts +2 -0
- package/dist/adapters.d.ts +15 -3
- package/dist/adapters.js +17 -6
- package/dist/agent-package.d.ts +3 -3
- package/dist/agent-package.js +17 -8
- package/dist/api-keys.d.ts +76 -0
- package/dist/api-keys.js +217 -0
- package/dist/api-only.d.ts +15 -5
- package/dist/api-only.js +32 -8
- package/dist/box-paths.d.ts +4 -3
- package/dist/box-paths.js +7 -4
- package/dist/browser-hold.d.ts +23 -0
- package/dist/browser-hold.js +48 -0
- package/dist/browser-person.d.ts +3 -0
- package/dist/browser-person.js +4 -1
- package/dist/chatgpt-plan.d.ts +18 -8
- package/dist/chatgpt-plan.js +91 -34
- package/dist/claude-login-token.d.ts +117 -0
- package/dist/claude-login-token.js +737 -0
- package/dist/claude-login.d.ts +120 -22
- package/dist/claude-login.js +347 -63
- package/dist/claude-sign-in.d.ts +17 -6
- package/dist/claude-sign-in.js +42 -39
- package/dist/cli.js +33 -10
- package/dist/composio-made.d.ts +4 -0
- package/dist/composio-made.js +4 -0
- package/dist/composio-preset.d.ts +43 -2
- package/dist/composio-preset.js +92 -4
- package/dist/computer-attach.d.ts +35 -17
- package/dist/computer-attach.js +301 -49
- package/dist/computer-held-routes.d.ts +5 -4
- package/dist/computer-held-routes.js +29 -8
- package/dist/computer-held.d.ts +6 -1
- package/dist/computer-held.js +14 -0
- package/dist/computer-record.js +4 -2
- package/dist/computer-viewer.js +4 -1
- package/dist/computers.d.ts +10 -10
- package/dist/computers.js +5 -5
- package/dist/console/assets/{backend-Boh7tC4i.js → backend-CSAWUqtZ.js} +19 -19
- package/dist/console/assets/index-Bwn1oTem.css +1 -0
- package/dist/console/assets/index-DPh29cyz.js +747 -0
- package/dist/console/index.html +2 -2
- package/dist/decisions.d.ts +1 -1
- package/dist/decisions.js +1 -1
- package/dist/dial-relay.d.ts +25 -4
- package/dist/dial-relay.js +129 -1
- package/dist/docker-host-addresses.d.ts +22 -11
- package/dist/docker-host-addresses.js +38 -26
- package/dist/env-switch.d.ts +8 -0
- package/dist/env-switch.js +31 -2
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +2 -0
- package/dist/fal-price.d.ts +56 -20
- package/dist/fal-price.js +400 -90
- package/dist/handed-values.d.ts +43 -1
- package/dist/handed-values.js +119 -2
- package/dist/harness-archive.d.ts +13 -10
- package/dist/harness-archive.js +60 -34
- package/dist/harness-check.d.ts +3 -1
- package/dist/harness-check.js +25 -46
- package/dist/harness-keys.d.ts +73 -27
- package/dist/harness-keys.js +194 -61
- package/dist/harness-recipe-entry.d.ts +8 -7
- package/dist/harness-recipe-entry.js +21 -32
- package/dist/harness-recipe.d.ts +38 -25
- package/dist/harness-recipe.js +49 -36
- package/dist/harness-sign-in.js +12 -23
- package/dist/harness-table.d.ts +10 -3
- package/dist/harness-table.js +26 -21
- package/dist/harness.d.ts +1 -0
- package/dist/harness.js +17 -5
- package/dist/hosted-search.d.ts +1 -1
- package/dist/hosted-search.js +1 -2
- package/dist/import-worker.d.ts +4 -2
- package/dist/import-worker.js +9 -2
- package/dist/in-flight.d.ts +26 -0
- package/dist/in-flight.js +52 -0
- package/dist/key-refusal.d.ts +9 -4
- package/dist/key-refusal.js +107 -25
- package/dist/learn/ledger.d.ts +170 -0
- package/dist/learn/ledger.js +218 -0
- package/dist/learn/promote.d.ts +3 -3
- package/dist/learn/promote.js +1 -1
- package/dist/learn/secrets.d.ts +13 -3
- package/dist/learn/secrets.js +118 -17
- package/dist/learning-cost.d.ts +28 -23
- package/dist/learning-cost.js +19 -23
- package/dist/link-check.js +1 -1
- package/dist/live-reach.d.ts +2 -0
- package/dist/live-reach.js +2 -0
- package/dist/llms.txt +1 -1
- package/dist/marketplace.d.ts +77 -0
- package/dist/marketplace.js +224 -0
- package/dist/mcp-api-only-origins.d.ts +35 -0
- package/dist/mcp-api-only-origins.js +57 -0
- package/dist/mcp-gateway.d.ts +7 -5
- package/dist/mcp-gateway.js +9 -12
- package/dist/mcp-secret-writes.js +5 -3
- package/dist/mcp-servers-store.d.ts +28 -6
- package/dist/mcp-servers-store.js +53 -4
- package/dist/media-duration.d.ts +3 -0
- package/dist/media-duration.js +90 -9
- package/dist/micro.d.ts +2 -0
- package/dist/micro.js +2 -0
- package/dist/model-form.d.ts +5 -4
- package/dist/model-form.js +11 -7
- package/dist/model.d.ts +10 -6
- package/dist/model.js +16 -11
- package/dist/monid.d.ts +14 -1
- package/dist/monid.js +103 -26
- package/dist/ollama-provider.d.ts +7 -1
- package/dist/ollama-provider.js +14 -2
- package/dist/openapi.js +210 -37
- package/dist/otel/genai.d.ts +65 -0
- package/dist/otel/genai.js +116 -0
- package/dist/otel/tracer.d.ts +55 -0
- package/dist/otel/tracer.js +308 -0
- package/dist/page.d.ts +2 -0
- package/dist/page.js +3 -1
- package/dist/paid-calls.d.ts +1 -32
- package/dist/paid-calls.js +4 -39
- package/dist/place-offers.d.ts +4 -0
- package/dist/place-offers.js +7 -4
- package/dist/provider.d.ts +11 -2
- package/dist/provider.js +59 -8
- package/dist/redact/match.d.ts +30 -3
- package/dist/redact/match.js +422 -41
- package/dist/refusal-words.d.ts +11 -0
- package/dist/refusal-words.js +11 -0
- package/dist/run-census.d.ts +67 -0
- package/dist/run-census.js +240 -0
- package/dist/run-computer.d.ts +6 -3
- package/dist/run-computer.js +4 -1
- package/dist/run-cut.d.ts +15 -6
- package/dist/run-cut.js +30 -9
- package/dist/run-files.d.ts +3 -0
- package/dist/run-files.js +3 -0
- package/dist/run-launch.d.ts +12 -1
- package/dist/run-launch.js +9 -10
- package/dist/run-learning-served.d.ts +4 -2
- package/dist/run-model-key.d.ts +8 -0
- package/dist/run-model-key.js +31 -1
- package/dist/run-reads-over-store.d.ts +24 -6
- package/dist/run-reads-over-store.js +67 -23
- package/dist/run-recordings.d.ts +5 -1
- package/dist/run-recordings.js +39 -14
- package/dist/run-timeline-served.d.ts +2 -0
- package/dist/run-timeline-served.js +2 -2
- package/dist/run-usage.d.ts +1 -0
- package/dist/run-view.d.ts +1 -2
- package/dist/run-view.js +2 -1
- package/dist/runnable.d.ts +10 -1
- package/dist/runnable.js +20 -8
- package/dist/runner/adapter-loop.d.ts +11 -0
- package/dist/runner/adapter-loop.js +58 -26
- package/dist/runner/adapter-run-spec.d.ts +55 -11
- package/dist/runner/adapter-run-spec.js +183 -52
- package/dist/runner/adapters/pi.js +25 -3
- package/dist/runner/beside.d.ts +9 -2
- package/dist/runner/beside.js +27 -9
- package/dist/runner/big-writes.js +1 -10
- package/dist/runner/claim-secrets.d.ts +27 -10
- package/dist/runner/claim-secrets.js +49 -22
- package/dist/runner/cli-run-spec.d.ts +6 -0
- package/dist/runner/cli-run-spec.js +97 -38
- package/dist/runner/computer-journal.d.ts +9 -1
- package/dist/runner/computer-journal.js +26 -0
- package/dist/runner/conformance/harness.js +1 -1
- package/dist/runner/feedback-round.js +3 -0
- package/dist/runner/harness-loops.d.ts +6 -5
- package/dist/runner/harness-loops.js +7 -7
- package/dist/runner/held.d.ts +24 -6
- package/dist/runner/journal-kinds.d.ts +5 -0
- package/dist/runner/journal-kinds.js +5 -0
- package/dist/runner/main.d.ts +11 -6
- package/dist/runner/main.js +19 -9
- package/dist/runner/mcp-claim.js +31 -3
- package/dist/runner/mcp-run.d.ts +9 -0
- package/dist/runner/mcp-run.js +11 -5
- package/dist/runner/model-route.d.ts +17 -0
- package/dist/runner/model-route.js +120 -2
- package/dist/runner/presence.d.ts +11 -1
- package/dist/runner/presence.js +7 -0
- package/dist/runner/reflect-hook.js +1 -1
- package/dist/runner/run-child-host.d.ts +22 -8
- package/dist/runner/run-child-host.js +128 -41
- package/dist/runner/run-child.js +5 -2
- package/dist/runner/runner.d.ts +17 -3
- package/dist/runner/runner.js +130 -34
- package/dist/runner/save-slots.js +2 -1
- package/dist/runner/store-port.d.ts +1 -1
- package/dist/runner/store-secrets.d.ts +6 -0
- package/dist/runner/store-secrets.js +49 -7
- package/dist/runner/subagent.d.ts +11 -0
- package/dist/runner/subagent.js +16 -38
- package/dist/runner/workflow-first.d.ts +35 -15
- package/dist/runner/workflow-first.js +38 -25
- package/dist/runner/workflow-spec.js +4 -3
- package/dist/runs-over-store.d.ts +15 -6
- package/dist/runs-over-store.js +33 -21
- package/dist/scrub-command.d.ts +73 -0
- package/dist/scrub-command.js +307 -0
- package/dist/secret-cut.d.ts +73 -0
- package/dist/secret-cut.js +291 -4
- package/dist/secret-rules.d.ts +143 -0
- package/dist/secret-rules.js +2564 -0
- package/dist/secrets.d.ts +7 -0
- package/dist/secrets.js +20 -0
- package/dist/server-keys.d.ts +20 -0
- package/dist/server-keys.js +25 -6
- package/dist/server.d.ts +65 -13
- package/dist/server.js +470 -157
- package/dist/skills/agentrun-serve/SKILL.md +4 -0
- package/dist/slots.d.ts +9 -0
- package/dist/slots.js +45 -0
- package/dist/store/index.d.ts +1 -1
- package/dist/store/index.js +1 -1
- package/dist/store/journal/storage.js +1 -1
- package/dist/store/postgres/migrations/0027_run_launch_census.sql +31 -0
- package/dist/store/postgres/migrations/0028_learning_ledger.sql +44 -0
- package/dist/store/schema.d.ts +23 -0
- package/dist/store/schema.js +58 -2
- package/dist/store/seal.d.ts +6 -1
- package/dist/store/seal.js +5 -3
- package/dist/store/sqlite/run-launch.d.ts +9 -1
- package/dist/store/sqlite/run-launch.js +24 -13
- package/dist/store/sqlite/run-patch.d.ts +12 -2
- package/dist/store/sqlite/run-patch.js +42 -5
- package/dist/store/sqlite/store.js +105 -12
- package/dist/store/store.d.ts +57 -2
- package/dist/store/store.js +20 -0
- package/dist/store-reads/learning.d.ts +84 -124
- package/dist/store-reads/learning.js +210 -274
- package/dist/store-view.d.ts +3 -0
- package/dist/store-view.js +3 -3
- package/dist/suggestions.js +3 -2
- package/dist/template-eval.d.ts +39 -9
- package/dist/template-eval.js +191 -60
- package/dist/template-import.js +6 -2
- package/dist/templates.d.ts +10 -2
- package/dist/templates.js +28 -8
- package/dist/timeline/labels.d.ts +6 -4
- package/dist/timeline/labels.js +18 -6
- package/dist/timeline/timeline.d.ts +5 -0
- package/dist/timeline/timeline.js +14 -8
- package/dist/timeline/util.js +1 -1
- package/dist/timeline/web-calls.d.ts +22 -7
- package/dist/timeline/web-calls.js +106 -35
- package/dist/tool-gate.d.ts +42 -3
- package/dist/tool-gate.js +66 -5
- package/dist/tool-keys-store.d.ts +2 -4
- package/dist/tool-keys-store.js +5 -21
- package/dist/tool-keys.d.ts +2 -2
- package/dist/tool-keys.js +2 -2
- package/dist/tool-list.js +1 -1
- package/dist/tool-plane.d.ts +2 -2
- package/dist/tool-plane.js +35 -33
- package/dist/tools.js +13 -7
- package/dist/trigger-targets.d.ts +4 -0
- package/dist/trigger-targets.js +9 -2
- package/dist/triggers.d.ts +67 -4
- package/dist/triggers.js +171 -22
- package/dist/until.d.ts +3 -0
- package/dist/until.js +11 -0
- package/dist/web-fake.d.ts +1 -3
- package/dist/web-fake.js +7 -18
- package/dist/web-fetch.d.ts +6 -72
- package/dist/web-fetch.js +11 -265
- package/dist/web-run.d.ts +31 -0
- package/dist/web-run.js +90 -0
- package/dist/web-save.d.ts +10 -13
- package/dist/web-save.js +13 -55
- package/dist/web-search.d.ts +9 -127
- package/dist/web-search.js +23 -259
- package/dist/wires.d.ts +13 -0
- package/dist/wires.js +11 -0
- package/dist/workflow-run.d.ts +5 -4
- package/dist/workflow-run.js +5 -4
- package/dist/workspace/attached-computers.d.ts +32 -9
- package/dist/workspace/attached-computers.js +77 -13
- package/dist/workspace/computer-deps.d.ts +8 -2
- package/dist/workspace/computer-deps.js +10 -3
- package/dist/workspace/computer-for-claim.d.ts +12 -1
- package/dist/workspace/computer-for-claim.js +83 -11
- package/dist/workspace/computer-kept.d.ts +3 -0
- package/dist/workspace/computer-kept.js +11 -2
- package/dist/workspace/index.d.ts +1 -1
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/kind-skills.d.ts +4 -0
- package/dist/workspace/kind-skills.js +9 -0
- package/dist/workspace/paired-route.d.ts +91 -0
- package/dist/workspace/paired-route.js +153 -0
- package/dist/workspace/synced-folder.js +3 -4
- package/dist/wrapped.d.ts +20 -6
- package/dist/wrapped.js +66 -25
- package/package.json +17 -11
- package/skills/agentrun-serve/SKILL.md +4 -0
- package/templates/README.md +32 -10
- package/dist/console/assets/index-CQ3cJRzI.js +0 -746
- package/dist/console/assets/index-DKkaS3a0.css +0 -1
- package/dist/exa-keyless.d.ts +0 -34
- package/dist/exa-keyless.js +0 -118
- package/dist/firecrawl-keyless.d.ts +0 -41
- package/dist/firecrawl-keyless.js +0 -152
- package/dist/keyless-mcp.d.ts +0 -36
- package/dist/keyless-mcp.js +0 -127
- package/dist/text-urls.d.ts +0 -38
- package/dist/text-urls.js +0 -170
- package/dist/web-fetch-direct.d.ts +0 -119
- package/dist/web-fetch-direct.js +0 -190
package/dist/claude-login.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ClaudeAgentLogin, ClaudeLoginStatus } from "@parcha/agentrun-harness-claude";
|
|
1
|
+
import type { ClaudeAgentLogin, ClaudeLoginStatus, ClaudeLoginToken } from "@parcha/agentrun-harness-claude";
|
|
2
2
|
import type { ClaudeSignIns, SignInView } from "./claude-sign-in.js";
|
|
3
3
|
import type { Settings } from "./store/index.js";
|
|
4
4
|
/** The switch: `off` (or 0, false, no) turns the mode off on this server, `on` (or 1, true, yes) leaves it there past
|
|
@@ -17,48 +17,98 @@ export declare const LOGIN_HARNESS: string;
|
|
|
17
17
|
export declare const CLAUDE_LOGIN_PROVIDER = "claude-login";
|
|
18
18
|
/** The model a run on the login gets when it names none. */
|
|
19
19
|
export declare const LOGIN_DEFAULT_MODEL = "anthropic/claude-sonnet-5-5";
|
|
20
|
+
/** Whether a run of the login's harness that names `model` goes on the login: one naming none (it gets
|
|
21
|
+
* LOGIN_DEFAULT_MODEL, Anthropic's) or one of Anthropic's own (`anthropic/<id>`). Any other, Anthropic's through
|
|
22
|
+
* OpenRouter (`openrouter/anthropic/<id>`) included, goes on its provider's key whatever the login says. providerFor
|
|
23
|
+
* puts a run on the login by this rule, and loginOnRunnerOnly offers the move to the runner by it. The console reads no
|
|
24
|
+
* server code: its lib/claudeLogin.ts loginServes copies this, and both tests name the same cases. */
|
|
25
|
+
export declare const loginServes: (model: string | undefined) => boolean;
|
|
20
26
|
/** Where the login is: AgentRun's own directory in its data (`agentrun`, the default), or this machine's own Claude Code
|
|
21
27
|
* login (`machine`, which the owner opts into by name). */
|
|
22
28
|
export declare const LOGIN_PLACES: readonly ["agentrun", "machine"];
|
|
23
29
|
export type LoginPlace = (typeof LOGIN_PLACES)[number];
|
|
30
|
+
/** `machine`: the id of the machine it was turned on for (machineId). A row saved before the id has none, and reads as
|
|
31
|
+
* turned on for another machine until turned on again. */
|
|
24
32
|
type Setting = {
|
|
25
33
|
v: 1;
|
|
26
34
|
place: LoginPlace;
|
|
27
|
-
|
|
35
|
+
machine?: string;
|
|
28
36
|
only_me: true;
|
|
29
37
|
};
|
|
38
|
+
/** The file in the data folder that holds this machine's id (machineId). */
|
|
39
|
+
export declare const MACHINE_ID_FILE = "machine-id";
|
|
40
|
+
/** This machine's id, which names the machine the login was turned on for: a random one, made once in
|
|
41
|
+
* `<data>/machine-id` (0600) and read back by every later start. Never the hostname, which moves with the network (a
|
|
42
|
+
* laptop's at home is not its name at the office), while the data folder stays. A missing file, or one that holds no
|
|
43
|
+
* id or can't be read, gets a fresh id, so a setting saved under the old one reads as another machine's until turned on
|
|
44
|
+
* again. The file appears whole: written aside, then linked in place, so a start beside this one that made an id first
|
|
45
|
+
* keeps its own, and both read that one. */
|
|
46
|
+
export declare function machineId(data: string): string;
|
|
30
47
|
/** This machine's own Claude Code login folder as the CLI finds it for the server's user, by the CLI's own rule: its
|
|
31
48
|
* config dir is `CLAUDE_CONFIG_DIR` when set, else `~/.claude`, and its credentials are kept there too unless
|
|
32
49
|
* `CLAUDE_SECURESTORAGE_CONFIG_DIR` says otherwise. Read from the server's env, so a Claude Code started with another
|
|
33
50
|
* `CLAUDE_CONFIG_DIR` is found only when AgentRun was started with it as well. A relative one is not taken: the CLI would
|
|
34
|
-
* read it against a working directory this server does not share. `source` says which rule gave the folder.
|
|
51
|
+
* read it against a working directory this server does not share. `source` says which rule gave the folder.
|
|
52
|
+
* `credentials`: the server's `CLAUDE_SECURESTORAGE_CONFIG_DIR` when it sets one the CLI takes as it is (an absolute
|
|
53
|
+
* path, or empty: `~/.claude`, and on macOS the Keychain item with no suffix), where the CLI keeps the tokens apart
|
|
54
|
+
* from the folder; a relative one is not taken, as above. */
|
|
35
55
|
export declare function machineFolder(env?: Readonly<Record<string, string | undefined>>): {
|
|
36
56
|
folder: string;
|
|
37
57
|
source: "CLAUDE_CONFIG_DIR" | "default";
|
|
58
|
+
credentials?: string;
|
|
59
|
+
};
|
|
60
|
+
/** The person's home: the home of the user this server runs as (`uid`, its effective uid), whose files the login's CLI
|
|
61
|
+
* writes. The env's `HOME` when it is an absolute path to a folder that user owns, else that user's own home as the
|
|
62
|
+
* system has it (`os.userInfo()`), when it owns that. So a server under a sudo that keeps `HOME` (root, with the
|
|
63
|
+
* person's) keeps its login in root's home, never root-owned files in the person's, and a service account that
|
|
64
|
+
* inherited someone's `HOME` reads its own. Neither: `refused` says why in words, and `home` is only what the view
|
|
65
|
+
* shows (nothing is written there). Where there is no uid (Windows), the env's `HOME` when absolute, else
|
|
66
|
+
* `os.homedir()`. */
|
|
67
|
+
export declare function homeOf(env: Readonly<Record<string, string | undefined>>, uid?: number | undefined): {
|
|
68
|
+
home: string;
|
|
69
|
+
refused?: string;
|
|
38
70
|
};
|
|
39
71
|
/** The directories of a login at `place`: AgentRun's in `data`, or this machine's (machineFolder, and the Anthropic
|
|
40
72
|
* profiles where the CLI looks for them: `ANTHROPIC_CONFIG_DIR`, else `$XDG_CONFIG_HOME/anthropic`, else
|
|
41
73
|
* `~/.config/anthropic`). This machine's on the CLI's default folder carries the person's home too, so the harness
|
|
42
74
|
* points the CLI at it as their own CLI runs, with no folder variable (the harness's signInEnv and loginEnv). This
|
|
43
|
-
* machine's
|
|
44
|
-
* (the
|
|
75
|
+
* machine's with a credentials dir in the server's env (machineFolder's `credentials`) carries it as `secure`, absolute
|
|
76
|
+
* (empty: `~/.claude`, `unsuffixed`), so the CLI keeps the tokens where the person's own CLI with it does. A status
|
|
77
|
+
* check at either place runs on a copy of the account file (the harness's claudeLoginStatus). Every login carries the
|
|
78
|
+
* person's home as `userHome`, read here once (homeOf), so the status check, the sign-in and a run on macOS all run in
|
|
79
|
+
* that one home whatever reads it later (the harness's personHome). */
|
|
45
80
|
export declare function loginAt(place: LoginPlace, data: string, env?: Readonly<Record<string, string | undefined>>): ClaudeAgentLogin;
|
|
46
81
|
/** The setting as saved, or undefined when the mode is not on (or the row is not one this reads). */
|
|
47
82
|
export declare function claudeLoginSetting(settings: Pick<Settings, "get">): Promise<Setting | undefined>;
|
|
48
|
-
/** The login a run here goes on: the setting's, when the switch is not off
|
|
83
|
+
/** The login a run here goes on: the setting's, when the switch is not off, this is the machine it was turned on for,
|
|
84
|
+
* and the server's user owns a home for it (homeOf). */
|
|
49
85
|
export declare function loginOf(setting: Setting | undefined, data: string, env: Readonly<Record<string, string | undefined>>): ClaudeAgentLogin | undefined;
|
|
86
|
+
/** A login as a run holds it: its two directories, or, in a run's own process under a user of its own, its runner's
|
|
87
|
+
* reader of its access token (held.ts claudeLogin). */
|
|
88
|
+
export type RunLogin = ClaudeAgentLogin | ClaudeLoginToken;
|
|
89
|
+
/** Whether `login` is a reader of its access token, not its directories. */
|
|
90
|
+
export declare const loginByToken: (login: RunLogin) => login is ClaudeLoginToken;
|
|
50
91
|
/** `env` carrying `login` (none: carrying none), as an enumerable symbol property: a spread keeps it, a spawn never sees
|
|
51
|
-
* it (it is no variable), and it holds
|
|
52
|
-
export declare function withClaudeLogin<T extends object>(env: T, login:
|
|
92
|
+
* it (it is no variable), and it holds two directory names or a token reader, never a token. */
|
|
93
|
+
export declare function withClaudeLogin<T extends object>(env: T, login: RunLogin | undefined): T;
|
|
53
94
|
/** `env` as a run at `place` reads it: a runner place keeps the login; any other place (a sandbox) gets a copy without it,
|
|
54
95
|
* so a revision's checks there ask for a key, as its run will. */
|
|
55
96
|
export declare function envAtPlace<T extends object>(env: T, place: {
|
|
56
97
|
readonly mode: string;
|
|
57
98
|
} | undefined): T;
|
|
58
99
|
/** The login `env` carries, unless the switch is off. */
|
|
59
|
-
export declare function claudeLoginOf(env: NodeJS.ProcessEnv):
|
|
100
|
+
export declare function claudeLoginOf(env: NodeJS.ProcessEnv): RunLogin | undefined;
|
|
60
101
|
/** Whether `harness` runs on the login `env` carries. */
|
|
61
102
|
export declare const onClaudeLogin: (env: NodeJS.ProcessEnv, harness: string) => boolean;
|
|
103
|
+
/** For a run refused for its model: the words that say why the login `env` carries does not run it, when its harness
|
|
104
|
+
* runs on that login, the login would run its `model` (loginServes: Anthropic's own, or none), and its place is a box
|
|
105
|
+
* (the login is a model only on the runner, loginForRun), naming the box and the move that runs it there; else
|
|
106
|
+
* undefined. A model the login never runs (an OpenRouter one) still needs its key after a move, so none is offered. The
|
|
107
|
+
* login's state is not asked: a signed-out one fails a run on the runner in its own words. */
|
|
108
|
+
export declare function loginOnRunnerOnly(env: NodeJS.ProcessEnv, harness: string | undefined, model: string | undefined, place: {
|
|
109
|
+
readonly mode: string;
|
|
110
|
+
readonly box?: string;
|
|
111
|
+
} | undefined): string | undefined;
|
|
62
112
|
/** The CLI that answers for a login: the pinned one this server installed for claude-agent (`pinned`), else a `claude` on
|
|
63
113
|
* PATH, else none. */
|
|
64
114
|
export declare function loginCli(pinned: string | undefined, env: Readonly<Record<string, string | undefined>>): string | undefined;
|
|
@@ -69,7 +119,11 @@ export declare const LOGIN_UNKNOWN = "Claude Code could not say whether its logi
|
|
|
69
119
|
export declare function whyNotOneOwner(facts: {
|
|
70
120
|
apiOnly: boolean;
|
|
71
121
|
tokens: number;
|
|
122
|
+
keys?: number;
|
|
123
|
+
keysDormant?: boolean;
|
|
72
124
|
}): string | undefined;
|
|
125
|
+
/** Why a server with Claude Code's login on makes no API key for an app, in one line: the same rule from the other side. */
|
|
126
|
+
export declare const LOGIN_REFUSES_API_KEYS = "Claude Code's login on this machine is on, and a Claude plan is one person's: an API key would let an app start runs on it. Turn the login off under Settings \u2192 Model keys first.";
|
|
73
127
|
/** GET /settings/claude-login. `state`: `off` (not turned on), `other_machine` (turned on for another machine), else
|
|
74
128
|
* what the CLI says: `signed_in`, `signed_out`, or `no_cli` (no CLI here to ask yet: claude-agent's first run installs
|
|
75
129
|
* the pinned one), `unknown` (it gave no answer). Never a token: an account's email, organization and plan only when
|
|
@@ -91,10 +145,12 @@ export type ClaudeLoginView = {
|
|
|
91
145
|
};
|
|
92
146
|
/** The folder whose login the CLI is asked about: the login's directory at `place`. */
|
|
93
147
|
folder: string;
|
|
94
|
-
/** This machine's own Claude Code login as this server finds it (machineFolder)
|
|
148
|
+
/** This machine's own Claude Code login as this server finds it (machineFolder), with `credentials` where the server's
|
|
149
|
+
* env sets `CLAUDE_SECURESTORAGE_CONFIG_DIR` (empty included). */
|
|
95
150
|
machine: {
|
|
96
151
|
folder: string;
|
|
97
152
|
source: "CLAUDE_CONFIG_DIR" | "default";
|
|
153
|
+
credentials?: string;
|
|
98
154
|
};
|
|
99
155
|
/** The CLI's sign-in this server started, while this server runs (claude-sign-in.ts). */
|
|
100
156
|
sign_in?: SignInView;
|
|
@@ -107,8 +163,8 @@ export declare function turnOnBody(body: unknown): {
|
|
|
107
163
|
} | {
|
|
108
164
|
problem: string;
|
|
109
165
|
};
|
|
110
|
-
/** The setting a turn-on saves, for this machine. AgentRun's own login directory is made (0700) so the CLI
|
|
111
|
-
* login there; nothing in it is read. */
|
|
166
|
+
/** The setting a turn-on saves, for this machine (machineId). AgentRun's own login directory is made (0700) so the CLI
|
|
167
|
+
* can keep its login there; nothing in it is read. */
|
|
112
168
|
export declare function settingFor(place: LoginPlace, data: string): Setting;
|
|
113
169
|
/** The login a run of `harness` on this runner goes on: the saved setting's, read now, when the switch is not off, the
|
|
114
170
|
* harness runs on it, the run is in a runner place (`place`), and this is the machine it was turned on for; else none,
|
|
@@ -122,19 +178,42 @@ export declare const claudeLoginRouteOff: (name: string, why: string) => string;
|
|
|
122
178
|
/** What the routes need of the server. `pinned`: the pinned CLI's path when installed. `refused`: whyNotOneOwner of this
|
|
123
179
|
* server. `sameMachine`: the request comes from a browser on this machine to a server bound to loopback with no public
|
|
124
180
|
* address, so a sign-in the CLI opens in a browser here reaches the person. `status`/`start`: the harness's
|
|
125
|
-
* claudeLoginStatus and startClaudeLogin. `
|
|
126
|
-
*
|
|
181
|
+
* claudeLoginStatus and startClaudeLogin. `saved`: the login runs here go on after a turn on or off (none once off),
|
|
182
|
+
* handed over inside the turn that saved it, so two changes never leave the server's copy out of order. `changed`: env
|
|
183
|
+
* read again after that turn, outside the queue, so a sign-in pressed meanwhile never waits on it. `signIns`: the
|
|
184
|
+
* sign-in this server started, one per server process (claude-sign-in.ts). */
|
|
127
185
|
export type ClaudeLoginDeps = {
|
|
128
186
|
signIns: ClaudeSignIns;
|
|
129
187
|
settings: Pick<Settings, "get" | "put" | "remove">;
|
|
130
188
|
data: string;
|
|
131
189
|
env: Readonly<Record<string, string | undefined>>;
|
|
132
190
|
pinned: () => Promise<string | undefined>;
|
|
133
|
-
|
|
191
|
+
/** Why this server may not turn the mode on now, asked each time and never held: the server's API keys are made and
|
|
192
|
+
* revoked while it runs (whyNotOneOwner counts them). */
|
|
193
|
+
refused: () => string | undefined;
|
|
194
|
+
/** Runs `work` once nothing that changes `refused` is under way, and holds such changes off until it settles: the
|
|
195
|
+
* API keys' turn (api-keys.ts inTurn). The turn-on decides and writes inside it. */
|
|
196
|
+
turn: <T>(work: () => Promise<T>) => Promise<T>;
|
|
134
197
|
sameMachine: boolean;
|
|
135
198
|
claude: () => Promise<ClaudeLoginCli>;
|
|
199
|
+
saved: (login: ClaudeAgentLogin | undefined) => void;
|
|
136
200
|
changed: () => Promise<void>;
|
|
201
|
+
/** The user this server runs as, whose home the login needs (homeOf): its effective uid unless given. */
|
|
202
|
+
uid?: number;
|
|
203
|
+
};
|
|
204
|
+
/** A server's API keys as the login needs them (api-keys.ts ApiKeys): how many there are now, and their turn. */
|
|
205
|
+
export type KeysForLogin = {
|
|
206
|
+
readonly count: number;
|
|
207
|
+
inTurn<T>(work: () => Promise<T>): Promise<T>;
|
|
137
208
|
};
|
|
209
|
+
/** What the one-owner rule gives the login's routes over a server's keys: `refused`, which counts the keys each time
|
|
210
|
+
* it is asked, and `turn`, the keys' own. The server's routes take both from here, and so does the test that runs the
|
|
211
|
+
* turn-on against a held revocation: neither is a value read once, or a turn of its own. */
|
|
212
|
+
export declare const oneOwnerDeps: (facts: {
|
|
213
|
+
apiOnly: boolean;
|
|
214
|
+
tokens: number;
|
|
215
|
+
keysDormant?: boolean;
|
|
216
|
+
}, keys: KeysForLogin) => Pick<ClaudeLoginDeps, "refused" | "turn">;
|
|
138
217
|
/** A route's refusal in words, answered as its `code` (server.ts makes it an ApiError). */
|
|
139
218
|
export declare class ClaudeLoginRefused extends Error {
|
|
140
219
|
readonly code: "forbidden" | "input_invalid" | "agent_not_runnable";
|
|
@@ -142,7 +221,9 @@ export declare class ClaudeLoginRefused extends Error {
|
|
|
142
221
|
}
|
|
143
222
|
/** GET /settings/claude-login: the mode's state and, when on, what the CLI says of its login. */
|
|
144
223
|
export declare function claudeLoginView(deps: ClaudeLoginDeps): Promise<ClaudeLoginView>;
|
|
145
|
-
/** PUT /settings/claude-login: turned on, refused in one line where more than one person can start runs.
|
|
224
|
+
/** PUT /settings/claude-login: turned on, refused in one line where more than one person can start runs. A turn-on that
|
|
225
|
+
* moves the login to another place first ends a sign-in this server started that still waits: its CLI signs in at the
|
|
226
|
+
* old place, which the login no longer reads. One at the same place leaves it waiting, as it still signs in there. */
|
|
146
227
|
export declare function turnOnClaudeLogin(deps: ClaudeLoginDeps, body: unknown): Promise<ClaudeLoginView>;
|
|
147
228
|
/** DELETE /settings/claude-login: turned off, and a sign-in this server started that still waits is ended. The login
|
|
148
229
|
* itself stays as the CLI keeps it; nothing here signs it out. */
|
|
@@ -150,16 +231,33 @@ export declare function turnOffClaudeLogin(deps: ClaudeLoginDeps): Promise<Claud
|
|
|
150
231
|
/** POST /settings/claude-login/login: the CLI's own sign-in, started on this machine, where it opens a browser, with the
|
|
151
232
|
* shown line's own variables (the harness's signInEnv), so it signs in where the status reads. A sign-in that
|
|
152
233
|
* still waits is ended first (deps.signIns). The browser code goes to the CLI, never here; the answer is the view as it
|
|
153
|
-
* is when the sign-in starts, its `sign_in` waiting. */
|
|
234
|
+
* is when the sign-in starts, its `sign_in` waiting. The setting is read, and the CLI started on it, in one turn. */
|
|
154
235
|
export declare function startLoginHere(deps: ClaudeLoginDeps): Promise<ClaudeLoginView>;
|
|
155
236
|
/** At the server's start: a setting saved where the mode is now off or refused (`why`: the switch, a listen address past
|
|
156
|
-
* loopback, a second token, the API-only profile) goes, so no runner, in this process or another, runs on it; the reason
|
|
157
|
-
* is logged. */
|
|
158
|
-
export declare function dropRefusedLogin(settings: Pick<Settings, "get" | "remove">, why: string | undefined, log: (line: string) => void): Promise<void>;
|
|
237
|
+
* loopback, a second token, the API-only profile, no home the server's user owns) goes, so no runner, in this process or another, runs on it; the reason
|
|
238
|
+
* is logged. A turn on `signIns`' queue, as every change of the setting is. */
|
|
239
|
+
export declare function dropRefusedLogin(signIns: Pick<ClaudeSignIns, "serial">, settings: Pick<Settings, "get" | "remove">, why: string | undefined, log: (line: string) => void): Promise<void>;
|
|
159
240
|
/** What the routes and a run's check use of the harness (its login.ts), loaded only when asked. */
|
|
160
241
|
export type ClaudeLoginCli = Pick<typeof import("@parcha/agentrun-harness-claude"), "claudeLoginStatus" | "startClaudeLogin" | "claudeLoginCommand">;
|
|
242
|
+
/** How long a signed-in answer stands in for a check that gives none (loginBeforeRun). */
|
|
243
|
+
export declare const LOGIN_ANSWER_STANDS_MS: number;
|
|
244
|
+
/** The folder in the data folder that holds, per login, when it last answered signed in (noteAnswer). The server and its
|
|
245
|
+
* runner may be two processes on one data folder (`--no-runner` beside `agentrun-serve runner`): the Settings view's
|
|
246
|
+
* answer is the server's, a run's check the runner's, so the answer is kept where both read it. */
|
|
247
|
+
export declare const LOGIN_ANSWERS_DIR = "claude-login-answers";
|
|
161
248
|
/** Before a run on the login: its CLI says it is signed in, or the run is refused in words (never a silent switch to a
|
|
162
249
|
* key). `cli`: the CLI that answers (loginCli); none, nothing to ask yet. `status`: the CLI's status check (the harness's
|
|
163
|
-
* claudeLoginStatus).
|
|
164
|
-
|
|
250
|
+
* claudeLoginStatus, which asks once and, when the CLI gives no answer, throws with `code` "timed_out" or "no_status").
|
|
251
|
+
* A check that gives no answer (it timed out, or the CLI said nothing that reads as a status) is asked once more, since
|
|
252
|
+
* a loaded host can take past the limit with the login fine. Still none: the run goes on when this login answered
|
|
253
|
+
* signed in on this machine within LOGIN_ANSWER_STANDS_MS (a run's check, or the Settings view's, in this process or
|
|
254
|
+
* another on the same data folder, `data`), as its own CLI still fails in words if the login is gone; else it is
|
|
255
|
+
* refused with LOGIN_UNKNOWN and why. Any other failure (a CLI that is not at its path, say) is refused with
|
|
256
|
+
* LOGIN_UNKNOWN and its own words at once, asked once and never waved through by an earlier answer. A signed-out answer
|
|
257
|
+
* is the answer: never asked again nor overridden, refused at once, and the earlier signed-in time goes. `now`: the
|
|
258
|
+
* clock (Date.now). */
|
|
259
|
+
export declare function loginBeforeRun(login: ClaudeAgentLogin | undefined, cli: string | undefined, status: (cli: string, login: ClaudeAgentLogin) => Promise<ClaudeLoginStatus>, options: {
|
|
260
|
+
data: string;
|
|
261
|
+
now?: () => number;
|
|
262
|
+
}): Promise<void>;
|
|
165
263
|
export {};
|