@mrrlin-dev/mcp 0.4.196 → 0.4.199

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.
Files changed (2) hide show
  1. package/dist/bin.cjs +63 -8
  2. package/package.json +1 -1
package/dist/bin.cjs CHANGED
@@ -67646,6 +67646,16 @@ var mrrlinExecutionRunSchema = external_exports.object({
67646
67646
  outcomeAcceptedAt: external_exports.string().datetime().nullable().default(null),
67647
67647
  resumedOnQuestionId: external_exports.string().nullable().default(null)
67648
67648
  });
67649
+ var compactExecutionTouchResponseSchema = external_exports.object({
67650
+ data: mrrlinExecutionRunSchema.pick({ projectSlug: true, id: true, leaseId: true, leaseRemainingMs: true }).extend({
67651
+ leaseId: external_exports.string().min(1),
67652
+ status: external_exports.literal("running"),
67653
+ executorBearer: external_exports.string().min(1).optional()
67654
+ }).strict()
67655
+ }).strict();
67656
+ var compactAsyncTouchResponseSchema = external_exports.object({
67657
+ data: external_exports.object({ applied: external_exports.literal(true) }).strict()
67658
+ }).strict();
67649
67659
  var mrrlinTaskStateSchema = external_exports.object({
67650
67660
  projectSlug: mrrlinProjectSlugSchema,
67651
67661
  taskId: mrrlinTaskIdSchema,
@@ -69871,6 +69881,30 @@ function createMrrlinClient(config2) {
69871
69881
  });
69872
69882
  return executionRunResponseSchema.parse(body).data;
69873
69883
  },
