@bridge_gpt/mcp-server 0.2.72 → 0.2.73
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/README.md +5 -5
- package/build/agent-launchers/claude-executor-adapter.js +3 -0
- package/build/agents.generated.js +6 -6
- package/build/bridge-permissions.js +27 -0
- package/build/ci-system-detection.js +50 -0
- package/build/ci-trigger-adapters.js +631 -0
- package/build/ci-trigger-install.js +106 -0
- package/build/codex-launcher-pin.js +33 -2
- package/build/codex-skill-adapter.js +3 -1
- package/build/command-host.js +33 -0
- package/build/commands.generated.js +7 -6
- package/build/conductor/bridge-api-client.js +842 -35
- package/build/conductor/bring-up-facts.js +18 -5
- package/build/conductor/command-drift-production.js +42 -17
- package/build/conductor/command-drift.js +47 -0
- package/build/conductor/declare-blocked.js +554 -0
- package/build/conductor/doctor.js +106 -21
- package/build/conductor/driver-commands.js +141 -0
- package/build/conductor/driver-guard.js +277 -0
- package/build/conductor/driver-lapse.js +321 -0
- package/build/conductor/driver-register.js +176 -0
- package/build/conductor/driver-release.js +174 -0
- package/build/conductor/driver-session-state.js +315 -0
- package/build/conductor/epic-branch-ci-inspection.js +222 -29
- package/build/conductor/epic-implementer-cli.js +166 -15
- package/build/conductor/epic-server-database.js +162 -0
- package/build/conductor/epic-server-guidance.js +278 -0
- package/build/conductor/epic-server-journal.js +239 -0
- package/build/conductor/epic-server-processes.js +324 -0
- package/build/conductor/epic-server-recipe.js +397 -0
- package/build/conductor/epic-server-runtime.js +1207 -0
- package/build/conductor/epic-server-sfcc.js +107 -0
- package/build/conductor/epic-server-state.js +427 -0
- package/build/conductor/epic-server.js +594 -0
- package/build/conductor/gate-discovery.js +150 -5
- package/build/conductor/gate-settings-review.js +224 -4
- package/build/conductor/launch-need-probes.js +6 -53
- package/build/conductor/launch-plan.js +313 -156
- package/build/conductor/prerequisite-inputs.js +879 -45
- package/build/conductor/readiness-assessment.js +16 -1
- package/build/conductor/readiness-cli.js +20 -9
- package/build/conductor/readiness-prerequisites.js +28 -9
- package/build/conductor/readiness-sections.js +133 -126
- package/build/conductor/readiness.js +1 -1
- package/build/conductor/recovery-cli.js +13 -2
- package/build/conductor/tools.js +6 -5
- package/build/conductor/wait-run-attention.js +2 -2
- package/build/conductor/wait-run-cli.js +208 -22
- package/build/conductor/worker-database-doctor-inspector.js +33 -2
- package/build/conductor/worker-setup-tally.js +27 -0
- package/build/credential-store.js +71 -1
- package/build/dependency-install-declarations.js +55 -0
- package/build/docs.generated.js +2 -2
- package/build/doctor.js +54 -3
- package/build/drive-epic-help.js +21 -2
- package/build/drive-epic.js +1811 -351
- package/build/engine-paths.js +20 -0
- package/build/epic-branch-ci-summary.js +140 -0
- package/build/epic-capability-statement.js +107 -0
- package/build/epic-ci-workflow-drift.js +30 -15
- package/build/epic-ci-workflow-install.js +110 -42
- package/build/epic-ci-workflow-v2.js +274 -0
- package/build/epic-ci-workflow.js +38 -12
- package/build/epic-implementer-bin.js +2101 -44
- package/build/epic-launch-context.js +607 -0
- package/build/epic-server-record.js +273 -0
- package/build/epic-shared/bridge-client.js +11 -3
- package/build/escalation-reachability.js +43 -0
- package/build/executor/ci-fix-test-runs.js +334 -0
- package/build/executor/completion-contract.js +8 -1
- package/build/executor/env.js +59 -22
- package/build/executor/epic-server-context.js +141 -0
- package/build/executor/gate-qualification-job.js +127 -26
- package/build/executor/http-client.js +52 -5
- package/build/executor/job-runner.js +423 -69
- package/build/executor/observation.js +8 -0
- package/build/executor/pre-pr-checks.js +363 -0
- package/build/executor/prompt-spec.js +114 -2
- package/build/executor/reconcile-overlap-job.js +5 -3
- package/build/executor/required-work-diagnostics.js +4 -2
- package/build/executor/required-work-ledger.js +936 -38
- package/build/executor/results.js +58 -0
- package/build/executor/terminal-mutation.js +8 -0
- package/build/executor/worker-command.js +72 -3
- package/build/executor/worker-database-config.js +281 -0
- package/build/executor/worker-database-target.js +16 -12
- package/build/executor/worker-database.js +320 -101
- package/build/executor/worker-finalization.js +7 -1
- package/build/executor/worker-resources.js +25 -3
- package/build/executor/worker-verification-guidance.js +18 -3
- package/build/executor/worktree.js +20 -1
- package/build/executor-launch.js +54 -2
- package/build/generated-assets-catalog.js +2 -2
- package/build/index.js +664 -335
- package/build/init.js +26 -11
- package/build/install-bridge-conductor-answers.js +465 -0
- package/build/install-bridge-conductor-apply.js +259 -0
- package/build/install-bridge-conductor-assessment.js +895 -0
- package/build/install-bridge-conductor-compact.js +161 -0
- package/build/install-bridge-conductor-contracts.js +63 -0
- package/build/install-bridge-conductor-gate.js +1197 -196
- package/build/install-bridge-conductor-setup.js +535 -79
- package/build/install-bridge-conductor.js +2885 -560
- package/build/install-bridge.js +199 -21
- package/build/install-maintenance.js +26 -3
- package/build/launcher-config-inspection.js +162 -1
- package/build/mcp-grant-candidates.js +767 -0
- package/build/mcp-grant-doctor.js +63 -0
- package/build/mcp-grant.js +288 -0
- package/build/mcp-host-targets.js +8 -0
- package/build/mcp-identity.js +23 -0
- package/build/mcp-invoke.js +126 -13
- package/build/mcp-presets.js +107 -0
- package/build/mcp-provisioning.js +134 -2
- package/build/mcp-registration-doctor.js +31 -2
- package/build/mcp-server-invocation.js +6 -1
- package/build/merge-workflow-install.js +234 -109
- package/build/pipelines.generated.js +5 -5
- package/build/plan-discovery.js +97 -4
- package/build/plan-execution-ledger.js +100 -7
- package/build/plan-generation-io.js +262 -0
- package/build/plan-generation.js +424 -0
- package/build/plane/build-freshness.js +6 -1
- package/build/plane/cli.js +75 -9
- package/build/plane/plane-freshness.js +17 -0
- package/build/plane/preflight.js +50 -10
- package/build/plane/shutdown.js +19 -0
- package/build/plane/terminal-run-cleanup.js +18 -4
- package/build/printed-remedy-commands.js +206 -12
- package/build/readiness-check.js +77 -0
- package/build/readiness-prerequisites.generated.js +122 -14
- package/build/readme.generated.js +1 -1
- package/build/repository-state-paths.js +38 -0
- package/build/run-unit-tests-launcher.js +8 -1
- package/build/setup-epic.js +1190 -196
- package/build/setup-progress.js +44 -0
- package/build/setup-question.js +122 -4
- package/build/third-party-mcp-targets.js +30 -0
- package/build/ticket-delivery-enrollment.js +9 -0
- package/build/upgrade-cli.js +85 -2
- package/build/v2-readiness-requirements.js +28 -1
- package/build/version.generated.js +3 -3
- package/docs/EPIC-IMPLEMENTER-INSTALL.md +9 -1
- package/docs/epic-implementer/getting-started.md +3 -1
- package/docs/epic-implementer/self-hosting.md +14 -1
- package/package.json +2 -2
|
@@ -305,8 +305,15 @@ export const MAX_TASKS = 64;
|
|
|
305
305
|
export const MAX_DENIALS = 32;
|
|
306
306
|
export const MAX_IDENTIFIER_CHARS = 128;
|
|
307
307
|
export const MAX_SERIALIZED_BYTES = 32 * 1024;
|
|
308
|
-
/**
|
|
308
|
+
/**
|
|
309
|
+
* One stream-json event larger than this is never retained or parsed as a whole
|
|
310
|
+
* event. It is read structurally instead: a bounded, incremental parser keeps
|
|
311
|
+
* only lifecycle metadata, and the event is `stream_oversize` unless that
|
|
312
|
+
* projection fully establishes its meaning.
|
|
313
|
+
*/
|
|
309
314
|
export const MAX_EVENT_BYTES = 1024 * 1024;
|
|
315
|
+
/** Hard per-line ceiling (UTF-8 bytes, newline excluded) for structural reading. */
|
|
316
|
+
export const MAX_STRUCTURAL_EVENT_BYTES = 32 * 1024 * 1024;
|
|
310
317
|
const IDENTIFIER_RE = /^[A-Za-z0-9][A-Za-z0-9_.:-]*$/;
|
|
311
318
|
export function sha256Hex(value) {
|
|
312
319
|
return createHash("sha256").update(value, "utf8").digest("hex");
|
package/build/executor/env.js
CHANGED
|
@@ -35,9 +35,11 @@
|
|
|
35
35
|
* executor must not reach a worker and silently change which configuration —
|
|
36
36
|
* and which MCP registrations — the CLI resolves.
|
|
37
37
|
*
|
|
38
|
-
* BAPI-1019: this builder also injects
|
|
39
|
-
*
|
|
40
|
-
* database that does not exist.
|
|
38
|
+
* BAPI-1019: this builder also injects SENTINEL DATABASE literals (the
|
|
39
|
+
* configured URL aliases, `POSTGRES_DATABASE`, `POSTGRES_DB`, `PGDATABASE`), all
|
|
40
|
+
* naming a database that does not exist. BAPI-1598: only when the job's
|
|
41
|
+
* `worker_database` declaration lists protected databases; an unconfigured
|
|
42
|
+
* project's own runtime defaults are left alone. Architecture Miss 28 was a worker that ran an
|
|
41
43
|
* allowed `pytest` whose harness truncated the operator's real operational
|
|
42
44
|
* database; it could name that database because a copied `.env` reached its
|
|
43
45
|
* worktree and nothing in the worker environment said otherwise. The env-file
|
|
@@ -321,8 +323,12 @@ export function validateWorkerEnvDeclarations(raw, taken = new Set()) {
|
|
|
321
323
|
* carries no credential and never the operator's database. Built here so the
|
|
322
324
|
* job runner never constructs a worker environment itself.
|
|
323
325
|
*/
|
|
324
|
-
export function buildDependencyInstallEnv(parentEnv, payload) {
|
|
325
|
-
return buildExecutorBaseWorkerEnv(parentEnv, {
|
|
326
|
+
export function buildDependencyInstallEnv(parentEnv, payload, databaseOption = {}) {
|
|
327
|
+
return buildExecutorBaseWorkerEnv(parentEnv, {
|
|
328
|
+
...payloadWorkerEnvOption(payload),
|
|
329
|
+
...databaseOption,
|
|
330
|
+
legacyNotice: false,
|
|
331
|
+
});
|
|
326
332
|
}
|
|
327
333
|
/**
|
|
328
334
|
* BAPI-1551 — the `{ dependencyInstall }` option a job payload implies: present
|
|
@@ -335,6 +341,18 @@ export function payloadDependencyInstallOption(payload) {
|
|
|
335
341
|
return {};
|
|
336
342
|
return { dependencyInstall: payload.dependency_install };
|
|
337
343
|
}
|
|
344
|
+
/**
|
|
345
|
+
* BAPI-1582 — the `{ prePrChecks }` option a job payload implies: present exactly
|
|
346
|
+
* when the payload OWNS a `pre_pr_checks` key (an inherited or prototype key is
|
|
347
|
+
* absent). Never validates the value; a malformed own value is still present.
|
|
348
|
+
*/
|
|
349
|
+
export function payloadPrePrChecksOption(payload) {
|
|
350
|
+
if (typeof payload !== "object" || payload === null || Array.isArray(payload))
|
|
351
|
+
return {};
|
|
352
|
+
if (!Object.prototype.hasOwnProperty.call(payload, "pre_pr_checks"))
|
|
353
|
+
return {};
|
|
354
|
+
return { prePrChecks: payload.pre_pr_checks };
|
|
355
|
+
}
|
|
338
356
|
/** BAPI-1551 — the `{ ciDatabase }` option, present exactly when the payload owns `ci_database`. */
|
|
339
357
|
export function payloadCiDatabaseOption(payload) {
|
|
340
358
|
if (typeof payload !== "object" || payload === null || Array.isArray(payload))
|
|
@@ -574,22 +592,41 @@ export function buildExecutorBaseWorkerEnv(parentEnv, options = {}) {
|
|
|
574
592
|
env[key] = value;
|
|
575
593
|
}
|
|
576
594
|
}
|
|
595
|
+
// BAPI-1598 — no executor database setting is ever inherited. The allowlist
|
|
596
|
+
// already omits these, so this sweep only keeps that true if the allowlist grows.
|
|
597
|
+
for (const key of Object.keys(env)) {
|
|
598
|
+
if (key === "DATABASE_URL" || key.startsWith("POSTGRES_") || key.startsWith("PG"))
|
|
599
|
+
delete env[key];
|
|
600
|
+
}
|
|
577
601
|
env.BRIDGE_SKIP_PREPUSH = "1";
|
|
578
602
|
env.MAX_MCP_OUTPUT_TOKENS = "50000";
|
|
579
|
-
// BAPI-1019 — the
|
|
580
|
-
//
|
|
581
|
-
//
|
|
582
|
-
//
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
603
|
+
// BAPI-1019/BAPI-1598 — the database destination, from the validated
|
|
604
|
+
// declaration and never from `parentEnv`. A declaration that lists protected
|
|
605
|
+
// databases gets the sentinel in every configured URL alias and the component
|
|
606
|
+
// variables, so a worker cannot name a real database. An absent declaration, or
|
|
607
|
+
// one with no protected names, adds nothing. A provisioned job database then
|
|
608
|
+
// replaces the sentinel TOGETHER with the loopback role keys; its name is
|
|
609
|
+
// validated before anything is set, so an invalid name throws rather than
|
|
610
|
+
// leaving a half-pointed environment.
|
|
611
|
+
let databaseEnv = {};
|
|
612
|
+
const databaseConfig = options.workerDatabaseConfig;
|
|
613
|
+
if (databaseConfig !== undefined && databaseConfig.protectedDatabases.length > 0) {
|
|
614
|
+
for (const alias of databaseConfig.envNames)
|
|
615
|
+
databaseEnv[alias] = WORKER_SENTINEL_DATABASE_URL;
|
|
616
|
+
databaseEnv.POSTGRES_DATABASE = WORKER_SENTINEL_DATABASE_NAME;
|
|
617
|
+
databaseEnv.POSTGRES_DB = WORKER_SENTINEL_DATABASE_NAME;
|
|
618
|
+
databaseEnv.PGDATABASE = WORKER_SENTINEL_DATABASE_NAME;
|
|
619
|
+
}
|
|
590
620
|
if (options.workerDatabase !== undefined) {
|
|
591
|
-
|
|
621
|
+
if (databaseConfig?.workerRole === undefined) {
|
|
622
|
+
throw new Error("worker database target requires a validated worker_database declaration");
|
|
623
|
+
}
|
|
624
|
+
databaseEnv = buildWorkerDatabaseEnv(options.workerDatabase, {
|
|
625
|
+
role: databaseConfig.workerRole,
|
|
626
|
+
envNames: databaseConfig.envNames,
|
|
627
|
+
});
|
|
592
628
|
}
|
|
629
|
+
Object.assign(env, databaseEnv);
|
|
593
630
|
// BAPI-1479 — CI's throwaway test values, from constants and never from
|
|
594
631
|
// `parentEnv`, for every job type and every adapter. BAPI-1521: only when the
|
|
595
632
|
// payload did not carry a `worker_env` declaration at all. A present declaration
|
|
@@ -655,17 +692,17 @@ export function buildExecutorBaseWorkerEnv(parentEnv, options = {}) {
|
|
|
655
692
|
env[name] = value;
|
|
656
693
|
}
|
|
657
694
|
}
|
|
695
|
+
// BAPI-1598 — the final database assignments, after every permitted declaration
|
|
696
|
+
// and legacy fill, so neither can overwrite the protected destination.
|
|
697
|
+
Object.assign(env, databaseEnv);
|
|
658
698
|
// Nothing agent-specific is added here, and deliberately nothing secret. An
|
|
659
699
|
// adapter that needs to forward an operator-owned credential declares it as a
|
|
660
700
|
// passthrough and copies it onto the object this function returns; see
|
|
661
701
|
// `buildClaudeWorkerEnv`. Keeping the base free of every credential is what
|
|
662
702
|
// makes "which secrets can reach a worker?" answerable per adapter instead of
|
|
663
703
|
// per call site.
|
|
664
|
-
//
|
|
665
|
-
//
|
|
666
|
-
// and an ambient host value can never choose the worker's SSL policy. Alembic
|
|
667
|
-
// uses this same builder, including for empty or legacy declarations.
|
|
668
|
-
env.ENVIRONMENT ??= "LOCAL";
|
|
704
|
+
// BAPI-1598 — no implicit `ENVIRONMENT`. A repository that needs one declares
|
|
705
|
+
// it in `worker_env` (bridge-api declares `ENVIRONMENT=LOCAL`).
|
|
669
706
|
return env;
|
|
670
707
|
}
|
|
671
708
|
/**
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The executor's read-only, fail-open view of the run's epic server (BAPI-1546).
|
|
3
|
+
*
|
|
4
|
+
* At spawn, an implement-style worker in an epic run gets the browser target the
|
|
5
|
+
* repository owner opted in to, and nothing else:
|
|
6
|
+
*
|
|
7
|
+
* - `local` mode: the helper's live state, accepted only when its pid is alive
|
|
8
|
+
* with the recorded start time and it names THIS run. The served loopback
|
|
9
|
+
* URL becomes `BRIDGE_EPIC_SERVER_URL`, and the run id becomes
|
|
10
|
+
* `BRIDGE_EPIC_SERVER_RUN_ID` (what `turn acquire` addresses). A missing,
|
|
11
|
+
* stale, or unreadable state file is "local, unavailable": the worker still
|
|
12
|
+
* spawns, with no URL, and is told to try one bounded turn.
|
|
13
|
+
* - `sfcc_shared_active` mode: the approved storefront origin becomes
|
|
14
|
+
* `BRIDGE_EPIC_SERVER_URL`. No local state is read, and no sandbox credential
|
|
15
|
+
* or credential reference reaches the worker.
|
|
16
|
+
* - no record, an unusable record, or `none`: disabled. Nothing is injected,
|
|
17
|
+
* so the spawn environment, the prompt, and `.mcp.json` are byte-identical to
|
|
18
|
+
* a repository that never opted in.
|
|
19
|
+
*
|
|
20
|
+
* Every read is bounded and every failure is swallowed into `disabled` or
|
|
21
|
+
* `local_unavailable`. Nothing here can fail a job, write run state, add a gate,
|
|
22
|
+
* park a ticket, or block a spawn. The browser origin restriction itself is the
|
|
23
|
+
* `mcp-invoke` shim's, derived from `BRIDGE_EPIC_SERVER_URL`; it is not
|
|
24
|
+
* recomputed here.
|
|
25
|
+
*/
|
|
26
|
+
import { lstat, readFile } from "node:fs/promises";
|
|
27
|
+
import os from "node:os";
|
|
28
|
+
import { readEpicServerRecord } from "../epic-server-record.js";
|
|
29
|
+
import { boundedResult, createDefaultEpicServerStateFs, findEpicServerRunPaths, isValidEpicRunId, readEpicServerLiveState, EPIC_SERVER_RUN_ID_ENV, EPIC_SERVER_URL_ENV, } from "../conductor/epic-server-state.js";
|
|
30
|
+
import { createDefaultEpicServerProcessDeps, readProcessStartTime } from "../conductor/epic-server-processes.js";
|
|
31
|
+
import { EPIC_SERVER_DEFAULT_TIMING } from "../conductor/epic-server-recipe.js";
|
|
32
|
+
/** The whole optional read is bounded by this. */
|
|
33
|
+
export const EPIC_SERVER_CONTEXT_BUDGET_MS = 3_000;
|
|
34
|
+
/**
|
|
35
|
+
* The live-state read finishes this much before the whole budget, so a hung
|
|
36
|
+
* helper probe resolves "local, unavailable" (the record DID select local mode)
|
|
37
|
+
* instead of losing the race to the outer `disabled` timeout.
|
|
38
|
+
*/
|
|
39
|
+
const LIVE_STATE_MARGIN_MS = 250;
|
|
40
|
+
export function createDefaultEpicServerContextDeps(env) {
|
|
41
|
+
const proc = createDefaultEpicServerProcessDeps();
|
|
42
|
+
return {
|
|
43
|
+
readRecord: (repoName) => readEpicServerRecord(repoName, { env, homedir: os.homedir, readFile: (p) => readFile(p, "utf8"), lstat: (p) => lstat(p) }),
|
|
44
|
+
homedir: os.homedir,
|
|
45
|
+
tmpdir: os.tmpdir,
|
|
46
|
+
fs: createDefaultEpicServerStateFs(),
|
|
47
|
+
identity: async (pid) => {
|
|
48
|
+
const startedAt = await readProcessStartTime(pid, proc);
|
|
49
|
+
return startedAt === null ? null : { startedAt };
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
async function readContext(repoName, epicRunId, deps, deadline) {
|
|
54
|
+
const record = await deps.readRecord(repoName);
|
|
55
|
+
if (record.state !== "ok")
|
|
56
|
+
return { kind: "disabled" };
|
|
57
|
+
const mode = record.record.mode;
|
|
58
|
+
if (mode === "none")
|
|
59
|
+
return { kind: "disabled" };
|
|
60
|
+
if (mode === "sfcc_shared_active") {
|
|
61
|
+
const origin = record.record.sfcc?.storefront_origin;
|
|
62
|
+
return typeof origin === "string" && origin.length > 0 ? { kind: "sfcc", origin } : { kind: "disabled" };
|
|
63
|
+
}
|
|
64
|
+
if (!isValidEpicRunId(epicRunId))
|
|
65
|
+
return { kind: "disabled" };
|
|
66
|
+
const paths = await findEpicServerRunPaths(deps.homedir(), epicRunId, deps.fs, deps.tmpdir());
|
|
67
|
+
if (paths === null)
|
|
68
|
+
return { kind: "local_unavailable", runId: epicRunId };
|
|
69
|
+
const live = await readEpicServerLiveState(paths.state, epicRunId, { fs: deps.fs, probe: { identity: deps.identity }, budgetMs: Math.max(1, deadline - Date.now() - LIVE_STATE_MARGIN_MS) });
|
|
70
|
+
return live.state === "live"
|
|
71
|
+
? {
|
|
72
|
+
kind: "local_live",
|
|
73
|
+
url: live.value.url,
|
|
74
|
+
runId: epicRunId,
|
|
75
|
+
turnWaitSeconds: live.value.turn_wait_seconds,
|
|
76
|
+
turnBuildSeconds: live.value.turn_build_seconds,
|
|
77
|
+
}
|
|
78
|
+
: { kind: "local_unavailable", runId: epicRunId };
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Read the worker's epic-server context. Never throws and never exceeds the
|
|
82
|
+
* budget: a slow or failed local read degrades to `local_unavailable` only after
|
|
83
|
+
* the record selected local mode, and to `disabled` otherwise.
|
|
84
|
+
*/
|
|
85
|
+
export async function readEpicServerWorkerContext(repoName, epicRunId, deps) {
|
|
86
|
+
if (typeof epicRunId !== "string" || epicRunId.length === 0)
|
|
87
|
+
return { kind: "disabled" };
|
|
88
|
+
const deadline = Date.now() + EPIC_SERVER_CONTEXT_BUDGET_MS;
|
|
89
|
+
const work = readContext(repoName, epicRunId, deps, deadline).catch(() => ({ kind: "disabled" }));
|
|
90
|
+
return boundedResult(work, EPIC_SERVER_CONTEXT_BUDGET_MS, { kind: "disabled" });
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Claude Code caps a foreground Bash command at 600 s unless this names a higher
|
|
94
|
+
* ceiling (milliseconds). `turn acquire` can legitimately take longer: a worker
|
|
95
|
+
* queued behind a held lease waits, then gets its own rebuild budget.
|
|
96
|
+
*/
|
|
97
|
+
export const EPIC_SERVER_BASH_MAX_TIMEOUT_ENV = "BASH_MAX_TIMEOUT_MS";
|
|
98
|
+
/** Slack the client allows past the queue wait and rebuild budget. */
|
|
99
|
+
const EPIC_SERVER_ACQUIRE_SLACK_SECONDS = 60;
|
|
100
|
+
/**
|
|
101
|
+
* The longest one `turn acquire` command can take before it prints, in seconds:
|
|
102
|
+
* the running helper's turn wait plus its rebuild budget, plus slack. A context
|
|
103
|
+
* with no live helper uses the default timing, which is what a helper that starts
|
|
104
|
+
* later is most likely to run with. The prompt states this number and the spawn
|
|
105
|
+
* env raises the harness ceiling to it, so the two always agree.
|
|
106
|
+
*/
|
|
107
|
+
export function epicServerAcquireCommandSeconds(context) {
|
|
108
|
+
const timing = context.kind === "local_live"
|
|
109
|
+
? { wait: context.turnWaitSeconds, build: context.turnBuildSeconds }
|
|
110
|
+
: { wait: EPIC_SERVER_DEFAULT_TIMING.acquire_wait_seconds, build: EPIC_SERVER_DEFAULT_TIMING.proof_seconds };
|
|
111
|
+
return timing.wait + timing.build + EPIC_SERVER_ACQUIRE_SLACK_SECONDS;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Inject the trusted epic-server keys AFTER the worker environment builder ran,
|
|
115
|
+
* like the job tag. Any ambient copy is removed first. Local contexts also raise
|
|
116
|
+
* the harness command ceiling to {@link epicServerAcquireCommandSeconds}. `disabled` returns the
|
|
117
|
+
* environment unchanged (the same object), so a repository without an opt-in is
|
|
118
|
+
* byte-identical.
|
|
119
|
+
*/
|
|
120
|
+
export function withEpicServerEnv(env, context) {
|
|
121
|
+
if (context.kind === "disabled")
|
|
122
|
+
return env;
|
|
123
|
+
const next = { ...env };
|
|
124
|
+
delete next[EPIC_SERVER_URL_ENV];
|
|
125
|
+
delete next[EPIC_SERVER_RUN_ID_ENV];
|
|
126
|
+
if (context.kind === "local_live" || context.kind === "local_unavailable") {
|
|
127
|
+
if (context.kind === "local_live")
|
|
128
|
+
next[EPIC_SERVER_URL_ENV] = context.url;
|
|
129
|
+
next[EPIC_SERVER_RUN_ID_ENV] = context.runId;
|
|
130
|
+
// Raise only the ceiling, never the default: the prompt names an explicit
|
|
131
|
+
// timeout for `turn acquire`, and every other command keeps the harness
|
|
132
|
+
// default. A higher ceiling already in the env is kept.
|
|
133
|
+
const needed = epicServerAcquireCommandSeconds(context) * 1000;
|
|
134
|
+
const current = Number(next[EPIC_SERVER_BASH_MAX_TIMEOUT_ENV]);
|
|
135
|
+
next[EPIC_SERVER_BASH_MAX_TIMEOUT_ENV] = String(Number.isSafeInteger(current) && current > needed ? current : needed);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
next[EPIC_SERVER_URL_ENV] = context.origin;
|
|
139
|
+
}
|
|
140
|
+
return next;
|
|
141
|
+
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* qualification. Like `ci_rerun` it is run-less and deterministic: no worker,
|
|
10
10
|
* no LLM, no worktrunk worktree, and no fallback to any of those.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
12
|
+
* Six properties are load-bearing:
|
|
13
13
|
*
|
|
14
14
|
* 1. **Validate before any effect.** Every payload rule in the cross-runtime
|
|
15
15
|
* contract — shape, bounds, every command digest and identity, the
|
|
@@ -43,13 +43,27 @@
|
|
|
43
43
|
* A command cut short by shutdown or lost ownership proved nothing about the
|
|
44
44
|
* gate, so it is reported as an inability (`GateQualificationInterrupted`)
|
|
45
45
|
* and never recorded as an unqualified gate.
|
|
46
|
+
*
|
|
47
|
+
* 6. **Dependencies are prepared exactly as a worker job would (BAPI-1637).**
|
|
48
|
+
* When the SEALED declaration carries `dependency_install`, the detached
|
|
49
|
+
* checkout is refreshed through the same `refreshDeclaredDependencies()` and
|
|
50
|
+
* install environment the worker pathway uses, after the clean-checkout check
|
|
51
|
+
* and before any command. A completed preparation failure is a COMPLETED job
|
|
52
|
+
* (`outcome: "failed"`, `dependency_preparation: "failed"`, every command
|
|
53
|
+
* `not_run`), distinct from an interruption, which still reports no result. A
|
|
54
|
+
* declaration without the key performs no installation work at all and its
|
|
55
|
+
* result keeps exactly the pre-existing shape (no `dependency_preparation`).
|
|
56
|
+
* Every message and fact stays value-free: no install output, path, argv, or
|
|
57
|
+
* environment value.
|
|
46
58
|
*/
|
|
47
59
|
import { createHash } from "node:crypto";
|
|
48
60
|
import { mkdtemp, rm } from "node:fs/promises";
|
|
49
61
|
import os from "node:os";
|
|
50
62
|
import path from "node:path";
|
|
51
63
|
import { validateBranchName } from "../base-ref.js";
|
|
52
|
-
import {
|
|
64
|
+
import { parseDependencyInstallStrict, } from "../dependency-install-declarations.js";
|
|
65
|
+
import { refreshDeclaredDependencies } from "./dependency-refresh.js";
|
|
66
|
+
import { buildDependencyInstallEnv, buildExecutorBaseWorkerEnv } from "./env.js";
|
|
53
67
|
import { ARTIFACT_GIT_TIMEOUT_MS, OWNERSHIP_POLL_MS, canonicalJson, createSupervisedCommandLauncher, preCheckArtifactState, runRequiredVerificationCommands, toCompletionCheckFact, } from "./required-verification.js";
|
|
54
68
|
import { GATE_QUALIFICATION_CAPABILITY, } from "./types.js";
|
|
55
69
|
// ---------------------------------------------------------------------------
|
|
@@ -210,6 +224,17 @@ export function parseGateQualificationPayload(job) {
|
|
|
210
224
|
digests.some((value, index) => value !== commands[index].digest)) {
|
|
211
225
|
return refuse(MESSAGES.contract);
|
|
212
226
|
}
|
|
227
|
+
// BAPI-1637: the install declaration is read from the SIGNED body only, with
|
|
228
|
+
// the same whole-list strictness the server applies. The lenient admission the
|
|
229
|
+
// worker pathway uses would silently drop a rejected entry and so run a
|
|
230
|
+
// different declaration from the one the server sealed.
|
|
231
|
+
let dependencyInstallOption = {};
|
|
232
|
+
if (Object.prototype.hasOwnProperty.call(envelope, "dependency_install")) {
|
|
233
|
+
const entries = parseDependencyInstallStrict(envelope.dependency_install);
|
|
234
|
+
if (entries === null)
|
|
235
|
+
return refuse(MESSAGES.contract);
|
|
236
|
+
dependencyInstallOption = { dependencyInstall: entries };
|
|
237
|
+
}
|
|
213
238
|
// The envelope digest covers the object exactly as received, minus its own
|
|
214
239
|
// digest key, so any field the server signed is checked byte for byte.
|
|
215
240
|
const { digest, ...signed } = envelope;
|
|
@@ -227,6 +252,7 @@ export function parseGateQualificationPayload(job) {
|
|
|
227
252
|
workerEnvOption: Object.prototype.hasOwnProperty.call(envelope, "worker_env")
|
|
228
253
|
? { workerEnv: envelope.worker_env }
|
|
229
254
|
: {},
|
|
255
|
+
dependencyInstallOption,
|
|
230
256
|
},
|
|
231
257
|
};
|
|
232
258
|
}
|
|
@@ -313,6 +339,24 @@ function isInterruptionFact(fact) {
|
|
|
313
339
|
fact.reason === "executor_cancelled" ||
|
|
314
340
|
fact.reason === "ownership_lost");
|
|
315
341
|
}
|
|
342
|
+
/**
|
|
343
|
+
* Fold what was observed into one classification, by fixed precedence:
|
|
344
|
+
* interruption, preparation failure, any `launch_error`/`spawn_failed` fact, any
|
|
345
|
+
* other unsuccessful or not-run fact, then passed. The server derives the same
|
|
346
|
+
* phase from the stored result; the completion envelope carries no `phase`.
|
|
347
|
+
*/
|
|
348
|
+
export function foldGateQualificationOutcome(input) {
|
|
349
|
+
if (input.facts.some(isInterruptionFact))
|
|
350
|
+
return "interrupted";
|
|
351
|
+
if (input.preparationFailed === true)
|
|
352
|
+
return "dependency_preparation_failed";
|
|
353
|
+
if (input.facts.some((fact) => fact.outcome === "launch_error" || fact.reason === "spawn_failed")) {
|
|
354
|
+
return "could_not_start";
|
|
355
|
+
}
|
|
356
|
+
if (input.facts.some((fact) => fact.outcome !== "exited_zero"))
|
|
357
|
+
return "ran_and_failed";
|
|
358
|
+
return "passed";
|
|
359
|
+
}
|
|
316
360
|
/**
|
|
317
361
|
* Run one `gate_qualification` job.
|
|
318
362
|
*
|
|
@@ -374,9 +418,10 @@ export async function runGateQualificationJob(job, input, deps) {
|
|
|
374
418
|
const timeoutMs = input.timeoutSeconds * 1000;
|
|
375
419
|
const deadlineAtMs = startedAt + Math.max(0, timeoutMs - GATE_QUALIFICATION_DEADLINE_RESERVE_MS);
|
|
376
420
|
const ownershipHeld = deps.ownershipHeld ?? (() => true);
|
|
377
|
-
// Ownership is re-checked WHILE
|
|
378
|
-
// exactly as the covered lane does: a lost claim terminates
|
|
379
|
-
//
|
|
421
|
+
// Ownership is re-checked WHILE preparation and each command run, not only
|
|
422
|
+
// between commands, exactly as the covered lane does: a lost claim terminates
|
|
423
|
+
// the running work. The supervisor's own abort (timeout, stop) is chained in
|
|
424
|
+
// too. One scope covers dependency preparation and verification.
|
|
380
425
|
const commandAbort = new AbortController();
|
|
381
426
|
const onOuterAbort = () => commandAbort.abort();
|
|
382
427
|
if (input.signal.aborted)
|
|
@@ -394,10 +439,6 @@ export async function runGateQualificationJob(job, input, deps) {
|
|
|
394
439
|
}, OWNERSHIP_POLL_MS);
|
|
395
440
|
};
|
|
396
441
|
watchOwnership();
|
|
397
|
-
// BAPI-1521 — the effective environment is built here, AFTER the envelope was
|
|
398
|
-
// verified and BEFORE any command runs, from the sealed declaration. The
|
|
399
|
-
// injected dependencies are never mutated.
|
|
400
|
-
const commandEnv = deps.commandEnv ?? buildGateQualificationEnv(deps.baseEnv ?? {}, payload.workerEnvOption);
|
|
401
442
|
const commands = payload.commands.map((command) => ({
|
|
402
443
|
identity: command.identity,
|
|
403
444
|
position: command.position,
|
|
@@ -405,20 +446,71 @@ export async function runGateQualificationJob(job, input, deps) {
|
|
|
405
446
|
argv: command.argv,
|
|
406
447
|
timeoutSeconds: command.timeoutSeconds,
|
|
407
448
|
}));
|
|
408
|
-
|
|
449
|
+
const dependencyInstall = payload.dependencyInstallOption.dependencyInstall;
|
|
450
|
+
const installDeclared = dependencyInstall !== undefined;
|
|
451
|
+
let preparationFailed = false;
|
|
452
|
+
let facts = [];
|
|
409
453
|
try {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
454
|
+
// BAPI-1637 — dependency preparation, only when the sealed declaration
|
|
455
|
+
// carries entries: after the clean-checkout check, before any command. A
|
|
456
|
+
// declaration without the key (or with an empty list) performs no
|
|
457
|
+
// installation-specific filesystem or process operation.
|
|
458
|
+
if (dependencyInstall !== undefined && dependencyInstall.length > 0) {
|
|
459
|
+
const refresh = deps.refreshDependencies ?? refreshDeclaredDependencies;
|
|
460
|
+
const refreshed = await refresh({
|
|
461
|
+
jobId: "gate-qualification",
|
|
462
|
+
entries: dependencyInstall,
|
|
463
|
+
worktreePath: dir,
|
|
464
|
+
mainCheckoutPath: deps.repoRoot,
|
|
465
|
+
// The install environment is NOT the command environment: it never
|
|
466
|
+
// gains the forced `CI=1` the qualification commands run under.
|
|
467
|
+
env: buildDependencyInstallEnv(deps.baseEnv ?? {}, Object.prototype.hasOwnProperty.call(payload.workerEnvOption, "workerEnv")
|
|
468
|
+
? { worker_env: payload.workerEnvOption.workerEnv }
|
|
469
|
+
: {}),
|
|
470
|
+
remainingMs: deadlineAtMs - deps.now(),
|
|
471
|
+
now: deps.now,
|
|
472
|
+
sleep: deps.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms))),
|
|
473
|
+
signal: commandAbort.signal,
|
|
474
|
+
log: (message) => deps.errorLog(message),
|
|
475
|
+
...(deps.platform ? { platform: deps.platform } : {}),
|
|
476
|
+
...(deps.runDependencyInstall ? { runInstall: deps.runDependencyInstall } : {}),
|
|
477
|
+
});
|
|
478
|
+
// A cancelled refresh proved nothing about the gate: an inability.
|
|
479
|
+
if (refreshed.cancelled)
|
|
480
|
+
return inability(GATE_QUALIFICATION_INTERRUPTED, MESSAGES.interrupted);
|
|
481
|
+
preparationFailed = refreshed.stale.length > 0;
|
|
482
|
+
}
|
|
483
|
+
if (preparationFailed) {
|
|
484
|
+
// The install did not complete, so nothing was launched. One bounded
|
|
485
|
+
// `not_run` fact per declared command, in declaration order.
|
|
486
|
+
facts = commands.map((command) => ({
|
|
487
|
+
identity: command.identity,
|
|
488
|
+
position: command.position,
|
|
489
|
+
name: command.name,
|
|
490
|
+
outcome: "not_run",
|
|
491
|
+
reason: null,
|
|
492
|
+
durationMs: 0,
|
|
493
|
+
output: "",
|
|
494
|
+
}));
|
|
495
|
+
}
|
|
496
|
+
else {
|
|
497
|
+
// BAPI-1521 — the effective environment is built here, AFTER the envelope
|
|
498
|
+
// was verified and BEFORE any command runs, from the sealed declaration.
|
|
499
|
+
// The injected dependencies are never mutated.
|
|
500
|
+
const commandEnv = deps.commandEnv ?? buildGateQualificationEnv(deps.baseEnv ?? {}, payload.workerEnvOption);
|
|
501
|
+
const run = await runRequiredVerificationCommands({
|
|
502
|
+
commands,
|
|
503
|
+
worktreePath: dir,
|
|
504
|
+
env: commandEnv,
|
|
505
|
+
launch: deps.launch,
|
|
506
|
+
now: deps.now,
|
|
507
|
+
deadlineAtMs,
|
|
508
|
+
signal: commandAbort.signal,
|
|
509
|
+
ownershipHeld,
|
|
510
|
+
onInterruption: "stop",
|
|
511
|
+
});
|
|
512
|
+
facts = run.facts;
|
|
513
|
+
}
|
|
422
514
|
}
|
|
423
515
|
finally {
|
|
424
516
|
if (watchTimer !== undefined)
|
|
@@ -433,20 +525,24 @@ export async function runGateQualificationJob(job, input, deps) {
|
|
|
433
525
|
}
|
|
434
526
|
}
|
|
435
527
|
// 5. An interruption proved nothing about the gate: an inability, never a
|
|
436
|
-
// completed "failed" that the server would record as unqualified.
|
|
437
|
-
|
|
528
|
+
// completed "failed" that the server would record as unqualified. A completed
|
|
529
|
+
// preparation failure, by contrast, IS a result.
|
|
530
|
+
const folded = foldGateQualificationOutcome({ facts, preparationFailed });
|
|
531
|
+
if (folded === "interrupted") {
|
|
438
532
|
return inability(GATE_QUALIFICATION_INTERRUPTED, MESSAGES.interrupted);
|
|
439
533
|
}
|
|
440
534
|
const resultFacts = facts.map(toResultFact);
|
|
441
|
-
const outcome = resultFacts.every((fact) => fact.outcome === "exited_zero") ? "passed" : "failed";
|
|
442
535
|
return {
|
|
443
536
|
ok: true,
|
|
444
537
|
result: {
|
|
445
538
|
schema_version: 1,
|
|
446
539
|
revision: payload.revision,
|
|
447
540
|
tested_head_sha: sha,
|
|
448
|
-
outcome,
|
|
541
|
+
outcome: folded === "passed" ? "passed" : "failed",
|
|
449
542
|
commands: resultFacts,
|
|
543
|
+
...(installDeclared
|
|
544
|
+
? { dependency_preparation: preparationFailed ? "failed" : "ready" }
|
|
545
|
+
: {}),
|
|
450
546
|
},
|
|
451
547
|
};
|
|
452
548
|
}
|
|
@@ -510,5 +606,10 @@ export function createProductionGateQualificationDeps(input) {
|
|
|
510
606
|
// stderr is the owner's own terminal, so it alone may show output tails.
|
|
511
607
|
showLocalOutput: options.jobTypes !== undefined && options.jobTypes.length > 0,
|
|
512
608
|
ownershipHeld: input.ownershipHeld,
|
|
609
|
+
// BAPI-1637: the same install runner, sleep, and platform the worker pathway
|
|
610
|
+
// uses, so a qualification prepares its checkout exactly as a worker would.
|
|
611
|
+
...(deps.runDependencyInstall ? { runDependencyInstall: deps.runDependencyInstall } : {}),
|
|
612
|
+
sleep: deps.sleep,
|
|
613
|
+
platform: deps.platform,
|
|
513
614
|
};
|
|
514
615
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { RECONCILER_LIVENESS_VALUES } from "./types.js";
|
|
11
11
|
import { EXECUTOR_REPORTABLE_END_CAUSE_VALUES, MAX_VERIFICATION_OBSERVATIONS, } from "./completion-contract.js";
|
|
12
|
-
import { readEpicRunCompletionState, } from "../conductor/bridge-api-client.js";
|
|
12
|
+
import { EPIC_CAPABILITY_STATEMENT_READ_TIMEOUT_MS, readEpicCapabilityStatement, readEpicRunCompletionState, } from "../conductor/bridge-api-client.js";
|
|
13
13
|
/** BAPI-1258 — the server's stable `error_code` for refused capacity evidence. */
|
|
14
14
|
export const UNSUPPORTED_TERMINAL_CAPACITY_ERROR_CODE = "UNSUPPORTED_TERMINAL_CAPACITY";
|
|
15
15
|
/**
|
|
@@ -56,9 +56,11 @@ function readDetailErrorCode(bodyText) {
|
|
|
56
56
|
*
|
|
57
57
|
* Mirrors {@link isCapacityEvidenceRefusal}'s shape, but is exported and NOT
|
|
58
58
|
* wired into `mapMutationResponse`: the mutation mapping stays unchanged (a 409
|
|
59
|
-
* still maps to `stale_claim` for every
|
|
60
|
-
*
|
|
61
|
-
*
|
|
59
|
+
* still maps to `stale_claim` for every other response). BAPI-1590: `complete()`
|
|
60
|
+
* alone asks, and marks the result `completionEvidenceRefused` so the job runner —
|
|
61
|
+
* which holds the envelope — can re-report once as `/fail` (the runner-owned
|
|
62
|
+
* `/fail` decision). A 409 `STALE_CLAIM` is never a refusal: the claim is gone and a
|
|
63
|
+
* re-send cannot help.
|
|
62
64
|
*/
|
|
63
65
|
export function isCompletionEvidenceRefusal(status, bodyText) {
|
|
64
66
|
if (status !== 409)
|
|
@@ -322,6 +324,24 @@ export function createExecutorHttpClient(config) {
|
|
|
322
324
|
// stay assignable) purely for the claim path's liveness annotation.
|
|
323
325
|
return { status: res.status, text, headers: res.headers };
|
|
324
326
|
}
|
|
327
|
+
/**
|
|
328
|
+
* BAPI-1590: `/complete` only. The exact 409 completion-evidence refusal is
|
|
329
|
+
* returned marked (carrier outcome `invalid_job_result`: terminal and never
|
|
330
|
+
* retried) instead of being read as a lost claim; every other response maps as
|
|
331
|
+
* before. Nothing from the response is retained.
|
|
332
|
+
*/
|
|
333
|
+
async function completeMutation(pathSuffix, body, repoName) {
|
|
334
|
+
try {
|
|
335
|
+
const { status, text } = await post(pathSuffix, body, repoName);
|
|
336
|
+
if (isCompletionEvidenceRefusal(status, text)) {
|
|
337
|
+
return { outcome: "invalid_job_result", completionEvidenceRefused: true };
|
|
338
|
+
}
|
|
339
|
+
return mapMutationResponse(status, text, true);
|
|
340
|
+
}
|
|
341
|
+
catch {
|
|
342
|
+
return { outcome: "fatal_http_error" };
|
|
343
|
+
}
|
|
344
|
+
}
|
|
325
345
|
async function mutate(pathSuffix, body, allowInvalidResult, repoName) {
|
|
326
346
|
try {
|
|
327
347
|
const { status, text } = await post(pathSuffix, body, repoName);
|
|
@@ -538,7 +558,7 @@ export function createExecutorHttpClient(config) {
|
|
|
538
558
|
...completionContractFields(job, completion),
|
|
539
559
|
...deliveryObservationFields(job, completion),
|
|
540
560
|
};
|
|
541
|
-
return
|
|
561
|
+
return completeMutation(`/${job.id}/complete`, body, job.repo_name);
|
|
542
562
|
},
|
|
543
563
|
async fail(job, failure) {
|
|
544
564
|
const body = {
|
|
@@ -600,5 +620,32 @@ export function createExecutorHttpClient(config) {
|
|
|
600
620
|
return { ok: false, reason: "network" };
|
|
601
621
|
}
|
|
602
622
|
},
|
|
623
|
+
/**
|
|
624
|
+
* BAPI-1545: the advisory capability statement, read once per
|
|
625
|
+
* implement-worker spawn. The adapted transport ignores the abort signal, so
|
|
626
|
+
* the short advisory timeout is enforced here with a race. Never throws;
|
|
627
|
+
* every failure is a reason the runner turns into "append nothing".
|
|
628
|
+
*/
|
|
629
|
+
async readEpicCapabilityStatement(repoName) {
|
|
630
|
+
const access = {
|
|
631
|
+
repoName,
|
|
632
|
+
apiKey: keyForRepo(repoName),
|
|
633
|
+
baseUrl: config.baseUrl,
|
|
634
|
+
};
|
|
635
|
+
let timer;
|
|
636
|
+
const timeout = new Promise((resolve) => {
|
|
637
|
+
timer = setTimeout(() => resolve({ ok: false, reason: "timeout" }), EPIC_CAPABILITY_STATEMENT_READ_TIMEOUT_MS);
|
|
638
|
+
});
|
|
639
|
+
try {
|
|
640
|
+
return await Promise.race([
|
|
641
|
+
readEpicCapabilityStatement(access, toConductorGetFetch(config.fetch)).catch(() => ({ ok: false, reason: "network" })),
|
|
642
|
+
timeout,
|
|
643
|
+
]);
|
|
644
|
+
}
|
|
645
|
+
finally {
|
|
646
|
+
if (timer !== undefined)
|
|
647
|
+
clearTimeout(timer);
|
|
648
|
+
}
|
|
649
|
+
},
|
|
603
650
|
};
|
|
604
651
|
}
|