spur-board 0.53.2 → 0.53.3
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/dist/{chunk-Z9DFhl-U.mjs → chunk-B81O9UQo.mjs} +1 -1
- package/dist/{chunk-BbwZCNQh.mjs → chunk-DSGruS1f.mjs} +2 -2
- package/dist/{chunk-DyHtyPom.mjs → chunk-DuSucVv4.mjs} +3 -1
- package/dist/cli.mjs +3 -3
- package/dist/client.mjs +1 -1
- package/dist/daemon.mjs +98 -28
- package/dist/mcp.mjs +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as errorEnvelopeSchema, Q as errorContextSchema, S as renderJsonError, X as ERRORS, c as tokenRequestStatusSchema, o as tokenRequestResultSchema, tt as successEnvelopeSchema } from "./chunk-
|
|
1
|
+
import { $ as errorEnvelopeSchema, Q as errorContextSchema, S as renderJsonError, X as ERRORS, c as tokenRequestStatusSchema, o as tokenRequestResultSchema, tt as successEnvelopeSchema } from "./chunk-DuSucVv4.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { request } from "node:http";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as buildCatalogSnapshot, ct as plainHttpAllowed, st as configSchema, y as OPERATIONS } from "./chunk-
|
|
2
|
-
import { o as CliError, t as fetchCatalogVersion } from "./chunk-
|
|
1
|
+
import { _ as buildCatalogSnapshot, ct as plainHttpAllowed, st as configSchema, y as OPERATIONS } from "./chunk-DuSucVv4.mjs";
|
|
2
|
+
import { o as CliError, t as fetchCatalogVersion } from "./chunk-B81O9UQo.mjs";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { closeSync, constants, fstatSync, lstatSync, mkdirSync, openSync, readFileSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { homedir } from "node:os";
|
|
@@ -1394,7 +1394,9 @@ const eventPayloadSchemas = {
|
|
|
1394
1394
|
task_submitted: z.looseObject({
|
|
1395
1395
|
turn: S.optional(),
|
|
1396
1396
|
column: z.enum(COLUMN_IDS),
|
|
1397
|
-
sha: S
|
|
1397
|
+
sha: S,
|
|
1398
|
+
/** The head was confirmed by the board's newest poll; GitHub did not answer the submit. */
|
|
1399
|
+
confirmedByPoll: z.literal(true).optional()
|
|
1398
1400
|
}),
|
|
1399
1401
|
task_moved: z.looseObject({
|
|
1400
1402
|
from: z.enum(COLUMN_IDS),
|
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { W as actorIdSchema, X as ERRORS, a as requestHashOf, ft as SLACK_BOT_SCOPES, lt as requiredSecretKeys, r as remoteDoctorReportSchema, st as configSchema, tt as successEnvelopeSchema, u as SYSTEMD_SERVICE_SETTINGS, v as roleCanUseOperation, y as OPERATIONS } from "./chunk-
|
|
1
|
+
import { W as actorIdSchema, X as ERRORS, a as requestHashOf, ft as SLACK_BOT_SCOPES, lt as requiredSecretKeys, r as remoteDoctorReportSchema, st as configSchema, tt as successEnvelopeSchema, u as SYSTEMD_SERVICE_SETTINGS, v as roleCanUseOperation, y as OPERATIONS } from "./chunk-DuSucVv4.mjs";
|
|
2
2
|
import { t as apiBaseUrl } from "./chunk-DAMwWWmT.mjs";
|
|
3
|
-
import { a as requestTokenEnrollment, c as renderCliError, i as requestSkillReload, l as escapeTerminalControls, n as fetchTokenStatus, o as CliError, r as requestOperation, s as errorExitCode } from "./chunk-
|
|
4
|
-
import { a as memoryVerdictCache, c as loadClientConfig, d as resolveDaemonAddress, f as tokenInFolder, i as fileVerdictCache, l as loadEnrollmentConfig, n as cliPackageVersion, o as configFile, s as dataDirectory, t as checkCatalog, u as readConfiguredPort } from "./chunk-
|
|
3
|
+
import { a as requestTokenEnrollment, c as renderCliError, i as requestSkillReload, l as escapeTerminalControls, n as fetchTokenStatus, o as CliError, r as requestOperation, s as errorExitCode } from "./chunk-B81O9UQo.mjs";
|
|
4
|
+
import { a as memoryVerdictCache, c as loadClientConfig, d as resolveDaemonAddress, f as tokenInFolder, i as fileVerdictCache, l as loadEnrollmentConfig, n as cliPackageVersion, o as configFile, s as dataDirectory, t as checkCatalog, u as readConfiguredPort } from "./chunk-DSGruS1f.mjs";
|
|
5
5
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
6
6
|
import { accessSync, chmodSync, closeSync, constants, cpSync, existsSync, ftruncateSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
7
7
|
import { homedir, hostname, userInfo } from "node:os";
|
package/dist/client.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as requestTokenEnrollment, i as requestSkillReload, n as fetchTokenStatus, r as requestOperation, t as fetchCatalogVersion } from "./chunk-
|
|
1
|
+
import { a as requestTokenEnrollment, i as requestSkillReload, n as fetchTokenStatus, r as requestOperation, t as fetchCatalogVersion } from "./chunk-B81O9UQo.mjs";
|
|
2
2
|
export { fetchCatalogVersion, fetchTokenStatus, requestOperation, requestSkillReload, requestTokenEnrollment };
|
package/dist/daemon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as EVENT_KINDS, B as sessionFactsSchema, D as interactionRefSchema, E as inboundEventSchema, F as isExternalAuthor, G as encodeActorId, H as JIRA_PROJECT_KEY, I as parseRingMarker, J as parseRef$1, K as errorCodeOf, L as prFactsSchema, M as REVIEW_STATES, N as SESSION_HEALTH_STATES, O as messageRefSchema, P as SESSION_STATUSES, R as prRefSchema, T as conversationRefSchema, U as REF_NUMBER, V as ticketFactsSchema, W as actorIdSchema, X as ERRORS, Y as taskKeySchema, Z as err, _ as buildCatalogSnapshot, a as requestHashOf, at as DEFAULT_SLACK_COMMAND, b as turnHandedSchema, c as tokenRequestStatusSchema, ct as plainHttpAllowed, d as AdapterError, dt as DISPATCHER_MODES, et as ok, f as batchSchema, ft as SLACK_BOT_SCOPES, g as trackerSourceId, h as sourceCursorSchema, i as TOKEN_REQUEST_LIMITS, j as eventPayloadSchemas, k as userIdSchema, l as BOARD_TICK_MS, lt as requiredSecretKeys, m as prSourceId, n as doctorReportSchema, o as tokenRequestResultSchema, ot as RESERVED_PROJECT, p as entityRefSchema, q as parseActorId, rt as DEFAULT_LINK, s as tokenRequestSchema, st as configSchema, t as assertNever, tt as successEnvelopeSchema, ut as COLUMN_IDS, v as roleCanUseOperation, w as SPACE_IDS, x as renderHttpProblem, y as OPERATIONS, z as ringMarker } from "./chunk-
|
|
1
|
+
import { A as EVENT_KINDS, B as sessionFactsSchema, D as interactionRefSchema, E as inboundEventSchema, F as isExternalAuthor, G as encodeActorId, H as JIRA_PROJECT_KEY, I as parseRingMarker, J as parseRef$1, K as errorCodeOf, L as prFactsSchema, M as REVIEW_STATES, N as SESSION_HEALTH_STATES, O as messageRefSchema, P as SESSION_STATUSES, R as prRefSchema, T as conversationRefSchema, U as REF_NUMBER, V as ticketFactsSchema, W as actorIdSchema, X as ERRORS, Y as taskKeySchema, Z as err, _ as buildCatalogSnapshot, a as requestHashOf, at as DEFAULT_SLACK_COMMAND, b as turnHandedSchema, c as tokenRequestStatusSchema, ct as plainHttpAllowed, d as AdapterError, dt as DISPATCHER_MODES, et as ok, f as batchSchema, ft as SLACK_BOT_SCOPES, g as trackerSourceId, h as sourceCursorSchema, i as TOKEN_REQUEST_LIMITS, j as eventPayloadSchemas, k as userIdSchema, l as BOARD_TICK_MS, lt as requiredSecretKeys, m as prSourceId, n as doctorReportSchema, o as tokenRequestResultSchema, ot as RESERVED_PROJECT, p as entityRefSchema, q as parseActorId, rt as DEFAULT_LINK, s as tokenRequestSchema, st as configSchema, t as assertNever, tt as successEnvelopeSchema, ut as COLUMN_IDS, v as roleCanUseOperation, w as SPACE_IDS, x as renderHttpProblem, y as OPERATIONS, z as ringMarker } from "./chunk-DuSucVv4.mjs";
|
|
2
2
|
import { t as apiBaseUrl } from "./chunk-DAMwWWmT.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -14822,6 +14822,16 @@ function shadowSummary(kind, payloadText) {
|
|
|
14822
14822
|
return null;
|
|
14823
14823
|
}
|
|
14824
14824
|
}
|
|
14825
|
+
/** The summary of a submit whose head the board's newest poll confirmed. */
|
|
14826
|
+
function submitSummary(kind, payloadText) {
|
|
14827
|
+
if (kind !== "task_submitted") return null;
|
|
14828
|
+
try {
|
|
14829
|
+
const payload = eventPayloadSchemas[kind].safeParse(JSON.parse(payloadText));
|
|
14830
|
+
return payload.success && payload.data.confirmedByPoll === true ? "Turn submitted on the head of the last poll" : null;
|
|
14831
|
+
} catch {
|
|
14832
|
+
return null;
|
|
14833
|
+
}
|
|
14834
|
+
}
|
|
14825
14835
|
function projectTarget(project) {
|
|
14826
14836
|
return {
|
|
14827
14837
|
kind: "found",
|
|
@@ -14945,7 +14955,7 @@ function createTaskQueries(deps) {
|
|
|
14945
14955
|
at: row.at,
|
|
14946
14956
|
kind,
|
|
14947
14957
|
actor: eventActor(row),
|
|
14948
|
-
summary: linkSummary(kind, row.payload) ?? shadowSummary(kind, row.payload) ?? EVENT_SUMMARIES[kind]
|
|
14958
|
+
summary: linkSummary(kind, row.payload) ?? shadowSummary(kind, row.payload) ?? submitSummary(kind, row.payload) ?? EVENT_SUMMARIES[kind]
|
|
14949
14959
|
}];
|
|
14950
14960
|
});
|
|
14951
14961
|
return {
|
|
@@ -15131,25 +15141,49 @@ async function takenTurn(trx, id, ctx) {
|
|
|
15131
15141
|
task
|
|
15132
15142
|
};
|
|
15133
15143
|
}
|
|
15144
|
+
/** Ends a hint for a refusal that a later submit cannot fix. */
|
|
15145
|
+
const noRepeat = (step) => `repeating will not help; ask the operator to ${step}.`;
|
|
15146
|
+
/** The next step for an on-demand poll that answered nothing. */
|
|
15134
15147
|
function pollErrorHint(error, pr) {
|
|
15135
15148
|
switch (error.kind) {
|
|
15136
|
-
case "timeout": return `GitHub did not answer for ${pr} within ${String(SUBMIT_POLL_TIMEOUT_MS / 1e3)} s; wait, then submit again.`;
|
|
15137
|
-
case "blind": return `The board cannot read ${pr} (${error.reason});
|
|
15138
|
-
case "failed":
|
|
15149
|
+
case "timeout": return `GitHub did not answer for ${pr} within ${String(SUBMIT_POLL_TIMEOUT_MS / 1e3)} s; wait a minute, then submit again.`;
|
|
15150
|
+
case "blind": return error.reason === "stale" ? `The board has no recent complete GitHub poll for ${pr}; submit again in a few minutes, once GitHub answers its polls.` : `The board cannot read ${pr} (${error.reason}); ${noRepeat("fix the GitHub access")}`;
|
|
15151
|
+
case "failed":
|
|
15152
|
+
if (error.adapterKind === "auth" || error.adapterKind === "config") return `The board cannot read ${pr} (${error.adapterKind}); ${noRepeat("fix the GitHub access")}`;
|
|
15153
|
+
return error.retryAt === void 0 ? `The GitHub poll of ${pr} failed (${error.adapterKind}); wait a minute, then submit again.` : `GitHub is throttled until ${error.retryAt}; submit again after that.`;
|
|
15139
15154
|
case "stopped": return "The GitHub poller is not running; submit again once the daemon is up.";
|
|
15140
|
-
case "unknown_source": return `The repo of ${pr} is not in the project's repos;
|
|
15141
|
-
case "unsupported": return
|
|
15155
|
+
case "unknown_source": return `The repo of ${pr} is not in the project's repos; ${noRepeat("add it to the config")}`;
|
|
15156
|
+
case "unsupported": return `This daemon cannot poll a pull request on demand; ${noRepeat("update the daemon")}`;
|
|
15142
15157
|
}
|
|
15143
15158
|
}
|
|
15144
|
-
/**
|
|
15145
|
-
function
|
|
15159
|
+
/** True when GitHub gave no answer this call and the last poll may stand in for it. */
|
|
15160
|
+
function pollMayConfirm(error) {
|
|
15161
|
+
return error.kind === "timeout" || error.kind === "failed" && (error.adapterKind === "transient" || error.adapterKind === "unexpected" || error.adapterKind === "throttled");
|
|
15162
|
+
}
|
|
15163
|
+
/**
|
|
15164
|
+
* How the PR head behind a submit is confirmed: `live` by this call's poll, `poll` by the
|
|
15165
|
+
* board's newest poll when GitHub did not answer. Throws `head_mismatch` when the confirmed head
|
|
15166
|
+
* is not `sha`, `github_unavailable` when nothing confirms it.
|
|
15167
|
+
*/
|
|
15168
|
+
function confirmHead(input) {
|
|
15169
|
+
const { prepared, pr, sha, snapshot, completeAt } = input;
|
|
15146
15170
|
const label = `${pr.repo}#${String(pr.number)}`;
|
|
15147
15171
|
const unavailable = (hint) => new CommandError("github_unavailable", hint);
|
|
15148
15172
|
if (prepared?.kind !== "polled" || prepared.repo !== pr.repo.toLowerCase() || prepared.number !== pr.number) throw unavailable(`The board did not poll ${label} for this call; submit again.`);
|
|
15149
15173
|
const { result } = prepared;
|
|
15150
|
-
if (result === null) throw unavailable(
|
|
15151
|
-
if (!result.ok)
|
|
15152
|
-
|
|
15174
|
+
if (result === null) throw unavailable(`This daemon runs no GitHub poller; ${noRepeat("check the daemon")}`);
|
|
15175
|
+
if (!result.ok) {
|
|
15176
|
+
const hint = pollErrorHint(result.error, label);
|
|
15177
|
+
if (!pollMayConfirm(result.error)) throw unavailable(hint);
|
|
15178
|
+
if (completeAt === void 0) throw unavailable(`${hint} The board has had no complete GitHub poll since it started.`);
|
|
15179
|
+
if (snapshot === void 0) throw unavailable(`${hint} The board has not seen the head of ${label} yet.`);
|
|
15180
|
+
if (Date.parse(snapshot.observed_at) < Date.parse(completeAt)) throw unavailable(`${hint} The board last saw head ${snapshot.head_sha} at ${snapshot.observed_at}, before its last complete GitHub poll.`);
|
|
15181
|
+
if (snapshot.head_sha.toLowerCase() !== sha) throw unavailable(`${hint} Its last poll saw head ${snapshot.head_sha}.`);
|
|
15182
|
+
return "poll";
|
|
15183
|
+
}
|
|
15184
|
+
if (result.value.status !== "ok") throw unavailable(`GitHub answered ${result.value.status} for ${label}; ${noRepeat("check the board's GitHub access")}`);
|
|
15185
|
+
if (snapshot?.head_sha.toLowerCase() !== sha) throw new CommandError("head_mismatch", `The head of ${label} is ${snapshot?.head_sha ?? "unknown"}; push the commit, then submit the head.`);
|
|
15186
|
+
return "live";
|
|
15153
15187
|
}
|
|
15154
15188
|
/** Polls the task's PR on demand for a submit; `skipped` when the task has none. */
|
|
15155
15189
|
async function pollTaskPr(db, task, poll) {
|
|
@@ -15169,16 +15203,21 @@ async function pollTaskPr(db, task, poll) {
|
|
|
15169
15203
|
};
|
|
15170
15204
|
}
|
|
15171
15205
|
/**
|
|
15172
|
-
* Records the submit of `sha` for the task's `column` visit `epoch
|
|
15173
|
-
* `
|
|
15206
|
+
* Records the submit of `sha` for the task's `column` visit `epoch` and says how its head was
|
|
15207
|
+
* confirmed (`confirmHead`). Throws `head_mismatch` or `github_unavailable` otherwise.
|
|
15174
15208
|
*/
|
|
15175
|
-
async function insertSubmission(trx, input, ctx) {
|
|
15209
|
+
async function insertSubmission(trx, input, ctx, completeSince) {
|
|
15176
15210
|
const { task, column, epoch, sha } = input;
|
|
15177
15211
|
const pr = await taskPr(trx, task.id);
|
|
15178
15212
|
if (pr === null) throw new CommandError("head_mismatch", "The task has no active pull request; ask the operator to link it with `board link`, then submit its head.");
|
|
15179
|
-
|
|
15180
|
-
const
|
|
15181
|
-
|
|
15213
|
+
const snapshot = await trx.selectFrom("pr_snapshot").select(["head_sha", "observed_at"]).where(sql`lower(repo) = ${pr.repo.toLowerCase()}`).where("number", "=", pr.number).executeTakeFirst();
|
|
15214
|
+
const confirmed = confirmHead({
|
|
15215
|
+
prepared: ctx.prepared,
|
|
15216
|
+
pr,
|
|
15217
|
+
sha,
|
|
15218
|
+
snapshot,
|
|
15219
|
+
completeAt: completeSince.get(prSourceId(task.project, pr.repo))
|
|
15220
|
+
});
|
|
15182
15221
|
await trx.insertInto("submission").values({
|
|
15183
15222
|
task_id: task.id,
|
|
15184
15223
|
column,
|
|
@@ -15190,7 +15229,10 @@ async function insertSubmission(trx, input, ctx) {
|
|
|
15190
15229
|
pr_repo: pr.repo,
|
|
15191
15230
|
pr_number: pr.number
|
|
15192
15231
|
}).execute();
|
|
15232
|
+
return confirmed;
|
|
15193
15233
|
}
|
|
15234
|
+
/** The `task_submitted` payload mark of a head confirmed by the board's last poll. */
|
|
15235
|
+
const confirmation = (confirmed) => confirmed === "poll" ? { confirmedByPoll: true } : {};
|
|
15194
15236
|
/**
|
|
15195
15237
|
* The executor's submit and return of a turn it took, the turnless shadow submit, and the
|
|
15196
15238
|
* operator's column correction.
|
|
@@ -15212,15 +15254,16 @@ function createTurnMutations(deps) {
|
|
|
15212
15254
|
if (task.membership === "archived") throw new CommandError("task_archived", "Add the task again before changing it.");
|
|
15213
15255
|
const column = shadowColumn(task);
|
|
15214
15256
|
if (!await executesShadowColumn(trx, task, ctx.actor, config)) throw new CommandError("forbidden", `Only the executor of ${column} submits this task while the dispatcher is in shadow mode.`);
|
|
15215
|
-
await insertSubmission(trx, {
|
|
15257
|
+
const confirmed = await insertSubmission(trx, {
|
|
15216
15258
|
task,
|
|
15217
15259
|
column,
|
|
15218
15260
|
epoch: task.column_epoch,
|
|
15219
15261
|
sha: input.sha
|
|
15220
|
-
}, ctx);
|
|
15262
|
+
}, ctx, completeSince);
|
|
15221
15263
|
await emit(trx, "task_submitted", task.project, task.id, ctx.at, {
|
|
15222
15264
|
column,
|
|
15223
|
-
sha: input.sha
|
|
15265
|
+
sha: input.sha,
|
|
15266
|
+
...confirmation(confirmed)
|
|
15224
15267
|
}, ctx.actor);
|
|
15225
15268
|
return {
|
|
15226
15269
|
task: taskView(await dispatched(trx, task.id, ctx.at)),
|
|
@@ -15247,12 +15290,12 @@ function createTurnMutations(deps) {
|
|
|
15247
15290
|
async run(trx, input, ctx) {
|
|
15248
15291
|
if (!isTurnId(input.turn)) return submitShadow(trx, input, ctx);
|
|
15249
15292
|
const { turn, task } = await takenTurn(trx, input.turn, ctx);
|
|
15250
|
-
await insertSubmission(trx, {
|
|
15293
|
+
const confirmed = await insertSubmission(trx, {
|
|
15251
15294
|
task,
|
|
15252
15295
|
column: turn.column,
|
|
15253
15296
|
epoch: turn.epoch,
|
|
15254
15297
|
sha: input.sha
|
|
15255
|
-
}, ctx);
|
|
15298
|
+
}, ctx, completeSince);
|
|
15256
15299
|
await closeTurns(trx, {
|
|
15257
15300
|
taskId: task.id,
|
|
15258
15301
|
reason: "submitted",
|
|
@@ -15261,7 +15304,8 @@ function createTurnMutations(deps) {
|
|
|
15261
15304
|
await emit(trx, "task_submitted", task.project, task.id, ctx.at, {
|
|
15262
15305
|
turn: input.turn,
|
|
15263
15306
|
column: turn.column,
|
|
15264
|
-
sha: input.sha
|
|
15307
|
+
sha: input.sha,
|
|
15308
|
+
...confirmation(confirmed)
|
|
15265
15309
|
}, ctx.actor);
|
|
15266
15310
|
return {
|
|
15267
15311
|
task: taskView(await dispatched(trx, task.id, ctx.at)),
|
|
@@ -19602,6 +19646,8 @@ function applyEntityOutcomes(input) {
|
|
|
19602
19646
|
//#region ../adapters/src/runner/runner.ts
|
|
19603
19647
|
/** The setTimeout limit: a longer delay would otherwise fire after 1 ms. */
|
|
19604
19648
|
const MAX_TIMER_MS = 2147483647;
|
|
19649
|
+
/** Waits before the second and third attempt of an on-demand poll after a transient failure. */
|
|
19650
|
+
const DEMAND_RETRY_WAITS_MS = [1e3, 2e3];
|
|
19605
19651
|
function startRunner(options) {
|
|
19606
19652
|
const startedAt = options.now();
|
|
19607
19653
|
const sources = options.entries.map((entry) => runSource(entry, options, startedAt));
|
|
@@ -19843,8 +19889,11 @@ function runSource(entry, options, runnerStartMs) {
|
|
|
19843
19889
|
if (!options.oneShot) schedule(delay.delayMs);
|
|
19844
19890
|
return outcome;
|
|
19845
19891
|
}
|
|
19846
|
-
/**
|
|
19847
|
-
|
|
19892
|
+
/**
|
|
19893
|
+
* One on-demand request at its turn on the chain; `live` is false once its caller left.
|
|
19894
|
+
* `retryable` is called before it returns a `transient` failure of the `poll` step.
|
|
19895
|
+
*/
|
|
19896
|
+
async function demandTurn(ref, abort, live, observing, retryable) {
|
|
19848
19897
|
if (stopping) return err(stoppedError);
|
|
19849
19898
|
if (!live()) return;
|
|
19850
19899
|
const startMs = now();
|
|
@@ -19924,6 +19973,7 @@ function runSource(entry, options, runnerStartMs) {
|
|
|
19924
19973
|
} catch (error) {
|
|
19925
19974
|
if (aborted()) return err(stoppedError);
|
|
19926
19975
|
fail(step, error);
|
|
19976
|
+
if (step === "poll" && error instanceof AdapterError && error.kind === "transient") retryable();
|
|
19927
19977
|
const retryAt = throttledRetryAt(error);
|
|
19928
19978
|
return err({
|
|
19929
19979
|
kind: "failed",
|
|
@@ -19941,12 +19991,17 @@ function runSource(entry, options, runnerStartMs) {
|
|
|
19941
19991
|
if (stopping) return Promise.resolve(err(stoppedError));
|
|
19942
19992
|
return new Promise((resolve) => {
|
|
19943
19993
|
const abort = new AbortController();
|
|
19994
|
+
const deadlineMs = now() + timeoutMs;
|
|
19944
19995
|
let settled = false;
|
|
19945
19996
|
let observing = false;
|
|
19997
|
+
let attempts = 0;
|
|
19998
|
+
let retryTimer;
|
|
19946
19999
|
const settle = (result) => {
|
|
19947
20000
|
if (settled) return;
|
|
19948
20001
|
settled = true;
|
|
19949
20002
|
clearTimeout(timer);
|
|
20003
|
+
clearTimeout(retryTimer);
|
|
20004
|
+
retryTimer = void 0;
|
|
19950
20005
|
pending.delete(cancel);
|
|
19951
20006
|
resolve(result);
|
|
19952
20007
|
};
|
|
@@ -19964,12 +20019,27 @@ function runSource(entry, options, runnerStartMs) {
|
|
|
19964
20019
|
}));
|
|
19965
20020
|
abort.abort();
|
|
19966
20021
|
}, timeoutMs);
|
|
19967
|
-
run(async () => {
|
|
20022
|
+
const attempt = () => run(async () => {
|
|
20023
|
+
let retry = false;
|
|
20024
|
+
const transient = () => retry;
|
|
19968
20025
|
const result = await demandTurn(ref, abort, () => !settled, () => {
|
|
19969
20026
|
observing = true;
|
|
20027
|
+
}, () => {
|
|
20028
|
+
retry = true;
|
|
19970
20029
|
});
|
|
19971
|
-
if (result
|
|
20030
|
+
if (result === void 0) return;
|
|
20031
|
+
const waitMs = DEMAND_RETRY_WAITS_MS[attempts];
|
|
20032
|
+
attempts += 1;
|
|
20033
|
+
if (transient() && waitMs !== void 0 && !settled && now() + waitMs < deadlineMs) {
|
|
20034
|
+
retryTimer = setTimeout(() => {
|
|
20035
|
+
retryTimer = void 0;
|
|
20036
|
+
attempt();
|
|
20037
|
+
}, waitMs);
|
|
20038
|
+
return;
|
|
20039
|
+
}
|
|
20040
|
+
settle(result);
|
|
19972
20041
|
});
|
|
20042
|
+
attempt();
|
|
19973
20043
|
});
|
|
19974
20044
|
}
|
|
19975
20045
|
if (!options.oneShot) armDeadline();
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as renderMcpError, X as ERRORS, y as OPERATIONS } from "./chunk-
|
|
2
|
-
import { o as CliError, r as requestOperation } from "./chunk-
|
|
3
|
-
import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-
|
|
1
|
+
import { C as renderMcpError, X as ERRORS, y as OPERATIONS } from "./chunk-DuSucVv4.mjs";
|
|
2
|
+
import { o as CliError, r as requestOperation } from "./chunk-B81O9UQo.mjs";
|
|
3
|
+
import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-DSGruS1f.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { z } from "zod";
|