69884
+ async touchExecutionRunLease(projectSlug, runId, leaseId) {
69885
+ try {
69886
+ const response = await request(`${projectPath(projectSlug)}/execution-runs/${encodeURIComponent(runId)}/touch-lease`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ leaseId }) });
69887
+ const data = compactExecutionTouchResponseSchema.parse(response).data;
69888
+ if (data.projectSlug !== projectSlug || data.id !== runId || data.leaseId !== leaseId || data.executorBearer === void 0 !== (data.leaseRemainingMs === void 0)) {
69889
+ throw new Error("Compact heartbeat returned a different execution lease");
69890
+ }
69891
+ return data;
69892
+ } catch (error51) {
69893
+ if (error51 instanceof MrrlinApiError && error51.status === 409 && error51.code !== "EXECUTION_LEASE_EFFECT_BUSY" && error51.code !== "COMPACT_HEARTBEAT_UNREPRESENTABLE")
69894
+ return null;
69895
+ throw error51;
69896
+ }
69897
+ },
69898
+ async touchAsyncJobLease(projectSlug, jobId, leaseId) {
69899
+ try {
69900
+ const response = await request(`${projectPath(projectSlug)}/async-jobs/${encodeURIComponent(jobId)}/touch-lease`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ leaseId }) });
69901
+ return compactAsyncTouchResponseSchema.parse(response).data.applied;
69902
+ } catch (error51) {
69903
+ if (error51 instanceof MrrlinApiError && error51.status === 409)
69904
+ return false;
69905
+ throw error51;
69906
+ }
69907
+ },
69874
69908
  async touchExecutionRun(projectSlug, runId, leaseId) {
69875
69909
  try {
69876
69910
  const body = await request(`${projectPath(projectSlug)}/execution-runs/${encodeURIComponent(runId)}/touch`, {
@@ -97200,7 +97234,7 @@ function createOwnedStreamingFetch(scope, origin) {
97200
97234
  throw new TypeError("Invalid streaming transport origin");
97201
97235
  }
97202
97236
  return async (input) => {
97203
- const { deadlineAt, signal, method } = input;
97237
+ const { deadlineAt, deadlineSignal, signal, method } = input;
97204
97238
  const url2 = new URL(input.url);
97205
97239
  if (url2.origin !== expected.origin || url2.username || url2.password || url2.hash || !["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE"].includes(method) || input.body !== void 0 && (typeof input.body !== "string" && !(input.body instanceof Uint8Array) || method === "GET" || method === "HEAD")) {
97206
97240
  throw new TypeError("Unsupported streaming request");
@@ -97212,7 +97246,14 @@ function createOwnedStreamingFetch(scope, origin) {
97212
97246
  if (!Number.isFinite(remaining) || remaining <= 0 || remaining > 2147483647 || signal?.aborted) throw aborted2();
97213
97247
  let onDeadline = expire;
97214
97248
  const timer = setTimeout(() => onDeadline(), Math.ceil(remaining));
97215
- const caller = signal ? (0, import_node_events3.addAbortListener)(signal, expire) : void 0;
97249
+ let canceledBeforeDeadline = false;
97250
+ const caller = signal ? (0, import_node_events3.addAbortListener)(signal, () => {
97251
+ if (deadlineSignal?.aborted && signal.reason === deadlineSignal.reason) onDeadline();
97252
+ else {
97253
+ canceledBeforeDeadline = performance.now() < deadlineAt;
97254
+ expire();
97255
+ }
97256
+ }) : void 0;
97216
97257
  let retained = false;
97217
97258
  const cleanup = () => {
97218
97259
  clearTimeout(timer);
@@ -97227,7 +97268,7 @@ function createOwnedStreamingFetch(scope, origin) {
97227
97268
  });
97228
97269
  let waitingForHeaders = false;
97229
97270
  const rotate = () => {
97230
- if (waitingForHeaders) input.rotateOnHeaderTimeout?.rotate(operation.generation);
97271
+ if (waitingForHeaders && !canceledBeforeDeadline) input.rotateOnHeaderTimeout?.rotate(operation.generation);
97231
97272
  };
97232
97273
  onDeadline = () => {
97233
97274
  rotate();
@@ -97989,8 +98030,9 @@ function createOwnedSdkOperation(options) {
97989
98030
  const authenticate = createScopedTokenRefresh(options, "ordinary");
97990
98031
  return (session) => {
97991
98032
  const deadlineAt = session?.deadlineAt ?? performance.now() + options.timeoutMs;
98033
+ const deadlineSignal = AbortSignal.timeout(Math.max(0, Math.ceil(deadlineAt - performance.now())));
97992
98034
  return {
97993
- signal: AbortSignal.timeout(Math.max(0, Math.ceil(deadlineAt - performance.now()))),
98035
+ signal: deadlineSignal,
97994
98036
  headers: async (authSignal) => ({
97995
98037
  authorization: "Bearer " + (session?.token ?? await authenticate(authSignal, deadlineAt))
97996
98038
  }),
@@ -98004,6 +98046,7 @@ function createOwnedSdkOperation(options) {
98004
98046
  url: url2,
98005
98047
  method,
98006
98048
  deadlineAt,
98049
+ deadlineSignal,
98007
98050
  rotateOnHeaderTimeout: options.generations,
98008
98051
  signal: init?.signal ?? void 0,
98009
98052
  headers: Object.fromEntries(new Headers(init?.headers)),
@@ -99206,7 +99249,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
99206
99249
  }
99207
99250
 
99208
99251
  // src/_generated/version.ts
99209
- var PKG_VERSION = "0.4.196";
99252
+ var PKG_VERSION = "0.4.199";
99210
99253
 
99211
99254
  // src/bridge-allowed-origins.ts
99212
99255
  var DEFAULT_DIRECTOR_BRIDGE_ALLOWED_ORIGINS = [
@@ -107926,7 +107969,7 @@ async function driveClaimableAsyncJob(deps, projectSlug, jobId, preClaimJob, sec
107926
107969
  const retryReport = async (action, stillCurrent, remaining, signal) => {
107927
107970
  if (!reportAction) return null;
107928
107971
  let pause = 100;
107929
- while (stillCurrent()) {
107972
+ while (!signal?.aborted && stillCurrent()) {
107930
107973
  let retryAfter = 0;
107931
107974
  try {
107932
107975
  return await reportAction(action, remaining());
@@ -107934,10 +107977,22 @@ async function driveClaimableAsyncJob(deps, projectSlug, jobId, preClaimJob, sec
107934
107977
  if (error51 instanceof MrrlinApiError) {
107935
107978
  if (error51.status < 500 && error51.status !== 429) throw error51;
107936
107979
  retryAfter = error51.retryAfterMs ?? 0;
107980
+ if (Number.isNaN(retryAfter) || retryAfter < 0) retryAfter = 0;
107937
107981
  }
107938
107982
  }
107939
- await (0, import_promises20.setTimeout)(Math.max(1, Math.min(Math.max(pause, retryAfter), remaining(), 2147483647)), void 0, { signal }).catch(() => {
107940
- });
107983
+ const retryIn = Math.max(pause, retryAfter);
107984
+ const retryAt = performance.now() + retryIn;
107985
+ let wait = retryIn;
107986
+ while (wait > 0) {
107987
+ if (signal?.aborted || !stillCurrent() || wait >= remaining()) return null;
107988
+ try {
107989
+ await (0, import_promises20.setTimeout)(Math.min(Math.ceil(wait), 2147483647), void 0, { signal });
107990
+ } catch (error51) {
107991
+ if (signal?.aborted && error51 instanceof Error && error51.name === "AbortError") return null;
107992
+ throw error51;
107993
+ }
107994
+ wait = retryAt - performance.now();
107995
+ }
107941
107996
  pause = Math.min(pause * 2, 2e3);
107942
107997
  }
107943
107998
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrrlin-dev/mcp",
3
- "version": "0.4.196",
3
+ "version": "0.4.199",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mrrlin-mcp": "dist/bin.cjs"