@mrrlin-dev/mcp 0.4.100 → 0.4.104
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 +612 -129
- package/package.json +3 -3
package/dist/bin.cjs
CHANGED
|
@@ -21593,7 +21593,7 @@ args = ${JSON.stringify(expected.args)}
|
|
|
21593
21593
|
return tomlStr;
|
|
21594
21594
|
}
|
|
21595
21595
|
async function installPublicMcpServerToConfigs(serverId, expected) {
|
|
21596
|
-
const homeDir =
|
|
21596
|
+
const homeDir = import_node_os17.default.homedir();
|
|
21597
21597
|
const claudePath = import_node_path37.default.join(homeDir, ".claude.json");
|
|
21598
21598
|
if (await pathExists5(claudePath)) {
|
|
21599
21599
|
try {
|
|
@@ -21644,12 +21644,12 @@ async function installPublicMcpServerToConfigs(serverId, expected) {
|
|
|
21644
21644
|
await writeAtomic(agyPath, JSON.stringify({ mcpServers: { [serverId]: expected } }, null, 2) + "\n");
|
|
21645
21645
|
}
|
|
21646
21646
|
}
|
|
21647
|
-
var import_promises15,
|
|
21647
|
+
var import_promises15, import_node_os17, import_node_path37, toml4;
|
|
21648
21648
|
var init_install_public_mcp = __esm({
|
|
21649
21649
|
"src/install-public-mcp.ts"() {
|
|
21650
21650
|
"use strict";
|
|
21651
21651
|
import_promises15 = __toESM(require("node:fs/promises"), 1);
|
|
21652
|
-
|
|
21652
|
+
import_node_os17 = __toESM(require("node:os"), 1);
|
|
21653
21653
|
import_node_path37 = __toESM(require("node:path"), 1);
|
|
21654
21654
|
toml4 = __toESM(require_toml(), 1);
|
|
21655
21655
|
}
|
|
@@ -21664,7 +21664,7 @@ module.exports = __toCommonJS(bin_exports);
|
|
|
21664
21664
|
var import_node_path42 = __toESM(require("node:path"), 1);
|
|
21665
21665
|
var import_node_child_process23 = require("node:child_process");
|
|
21666
21666
|
var import_node_fs25 = require("node:fs");
|
|
21667
|
-
var
|
|
21667
|
+
var import_node_os21 = require("node:os");
|
|
21668
21668
|
var import_node_path43 = __toESM(require("node:path"), 1);
|
|
21669
21669
|
|
|
21670
21670
|
// src/install-codex.ts
|
|
@@ -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 });
|
|
@@ -46746,7 +46984,7 @@ async function deliverToWiki(client, projectSlug, payload) {
|
|
|
46746
46984
|
return client.updateWikiPage(projectSlug, payload.pageId, payload.patch);
|
|
46747
46985
|
}
|
|
46748
46986
|
|
|
46749
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
46987
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
|
|
46750
46988
|
function isZ4Schema(s) {
|
|
46751
46989
|
const schema = s;
|
|
46752
46990
|
return !!schema._zod;
|
|
@@ -46809,7 +47047,7 @@ function getLiteralValue(schema) {
|
|
|
46809
47047
|
return void 0;
|
|
46810
47048
|
}
|
|
46811
47049
|
|
|
46812
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
47050
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
|
|
46813
47051
|
var LATEST_PROTOCOL_VERSION = "2025-11-25";
|
|
46814
47052
|
var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
|
|
46815
47053
|
var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
|
|
@@ -48329,7 +48567,7 @@ var UrlElicitationRequiredError = class extends McpError {
|
|
|
48329
48567
|
}
|
|
48330
48568
|
};
|
|
48331
48569
|
|
|
48332
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
48570
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
|
|
48333
48571
|
function isTerminal(status) {
|
|
48334
48572
|
return status === "completed" || status === "failed" || status === "cancelled";
|
|
48335
48573
|
}
|
|
@@ -48340,7 +48578,7 @@ var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use")
|
|
|
48340
48578
|
// ../../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
48579
|
var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
48342
48580
|
|
|
48343
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
48581
|
+
// ../../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
48582
|
function getMethodLiteral(schema) {
|
|
48345
48583
|
const shape = getObjectShape(schema);
|
|
48346
48584
|
const methodSchema = shape?.method;
|
|
@@ -48361,7 +48599,7 @@ function parseWithCompat(schema, data) {
|
|
|
48361
48599
|
return result.data;
|
|
48362
48600
|
}
|
|
48363
48601
|
|
|
48364
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
48602
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
|
|
48365
48603
|
var DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4;
|
|
48366
48604
|
var Protocol = class {
|
|
48367
48605
|
constructor(_options) {
|
|
@@ -48402,6 +48640,9 @@ var Protocol = class {
|
|
|
48402
48640
|
this.setRequestHandler(GetTaskPayloadRequestSchema, async (request, extra) => {
|
|
48403
48641
|
const handleTaskResult = async () => {
|
|
48404
48642
|
const taskId = request.params.taskId;
|
|
48643
|
+
if (!await this._taskStore.getTask(taskId, extra.sessionId)) {
|
|
48644
|
+
throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
|
|
48645
|
+
}
|
|
48405
48646
|
if (this._taskMessageQueue) {
|
|
48406
48647
|
let queuedMessage;
|
|
48407
48648
|
while (queuedMessage = await this._taskMessageQueue.dequeue(taskId, extra.sessionId)) {
|
|
@@ -48432,12 +48673,12 @@ var Protocol = class {
|
|
|
48432
48673
|
throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
|
|
48433
48674
|
}
|
|
48434
48675
|
if (!isTerminal(task.status)) {
|
|
48435
|
-
await this._waitForTaskUpdate(taskId, extra.signal);
|
|
48676
|
+
await this._waitForTaskUpdate(taskId, extra.signal, extra.sessionId);
|
|
48436
48677
|
return await handleTaskResult();
|
|
48437
48678
|
}
|
|
48438
48679
|
if (isTerminal(task.status)) {
|
|
48439
48680
|
const result = await this._taskStore.getTaskResult(taskId, extra.sessionId);
|
|
48440
|
-
this._clearTaskQueue(taskId);
|
|
48681
|
+
this._clearTaskQueue(taskId, extra.sessionId);
|
|
48441
48682
|
return {
|
|
48442
48683
|
...result,
|
|
48443
48684
|
_meta: {
|
|
@@ -48474,7 +48715,7 @@ var Protocol = class {
|
|
|
48474
48715
|
throw new McpError(ErrorCode.InvalidParams, `Cannot cancel task in terminal status: ${task.status}`);
|
|
48475
48716
|
}
|
|
48476
48717
|
await this._taskStore.updateTaskStatus(request.params.taskId, "cancelled", "Client cancelled task execution.", extra.sessionId);
|
|
48477
|
-
this._clearTaskQueue(request.params.taskId);
|
|
48718
|
+
this._clearTaskQueue(request.params.taskId, extra.sessionId);
|
|
48478
48719
|
const cancelledTask = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
|
|
48479
48720
|
if (!cancelledTask) {
|
|
48480
48721
|
throw new McpError(ErrorCode.InvalidParams, `Task not found after cancellation: ${request.params.taskId}`);
|
|
@@ -48602,6 +48843,19 @@ var Protocol = class {
|
|
|
48602
48843
|
const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler;
|
|
48603
48844
|
const capturedTransport = this._transport;
|
|
48604
48845
|
const relatedTaskId = request.params?._meta?.[RELATED_TASK_META_KEY]?.taskId;
|
|
48846
|
+
const sessionId = capturedTransport?.sessionId;
|
|
48847
|
+
const store = this._taskStore;
|
|
48848
|
+
let relatedTaskFound = true;
|
|
48849
|
+
let relatedTaskLookup;
|
|
48850
|
+
if (relatedTaskId && store && this._taskMessageQueue && sessionId !== void 0) {
|
|
48851
|
+
relatedTaskFound = false;
|
|
48852
|
+
relatedTaskLookup = (async () => {
|
|
48853
|
+
if (!await store.getTask(relatedTaskId, sessionId)) {
|
|
48854
|
+
throw new McpError(ErrorCode.InvalidParams, `Task not found: ${relatedTaskId}`);
|
|
48855
|
+
}
|
|
48856
|
+
relatedTaskFound = true;
|
|
48857
|
+
})();
|
|
48858
|
+
}
|
|
48605
48859
|
if (handler === void 0) {
|
|
48606
48860
|
const errorResponse = {
|
|
48607
48861
|
jsonrpc: "2.0",
|
|
@@ -48611,7 +48865,10 @@ var Protocol = class {
|
|
|
48611
48865
|
message: "Method not found"
|
|
48612
48866
|
}
|
|
48613
48867
|
};
|
|
48614
|
-
if (relatedTaskId &&
|
|
48868
|
+
if (relatedTaskId && relatedTaskLookup) {
|
|
48869
|
+
const queuedError = { type: "error", message: errorResponse, timestamp: Date.now() };
|
|
48870
|
+
relatedTaskLookup.then(() => this._enqueueTaskMessage(relatedTaskId, queuedError, sessionId), () => capturedTransport?.send(errorResponse)).catch((error51) => this._onerror(new Error(`Failed to send an error response: ${error51}`)));
|
|
48871
|
+
} else if (relatedTaskId && this._taskMessageQueue) {
|
|
48615
48872
|
this._enqueueTaskMessage(relatedTaskId, {
|
|
48616
48873
|
type: "error",
|
|
48617
48874
|
message: errorResponse,
|
|
@@ -48662,7 +48919,10 @@ var Protocol = class {
|
|
|
48662
48919
|
closeSSEStream: extra?.closeSSEStream,
|
|
48663
48920
|
closeStandaloneSSEStream: extra?.closeStandaloneSSEStream
|
|
48664
48921
|
};
|
|
48665
|
-
Promise.resolve().then(() => {
|
|
48922
|
+
(relatedTaskLookup ?? Promise.resolve()).then(() => {
|
|
48923
|
+
if (relatedTaskLookup && abortController.signal.aborted) {
|
|
48924
|
+
throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
|
|
48925
|
+
}
|
|
48666
48926
|
if (taskCreationParams) {
|
|
48667
48927
|
this.assertTaskHandlerCapability(request.method);
|
|
48668
48928
|
}
|
|
@@ -48697,7 +48957,7 @@ var Protocol = class {
|
|
|
48697
48957
|
...error51["data"] !== void 0 && { data: error51["data"] }
|
|
48698
48958
|
}
|
|
48699
48959
|
};
|
|
48700
|
-
if (relatedTaskId && this._taskMessageQueue) {
|
|
48960
|
+
if (relatedTaskId && this._taskMessageQueue && relatedTaskFound) {
|
|
48701
48961
|
await this._enqueueTaskMessage(relatedTaskId, {
|
|
48702
48962
|
type: "error",
|
|
48703
48963
|
message: errorResponse,
|
|
@@ -49177,7 +49437,7 @@ var Protocol = class {
|
|
|
49177
49437
|
throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");
|
|
49178
49438
|
}
|
|
49179
49439
|
const maxQueueSize = this._options?.maxTaskQueueSize;
|
|
49180
|
-
await this._taskMessageQueue.enqueue(taskId, message, sessionId, maxQueueSize);
|
|
49440
|
+
await this._taskMessageQueue.enqueue(taskId, message, sessionId ?? this._transport?.sessionId, maxQueueSize);
|
|
49181
49441
|
}
|
|
49182
49442
|
/**
|
|
49183
49443
|
* Clears the message queue for a task and rejects any pending request resolvers.
|
|
@@ -49206,12 +49466,13 @@ var Protocol = class {
|
|
|
49206
49466
|
* Uses polling to check for updates at the task's configured poll interval.
|
|
49207
49467
|
* @param taskId The task ID to wait for
|
|
49208
49468
|
* @param signal Abort signal to cancel the wait
|
|
49469
|
+
* @param sessionId Session of the request that waits, passed to the task store
|
|
49209
49470
|
* @returns Promise that resolves when an update occurs or rejects if aborted
|
|
49210
49471
|
*/
|
|
49211
|
-
async _waitForTaskUpdate(taskId, signal) {
|
|
49472
|
+
async _waitForTaskUpdate(taskId, signal, sessionId) {
|
|
49212
49473
|
let interval = this._options?.defaultTaskPollInterval ?? 1e3;
|
|
49213
49474
|
try {
|
|
49214
|
-
const task = await this._taskStore?.getTask(taskId);
|
|
49475
|
+
const task = await this._taskStore?.getTask(taskId, sessionId);
|
|
49215
49476
|
if (task?.pollInterval) {
|
|
49216
49477
|
interval = task.pollInterval;
|
|
49217
49478
|
}
|
|
@@ -49315,7 +49576,7 @@ function mergeCapabilities(base, additional) {
|
|
|
49315
49576
|
return result;
|
|
49316
49577
|
}
|
|
49317
49578
|
|
|
49318
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
49579
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
|
|
49319
49580
|
var import_ajv = __toESM(require_ajv(), 1);
|
|
49320
49581
|
var import_ajv_formats = __toESM(require_dist(), 1);
|
|
49321
49582
|
function createDefaultAjvInstance() {
|
|
@@ -49383,7 +49644,7 @@ var AjvJsonSchemaValidator = class {
|
|
|
49383
49644
|
}
|
|
49384
49645
|
};
|
|
49385
49646
|
|
|
49386
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
49647
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js
|
|
49387
49648
|
var ExperimentalClientTasks = class {
|
|
49388
49649
|
constructor(_client) {
|
|
49389
49650
|
this._client = _client;
|
|
@@ -49537,7 +49798,7 @@ var ExperimentalClientTasks = class {
|
|
|
49537
49798
|
}
|
|
49538
49799
|
};
|
|
49539
49800
|
|
|
49540
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
49801
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
|
|
49541
49802
|
function assertToolsCallTaskCapability(requests, method, entityName) {
|
|
49542
49803
|
if (!requests) {
|
|
49543
49804
|
throw new Error(`${entityName} does not support task creation (required for ${method})`);
|
|
@@ -49572,7 +49833,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
|
|
|
49572
49833
|
}
|
|
49573
49834
|
}
|
|
49574
49835
|
|
|
49575
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
49836
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js
|
|
49576
49837
|
function applyElicitationDefaults(schema, data) {
|
|
49577
49838
|
if (!schema || data === null || typeof data !== "object")
|
|
49578
49839
|
return;
|
|
@@ -50083,7 +50344,7 @@ var Client = class extends Protocol {
|
|
|
50083
50344
|
}
|
|
50084
50345
|
};
|
|
50085
50346
|
|
|
50086
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
50347
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js
|
|
50087
50348
|
var import_content_type = __toESM(require_content_type(), 1);
|
|
50088
50349
|
function mediaTypeEssence(header) {
|
|
50089
50350
|
if (!header) {
|
|
@@ -50100,7 +50361,7 @@ function mediaTypeEssence(header) {
|
|
|
50100
50361
|
}
|
|
50101
50362
|
}
|
|
50102
50363
|
|
|
50103
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
50364
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js
|
|
50104
50365
|
function normalizeHeaders(headers) {
|
|
50105
50366
|
if (!headers)
|
|
50106
50367
|
return {};
|
|
@@ -50126,6 +50387,68 @@ function createFetchWithInit(baseFetch = fetch, baseInit) {
|
|
|
50126
50387
|
return baseFetch(url2, mergedInit);
|
|
50127
50388
|
};
|
|
50128
50389
|
}
|
|
50390
|
+
var MAX_REDIRECTS = 5;
|
|
50391
|
+
var REDIRECT_STATUSES = [301, 302, 303, 307, 308];
|
|
50392
|
+
function isWithinOrigin(from, to) {
|
|
50393
|
+
if (from.protocol === to.protocol && from.hostname === to.hostname && from.port === to.port) {
|
|
50394
|
+
return true;
|
|
50395
|
+
}
|
|
50396
|
+
return from.hostname === to.hostname && from.protocol === "http:" && from.port === "" && to.protocol === "https:" && to.port === "";
|
|
50397
|
+
}
|
|
50398
|
+
function redirectTarget(response, requestUrl) {
|
|
50399
|
+
const location = REDIRECT_STATUSES.includes(response.status) ? response.headers.get("location") : null;
|
|
50400
|
+
try {
|
|
50401
|
+
return location ? new URL(location, requestUrl) : void 0;
|
|
50402
|
+
} catch {
|
|
50403
|
+
return void 0;
|
|
50404
|
+
}
|
|
50405
|
+
}
|
|
50406
|
+
function followWithinOrigin(baseFetch, url2, init, response, followed = 0) {
|
|
50407
|
+
const target = redirectTarget(response, url2);
|
|
50408
|
+
const keepsMethod = response.status === 307 || response.status === 308 || (init?.method ?? "GET").toUpperCase() === "GET";
|
|
50409
|
+
if (!target || followed === MAX_REDIRECTS || !keepsMethod) {
|
|
50410
|
+
return void 0;
|
|
50411
|
+
}
|
|
50412
|
+
const from = new URL(url2);
|
|
50413
|
+
const addsUserinfo = (target.username || target.password) && (target.username !== from.username || target.password !== from.password);
|
|
50414
|
+
if (addsUserinfo || !isWithinOrigin(from, target)) {
|
|
50415
|
+
return void 0;
|
|
50416
|
+
}
|
|
50417
|
+
return Promise.resolve(response.body?.cancel()).then(() => baseFetch(target, { ...init, redirect: "manual" })).then((next) => followWithinOrigin(baseFetch, target, init, next, followed + 1) ?? next);
|
|
50418
|
+
}
|
|
50419
|
+
var followingFetches = /* @__PURE__ */ new WeakSet();
|
|
50420
|
+
function fetchLeavingRedirects(baseFetch) {
|
|
50421
|
+
const following = (url2, init) => (baseFetch ?? fetch)(url2, init);
|
|
50422
|
+
followingFetches.add(following);
|
|
50423
|
+
return following;
|
|
50424
|
+
}
|
|
50425
|
+
function fetchWithinOrigin(baseFetch = fetch) {
|
|
50426
|
+
if (followingFetches.has(baseFetch)) {
|
|
50427
|
+
return baseFetch;
|
|
50428
|
+
}
|
|
50429
|
+
return (url2, init) => {
|
|
50430
|
+
if (init?.redirect === "error" || init?.redirect === "manual") {
|
|
50431
|
+
return baseFetch(url2, init);
|
|
50432
|
+
}
|
|
50433
|
+
return Promise.resolve(baseFetch(url2, { ...init, redirect: "manual" })).then((response) => followWithinOrigin(baseFetch, url2, init, response) ?? response);
|
|
50434
|
+
};
|
|
50435
|
+
}
|
|
50436
|
+
function unfollowedRedirect(response, requestUrl) {
|
|
50437
|
+
if (response.type === "opaqueredirect") {
|
|
50438
|
+
return "Redirect not followed: this runtime does not expose the redirect target";
|
|
50439
|
+
}
|
|
50440
|
+
const from = response.url || requestUrl;
|
|
50441
|
+
const target = redirectTarget(response, from);
|
|
50442
|
+
if (!target) {
|
|
50443
|
+
return void 0;
|
|
50444
|
+
}
|
|
50445
|
+
target.username = target.password = target.search = target.hash = "";
|
|
50446
|
+
if (target.protocol === "http:" && new URL(from).protocol === "https:") {
|
|
50447
|
+
target.protocol = "https:";
|
|
50448
|
+
return `Redirect to plain http not followed; try ${target.href} instead`;
|
|
50449
|
+
}
|
|
50450
|
+
return `Redirect to ${target.href} not followed`;
|
|
50451
|
+
}
|
|
50129
50452
|
|
|
50130
50453
|
// ../../node_modules/.pnpm/pkce-challenge@5.0.1/node_modules/pkce-challenge/dist/index.node.js
|
|
50131
50454
|
var crypto3;
|
|
@@ -50170,7 +50493,7 @@ async function pkceChallenge(length) {
|
|
|
50170
50493
|
};
|
|
50171
50494
|
}
|
|
50172
50495
|
|
|
50173
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
50496
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
|
|
50174
50497
|
var SafeUrlSchema = url().superRefine((val, ctx) => {
|
|
50175
50498
|
if (!URL.canParse(val)) {
|
|
50176
50499
|
ctx.addIssue({
|
|
@@ -50272,7 +50595,12 @@ var OAuthTokensSchema = object({
|
|
|
50272
50595
|
token_type: string2(),
|
|
50273
50596
|
expires_in: coerce_exports.number().optional(),
|
|
50274
50597
|
scope: string2().optional(),
|
|
50275
|
-
refresh_token: string2().optional()
|
|
50598
|
+
refresh_token: string2().optional(),
|
|
50599
|
+
/**
|
|
50600
|
+
* Not part of the wire format: the authorization server this value was obtained from, added by
|
|
50601
|
+
* the client's `auth()` before it is stored and compared when it is read back.
|
|
50602
|
+
*/
|
|
50603
|
+
issuer: string2().optional().catch(void 0)
|
|
50276
50604
|
}).strip();
|
|
50277
50605
|
var OAuthErrorResponseSchema = object({
|
|
50278
50606
|
error: string2(),
|
|
@@ -50302,7 +50630,12 @@ var OAuthClientInformationSchema = object({
|
|
|
50302
50630
|
client_id: string2(),
|
|
50303
50631
|
client_secret: string2().optional(),
|
|
50304
50632
|
client_id_issued_at: number2().optional(),
|
|
50305
|
-
client_secret_expires_at: number2().optional()
|
|
50633
|
+
client_secret_expires_at: number2().optional(),
|
|
50634
|
+
/**
|
|
50635
|
+
* Not part of the wire format: the authorization server this value was obtained from, added by
|
|
50636
|
+
* the client's `auth()` before it is stored and compared when it is read back.
|
|
50637
|
+
*/
|
|
50638
|
+
issuer: string2().optional().catch(void 0)
|
|
50306
50639
|
}).strip();
|
|
50307
50640
|
var OAuthClientInformationFullSchema = OAuthClientMetadataSchema.merge(OAuthClientInformationSchema);
|
|
50308
50641
|
var OAuthClientRegistrationErrorSchema = object({
|
|
@@ -50314,7 +50647,7 @@ var OAuthTokenRevocationRequestSchema = object({
|
|
|
50314
50647
|
token_type_hint: string2().optional()
|
|
50315
50648
|
}).strip();
|
|
50316
50649
|
|
|
50317
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
50650
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js
|
|
50318
50651
|
function resourceUrlFromServerUrl(url2) {
|
|
50319
50652
|
const resourceURL = typeof url2 === "string" ? new URL(url2) : new URL(url2.href);
|
|
50320
50653
|
resourceURL.hash = "";
|
|
@@ -50334,7 +50667,7 @@ function checkResourceAllowed({ requestedResource, configuredResource }) {
|
|
|
50334
50667
|
return requestedPath.startsWith(configuredPath);
|
|
50335
50668
|
}
|
|
50336
50669
|
|
|
50337
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
50670
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
|
|
50338
50671
|
var OAuthError = class extends Error {
|
|
50339
50672
|
constructor(message, errorUri) {
|
|
50340
50673
|
super(message);
|
|
@@ -50429,7 +50762,7 @@ var OAUTH_ERRORS = {
|
|
|
50429
50762
|
[InvalidTargetError.errorCode]: InvalidTargetError
|
|
50430
50763
|
};
|
|
50431
50764
|
|
|
50432
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
50765
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
|
|
50433
50766
|
var UnauthorizedError = class extends Error {
|
|
50434
50767
|
constructor(message) {
|
|
50435
50768
|
super(message ?? "Unauthorized");
|
|
@@ -50500,10 +50833,31 @@ async function parseErrorResponse(input) {
|
|
|
50500
50833
|
const errorClass = OAUTH_ERRORS[error51] || ServerError;
|
|
50501
50834
|
return new errorClass(error_description || "", error_uri);
|
|
50502
50835
|
} catch (error51) {
|
|
50503
|
-
const
|
|
50836
|
+
const redirect = input instanceof Response ? unfollowedRedirect(input, input.url) : void 0;
|
|
50837
|
+
const errorMessage = `${statusCode ? `HTTP ${statusCode}: ` : ""}${redirect ?? `Invalid OAuth error response: ${error51}. Raw body: ${body}`}`;
|
|
50504
50838
|
return new ServerError(errorMessage);
|
|
50505
50839
|
}
|
|
50506
50840
|
}
|
|
50841
|
+
function issuersMatch(a, b) {
|
|
50842
|
+
let [x, y] = [a, b];
|
|
50843
|
+
try {
|
|
50844
|
+
[x, y] = [new URL(a).href, new URL(b).href];
|
|
50845
|
+
} catch {
|
|
50846
|
+
}
|
|
50847
|
+
return x === y || x.endsWith("/") && x.slice(0, -1) === y || y.endsWith("/") && y.slice(0, -1) === x;
|
|
50848
|
+
}
|
|
50849
|
+
function discardIfIssuerMismatch(stored, issuer) {
|
|
50850
|
+
if (!stored)
|
|
50851
|
+
return void 0;
|
|
50852
|
+
if (typeof stored.issuer !== "string")
|
|
50853
|
+
return stored.issuer == null ? stored : { ...stored, issuer: void 0 };
|
|
50854
|
+
return issuersMatch(stored.issuer, issuer) ? stored : void 0;
|
|
50855
|
+
}
|
|
50856
|
+
var TokenResponseSchema = OAuthTokensSchema.omit({ issuer: true });
|
|
50857
|
+
var RegistrationResponseSchema = OAuthClientInformationFullSchema.omit({ issuer: true });
|
|
50858
|
+
function boundElsewhereError(stored, issuer) {
|
|
50859
|
+
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.`);
|
|
50860
|
+
}
|
|
50507
50861
|
async function auth(provider, options) {
|
|
50508
50862
|
try {
|
|
50509
50863
|
return await authInternal(provider, options);
|
|
@@ -50557,9 +50911,24 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
|
|
|
50557
50911
|
authorizationServerMetadata: metadata
|
|
50558
50912
|
});
|
|
50559
50913
|
}
|
|
50560
|
-
const
|
|
50914
|
+
const issuer = String(authorizationServerUrl);
|
|
50915
|
+
const selectedResource = await selectResourceURL(serverUrl, provider, resourceMetadata);
|
|
50916
|
+
const resource = selectedResource && resourceMetadata && !provider.validateResourceURL ? resourceMetadata.resource : selectedResource;
|
|
50561
50917
|
const resolvedScope = scope || resourceMetadata?.scopes_supported?.join(" ") || provider.clientMetadata.scope;
|
|
50562
|
-
|
|
50918
|
+
const storedClientInformation = await Promise.resolve(provider.clientInformation());
|
|
50919
|
+
let clientInformation = discardIfIssuerMismatch(storedClientInformation, issuer);
|
|
50920
|
+
const canRegisterAgain = provider.saveClientInformation !== void 0 && !!provider.redirectUrl;
|
|
50921
|
+
if (storedClientInformation && !clientInformation && !canRegisterAgain) {
|
|
50922
|
+
throw boundElsewhereError(storedClientInformation, issuer);
|
|
50923
|
+
}
|
|
50924
|
+
const unstampedClientInformation = clientInformation?.issuer == null ? clientInformation : void 0;
|
|
50925
|
+
const bindClientInformation = async () => {
|
|
50926
|
+
try {
|
|
50927
|
+
if (unstampedClientInformation)
|
|
50928
|
+
await provider.saveClientInformation?.({ ...unstampedClientInformation, issuer });
|
|
50929
|
+
} catch {
|
|
50930
|
+
}
|
|
50931
|
+
};
|
|
50563
50932
|
if (!clientInformation) {
|
|
50564
50933
|
if (authorizationCode !== void 0) {
|
|
50565
50934
|
throw new Error("Existing OAuth client information is required when exchanging an authorization code");
|
|
@@ -50571,9 +50940,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
|
|
|
50571
50940
|
}
|
|
50572
50941
|
const shouldUseUrlBasedClientId = supportsUrlBasedClientId && clientMetadataUrl;
|
|
50573
50942
|
if (shouldUseUrlBasedClientId) {
|
|
50574
|
-
clientInformation = {
|
|
50575
|
-
client_id: clientMetadataUrl
|
|
50576
|
-
};
|
|
50943
|
+
clientInformation = { client_id: clientMetadataUrl, issuer };
|
|
50577
50944
|
await provider.saveClientInformation?.(clientInformation);
|
|
50578
50945
|
} else {
|
|
50579
50946
|
if (!provider.saveClientInformation) {
|
|
@@ -50585,8 +50952,8 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
|
|
|
50585
50952
|
scope: resolvedScope,
|
|
50586
50953
|
fetchFn
|
|
50587
50954
|
});
|
|
50588
|
-
|
|
50589
|
-
clientInformation
|
|
50955
|
+
clientInformation = { ...fullInformation, issuer };
|
|
50956
|
+
await provider.saveClientInformation(clientInformation);
|
|
50590
50957
|
}
|
|
50591
50958
|
}
|
|
50592
50959
|
const nonInteractiveFlow = !provider.redirectUrl;
|
|
@@ -50597,10 +50964,14 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
|
|
|
50597
50964
|
authorizationCode,
|
|
50598
50965
|
fetchFn
|
|
50599
50966
|
});
|
|
50600
|
-
await
|
|
50967
|
+
await bindClientInformation();
|
|
50968
|
+
await provider.saveTokens({ ...tokens3, issuer });
|
|
50601
50969
|
return "AUTHORIZED";
|
|
50602
50970
|
}
|
|
50603
|
-
const tokens2 = await provider.tokens();
|
|
50971
|
+
const tokens2 = discardIfIssuerMismatch(await provider.tokens(), issuer);
|
|
50972
|
+
if (tokens2?.refresh_token && tokens2.issuer == null) {
|
|
50973
|
+
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.");
|
|
50974
|
+
}
|
|
50604
50975
|
if (tokens2?.refresh_token) {
|
|
50605
50976
|
try {
|
|
50606
50977
|
const newTokens = await refreshAuthorization(authorizationServerUrl, {
|
|
@@ -50611,7 +50982,8 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
|
|
|
50611
50982
|
addClientAuthentication: provider.addClientAuthentication,
|
|
50612
50983
|
fetchFn
|
|
50613
50984
|
});
|
|
50614
|
-
await
|
|
50985
|
+
await bindClientInformation();
|
|
50986
|
+
await provider.saveTokens({ ...newTokens, issuer });
|
|
50615
50987
|
return "AUTHORIZED";
|
|
50616
50988
|
} catch (error51) {
|
|
50617
50989
|
if (!(error51 instanceof OAuthError) || error51 instanceof ServerError) {
|
|
@@ -50710,7 +51082,7 @@ async function discoverOAuthProtectedResourceMetadata(serverUrl, opts, fetchFn =
|
|
|
50710
51082
|
}
|
|
50711
51083
|
async function fetchWithCorsRetry(url2, headers, fetchFn = fetch) {
|
|
50712
51084
|
try {
|
|
50713
|
-
return await fetchFn(url2, { headers });
|
|
51085
|
+
return await fetchWithinOrigin(fetchFn)(url2, { headers });
|
|
50714
51086
|
} catch (error51) {
|
|
50715
51087
|
if (error51 instanceof TypeError) {
|
|
50716
51088
|
if (headers) {
|
|
@@ -50735,7 +51107,7 @@ async function tryMetadataDiscovery(url2, protocolVersion, fetchFn = fetch) {
|
|
|
50735
51107
|
return await fetchWithCorsRetry(url2, headers, fetchFn);
|
|
50736
51108
|
}
|
|
50737
51109
|
function shouldAttemptFallback(response, pathname) {
|
|
50738
|
-
return !response || response.
|
|
51110
|
+
return !response || !response.ok && response.status < 500 && pathname !== "/";
|
|
50739
51111
|
}
|
|
50740
51112
|
async function discoverMetadataWithFallback(serverUrl, wellKnownType, fetchFn, opts) {
|
|
50741
51113
|
const issuer = new URL(serverUrl);
|
|
@@ -50801,7 +51173,7 @@ async function discoverAuthorizationServerMetadata(authorizationServerUrl, { fet
|
|
|
50801
51173
|
}
|
|
50802
51174
|
if (!response.ok) {
|
|
50803
51175
|
await response.body?.cancel();
|
|
50804
|
-
if (response.status
|
|
51176
|
+
if (response.status < 500) {
|
|
50805
51177
|
continue;
|
|
50806
51178
|
}
|
|
50807
51179
|
throw new Error(`HTTP ${response.status} trying to load ${type === "oauth" ? "OAuth" : "OpenID provider"} metadata from ${endpointUrl}`);
|
|
@@ -50834,6 +51206,9 @@ async function discoverOAuthServerInfo(serverUrl, opts) {
|
|
|
50834
51206
|
resourceMetadata
|
|
50835
51207
|
};
|
|
50836
51208
|
}
|
|
51209
|
+
function resourceIndicatorToString(resource) {
|
|
51210
|
+
return typeof resource === "string" ? resource : resource.href;
|
|
51211
|
+
}
|
|
50837
51212
|
async function startAuthorization(authorizationServerUrl, { metadata, clientInformation, redirectUrl, scope, state, resource }) {
|
|
50838
51213
|
let authorizationUrl;
|
|
50839
51214
|
if (metadata) {
|
|
@@ -50865,7 +51240,7 @@ async function startAuthorization(authorizationServerUrl, { metadata, clientInfo
|
|
|
50865
51240
|
authorizationUrl.searchParams.append("prompt", "consent");
|
|
50866
51241
|
}
|
|
50867
51242
|
if (resource) {
|
|
50868
|
-
authorizationUrl.searchParams.set("resource", resource
|
|
51243
|
+
authorizationUrl.searchParams.set("resource", resourceIndicatorToString(resource));
|
|
50869
51244
|
}
|
|
50870
51245
|
return { authorizationUrl, codeVerifier };
|
|
50871
51246
|
}
|
|
@@ -50884,7 +51259,7 @@ async function executeTokenRequest(authorizationServerUrl, { metadata, tokenRequ
|
|
|
50884
51259
|
Accept: "application/json"
|
|
50885
51260
|
});
|
|
50886
51261
|
if (resource) {
|
|
50887
|
-
tokenRequestParams.set("resource", resource
|
|
51262
|
+
tokenRequestParams.set("resource", resourceIndicatorToString(resource));
|
|
50888
51263
|
}
|
|
50889
51264
|
if (addClientAuthentication) {
|
|
50890
51265
|
await addClientAuthentication(headers, tokenRequestParams, tokenUrl, metadata);
|
|
@@ -50893,7 +51268,7 @@ async function executeTokenRequest(authorizationServerUrl, { metadata, tokenRequ
|
|
|
50893
51268
|
const authMethod = selectClientAuthMethod(clientInformation, supportedMethods);
|
|
50894
51269
|
applyClientAuthentication(authMethod, clientInformation, headers, tokenRequestParams);
|
|
50895
51270
|
}
|
|
50896
|
-
const response = await (fetchFn ?? fetch)(tokenUrl, {
|
|
51271
|
+
const response = await fetchWithinOrigin(fetchFn ?? fetch)(tokenUrl, {
|
|
50897
51272
|
method: "POST",
|
|
50898
51273
|
headers,
|
|
50899
51274
|
body: tokenRequestParams
|
|
@@ -50901,7 +51276,7 @@ async function executeTokenRequest(authorizationServerUrl, { metadata, tokenRequ
|
|
|
50901
51276
|
if (!response.ok) {
|
|
50902
51277
|
throw await parseErrorResponse(response);
|
|
50903
51278
|
}
|
|
50904
|
-
return
|
|
51279
|
+
return TokenResponseSchema.parse(await response.json());
|
|
50905
51280
|
}
|
|
50906
51281
|
async function refreshAuthorization(authorizationServerUrl, { metadata, clientInformation, refreshToken, resource, addClientAuthentication, fetchFn }) {
|
|
50907
51282
|
const tokenRequestParams = new URLSearchParams({
|
|
@@ -50919,6 +51294,15 @@ async function refreshAuthorization(authorizationServerUrl, { metadata, clientIn
|
|
|
50919
51294
|
return { refresh_token: refreshToken, ...tokens2 };
|
|
50920
51295
|
}
|
|
50921
51296
|
async function fetchToken(provider, authorizationServerUrl, { metadata, resource, authorizationCode, fetchFn } = {}) {
|
|
51297
|
+
const readClientInformation = async () => {
|
|
51298
|
+
const storedClientInformation = await provider.clientInformation();
|
|
51299
|
+
const checked = discardIfIssuerMismatch(storedClientInformation, String(authorizationServerUrl));
|
|
51300
|
+
if (storedClientInformation && !checked) {
|
|
51301
|
+
throw boundElsewhereError(storedClientInformation, String(authorizationServerUrl));
|
|
51302
|
+
}
|
|
51303
|
+
return checked;
|
|
51304
|
+
};
|
|
51305
|
+
let clientInformation = await readClientInformation();
|
|
50922
51306
|
const scope = provider.clientMetadata.scope;
|
|
50923
51307
|
let tokenRequestParams;
|
|
50924
51308
|
if (provider.prepareTokenRequest) {
|
|
@@ -50934,11 +51318,11 @@ async function fetchToken(provider, authorizationServerUrl, { metadata, resource
|
|
|
50934
51318
|
const codeVerifier = await provider.codeVerifier();
|
|
50935
51319
|
tokenRequestParams = prepareAuthorizationCodeRequest(authorizationCode, codeVerifier, provider.redirectUrl);
|
|
50936
51320
|
}
|
|
50937
|
-
|
|
51321
|
+
clientInformation ?? (clientInformation = await readClientInformation());
|
|
50938
51322
|
return executeTokenRequest(authorizationServerUrl, {
|
|
50939
51323
|
metadata,
|
|
50940
51324
|
tokenRequestParams,
|
|
50941
|
-
clientInformation
|
|
51325
|
+
clientInformation,
|
|
50942
51326
|
addClientAuthentication: provider.addClientAuthentication,
|
|
50943
51327
|
resource,
|
|
50944
51328
|
fetchFn
|
|
@@ -50954,7 +51338,7 @@ async function registerClient(authorizationServerUrl, { metadata, clientMetadata
|
|
|
50954
51338
|
} else {
|
|
50955
51339
|
registrationUrl = new URL("/register", authorizationServerUrl);
|
|
50956
51340
|
}
|
|
50957
|
-
const response = await (fetchFn ?? fetch)(registrationUrl, {
|
|
51341
|
+
const response = await fetchWithinOrigin(fetchFn ?? fetch)(registrationUrl, {
|
|
50958
51342
|
method: "POST",
|
|
50959
51343
|
headers: {
|
|
50960
51344
|
"Content-Type": "application/json"
|
|
@@ -50967,7 +51351,7 @@ async function registerClient(authorizationServerUrl, { metadata, clientMetadata
|
|
|
50967
51351
|
if (!response.ok) {
|
|
50968
51352
|
throw await parseErrorResponse(response);
|
|
50969
51353
|
}
|
|
50970
|
-
return
|
|
51354
|
+
return RegistrationResponseSchema.parse(await response.json());
|
|
50971
51355
|
}
|
|
50972
51356
|
|
|
50973
51357
|
// ../../node_modules/.pnpm/eventsource-parser@3.1.1/node_modules/eventsource-parser/dist/index.js
|
|
@@ -51171,7 +51555,7 @@ var EventSourceParserStream = class extends TransformStream {
|
|
|
51171
51555
|
}
|
|
51172
51556
|
};
|
|
51173
51557
|
|
|
51174
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
51558
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js
|
|
51175
51559
|
var DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS = {
|
|
51176
51560
|
initialReconnectionDelay: 1e3,
|
|
51177
51561
|
maxReconnectionDelay: 3e4,
|
|
@@ -51194,9 +51578,19 @@ var StreamableHTTPClientTransport = class {
|
|
|
51194
51578
|
this._authProvider = opts?.authProvider;
|
|
51195
51579
|
this._fetch = opts?.fetch;
|
|
51196
51580
|
this._fetchWithInit = createFetchWithInit(opts?.fetch, opts?.requestInit);
|
|
51581
|
+
this._followRedirects = opts?.redirectPolicy === "follow";
|
|
51582
|
+
if (this._followRedirects) {
|
|
51583
|
+
this._fetch = fetchLeavingRedirects(this._fetch);
|
|
51584
|
+
this._fetchWithInit = fetchLeavingRedirects(this._fetchWithInit);
|
|
51585
|
+
}
|
|
51197
51586
|
this._sessionId = opts?.sessionId;
|
|
51198
51587
|
this._reconnectionOptions = opts?.reconnectionOptions ?? DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS;
|
|
51199
51588
|
}
|
|
51589
|
+
/** Error text for a redirect `response` that was not followed, or `undefined` for any other response. */
|
|
51590
|
+
_unfollowedRedirect(response, url2) {
|
|
51591
|
+
const text = unfollowedRedirect(response, url2);
|
|
51592
|
+
return text && !this._followRedirects ? `${text} (redirectPolicy: 'same-origin')` : text;
|
|
51593
|
+
}
|
|
51200
51594
|
async _authThenStart() {
|
|
51201
51595
|
if (!this._authProvider) {
|
|
51202
51596
|
throw new UnauthorizedError("No auth provider");
|
|
@@ -51246,11 +51640,13 @@ var StreamableHTTPClientTransport = class {
|
|
|
51246
51640
|
if (resumptionToken) {
|
|
51247
51641
|
headers.set("last-event-id", resumptionToken);
|
|
51248
51642
|
}
|
|
51249
|
-
const
|
|
51250
|
-
|
|
51251
|
-
|
|
51252
|
-
|
|
51253
|
-
|
|
51643
|
+
const fetchFn = this._fetch ?? fetch;
|
|
51644
|
+
const init = { method: "GET", headers, signal: this._abortController?.signal };
|
|
51645
|
+
let response = await fetchFn(this._url, this._followRedirects ? init : { ...init, redirect: "manual" });
|
|
51646
|
+
const followed = this._followRedirects ? void 0 : followWithinOrigin(fetchFn, this._url, init, response);
|
|
51647
|
+
if (followed) {
|
|
51648
|
+
response = await followed;
|
|
51649
|
+
}
|
|
51254
51650
|
if (!response.ok) {
|
|
51255
51651
|
await response.body?.cancel();
|
|
51256
51652
|
if (response.status === 401 && this._authProvider) {
|
|
@@ -51259,7 +51655,7 @@ var StreamableHTTPClientTransport = class {
|
|
|
51259
51655
|
if (response.status === 405) {
|
|
51260
51656
|
return;
|
|
51261
51657
|
}
|
|
51262
|
-
throw new StreamableHTTPError(response.status, `Failed to open SSE stream: ${response.statusText}`);
|
|
51658
|
+
throw new StreamableHTTPError(response.status, `Failed to open SSE stream: ${this._unfollowedRedirect(response, this._url) ?? response.statusText}`);
|
|
51263
51659
|
}
|
|
51264
51660
|
this._handleSseStream(response.body, options, true);
|
|
51265
51661
|
} catch (error51) {
|
|
@@ -51422,7 +51818,7 @@ var StreamableHTTPClientTransport = class {
|
|
|
51422
51818
|
body: JSON.stringify(message),
|
|
51423
51819
|
signal: this._abortController?.signal
|
|
51424
51820
|
};
|
|
51425
|
-
const response = await (this._fetch ?? fetch)(this._url, init);
|
|
51821
|
+
const response = await fetchWithinOrigin(this._fetch ?? fetch)(this._url, init);
|
|
51426
51822
|
const sessionId = response.headers.get("mcp-session-id");
|
|
51427
51823
|
if (sessionId) {
|
|
51428
51824
|
this._sessionId = sessionId;
|
|
@@ -51474,7 +51870,7 @@ var StreamableHTTPClientTransport = class {
|
|
|
51474
51870
|
return this.send(message);
|
|
51475
51871
|
}
|
|
51476
51872
|
}
|
|
51477
|
-
throw new StreamableHTTPError(response.status, `Error POSTing to endpoint: ${text}`);
|
|
51873
|
+
throw new StreamableHTTPError(response.status, `Error POSTing to endpoint: ${this._unfollowedRedirect(response, this._url) ?? text}`);
|
|
51478
51874
|
}
|
|
51479
51875
|
this._hasCompletedAuthFlow = false;
|
|
51480
51876
|
this._lastUpscopingHeader = void 0;
|
|
@@ -51536,10 +51932,10 @@ var StreamableHTTPClientTransport = class {
|
|
|
51536
51932
|
headers,
|
|
51537
51933
|
signal: this._abortController?.signal
|
|
51538
51934
|
};
|
|
51539
|
-
const response = await (this._fetch ?? fetch)(this._url, init);
|
|
51935
|
+
const response = await fetchWithinOrigin(this._fetch ?? fetch)(this._url, init);
|
|
51540
51936
|
await response.body?.cancel();
|
|
51541
51937
|
if (!response.ok && response.status !== 405) {
|
|
51542
|
-
throw new StreamableHTTPError(response.status, `Failed to terminate session: ${response.statusText}`);
|
|
51938
|
+
throw new StreamableHTTPError(response.status, `Failed to terminate session: ${this._unfollowedRedirect(response, this._url) ?? response.statusText}`);
|
|
51543
51939
|
}
|
|
51544
51940
|
this._sessionId = void 0;
|
|
51545
51941
|
} catch (error51) {
|
|
@@ -51568,12 +51964,12 @@ var StreamableHTTPClientTransport = class {
|
|
|
51568
51964
|
}
|
|
51569
51965
|
};
|
|
51570
51966
|
|
|
51571
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
51967
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
|
|
51572
51968
|
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
51573
51969
|
var import_node_process = __toESM(require("node:process"), 1);
|
|
51574
51970
|
var import_node_stream = require("node:stream");
|
|
51575
51971
|
|
|
51576
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
51972
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
51577
51973
|
var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
|
|
51578
51974
|
var ReadBuffer = class {
|
|
51579
51975
|
constructor(options) {
|
|
@@ -51610,7 +52006,7 @@ function serializeMessage(message) {
|
|
|
51610
52006
|
return JSON.stringify(message) + "\n";
|
|
51611
52007
|
}
|
|
51612
52008
|
|
|
51613
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
52009
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
|
|
51614
52010
|
var DEFAULT_INHERITED_ENV_VARS = import_node_process.default.platform === "win32" ? [
|
|
51615
52011
|
"APPDATA",
|
|
51616
52012
|
"HOMEDRIVE",
|
|
@@ -57770,6 +58166,7 @@ async function verifyProviderReadiness(provider, run3, opts = {}) {
|
|
|
57770
58166
|
}
|
|
57771
58167
|
|
|
57772
58168
|
// src/browser-interceptor.ts
|
|
58169
|
+
var import_node_os12 = __toESM(require("node:os"), 1);
|
|
57773
58170
|
var import_node_readline = __toESM(require("node:readline"), 1);
|
|
57774
58171
|
var import_node_child_process14 = require("node:child_process");
|
|
57775
58172
|
var INTERNAL_HOST_PATTERNS = [
|
|
@@ -57793,8 +58190,7 @@ function isInternalMrrlinUrl(urlString) {
|
|
|
57793
58190
|
const trimmed = urlString.trim();
|
|
57794
58191
|
try {
|
|
57795
58192
|
const isRelative = trimmed.startsWith("/");
|
|
57796
|
-
const
|
|
57797
|
-
const parsed = isRelative ? { pathname: parsedPathname, hostname: "localhost" } : new URL(trimmed);
|
|
58193
|
+
const parsed = isRelative ? new URL(trimmed, "http://localhost") : new URL(trimmed);
|
|
57798
58194
|
const isInternalHost = isRelative || INTERNAL_HOST_PATTERNS.some((p) => p.test(parsed.hostname));
|
|
57799
58195
|
if (!isInternalHost) {
|
|
57800
58196
|
return { isInternal: false };
|
|
@@ -57823,66 +58219,132 @@ function isInternalMrrlinUrl(urlString) {
|
|
|
57823
58219
|
function formatInternalRouteRejectionMessage(url2, suggestedTool) {
|
|
57824
58220
|
return `[Preflight Guard] Refused to navigate browser to internal route "${url2}". Internal entities must be accessed via fast typed MCP tools directly against the database/API. Suggested tool: ${suggestedTool}. Do NOT open Chromium for internal data retrieval. If browser rendering is strictly required for visual UI testing, pass force_internal: true.`;
|
|
57825
58221
|
}
|
|
57826
|
-
function
|
|
58222
|
+
function processClientJsonRpcLine(rawLine) {
|
|
57827
58223
|
const trimmed = rawLine.trim();
|
|
57828
|
-
if (!trimmed) return
|
|
58224
|
+
if (!trimmed) return { type: "forward", payload: rawLine };
|
|
57829
58225
|
try {
|
|
57830
58226
|
const msg = JSON.parse(trimmed);
|
|
57831
58227
|
if (msg && msg.jsonrpc === "2.0" && msg.method === "tools/call" && msg.params?.name === "browser_navigate") {
|
|
57832
58228
|
const args = msg.params.arguments;
|
|
57833
58229
|
const url2 = typeof args?.url === "string" ? args.url : "";
|
|
57834
|
-
const forceInternal =
|
|
57835
|
-
|
|
58230
|
+
const forceInternal = args?.force_internal === true;
|
|
58231
|
+
const hadForceInternal = args && typeof args === "object" && "force_internal" in args;
|
|
58232
|
+
if (hadForceInternal) {
|
|
58233
|
+
delete args.force_internal;
|
|
58234
|
+
}
|
|
58235
|
+
if (forceInternal) {
|
|
58236
|
+
return { type: "forward", payload: JSON.stringify(msg) };
|
|
58237
|
+
}
|
|
58238
|
+
if (url2) {
|
|
57836
58239
|
const check2 = isInternalMrrlinUrl(url2);
|
|
57837
58240
|
if (check2.isInternal) {
|
|
57838
58241
|
const rejectionText = formatInternalRouteRejectionMessage(
|
|
57839
58242
|
url2,
|
|
57840
58243
|
check2.suggestedTool ?? "get_wiki_page / get_task"
|
|
57841
58244
|
);
|
|
57842
|
-
return
|
|
57843
|
-
|
|
57844
|
-
|
|
57845
|
-
|
|
57846
|
-
|
|
57847
|
-
|
|
57848
|
-
|
|
57849
|
-
|
|
57850
|
-
|
|
57851
|
-
|
|
57852
|
-
|
|
57853
|
-
|
|
57854
|
-
|
|
58245
|
+
return {
|
|
58246
|
+
type: "respond",
|
|
58247
|
+
payload: JSON.stringify({
|
|
58248
|
+
jsonrpc: "2.0",
|
|
58249
|
+
id: msg.id,
|
|
58250
|
+
result: {
|
|
58251
|
+
isError: true,
|
|
58252
|
+
content: [
|
|
58253
|
+
{
|
|
58254
|
+
type: "text",
|
|
58255
|
+
text: rejectionText
|
|
58256
|
+
}
|
|
58257
|
+
]
|
|
58258
|
+
}
|
|
58259
|
+
})
|
|
58260
|
+
};
|
|
57855
58261
|
}
|
|
57856
58262
|
}
|
|
58263
|
+
if (hadForceInternal) {
|
|
58264
|
+
return { type: "forward", payload: JSON.stringify(msg) };
|
|
58265
|
+
}
|
|
57857
58266
|
}
|
|
57858
58267
|
} catch {
|
|
57859
58268
|
}
|
|
57860
|
-
return
|
|
58269
|
+
return { type: "forward", payload: rawLine };
|
|
58270
|
+
}
|
|
58271
|
+
function processChildJsonRpcLine(rawLine) {
|
|
58272
|
+
const trimmed = rawLine.trim();
|
|
58273
|
+
if (!trimmed) return rawLine;
|
|
58274
|
+
try {
|
|
58275
|
+
const msg = JSON.parse(trimmed);
|
|
58276
|
+
if (msg && msg.result && Array.isArray(msg.result.tools)) {
|
|
58277
|
+
const navTool = msg.result.tools.find((t) => t.name === "browser_navigate");
|
|
58278
|
+
if (navTool && navTool.inputSchema) {
|
|
58279
|
+
if (!navTool.inputSchema.properties) {
|
|
58280
|
+
navTool.inputSchema.properties = {};
|
|
58281
|
+
}
|
|
58282
|
+
navTool.inputSchema.properties.force_internal = {
|
|
58283
|
+
type: "boolean",
|
|
58284
|
+
description: "Bypass the preflight guard for internal Mrrlin routes when visual browser rendering is strictly required."
|
|
58285
|
+
};
|
|
58286
|
+
return JSON.stringify(msg);
|
|
58287
|
+
}
|
|
58288
|
+
}
|
|
58289
|
+
} catch {
|
|
58290
|
+
}
|
|
58291
|
+
return rawLine;
|
|
57861
58292
|
}
|
|
57862
58293
|
function wireBrowserServeProxy(streams) {
|
|
57863
58294
|
const { input, output: output3, childIn, childOut } = streams;
|
|
58295
|
+
childIn.on("error", () => {
|
|
58296
|
+
});
|
|
57864
58297
|
const rl = import_node_readline.default.createInterface({
|
|
57865
58298
|
input,
|
|
57866
58299
|
crlfDelay: Infinity,
|
|
57867
58300
|
terminal: false
|
|
57868
58301
|
});
|
|
58302
|
+
const childRl = import_node_readline.default.createInterface({
|
|
58303
|
+
input: childOut,
|
|
58304
|
+
crlfDelay: Infinity,
|
|
58305
|
+
terminal: false
|
|
58306
|
+
});
|
|
57869
58307
|
rl.on("line", (line) => {
|
|
57870
|
-
const
|
|
57871
|
-
if (
|
|
57872
|
-
output3.write(
|
|
58308
|
+
const action = processClientJsonRpcLine(line);
|
|
58309
|
+
if (action.type === "respond") {
|
|
58310
|
+
output3.write(action.payload + "\n");
|
|
57873
58311
|
} else {
|
|
57874
|
-
|
|
58312
|
+
try {
|
|
58313
|
+
childIn.write(action.payload + "\n");
|
|
58314
|
+
} catch {
|
|
58315
|
+
}
|
|
58316
|
+
}
|
|
58317
|
+
});
|
|
58318
|
+
childRl.on("line", (line) => {
|
|
58319
|
+
const augmented = processChildJsonRpcLine(line);
|
|
58320
|
+
try {
|
|
58321
|
+
output3.write(augmented + "\n");
|
|
58322
|
+
} catch {
|
|
57875
58323
|
}
|
|
57876
58324
|
});
|
|
58325
|
+
const close = () => {
|
|
58326
|
+
rl.close();
|
|
58327
|
+
childRl.close();
|
|
58328
|
+
try {
|
|
58329
|
+
childIn.end();
|
|
58330
|
+
} catch {
|
|
58331
|
+
}
|
|
58332
|
+
};
|
|
57877
58333
|
rl.on("close", () => {
|
|
57878
58334
|
try {
|
|
57879
58335
|
childIn.end();
|
|
57880
58336
|
} catch {
|
|
57881
58337
|
}
|
|
57882
58338
|
});
|
|
57883
|
-
|
|
57884
|
-
|
|
57885
|
-
|
|
58339
|
+
return { close };
|
|
58340
|
+
}
|
|
58341
|
+
function signalToExitCode(signal) {
|
|
58342
|
+
if (!signal) return 1;
|
|
58343
|
+
const sigNum = import_node_os12.default.constants.signals[signal];
|
|
58344
|
+
if (typeof sigNum === "number") {
|
|
58345
|
+
return 128 + sigNum;
|
|
58346
|
+
}
|
|
58347
|
+
return 128 + 15;
|
|
57886
58348
|
}
|
|
57887
58349
|
async function runBrowserServeProxy(opts) {
|
|
57888
58350
|
const input = opts.input ?? process.stdin;
|
|
@@ -57894,17 +58356,38 @@ async function runBrowserServeProxy(opts) {
|
|
|
57894
58356
|
if (!child.stdin || !child.stdout) {
|
|
57895
58357
|
throw new Error("Failed to open stdio pipes to @playwright/mcp child process");
|
|
57896
58358
|
}
|
|
57897
|
-
wireBrowserServeProxy({
|
|
58359
|
+
const proxy = wireBrowserServeProxy({
|
|
57898
58360
|
input,
|
|
57899
58361
|
output: output3,
|
|
57900
58362
|
childIn: child.stdin,
|
|
57901
58363
|
childOut: child.stdout
|
|
57902
58364
|
});
|
|
58365
|
+
const sigintHandler = () => {
|
|
58366
|
+
try {
|
|
58367
|
+
child.kill("SIGINT");
|
|
58368
|
+
} catch {
|
|
58369
|
+
}
|
|
58370
|
+
};
|
|
58371
|
+
const sigtermHandler = () => {
|
|
58372
|
+
try {
|
|
58373
|
+
child.kill("SIGTERM");
|
|
58374
|
+
} catch {
|
|
58375
|
+
}
|
|
58376
|
+
};
|
|
58377
|
+
process.on("SIGINT", sigintHandler);
|
|
58378
|
+
process.on("SIGTERM", sigtermHandler);
|
|
57903
58379
|
return new Promise((resolve2) => {
|
|
57904
|
-
child.on("close", (code) => {
|
|
57905
|
-
|
|
58380
|
+
child.on("close", (code, signal) => {
|
|
58381
|
+
process.off("SIGINT", sigintHandler);
|
|
58382
|
+
process.off("SIGTERM", sigtermHandler);
|
|
58383
|
+
proxy.close();
|
|
58384
|
+
const exitCode = code !== null ? code : signalToExitCode(signal);
|
|
58385
|
+
resolve2(exitCode);
|
|
57906
58386
|
});
|
|
57907
58387
|
child.on("error", (err) => {
|
|
58388
|
+
process.off("SIGINT", sigintHandler);
|
|
58389
|
+
process.off("SIGTERM", sigtermHandler);
|
|
58390
|
+
proxy.close();
|
|
57908
58391
|
process.stderr.write(`[browser-serve proxy error]: ${err.message}
|
|
57909
58392
|
`);
|
|
57910
58393
|
resolve2(1);
|
|
@@ -57915,7 +58398,7 @@ async function runBrowserServeProxy(opts) {
|
|
|
57915
58398
|
// src/director-bridge.ts
|
|
57916
58399
|
var import_node_fs23 = __toESM(require("node:fs"), 1);
|
|
57917
58400
|
var import_node_http = __toESM(require("node:http"), 1);
|
|
57918
|
-
var
|
|
58401
|
+
var import_node_os18 = __toESM(require("node:os"), 1);
|
|
57919
58402
|
var import_node_path38 = __toESM(require("node:path"), 1);
|
|
57920
58403
|
var import_node_child_process22 = require("node:child_process");
|
|
57921
58404
|
var import_node_crypto16 = __toESM(require("node:crypto"), 1);
|
|
@@ -58471,7 +58954,7 @@ var import_semver3 = __toESM(require_semver2(), 1);
|
|
|
58471
58954
|
// src/codex-auth-preflight.ts
|
|
58472
58955
|
var import_node_child_process15 = require("node:child_process");
|
|
58473
58956
|
var import_node_fs11 = require("node:fs");
|
|
58474
|
-
var
|
|
58957
|
+
var import_node_os13 = __toESM(require("node:os"), 1);
|
|
58475
58958
|
var import_node_path20 = __toESM(require("node:path"), 1);
|
|
58476
58959
|
var DEFAULT_CODEX_AUTH_MIN_TTL_SECONDS = 15 * 60;
|
|
58477
58960
|
var DEFAULT_CODEX_AUTH_SMOKE_TIMEOUT_MS = 2e4;
|
|
@@ -58491,7 +58974,7 @@ function codexAuthSmokeTimeoutMs(env = process.env) {
|
|
|
58491
58974
|
function resolveCodexAuthPath(opts = {}) {
|
|
58492
58975
|
const env = opts.env ?? process.env;
|
|
58493
58976
|
const codexHome = env.CODEX_HOME?.trim();
|
|
58494
|
-
return import_node_path20.default.join(codexHome || import_node_path20.default.join(opts.homeDir ??
|
|
58977
|
+
return import_node_path20.default.join(codexHome || import_node_path20.default.join(opts.homeDir ?? import_node_os13.default.homedir(), ".codex"), "auth.json");
|
|
58495
58978
|
}
|
|
58496
58979
|
function decodeJwtExpMs(token) {
|
|
58497
58980
|
const parts = token.split(".");
|
|
@@ -58549,7 +59032,7 @@ function runCodexAuthRefreshSmokeForBridgeUpdate(opts = {}) {
|
|
|
58549
59032
|
const configuredExecutable = opts.codexExecutable ?? env.MRRLIN_DIRECTOR_BRIDGE_CODEX_BIN?.trim();
|
|
58550
59033
|
const executable = configuredExecutable || "codex";
|
|
58551
59034
|
const timeoutMs = opts.timeoutMs ?? codexAuthSmokeTimeoutMs(env);
|
|
58552
|
-
const cwd = opts.cwd ??
|
|
59035
|
+
const cwd = opts.cwd ?? import_node_os13.default.tmpdir();
|
|
58553
59036
|
const args = [
|
|
58554
59037
|
"exec",
|
|
58555
59038
|
"--sandbox",
|
|
@@ -59047,7 +59530,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
|
|
|
59047
59530
|
}
|
|
59048
59531
|
|
|
59049
59532
|
// src/_generated/version.ts
|
|
59050
|
-
var PKG_VERSION = "0.4.
|
|
59533
|
+
var PKG_VERSION = "0.4.104";
|
|
59051
59534
|
|
|
59052
59535
|
// src/director-closure.ts
|
|
59053
59536
|
var CLOSURE_SNAPSHOT_TIMEOUT_MS = 2e3;
|
|
@@ -59761,7 +60244,7 @@ function parseLedger(value) {
|
|
|
59761
60244
|
|
|
59762
60245
|
// src/api-base-url-migrate.ts
|
|
59763
60246
|
var import_node_fs13 = __toESM(require("node:fs"), 1);
|
|
59764
|
-
var
|
|
60247
|
+
var import_node_os14 = __toESM(require("node:os"), 1);
|
|
59765
60248
|
var import_node_path23 = __toESM(require("node:path"), 1);
|
|
59766
60249
|
|
|
59767
60250
|
// src/service-paths.ts
|
|
@@ -59839,7 +60322,7 @@ ${envLines}
|
|
|
59839
60322
|
|
|
59840
60323
|
// src/api-base-url-migrate.ts
|
|
59841
60324
|
function defaultDeps(deps) {
|
|
59842
|
-
const home = deps.home ?? process.env.HOME ??
|
|
60325
|
+
const home = deps.home ?? process.env.HOME ?? import_node_os14.default.homedir();
|
|
59843
60326
|
return {
|
|
59844
60327
|
home,
|
|
59845
60328
|
codexHome: deps.codexHome ?? process.env.CODEX_HOME?.trim() ?? import_node_path23.default.join(home, ".codex"),
|
|
@@ -65524,7 +66007,7 @@ function createToolBusyClock(opts) {
|
|
|
65524
66007
|
// src/remote-phone-relay.ts
|
|
65525
66008
|
var import_node_events3 = require("node:events");
|
|
65526
66009
|
var import_node_fs20 = require("node:fs");
|
|
65527
|
-
var
|
|
66010
|
+
var import_node_os15 = require("node:os");
|
|
65528
66011
|
var import_node_path34 = require("node:path");
|
|
65529
66012
|
|
|
65530
66013
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/cryptoNode.js
|
|
@@ -69096,7 +69579,7 @@ var DirectorRelay = class {
|
|
|
69096
69579
|
|
|
69097
69580
|
// src/remote-phone-relay.ts
|
|
69098
69581
|
function loadOrCreateAgentDeviceKey() {
|
|
69099
|
-
const path29 = (0, import_node_path34.join)((0,
|
|
69582
|
+
const path29 = (0, import_node_path34.join)((0, import_node_os15.homedir)(), ".mrrlin", "agent-device-key");
|
|
69100
69583
|
try {
|
|
69101
69584
|
const raw = JSON.parse((0, import_node_fs20.readFileSync)(path29, "utf8"));
|
|
69102
69585
|
if (typeof raw.priv === "string" && typeof raw.pub === "string") {
|
|
@@ -69106,7 +69589,7 @@ function loadOrCreateAgentDeviceKey() {
|
|
|
69106
69589
|
}
|
|
69107
69590
|
const kp = generateIdentityKeyPair();
|
|
69108
69591
|
try {
|
|
69109
|
-
(0, import_node_fs20.mkdirSync)((0, import_node_path34.join)((0,
|
|
69592
|
+
(0, import_node_fs20.mkdirSync)((0, import_node_path34.join)((0, import_node_os15.homedir)(), ".mrrlin"), { recursive: true });
|
|
69110
69593
|
(0, import_node_fs20.writeFileSync)(
|
|
69111
69594
|
path29,
|
|
69112
69595
|
JSON.stringify({ priv: toBase64Url(kp.privateKey), pub: toBase64Url(kp.publicKey) }),
|
|
@@ -69116,7 +69599,7 @@ function loadOrCreateAgentDeviceKey() {
|
|
|
69116
69599
|
}
|
|
69117
69600
|
return kp;
|
|
69118
69601
|
}
|
|
69119
|
-
var AGENT_PAIRING_PATH = (0, import_node_path34.join)((0,
|
|
69602
|
+
var AGENT_PAIRING_PATH = (0, import_node_path34.join)((0, import_node_os15.homedir)(), ".mrrlin", "agent-pairing.json");
|
|
69120
69603
|
function loadAgentPairing() {
|
|
69121
69604
|
try {
|
|
69122
69605
|
const raw = JSON.parse((0, import_node_fs20.readFileSync)(AGENT_PAIRING_PATH, "utf8"));
|
|
@@ -69134,7 +69617,7 @@ function loadAgentPairing() {
|
|
|
69134
69617
|
}
|
|
69135
69618
|
function saveAgentPairing(record2) {
|
|
69136
69619
|
try {
|
|
69137
|
-
(0, import_node_fs20.mkdirSync)((0, import_node_path34.join)((0,
|
|
69620
|
+
(0, import_node_fs20.mkdirSync)((0, import_node_path34.join)((0, import_node_os15.homedir)(), ".mrrlin"), { recursive: true });
|
|
69138
69621
|
(0, import_node_fs20.writeFileSync)(AGENT_PAIRING_PATH, JSON.stringify(record2), { mode: 384 });
|
|
69139
69622
|
} catch {
|
|
69140
69623
|
}
|
|
@@ -69640,11 +70123,11 @@ async function readSessionRows(logsDir, files, sessionIds) {
|
|
|
69640
70123
|
|
|
69641
70124
|
// src/external-agents-scrub.ts
|
|
69642
70125
|
var import_node_fs22 = __toESM(require("node:fs"), 1);
|
|
69643
|
-
var
|
|
70126
|
+
var import_node_os16 = __toESM(require("node:os"), 1);
|
|
69644
70127
|
var import_node_path36 = __toESM(require("node:path"), 1);
|
|
69645
70128
|
var REDACTION = "[REDACTED]";
|
|
69646
70129
|
var SHORT_VALUE_THRESHOLD = 8;
|
|
69647
|
-
var KEYS_ENV_PATH = () => import_node_path36.default.join(
|
|
70130
|
+
var KEYS_ENV_PATH = () => import_node_path36.default.join(import_node_os16.default.homedir(), ".local", "state", "external-agents", "keys.env");
|
|
69648
70131
|
var keysEnvCache = null;
|
|
69649
70132
|
function readKeysEnv() {
|
|
69650
70133
|
const filePath = KEYS_ENV_PATH();
|
|
@@ -70088,7 +70571,7 @@ function readKnownGptSlugsFromTomlFile(filePath) {
|
|
|
70088
70571
|
return Array.from(raw.matchAll(/^\s*model\s*=\s*"([^"]+)"/gm)).map((match) => match[1]?.trim() ?? "").filter(isSelectableModelSlug);
|
|
70089
70572
|
}
|
|
70090
70573
|
function readCodexFallbackModels() {
|
|
70091
|
-
const codexHome = process.env.CODEX_HOME?.trim() || import_node_path38.default.join(
|
|
70574
|
+
const codexHome = process.env.CODEX_HOME?.trim() || import_node_path38.default.join(import_node_os18.default.homedir(), ".codex");
|
|
70092
70575
|
const models = /* @__PURE__ */ new Map();
|
|
70093
70576
|
const cachePath = import_node_path38.default.join(codexHome, "models_cache.json");
|
|
70094
70577
|
const cacheRaw = readTextIfExists(cachePath);
|
|
@@ -71254,7 +71737,7 @@ function createBridgeMessageHandler(deps) {
|
|
|
71254
71737
|
sendForSpan({ type: "checkout-state", ok: false, error: { code: "invalid_input", fields: { projectSlug: "required" } } });
|
|
71255
71738
|
return;
|
|
71256
71739
|
}
|
|
71257
|
-
const state = readCheckoutState(deps.checkoutRegistry, projectSlug,
|
|
71740
|
+
const state = readCheckoutState(deps.checkoutRegistry, projectSlug, import_node_os18.default.hostname());
|
|
71258
71741
|
if (!state) {
|
|
71259
71742
|
sendForSpan({ type: "checkout-state", ok: false, error: { code: "checkout_missing" } });
|
|
71260
71743
|
return;
|
|
@@ -71286,7 +71769,7 @@ function createBridgeMessageHandler(deps) {
|
|
|
71286
71769
|
const result = registerCheckout(
|
|
71287
71770
|
deps.checkoutRegistry,
|
|
71288
71771
|
{ projectSlug, path: typeof msg.path === "string" ? msg.path : "", repo },
|
|
71289
|
-
|
|
71772
|
+
import_node_os18.default.hostname()
|
|
71290
71773
|
);
|
|
71291
71774
|
if (!result.ok) {
|
|
71292
71775
|
sendForSpan({ type: "checkout-register", ok: false, error: { code: result.code, detail: result.detail } });
|
|
@@ -73552,7 +74035,7 @@ function renderContextPrefix(context) {
|
|
|
73552
74035
|
return parts.join("\n\n");
|
|
73553
74036
|
}
|
|
73554
74037
|
|
|
73555
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
74038
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
|
|
73556
74039
|
var ExperimentalServerTasks = class {
|
|
73557
74040
|
constructor(_server) {
|
|
73558
74041
|
this._server = _server;
|
|
@@ -73765,7 +74248,7 @@ var ExperimentalServerTasks = class {
|
|
|
73765
74248
|
}
|
|
73766
74249
|
};
|
|
73767
74250
|
|
|
73768
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
74251
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
|
|
73769
74252
|
var Server = class extends Protocol {
|
|
73770
74253
|
/**
|
|
73771
74254
|
* Initializes this server with the given name and version information.
|
|
@@ -74136,7 +74619,7 @@ var Server = class extends Protocol {
|
|
|
74136
74619
|
}
|
|
74137
74620
|
};
|
|
74138
74621
|
|
|
74139
|
-
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
74622
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
74140
74623
|
var import_node_process2 = __toESM(require("node:process"), 1);
|
|
74141
74624
|
var StdioServerTransport = class {
|
|
74142
74625
|
constructor(_stdin = import_node_process2.default.stdin, _stdout = import_node_process2.default.stdout, options) {
|
|
@@ -74383,7 +74866,7 @@ function runSetCredential(args) {
|
|
|
74383
74866
|
}
|
|
74384
74867
|
|
|
74385
74868
|
// src/install-service.ts
|
|
74386
|
-
var
|
|
74869
|
+
var import_node_os19 = __toESM(require("node:os"), 1);
|
|
74387
74870
|
var import_node_fs24 = require("node:fs");
|
|
74388
74871
|
var import_node_path39 = __toESM(require("node:path"), 1);
|
|
74389
74872
|
function parseEnvLine(line, env) {
|
|
@@ -74862,11 +75345,11 @@ function installService(deps) {
|
|
|
74862
75345
|
deps.log(resolved.reason);
|
|
74863
75346
|
return { ok: false };
|
|
74864
75347
|
}
|
|
74865
|
-
const home = deps.env.HOME ??
|
|
75348
|
+
const home = deps.env.HOME ?? import_node_os19.default.homedir();
|
|
74866
75349
|
const user = resolveBridgeUser({
|
|
74867
75350
|
env: deps.env,
|
|
74868
75351
|
home,
|
|
74869
|
-
userInfo: deps.userInfo ?? (() =>
|
|
75352
|
+
userInfo: deps.userInfo ?? (() => import_node_os19.default.userInfo()),
|
|
74870
75353
|
homeOwnerUid: deps.homeOwnerUid ?? defaultHomeOwnerUid,
|
|
74871
75354
|
log: deps.log
|
|
74872
75355
|
});
|
|
@@ -74887,7 +75370,7 @@ function installService(deps) {
|
|
|
74887
75370
|
const claudeBin = deps.which("claude");
|
|
74888
75371
|
const agyBin = deps.which("agy");
|
|
74889
75372
|
const resolvedBins = [...bins, claudeBin, agyBin].filter((b) => b !== null);
|
|
74890
|
-
const isWin =
|
|
75373
|
+
const isWin = import_node_os19.default.platform() === "win32";
|
|
74891
75374
|
const systemDirs = isWin ? (deps.env.PATH || "").split(import_node_path39.default.delimiter).filter(Boolean) : SYSTEM_PATH_DIRS;
|
|
74892
75375
|
const pathEnv = Array.from(
|
|
74893
75376
|
/* @__PURE__ */ new Set([...resolvedBins.map((b) => import_node_path39.default.dirname(b)), ...systemDirs])
|
|
@@ -74970,14 +75453,14 @@ function uninstallService(deps) {
|
|
|
74970
75453
|
|
|
74971
75454
|
// src/uninstall-codex.ts
|
|
74972
75455
|
var import_promises16 = __toESM(require("node:fs/promises"), 1);
|
|
74973
|
-
var
|
|
75456
|
+
var import_node_os20 = __toESM(require("node:os"), 1);
|
|
74974
75457
|
var import_node_path40 = __toESM(require("node:path"), 1);
|
|
74975
75458
|
var toml5 = __toESM(require_toml(), 1);
|
|
74976
75459
|
function resolveCodexHome3(options) {
|
|
74977
75460
|
if (options.codexHome) return options.codexHome;
|
|
74978
75461
|
if (options.homeDir) return import_node_path40.default.join(options.homeDir, ".codex");
|
|
74979
75462
|
if (process.env.CODEX_HOME) return process.env.CODEX_HOME;
|
|
74980
|
-
return import_node_path40.default.join(
|
|
75463
|
+
return import_node_path40.default.join(import_node_os20.default.homedir(), ".codex");
|
|
74981
75464
|
}
|
|
74982
75465
|
async function pathExists6(target) {
|
|
74983
75466
|
try {
|
|
@@ -75164,7 +75647,7 @@ Missing required flag(s): ${missing.join(
|
|
|
75164
75647
|
function augmentProcessPathWithCommonDirs() {
|
|
75165
75648
|
const isWin = process.platform === "win32";
|
|
75166
75649
|
if (isWin) return;
|
|
75167
|
-
const home = process.env.HOME || (0,
|
|
75650
|
+
const home = process.env.HOME || (0, import_node_os21.homedir)();
|
|
75168
75651
|
const candidates = [
|
|
75169
75652
|
import_node_path43.default.join(home, ".local", "bin"),
|
|
75170
75653
|
import_node_path43.default.join(home, ".cargo", "bin"),
|
|
@@ -75194,11 +75677,11 @@ function bootHookStatus() {
|
|
|
75194
75677
|
if (process.platform !== "darwin") return { status: "unknown" };
|
|
75195
75678
|
const uid = process.getuid?.();
|
|
75196
75679
|
if (uid === void 0 || uid === 0) return { status: "unknown" };
|
|
75197
|
-
const home = process.env.HOME ?? (0,
|
|
75680
|
+
const home = process.env.HOME ?? (0, import_node_os21.homedir)();
|
|
75198
75681
|
const agents = import_node_path43.default.join(home, "Library", "LaunchAgents");
|
|
75199
75682
|
const candidates = [
|
|
75200
75683
|
{ label: "com.mrrlin.director-bridge", plist: import_node_path43.default.join(agents, "com.mrrlin.director-bridge.plist") },
|
|
75201
|
-
{ label: "com.PM2", plist: import_node_path43.default.join(agents, `pm2.${(0,
|
|
75684
|
+
{ label: "com.PM2", plist: import_node_path43.default.join(agents, `pm2.${(0, import_node_os21.userInfo)().username}.plist`) }
|
|
75202
75685
|
];
|
|
75203
75686
|
for (const candidate of candidates) {
|
|
75204
75687
|
const printed = (0, import_node_child_process23.spawnSync)("launchctl", ["print", `gui/${uid}/${candidate.label}`], { encoding: "utf8" });
|
|
@@ -75480,7 +75963,7 @@ async function main() {
|
|
|
75480
75963
|
}
|
|
75481
75964
|
}
|
|
75482
75965
|
try {
|
|
75483
|
-
const codexHome = process.env.CODEX_HOME ?? import_node_path43.default.join(process.env.HOME ?? (0,
|
|
75966
|
+
const codexHome = process.env.CODEX_HOME ?? import_node_path43.default.join(process.env.HOME ?? (0, import_node_os21.homedir)(), ".codex");
|
|
75484
75967
|
(0, import_node_fs25.rmSync)(import_node_path43.default.join(codexHome, "prompts", "report-issue.md"), { force: true });
|
|
75485
75968
|
} catch {
|
|
75486
75969
|
}
|
|
@@ -75596,14 +76079,14 @@ async function main() {
|
|
|
75596
76079
|
purgeSecret: purge,
|
|
75597
76080
|
secretPath: agentCredentialPath(),
|
|
75598
76081
|
tokenPath: operatorTokenPath(),
|
|
75599
|
-
ecoPath: import_node_path43.default.join(process.env.HOME ?? (0,
|
|
76082
|
+
ecoPath: import_node_path43.default.join(process.env.HOME ?? (0, import_node_os21.homedir)(), ".mrrlin", "ecosystem.config.cjs"),
|
|
75600
76083
|
log: (m) => process.stderr.write(`[mrrlin-mcp uninstall-service] ${m}
|
|
75601
76084
|
`)
|
|
75602
76085
|
});
|
|
75603
76086
|
return;
|
|
75604
76087
|
}
|
|
75605
76088
|
case "uninstall": {
|
|
75606
|
-
const home = process.env.HOME ?? (0,
|
|
76089
|
+
const home = process.env.HOME ?? (0, import_node_os21.homedir)();
|
|
75607
76090
|
const log = (m) => process.stderr.write(`[mrrlin-mcp uninstall] ${m}
|
|
75608
76091
|
`);
|
|
75609
76092
|
uninstallService({
|