spur-board 0.71.0 → 0.72.0
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-DlDngVbH.mjs → chunk-BRdjSAl1.mjs} +2 -2
- package/dist/{chunk-BPwdLTBv.mjs → chunk-Di9QGxO1.mjs} +6 -0
- package/dist/{chunk-B1u_eWSX.mjs → chunk-QCOwDTOu.mjs} +1 -1
- package/dist/cli.mjs +3 -3
- package/dist/client.mjs +1 -1
- package/dist/daemon.mjs +38 -15
- package/dist/mcp.mjs +3 -3
- package/dist/migrations/0023_source_budget.sql +5 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as buildCatalogSnapshot, dt as configSchema, p as OPERATIONS, pt as plainHttpAllowed } from "./chunk-
|
|
2
|
-
import { o as CliError, t as fetchCatalogVersion } from "./chunk-
|
|
1
|
+
import { d as buildCatalogSnapshot, dt as configSchema, p as OPERATIONS, pt as plainHttpAllowed } from "./chunk-Di9QGxO1.mjs";
|
|
2
|
+
import { o as CliError, t as fetchCatalogVersion } from "./chunk-QCOwDTOu.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";
|
|
@@ -1725,6 +1725,7 @@ const batchSchema = z.strictObject({
|
|
|
1725
1725
|
usage: z.strictObject({ points: z.int().nonnegative().describe("Reported points consumed.") }).optional().describe("Reported source points consumed by this attempt."),
|
|
1726
1726
|
budget: z.strictObject({
|
|
1727
1727
|
remaining: z.int().min(0).describe("Requests or points the source still allows."),
|
|
1728
|
+
limit: z.int().positive().optional().describe("Full budget the source restores at reset; omitted when it reports none."),
|
|
1728
1729
|
resetAt: z.iso.datetime().describe("When the source restores the full budget.")
|
|
1729
1730
|
}).optional().describe("Request budget the source reported on this poll; omitted when it reports none.")
|
|
1730
1731
|
}).superRefine((batch, ctx) => {
|
|
@@ -2642,6 +2643,11 @@ const sourceViewSchema = z.strictObject({
|
|
|
2642
2643
|
"stale"
|
|
2643
2644
|
]).nullable().describe("Why this source is blind, or null when it is usable."),
|
|
2644
2645
|
message: z.string().nullable().describe("Short explanation of the source state."),
|
|
2646
|
+
budget: z.strictObject({
|
|
2647
|
+
remaining: z.int().nonnegative().describe("Requests or points the source still allowed."),
|
|
2648
|
+
limit: z.int().positive().nullable().describe("Full budget the source restores at reset, or null when it reported none."),
|
|
2649
|
+
resetAt: z.iso.datetime().describe("When the source said it restores the full budget.")
|
|
2650
|
+
}).nullable().describe("Request budget from the last poll of this source that reported one, or null when none did."),
|
|
2645
2651
|
stale: z.boolean().describe("Whether facts from this source exceed their freshness threshold."),
|
|
2646
2652
|
warmingUp: z.boolean().describe("Whether this source needs a complete poll in this daemon run.")
|
|
2647
2653
|
}).describe("Freshness and availability of one source.");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Q as ERRORS, c as tokenRequestStatusSchema, et as errorContextSchema, g as renderJsonError, o as tokenRequestResultSchema, rt as successEnvelopeSchema, tt as errorEnvelopeSchema } from "./chunk-
|
|
1
|
+
import { Q as ERRORS, c as tokenRequestStatusSchema, et as errorContextSchema, g as renderJsonError, o as tokenRequestResultSchema, rt as successEnvelopeSchema, tt as errorEnvelopeSchema } from "./chunk-Di9QGxO1.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { request } from "node:http";
|
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Q as ERRORS, _t as SLACK_BOT_SCOPES, a as requestHashOf, dt as configSchema, f as roleCanUseOperation, mt as requiredSecretKeys, p as OPERATIONS, q as actorIdSchema, r as remoteDoctorReportSchema, rt as successEnvelopeSchema, u as SYSTEMD_SERVICE_SETTINGS } from "./chunk-
|
|
1
|
+
import { Q as ERRORS, _t as SLACK_BOT_SCOPES, a as requestHashOf, dt as configSchema, f as roleCanUseOperation, mt as requiredSecretKeys, p as OPERATIONS, q as actorIdSchema, r as remoteDoctorReportSchema, rt as successEnvelopeSchema, u as SYSTEMD_SERVICE_SETTINGS } from "./chunk-Di9QGxO1.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-QCOwDTOu.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-BRdjSAl1.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-QCOwDTOu.mjs";
|
|
2
2
|
export { fetchCatalogVersion, fetchTokenStatus, requestOperation, requestSkillReload, requestTokenEnrollment };
|
package/dist/daemon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as err, A as prSourceId, B as prFactsSchema, C as userIdSchema, D as AdapterError, E as eventPayloadSchemas, F as REVIEW_STATES, G as JIRA_PROJECT_KEY, H as ringMarker, I as SESSION_HEALTH_STATES, J as encodeActorId, K as REF_NUMBER, L as SESSION_STATUSES, M as sourceCursorSchema, N as trackerSourceId, O as batchSchema, P as PR_STATES, Q as ERRORS, R as isExternalAuthor, S as messageRefSchema, T as GATE_REASONS, U as sessionFactsSchema, V as prRefSchema, W as ticketFactsSchema, X as parseActorId, Y as errorCodeOf, Z as parseRef$1, _t as SLACK_BOT_SCOPES, a as requestHashOf, at as DEFAULT_LINK, b as inboundEventSchema, c as tokenRequestStatusSchema, ct as RESERVED_PROJECT, d as buildCatalogSnapshot, dt as configSchema, f as roleCanUseOperation, ft as defaultAddressee, gt as DISPATCHER_MODES, h as renderHttpProblem, ht as COLUMN_IDS, i as TOKEN_REQUEST_LIMITS, j as sessionTransitionSchema, k as entityRefSchema, l as BOARD_TICK_MS, lt as boardWideSpurProject, m as turnHandedSchema, mt as requiredSecretKeys, n as doctorReportSchema, nt as ok, o as tokenRequestResultSchema, p as OPERATIONS, pt as plainHttpAllowed, q as actorIdSchema, rt as successEnvelopeSchema, s as tokenRequestSchema, st as DEFAULT_SLACK_COMMAND, t as assertNever, ut as configBindings, v as SPACE_IDS, vt as TASK_HOLDS, w as EVENT_KINDS, x as interactionRefSchema, y as conversationRefSchema, z as parseRingMarker } from "./chunk-
|
|
1
|
+
import { $ as err, A as prSourceId, B as prFactsSchema, C as userIdSchema, D as AdapterError, E as eventPayloadSchemas, F as REVIEW_STATES, G as JIRA_PROJECT_KEY, H as ringMarker, I as SESSION_HEALTH_STATES, J as encodeActorId, K as REF_NUMBER, L as SESSION_STATUSES, M as sourceCursorSchema, N as trackerSourceId, O as batchSchema, P as PR_STATES, Q as ERRORS, R as isExternalAuthor, S as messageRefSchema, T as GATE_REASONS, U as sessionFactsSchema, V as prRefSchema, W as ticketFactsSchema, X as parseActorId, Y as errorCodeOf, Z as parseRef$1, _t as SLACK_BOT_SCOPES, a as requestHashOf, at as DEFAULT_LINK, b as inboundEventSchema, c as tokenRequestStatusSchema, ct as RESERVED_PROJECT, d as buildCatalogSnapshot, dt as configSchema, f as roleCanUseOperation, ft as defaultAddressee, gt as DISPATCHER_MODES, h as renderHttpProblem, ht as COLUMN_IDS, i as TOKEN_REQUEST_LIMITS, j as sessionTransitionSchema, k as entityRefSchema, l as BOARD_TICK_MS, lt as boardWideSpurProject, m as turnHandedSchema, mt as requiredSecretKeys, n as doctorReportSchema, nt as ok, o as tokenRequestResultSchema, p as OPERATIONS, pt as plainHttpAllowed, q as actorIdSchema, rt as successEnvelopeSchema, s as tokenRequestSchema, st as DEFAULT_SLACK_COMMAND, t as assertNever, ut as configBindings, v as SPACE_IDS, vt as TASK_HOLDS, w as EVENT_KINDS, x as interactionRefSchema, y as conversationRefSchema, z as parseRingMarker } from "./chunk-Di9QGxO1.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";
|
|
@@ -14130,6 +14130,11 @@ async function getStatus(deps, options = {}) {
|
|
|
14130
14130
|
lastCompleteAt: last,
|
|
14131
14131
|
blindReason,
|
|
14132
14132
|
message: row?.blind_message ?? null,
|
|
14133
|
+
budget: row?.budget_remaining != null && row.budget_reset_at != null ? {
|
|
14134
|
+
remaining: row.budget_remaining,
|
|
14135
|
+
limit: row.budget_limit,
|
|
14136
|
+
resetAt: row.budget_reset_at
|
|
14137
|
+
} : null,
|
|
14133
14138
|
stale: last === null || clock.now() - Date.parse(last) > config.thresholds.staleMultiplier * interval(config, source),
|
|
14134
14139
|
warmingUp: !completeSince.has(source)
|
|
14135
14140
|
};
|
|
@@ -17293,7 +17298,7 @@ async function updateTerminal(trx, config, taskId, at, completeSince, blind) {
|
|
|
17293
17298
|
async function blindReason(trx, source) {
|
|
17294
17299
|
return (await trx.selectFrom("source_state").select("blind_reason").where("source", "=", source).executeTakeFirst())?.blind_reason ?? null;
|
|
17295
17300
|
}
|
|
17296
|
-
async function sourceState(trx, source, state, observedAt, cursor) {
|
|
17301
|
+
async function sourceState(trx, source, state, observedAt, cursor, budget) {
|
|
17297
17302
|
await trx.insertInto("source_state").values({
|
|
17298
17303
|
source,
|
|
17299
17304
|
initialized: observedAt === void 0 ? 0 : 1,
|
|
@@ -17302,7 +17307,10 @@ async function sourceState(trx, source, state, observedAt, cursor) {
|
|
|
17302
17307
|
blind_message: state.blind?.message ?? null,
|
|
17303
17308
|
cursor: cursor ?? null,
|
|
17304
17309
|
observed_at: observedAt ?? null,
|
|
17305
|
-
gone: toJson(z.array(entityRefSchema), [...state.gone])
|
|
17310
|
+
gone: toJson(z.array(entityRefSchema), [...state.gone]),
|
|
17311
|
+
budget_remaining: budget?.remaining ?? null,
|
|
17312
|
+
budget_limit: budget?.limit ?? null,
|
|
17313
|
+
budget_reset_at: budget?.resetAt ?? null
|
|
17306
17314
|
}).onConflict((oc) => oc.column("source").doUpdateSet((eb) => ({
|
|
17307
17315
|
initialized: observedAt === void 0 ? eb.ref("source_state.initialized") : 1,
|
|
17308
17316
|
last_complete_at: state.lastCompleteAt ?? null,
|
|
@@ -17310,7 +17318,10 @@ async function sourceState(trx, source, state, observedAt, cursor) {
|
|
|
17310
17318
|
blind_message: state.blind?.message ?? null,
|
|
17311
17319
|
cursor: cursor ?? eb.ref("source_state.cursor"),
|
|
17312
17320
|
observed_at: observedAt ?? eb.ref("source_state.observed_at"),
|
|
17313
|
-
gone: toJson(z.array(entityRefSchema), [...state.gone])
|
|
17321
|
+
gone: toJson(z.array(entityRefSchema), [...state.gone]),
|
|
17322
|
+
budget_remaining: budget === void 0 ? eb.ref("source_state.budget_remaining") : budget.remaining,
|
|
17323
|
+
budget_limit: budget === void 0 ? eb.ref("source_state.budget_limit") : budget.limit ?? null,
|
|
17324
|
+
budget_reset_at: budget === void 0 ? eb.ref("source_state.budget_reset_at") : budget.resetAt
|
|
17314
17325
|
}))).execute();
|
|
17315
17326
|
}
|
|
17316
17327
|
/**
|
|
@@ -17945,7 +17956,7 @@ function createObservationCore(deps) {
|
|
|
17945
17956
|
const wasBlind = await blindReason(trx, source);
|
|
17946
17957
|
const previousSpur = source === "spur" ? await trx.selectFrom("source_state").select("last_complete_at").where("source", "=", source).executeTakeFirst() : void 0;
|
|
17947
17958
|
const spurGap = previousSpur?.last_complete_at != null && Date.parse(batch.observedAt) > Date.parse(previousSpur.last_complete_at) + config.adapters.spur.intervalMs * config.thresholds.staleMultiplier;
|
|
17948
|
-
await sourceState(trx, source, observation.state, batch.observedAt, batch.cursor);
|
|
17959
|
+
await sourceState(trx, source, observation.state, batch.observedAt, batch.cursor, batch.budget);
|
|
17949
17960
|
await recordUsage(trx, source, batch.usage, now);
|
|
17950
17961
|
for (const probe of batch.prProbes ?? []) {
|
|
17951
17962
|
if (probe.status !== "closed") continue;
|
|
@@ -19674,21 +19685,21 @@ function aliases(numbers, fields) {
|
|
|
19674
19685
|
}
|
|
19675
19686
|
const discoveryStates = (bootstrap) => bootstrap ? "OPEN" : "OPEN, MERGED, CLOSED";
|
|
19676
19687
|
function discoveryQuery(bootstrap = false) {
|
|
19677
|
-
return `query PrBatch($owner: String!, $repo: String!) { rateLimit { cost remaining resetAt } repository(owner: $owner, name: $repo) { pullRequests(first: 100, states: [${discoveryStates(bootstrap)}], orderBy: {field: UPDATED_AT, direction: DESC}) { ${DISCOVERY_FIELDS} }${bootstrap ? " mergedBaseline: pullRequests(first: 1, states: [MERGED, CLOSED], orderBy: {field: UPDATED_AT, direction: DESC}) { nodes { updatedAt } }" : ""} } }`;
|
|
19688
|
+
return `query PrBatch($owner: String!, $repo: String!) { rateLimit { cost limit remaining resetAt } repository(owner: $owner, name: $repo) { pullRequests(first: 100, states: [${discoveryStates(bootstrap)}], orderBy: {field: UPDATED_AT, direction: DESC}) { ${DISCOVERY_FIELDS} }${bootstrap ? " mergedBaseline: pullRequests(first: 1, states: [MERGED, CLOSED], orderBy: {field: UPDATED_AT, direction: DESC}) { nodes { updatedAt } }" : ""} } }`;
|
|
19678
19689
|
}
|
|
19679
19690
|
function stateQuery(numbers) {
|
|
19680
|
-
return `query PrStates($owner: String!, $repo: String!) { rateLimit { cost remaining resetAt } ${aliases(numbers, () => "number state")} }`;
|
|
19691
|
+
return `query PrStates($owner: String!, $repo: String!) { rateLimit { cost limit remaining resetAt } ${aliases(numbers, () => "number state")} }`;
|
|
19681
19692
|
}
|
|
19682
19693
|
function indexQuery(numbers) {
|
|
19683
|
-
return `query PrIndex($owner: String!, $repo: String!) { rateLimit { cost remaining resetAt } ${aliases(numbers, () => INDEX_FIELDS)} }`;
|
|
19694
|
+
return `query PrIndex($owner: String!, $repo: String!) { rateLimit { cost limit remaining resetAt } ${aliases(numbers, () => INDEX_FIELDS)} }`;
|
|
19684
19695
|
}
|
|
19685
19696
|
function detailQuery(numbers, closing = false) {
|
|
19686
|
-
return `query PrDetails($owner: String!, $repo: String!) { rateLimit { cost remaining resetAt } ${aliases(numbers, (number) => prFields(number, closing))} }`;
|
|
19697
|
+
return `query PrDetails($owner: String!, $repo: String!) { rateLimit { cost limit remaining resetAt } ${aliases(numbers, (number) => prFields(number, closing))} }`;
|
|
19687
19698
|
}
|
|
19688
19699
|
function pageQuery(connection, bootstrap = false) {
|
|
19689
|
-
if (connection === "comments") return `query PrPage($owner: String!, $repo: String!, $number: Int!, $before: String!) { rateLimit { cost remaining resetAt } repository(owner: $owner, name: $repo) { pullRequest(number: $number) { comments(last: 100, before: $before) { ${COMMENT_FIELDS} } } } }`;
|
|
19690
|
-
if (connection === "pullRequests") return `query DiscoveryPage($owner: String!, $repo: String!, $after: String!) { rateLimit { cost remaining resetAt } repository(owner: $owner, name: $repo) { pullRequests(first: 100, after: $after, states: [${discoveryStates(bootstrap)}], orderBy: {field: UPDATED_AT, direction: DESC}) { ${DISCOVERY_FIELDS} } } }`;
|
|
19691
|
-
return `query PrPage($owner: String!, $repo: String!, $number: Int!, $after: String!) { rateLimit { cost remaining resetAt } repository(owner: $owner, name: $repo) { pullRequest(number: $number) { ${connection === "closingIssuesReferences" ? `closingIssuesReferences(first: 100, after: $after) { ${CLOSING_FIELDS} }` : connection === "contexts" ? `statusCheckRollup { contexts(first: 100, after: $after) { nodes { ... on CheckRun { __typename name status conclusion startedAt completedAt checkSuite { createdAt } isRequired(pullRequestNumber: $number) } ... on StatusContext { __typename context state createdAt isRequired(pullRequestNumber: $number) } } pageInfo { hasNextPage endCursor } } }` : `${connection}(first: 100, after: $after) { nodes { ${connection === "reviews" ? REVIEW_FIELDS : connection === "reviewThreads" ? THREAD_FIELDS : REVIEWER_FIELDS} } pageInfo { hasNextPage endCursor } }`} } } }`;
|
|
19700
|
+
if (connection === "comments") return `query PrPage($owner: String!, $repo: String!, $number: Int!, $before: String!) { rateLimit { cost limit remaining resetAt } repository(owner: $owner, name: $repo) { pullRequest(number: $number) { comments(last: 100, before: $before) { ${COMMENT_FIELDS} } } } }`;
|
|
19701
|
+
if (connection === "pullRequests") return `query DiscoveryPage($owner: String!, $repo: String!, $after: String!) { rateLimit { cost limit remaining resetAt } repository(owner: $owner, name: $repo) { pullRequests(first: 100, after: $after, states: [${discoveryStates(bootstrap)}], orderBy: {field: UPDATED_AT, direction: DESC}) { ${DISCOVERY_FIELDS} } } }`;
|
|
19702
|
+
return `query PrPage($owner: String!, $repo: String!, $number: Int!, $after: String!) { rateLimit { cost limit remaining resetAt } repository(owner: $owner, name: $repo) { pullRequest(number: $number) { ${connection === "closingIssuesReferences" ? `closingIssuesReferences(first: 100, after: $after) { ${CLOSING_FIELDS} }` : connection === "contexts" ? `statusCheckRollup { contexts(first: 100, after: $after) { nodes { ... on CheckRun { __typename name status conclusion startedAt completedAt checkSuite { createdAt } isRequired(pullRequestNumber: $number) } ... on StatusContext { __typename context state createdAt isRequired(pullRequestNumber: $number) } } pageInfo { hasNextPage endCursor } } }` : `${connection}(first: 100, after: $after) { nodes { ${connection === "reviews" ? REVIEW_FIELDS : connection === "reviewThreads" ? THREAD_FIELDS : REVIEWER_FIELDS} } pageInfo { hasNextPage endCursor } }`} } } }`;
|
|
19692
19703
|
}
|
|
19693
19704
|
/**
|
|
19694
19705
|
* The failure that GraphQL `errors` mean for the whole request, in rule order: a rate limit is
|
|
@@ -19766,10 +19777,14 @@ var GithubClient = class {
|
|
|
19766
19777
|
const failure = graphqlFailure(errors, query, response.headers, this.now());
|
|
19767
19778
|
if (failure !== null) throw failure;
|
|
19768
19779
|
const data = parseWire(dataWire, wire.data, MALFORMED$3, ["data"]);
|
|
19780
|
+
const limit = z.object({ rateLimit: z.object({ limit: z.int().positive() }) }).safeParse(wire.data);
|
|
19769
19781
|
return {
|
|
19770
19782
|
data,
|
|
19771
19783
|
errors,
|
|
19772
|
-
budget:
|
|
19784
|
+
budget: limit.success ? {
|
|
19785
|
+
...data.rateLimit,
|
|
19786
|
+
limit: limit.data.rateLimit.limit
|
|
19787
|
+
} : data.rateLimit
|
|
19773
19788
|
};
|
|
19774
19789
|
}
|
|
19775
19790
|
};
|
|
@@ -21066,7 +21081,10 @@ function matchesFilter(issue, tracker) {
|
|
|
21066
21081
|
if (tracker.label !== void 0) return issue.labels.some((label) => label.name === tracker.label);
|
|
21067
21082
|
return issue.milestone?.title === tracker.milestone;
|
|
21068
21083
|
}
|
|
21069
|
-
/**
|
|
21084
|
+
/**
|
|
21085
|
+
* The REST `core` budget from GitHub's rate-limit headers; undefined when remaining or reset is
|
|
21086
|
+
* invalid. An invalid `x-ratelimit-limit` is left out of the budget.
|
|
21087
|
+
*/
|
|
21070
21088
|
function restBudget(headers) {
|
|
21071
21089
|
const remaining = headers.get("x-ratelimit-remaining");
|
|
21072
21090
|
const reset = headers.get("x-ratelimit-reset");
|
|
@@ -21077,7 +21095,12 @@ function restBudget(headers) {
|
|
|
21077
21095
|
if (!Number.isSafeInteger(count) || Number.isNaN(resetAt.getTime())) return void 0;
|
|
21078
21096
|
const iso = resetAt.toISOString();
|
|
21079
21097
|
if (!/^\d{4}-/.test(iso)) return void 0;
|
|
21080
|
-
|
|
21098
|
+
const limit = Number(headers.get("x-ratelimit-limit")?.match(/^\d+$/)?.[0]);
|
|
21099
|
+
return Number.isSafeInteger(limit) && limit > 0 ? {
|
|
21100
|
+
remaining: count,
|
|
21101
|
+
limit,
|
|
21102
|
+
resetAt: iso
|
|
21103
|
+
} : {
|
|
21081
21104
|
remaining: count,
|
|
21082
21105
|
resetAt: iso
|
|
21083
21106
|
};
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Q as ERRORS, _ as renderMcpError, p 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 { Q as ERRORS, _ as renderMcpError, p as OPERATIONS } from "./chunk-Di9QGxO1.mjs";
|
|
2
|
+
import { o as CliError, r as requestOperation } from "./chunk-QCOwDTOu.mjs";
|
|
3
|
+
import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-BRdjSAl1.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { z } from "zod";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
-- Request budget each source reported on its last batch that carried one. observe writes the three
|
|
2
|
+
-- columns together from one batch or leaves them alone; reportSourceState never changes them.
|
|
3
|
+
ALTER TABLE source_state ADD COLUMN budget_remaining INTEGER;
|
|
4
|
+
ALTER TABLE source_state ADD COLUMN budget_limit INTEGER;
|
|
5
|
+
ALTER TABLE source_state ADD COLUMN budget_reset_at TEXT;
|