@mrrlin-dev/mcp 0.4.101 → 0.4.106
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/bin.cjs +502 -91
- package/package.json +3 -3
package/dist/bin.cjs
CHANGED
|
@@ -37428,6 +37428,14 @@ var openApiOperationIds = {
|
|
|
37428
37428
|
resolveArtifactKindRoute: "resolveArtifactKindRoute",
|
|
37429
37429
|
resolveDeliveryForArtifactKind: "resolveDeliveryForArtifactKind",
|
|
37430
37430
|
recordCapabilityUse: "recordCapabilityUse",
|
|
37431
|
+
appendOperatorTranscriptMessage: "appendOperatorTranscriptMessage",
|
|
37432
|
+
listOperatorTranscriptMessages: "listOperatorTranscriptMessages",
|
|
37433
|
+
createIntentProposal: "createIntentProposal",
|
|
37434
|
+
getIntentProposal: "getIntentProposal",
|
|
37435
|
+
recordIntentClarification: "recordIntentClarification",
|
|
37436
|
+
answerIntentClarification: "answerIntentClarification",
|
|
37437
|
+
confirmIntentProposal: "confirmIntentProposal",
|
|
37438
|
+
getIntentConfirmation: "getIntentConfirmation",
|
|
37431
37439
|
resolveAccount: "resolveAccount",
|
|
37432
37440
|
linkAccountIdentity: "linkAccountIdentity",
|
|
37433
37441
|
getMyAccount: "getMyAccount",
|
|
@@ -38109,6 +38117,152 @@ var TASK_NOTES_JOURNAL_SECTIONS = [
|
|
|
38109
38117
|
];
|
|
38110
38118
|
var JOURNAL_HEADING_RE = new RegExp(`^##[ \\t]+(${TASK_NOTES_JOURNAL_SECTIONS.map((s) => s.heading).join("|")})\\b[ \\t]*(?:[\u2014\u2013-][ \\t]*(\\S.*?))?[ \\t]*$`);
|
|
38111
38119
|
|
|
38120
|
+
// ../../packages/schemas/dist/intent.js
|
|
38121
|
+
var taskImpactSchema = external_exports.enum(["low", "medium", "high"]);
|
|
38122
|
+
var autonomyLevelSchema = external_exports.enum(["auto", "human_review"]);
|
|
38123
|
+
var autoDeploySchema = external_exports.enum(["off", "dev", "prod"]);
|
|
38124
|
+
var mrrlinOperatorTranscriptMessageSchema = external_exports.object({
|
|
38125
|
+
id: external_exports.string().uuid(),
|
|
38126
|
+
projectSlug: external_exports.string().min(1),
|
|
38127
|
+
content: external_exports.string().min(1),
|
|
38128
|
+
revision: external_exports.number().int().nonnegative().optional(),
|
|
38129
|
+
createdAt: external_exports.string()
|
|
38130
|
+
});
|
|
38131
|
+
var mrrlinOperatorTranscriptAppendSchema = external_exports.object({
|
|
38132
|
+
content: external_exports.string().min(1)
|
|
38133
|
+
});
|
|
38134
|
+
var mrrlinOperatorTranscriptListSchema = external_exports.array(mrrlinOperatorTranscriptMessageSchema);
|
|
38135
|
+
var operatorTranscriptMessageResponseSchema = external_exports.object({
|
|
38136
|
+
data: mrrlinOperatorTranscriptMessageSchema
|
|
38137
|
+
});
|
|
38138
|
+
var operatorTranscriptListResponseSchema = external_exports.object({
|
|
38139
|
+
data: mrrlinOperatorTranscriptListSchema
|
|
38140
|
+
});
|
|
38141
|
+
var mrrlinIntentProposalStateSchema = external_exports.enum([
|
|
38142
|
+
"pending",
|
|
38143
|
+
"confirmed",
|
|
38144
|
+
"rejected",
|
|
38145
|
+
"blocked",
|
|
38146
|
+
"superseded"
|
|
38147
|
+
]);
|
|
38148
|
+
var mrrlinIntentProposalSchema = external_exports.object({
|
|
38149
|
+
id: external_exports.string().uuid(),
|
|
38150
|
+
projectSlug: external_exports.string().min(1),
|
|
38151
|
+
proposalId: external_exports.string().uuid(),
|
|
38152
|
+
version: external_exports.number().int().min(1),
|
|
38153
|
+
state: mrrlinIntentProposalStateSchema,
|
|
38154
|
+
resolvedIntent: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
38155
|
+
digest: external_exports.string().min(1),
|
|
38156
|
+
messageIds: external_exports.array(external_exports.string().uuid()).default([]),
|
|
38157
|
+
transcriptRevision: external_exports.string(),
|
|
38158
|
+
transcriptRevisionNumber: external_exports.number().int().nonnegative().optional(),
|
|
38159
|
+
createdAt: external_exports.string(),
|
|
38160
|
+
updatedAt: external_exports.string()
|
|
38161
|
+
});
|
|
38162
|
+
var mrrlinIntentProposalCreateSchema = external_exports.object({
|
|
38163
|
+
proposalId: external_exports.string().uuid(),
|
|
38164
|
+
version: external_exports.number().int().min(1),
|
|
38165
|
+
resolvedIntent: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
38166
|
+
digest: external_exports.string().min(1),
|
|
38167
|
+
transcriptRevision: external_exports.string().optional(),
|
|
38168
|
+
expectedTranscriptRevisionNumber: external_exports.number().int().nonnegative(),
|
|
38169
|
+
messageIds: external_exports.array(external_exports.string().uuid())
|
|
38170
|
+
}).strict();
|
|
38171
|
+
var intentProposalResponseSchema = external_exports.object({
|
|
38172
|
+
data: mrrlinIntentProposalSchema
|
|
38173
|
+
});
|
|
38174
|
+
var intentProposalMaybeResponseSchema = external_exports.object({
|
|
38175
|
+
data: mrrlinIntentProposalSchema.nullable()
|
|
38176
|
+
});
|
|
38177
|
+
var mrrlinIntentClarificationStateSchema = external_exports.enum(["open", "answered", "rejected"]);
|
|
38178
|
+
var mrrlinIntentClarificationSchema = external_exports.object({
|
|
38179
|
+
id: external_exports.string().uuid(),
|
|
38180
|
+
projectSlug: external_exports.string().min(1),
|
|
38181
|
+
proposalId: external_exports.string().uuid(),
|
|
38182
|
+
proposalVersion: external_exports.number().int().min(1),
|
|
38183
|
+
round: external_exports.number().int().min(1).max(3),
|
|
38184
|
+
ordinal: external_exports.number().int().min(1).max(3),
|
|
38185
|
+
question: external_exports.string().min(1),
|
|
38186
|
+
state: mrrlinIntentClarificationStateSchema,
|
|
38187
|
+
answer: external_exports.string().nullable().optional(),
|
|
38188
|
+
actor: external_exports.string().nullable().optional(),
|
|
38189
|
+
answeredAt: external_exports.string().nullable().optional(),
|
|
38190
|
+
createdAt: external_exports.string()
|
|
38191
|
+
});
|
|
38192
|
+
var mrrlinIntentClarificationRecordSchema = external_exports.object({
|
|
38193
|
+
proposalId: external_exports.string().uuid(),
|
|
38194
|
+
proposalVersion: external_exports.number().int().min(1),
|
|
38195
|
+
round: external_exports.number().int().min(1).max(3),
|
|
38196
|
+
ordinal: external_exports.number().int().min(1).max(3),
|
|
38197
|
+
question: external_exports.string().min(1)
|
|
38198
|
+
}).strict();
|
|
38199
|
+
var mrrlinIntentClarificationAnswerSchema = external_exports.object({
|
|
38200
|
+
answer: external_exports.string().min(1),
|
|
38201
|
+
actor: external_exports.string().min(1).optional()
|
|
38202
|
+
}).strict();
|
|
38203
|
+
var intentClarificationResponseSchema = external_exports.object({
|
|
38204
|
+
data: mrrlinIntentClarificationSchema
|
|
38205
|
+
});
|
|
38206
|
+
var mrrlinIntentConfirmRequestSchema = external_exports.object({
|
|
38207
|
+
proposalId: external_exports.string().uuid(),
|
|
38208
|
+
expectedVersion: external_exports.number().int().min(1),
|
|
38209
|
+
expectedDigest: external_exports.string().min(1),
|
|
38210
|
+
actor: external_exports.string().min(1).optional(),
|
|
38211
|
+
materializeParams: external_exports.object({
|
|
38212
|
+
task: external_exports.object({
|
|
38213
|
+
id: external_exports.string().min(1),
|
|
38214
|
+
title: external_exports.string().min(1).optional(),
|
|
38215
|
+
category: external_exports.string().optional(),
|
|
38216
|
+
subcategory: external_exports.string().optional(),
|
|
38217
|
+
impact: taskImpactSchema.optional(),
|
|
38218
|
+
autonomyLevel: autonomyLevelSchema.optional(),
|
|
38219
|
+
autonomyReason: external_exports.string().optional(),
|
|
38220
|
+
autoDeploy: autoDeploySchema.optional(),
|
|
38221
|
+
domains: external_exports.array(external_exports.string()).optional(),
|
|
38222
|
+
tags: external_exports.array(external_exports.string()).optional(),
|
|
38223
|
+
planId: external_exports.string().optional(),
|
|
38224
|
+
specWikiPageId: external_exports.string().optional(),
|
|
38225
|
+
assignee: external_exports.string().optional(),
|
|
38226
|
+
notes: external_exports.string().optional()
|
|
38227
|
+
}).strict().optional(),
|
|
38228
|
+
plan: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
38229
|
+
}).strict().optional()
|
|
38230
|
+
}).strict();
|
|
38231
|
+
var mrrlinIntentConfirmResponseSchema = external_exports.discriminatedUnion("ok", [
|
|
38232
|
+
external_exports.object({
|
|
38233
|
+
ok: external_exports.literal(true),
|
|
38234
|
+
confirmation_id: external_exports.string().uuid(),
|
|
38235
|
+
proposal_id: external_exports.string().uuid(),
|
|
38236
|
+
proposal_version: external_exports.number().int(),
|
|
38237
|
+
digest: external_exports.string(),
|
|
38238
|
+
task_id: external_exports.string().nullable().optional()
|
|
38239
|
+
}),
|
|
38240
|
+
external_exports.object({
|
|
38241
|
+
ok: external_exports.literal(false),
|
|
38242
|
+
code: external_exports.string(),
|
|
38243
|
+
message: external_exports.string(),
|
|
38244
|
+
expected_version: external_exports.number().optional(),
|
|
38245
|
+
current_state: external_exports.string().optional()
|
|
38246
|
+
})
|
|
38247
|
+
]);
|
|
38248
|
+
var intentConfirmResultResponseSchema = external_exports.object({
|
|
38249
|
+
data: mrrlinIntentConfirmResponseSchema
|
|
38250
|
+
});
|
|
38251
|
+
var mrrlinIntentConfirmationSchema = external_exports.object({
|
|
38252
|
+
id: external_exports.string().uuid(),
|
|
38253
|
+
projectSlug: external_exports.string().min(1),
|
|
38254
|
+
proposalId: external_exports.string().uuid(),
|
|
38255
|
+
proposalVersion: external_exports.number().int().min(1),
|
|
38256
|
+
confirmedBy: external_exports.string().min(1),
|
|
38257
|
+
digest: external_exports.string().min(1),
|
|
38258
|
+
transcriptRevision: external_exports.string(),
|
|
38259
|
+
transcriptRevisionNumber: external_exports.number().int().nonnegative().optional(),
|
|
38260
|
+
createdAt: external_exports.string()
|
|
38261
|
+
});
|
|
38262
|
+
var intentConfirmationMaybeResponseSchema = external_exports.object({
|
|
38263
|
+
data: mrrlinIntentConfirmationSchema.nullable()
|
|
38264
|
+
});
|
|
38265
|
+
|
|
38112
38266
|
// ../../packages/schemas/dist/appsumo.js
|
|
38113
38267
|
var APPSUMO_CODE_ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
38114
38268
|
var APPSUMO_ALPHABET_SET = new Set(APPSUMO_CODE_ALPHABET);
|
|
@@ -41299,6 +41453,84 @@ function createMrrlinClient(config2) {
|
|
|
41299
41453
|
method: "DELETE"
|
|
41300
41454
|
});
|
|
41301
41455
|
},
|
|
41456
|
+
// ── Server-Authoritative Intent Methods ─────────────────────────────────
|
|
41457
|
+
async appendOperatorTranscriptMessage(projectSlug, content) {
|
|
41458
|
+
const body = await request(`${projectPath(projectSlug)}/intent/transcript`, {
|
|
41459
|
+
method: "POST",
|
|
41460
|
+
headers: { "content-type": "application/json" },
|
|
41461
|
+
body: JSON.stringify({ content })
|
|
41462
|
+
});
|
|
41463
|
+
return operatorTranscriptMessageResponseSchema.parse(body).data;
|
|
41464
|
+
},
|
|
41465
|
+
async listOperatorTranscriptMessages(projectSlug) {
|
|
41466
|
+
const body = await request(`${projectPath(projectSlug)}/intent/transcript`);
|
|
41467
|
+
return operatorTranscriptListResponseSchema.parse(body).data;
|
|
41468
|
+
},
|
|
41469
|
+
async createIntentProposal(projectSlug, input) {
|
|
41470
|
+
const body = await request(`${projectPath(projectSlug)}/intent/proposals`, {
|
|
41471
|
+
method: "POST",
|
|
41472
|
+
headers: { "content-type": "application/json" },
|
|
41473
|
+
body: JSON.stringify(input)
|
|
41474
|
+
});
|
|
41475
|
+
return intentProposalResponseSchema.parse(body).data;
|
|
41476
|
+
},
|
|
41477
|
+
async getIntentProposal(projectSlug, proposalId, version2) {
|
|
41478
|
+
try {
|
|
41479
|
+
const body = await request(`${projectPath(projectSlug)}/intent/proposals/${encodeURIComponent(proposalId)}/${encodeURIComponent(String(version2))}`);
|
|
41480
|
+
return intentProposalMaybeResponseSchema.parse(body).data;
|
|
41481
|
+
} catch (error51) {
|
|
41482
|
+
if (error51 instanceof MrrlinApiError && error51.status === 404)
|
|
41483
|
+
return null;
|
|
41484
|
+
throw error51;
|
|
41485
|
+
}
|
|
41486
|
+
},
|
|
41487
|
+
async recordIntentClarification(projectSlug, input) {
|
|
41488
|
+
const body = await request(`${projectPath(projectSlug)}/intent/clarifications`, {
|
|
41489
|
+
method: "POST",
|
|
41490
|
+
headers: { "content-type": "application/json" },
|
|
41491
|
+
body: JSON.stringify(input)
|
|
41492
|
+
});
|
|
41493
|
+
return intentClarificationResponseSchema.parse(body).data;
|
|
41494
|
+
},
|
|
41495
|
+
async answerIntentClarification(projectSlug, id, input) {
|
|
41496
|
+
const body = await request(`${projectPath(projectSlug)}/intent/clarifications/${encodeURIComponent(id)}/answer`, {
|
|
41497
|
+
method: "POST",
|
|
41498
|
+
headers: { "content-type": "application/json" },
|
|
41499
|
+
body: JSON.stringify(input)
|
|
41500
|
+
});
|
|
41501
|
+
return intentClarificationResponseSchema.parse(body).data;
|
|
41502
|
+
},
|
|
41503
|
+
async confirmIntentProposal(projectSlug, proposalId, input) {
|
|
41504
|
+
try {
|
|
41505
|
+
const body = await request(`${projectPath(projectSlug)}/intent/proposals/${encodeURIComponent(proposalId)}/confirm`, {
|
|
41506
|
+
method: "POST",
|
|
41507
|
+
headers: { "content-type": "application/json" },
|
|
41508
|
+
body: JSON.stringify(input)
|
|
41509
|
+
});
|
|
41510
|
+
return intentConfirmResultResponseSchema.parse(body).data;
|
|
41511
|
+
} catch (error51) {
|
|
41512
|
+
if (error51 instanceof MrrlinApiError && (error51.status === 409 || error51.status === 422)) {
|
|
41513
|
+
try {
|
|
41514
|
+
const parsed = JSON.parse(error51.responseBody);
|
|
41515
|
+
const maybeResult = mrrlinIntentConfirmResponseSchema.safeParse(parsed);
|
|
41516
|
+
if (maybeResult.success)
|
|
41517
|
+
return maybeResult.data;
|
|
41518
|
+
} catch {
|
|
41519
|
+
}
|
|
41520
|
+
}
|
|
41521
|
+
throw error51;
|
|
41522
|
+
}
|
|
41523
|
+
},
|
|
41524
|
+
async getIntentConfirmation(projectSlug, proposalId, version2) {
|
|
41525
|
+
try {
|
|
41526
|
+
const body = await request(`${projectPath(projectSlug)}/intent/confirmations/${encodeURIComponent(proposalId)}/${encodeURIComponent(String(version2))}`);
|
|
41527
|
+
return intentConfirmationMaybeResponseSchema.parse(body).data;
|
|
41528
|
+
} catch (error51) {
|
|
41529
|
+
if (error51 instanceof MrrlinApiError && error51.status === 404)
|
|
41530
|
+
return null;
|
|
41531
|
+
throw error51;
|
|
41532
|
+
}
|
|
41533
|
+
},
|
|
41302
41534
|
async resolveAccount() {
|
|
41303
41535
|
const body = await request("/auth/account/resolve", {
|
|
41304
41536
|
method: "POST"
|
|
@@ -41404,7 +41636,13 @@ async function resolveIndexPath(input) {
|
|
|
41404
41636
|
return import_node_path5.default.resolve(process.env.MRRLIN_WIKI_INDEX_PATH);
|
|
41405
41637
|
}
|
|
41406
41638
|
const workspaceRoot = await findWorkspaceRoot();
|
|
41407
|
-
|
|
41639
|
+
const packageIndexPath = import_node_path5.default.join(workspaceRoot, "packages", "wiki", "wiki-index.json");
|
|
41640
|
+
try {
|
|
41641
|
+
await import_promises3.default.access(packageIndexPath);
|
|
41642
|
+
return packageIndexPath;
|
|
41643
|
+
} catch {
|
|
41644
|
+
return import_node_path5.default.join(workspaceRoot, "apps", "web", "public", "wiki-index.json");
|
|
41645
|
+
}
|
|
41408
41646
|
}
|
|
41409
41647
|
async function walkMarkdownFiles(root, dir = root) {
|
|
41410
41648
|
const entries = await import_promises3.default.readdir(dir, { withFileTypes: true });
|
|
@@ -42045,7 +42283,8 @@ function normalizeDomains(value) {
|
|
|
42045
42283
|
return normalized.length > 0 ? normalized.sort() : [DEFAULT_DOMAIN];
|
|
42046
42284
|
}
|
|
42047
42285
|
function normalizeDomain(value) {
|
|
42048
|
-
|
|
42286
|
+
const domains = normalizeDomains(value);
|
|
42287
|
+
return domains[0] ?? DEFAULT_DOMAIN;
|
|
42049
42288
|
}
|
|
42050
42289
|
function normalizeImpact(value) {
|
|
42051
42290
|
if (typeof value !== "string") return null;
|
|
@@ -42075,8 +42314,9 @@ var PERSONAS_BY_DOMAIN = {
|
|
|
42075
42314
|
function resolveProducerPersona(domain2) {
|
|
42076
42315
|
const domains = normalizeDomains(domain2);
|
|
42077
42316
|
for (const d of domains) {
|
|
42078
|
-
|
|
42079
|
-
|
|
42317
|
+
const persona = PERSONAS_BY_DOMAIN[d];
|
|
42318
|
+
if (d !== "code" && persona) {
|
|
42319
|
+
return persona;
|
|
42080
42320
|
}
|
|
42081
42321
|
}
|
|
42082
42322
|
return null;
|
|
@@ -44107,6 +44347,11 @@ var import_promises4 = require("node:timers/promises");
|
|
|
44107
44347
|
var MODEL_ID_REGEX = /^[a-zA-Z0-9][a-zA-Z0-9._-]{1,63}$/;
|
|
44108
44348
|
var CONVERSATION_ID_REGEX = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
44109
44349
|
var activeProcesses = /* @__PURE__ */ new Set();
|
|
44350
|
+
function signalStartedChild(child, signal) {
|
|
44351
|
+
if (child.pid === void 0 || child.pid <= 0)
|
|
44352
|
+
return;
|
|
44353
|
+
child.kill(signal);
|
|
44354
|
+
}
|
|
44110
44355
|
var globalCleanupInstalled = false;
|
|
44111
44356
|
function installGlobalCleanupOnce() {
|
|
44112
44357
|
if (globalCleanupInstalled)
|
|
@@ -44115,7 +44360,7 @@ function installGlobalCleanupOnce() {
|
|
|
44115
44360
|
process.once("exit", () => {
|
|
44116
44361
|
for (const child of activeProcesses) {
|
|
44117
44362
|
try {
|
|
44118
|
-
child
|
|
44363
|
+
signalStartedChild(child, "SIGKILL");
|
|
44119
44364
|
} catch {
|
|
44120
44365
|
}
|
|
44121
44366
|
}
|
|
@@ -44123,14 +44368,14 @@ function installGlobalCleanupOnce() {
|
|
|
44123
44368
|
const sigHandler = async () => {
|
|
44124
44369
|
for (const child of activeProcesses) {
|
|
44125
44370
|
try {
|
|
44126
|
-
child
|
|
44371
|
+
signalStartedChild(child, "SIGTERM");
|
|
44127
44372
|
} catch {
|
|
44128
44373
|
}
|
|
44129
44374
|
}
|
|
44130
44375
|
await (0, import_promises4.setTimeout)(1e3);
|
|
44131
44376
|
for (const child of activeProcesses) {
|
|
44132
44377
|
try {
|
|
44133
|
-
child
|
|
44378
|
+
signalStartedChild(child, "SIGKILL");
|
|
44134
44379
|
} catch {
|
|
44135
44380
|
}
|
|
44136
44381
|
}
|
|
@@ -44261,11 +44506,11 @@ var AgyProcess = class _AgyProcess {
|
|
|
44261
44506
|
return () => this.exitHandlers.delete(handler);
|
|
44262
44507
|
}
|
|
44263
44508
|
async dispose() {
|
|
44264
|
-
if (this.exited || this.child.killed) {
|
|
44509
|
+
if (this.exited || this.child.killed || this.child.pid === void 0 || this.child.pid <= 0) {
|
|
44265
44510
|
activeProcesses.delete(this.child);
|
|
44266
44511
|
return;
|
|
44267
44512
|
}
|
|
44268
|
-
this.child
|
|
44513
|
+
signalStartedChild(this.child, "SIGTERM");
|
|
44269
44514
|
try {
|
|
44270
44515
|
await Promise.race([
|
|
44271
44516
|
(0, import_node_events2.once)(this.child, "exit"),
|
|
@@ -44275,7 +44520,7 @@ var AgyProcess = class _AgyProcess {
|
|
|
44275
44520
|
}
|
|
44276
44521
|
if (!this.exited) {
|
|
44277
44522
|
try {
|
|
44278
|
-
this.child
|
|
44523
|
+
signalStartedChild(this.child, "SIGKILL");
|
|
44279
44524
|
} catch {
|
|
44280
44525
|
}
|
|
44281
44526
|
}
|
|
@@ -45057,7 +45302,7 @@ function extractOneShotResult2(stdout) {
|
|
|
45057
45302
|
} catch {
|
|
45058
45303
|
return { ok: false, error: "agy exec produced no parseable JSON output" };
|
|
45059
45304
|
}
|
|
45060
|
-
if (parsed.status !== "SUCCESS" || typeof parsed.response !== "string") {
|
|
45305
|
+
if (!parsed || parsed.status !== "SUCCESS" || typeof parsed.response !== "string") {
|
|
45061
45306
|
return { ok: false, error: `agy exec failed or returned invalid response format: ${JSON.stringify(parsed)}` };
|
|
45062
45307
|
}
|
|
45063
45308
|
return {
|
|
@@ -45248,19 +45493,22 @@ async function resolveSpecDomains(client, projectSlug, page) {
|
|
|
45248
45493
|
const taskId = await resolveGatedTaskId(client, projectSlug, page);
|
|
45249
45494
|
if (taskId !== null) {
|
|
45250
45495
|
const task = await client.getTask(projectSlug, taskId);
|
|
45251
|
-
|
|
45496
|
+
const taskRecord = task;
|
|
45497
|
+
return normalizeDomainArray(taskRecord?.domains ?? taskRecord?.domain);
|
|
45252
45498
|
}
|
|
45253
45499
|
const plans = await client.listPlans(projectSlug);
|
|
45254
45500
|
const plan = plans.find((p) => p.specWikiPageId === page.id);
|
|
45255
45501
|
if (plan) {
|
|
45256
|
-
const
|
|
45502
|
+
const planRecord = plan;
|
|
45503
|
+
const rawPlanDomains = planRecord?.domains ?? planRecord?.domain;
|
|
45257
45504
|
const substantivePlanDomains = (Array.isArray(rawPlanDomains) ? rawPlanDomains : rawPlanDomains != null ? [rawPlanDomains] : []).map(String).map((d) => d.trim().toLowerCase()).filter(Boolean);
|
|
45258
45505
|
if (substantivePlanDomains.length > 0) {
|
|
45259
45506
|
return normalizeDomainArray(substantivePlanDomains);
|
|
45260
45507
|
}
|
|
45261
45508
|
}
|
|
45262
45509
|
const project = await client.getProject(projectSlug);
|
|
45263
|
-
|
|
45510
|
+
const projectRecord = project;
|
|
45511
|
+
return normalizeDomainArray(projectRecord?.defaultDomains ?? projectRecord?.defaultDomain);
|
|
45264
45512
|
} catch {
|
|
45265
45513
|
return ["code"];
|
|
45266
45514
|
}
|
|
@@ -45676,14 +45924,16 @@ function buildSpecGateDeps(args) {
|
|
|
45676
45924
|
const plan = plans.find((p) => p.specWikiPageId === specPageId);
|
|
45677
45925
|
if (plan) {
|
|
45678
45926
|
const project2 = await client.getProject(projectSlug);
|
|
45679
|
-
const
|
|
45927
|
+
const planRecord = plan;
|
|
45928
|
+
const projectRecord = project2;
|
|
45929
|
+
const rawPlanDomains = planRecord.domains ?? planRecord.domain;
|
|
45680
45930
|
const substantivePlanDomains = (Array.isArray(rawPlanDomains) ? rawPlanDomains : rawPlanDomains != null ? [rawPlanDomains] : []).map(String).map((d) => d.trim().toLowerCase()).filter(Boolean);
|
|
45681
|
-
const planDomains = substantivePlanDomains.length > 0 ? substantivePlanDomains :
|
|
45931
|
+
const planDomains = substantivePlanDomains.length > 0 ? substantivePlanDomains : projectRecord?.defaultDomains ?? (projectRecord?.defaultDomain ? [projectRecord.defaultDomain] : void 0);
|
|
45682
45932
|
return {
|
|
45683
45933
|
taskId: null,
|
|
45684
45934
|
planId: plan.id,
|
|
45685
45935
|
seed: null,
|
|
45686
|
-
title:
|
|
45936
|
+
title: planRecord.title ?? plan.name ?? null,
|
|
45687
45937
|
domains: planDomains,
|
|
45688
45938
|
notes: null
|
|
45689
45939
|
};
|
|
@@ -46062,7 +46312,8 @@ async function buildDeliverableGateDeps(args) {
|
|
|
46062
46312
|
let criteria = [];
|
|
46063
46313
|
if (taskId) {
|
|
46064
46314
|
const task = await client.getTask(projectSlug, taskId);
|
|
46065
|
-
|
|
46315
|
+
const taskRecord = task;
|
|
46316
|
+
domain2 = normalizeDomain(taskRecord?.domains ?? taskRecord?.domain);
|
|
46066
46317
|
impact = task?.impact;
|
|
46067
46318
|
taskTitle = task?.title ?? "";
|
|
46068
46319
|
if (task?.specWikiPageId) {
|
|
@@ -46746,7 +46997,7 @@ async function deliverToWiki(client, projectSlug, payload) {
|
|
|
46746
46997
|
return client.updateWikiPage(projectSlug, payload.pageId, payload.patch);
|
|
46747
46998
|
}
|
|
46748
46999
|
|
|
46749
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
47000
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
|
|
46750
47001
|
function isZ4Schema(s) {
|
|
46751
47002
|
const schema = s;
|
|
46752
47003
|
return !!schema._zod;
|
|
@@ -46809,7 +47060,7 @@ function getLiteralValue(schema) {
|
|
|
46809
47060
|
return void 0;
|
|
46810
47061
|
}
|
|
46811
47062
|
|
|
46812
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
47063
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
|
|
46813
47064
|
var LATEST_PROTOCOL_VERSION = "2025-11-25";
|
|
46814
47065
|
var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
|
|
46815
47066
|
var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
|
|
@@ -48329,7 +48580,7 @@ var UrlElicitationRequiredError = class extends McpError {
|
|
|
48329
48580
|
}
|
|
48330
48581
|
};
|
|
48331
48582
|
|
|
48332
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
48583
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
|
|
48333
48584
|
function isTerminal(status) {
|
|
48334
48585
|
return status === "completed" || status === "failed" || status === "cancelled";
|
|
48335
48586
|
}
|
|
@@ -48340,7 +48591,7 @@ var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use")
|
|
|
48340
48591
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@4.4.3/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
|
|
48341
48592
|
var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
48342
48593
|
|
|
48343
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
48594
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
|
|
48344
48595
|
function getMethodLiteral(schema) {
|
|
48345
48596
|
const shape = getObjectShape(schema);
|
|
48346
48597
|
const methodSchema = shape?.method;
|
|
@@ -48361,7 +48612,7 @@ function parseWithCompat(schema, data) {
|
|
|
48361
48612
|
return result.data;
|
|
48362
48613
|
}
|
|
48363
48614
|
|
|
48364
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
48615
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
|
|
48365
48616
|
var DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4;
|
|
48366
48617
|
var Protocol = class {
|
|
48367
48618
|
constructor(_options) {
|
|
@@ -48402,6 +48653,9 @@ var Protocol = class {
|
|
|
48402
48653
|
this.setRequestHandler(GetTaskPayloadRequestSchema, async (request, extra) => {
|
|
48403
48654
|
const handleTaskResult = async () => {
|
|
48404
48655
|
const taskId = request.params.taskId;
|
|
48656
|
+
if (!await this._taskStore.getTask(taskId, extra.sessionId)) {
|
|
48657
|
+
throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
|
|
48658
|
+
}
|
|
48405
48659
|
if (this._taskMessageQueue) {
|
|
48406
48660
|
let queuedMessage;
|
|
48407
48661
|
while (queuedMessage = await this._taskMessageQueue.dequeue(taskId, extra.sessionId)) {
|
|
@@ -48432,12 +48686,12 @@ var Protocol = class {
|
|
|
48432
48686
|
throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
|
|
48433
48687
|
}
|
|
48434
48688
|
if (!isTerminal(task.status)) {
|
|
48435
|
-
await this._waitForTaskUpdate(taskId, extra.signal);
|
|
48689
|
+
await this._waitForTaskUpdate(taskId, extra.signal, extra.sessionId);
|
|
48436
48690
|
return await handleTaskResult();
|
|
48437
48691
|
}
|
|
48438
48692
|
if (isTerminal(task.status)) {
|
|
48439
48693
|
const result = await this._taskStore.getTaskResult(taskId, extra.sessionId);
|
|
48440
|
-
this._clearTaskQueue(taskId);
|
|
48694
|
+
this._clearTaskQueue(taskId, extra.sessionId);
|
|
48441
48695
|
return {
|
|
48442
48696
|
...result,
|
|
48443
48697
|
_meta: {
|
|
@@ -48474,7 +48728,7 @@ var Protocol = class {
|
|
|
48474
48728
|
throw new McpError(ErrorCode.InvalidParams, `Cannot cancel task in terminal status: ${task.status}`);
|
|
48475
48729
|
}
|
|
48476
48730
|
await this._taskStore.updateTaskStatus(request.params.taskId, "cancelled", "Client cancelled task execution.", extra.sessionId);
|
|
48477
|
-
this._clearTaskQueue(request.params.taskId);
|
|
48731
|
+
this._clearTaskQueue(request.params.taskId, extra.sessionId);
|
|
48478
48732
|
const cancelledTask = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
|
|
48479
48733
|
if (!cancelledTask) {
|
|
48480
48734
|
throw new McpError(ErrorCode.InvalidParams, `Task not found after cancellation: ${request.params.taskId}`);
|
|
@@ -48602,6 +48856,19 @@ var Protocol = class {
|
|
|
48602
48856
|
const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler;
|
|
48603
48857
|
const capturedTransport = this._transport;
|
|
48604
48858
|
const relatedTaskId = request.params?._meta?.[RELATED_TASK_META_KEY]?.taskId;
|
|
48859
|
+
const sessionId = capturedTransport?.sessionId;
|
|
48860
|
+
const store = this._taskStore;
|
|
48861
|
+
let relatedTaskFound = true;
|
|
48862
|
+
let relatedTaskLookup;
|
|
48863
|
+
if (relatedTaskId && store && this._taskMessageQueue && sessionId !== void 0) {
|
|
48864
|
+
relatedTaskFound = false;
|
|
48865
|
+
relatedTaskLookup = (async () => {
|
|
48866
|
+
if (!await store.getTask(relatedTaskId, sessionId)) {
|
|
48867
|
+
throw new McpError(ErrorCode.InvalidParams, `Task not found: ${relatedTaskId}`);
|
|
48868
|
+
}
|
|
48869
|
+
relatedTaskFound = true;
|
|
48870
|
+
})();
|
|
48871
|
+
}
|
|
48605
48872
|
if (handler === void 0) {
|
|
48606
48873
|
const errorResponse = {
|
|
48607
48874
|
jsonrpc: "2.0",
|
|
@@ -48611,7 +48878,10 @@ var Protocol = class {
|
|
|
48611
48878
|
message: "Method not found"
|
|
48612
48879
|
}
|
|
48613
48880
|
};
|
|
48614
|
-
if (relatedTaskId &&
|
|
48881
|
+
if (relatedTaskId && relatedTaskLookup) {
|
|
48882
|
+
const queuedError = { type: "error", message: errorResponse, timestamp: Date.now() };
|
|
48883
|
+
relatedTaskLookup.then(() => this._enqueueTaskMessage(relatedTaskId, queuedError, sessionId), () => capturedTransport?.send(errorResponse)).catch((error51) => this._onerror(new Error(`Failed to send an error response: ${error51}`)));
|
|
48884
|
+
} else if (relatedTaskId && this._taskMessageQueue) {
|
|
48615
48885
|
this._enqueueTaskMessage(relatedTaskId, {
|
|
48616
48886
|
type: "error",
|
|
48617
48887
|
message: errorResponse,
|
|
@@ -48662,7 +48932,10 @@ var Protocol = class {
|
|
|
48662
48932
|
closeSSEStream: extra?.closeSSEStream,
|
|
48663
48933
|
closeStandaloneSSEStream: extra?.closeStandaloneSSEStream
|
|
48664
48934
|
};
|
|
48665
|
-
Promise.resolve().then(() => {
|
|
48935
|
+
(relatedTaskLookup ?? Promise.resolve()).then(() => {
|
|
48936
|
+
if (relatedTaskLookup && abortController.signal.aborted) {
|
|
48937
|
+
throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
|
|
48938
|
+
}
|
|
48666
48939
|
if (taskCreationParams) {
|
|
48667
48940
|
this.assertTaskHandlerCapability(request.method);
|
|
48668
48941
|
}
|
|
@@ -48697,7 +48970,7 @@ var Protocol = class {
|
|
|
48697
48970
|
...error51["data"] !== void 0 && { data: error51["data"] }
|
|
48698
48971
|
}
|
|
48699
48972
|
};
|
|
48700
|
-
if (relatedTaskId && this._taskMessageQueue) {
|
|
48973
|
+
if (relatedTaskId && this._taskMessageQueue && relatedTaskFound) {
|
|
48701
48974
|
await this._enqueueTaskMessage(relatedTaskId, {
|
|
48702
48975
|
type: "error",
|
|
48703
48976
|
message: errorResponse,
|
|
@@ -49177,7 +49450,7 @@ var Protocol = class {
|
|
|
49177
49450
|
throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");
|
|
49178
49451
|
}
|
|
49179
49452
|
const maxQueueSize = this._options?.maxTaskQueueSize;
|
|
49180
|
-
await this._taskMessageQueue.enqueue(taskId, message, sessionId, maxQueueSize);
|
|
49453
|
+
await this._taskMessageQueue.enqueue(taskId, message, sessionId ?? this._transport?.sessionId, maxQueueSize);
|
|
49181
49454
|
}
|
|
49182
49455
|
/**
|
|
49183
49456
|
* Clears the message queue for a task and rejects any pending request resolvers.
|
|
@@ -49206,12 +49479,13 @@ var Protocol = class {
|
|
|
49206
49479
|
* Uses polling to check for updates at the task's configured poll interval.
|
|
49207
49480
|
* @param taskId The task ID to wait for
|
|
49208
49481
|
* @param signal Abort signal to cancel the wait
|
|
49482
|
+
* @param sessionId Session of the request that waits, passed to the task store
|
|
49209
49483
|
* @returns Promise that resolves when an update occurs or rejects if aborted
|
|
49210
49484
|
*/
|
|
49211
|
-
async _waitForTaskUpdate(taskId, signal) {
|
|
49485
|
+
async _waitForTaskUpdate(taskId, signal, sessionId) {
|
|
49212
49486
|
let interval = this._options?.defaultTaskPollInterval ?? 1e3;
|
|
49213
49487
|
try {
|
|
49214
|
-
const task = await this._taskStore?.getTask(taskId);
|
|
49488
|
+
const task = await this._taskStore?.getTask(taskId, sessionId);
|
|
49215
49489
|
if (task?.pollInterval) {
|
|
49216
49490
|
interval = task.pollInterval;
|
|
49217
49491
|
}
|
|
@@ -49315,7 +49589,7 @@ function mergeCapabilities(base, additional) {
|
|
|
49315
49589
|
return result;
|
|
49316
49590
|
}
|
|
49317
49591
|
|
|
49318
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
49592
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
|
|
49319
49593
|
var import_ajv = __toESM(require_ajv(), 1);
|
|
49320
49594
|
var import_ajv_formats = __toESM(require_dist(), 1);
|
|
49321
49595
|
function createDefaultAjvInstance() {
|
|
@@ -49383,7 +49657,7 @@ var AjvJsonSchemaValidator = class {
|
|
|
49383
49657
|
}
|
|
49384
49658
|
};
|
|
49385
49659
|
|
|
49386
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
49660
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js
|
|
49387
49661
|
var ExperimentalClientTasks = class {
|
|
49388
49662
|
constructor(_client) {
|
|
49389
49663
|
this._client = _client;
|
|
@@ -49537,7 +49811,7 @@ var ExperimentalClientTasks = class {
|
|
|
49537
49811
|
}
|
|
49538
49812
|
};
|
|
49539
49813
|
|
|
49540
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
49814
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
|
|
49541
49815
|
function assertToolsCallTaskCapability(requests, method, entityName) {
|
|
49542
49816
|
if (!requests) {
|
|
49543
49817
|
throw new Error(`${entityName} does not support task creation (required for ${method})`);
|
|
@@ -49572,7 +49846,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
|
|
|
49572
49846
|
}
|
|
49573
49847
|
}
|
|
49574
49848
|
|
|
49575
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
49849
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js
|
|
49576
49850
|
function applyElicitationDefaults(schema, data) {
|
|
49577
49851
|
if (!schema || data === null || typeof data !== "object")
|
|
49578
49852
|
return;
|
|
@@ -50083,7 +50357,7 @@ var Client = class extends Protocol {
|
|
|
50083
50357
|
}
|
|
50084
50358
|
};
|
|
50085
50359
|
|
|
50086
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
50360
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js
|
|
50087
50361
|
var import_content_type = __toESM(require_content_type(), 1);
|
|
50088
50362
|
function mediaTypeEssence(header) {
|
|
50089
50363
|
if (!header) {
|
|
@@ -50100,7 +50374,7 @@ function mediaTypeEssence(header) {
|
|
|
50100
50374
|
}
|
|
50101
50375
|
}
|
|
50102
50376
|
|
|
50103
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
50377
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js
|
|
50104
50378
|
function normalizeHeaders(headers) {
|
|
50105
50379
|
if (!headers)
|
|
50106
50380
|
return {};
|
|
@@ -50126,6 +50400,68 @@ function createFetchWithInit(baseFetch = fetch, baseInit) {
|
|
|
50126
50400
|
return baseFetch(url2, mergedInit);
|
|
50127
50401
|
};
|
|
50128
50402
|
}
|
|
50403
|
+
var MAX_REDIRECTS = 5;
|
|
50404
|
+
var REDIRECT_STATUSES = [301, 302, 303, 307, 308];
|
|
50405
|
+
function isWithinOrigin(from, to) {
|
|
50406
|
+
if (from.protocol === to.protocol && from.hostname === to.hostname && from.port === to.port) {
|
|
50407
|
+
return true;
|
|
50408
|
+
}
|
|
50409
|
+
return from.hostname === to.hostname && from.protocol === "http:" && from.port === "" && to.protocol === "https:" && to.port === "";
|
|
50410
|
+
}
|
|
50411
|
+
function redirectTarget(response, requestUrl) {
|
|
50412
|
+
const location = REDIRECT_STATUSES.includes(response.status) ? response.headers.get("location") : null;
|
|
50413
|
+
try {
|
|
50414
|
+
return location ? new URL(location, requestUrl) : void 0;
|
|
50415
|
+
} catch {
|
|
50416
|
+
return void 0;
|
|
50417
|
+
}
|
|
50418
|
+
}
|
|
50419
|
+
function followWithinOrigin(baseFetch, url2, init, response, followed = 0) {
|
|
50420
|
+
const target = redirectTarget(response, url2);
|
|
50421
|
+
const keepsMethod = response.status === 307 || response.status === 308 || (init?.method ?? "GET").toUpperCase() === "GET";
|
|
50422
|
+
if (!target || followed === MAX_REDIRECTS || !keepsMethod) {
|
|
50423
|
+
return void 0;
|
|
50424
|
+
}
|
|
50425
|
+
const from = new URL(url2);
|
|
50426
|
+
const addsUserinfo = (target.username || target.password) && (target.username !== from.username || target.password !== from.password);
|
|
50427
|
+
if (addsUserinfo || !isWithinOrigin(from, target)) {
|
|
50428
|
+
return void 0;
|
|
50429
|
+
}
|
|
50430
|
+
return Promise.resolve(response.body?.cancel()).then(() => baseFetch(target, { ...init, redirect: "manual" })).then((next) => followWithinOrigin(baseFetch, target, init, next, followed + 1) ?? next);
|
|
50431
|
+
}
|
|
50432
|
+
var followingFetches = /* @__PURE__ */ new WeakSet();
|
|
50433
|
+
function fetchLeavingRedirects(baseFetch) {
|
|
50434
|
+
const following = (url2, init) => (baseFetch ?? fetch)(url2, init);
|
|
50435
|
+
followingFetches.add(following);
|
|
50436
|
+
return following;
|
|
50437
|
+
}
|
|
50438
|
+
function fetchWithinOrigin(baseFetch = fetch) {
|
|
50439
|
+
if (followingFetches.has(baseFetch)) {
|
|
50440
|
+
return baseFetch;
|
|
50441
|
+
}
|
|
50442
|
+
return (url2, init) => {
|
|
50443
|
+
if (init?.redirect === "error" || init?.redirect === "manual") {
|
|
50444
|
+
return baseFetch(url2, init);
|
|
50445
|
+
}
|
|
50446
|
+
return Promise.resolve(baseFetch(url2, { ...init, redirect: "manual" })).then((response) => followWithinOrigin(baseFetch, url2, init, response) ?? response);
|
|
50447
|
+
};
|
|
50448
|
+
}
|
|
50449
|
+
function unfollowedRedirect(response, requestUrl) {
|
|
50450
|
+
if (response.type === "opaqueredirect") {
|
|
50451
|
+
return "Redirect not followed: this runtime does not expose the redirect target";
|
|
50452
|
+
}
|
|
50453
|
+
const from = response.url || requestUrl;
|
|
50454
|
+
const target = redirectTarget(response, from);
|
|
50455
|
+
if (!target) {
|
|
50456
|
+
return void 0;
|
|
50457
|
+
}
|
|
50458
|
+
target.username = target.password = target.search = target.hash = "";
|
|
50459
|
+
if (target.protocol === "http:" && new URL(from).protocol === "https:") {
|
|
50460
|
+
target.protocol = "https:";
|
|
50461
|
+
return `Redirect to plain http not followed; try ${target.href} instead`;
|
|
50462
|
+
}
|
|
50463
|
+
return `Redirect to ${target.href} not followed`;
|
|
50464
|
+
}
|
|
50129
50465
|
|
|
50130
50466
|
// ../../node_modules/.pnpm/pkce-challenge@5.0.1/node_modules/pkce-challenge/dist/index.node.js
|
|
50131
50467
|
var crypto3;
|
|
@@ -50170,7 +50506,7 @@ async function pkceChallenge(length) {
|
|
|
50170
50506
|
};
|
|
50171
50507
|
}
|
|
50172
50508
|
|
|
50173
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
50509
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
|
|
50174
50510
|
var SafeUrlSchema = url().superRefine((val, ctx) => {
|
|
50175
50511
|
if (!URL.canParse(val)) {
|
|
50176
50512
|
ctx.addIssue({
|
|
@@ -50272,7 +50608,12 @@ var OAuthTokensSchema = object({
|
|
|
50272
50608
|
token_type: string2(),
|
|
50273
50609
|
expires_in: coerce_exports.number().optional(),
|
|
50274
50610
|
scope: string2().optional(),
|
|
50275
|
-
refresh_token: string2().optional()
|
|
50611
|
+
refresh_token: string2().optional(),
|
|
50612
|
+
/**
|
|
50613
|
+
* Not part of the wire format: the authorization server this value was obtained from, added by
|
|
50614
|
+
* the client's `auth()` before it is stored and compared when it is read back.
|
|
50615
|
+
*/
|
|
50616
|
+
issuer: string2().optional().catch(void 0)
|
|
50276
50617
|
}).strip();
|
|
50277
50618
|
var OAuthErrorResponseSchema = object({
|
|
50278
50619
|
error: string2(),
|
|
@@ -50302,7 +50643,12 @@ var OAuthClientInformationSchema = object({
|
|
|
50302
50643
|
client_id: string2(),
|
|
50303
50644
|
client_secret: string2().optional(),
|
|
50304
50645
|
client_id_issued_at: number2().optional(),
|
|
50305
|
-
client_secret_expires_at: number2().optional()
|
|
50646
|
+
client_secret_expires_at: number2().optional(),
|
|
50647
|
+
/**
|
|
50648
|
+
* Not part of the wire format: the authorization server this value was obtained from, added by
|
|
50649
|
+
* the client's `auth()` before it is stored and compared when it is read back.
|
|
50650
|
+
*/
|
|
50651
|
+
issuer: string2().optional().catch(void 0)
|
|
50306
50652
|
}).strip();
|
|
50307
50653
|
var OAuthClientInformationFullSchema = OAuthClientMetadataSchema.merge(OAuthClientInformationSchema);
|
|
50308
50654
|
var OAuthClientRegistrationErrorSchema = object({
|
|
@@ -50314,7 +50660,7 @@ var OAuthTokenRevocationRequestSchema = object({
|
|
|
50314
50660
|
token_type_hint: string2().optional()
|
|
50315
50661
|
}).strip();
|
|
50316
50662
|
|
|
50317
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
50663
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js
|
|
50318
50664
|
function resourceUrlFromServerUrl(url2) {
|
|
50319
50665
|
const resourceURL = typeof url2 === "string" ? new URL(url2) : new URL(url2.href);
|
|
50320
50666
|
resourceURL.hash = "";
|
|
@@ -50334,7 +50680,7 @@ function checkResourceAllowed({ requestedResource, configuredResource }) {
|
|
|
50334
50680
|
return requestedPath.startsWith(configuredPath);
|
|
50335
50681
|
}
|
|
50336
50682
|
|
|
50337
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
50683
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
|
|
50338
50684
|
var OAuthError = class extends Error {
|
|
50339
50685
|
constructor(message, errorUri) {
|
|
50340
50686
|
super(message);
|
|
@@ -50429,7 +50775,7 @@ var OAUTH_ERRORS = {
|
|
|
50429
50775
|
[InvalidTargetError.errorCode]: InvalidTargetError
|
|
50430
50776
|
};
|
|
50431
50777
|
|
|
50432
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
50778
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
|
|
50433
50779
|
var UnauthorizedError = class extends Error {
|
|
50434
50780
|
constructor(message) {
|
|
50435
50781
|
super(message ?? "Unauthorized");
|
|
@@ -50500,10 +50846,31 @@ async function parseErrorResponse(input) {
|
|
|
50500
50846
|
const errorClass = OAUTH_ERRORS[error51] || ServerError;
|
|
50501
50847
|
return new errorClass(error_description || "", error_uri);
|
|
50502
50848
|
} catch (error51) {
|
|
50503
|
-
const
|
|
50849
|
+
const redirect = input instanceof Response ? unfollowedRedirect(input, input.url) : void 0;
|
|
50850
|
+
const errorMessage = `${statusCode ? `HTTP ${statusCode}: ` : ""}${redirect ?? `Invalid OAuth error response: ${error51}. Raw body: ${body}`}`;
|
|
50504
50851
|
return new ServerError(errorMessage);
|
|
50505
50852
|
}
|
|
50506
50853
|
}
|
|
50854
|
+
function issuersMatch(a, b) {
|
|
50855
|
+
let [x, y] = [a, b];
|
|
50856
|
+
try {
|
|
50857
|
+
[x, y] = [new URL(a).href, new URL(b).href];
|
|
50858
|
+
} catch {
|
|
50859
|
+
}
|
|
50860
|
+
return x === y || x.endsWith("/") && x.slice(0, -1) === y || y.endsWith("/") && y.slice(0, -1) === x;
|
|
50861
|
+
}
|
|
50862
|
+
function discardIfIssuerMismatch(stored, issuer) {
|
|
50863
|
+
if (!stored)
|
|
50864
|
+
return void 0;
|
|
50865
|
+
if (typeof stored.issuer !== "string")
|
|
50866
|
+
return stored.issuer == null ? stored : { ...stored, issuer: void 0 };
|
|
50867
|
+
return issuersMatch(stored.issuer, issuer) ? stored : void 0;
|
|
50868
|
+
}
|
|
50869
|
+
var TokenResponseSchema = OAuthTokensSchema.omit({ issuer: true });
|
|
50870
|
+
var RegistrationResponseSchema = OAuthClientInformationFullSchema.omit({ issuer: true });
|
|
50871
|
+
function boundElsewhereError(stored, issuer) {
|
|
50872
|
+
return new Error(`OAuth client information is bound to authorization server ${stored.issuer} and is not presented to ${issuer}. Clear the stored client information, or correct \`expectedIssuer\`, if the authorization server has moved.`);
|
|
50873
|
+
}
|
|
50507
50874
|
async function auth(provider, options) {
|
|
50508
50875
|
try {
|
|
50509
50876
|
return await authInternal(provider, options);
|
|
@@ -50557,9 +50924,24 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
|
|
|
50557
50924
|
authorizationServerMetadata: metadata
|
|
50558
50925
|
});
|
|
50559
50926
|
}
|
|
50560
|
-
const
|
|
50927
|
+
const issuer = String(authorizationServerUrl);
|
|
50928
|
+
const selectedResource = await selectResourceURL(serverUrl, provider, resourceMetadata);
|
|
50929
|
+
const resource = selectedResource && resourceMetadata && !provider.validateResourceURL ? resourceMetadata.resource : selectedResource;
|
|
50561
50930
|
const resolvedScope = scope || resourceMetadata?.scopes_supported?.join(" ") || provider.clientMetadata.scope;
|
|
50562
|
-
|
|
50931
|
+
const storedClientInformation = await Promise.resolve(provider.clientInformation());
|
|
50932
|
+
let clientInformation = discardIfIssuerMismatch(storedClientInformation, issuer);
|
|
50933
|
+
const canRegisterAgain = provider.saveClientInformation !== void 0 && !!provider.redirectUrl;
|
|
50934
|
+
if (storedClientInformation && !clientInformation && !canRegisterAgain) {
|
|
50935
|
+
throw boundElsewhereError(storedClientInformation, issuer);
|
|
50936
|
+
}
|
|
50937
|
+
const unstampedClientInformation = clientInformation?.issuer == null ? clientInformation : void 0;
|
|
50938
|
+
const bindClientInformation = async () => {
|
|
50939
|
+
try {
|
|
50940
|
+
if (unstampedClientInformation)
|
|
50941
|
+
await provider.saveClientInformation?.({ ...unstampedClientInformation, issuer });
|
|
50942
|
+
} catch {
|
|
50943
|
+
}
|
|
50944
|
+
};
|
|
50563
50945
|
if (!clientInformation) {
|
|
50564
50946
|
if (authorizationCode !== void 0) {
|
|
50565
50947
|
throw new Error("Existing OAuth client information is required when exchanging an authorization code");
|
|
@@ -50571,9 +50953,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
|
|
|
50571
50953
|
}
|
|
50572
50954
|
const shouldUseUrlBasedClientId = supportsUrlBasedClientId && clientMetadataUrl;
|
|
50573
50955
|
if (shouldUseUrlBasedClientId) {
|
|
50574
|
-
clientInformation = {
|
|
50575
|
-
client_id: clientMetadataUrl
|
|
50576
|
-
};
|
|
50956
|
+
clientInformation = { client_id: clientMetadataUrl, issuer };
|
|
50577
50957
|
await provider.saveClientInformation?.(clientInformation);
|
|
50578
50958
|
} else {
|
|
50579
50959
|
if (!provider.saveClientInformation) {
|
|
@@ -50585,8 +50965,8 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
|
|
|
50585
50965
|
scope: resolvedScope,
|
|
50586
50966
|
fetchFn
|
|
50587
50967
|
});
|
|
50588
|
-
|
|
50589
|
-
clientInformation
|
|
50968
|
+
clientInformation = { ...fullInformation, issuer };
|
|
50969
|
+
await provider.saveClientInformation(clientInformation);
|
|
50590
50970
|
}
|
|
50591
50971
|
}
|
|
50592
50972
|
const nonInteractiveFlow = !provider.redirectUrl;
|
|
@@ -50597,10 +50977,14 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
|
|
|
50597
50977
|
authorizationCode,
|
|
50598
50978
|
fetchFn
|
|
50599
50979
|
});
|
|
50600
|
-
await
|
|
50980
|
+
await bindClientInformation();
|
|
50981
|
+
await provider.saveTokens({ ...tokens3, issuer });
|
|
50601
50982
|
return "AUTHORIZED";
|
|
50602
50983
|
}
|
|
50603
|
-
const tokens2 = await provider.tokens();
|
|
50984
|
+
const tokens2 = discardIfIssuerMismatch(await provider.tokens(), issuer);
|
|
50985
|
+
if (tokens2?.refresh_token && tokens2.issuer == null) {
|
|
50986
|
+
console.warn("[mcp-sdk] stored OAuth tokens have no 'issuer' property (saved by an earlier version, or by a provider that does not keep it) and are used as-is; make sure your OAuthClientProvider stores what saveTokens() and saveClientInformation() receive unchanged.");
|
|
50987
|
+
}
|
|
50604
50988
|
if (tokens2?.refresh_token) {
|
|
50605
50989
|
try {
|
|
50606
50990
|
const newTokens = await refreshAuthorization(authorizationServerUrl, {
|
|
@@ -50611,7 +50995,8 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
|
|
|
50611
50995
|
addClientAuthentication: provider.addClientAuthentication,
|
|
50612
50996
|
fetchFn
|
|
50613
50997
|
});
|
|
50614
|
-
await
|
|
50998
|
+
await bindClientInformation();
|
|
50999
|
+
await provider.saveTokens({ ...newTokens, issuer });
|
|
50615
51000
|
return "AUTHORIZED";
|
|
50616
51001
|
} catch (error51) {
|
|
50617
51002
|
if (!(error51 instanceof OAuthError) || error51 instanceof ServerError) {
|
|
@@ -50710,7 +51095,7 @@ async function discoverOAuthProtectedResourceMetadata(serverUrl, opts, fetchFn =
|
|
|
50710
51095
|
}
|
|
50711
51096
|
async function fetchWithCorsRetry(url2, headers, fetchFn = fetch) {
|
|
50712
51097
|
try {
|
|
50713
|
-
return await fetchFn(url2, { headers });
|
|
51098
|
+
return await fetchWithinOrigin(fetchFn)(url2, { headers });
|
|
50714
51099
|
} catch (error51) {
|
|
50715
51100
|
if (error51 instanceof TypeError) {
|
|
50716
51101
|
if (headers) {
|
|
@@ -50735,7 +51120,7 @@ async function tryMetadataDiscovery(url2, protocolVersion, fetchFn = fetch) {
|
|
|
50735
51120
|
return await fetchWithCorsRetry(url2, headers, fetchFn);
|
|
50736
51121
|
}
|
|
50737
51122
|
function shouldAttemptFallback(response, pathname) {
|
|
50738
|
-
return !response || response.
|
|
51123
|
+
return !response || !response.ok && response.status < 500 && pathname !== "/";
|
|
50739
51124
|
}
|
|
50740
51125
|
async function discoverMetadataWithFallback(serverUrl, wellKnownType, fetchFn, opts) {
|
|
50741
51126
|
const issuer = new URL(serverUrl);
|
|
@@ -50801,7 +51186,7 @@ async function discoverAuthorizationServerMetadata(authorizationServerUrl, { fet
|
|
|
50801
51186
|
}
|
|
50802
51187
|
if (!response.ok) {
|
|
50803
51188
|
await response.body?.cancel();
|
|
50804
|
-
if (response.status
|
|
51189
|
+
if (response.status < 500) {
|
|
50805
51190
|
continue;
|
|
50806
51191
|
}
|
|
50807
51192
|
throw new Error(`HTTP ${response.status} trying to load ${type === "oauth" ? "OAuth" : "OpenID provider"} metadata from ${endpointUrl}`);
|
|
@@ -50834,6 +51219,9 @@ async function discoverOAuthServerInfo(serverUrl, opts) {
|
|
|
50834
51219
|
resourceMetadata
|
|
50835
51220
|
};
|
|
50836
51221
|
}
|
|
51222
|
+
function resourceIndicatorToString(resource) {
|
|
51223
|
+
return typeof resource === "string" ? resource : resource.href;
|
|
51224
|
+
}
|
|
50837
51225
|
async function startAuthorization(authorizationServerUrl, { metadata, clientInformation, redirectUrl, scope, state, resource }) {
|
|
50838
51226
|
let authorizationUrl;
|
|
50839
51227
|
if (metadata) {
|
|
@@ -50865,7 +51253,7 @@ async function startAuthorization(authorizationServerUrl, { metadata, clientInfo
|
|
|
50865
51253
|
authorizationUrl.searchParams.append("prompt", "consent");
|
|
50866
51254
|
}
|
|
50867
51255
|
if (resource) {
|
|
50868
|
-
authorizationUrl.searchParams.set("resource", resource
|
|
51256
|
+
authorizationUrl.searchParams.set("resource", resourceIndicatorToString(resource));
|
|
50869
51257
|
}
|
|
50870
51258
|
return { authorizationUrl, codeVerifier };
|
|
50871
51259
|
}
|
|
@@ -50884,7 +51272,7 @@ async function executeTokenRequest(authorizationServerUrl, { metadata, tokenRequ
|
|
|
50884
51272
|
Accept: "application/json"
|
|
50885
51273
|
});
|
|
50886
51274
|
if (resource) {
|
|
50887
|
-
tokenRequestParams.set("resource", resource
|
|
51275
|
+
tokenRequestParams.set("resource", resourceIndicatorToString(resource));
|
|
50888
51276
|
}
|
|
50889
51277
|
if (addClientAuthentication) {
|
|
50890
51278
|
await addClientAuthentication(headers, tokenRequestParams, tokenUrl, metadata);
|
|
@@ -50893,7 +51281,7 @@ async function executeTokenRequest(authorizationServerUrl, { metadata, tokenRequ
|
|
|
50893
51281
|
const authMethod = selectClientAuthMethod(clientInformation, supportedMethods);
|
|
50894
51282
|
applyClientAuthentication(authMethod, clientInformation, headers, tokenRequestParams);
|
|
50895
51283
|
}
|
|
50896
|
-
const response = await (fetchFn ?? fetch)(tokenUrl, {
|
|
51284
|
+
const response = await fetchWithinOrigin(fetchFn ?? fetch)(tokenUrl, {
|
|
50897
51285
|
method: "POST",
|
|
50898
51286
|
headers,
|
|
50899
51287
|
body: tokenRequestParams
|
|
@@ -50901,7 +51289,7 @@ async function executeTokenRequest(authorizationServerUrl, { metadata, tokenRequ
|
|
|
50901
51289
|
if (!response.ok) {
|
|
50902
51290
|
throw await parseErrorResponse(response);
|
|
50903
51291
|
}
|
|
50904
|
-
return
|
|
51292
|
+
return TokenResponseSchema.parse(await response.json());
|
|
50905
51293
|
}
|
|
50906
51294
|
async function refreshAuthorization(authorizationServerUrl, { metadata, clientInformation, refreshToken, resource, addClientAuthentication, fetchFn }) {
|
|
50907
51295
|
const tokenRequestParams = new URLSearchParams({
|
|
@@ -50919,6 +51307,15 @@ async function refreshAuthorization(authorizationServerUrl, { metadata, clientIn
|
|
|
50919
51307
|
return { refresh_token: refreshToken, ...tokens2 };
|
|
50920
51308
|
}
|
|
50921
51309
|
async function fetchToken(provider, authorizationServerUrl, { metadata, resource, authorizationCode, fetchFn } = {}) {
|
|
51310
|
+
const readClientInformation = async () => {
|
|
51311
|
+
const storedClientInformation = await provider.clientInformation();
|
|
51312
|
+
const checked = discardIfIssuerMismatch(storedClientInformation, String(authorizationServerUrl));
|
|
51313
|
+
if (storedClientInformation && !checked) {
|
|
51314
|
+
throw boundElsewhereError(storedClientInformation, String(authorizationServerUrl));
|
|
51315
|
+
}
|
|
51316
|
+
return checked;
|
|
51317
|
+
};
|
|
51318
|
+
let clientInformation = await readClientInformation();
|
|
50922
51319
|
const scope = provider.clientMetadata.scope;
|
|
50923
51320
|
let tokenRequestParams;
|
|
50924
51321
|
if (provider.prepareTokenRequest) {
|
|
@@ -50934,11 +51331,11 @@ async function fetchToken(provider, authorizationServerUrl, { metadata, resource
|
|
|
50934
51331
|
const codeVerifier = await provider.codeVerifier();
|
|
50935
51332
|
tokenRequestParams = prepareAuthorizationCodeRequest(authorizationCode, codeVerifier, provider.redirectUrl);
|
|
50936
51333
|
}
|
|
50937
|
-
|
|
51334
|
+
clientInformation ?? (clientInformation = await readClientInformation());
|
|
50938
51335
|
return executeTokenRequest(authorizationServerUrl, {
|
|
50939
51336
|
metadata,
|
|
50940
51337
|
tokenRequestParams,
|
|
50941
|
-
clientInformation
|
|
51338
|
+
clientInformation,
|
|
50942
51339
|
addClientAuthentication: provider.addClientAuthentication,
|
|
50943
51340
|
resource,
|
|
50944
51341
|
fetchFn
|
|
@@ -50954,7 +51351,7 @@ async function registerClient(authorizationServerUrl, { metadata, clientMetadata
|
|
|
50954
51351
|
} else {
|
|
50955
51352
|
registrationUrl = new URL("/register", authorizationServerUrl);
|
|
50956
51353
|
}
|
|
50957
|
-
const response = await (fetchFn ?? fetch)(registrationUrl, {
|
|
51354
|
+
const response = await fetchWithinOrigin(fetchFn ?? fetch)(registrationUrl, {
|
|
50958
51355
|
method: "POST",
|
|
50959
51356
|
headers: {
|
|
50960
51357
|
"Content-Type": "application/json"
|
|
@@ -50967,7 +51364,7 @@ async function registerClient(authorizationServerUrl, { metadata, clientMetadata
|
|
|
50967
51364
|
if (!response.ok) {
|
|
50968
51365
|
throw await parseErrorResponse(response);
|
|
50969
51366
|
}
|
|
50970
|
-
return
|
|
51367
|
+
return RegistrationResponseSchema.parse(await response.json());
|
|
50971
51368
|
}
|
|
50972
51369
|
|
|
50973
51370
|
// ../../node_modules/.pnpm/eventsource-parser@3.1.1/node_modules/eventsource-parser/dist/index.js
|
|
@@ -51171,7 +51568,7 @@ var EventSourceParserStream = class extends TransformStream {
|
|
|
51171
51568
|
}
|
|
51172
51569
|
};
|
|
51173
51570
|
|
|
51174
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
51571
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js
|
|
51175
51572
|
var DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS = {
|
|
51176
51573
|
initialReconnectionDelay: 1e3,
|
|
51177
51574
|
maxReconnectionDelay: 3e4,
|
|
@@ -51194,9 +51591,19 @@ var StreamableHTTPClientTransport = class {
|
|
|
51194
51591
|
this._authProvider = opts?.authProvider;
|
|
51195
51592
|
this._fetch = opts?.fetch;
|
|
51196
51593
|
this._fetchWithInit = createFetchWithInit(opts?.fetch, opts?.requestInit);
|
|
51594
|
+
this._followRedirects = opts?.redirectPolicy === "follow";
|
|
51595
|
+
if (this._followRedirects) {
|
|
51596
|
+
this._fetch = fetchLeavingRedirects(this._fetch);
|
|
51597
|
+
this._fetchWithInit = fetchLeavingRedirects(this._fetchWithInit);
|
|
51598
|
+
}
|
|
51197
51599
|
this._sessionId = opts?.sessionId;
|
|
51198
51600
|
this._reconnectionOptions = opts?.reconnectionOptions ?? DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS;
|
|
51199
51601
|
}
|
|
51602
|
+
/** Error text for a redirect `response` that was not followed, or `undefined` for any other response. */
|
|
51603
|
+
_unfollowedRedirect(response, url2) {
|
|
51604
|
+
const text = unfollowedRedirect(response, url2);
|
|
51605
|
+
return text && !this._followRedirects ? `${text} (redirectPolicy: 'same-origin')` : text;
|
|
51606
|
+
}
|
|
51200
51607
|
async _authThenStart() {
|
|
51201
51608
|
if (!this._authProvider) {
|
|
51202
51609
|
throw new UnauthorizedError("No auth provider");
|
|
@@ -51246,11 +51653,13 @@ var StreamableHTTPClientTransport = class {
|
|
|
51246
51653
|
if (resumptionToken) {
|
|
51247
51654
|
headers.set("last-event-id", resumptionToken);
|
|
51248
51655
|
}
|
|
51249
|
-
const
|
|
51250
|
-
|
|
51251
|
-
|
|
51252
|
-
|
|
51253
|
-
|
|
51656
|
+
const fetchFn = this._fetch ?? fetch;
|
|
51657
|
+
const init = { method: "GET", headers, signal: this._abortController?.signal };
|
|
51658
|
+
let response = await fetchFn(this._url, this._followRedirects ? init : { ...init, redirect: "manual" });
|
|
51659
|
+
const followed = this._followRedirects ? void 0 : followWithinOrigin(fetchFn, this._url, init, response);
|
|
51660
|
+
if (followed) {
|
|
51661
|
+
response = await followed;
|
|
51662
|
+
}
|
|
51254
51663
|
if (!response.ok) {
|
|
51255
51664
|
await response.body?.cancel();
|
|
51256
51665
|
if (response.status === 401 && this._authProvider) {
|
|
@@ -51259,7 +51668,7 @@ var StreamableHTTPClientTransport = class {
|
|
|
51259
51668
|
if (response.status === 405) {
|
|
51260
51669
|
return;
|
|
51261
51670
|
}
|
|
51262
|
-
throw new StreamableHTTPError(response.status, `Failed to open SSE stream: ${response.statusText}`);
|
|
51671
|
+
throw new StreamableHTTPError(response.status, `Failed to open SSE stream: ${this._unfollowedRedirect(response, this._url) ?? response.statusText}`);
|
|
51263
51672
|
}
|
|
51264
51673
|
this._handleSseStream(response.body, options, true);
|
|
51265
51674
|
} catch (error51) {
|
|
@@ -51422,7 +51831,7 @@ var StreamableHTTPClientTransport = class {
|
|
|
51422
51831
|
body: JSON.stringify(message),
|
|
51423
51832
|
signal: this._abortController?.signal
|
|
51424
51833
|
};
|
|
51425
|
-
const response = await (this._fetch ?? fetch)(this._url, init);
|
|
51834
|
+
const response = await fetchWithinOrigin(this._fetch ?? fetch)(this._url, init);
|
|
51426
51835
|
const sessionId = response.headers.get("mcp-session-id");
|
|
51427
51836
|
if (sessionId) {
|
|
51428
51837
|
this._sessionId = sessionId;
|
|
@@ -51474,7 +51883,7 @@ var StreamableHTTPClientTransport = class {
|
|
|
51474
51883
|
return this.send(message);
|
|
51475
51884
|
}
|
|
51476
51885
|
}
|
|
51477
|
-
throw new StreamableHTTPError(response.status, `Error POSTing to endpoint: ${text}`);
|
|
51886
|
+
throw new StreamableHTTPError(response.status, `Error POSTing to endpoint: ${this._unfollowedRedirect(response, this._url) ?? text}`);
|
|
51478
51887
|
}
|
|
51479
51888
|
this._hasCompletedAuthFlow = false;
|
|
51480
51889
|
this._lastUpscopingHeader = void 0;
|
|
@@ -51536,10 +51945,10 @@ var StreamableHTTPClientTransport = class {
|
|
|
51536
51945
|
headers,
|
|
51537
51946
|
signal: this._abortController?.signal
|
|
51538
51947
|
};
|
|
51539
|
-
const response = await (this._fetch ?? fetch)(this._url, init);
|
|
51948
|
+
const response = await fetchWithinOrigin(this._fetch ?? fetch)(this._url, init);
|
|
51540
51949
|
await response.body?.cancel();
|
|
51541
51950
|
if (!response.ok && response.status !== 405) {
|
|
51542
|
-
throw new StreamableHTTPError(response.status, `Failed to terminate session: ${response.statusText}`);
|
|
51951
|
+
throw new StreamableHTTPError(response.status, `Failed to terminate session: ${this._unfollowedRedirect(response, this._url) ?? response.statusText}`);
|
|
51543
51952
|
}
|
|
51544
51953
|
this._sessionId = void 0;
|
|
51545
51954
|
} catch (error51) {
|
|
@@ -51568,12 +51977,12 @@ var StreamableHTTPClientTransport = class {
|
|
|
51568
51977
|
}
|
|
51569
51978
|
};
|
|
51570
51979
|
|
|
51571
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
51980
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
|
|
51572
51981
|
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
51573
51982
|
var import_node_process = __toESM(require("node:process"), 1);
|
|
51574
51983
|
var import_node_stream = require("node:stream");
|
|
51575
51984
|
|
|
51576
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
51985
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
51577
51986
|
var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
|
|
51578
51987
|
var ReadBuffer = class {
|
|
51579
51988
|
constructor(options) {
|
|
@@ -51610,7 +52019,7 @@ function serializeMessage(message) {
|
|
|
51610
52019
|
return JSON.stringify(message) + "\n";
|
|
51611
52020
|
}
|
|
51612
52021
|
|
|
51613
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
52022
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
|
|
51614
52023
|
var DEFAULT_INHERITED_ENV_VARS = import_node_process.default.platform === "win32" ? [
|
|
51615
52024
|
"APPDATA",
|
|
51616
52025
|
"HOMEDRIVE",
|
|
@@ -53082,7 +53491,8 @@ async function handleConsensusBlocked(result, ctx, input, resolvedTaskId) {
|
|
|
53082
53491
|
...groupId ? { groupId } : {}
|
|
53083
53492
|
});
|
|
53084
53493
|
} catch (err) {
|
|
53085
|
-
const
|
|
53494
|
+
const errObj = err;
|
|
53495
|
+
const isConflict = errObj?.status === 409 || errObj?.statusCode === 409 || errObj?.code === "23505" || String(errObj?.message ?? "").includes("already exists") || String(errObj?.message ?? "").includes("duplicate key");
|
|
53086
53496
|
if (!isConflict) {
|
|
53087
53497
|
throw err;
|
|
53088
53498
|
}
|
|
@@ -53106,7 +53516,8 @@ async function handleConsensusBlocked(result, ctx, input, resolvedTaskId) {
|
|
|
53106
53516
|
...groupId ? { groupId } : {}
|
|
53107
53517
|
});
|
|
53108
53518
|
} catch (err) {
|
|
53109
|
-
const
|
|
53519
|
+
const errObj = err;
|
|
53520
|
+
const isConflict = errObj?.status === 409 || errObj?.statusCode === 409 || errObj?.code === "23505" || String(errObj?.message ?? "").includes("already exists") || String(errObj?.message ?? "").includes("duplicate key");
|
|
53110
53521
|
if (!isConflict) {
|
|
53111
53522
|
throw err;
|
|
53112
53523
|
}
|
|
@@ -59134,7 +59545,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
|
|
|
59134
59545
|
}
|
|
59135
59546
|
|
|
59136
59547
|
// src/_generated/version.ts
|
|
59137
|
-
var PKG_VERSION = "0.4.
|
|
59548
|
+
var PKG_VERSION = "0.4.106";
|
|
59138
59549
|
|
|
59139
59550
|
// src/director-closure.ts
|
|
59140
59551
|
var CLOSURE_SNAPSHOT_TIMEOUT_MS = 2e3;
|
|
@@ -61085,7 +61496,7 @@ async function uploadPendingDays(stateDir, client, bridgeHealth, gateCtx) {
|
|
|
61085
61496
|
...gateCalls.length > 0 ? { gateCalls } : {}
|
|
61086
61497
|
};
|
|
61087
61498
|
const gateResult = await gate(batch, [], gateCtx);
|
|
61088
|
-
const
|
|
61499
|
+
const _gateMarker = gateResult.gated ? "gated" : "projection-only";
|
|
61089
61500
|
if (cur.projectSlug === "_unattributed") {
|
|
61090
61501
|
await client.postOperatorTelemetry(gateResult.artifact);
|
|
61091
61502
|
} else {
|
|
@@ -63709,7 +64120,7 @@ ${renderTaskStateSection(taskState)}`;
|
|
|
63709
64120
|
}
|
|
63710
64121
|
}
|
|
63711
64122
|
const removeWtFn = deps.removeRunWorktree ?? removeRunWorktree;
|
|
63712
|
-
const
|
|
64123
|
+
const _pushFn = deps.pushRunBranch ?? pushRunBranch;
|
|
63713
64124
|
try {
|
|
63714
64125
|
const startParams = {
|
|
63715
64126
|
cwd: turnCwd,
|
|
@@ -63970,10 +64381,10 @@ Continue executing task ${task.id}. Make the next concrete increment of progress
|
|
|
63970
64381
|
if (!expectedRepoFullName) {
|
|
63971
64382
|
throw new Error(`push aborted: project ${projectSlug} has no bound GitHub repository`);
|
|
63972
64383
|
}
|
|
63973
|
-
const
|
|
64384
|
+
const pushFn = deps.pushRunBranch ?? pushRunBranch;
|
|
63974
64385
|
const locksDir = deps.locksDir ?? "/tmp/mrrlin-locks";
|
|
63975
64386
|
await withCheckoutLock(locksDir, projectSlug, async () => {
|
|
63976
|
-
await
|
|
64387
|
+
await pushFn({
|
|
63977
64388
|
worktreePath,
|
|
63978
64389
|
locksDir,
|
|
63979
64390
|
slug: projectSlug,
|
|
@@ -72675,7 +73086,7 @@ async function startDirectorBridge() {
|
|
|
72675
73086
|
await tokenRefresher.start();
|
|
72676
73087
|
process.stderr.write("[mrrlin-mcp director-bridge] agent credential active; operator token auto-refresh enabled.\n");
|
|
72677
73088
|
} else {
|
|
72678
|
-
|
|
73089
|
+
const apiToken = envToken ?? readOperatorToken() ?? void 0;
|
|
72679
73090
|
if (envToken) {
|
|
72680
73091
|
try {
|
|
72681
73092
|
persistOperatorToken(envToken);
|
|
@@ -73639,7 +74050,7 @@ function renderContextPrefix(context) {
|
|
|
73639
74050
|
return parts.join("\n\n");
|
|
73640
74051
|
}
|
|
73641
74052
|
|
|
73642
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
74053
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
|
|
73643
74054
|
var ExperimentalServerTasks = class {
|
|
73644
74055
|
constructor(_server) {
|
|
73645
74056
|
this._server = _server;
|
|
@@ -73852,7 +74263,7 @@ var ExperimentalServerTasks = class {
|
|
|
73852
74263
|
}
|
|
73853
74264
|
};
|
|
73854
74265
|
|
|
73855
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
74266
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
|
|
73856
74267
|
var Server = class extends Protocol {
|
|
73857
74268
|
/**
|
|
73858
74269
|
* Initializes this server with the given name and version information.
|
|
@@ -74223,7 +74634,7 @@ var Server = class extends Protocol {
|
|
|
74223
74634
|
}
|
|
74224
74635
|
};
|
|
74225
74636
|
|
|
74226
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
74637
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
74227
74638
|
var import_node_process2 = __toESM(require("node:process"), 1);
|
|
74228
74639
|
var StdioServerTransport = class {
|
|
74229
74640
|
constructor(_stdin = import_node_process2.default.stdin, _stdout = import_node_process2.default.stdout, options) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrrlin-dev/mcp",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.106",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"mrrlin-mcp": "dist/bin.cjs"
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@clack/prompts": "^0.8.2",
|
|
18
18
|
"@iarna/toml": "^2.2.5",
|
|
19
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
19
|
+
"@modelcontextprotocol/sdk": "^1.32.0",
|
|
20
20
|
"@mrrlin-dev/external-agents": "latest",
|
|
21
21
|
"@playwright/mcp": "0.0.76",
|
|
22
22
|
"dotenv": "^16.4.5",
|
|
23
|
-
"hono": "^4.
|
|
23
|
+
"hono": "^4.13.11",
|
|
24
24
|
"playwright-core": "1.61.0-alpha-1781023400000",
|
|
25
25
|
"proper-lockfile": "^4.1.2",
|
|
26
26
|
"qrcode": "^1.5.3",
|