@boardwalk-labs/runner 0.1.2
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/LICENSE +202 -0
- package/README.md +68 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +214 -0
- package/dist/contract.d.ts +154 -0
- package/dist/contract.js +196 -0
- package/dist/daemon/daemon.d.ts +45 -0
- package/dist/daemon/daemon.js +129 -0
- package/dist/daemon/identity.d.ts +15 -0
- package/dist/daemon/identity.js +44 -0
- package/dist/daemon/index.d.ts +3 -0
- package/dist/daemon/index.js +4 -0
- package/dist/daemon/pool_client.d.ts +31 -0
- package/dist/daemon/pool_client.js +101 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -0
- package/dist/runtime/agent/budget.d.ts +123 -0
- package/dist/runtime/agent/budget.js +174 -0
- package/dist/runtime/agent/events.d.ts +46 -0
- package/dist/runtime/agent/events.js +8 -0
- package/dist/runtime/agent/model_rates.d.ts +7 -0
- package/dist/runtime/agent/model_rates.js +21 -0
- package/dist/runtime/agent/secret_redactor.d.ts +42 -0
- package/dist/runtime/agent/secret_redactor.js +98 -0
- package/dist/runtime/broker_artifact_store.d.ts +17 -0
- package/dist/runtime/broker_artifact_store.js +46 -0
- package/dist/runtime/broker_child_dispatcher.d.ts +31 -0
- package/dist/runtime/broker_child_dispatcher.js +88 -0
- package/dist/runtime/broker_event_publisher.d.ts +25 -0
- package/dist/runtime/broker_event_publisher.js +69 -0
- package/dist/runtime/broker_tool_host.d.ts +49 -0
- package/dist/runtime/broker_tool_host.js +240 -0
- package/dist/runtime/cancel_watcher.d.ts +31 -0
- package/dist/runtime/cancel_watcher.js +77 -0
- package/dist/runtime/credit_watcher.d.ts +30 -0
- package/dist/runtime/credit_watcher.js +78 -0
- package/dist/runtime/direct_inference.d.ts +29 -0
- package/dist/runtime/direct_inference.js +78 -0
- package/dist/runtime/index.d.ts +85 -0
- package/dist/runtime/index.js +525 -0
- package/dist/runtime/inference_transport.d.ts +5 -0
- package/dist/runtime/inference_transport.js +9 -0
- package/dist/runtime/leaf_executor.d.ts +104 -0
- package/dist/runtime/leaf_executor.js +333 -0
- package/dist/runtime/lease_renewer.d.ts +31 -0
- package/dist/runtime/lease_renewer.js +80 -0
- package/dist/runtime/main.d.ts +1 -0
- package/dist/runtime/main.js +7 -0
- package/dist/runtime/phase_tracker.d.ts +26 -0
- package/dist/runtime/phase_tracker.js +45 -0
- package/dist/runtime/program_log_capture.d.ts +20 -0
- package/dist/runtime/program_log_capture.js +79 -0
- package/dist/runtime/program_runner.d.ts +82 -0
- package/dist/runtime/program_runner.js +116 -0
- package/dist/runtime/program_worker.d.ts +177 -0
- package/dist/runtime/program_worker.js +272 -0
- package/dist/runtime/recording_secret_resolver.d.ts +9 -0
- package/dist/runtime/recording_secret_resolver.js +22 -0
- package/dist/runtime/run_abort.d.ts +16 -0
- package/dist/runtime/run_abort.js +38 -0
- package/dist/runtime/run_event_emitter.d.ts +24 -0
- package/dist/runtime/run_event_emitter.js +63 -0
- package/dist/runtime/runner_control_client.d.ts +184 -0
- package/dist/runtime/runner_control_client.js +501 -0
- package/dist/runtime/runtime_flusher.d.ts +41 -0
- package/dist/runtime/runtime_flusher.js +90 -0
- package/dist/runtime/sandbox_config.d.ts +21 -0
- package/dist/runtime/sandbox_config.js +34 -0
- package/dist/runtime/support/index.d.ts +53 -0
- package/dist/runtime/support/index.js +114 -0
- package/dist/runtime/suspension.d.ts +141 -0
- package/dist/runtime/suspension.js +120 -0
- package/dist/runtime/testing_artifact_build.d.ts +27 -0
- package/dist/runtime/testing_artifact_build.js +96 -0
- package/dist/runtime/tools/artifacts.d.ts +146 -0
- package/dist/runtime/tools/artifacts.js +125 -0
- package/dist/runtime/tools/types.d.ts +114 -0
- package/dist/runtime/tools/types.js +61 -0
- package/dist/runtime/tools/web_search.d.ts +66 -0
- package/dist/runtime/tools/web_search.js +165 -0
- package/dist/runtime/wire/artifact_storage.d.ts +37 -0
- package/dist/runtime/wire/artifact_storage.js +93 -0
- package/dist/runtime/wire/artifact_verify.d.ts +1 -0
- package/dist/runtime/wire/artifact_verify.js +8 -0
- package/dist/runtime/wire/human_input.d.ts +62 -0
- package/dist/runtime/wire/human_input.js +156 -0
- package/dist/runtime/wire/inference_proxy.d.ts +70 -0
- package/dist/runtime/wire/inference_proxy.js +157 -0
- package/dist/runtime/wire/manifest.d.ts +16 -0
- package/dist/runtime/wire/manifest.js +18 -0
- package/dist/runtime/wire/run.d.ts +54 -0
- package/dist/runtime/wire/run.js +2 -0
- package/dist/runtime/workflow_host.d.ts +194 -0
- package/dist/runtime/workflow_host.js +382 -0
- package/dist/runtime/workspace_store.d.ts +73 -0
- package/dist/runtime/workspace_store.js +118 -0
- package/package.json +70 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// CreditWatcher — stops a run when its org runs out of prepaid credit mid-flight (MASTER_SPEC §15 +
|
|
2
|
+
// docs/CODING_AGENT.md §6/§10).
|
|
3
|
+
//
|
|
4
|
+
// One per run session. On a timer it asks — through the broker (`GET /credit`, since the runner holds
|
|
5
|
+
// no Stripe credential) — whether the org is still funded; the FIRST time it isn't, it fires
|
|
6
|
+
// `onExhausted` once (the orchestrator wires this to `AbortController.abort`, which the WorkflowHost
|
|
7
|
+
// honors cooperatively) and stops checking. This is the org-level counterpart to the per-run
|
|
8
|
+
// BudgetMeter cap: the run can't see Stripe balances, so funding is enforced here, out of band,
|
|
9
|
+
// against the live balance that incremental token metering keeps fresh.
|
|
10
|
+
//
|
|
11
|
+
// "Prompt, not instant": Stripe meter aggregation is eventually-consistent and the host honors the
|
|
12
|
+
// abort at the next hook boundary, so a run stops within ~one check interval (plus Stripe's lag) of
|
|
13
|
+
// going unfunded — bounding overshoot, not eliminating it. Applies to MANAGED and BYOK runs alike,
|
|
14
|
+
// since runtime always burns credit (the gate requires the runtime floor regardless of token billing).
|
|
15
|
+
import { createLogger } from "./support/index.js";
|
|
16
|
+
const log = createLogger("CreditWatcher");
|
|
17
|
+
/** Default funding-check cadence. */
|
|
18
|
+
export const DEFAULT_CREDIT_CHECK_INTERVAL_MS = 60_000;
|
|
19
|
+
export class CreditWatcher {
|
|
20
|
+
deps;
|
|
21
|
+
timer = null;
|
|
22
|
+
firing = Promise.resolve();
|
|
23
|
+
exhausted = false;
|
|
24
|
+
stopped = false;
|
|
25
|
+
constructor(deps) {
|
|
26
|
+
this.deps = deps;
|
|
27
|
+
}
|
|
28
|
+
/** Begin periodic funding checks. */
|
|
29
|
+
start() {
|
|
30
|
+
if (this.timer !== null)
|
|
31
|
+
return;
|
|
32
|
+
const interval = this.deps.intervalMs ?? DEFAULT_CREDIT_CHECK_INTERVAL_MS;
|
|
33
|
+
this.timer = setInterval(() => {
|
|
34
|
+
this.firing = this.firing.then(() => this.check());
|
|
35
|
+
}, interval);
|
|
36
|
+
// Don't keep the worker process alive solely for the credit timer.
|
|
37
|
+
this.timer.unref();
|
|
38
|
+
}
|
|
39
|
+
/** Stop checking and drain any in-flight check. Idempotent. */
|
|
40
|
+
async stop() {
|
|
41
|
+
this.stopped = true;
|
|
42
|
+
if (this.timer !== null) {
|
|
43
|
+
clearInterval(this.timer);
|
|
44
|
+
this.timer = null;
|
|
45
|
+
}
|
|
46
|
+
await this.firing.catch(() => undefined);
|
|
47
|
+
}
|
|
48
|
+
/** Whether exhaustion was detected (the orchestrator may read this to shape the terminal result). */
|
|
49
|
+
isExhausted() {
|
|
50
|
+
return this.exhausted;
|
|
51
|
+
}
|
|
52
|
+
/** True once the watcher should no longer act. A method (not an inline field read) so it's
|
|
53
|
+
* re-evaluated after an `await` — `stop()` can flip `stopped` mid-check. */
|
|
54
|
+
done() {
|
|
55
|
+
return this.stopped || this.exhausted;
|
|
56
|
+
}
|
|
57
|
+
async check() {
|
|
58
|
+
if (this.done())
|
|
59
|
+
return;
|
|
60
|
+
let funded;
|
|
61
|
+
try {
|
|
62
|
+
funded = await this.deps.isFunded();
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
// A failed balance check must NOT kill a paying run — log and let the next tick retry.
|
|
66
|
+
log.warn("credit_check_failed", {
|
|
67
|
+
runId: this.deps.runId,
|
|
68
|
+
error: err instanceof Error ? err.message : String(err),
|
|
69
|
+
});
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (funded || this.done())
|
|
73
|
+
return;
|
|
74
|
+
this.exhausted = true;
|
|
75
|
+
log.info("run_credit_exhausted", { runId: this.deps.runId });
|
|
76
|
+
this.deps.onExhausted();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ChatMessage, ChatTurn, ToolSpec } from "@boardwalk-labs/engine/core";
|
|
2
|
+
import type { NormalizedReasoning } from "@boardwalk-labs/workflow";
|
|
3
|
+
import { type ByoInferenceProvider } from "../contract.js";
|
|
4
|
+
/** Parse the claim-delivered registry (BOARDWALK_BYO_PROVIDERS). Absent/malformed ⇒ empty —
|
|
5
|
+
* the run still works; BYO calls simply fall back to the broker's clear error. */
|
|
6
|
+
export declare function parseByoProviders(raw: string | undefined): ByoInferenceProvider[];
|
|
7
|
+
/** The registry entry for a per-`agent()` provider name, when the runtime may call it
|
|
8
|
+
* directly. Null ⇒ use the broker (managed lane, unknown provider, or a brokered-only
|
|
9
|
+
* source like bedrock). */
|
|
10
|
+
export declare function directProviderFor(registry: readonly ByoInferenceProvider[], provider: string | undefined): ByoInferenceProvider | null;
|
|
11
|
+
export interface DirectTurnRequest {
|
|
12
|
+
model: string;
|
|
13
|
+
messages: readonly ChatMessage[];
|
|
14
|
+
tools: readonly ToolSpec[];
|
|
15
|
+
reasoning?: NormalizedReasoning;
|
|
16
|
+
}
|
|
17
|
+
export interface DirectInferenceDeps {
|
|
18
|
+
registry: readonly ByoInferenceProvider[];
|
|
19
|
+
/** Resolves the provider's auth secret by NAME (the run's RecordingSecretResolver, so the
|
|
20
|
+
* value registers with the redactor). */
|
|
21
|
+
resolveSecret: (name: string) => Promise<string>;
|
|
22
|
+
fetchImpl?: typeof fetch;
|
|
23
|
+
}
|
|
24
|
+
/** One model turn, straight to the org's endpoint. Returns the ChatTurn + canonical model ref;
|
|
25
|
+
* BYO carries no platform cost (costMicros stays 0 — BYO is never metered). */
|
|
26
|
+
export declare function streamDirectTurn(deps: DirectInferenceDeps, entry: ByoInferenceProvider, req: DirectTurnRequest, onDelta: ((text: string) => void) | undefined): Promise<{
|
|
27
|
+
turn: ChatTurn;
|
|
28
|
+
modelRef: string;
|
|
29
|
+
}>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Runner-direct BYO inference (docs/SELF_HOSTED_RUNNERS.md D7): the managed lane stays
|
|
3
|
+
// brokered (the platform key never leaves the platform), but a BYO provider is the ORG'S OWN
|
|
4
|
+
// endpoint + key — class-3 material the runner may hold — so the runtime calls it directly
|
|
5
|
+
// with the SAME engine adapters the broker uses. This is what makes a LAN-only model work on
|
|
6
|
+
// a runner inside that LAN, and it removes a hop for public BYO endpoints.
|
|
7
|
+
//
|
|
8
|
+
// Scope: key-based HTTP providers (openai_compatible / openai / azure_openai / anthropic).
|
|
9
|
+
// `bedrock` (and anything credentialed by a cross-account role rather than an org secret)
|
|
10
|
+
// STAYS brokered — that credential is the broker's to assume, never the runner's.
|
|
11
|
+
//
|
|
12
|
+
// The provider registry arrives as DATA on the claim (BOARDWALK_BYO_PROVIDERS: name, adapter
|
|
13
|
+
// source, base_url, auth secret NAME). The key resolves once per provider through the broker's
|
|
14
|
+
// secrets endpoint via the run's RecordingSecretResolver, so the value registers with the
|
|
15
|
+
// SecretRedactor and can never leak into LLM context, events, or logs.
|
|
16
|
+
import { chatAnthropic, chatOpenAi } from "@boardwalk-labs/engine/core";
|
|
17
|
+
import { z } from "zod";
|
|
18
|
+
import { byoInferenceProviderSchema } from "../contract.js";
|
|
19
|
+
import { createLogger } from "./support/index.js";
|
|
20
|
+
const log = createLogger("DirectInference");
|
|
21
|
+
/** The adapter sources the runtime can call directly (a key-based HTTP request). */
|
|
22
|
+
const DIRECT_SOURCES = new Set(["openai_compatible", "openai", "azure_openai", "anthropic"]);
|
|
23
|
+
/** Parse the claim-delivered registry (BOARDWALK_BYO_PROVIDERS). Absent/malformed ⇒ empty —
|
|
24
|
+
* the run still works; BYO calls simply fall back to the broker's clear error. */
|
|
25
|
+
export function parseByoProviders(raw) {
|
|
26
|
+
if (raw === undefined || raw.trim().length === 0)
|
|
27
|
+
return [];
|
|
28
|
+
try {
|
|
29
|
+
const parsed = z.array(byoInferenceProviderSchema).safeParse(JSON.parse(raw));
|
|
30
|
+
if (!parsed.success) {
|
|
31
|
+
log.warn("byo_registry_invalid", { issues: parsed.error.issues.length });
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
return parsed.data;
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
log.warn("byo_registry_unparseable", {});
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** The registry entry for a per-`agent()` provider name, when the runtime may call it
|
|
42
|
+
* directly. Null ⇒ use the broker (managed lane, unknown provider, or a brokered-only
|
|
43
|
+
* source like bedrock). */
|
|
44
|
+
export function directProviderFor(registry, provider) {
|
|
45
|
+
if (provider === undefined || provider === "boardwalk")
|
|
46
|
+
return null;
|
|
47
|
+
const entry = registry.find((p) => p.name === provider);
|
|
48
|
+
if (entry === undefined)
|
|
49
|
+
return null;
|
|
50
|
+
if (!DIRECT_SOURCES.has(entry.source) || entry.base_url === null)
|
|
51
|
+
return null;
|
|
52
|
+
return entry;
|
|
53
|
+
}
|
|
54
|
+
/** One model turn, straight to the org's endpoint. Returns the ChatTurn + canonical model ref;
|
|
55
|
+
* BYO carries no platform cost (costMicros stays 0 — BYO is never metered). */
|
|
56
|
+
export async function streamDirectTurn(deps, entry, req, onDelta) {
|
|
57
|
+
const apiKey = entry.auth_secret_name === null ? null : await deps.resolveSecret(entry.auth_secret_name);
|
|
58
|
+
if (entry.base_url === null) {
|
|
59
|
+
throw new Error(`BYO provider '${entry.name}' has no base_url`);
|
|
60
|
+
}
|
|
61
|
+
const args = {
|
|
62
|
+
baseUrl: entry.base_url,
|
|
63
|
+
apiKey,
|
|
64
|
+
model: req.model,
|
|
65
|
+
messages: req.messages,
|
|
66
|
+
tools: req.tools,
|
|
67
|
+
...(req.reasoning !== undefined ? { reasoning: req.reasoning } : {}),
|
|
68
|
+
};
|
|
69
|
+
const io = {
|
|
70
|
+
...(deps.fetchImpl !== undefined ? { fetchImpl: deps.fetchImpl } : {}),
|
|
71
|
+
...(onDelta !== undefined ? { onDelta } : {}),
|
|
72
|
+
};
|
|
73
|
+
log.debug("direct_turn", { provider: entry.name, source: entry.source, model: req.model });
|
|
74
|
+
const turn = entry.source === "anthropic"
|
|
75
|
+
? await chatAnthropic(args, io)
|
|
76
|
+
: await chatOpenAi({ ...args, reasoningStyle: "openai_effort" }, io);
|
|
77
|
+
return { turn, modelRef: `${entry.name}/${req.model}` };
|
|
78
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { AuthContext } from "./support/index.js";
|
|
2
|
+
import type { Run } from "./wire/run.js";
|
|
3
|
+
import type { ByoInferenceProvider } from "../contract.js";
|
|
4
|
+
import { type ProgramWorkerDeps } from "./program_worker.js";
|
|
5
|
+
/** Constructed primitives the pure assembly consumes (real ones in main(), fakes in tests). The
|
|
6
|
+
* runner holds NO platform credential — only the per-run control-plane handle (run token + broker
|
|
7
|
+
* URL); everything else is reached through the Runner Control API (docs/RUNNER_BROKER.md). */
|
|
8
|
+
export interface WorkerRuntime {
|
|
9
|
+
/** Stable worker identity stamped onto the lease (ECS task arn / hostname / run-derived). */
|
|
10
|
+
workerId: string;
|
|
11
|
+
/** Sandbox workspace root for filesystem/shell/git tools. */
|
|
12
|
+
workspaceRoot: string;
|
|
13
|
+
/** The run this worker task is executing (RUN_ID) — binds the Runner Control API client. */
|
|
14
|
+
runId: string;
|
|
15
|
+
/** The org's BYO inference providers (claim-delivered, BOARDWALK_BYO_PROVIDERS) for the
|
|
16
|
+
* runner-direct model path (D7). Empty/omitted ⇒ every model call goes through the broker. */
|
|
17
|
+
byoProviders?: readonly ByoInferenceProvider[];
|
|
18
|
+
/** Broker control-plane handle (run token + base URL), injected by the dispatcher as
|
|
19
|
+
* BOARDWALK_CONTROL_PLANE_URL + BOARDWALK_RUN_TOKEN. The runner's ONLY broker credential.
|
|
20
|
+
* `apiToken` is the run's separate public-API bearer (was BOARDWALK_API_KEY) — served to the
|
|
21
|
+
* program on demand via `runtime.apiToken()`, never placed back into process.env. */
|
|
22
|
+
controlPlane: {
|
|
23
|
+
baseUrl: string;
|
|
24
|
+
runToken: string;
|
|
25
|
+
apiToken?: string;
|
|
26
|
+
};
|
|
27
|
+
/** vCPUs provisioned for this task (the dispatcher's resolved machine size ÷ 1024 cpu units). Runtime
|
|
28
|
+
* is billed per vCPU-SECOND, so the RuntimeFlusher scales wall-clock by this. Defaults to 1. */
|
|
29
|
+
vcpus: number;
|
|
30
|
+
}
|
|
31
|
+
/** Durable events are deferred (run_step_events table) — live fan-out via the broker only. */
|
|
32
|
+
/** Synthesize the run's AuthContext. The run was already authorized at trigger time; the
|
|
33
|
+
* worker acts on the org's behalf, so it carries the org + an owner role. Tool-level
|
|
34
|
+
* boundaries (the broker's server-side manifest allowlist) are the real guard.
|
|
35
|
+
*
|
|
36
|
+
* source='workflow' (NOT 'session_jwt'): the program must never perform SESSION_JWT_ONLY
|
|
37
|
+
* credential mutations (§12.11), so a tool that ever exposed such a service is denied by
|
|
38
|
+
* construction regardless of the owner role. */
|
|
39
|
+
export declare function workerAuthContext(run: Run): AuthContext;
|
|
40
|
+
/**
|
|
41
|
+
* Sequencer for per-call token-metering identifiers, `<runId>:<sessionId>:<leafIndex>:<turnSeq>`.
|
|
42
|
+
*
|
|
43
|
+
* The worker's `meterUsage` hook fires once per model TURN (the engine's leaf loop reports usage
|
|
44
|
+
* after every model call), but the display aggregate is idempotent on this identifier
|
|
45
|
+
* (UsageEventRepository.recordAndAggregate → `onConflictDoNothing`). A key that didn't vary per call
|
|
46
|
+
* (it was `<runId>:<sessionId>:<leafIndex>`) collapsed every turn after a leaf's first into a dropped
|
|
47
|
+
* duplicate — so `runs.tokens_in/out` reflected only each leaf's FIRST turn and under-reported
|
|
48
|
+
* multi-turn leaves by orders of magnitude, even as the BudgetMeter (which accumulates every turn)
|
|
49
|
+
* still tripped on the real spend. Bumping a per-session counter gives every turn its own idempotent
|
|
50
|
+
* event. Restart safety rides the session id (a fresh `meteringSessionId` per worker session) — a
|
|
51
|
+
* restart genuinely re-spends inference, so it must re-meter rather than dedupe against a prior run.
|
|
52
|
+
*/
|
|
53
|
+
export declare function tokenMeterIdentifiers(runId: string, sessionId: string): (leafIndex: number) => string;
|
|
54
|
+
/** Pure wiring: build the full ProgramWorkerDeps from the control-plane handle. The runner reaches
|
|
55
|
+
* every privileged seam through the broker over its run token — no DB / Redis / Stripe / model creds. */
|
|
56
|
+
export declare function assembleWorkerDeps(runtime: WorkerRuntime): ProgramWorkerDeps;
|
|
57
|
+
/**
|
|
58
|
+
* The per-run platform values the dispatcher injects as container env (ecs_run_task_client.ts). They
|
|
59
|
+
* are captured into private worker state at bootstrap and DELETED from `process.env` before any user
|
|
60
|
+
* program / agent leaf / subprocess can run — the run token + API token are credentials, and nothing
|
|
61
|
+
* untrusted run code touches should inherit them (docs/RUN_ENV_AND_CREDS.md). The user owns the rest
|
|
62
|
+
* of `process.env` outright.
|
|
63
|
+
*/
|
|
64
|
+
export declare const PLATFORM_ENV_KEYS: readonly ["RUN_ID", "BOARDWALK_CONTROL_PLANE_URL", "BOARDWALK_RUN_TOKEN", "BOARDWALK_API_KEY", "BOARDWALK_TASK_CPU_UNITS"];
|
|
65
|
+
/** The captured platform context, shaped to feed {@link assembleWorkerDeps}. */
|
|
66
|
+
export interface PlatformContext {
|
|
67
|
+
runId: string;
|
|
68
|
+
controlPlane: {
|
|
69
|
+
baseUrl: string;
|
|
70
|
+
runToken: string;
|
|
71
|
+
apiToken?: string;
|
|
72
|
+
};
|
|
73
|
+
vcpus: number;
|
|
74
|
+
}
|
|
75
|
+
/** The public-API origin a run uses for raw API / MCP / CLI calls. The broker (Runner Control API)
|
|
76
|
+
* is hosted on the api-server, so the public API shares its origin; the program appends `/v1` or
|
|
77
|
+
* `/mcp/v1`. Falls back to the broker URL unchanged if it can't be parsed. */
|
|
78
|
+
export declare function publicApiOrigin(controlPlaneBaseUrl: string): string;
|
|
79
|
+
/**
|
|
80
|
+
* Read the dispatcher-injected platform context from `env`, then DELETE every {@link PLATFORM_ENV_KEYS}
|
|
81
|
+
* key from it so the user program, the agent leaf, and any subprocess inherit none of them. Mutates
|
|
82
|
+
* `env` (called once on `process.env` at the very top of `main`, before any run code can read it).
|
|
83
|
+
*/
|
|
84
|
+
export declare function capturePlatformContext(env: NodeJS.ProcessEnv): PlatformContext;
|
|
85
|
+
export declare function main(): Promise<void>;
|