@mrrlin-dev/mcp 0.4.152 → 0.4.153
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 +75 -18
- package/package.json +1 -1
package/dist/bin.cjs
CHANGED
|
@@ -40362,8 +40362,16 @@ var mrrlinInboxItemActionPayloadSchema = external_exports.object({
|
|
|
40362
40362
|
codeExecution: external_exports.boolean().optional(),
|
|
40363
40363
|
// Optional scheduler recovery action carried by an info item.
|
|
40364
40364
|
retryToolName: external_exports.string().min(1).optional(),
|
|
40365
|
-
retryDedupKey: external_exports.string().min(1).optional()
|
|
40366
|
-
|
|
40365
|
+
retryDedupKey: external_exports.string().min(1).optional(),
|
|
40366
|
+
capability: external_exports.string().optional(),
|
|
40367
|
+
capabilityPayload: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
40368
|
+
permitId: external_exports.string().optional(),
|
|
40369
|
+
scopeId: external_exports.string().optional(),
|
|
40370
|
+
serverId: external_exports.string().optional(),
|
|
40371
|
+
specRevision: external_exports.string().optional(),
|
|
40372
|
+
specWikiPageId: external_exports.string().optional(),
|
|
40373
|
+
toolName: external_exports.string().optional()
|
|
40374
|
+
}).passthrough();
|
|
40367
40375
|
var mrrlinInboxQuestionOptionSchema = external_exports.object({
|
|
40368
40376
|
answer: external_exports.string().trim().min(1),
|
|
40369
40377
|
description: external_exports.string().trim().min(1),
|
|
@@ -40418,6 +40426,7 @@ var mrrlinInboxItemSchema = external_exports.object({
|
|
|
40418
40426
|
id: mrrlinInboxItemIdSchema,
|
|
40419
40427
|
kind: mrrlinInboxItemKindSchema,
|
|
40420
40428
|
origin: external_exports.string().nullable().optional(),
|
|
40429
|
+
payloadDigest: external_exports.string().nullable().optional(),
|
|
40421
40430
|
planId: mrrlinPlanIdSchema.nullable().default(null),
|
|
40422
40431
|
projectSlug: mrrlinProjectSlugSchema,
|
|
40423
40432
|
questionOptions: mrrlinInboxQuestionOptionsSchema.nullable().default(null),
|
|
@@ -40443,6 +40452,7 @@ var mrrlinInboxItemCreateSchema = external_exports.object({
|
|
|
40443
40452
|
id: mrrlinInboxItemIdSchema,
|
|
40444
40453
|
kind: mrrlinInboxItemKindSchema,
|
|
40445
40454
|
origin: external_exports.string().min(1).optional(),
|
|
40455
|
+
payloadDigest: external_exports.string().min(1).nullable().optional(),
|
|
40446
40456
|
planId: mrrlinPlanIdSchema.nullable().optional(),
|
|
40447
40457
|
questionOptions: mrrlinInboxQuestionOptionsSchema.nullable().optional(),
|
|
40448
40458
|
taskId: mrrlinTaskIdSchema.nullable().optional()
|
|
@@ -40458,6 +40468,7 @@ var mrrlinInboxItemCreateSchema = external_exports.object({
|
|
|
40458
40468
|
var mrrlinInboxItemDecideSchema = external_exports.object({
|
|
40459
40469
|
answer: external_exports.string().min(1).optional(),
|
|
40460
40470
|
decidedBy: external_exports.string().min(1),
|
|
40471
|
+
expectedPayloadDigest: external_exports.string().min(1).optional(),
|
|
40461
40472
|
reason: external_exports.string().min(1).optional(),
|
|
40462
40473
|
verdict: external_exports.enum(["approved", "rejected", "acknowledged"])
|
|
40463
40474
|
}).superRefine((value, context) => {
|
|
@@ -40481,6 +40492,7 @@ var mrrlinInboxItemSummarySchema = external_exports.object({
|
|
|
40481
40492
|
id: mrrlinInboxItemIdSchema,
|
|
40482
40493
|
kind: mrrlinInboxItemKindSchema,
|
|
40483
40494
|
origin: external_exports.string().nullable().optional(),
|
|
40495
|
+
payloadDigest: external_exports.string().nullable().optional(),
|
|
40484
40496
|
planId: mrrlinPlanIdSchema.nullable().default(null),
|
|
40485
40497
|
projectSlug: mrrlinProjectSlugSchema,
|
|
40486
40498
|
readAt: external_exports.string().datetime().nullable(),
|
|
@@ -40539,7 +40551,10 @@ var inboxItemsMarkReadResponseSchema = external_exports.object({
|
|
|
40539
40551
|
readAt: external_exports.string().datetime()
|
|
40540
40552
|
})
|
|
40541
40553
|
});
|
|
40542
|
-
var inboxItemResponseSchema = external_exports.object({
|
|
40554
|
+
var inboxItemResponseSchema = external_exports.object({
|
|
40555
|
+
data: mrrlinInboxItemSchema,
|
|
40556
|
+
replayed: external_exports.boolean().optional()
|
|
40557
|
+
});
|
|
40543
40558
|
var inboxItemListResponseSchema = external_exports.object({ data: external_exports.array(mrrlinInboxItemSchema) });
|
|
40544
40559
|
var inboxItemSummaryListResponseSchema = external_exports.object({ data: external_exports.array(mrrlinInboxItemSummarySchema) });
|
|
40545
40560
|
var capabilityServerIdSchema = external_exports.string().trim().min(1).max(200);
|
|
@@ -55061,7 +55076,7 @@ var RepoHostRouteUnavailableError = class extends Error {
|
|
|
55061
55076
|
};
|
|
55062
55077
|
var NoGrantForServerError = class extends RepoHostRouteUnavailableError {
|
|
55063
55078
|
};
|
|
55064
|
-
async function proceedToDestination(client, route, resolvedToolName, input) {
|
|
55079
|
+
async function proceedToDestination(client, route, resolvedToolName, input, approvalItemId, boundPermitId) {
|
|
55065
55080
|
const taskless = !input.taskId;
|
|
55066
55081
|
if (taskless && !MRRLIN_API_CAPABILITIES.has(route.capability)) {
|
|
55067
55082
|
await recordUse(client, route, resolvedToolName, input, "refused");
|
|
@@ -55083,7 +55098,16 @@ async function proceedToDestination(client, route, resolvedToolName, input) {
|
|
|
55083
55098
|
if (input.taskId && client.issueCapabilityPermit && client.redeemCapabilityPermit) {
|
|
55084
55099
|
try {
|
|
55085
55100
|
const payloadDigest = import_node_crypto5.default.createHash("sha256").update(JSON.stringify(input.payload ?? null)).digest("hex");
|
|
55086
|
-
const
|
|
55101
|
+
const targetInvocationId = approvalItemId ? `inv_${approvalItemId}` : void 0;
|
|
55102
|
+
let effectivePermitId = boundPermitId;
|
|
55103
|
+
if (!effectivePermitId && targetInvocationId && client.getCapabilityInvocation) {
|
|
55104
|
+
try {
|
|
55105
|
+
const existingInv = await client.getCapabilityInvocation(input.taskProjectSlug, targetInvocationId);
|
|
55106
|
+
if (existingInv) effectivePermitId = existingInv.permitId;
|
|
55107
|
+
} catch {
|
|
55108
|
+
}
|
|
55109
|
+
}
|
|
55110
|
+
const permitId = effectivePermitId ?? (await client.issueCapabilityPermit(input.taskProjectSlug, {
|
|
55087
55111
|
projectSlug: input.taskProjectSlug,
|
|
55088
55112
|
taskId: input.taskId,
|
|
55089
55113
|
serverId: route.serverId,
|
|
@@ -55091,12 +55115,13 @@ async function proceedToDestination(client, route, resolvedToolName, input) {
|
|
|
55091
55115
|
toolName: resolvedToolName,
|
|
55092
55116
|
operationClass: resolveOperationClass(route, "reversible"),
|
|
55093
55117
|
payloadDigest
|
|
55094
|
-
});
|
|
55095
|
-
const idempotencyKey = `deliver:${input.taskProjectSlug}:${
|
|
55118
|
+
})).id;
|
|
55119
|
+
const idempotencyKey = approvalItemId ? `deliver:approval:${approvalItemId}` : `deliver:${input.taskProjectSlug}:${permitId}`;
|
|
55096
55120
|
const redemption = await client.redeemCapabilityPermit(input.taskProjectSlug, {
|
|
55097
|
-
permitId
|
|
55121
|
+
permitId,
|
|
55098
55122
|
idempotencyKey,
|
|
55099
|
-
payloadDigest
|
|
55123
|
+
payloadDigest,
|
|
55124
|
+
invocationId: targetInvocationId
|
|
55100
55125
|
});
|
|
55101
55126
|
invocationId = redemption.id;
|
|
55102
55127
|
if (redemption.replayed) {
|
|
@@ -55226,8 +55251,10 @@ async function handleApproval(client, route, resolvedToolName, input) {
|
|
|
55226
55251
|
if (scopeId === null) {
|
|
55227
55252
|
return refuse(client, route, resolvedToolName, input);
|
|
55228
55253
|
}
|
|
55229
|
-
const
|
|
55230
|
-
const
|
|
55254
|
+
const payloadDigest = import_node_crypto5.default.createHash("sha256").update(JSON.stringify(input.payload ?? null)).digest("hex");
|
|
55255
|
+
const digestPrefix = payloadDigest.slice(0, 16);
|
|
55256
|
+
const groupId = `capability:approval:${scopeId}:${route.serverId}:${resolvedToolName}:${digestPrefix}`;
|
|
55257
|
+
const id = `II-capability-approval-${scopeId}-${route.serverId}-${resolvedToolName}-${digestPrefix}`;
|
|
55231
55258
|
let items;
|
|
55232
55259
|
try {
|
|
55233
55260
|
items = await client.listInboxItems(input.taskProjectSlug, { groupId });
|
|
@@ -55239,26 +55266,56 @@ async function handleApproval(client, route, resolvedToolName, input) {
|
|
|
55239
55266
|
try {
|
|
55240
55267
|
await client.createInboxItem(input.taskProjectSlug, {
|
|
55241
55268
|
id,
|
|
55242
|
-
kind: "
|
|
55269
|
+
kind: "proposal",
|
|
55243
55270
|
origin: "capability",
|
|
55244
55271
|
groupId,
|
|
55245
|
-
body: `Approve ${resolvedToolName} on ${route.serverId}
|
|
55246
|
-
|
|
55272
|
+
body: `Approve ${resolvedToolName} on ${route.serverId}?
|
|
55273
|
+
|
|
55274
|
+
Payload:
|
|
55275
|
+
\`\`\`json
|
|
55276
|
+
${JSON.stringify(input.payload ?? {}, null, 2)}
|
|
55277
|
+
\`\`\``,
|
|
55278
|
+
taskId: input.taskId,
|
|
55279
|
+
payloadDigest,
|
|
55280
|
+
actionPayload: {
|
|
55281
|
+
actor: "agent",
|
|
55282
|
+
provider: "mcp",
|
|
55283
|
+
runId: input.runId ?? (input.taskId ? `ER-${input.taskId}` : "ER-CAP-APPROVAL"),
|
|
55284
|
+
codeExecution: false,
|
|
55285
|
+
capabilityPayload: input.payload ?? {},
|
|
55286
|
+
serverId: route.serverId,
|
|
55287
|
+
toolName: resolvedToolName,
|
|
55288
|
+
scopeId,
|
|
55289
|
+
capability: route.capability
|
|
55290
|
+
}
|
|
55247
55291
|
});
|
|
55248
55292
|
} catch {
|
|
55249
55293
|
}
|
|
55250
55294
|
return refuse(client, route, resolvedToolName, input);
|
|
55251
55295
|
}
|
|
55252
|
-
if (existing.
|
|
55296
|
+
if (!existing.payloadDigest || existing.payloadDigest !== payloadDigest) {
|
|
55297
|
+
return refuse(client, route, resolvedToolName, input);
|
|
55298
|
+
}
|
|
55299
|
+
const isApproved = existing.status === "approved";
|
|
55300
|
+
if (!isApproved) {
|
|
55253
55301
|
return refuse(client, route, resolvedToolName, input);
|
|
55254
55302
|
}
|
|
55255
55303
|
if (existing.decidedAt === null) {
|
|
55256
55304
|
return refuse(client, route, resolvedToolName, input);
|
|
55257
55305
|
}
|
|
55258
|
-
|
|
55306
|
+
const invocationId = `inv_${existing.id}`;
|
|
55307
|
+
let existingInv = null;
|
|
55308
|
+
if (client.getCapabilityInvocation) {
|
|
55309
|
+
try {
|
|
55310
|
+
existingInv = await client.getCapabilityInvocation(input.taskProjectSlug, invocationId);
|
|
55311
|
+
} catch {
|
|
55312
|
+
}
|
|
55313
|
+
}
|
|
55314
|
+
if (!existingInv && await alreadyConsumed(client, route, resolvedToolName, input, existing.decidedAt)) {
|
|
55259
55315
|
return refuse(client, route, resolvedToolName, input);
|
|
55260
55316
|
}
|
|
55261
|
-
|
|
55317
|
+
const boundPermitId = existingInv?.permitId ?? existing.actionPayload?.permitId;
|
|
55318
|
+
return proceedToDestination(client, route, resolvedToolName, input, existing.id, boundPermitId);
|
|
55262
55319
|
}
|
|
55263
55320
|
async function handleWindow(client, route, resolvedToolName, input) {
|
|
55264
55321
|
if (input.taskId === null) {
|
|
@@ -63962,7 +64019,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
|
|
|
63962
64019
|
}
|
|
63963
64020
|
|
|
63964
64021
|
// src/_generated/version.ts
|
|
63965
|
-
var PKG_VERSION = "0.4.
|
|
64022
|
+
var PKG_VERSION = "0.4.153";
|
|
63966
64023
|
|
|
63967
64024
|
// src/bridge-allowed-origins.ts
|
|
63968
64025
|
var DEFAULT_DIRECTOR_BRIDGE_ALLOWED_ORIGINS = [
|