@kya-os/create-mcpi-app 1.10.2 โ 1.10.3
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/.turbo/turbo-build.log +7 -7
- package/dist/bundles/blank.js +116 -61
- package/dist/bundles/ecommerce.js +116 -61
- package/dist/bundles/hardware-world.js +116 -61
- package/dist/bundles/manifest.json +11 -11
- package/dist/bundles/mix-station.js +116 -61
- package/dist/helpers/get-package-versions.js +1 -1
- package/package.json +2 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @kya-os/create-mcpi-app@1.10.
|
|
2
|
+
> @kya-os/create-mcpi-app@1.10.3 build /Users/dylanhobbs/Documents/@kya-os/xmcp-i/.claude/worktrees/kya-os-http/packages/create-mcpi-app
|
|
3
3
|
> tsc && chmod +x dist/index.js && node --import tsx scripts/build-bundles.ts
|
|
4
4
|
|
|
5
5
|
๐จ Building template bundles...
|
|
@@ -7,23 +7,23 @@
|
|
|
7
7
|
|
|
8
8
|
๐ฆ Building template: blank
|
|
9
9
|
โ
Source files written to /Users/dylanhobbs/Documents/@kya-os/xmcp-i/.claude/worktrees/kya-os-http/packages/create-mcpi-app/dist/.tmp-bundles/blank
|
|
10
|
-
โ
Bundle built:
|
|
10
|
+
โ
Bundle built: 7226042 bytes, hash: sha256:85d714b4d55d6...
|
|
11
11
|
|
|
12
12
|
๐ฆ Building template: hardware-world
|
|
13
13
|
โ
Source files written to /Users/dylanhobbs/Documents/@kya-os/xmcp-i/.claude/worktrees/kya-os-http/packages/create-mcpi-app/dist/.tmp-bundles/hardware-world
|
|
14
|
-
โ
Bundle built:
|
|
14
|
+
โ
Bundle built: 7238445 bytes, hash: sha256:57df00cb178cc...
|
|
15
15
|
|
|
16
16
|
๐ฆ Building template: ecommerce
|
|
17
17
|
โ
Source files written to /Users/dylanhobbs/Documents/@kya-os/xmcp-i/.claude/worktrees/kya-os-http/packages/create-mcpi-app/dist/.tmp-bundles/ecommerce
|
|
18
|
-
โ
Bundle built:
|
|
18
|
+
โ
Bundle built: 7227736 bytes, hash: sha256:e31ace48f2753...
|
|
19
19
|
|
|
20
20
|
๐ฆ Building template: mix-station
|
|
21
21
|
โ
Source files written to /Users/dylanhobbs/Documents/@kya-os/xmcp-i/.claude/worktrees/kya-os-http/packages/create-mcpi-app/dist/.tmp-bundles/mix-station
|
|
22
|
-
โ
Bundle built:
|
|
22
|
+
โ
Bundle built: 7240829 bytes, hash: sha256:873a503de7a07...
|
|
23
23
|
|
|
24
24
|
โ
All bundles built successfully!
|
|
25
25
|
Output: /Users/dylanhobbs/Documents/@kya-os/xmcp-i/.claude/worktrees/kya-os-http/packages/create-mcpi-app/dist/bundles
|
|
26
|
-
Version: 1.10.
|
|
27
|
-
Framework: 1.12.
|
|
26
|
+
Version: 1.10.3
|
|
27
|
+
Framework: 1.12.1
|
|
28
28
|
Templates: blank, hardware-world, ecommerce, mix-station
|
|
29
29
|
Manifest: /Users/dylanhobbs/Documents/@kya-os/xmcp-i/.claude/worktrees/kya-os-http/packages/create-mcpi-app/dist/bundles/manifest.json
|
package/dist/bundles/blank.js
CHANGED
|
@@ -141492,6 +141492,21 @@ var INTERNAL_PICKUP_INFO = "/_internal/pickup/info";
|
|
|
141492
141492
|
|
|
141493
141493
|
// ../mcp-i-cloudflare/dist/delegation-http/anchor-do.js
|
|
141494
141494
|
init_storage_keys();
|
|
141495
|
+
function anchorSnapshot(rec) {
|
|
141496
|
+
return {
|
|
141497
|
+
sid: rec.sid,
|
|
141498
|
+
status: rec.status,
|
|
141499
|
+
requiredScopes: rec.requiredScopes,
|
|
141500
|
+
minAssurance: rec.minAssurance,
|
|
141501
|
+
expiresAt: rec.expiresAt,
|
|
141502
|
+
createdAt: rec.createdAt,
|
|
141503
|
+
registeredAtMs: rec.registeredAtMs,
|
|
141504
|
+
issuedAtMs: rec.issuedAtMs,
|
|
141505
|
+
agentDid: rec.agentDid,
|
|
141506
|
+
audience: rec.audience,
|
|
141507
|
+
serverDid: rec.serverDid
|
|
141508
|
+
};
|
|
141509
|
+
}
|
|
141495
141510
|
var pendingBody = () => ({ status: "pending" });
|
|
141496
141511
|
var pinnedErr = () => ({ error: KYAOS_ERRORS.pickupPinned });
|
|
141497
141512
|
var invalidSessionErr = () => ({ error: KYAOS_ERRORS.invalidSession });
|
|
@@ -141499,7 +141514,12 @@ var pickupExpiredErr = () => ({ error: KYAOS_ERRORS.pickupExpired });
|
|
|
141499
141514
|
function reduceCreate(rec, input, now2) {
|
|
141500
141515
|
const i2 = input;
|
|
141501
141516
|
if (rec && now2 <= rec.expiresAt) {
|
|
141502
|
-
return {
|
|
141517
|
+
return {
|
|
141518
|
+
response: {
|
|
141519
|
+
status: 201,
|
|
141520
|
+
body: { success: true, reused: true, anchor: anchorSnapshot(rec) }
|
|
141521
|
+
}
|
|
141522
|
+
};
|
|
141503
141523
|
}
|
|
141504
141524
|
const record4 = {
|
|
141505
141525
|
sid: i2.sid,
|
|
@@ -141512,6 +141532,8 @@ function reduceCreate(rec, input, now2) {
|
|
|
141512
141532
|
agentDid: typeof i2.agentDid === "string" ? i2.agentDid : void 0,
|
|
141513
141533
|
audience: typeof i2.audience === "string" ? i2.audience : void 0,
|
|
141514
141534
|
serverDid: typeof i2.serverDid === "string" ? i2.serverDid : void 0,
|
|
141535
|
+
registeredAtMs: typeof i2.registeredAtMs === "number" ? i2.registeredAtMs : void 0,
|
|
141536
|
+
issuedAtMs: now2,
|
|
141515
141537
|
pin: i2.pin ? {
|
|
141516
141538
|
type: i2.pin.type,
|
|
141517
141539
|
valueSha256: i2.pin.valueSha256,
|
|
@@ -141519,7 +141541,13 @@ function reduceCreate(rec, input, now2) {
|
|
|
141519
141541
|
source: "challenge"
|
|
141520
141542
|
} : void 0
|
|
141521
141543
|
};
|
|
141522
|
-
return {
|
|
141544
|
+
return {
|
|
141545
|
+
record: record4,
|
|
141546
|
+
response: {
|
|
141547
|
+
status: 201,
|
|
141548
|
+
body: { success: true, anchor: anchorSnapshot(record4) }
|
|
141549
|
+
}
|
|
141550
|
+
};
|
|
141523
141551
|
}
|
|
141524
141552
|
function reducePoll(rec, holder, now2) {
|
|
141525
141553
|
if (!rec) {
|
|
@@ -141663,7 +141691,7 @@ async function handlePickupInternal(ctx, request, now2) {
|
|
|
141663
141691
|
// ../mcp-i-cloudflare/package.json
|
|
141664
141692
|
var package_default = {
|
|
141665
141693
|
name: "@kya-os/mcp-i-cloudflare",
|
|
141666
|
-
version: "1.12.
|
|
141694
|
+
version: "1.12.1",
|
|
141667
141695
|
description: "Cloudflare Workers adapter for MCP-I framework",
|
|
141668
141696
|
main: "dist/index.js",
|
|
141669
141697
|
types: "dist/index.d.ts",
|
|
@@ -141881,6 +141909,16 @@ function registrationRateLimited(now2) {
|
|
|
141881
141909
|
|
|
141882
141910
|
// ../mcp-i-cloudflare/dist/delegation-http/anchor-registration-validate.js
|
|
141883
141911
|
var DID_RE = /^did:(key|web):.+$/;
|
|
141912
|
+
var SYNTHETIC_DETECTED_DID_PREFIX = "did:web:detected:";
|
|
141913
|
+
function didIssueMessage(value) {
|
|
141914
|
+
if (typeof value !== "string" || !DID_RE.test(value)) {
|
|
141915
|
+
return "Invalid DID format. Must be did:key: or did:web:";
|
|
141916
|
+
}
|
|
141917
|
+
if (value.startsWith(SYNTHETIC_DETECTED_DID_PREFIX)) {
|
|
141918
|
+
return "Synthetic detected DIDs are not valid KYA-OS identities";
|
|
141919
|
+
}
|
|
141920
|
+
return null;
|
|
141921
|
+
}
|
|
141884
141922
|
function isRecord2(value) {
|
|
141885
141923
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
141886
141924
|
}
|
|
@@ -141914,17 +141952,17 @@ function validateChallenge(issues, raw2) {
|
|
|
141914
141952
|
checkOptionalString(issues, "challenge.pep_surface", raw2.pep_surface, 64);
|
|
141915
141953
|
checkOptionalString(issues, "challenge.verdict", raw2.verdict, 64);
|
|
141916
141954
|
checkOptionalString(issues, "challenge.challenge_pin", raw2.challenge_pin, 512);
|
|
141917
|
-
if (raw2.detected_agent_did !== void 0
|
|
141918
|
-
|
|
141919
|
-
|
|
141920
|
-
|
|
141921
|
-
}
|
|
141955
|
+
if (raw2.detected_agent_did !== void 0) {
|
|
141956
|
+
const issue4 = didIssueMessage(raw2.detected_agent_did);
|
|
141957
|
+
if (issue4) {
|
|
141958
|
+
issues.push({ path: "challenge.detected_agent_did", message: issue4 });
|
|
141959
|
+
}
|
|
141922
141960
|
}
|
|
141923
|
-
if (raw2.audience !== void 0
|
|
141924
|
-
|
|
141925
|
-
|
|
141926
|
-
|
|
141927
|
-
}
|
|
141961
|
+
if (raw2.audience !== void 0) {
|
|
141962
|
+
const issue4 = didIssueMessage(raw2.audience);
|
|
141963
|
+
if (issue4) {
|
|
141964
|
+
issues.push({ path: "challenge.audience", message: issue4 });
|
|
141965
|
+
}
|
|
141928
141966
|
}
|
|
141929
141967
|
if (issues.length > issuesBefore)
|
|
141930
141968
|
return void 0;
|
|
@@ -141946,17 +141984,21 @@ function validateRegistrationBody(raw2) {
|
|
|
141946
141984
|
}
|
|
141947
141985
|
const issues = [];
|
|
141948
141986
|
checkString(issues, "session_id", raw2.session_id, 255);
|
|
141949
|
-
|
|
141987
|
+
{
|
|
141988
|
+
const issue4 = didIssueMessage(raw2.agent_did);
|
|
141989
|
+
if (issue4)
|
|
141990
|
+
issues.push({ path: "agent_did", message: issue4 });
|
|
141991
|
+
}
|
|
141992
|
+
if (typeof raw2.project_id !== "string" || raw2.project_id.length < 1) {
|
|
141950
141993
|
issues.push({
|
|
141951
|
-
path: "
|
|
141952
|
-
message: "
|
|
141994
|
+
path: "project_id",
|
|
141995
|
+
message: "project_id must be a non-empty string"
|
|
141953
141996
|
});
|
|
141954
141997
|
}
|
|
141955
|
-
|
|
141956
|
-
if (typeof raw2.created_at !== "number" || !Number.isInteger(raw2.created_at) || raw2.created_at <= 0) {
|
|
141998
|
+
if (typeof raw2.created_at !== "number" || !Number.isInteger(raw2.created_at) || raw2.created_at <= 0 || raw2.created_at > 864e13) {
|
|
141957
141999
|
issues.push({
|
|
141958
142000
|
path: "created_at",
|
|
141959
|
-
message: "created_at must be a positive unix-ms integer"
|
|
142001
|
+
message: "created_at must be a valid positive unix-ms integer"
|
|
141960
142002
|
});
|
|
141961
142003
|
}
|
|
141962
142004
|
const clientInfo = raw2.client_info;
|
|
@@ -141969,11 +142011,10 @@ function validateRegistrationBody(raw2) {
|
|
|
141969
142011
|
checkString(issues, "client_info.name", clientInfo.name, 255);
|
|
141970
142012
|
checkOptionalString(issues, "client_info.version", clientInfo.version, 50);
|
|
141971
142013
|
}
|
|
141972
|
-
if (raw2.server_did !== void 0
|
|
141973
|
-
|
|
141974
|
-
|
|
141975
|
-
|
|
141976
|
-
});
|
|
142014
|
+
if (raw2.server_did !== void 0) {
|
|
142015
|
+
const issue4 = didIssueMessage(raw2.server_did);
|
|
142016
|
+
if (issue4)
|
|
142017
|
+
issues.push({ path: "server_did", message: issue4 });
|
|
141977
142018
|
}
|
|
141978
142019
|
const challenge = validateChallenge(issues, raw2.challenge);
|
|
141979
142020
|
if (raw2.challenge !== void 0 && typeof raw2.session_id === "string" && raw2.session_id.length < 22) {
|
|
@@ -142002,7 +142043,10 @@ function validateRegistrationBody(raw2) {
|
|
|
142002
142043
|
// ../mcp-i-cloudflare/dist/delegation-http/anchor-registration.js
|
|
142003
142044
|
var DO_INTERNAL_ORIGIN = "https://do.internal";
|
|
142004
142045
|
function isAnchorRegistrationEnabled(cfg, env2) {
|
|
142005
|
-
return cfg !== null && cfg.remoteAnchorRegistration && typeof env2.AGENTSHIELD_API_KEY === "string" && env2.AGENTSHIELD_API_KEY.length > 0
|
|
142046
|
+
return cfg !== null && cfg.remoteAnchorRegistration && typeof env2.AGENTSHIELD_API_KEY === "string" && env2.AGENTSHIELD_API_KEY.length > 0 && // No anchor store, no registration surface: getAnchorStub throws on an
|
|
142047
|
+
// unbound MCP_OBJECT, so an unbound deployment must 404 like every other
|
|
142048
|
+
// unprovisioned state instead of 500ing per request.
|
|
142049
|
+
env2.MCP_OBJECT !== void 0;
|
|
142006
142050
|
}
|
|
142007
142051
|
function deriveRegistrationSid(sessionId) {
|
|
142008
142052
|
if (isAnchorSid(sessionId))
|
|
@@ -142032,41 +142076,37 @@ async function callAnchor(env2, deps, sid, internalPath, body) {
|
|
|
142032
142076
|
}
|
|
142033
142077
|
async function ensureAnchor(env2, cfg, deps, sid, challenge, session) {
|
|
142034
142078
|
const pin = challenge.challengePin && cfg.allowUnverifiedKeyidHolders ? { type: "keyid", valueSha256: sha256Hex(challenge.challengePin) } : void 0;
|
|
142035
|
-
const
|
|
142036
|
-
|
|
142037
|
-
|
|
142038
|
-
|
|
142039
|
-
|
|
142040
|
-
delegationExpiresInS: cfg.delegationExpiresInS,
|
|
142041
|
-
agentDid: challenge.detectedAgentDid ?? session.agentDid,
|
|
142042
|
-
// Cross-resource claim inputs (drive the minted VC's aud / server_did โ
|
|
142043
|
-
// see consent-anchor-bridge's withCrossResourceClaims).
|
|
142044
|
-
...challenge.audience ? { audience: challenge.audience } : {},
|
|
142045
|
-
...session.serverDid ? { serverDid: session.serverDid } : {},
|
|
142046
|
-
...pin ? { pin } : {}
|
|
142047
|
-
});
|
|
142048
|
-
if (created.status !== 201) {
|
|
142049
|
-
return {
|
|
142050
|
-
error: errorResponse(502, "anchor_unavailable", "The anchor store did not accept the registration")
|
|
142051
|
-
};
|
|
142052
|
-
}
|
|
142053
|
-
let reused = false;
|
|
142079
|
+
const anchorUnavailable = {
|
|
142080
|
+
error: errorResponse(502, "anchor_unavailable", "The anchor store did not accept the registration")
|
|
142081
|
+
};
|
|
142082
|
+
let created;
|
|
142083
|
+
let body;
|
|
142054
142084
|
try {
|
|
142055
|
-
|
|
142056
|
-
|
|
142085
|
+
created = await callAnchor(env2, deps, sid, INTERNAL_PICKUP_CREATE, {
|
|
142086
|
+
sid,
|
|
142087
|
+
requiredScopes: challenge.requiredScopes,
|
|
142088
|
+
pollIntervalS: cfg.pollIntervalS,
|
|
142089
|
+
anchorTtlS: cfg.anchorTtlS,
|
|
142090
|
+
delegationExpiresInS: cfg.delegationExpiresInS,
|
|
142091
|
+
agentDid: challenge.detectedAgentDid ?? session.agentDid,
|
|
142092
|
+
registeredAtMs: session.registeredAtMs,
|
|
142093
|
+
// Cross-resource claim inputs (drive the minted VC's aud / server_did โ
|
|
142094
|
+
// see consent-anchor-bridge's withCrossResourceClaims).
|
|
142095
|
+
...challenge.audience ? { audience: challenge.audience } : {},
|
|
142096
|
+
...session.serverDid ? { serverDid: session.serverDid } : {},
|
|
142097
|
+
...pin ? { pin } : {}
|
|
142098
|
+
});
|
|
142099
|
+
if (created.status !== 201)
|
|
142100
|
+
return anchorUnavailable;
|
|
142101
|
+
body = await created.json();
|
|
142102
|
+
} catch (error87) {
|
|
142103
|
+
console.warn(`[kya-http] anchor create failed (sid=${sid}):`, error87 instanceof Error ? error87.message : String(error87));
|
|
142104
|
+
return anchorUnavailable;
|
|
142057
142105
|
}
|
|
142058
|
-
|
|
142059
|
-
|
|
142060
|
-
});
|
|
142061
|
-
if (readBack.status !== 200) {
|
|
142062
|
-
return {
|
|
142063
|
-
error: errorResponse(502, "anchor_unavailable", "The registered anchor could not be read back")
|
|
142064
|
-
};
|
|
142106
|
+
if (!body.anchor || !Array.isArray(body.anchor.requiredScopes)) {
|
|
142107
|
+
return anchorUnavailable;
|
|
142065
142108
|
}
|
|
142066
|
-
return {
|
|
142067
|
-
isNew: !reused,
|
|
142068
|
-
snapshot: await readBack.json()
|
|
142069
|
-
};
|
|
142109
|
+
return { isNew: body.reused !== true, snapshot: body.anchor };
|
|
142070
142110
|
}
|
|
142071
142111
|
async function handleAnchorRegistration(c, env2, cfg, deps) {
|
|
142072
142112
|
if (!registrarAuthorized(env2, c.req.header("Authorization"))) {
|
|
@@ -142092,9 +142132,13 @@ async function handleAnchorRegistration(c, env2, cfg, deps) {
|
|
|
142092
142132
|
return errorResponse(401, "unauthorized", "This endpoint only accepts challenge registration");
|
|
142093
142133
|
}
|
|
142094
142134
|
const sid = deriveRegistrationSid(validated.input.sessionId);
|
|
142135
|
+
if (!challenge.audience) {
|
|
142136
|
+
console.warn(`[kya-http] external registration without challenge.audience (sid=${sid}): the minted credential will FAIL an org-pinned \xA74.3 audience gate; cross-resource use requires the registrar to send challenge.audience`);
|
|
142137
|
+
}
|
|
142095
142138
|
const anchor = await ensureAnchor(env2, cfg, deps, sid, challenge, {
|
|
142096
142139
|
agentDid: validated.input.agentDid,
|
|
142097
|
-
serverDid: validated.input.serverDid
|
|
142140
|
+
serverDid: validated.input.serverDid,
|
|
142141
|
+
registeredAtMs: validated.input.createdAt
|
|
142098
142142
|
});
|
|
142099
142143
|
if ("error" in anchor)
|
|
142100
142144
|
return anchor.error;
|
|
@@ -142118,17 +142162,24 @@ async function handleAnchorRegistration(c, env2, cfg, deps) {
|
|
|
142118
142162
|
console.warn(`[kya-http] registration challenge_proof signing failed (sid=${sid}):`, error87 instanceof Error ? error87.message : String(error87));
|
|
142119
142163
|
return errorResponse(502, "proof_unavailable", "The challenge proof could not be signed");
|
|
142120
142164
|
}
|
|
142165
|
+
const createdAtMs = anchor.snapshot.registeredAtMs ?? validated.input.createdAt;
|
|
142166
|
+
const issuedAtMs = anchor.snapshot.issuedAtMs ?? Date.now();
|
|
142121
142167
|
return new Response(JSON.stringify({
|
|
142122
142168
|
success: true,
|
|
142123
142169
|
data: {
|
|
142124
142170
|
session_id: sid,
|
|
142125
142171
|
registered: true,
|
|
142126
|
-
created_at: new Date(
|
|
142172
|
+
created_at: new Date(createdAtMs).toISOString(),
|
|
142127
142173
|
challenge: {
|
|
142128
142174
|
consent_uri: consentUri,
|
|
142129
142175
|
challenge_proof: challengeProof,
|
|
142130
142176
|
required_scopes: anchor.snapshot.requiredScopes,
|
|
142131
|
-
issued_at:
|
|
142177
|
+
issued_at: issuedAtMs,
|
|
142178
|
+
// ADDITIVE diagnostic (not in the frozen conformance key set, ignored
|
|
142179
|
+
// by both existing parsers): whether the minted credential will carry
|
|
142180
|
+
// the ยง4.3 cross-resource claims. False means no audience was
|
|
142181
|
+
// registered โ the credential only self-verifies at this worker.
|
|
142182
|
+
cross_resource: typeof anchor.snapshot.audience === "string"
|
|
142132
142183
|
}
|
|
142133
142184
|
}
|
|
142134
142185
|
}), {
|
|
@@ -147549,7 +147600,11 @@ async function mintDelegationVcJwt(env2, sid, info, expiresInS) {
|
|
|
147549
147600
|
constraints: {
|
|
147550
147601
|
scopes: info.requiredScopes,
|
|
147551
147602
|
notBefore: nowS,
|
|
147552
|
-
notAfter: nowS + expiresInS
|
|
147603
|
+
notAfter: nowS + expiresInS,
|
|
147604
|
+
// ยง11.7 outer===inner audience invariant (checkpoint's own mints bind the
|
|
147605
|
+
// audience in BOTH the JWT aud and constraints.audience): set the inner
|
|
147606
|
+
// half for cross-resource anchors so verifiers reading either slot agree.
|
|
147607
|
+
...info.audience ? { audience: info.audience } : {}
|
|
147553
147608
|
},
|
|
147554
147609
|
signature: "",
|
|
147555
147610
|
status: "active",
|
|
@@ -141492,6 +141492,21 @@ var INTERNAL_PICKUP_INFO = "/_internal/pickup/info";
|
|
|
141492
141492
|
|
|
141493
141493
|
// ../mcp-i-cloudflare/dist/delegation-http/anchor-do.js
|
|
141494
141494
|
init_storage_keys();
|
|
141495
|
+
function anchorSnapshot(rec) {
|
|
141496
|
+
return {
|
|
141497
|
+
sid: rec.sid,
|
|
141498
|
+
status: rec.status,
|
|
141499
|
+
requiredScopes: rec.requiredScopes,
|
|
141500
|
+
minAssurance: rec.minAssurance,
|
|
141501
|
+
expiresAt: rec.expiresAt,
|
|
141502
|
+
createdAt: rec.createdAt,
|
|
141503
|
+
registeredAtMs: rec.registeredAtMs,
|
|
141504
|
+
issuedAtMs: rec.issuedAtMs,
|
|
141505
|
+
agentDid: rec.agentDid,
|
|
141506
|
+
audience: rec.audience,
|
|
141507
|
+
serverDid: rec.serverDid
|
|
141508
|
+
};
|
|
141509
|
+
}
|
|
141495
141510
|
var pendingBody = () => ({ status: "pending" });
|
|
141496
141511
|
var pinnedErr = () => ({ error: KYAOS_ERRORS.pickupPinned });
|
|
141497
141512
|
var invalidSessionErr = () => ({ error: KYAOS_ERRORS.invalidSession });
|
|
@@ -141499,7 +141514,12 @@ var pickupExpiredErr = () => ({ error: KYAOS_ERRORS.pickupExpired });
|
|
|
141499
141514
|
function reduceCreate(rec, input, now2) {
|
|
141500
141515
|
const i2 = input;
|
|
141501
141516
|
if (rec && now2 <= rec.expiresAt) {
|
|
141502
|
-
return {
|
|
141517
|
+
return {
|
|
141518
|
+
response: {
|
|
141519
|
+
status: 201,
|
|
141520
|
+
body: { success: true, reused: true, anchor: anchorSnapshot(rec) }
|
|
141521
|
+
}
|
|
141522
|
+
};
|
|
141503
141523
|
}
|
|
141504
141524
|
const record4 = {
|
|
141505
141525
|
sid: i2.sid,
|
|
@@ -141512,6 +141532,8 @@ function reduceCreate(rec, input, now2) {
|
|
|
141512
141532
|
agentDid: typeof i2.agentDid === "string" ? i2.agentDid : void 0,
|
|
141513
141533
|
audience: typeof i2.audience === "string" ? i2.audience : void 0,
|
|
141514
141534
|
serverDid: typeof i2.serverDid === "string" ? i2.serverDid : void 0,
|
|
141535
|
+
registeredAtMs: typeof i2.registeredAtMs === "number" ? i2.registeredAtMs : void 0,
|
|
141536
|
+
issuedAtMs: now2,
|
|
141515
141537
|
pin: i2.pin ? {
|
|
141516
141538
|
type: i2.pin.type,
|
|
141517
141539
|
valueSha256: i2.pin.valueSha256,
|
|
@@ -141519,7 +141541,13 @@ function reduceCreate(rec, input, now2) {
|
|
|
141519
141541
|
source: "challenge"
|
|
141520
141542
|
} : void 0
|
|
141521
141543
|
};
|
|
141522
|
-
return {
|
|
141544
|
+
return {
|
|
141545
|
+
record: record4,
|
|
141546
|
+
response: {
|
|
141547
|
+
status: 201,
|
|
141548
|
+
body: { success: true, anchor: anchorSnapshot(record4) }
|
|
141549
|
+
}
|
|
141550
|
+
};
|
|
141523
141551
|
}
|
|
141524
141552
|
function reducePoll(rec, holder, now2) {
|
|
141525
141553
|
if (!rec) {
|
|
@@ -141663,7 +141691,7 @@ async function handlePickupInternal(ctx, request, now2) {
|
|
|
141663
141691
|
// ../mcp-i-cloudflare/package.json
|
|
141664
141692
|
var package_default = {
|
|
141665
141693
|
name: "@kya-os/mcp-i-cloudflare",
|
|
141666
|
-
version: "1.12.
|
|
141694
|
+
version: "1.12.1",
|
|
141667
141695
|
description: "Cloudflare Workers adapter for MCP-I framework",
|
|
141668
141696
|
main: "dist/index.js",
|
|
141669
141697
|
types: "dist/index.d.ts",
|
|
@@ -141881,6 +141909,16 @@ function registrationRateLimited(now2) {
|
|
|
141881
141909
|
|
|
141882
141910
|
// ../mcp-i-cloudflare/dist/delegation-http/anchor-registration-validate.js
|
|
141883
141911
|
var DID_RE = /^did:(key|web):.+$/;
|
|
141912
|
+
var SYNTHETIC_DETECTED_DID_PREFIX = "did:web:detected:";
|
|
141913
|
+
function didIssueMessage(value) {
|
|
141914
|
+
if (typeof value !== "string" || !DID_RE.test(value)) {
|
|
141915
|
+
return "Invalid DID format. Must be did:key: or did:web:";
|
|
141916
|
+
}
|
|
141917
|
+
if (value.startsWith(SYNTHETIC_DETECTED_DID_PREFIX)) {
|
|
141918
|
+
return "Synthetic detected DIDs are not valid KYA-OS identities";
|
|
141919
|
+
}
|
|
141920
|
+
return null;
|
|
141921
|
+
}
|
|
141884
141922
|
function isRecord2(value) {
|
|
141885
141923
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
141886
141924
|
}
|
|
@@ -141914,17 +141952,17 @@ function validateChallenge(issues, raw2) {
|
|
|
141914
141952
|
checkOptionalString(issues, "challenge.pep_surface", raw2.pep_surface, 64);
|
|
141915
141953
|
checkOptionalString(issues, "challenge.verdict", raw2.verdict, 64);
|
|
141916
141954
|
checkOptionalString(issues, "challenge.challenge_pin", raw2.challenge_pin, 512);
|
|
141917
|
-
if (raw2.detected_agent_did !== void 0
|
|
141918
|
-
|
|
141919
|
-
|
|
141920
|
-
|
|
141921
|
-
}
|
|
141955
|
+
if (raw2.detected_agent_did !== void 0) {
|
|
141956
|
+
const issue4 = didIssueMessage(raw2.detected_agent_did);
|
|
141957
|
+
if (issue4) {
|
|
141958
|
+
issues.push({ path: "challenge.detected_agent_did", message: issue4 });
|
|
141959
|
+
}
|
|
141922
141960
|
}
|
|
141923
|
-
if (raw2.audience !== void 0
|
|
141924
|
-
|
|
141925
|
-
|
|
141926
|
-
|
|
141927
|
-
}
|
|
141961
|
+
if (raw2.audience !== void 0) {
|
|
141962
|
+
const issue4 = didIssueMessage(raw2.audience);
|
|
141963
|
+
if (issue4) {
|
|
141964
|
+
issues.push({ path: "challenge.audience", message: issue4 });
|
|
141965
|
+
}
|
|
141928
141966
|
}
|
|
141929
141967
|
if (issues.length > issuesBefore)
|
|
141930
141968
|
return void 0;
|
|
@@ -141946,17 +141984,21 @@ function validateRegistrationBody(raw2) {
|
|
|
141946
141984
|
}
|
|
141947
141985
|
const issues = [];
|
|
141948
141986
|
checkString(issues, "session_id", raw2.session_id, 255);
|
|
141949
|
-
|
|
141987
|
+
{
|
|
141988
|
+
const issue4 = didIssueMessage(raw2.agent_did);
|
|
141989
|
+
if (issue4)
|
|
141990
|
+
issues.push({ path: "agent_did", message: issue4 });
|
|
141991
|
+
}
|
|
141992
|
+
if (typeof raw2.project_id !== "string" || raw2.project_id.length < 1) {
|
|
141950
141993
|
issues.push({
|
|
141951
|
-
path: "
|
|
141952
|
-
message: "
|
|
141994
|
+
path: "project_id",
|
|
141995
|
+
message: "project_id must be a non-empty string"
|
|
141953
141996
|
});
|
|
141954
141997
|
}
|
|
141955
|
-
|
|
141956
|
-
if (typeof raw2.created_at !== "number" || !Number.isInteger(raw2.created_at) || raw2.created_at <= 0) {
|
|
141998
|
+
if (typeof raw2.created_at !== "number" || !Number.isInteger(raw2.created_at) || raw2.created_at <= 0 || raw2.created_at > 864e13) {
|
|
141957
141999
|
issues.push({
|
|
141958
142000
|
path: "created_at",
|
|
141959
|
-
message: "created_at must be a positive unix-ms integer"
|
|
142001
|
+
message: "created_at must be a valid positive unix-ms integer"
|
|
141960
142002
|
});
|
|
141961
142003
|
}
|
|
141962
142004
|
const clientInfo = raw2.client_info;
|
|
@@ -141969,11 +142011,10 @@ function validateRegistrationBody(raw2) {
|
|
|
141969
142011
|
checkString(issues, "client_info.name", clientInfo.name, 255);
|
|
141970
142012
|
checkOptionalString(issues, "client_info.version", clientInfo.version, 50);
|
|
141971
142013
|
}
|
|
141972
|
-
if (raw2.server_did !== void 0
|
|
141973
|
-
|
|
141974
|
-
|
|
141975
|
-
|
|
141976
|
-
});
|
|
142014
|
+
if (raw2.server_did !== void 0) {
|
|
142015
|
+
const issue4 = didIssueMessage(raw2.server_did);
|
|
142016
|
+
if (issue4)
|
|
142017
|
+
issues.push({ path: "server_did", message: issue4 });
|
|
141977
142018
|
}
|
|
141978
142019
|
const challenge = validateChallenge(issues, raw2.challenge);
|
|
141979
142020
|
if (raw2.challenge !== void 0 && typeof raw2.session_id === "string" && raw2.session_id.length < 22) {
|
|
@@ -142002,7 +142043,10 @@ function validateRegistrationBody(raw2) {
|
|
|
142002
142043
|
// ../mcp-i-cloudflare/dist/delegation-http/anchor-registration.js
|
|
142003
142044
|
var DO_INTERNAL_ORIGIN = "https://do.internal";
|
|
142004
142045
|
function isAnchorRegistrationEnabled(cfg, env2) {
|
|
142005
|
-
return cfg !== null && cfg.remoteAnchorRegistration && typeof env2.AGENTSHIELD_API_KEY === "string" && env2.AGENTSHIELD_API_KEY.length > 0
|
|
142046
|
+
return cfg !== null && cfg.remoteAnchorRegistration && typeof env2.AGENTSHIELD_API_KEY === "string" && env2.AGENTSHIELD_API_KEY.length > 0 && // No anchor store, no registration surface: getAnchorStub throws on an
|
|
142047
|
+
// unbound MCP_OBJECT, so an unbound deployment must 404 like every other
|
|
142048
|
+
// unprovisioned state instead of 500ing per request.
|
|
142049
|
+
env2.MCP_OBJECT !== void 0;
|
|
142006
142050
|
}
|
|
142007
142051
|
function deriveRegistrationSid(sessionId) {
|
|
142008
142052
|
if (isAnchorSid(sessionId))
|
|
@@ -142032,41 +142076,37 @@ async function callAnchor(env2, deps, sid, internalPath, body) {
|
|
|
142032
142076
|
}
|
|
142033
142077
|
async function ensureAnchor(env2, cfg, deps, sid, challenge, session) {
|
|
142034
142078
|
const pin = challenge.challengePin && cfg.allowUnverifiedKeyidHolders ? { type: "keyid", valueSha256: sha256Hex(challenge.challengePin) } : void 0;
|
|
142035
|
-
const
|
|
142036
|
-
|
|
142037
|
-
|
|
142038
|
-
|
|
142039
|
-
|
|
142040
|
-
delegationExpiresInS: cfg.delegationExpiresInS,
|
|
142041
|
-
agentDid: challenge.detectedAgentDid ?? session.agentDid,
|
|
142042
|
-
// Cross-resource claim inputs (drive the minted VC's aud / server_did โ
|
|
142043
|
-
// see consent-anchor-bridge's withCrossResourceClaims).
|
|
142044
|
-
...challenge.audience ? { audience: challenge.audience } : {},
|
|
142045
|
-
...session.serverDid ? { serverDid: session.serverDid } : {},
|
|
142046
|
-
...pin ? { pin } : {}
|
|
142047
|
-
});
|
|
142048
|
-
if (created.status !== 201) {
|
|
142049
|
-
return {
|
|
142050
|
-
error: errorResponse(502, "anchor_unavailable", "The anchor store did not accept the registration")
|
|
142051
|
-
};
|
|
142052
|
-
}
|
|
142053
|
-
let reused = false;
|
|
142079
|
+
const anchorUnavailable = {
|
|
142080
|
+
error: errorResponse(502, "anchor_unavailable", "The anchor store did not accept the registration")
|
|
142081
|
+
};
|
|
142082
|
+
let created;
|
|
142083
|
+
let body;
|
|
142054
142084
|
try {
|
|
142055
|
-
|
|
142056
|
-
|
|
142085
|
+
created = await callAnchor(env2, deps, sid, INTERNAL_PICKUP_CREATE, {
|
|
142086
|
+
sid,
|
|
142087
|
+
requiredScopes: challenge.requiredScopes,
|
|
142088
|
+
pollIntervalS: cfg.pollIntervalS,
|
|
142089
|
+
anchorTtlS: cfg.anchorTtlS,
|
|
142090
|
+
delegationExpiresInS: cfg.delegationExpiresInS,
|
|
142091
|
+
agentDid: challenge.detectedAgentDid ?? session.agentDid,
|
|
142092
|
+
registeredAtMs: session.registeredAtMs,
|
|
142093
|
+
// Cross-resource claim inputs (drive the minted VC's aud / server_did โ
|
|
142094
|
+
// see consent-anchor-bridge's withCrossResourceClaims).
|
|
142095
|
+
...challenge.audience ? { audience: challenge.audience } : {},
|
|
142096
|
+
...session.serverDid ? { serverDid: session.serverDid } : {},
|
|
142097
|
+
...pin ? { pin } : {}
|
|
142098
|
+
});
|
|
142099
|
+
if (created.status !== 201)
|
|
142100
|
+
return anchorUnavailable;
|
|
142101
|
+
body = await created.json();
|
|
142102
|
+
} catch (error87) {
|
|
142103
|
+
console.warn(`[kya-http] anchor create failed (sid=${sid}):`, error87 instanceof Error ? error87.message : String(error87));
|
|
142104
|
+
return anchorUnavailable;
|
|
142057
142105
|
}
|
|
142058
|
-
|
|
142059
|
-
|
|
142060
|
-
});
|
|
142061
|
-
if (readBack.status !== 200) {
|
|
142062
|
-
return {
|
|
142063
|
-
error: errorResponse(502, "anchor_unavailable", "The registered anchor could not be read back")
|
|
142064
|
-
};
|
|
142106
|
+
if (!body.anchor || !Array.isArray(body.anchor.requiredScopes)) {
|
|
142107
|
+
return anchorUnavailable;
|
|
142065
142108
|
}
|
|
142066
|
-
return {
|
|
142067
|
-
isNew: !reused,
|
|
142068
|
-
snapshot: await readBack.json()
|
|
142069
|
-
};
|
|
142109
|
+
return { isNew: body.reused !== true, snapshot: body.anchor };
|
|
142070
142110
|
}
|
|
142071
142111
|
async function handleAnchorRegistration(c, env2, cfg, deps) {
|
|
142072
142112
|
if (!registrarAuthorized(env2, c.req.header("Authorization"))) {
|
|
@@ -142092,9 +142132,13 @@ async function handleAnchorRegistration(c, env2, cfg, deps) {
|
|
|
142092
142132
|
return errorResponse(401, "unauthorized", "This endpoint only accepts challenge registration");
|
|
142093
142133
|
}
|
|
142094
142134
|
const sid = deriveRegistrationSid(validated.input.sessionId);
|
|
142135
|
+
if (!challenge.audience) {
|
|
142136
|
+
console.warn(`[kya-http] external registration without challenge.audience (sid=${sid}): the minted credential will FAIL an org-pinned \xA74.3 audience gate; cross-resource use requires the registrar to send challenge.audience`);
|
|
142137
|
+
}
|
|
142095
142138
|
const anchor = await ensureAnchor(env2, cfg, deps, sid, challenge, {
|
|
142096
142139
|
agentDid: validated.input.agentDid,
|
|
142097
|
-
serverDid: validated.input.serverDid
|
|
142140
|
+
serverDid: validated.input.serverDid,
|
|
142141
|
+
registeredAtMs: validated.input.createdAt
|
|
142098
142142
|
});
|
|
142099
142143
|
if ("error" in anchor)
|
|
142100
142144
|
return anchor.error;
|
|
@@ -142118,17 +142162,24 @@ async function handleAnchorRegistration(c, env2, cfg, deps) {
|
|
|
142118
142162
|
console.warn(`[kya-http] registration challenge_proof signing failed (sid=${sid}):`, error87 instanceof Error ? error87.message : String(error87));
|
|
142119
142163
|
return errorResponse(502, "proof_unavailable", "The challenge proof could not be signed");
|
|
142120
142164
|
}
|
|
142165
|
+
const createdAtMs = anchor.snapshot.registeredAtMs ?? validated.input.createdAt;
|
|
142166
|
+
const issuedAtMs = anchor.snapshot.issuedAtMs ?? Date.now();
|
|
142121
142167
|
return new Response(JSON.stringify({
|
|
142122
142168
|
success: true,
|
|
142123
142169
|
data: {
|
|
142124
142170
|
session_id: sid,
|
|
142125
142171
|
registered: true,
|
|
142126
|
-
created_at: new Date(
|
|
142172
|
+
created_at: new Date(createdAtMs).toISOString(),
|
|
142127
142173
|
challenge: {
|
|
142128
142174
|
consent_uri: consentUri,
|
|
142129
142175
|
challenge_proof: challengeProof,
|
|
142130
142176
|
required_scopes: anchor.snapshot.requiredScopes,
|
|
142131
|
-
issued_at:
|
|
142177
|
+
issued_at: issuedAtMs,
|
|
142178
|
+
// ADDITIVE diagnostic (not in the frozen conformance key set, ignored
|
|
142179
|
+
// by both existing parsers): whether the minted credential will carry
|
|
142180
|
+
// the ยง4.3 cross-resource claims. False means no audience was
|
|
142181
|
+
// registered โ the credential only self-verifies at this worker.
|
|
142182
|
+
cross_resource: typeof anchor.snapshot.audience === "string"
|
|
142132
142183
|
}
|
|
142133
142184
|
}
|
|
142134
142185
|
}), {
|
|
@@ -147549,7 +147600,11 @@ async function mintDelegationVcJwt(env2, sid, info, expiresInS) {
|
|
|
147549
147600
|
constraints: {
|
|
147550
147601
|
scopes: info.requiredScopes,
|
|
147551
147602
|
notBefore: nowS,
|
|
147552
|
-
notAfter: nowS + expiresInS
|
|
147603
|
+
notAfter: nowS + expiresInS,
|
|
147604
|
+
// ยง11.7 outer===inner audience invariant (checkpoint's own mints bind the
|
|
147605
|
+
// audience in BOTH the JWT aud and constraints.audience): set the inner
|
|
147606
|
+
// half for cross-resource anchors so verifiers reading either slot agree.
|
|
147607
|
+
...info.audience ? { audience: info.audience } : {}
|
|
147553
147608
|
},
|
|
147554
147609
|
signature: "",
|
|
147555
147610
|
status: "active",
|
|
@@ -141492,6 +141492,21 @@ var INTERNAL_PICKUP_INFO = "/_internal/pickup/info";
|
|
|
141492
141492
|
|
|
141493
141493
|
// ../mcp-i-cloudflare/dist/delegation-http/anchor-do.js
|
|
141494
141494
|
init_storage_keys();
|
|
141495
|
+
function anchorSnapshot(rec) {
|
|
141496
|
+
return {
|
|
141497
|
+
sid: rec.sid,
|
|
141498
|
+
status: rec.status,
|
|
141499
|
+
requiredScopes: rec.requiredScopes,
|
|
141500
|
+
minAssurance: rec.minAssurance,
|
|
141501
|
+
expiresAt: rec.expiresAt,
|
|
141502
|
+
createdAt: rec.createdAt,
|
|
141503
|
+
registeredAtMs: rec.registeredAtMs,
|
|
141504
|
+
issuedAtMs: rec.issuedAtMs,
|
|
141505
|
+
agentDid: rec.agentDid,
|
|
141506
|
+
audience: rec.audience,
|
|
141507
|
+
serverDid: rec.serverDid
|
|
141508
|
+
};
|
|
141509
|
+
}
|
|
141495
141510
|
var pendingBody = () => ({ status: "pending" });
|
|
141496
141511
|
var pinnedErr = () => ({ error: KYAOS_ERRORS.pickupPinned });
|
|
141497
141512
|
var invalidSessionErr = () => ({ error: KYAOS_ERRORS.invalidSession });
|
|
@@ -141499,7 +141514,12 @@ var pickupExpiredErr = () => ({ error: KYAOS_ERRORS.pickupExpired });
|
|
|
141499
141514
|
function reduceCreate(rec, input, now2) {
|
|
141500
141515
|
const i2 = input;
|
|
141501
141516
|
if (rec && now2 <= rec.expiresAt) {
|
|
141502
|
-
return {
|
|
141517
|
+
return {
|
|
141518
|
+
response: {
|
|
141519
|
+
status: 201,
|
|
141520
|
+
body: { success: true, reused: true, anchor: anchorSnapshot(rec) }
|
|
141521
|
+
}
|
|
141522
|
+
};
|
|
141503
141523
|
}
|
|
141504
141524
|
const record4 = {
|
|
141505
141525
|
sid: i2.sid,
|
|
@@ -141512,6 +141532,8 @@ function reduceCreate(rec, input, now2) {
|
|
|
141512
141532
|
agentDid: typeof i2.agentDid === "string" ? i2.agentDid : void 0,
|
|
141513
141533
|
audience: typeof i2.audience === "string" ? i2.audience : void 0,
|
|
141514
141534
|
serverDid: typeof i2.serverDid === "string" ? i2.serverDid : void 0,
|
|
141535
|
+
registeredAtMs: typeof i2.registeredAtMs === "number" ? i2.registeredAtMs : void 0,
|
|
141536
|
+
issuedAtMs: now2,
|
|
141515
141537
|
pin: i2.pin ? {
|
|
141516
141538
|
type: i2.pin.type,
|
|
141517
141539
|
valueSha256: i2.pin.valueSha256,
|
|
@@ -141519,7 +141541,13 @@ function reduceCreate(rec, input, now2) {
|
|
|
141519
141541
|
source: "challenge"
|
|
141520
141542
|
} : void 0
|
|
141521
141543
|
};
|
|
141522
|
-
return {
|
|
141544
|
+
return {
|
|
141545
|
+
record: record4,
|
|
141546
|
+
response: {
|
|
141547
|
+
status: 201,
|
|
141548
|
+
body: { success: true, anchor: anchorSnapshot(record4) }
|
|
141549
|
+
}
|
|
141550
|
+
};
|
|
141523
141551
|
}
|
|
141524
141552
|
function reducePoll(rec, holder, now2) {
|
|
141525
141553
|
if (!rec) {
|
|
@@ -141663,7 +141691,7 @@ async function handlePickupInternal(ctx, request, now2) {
|
|
|
141663
141691
|
// ../mcp-i-cloudflare/package.json
|
|
141664
141692
|
var package_default = {
|
|
141665
141693
|
name: "@kya-os/mcp-i-cloudflare",
|
|
141666
|
-
version: "1.12.
|
|
141694
|
+
version: "1.12.1",
|
|
141667
141695
|
description: "Cloudflare Workers adapter for MCP-I framework",
|
|
141668
141696
|
main: "dist/index.js",
|
|
141669
141697
|
types: "dist/index.d.ts",
|
|
@@ -141881,6 +141909,16 @@ function registrationRateLimited(now2) {
|
|
|
141881
141909
|
|
|
141882
141910
|
// ../mcp-i-cloudflare/dist/delegation-http/anchor-registration-validate.js
|
|
141883
141911
|
var DID_RE = /^did:(key|web):.+$/;
|
|
141912
|
+
var SYNTHETIC_DETECTED_DID_PREFIX = "did:web:detected:";
|
|
141913
|
+
function didIssueMessage(value) {
|
|
141914
|
+
if (typeof value !== "string" || !DID_RE.test(value)) {
|
|
141915
|
+
return "Invalid DID format. Must be did:key: or did:web:";
|
|
141916
|
+
}
|
|
141917
|
+
if (value.startsWith(SYNTHETIC_DETECTED_DID_PREFIX)) {
|
|
141918
|
+
return "Synthetic detected DIDs are not valid KYA-OS identities";
|
|
141919
|
+
}
|
|
141920
|
+
return null;
|
|
141921
|
+
}
|
|
141884
141922
|
function isRecord2(value) {
|
|
141885
141923
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
141886
141924
|
}
|
|
@@ -141914,17 +141952,17 @@ function validateChallenge(issues, raw2) {
|
|
|
141914
141952
|
checkOptionalString(issues, "challenge.pep_surface", raw2.pep_surface, 64);
|
|
141915
141953
|
checkOptionalString(issues, "challenge.verdict", raw2.verdict, 64);
|
|
141916
141954
|
checkOptionalString(issues, "challenge.challenge_pin", raw2.challenge_pin, 512);
|
|
141917
|
-
if (raw2.detected_agent_did !== void 0
|
|
141918
|
-
|
|
141919
|
-
|
|
141920
|
-
|
|
141921
|
-
}
|
|
141955
|
+
if (raw2.detected_agent_did !== void 0) {
|
|
141956
|
+
const issue4 = didIssueMessage(raw2.detected_agent_did);
|
|
141957
|
+
if (issue4) {
|
|
141958
|
+
issues.push({ path: "challenge.detected_agent_did", message: issue4 });
|
|
141959
|
+
}
|
|
141922
141960
|
}
|
|
141923
|
-
if (raw2.audience !== void 0
|
|
141924
|
-
|
|
141925
|
-
|
|
141926
|
-
|
|
141927
|
-
}
|
|
141961
|
+
if (raw2.audience !== void 0) {
|
|
141962
|
+
const issue4 = didIssueMessage(raw2.audience);
|
|
141963
|
+
if (issue4) {
|
|
141964
|
+
issues.push({ path: "challenge.audience", message: issue4 });
|
|
141965
|
+
}
|
|
141928
141966
|
}
|
|
141929
141967
|
if (issues.length > issuesBefore)
|
|
141930
141968
|
return void 0;
|
|
@@ -141946,17 +141984,21 @@ function validateRegistrationBody(raw2) {
|
|
|
141946
141984
|
}
|
|
141947
141985
|
const issues = [];
|
|
141948
141986
|
checkString(issues, "session_id", raw2.session_id, 255);
|
|
141949
|
-
|
|
141987
|
+
{
|
|
141988
|
+
const issue4 = didIssueMessage(raw2.agent_did);
|
|
141989
|
+
if (issue4)
|
|
141990
|
+
issues.push({ path: "agent_did", message: issue4 });
|
|
141991
|
+
}
|
|
141992
|
+
if (typeof raw2.project_id !== "string" || raw2.project_id.length < 1) {
|
|
141950
141993
|
issues.push({
|
|
141951
|
-
path: "
|
|
141952
|
-
message: "
|
|
141994
|
+
path: "project_id",
|
|
141995
|
+
message: "project_id must be a non-empty string"
|
|
141953
141996
|
});
|
|
141954
141997
|
}
|
|
141955
|
-
|
|
141956
|
-
if (typeof raw2.created_at !== "number" || !Number.isInteger(raw2.created_at) || raw2.created_at <= 0) {
|
|
141998
|
+
if (typeof raw2.created_at !== "number" || !Number.isInteger(raw2.created_at) || raw2.created_at <= 0 || raw2.created_at > 864e13) {
|
|
141957
141999
|
issues.push({
|
|
141958
142000
|
path: "created_at",
|
|
141959
|
-
message: "created_at must be a positive unix-ms integer"
|
|
142001
|
+
message: "created_at must be a valid positive unix-ms integer"
|
|
141960
142002
|
});
|
|
141961
142003
|
}
|
|
141962
142004
|
const clientInfo = raw2.client_info;
|
|
@@ -141969,11 +142011,10 @@ function validateRegistrationBody(raw2) {
|
|
|
141969
142011
|
checkString(issues, "client_info.name", clientInfo.name, 255);
|
|
141970
142012
|
checkOptionalString(issues, "client_info.version", clientInfo.version, 50);
|
|
141971
142013
|
}
|
|
141972
|
-
if (raw2.server_did !== void 0
|
|
141973
|
-
|
|
141974
|
-
|
|
141975
|
-
|
|
141976
|
-
});
|
|
142014
|
+
if (raw2.server_did !== void 0) {
|
|
142015
|
+
const issue4 = didIssueMessage(raw2.server_did);
|
|
142016
|
+
if (issue4)
|
|
142017
|
+
issues.push({ path: "server_did", message: issue4 });
|
|
141977
142018
|
}
|
|
141978
142019
|
const challenge = validateChallenge(issues, raw2.challenge);
|
|
141979
142020
|
if (raw2.challenge !== void 0 && typeof raw2.session_id === "string" && raw2.session_id.length < 22) {
|
|
@@ -142002,7 +142043,10 @@ function validateRegistrationBody(raw2) {
|
|
|
142002
142043
|
// ../mcp-i-cloudflare/dist/delegation-http/anchor-registration.js
|
|
142003
142044
|
var DO_INTERNAL_ORIGIN = "https://do.internal";
|
|
142004
142045
|
function isAnchorRegistrationEnabled(cfg, env2) {
|
|
142005
|
-
return cfg !== null && cfg.remoteAnchorRegistration && typeof env2.AGENTSHIELD_API_KEY === "string" && env2.AGENTSHIELD_API_KEY.length > 0
|
|
142046
|
+
return cfg !== null && cfg.remoteAnchorRegistration && typeof env2.AGENTSHIELD_API_KEY === "string" && env2.AGENTSHIELD_API_KEY.length > 0 && // No anchor store, no registration surface: getAnchorStub throws on an
|
|
142047
|
+
// unbound MCP_OBJECT, so an unbound deployment must 404 like every other
|
|
142048
|
+
// unprovisioned state instead of 500ing per request.
|
|
142049
|
+
env2.MCP_OBJECT !== void 0;
|
|
142006
142050
|
}
|
|
142007
142051
|
function deriveRegistrationSid(sessionId) {
|
|
142008
142052
|
if (isAnchorSid(sessionId))
|
|
@@ -142032,41 +142076,37 @@ async function callAnchor(env2, deps, sid, internalPath, body) {
|
|
|
142032
142076
|
}
|
|
142033
142077
|
async function ensureAnchor(env2, cfg, deps, sid, challenge, session) {
|
|
142034
142078
|
const pin = challenge.challengePin && cfg.allowUnverifiedKeyidHolders ? { type: "keyid", valueSha256: sha256Hex(challenge.challengePin) } : void 0;
|
|
142035
|
-
const
|
|
142036
|
-
|
|
142037
|
-
|
|
142038
|
-
|
|
142039
|
-
|
|
142040
|
-
delegationExpiresInS: cfg.delegationExpiresInS,
|
|
142041
|
-
agentDid: challenge.detectedAgentDid ?? session.agentDid,
|
|
142042
|
-
// Cross-resource claim inputs (drive the minted VC's aud / server_did โ
|
|
142043
|
-
// see consent-anchor-bridge's withCrossResourceClaims).
|
|
142044
|
-
...challenge.audience ? { audience: challenge.audience } : {},
|
|
142045
|
-
...session.serverDid ? { serverDid: session.serverDid } : {},
|
|
142046
|
-
...pin ? { pin } : {}
|
|
142047
|
-
});
|
|
142048
|
-
if (created.status !== 201) {
|
|
142049
|
-
return {
|
|
142050
|
-
error: errorResponse(502, "anchor_unavailable", "The anchor store did not accept the registration")
|
|
142051
|
-
};
|
|
142052
|
-
}
|
|
142053
|
-
let reused = false;
|
|
142079
|
+
const anchorUnavailable = {
|
|
142080
|
+
error: errorResponse(502, "anchor_unavailable", "The anchor store did not accept the registration")
|
|
142081
|
+
};
|
|
142082
|
+
let created;
|
|
142083
|
+
let body;
|
|
142054
142084
|
try {
|
|
142055
|
-
|
|
142056
|
-
|
|
142085
|
+
created = await callAnchor(env2, deps, sid, INTERNAL_PICKUP_CREATE, {
|
|
142086
|
+
sid,
|
|
142087
|
+
requiredScopes: challenge.requiredScopes,
|
|
142088
|
+
pollIntervalS: cfg.pollIntervalS,
|
|
142089
|
+
anchorTtlS: cfg.anchorTtlS,
|
|
142090
|
+
delegationExpiresInS: cfg.delegationExpiresInS,
|
|
142091
|
+
agentDid: challenge.detectedAgentDid ?? session.agentDid,
|
|
142092
|
+
registeredAtMs: session.registeredAtMs,
|
|
142093
|
+
// Cross-resource claim inputs (drive the minted VC's aud / server_did โ
|
|
142094
|
+
// see consent-anchor-bridge's withCrossResourceClaims).
|
|
142095
|
+
...challenge.audience ? { audience: challenge.audience } : {},
|
|
142096
|
+
...session.serverDid ? { serverDid: session.serverDid } : {},
|
|
142097
|
+
...pin ? { pin } : {}
|
|
142098
|
+
});
|
|
142099
|
+
if (created.status !== 201)
|
|
142100
|
+
return anchorUnavailable;
|
|
142101
|
+
body = await created.json();
|
|
142102
|
+
} catch (error87) {
|
|
142103
|
+
console.warn(`[kya-http] anchor create failed (sid=${sid}):`, error87 instanceof Error ? error87.message : String(error87));
|
|
142104
|
+
return anchorUnavailable;
|
|
142057
142105
|
}
|
|
142058
|
-
|
|
142059
|
-
|
|
142060
|
-
});
|
|
142061
|
-
if (readBack.status !== 200) {
|
|
142062
|
-
return {
|
|
142063
|
-
error: errorResponse(502, "anchor_unavailable", "The registered anchor could not be read back")
|
|
142064
|
-
};
|
|
142106
|
+
if (!body.anchor || !Array.isArray(body.anchor.requiredScopes)) {
|
|
142107
|
+
return anchorUnavailable;
|
|
142065
142108
|
}
|
|
142066
|
-
return {
|
|
142067
|
-
isNew: !reused,
|
|
142068
|
-
snapshot: await readBack.json()
|
|
142069
|
-
};
|
|
142109
|
+
return { isNew: body.reused !== true, snapshot: body.anchor };
|
|
142070
142110
|
}
|
|
142071
142111
|
async function handleAnchorRegistration(c, env2, cfg, deps) {
|
|
142072
142112
|
if (!registrarAuthorized(env2, c.req.header("Authorization"))) {
|
|
@@ -142092,9 +142132,13 @@ async function handleAnchorRegistration(c, env2, cfg, deps) {
|
|
|
142092
142132
|
return errorResponse(401, "unauthorized", "This endpoint only accepts challenge registration");
|
|
142093
142133
|
}
|
|
142094
142134
|
const sid = deriveRegistrationSid(validated.input.sessionId);
|
|
142135
|
+
if (!challenge.audience) {
|
|
142136
|
+
console.warn(`[kya-http] external registration without challenge.audience (sid=${sid}): the minted credential will FAIL an org-pinned \xA74.3 audience gate; cross-resource use requires the registrar to send challenge.audience`);
|
|
142137
|
+
}
|
|
142095
142138
|
const anchor = await ensureAnchor(env2, cfg, deps, sid, challenge, {
|
|
142096
142139
|
agentDid: validated.input.agentDid,
|
|
142097
|
-
serverDid: validated.input.serverDid
|
|
142140
|
+
serverDid: validated.input.serverDid,
|
|
142141
|
+
registeredAtMs: validated.input.createdAt
|
|
142098
142142
|
});
|
|
142099
142143
|
if ("error" in anchor)
|
|
142100
142144
|
return anchor.error;
|
|
@@ -142118,17 +142162,24 @@ async function handleAnchorRegistration(c, env2, cfg, deps) {
|
|
|
142118
142162
|
console.warn(`[kya-http] registration challenge_proof signing failed (sid=${sid}):`, error87 instanceof Error ? error87.message : String(error87));
|
|
142119
142163
|
return errorResponse(502, "proof_unavailable", "The challenge proof could not be signed");
|
|
142120
142164
|
}
|
|
142165
|
+
const createdAtMs = anchor.snapshot.registeredAtMs ?? validated.input.createdAt;
|
|
142166
|
+
const issuedAtMs = anchor.snapshot.issuedAtMs ?? Date.now();
|
|
142121
142167
|
return new Response(JSON.stringify({
|
|
142122
142168
|
success: true,
|
|
142123
142169
|
data: {
|
|
142124
142170
|
session_id: sid,
|
|
142125
142171
|
registered: true,
|
|
142126
|
-
created_at: new Date(
|
|
142172
|
+
created_at: new Date(createdAtMs).toISOString(),
|
|
142127
142173
|
challenge: {
|
|
142128
142174
|
consent_uri: consentUri,
|
|
142129
142175
|
challenge_proof: challengeProof,
|
|
142130
142176
|
required_scopes: anchor.snapshot.requiredScopes,
|
|
142131
|
-
issued_at:
|
|
142177
|
+
issued_at: issuedAtMs,
|
|
142178
|
+
// ADDITIVE diagnostic (not in the frozen conformance key set, ignored
|
|
142179
|
+
// by both existing parsers): whether the minted credential will carry
|
|
142180
|
+
// the ยง4.3 cross-resource claims. False means no audience was
|
|
142181
|
+
// registered โ the credential only self-verifies at this worker.
|
|
142182
|
+
cross_resource: typeof anchor.snapshot.audience === "string"
|
|
142132
142183
|
}
|
|
142133
142184
|
}
|
|
142134
142185
|
}), {
|
|
@@ -147549,7 +147600,11 @@ async function mintDelegationVcJwt(env2, sid, info, expiresInS) {
|
|
|
147549
147600
|
constraints: {
|
|
147550
147601
|
scopes: info.requiredScopes,
|
|
147551
147602
|
notBefore: nowS,
|
|
147552
|
-
notAfter: nowS + expiresInS
|
|
147603
|
+
notAfter: nowS + expiresInS,
|
|
147604
|
+
// ยง11.7 outer===inner audience invariant (checkpoint's own mints bind the
|
|
147605
|
+
// audience in BOTH the JWT aud and constraints.audience): set the inner
|
|
147606
|
+
// half for cross-resource anchors so verifiers reading either slot agree.
|
|
147607
|
+
...info.audience ? { audience: info.audience } : {}
|
|
147553
147608
|
},
|
|
147554
147609
|
signature: "",
|
|
147555
147610
|
status: "active",
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.10.
|
|
3
|
-
"frameworkVersion": "1.12.
|
|
2
|
+
"version": "1.10.3",
|
|
3
|
+
"frameworkVersion": "1.12.1",
|
|
4
4
|
"doClassName": "MCPIAgent",
|
|
5
|
-
"buildDate": "2026-07-
|
|
5
|
+
"buildDate": "2026-07-08T22:33:37.213Z",
|
|
6
6
|
"templates": {
|
|
7
7
|
"blank": {
|
|
8
8
|
"file": "blank.js",
|
|
9
|
-
"size":
|
|
10
|
-
"hash": "sha256:
|
|
9
|
+
"size": 7226042,
|
|
10
|
+
"hash": "sha256:85d714b4d55d63216b6da7622a06ccbde4c117ae78d968b1a7f5e45384b5bb86"
|
|
11
11
|
},
|
|
12
12
|
"hardware-world": {
|
|
13
13
|
"file": "hardware-world.js",
|
|
14
|
-
"size":
|
|
15
|
-
"hash": "sha256:
|
|
14
|
+
"size": 7238445,
|
|
15
|
+
"hash": "sha256:57df00cb178ccff53fe1d1da664d3873b0ddc8f2506461f3896a4917cde0c70a"
|
|
16
16
|
},
|
|
17
17
|
"ecommerce": {
|
|
18
18
|
"file": "ecommerce.js",
|
|
19
|
-
"size":
|
|
20
|
-
"hash": "sha256:
|
|
19
|
+
"size": 7227736,
|
|
20
|
+
"hash": "sha256:e31ace48f27532c3894e6cd71389c68adb404c96da3d96c6912e61b5288d3964"
|
|
21
21
|
},
|
|
22
22
|
"mix-station": {
|
|
23
23
|
"file": "mix-station.js",
|
|
24
|
-
"size":
|
|
25
|
-
"hash": "sha256:
|
|
24
|
+
"size": 7240829,
|
|
25
|
+
"hash": "sha256:873a503de7a07ae2e62cde4d4c93e4a3872bad1b34bb1df64903f8fe40bd23d8"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -141492,6 +141492,21 @@ var INTERNAL_PICKUP_INFO = "/_internal/pickup/info";
|
|
|
141492
141492
|
|
|
141493
141493
|
// ../mcp-i-cloudflare/dist/delegation-http/anchor-do.js
|
|
141494
141494
|
init_storage_keys();
|
|
141495
|
+
function anchorSnapshot(rec) {
|
|
141496
|
+
return {
|
|
141497
|
+
sid: rec.sid,
|
|
141498
|
+
status: rec.status,
|
|
141499
|
+
requiredScopes: rec.requiredScopes,
|
|
141500
|
+
minAssurance: rec.minAssurance,
|
|
141501
|
+
expiresAt: rec.expiresAt,
|
|
141502
|
+
createdAt: rec.createdAt,
|
|
141503
|
+
registeredAtMs: rec.registeredAtMs,
|
|
141504
|
+
issuedAtMs: rec.issuedAtMs,
|
|
141505
|
+
agentDid: rec.agentDid,
|
|
141506
|
+
audience: rec.audience,
|
|
141507
|
+
serverDid: rec.serverDid
|
|
141508
|
+
};
|
|
141509
|
+
}
|
|
141495
141510
|
var pendingBody = () => ({ status: "pending" });
|
|
141496
141511
|
var pinnedErr = () => ({ error: KYAOS_ERRORS.pickupPinned });
|
|
141497
141512
|
var invalidSessionErr = () => ({ error: KYAOS_ERRORS.invalidSession });
|
|
@@ -141499,7 +141514,12 @@ var pickupExpiredErr = () => ({ error: KYAOS_ERRORS.pickupExpired });
|
|
|
141499
141514
|
function reduceCreate(rec, input, now2) {
|
|
141500
141515
|
const i2 = input;
|
|
141501
141516
|
if (rec && now2 <= rec.expiresAt) {
|
|
141502
|
-
return {
|
|
141517
|
+
return {
|
|
141518
|
+
response: {
|
|
141519
|
+
status: 201,
|
|
141520
|
+
body: { success: true, reused: true, anchor: anchorSnapshot(rec) }
|
|
141521
|
+
}
|
|
141522
|
+
};
|
|
141503
141523
|
}
|
|
141504
141524
|
const record4 = {
|
|
141505
141525
|
sid: i2.sid,
|
|
@@ -141512,6 +141532,8 @@ function reduceCreate(rec, input, now2) {
|
|
|
141512
141532
|
agentDid: typeof i2.agentDid === "string" ? i2.agentDid : void 0,
|
|
141513
141533
|
audience: typeof i2.audience === "string" ? i2.audience : void 0,
|
|
141514
141534
|
serverDid: typeof i2.serverDid === "string" ? i2.serverDid : void 0,
|
|
141535
|
+
registeredAtMs: typeof i2.registeredAtMs === "number" ? i2.registeredAtMs : void 0,
|
|
141536
|
+
issuedAtMs: now2,
|
|
141515
141537
|
pin: i2.pin ? {
|
|
141516
141538
|
type: i2.pin.type,
|
|
141517
141539
|
valueSha256: i2.pin.valueSha256,
|
|
@@ -141519,7 +141541,13 @@ function reduceCreate(rec, input, now2) {
|
|
|
141519
141541
|
source: "challenge"
|
|
141520
141542
|
} : void 0
|
|
141521
141543
|
};
|
|
141522
|
-
return {
|
|
141544
|
+
return {
|
|
141545
|
+
record: record4,
|
|
141546
|
+
response: {
|
|
141547
|
+
status: 201,
|
|
141548
|
+
body: { success: true, anchor: anchorSnapshot(record4) }
|
|
141549
|
+
}
|
|
141550
|
+
};
|
|
141523
141551
|
}
|
|
141524
141552
|
function reducePoll(rec, holder, now2) {
|
|
141525
141553
|
if (!rec) {
|
|
@@ -141663,7 +141691,7 @@ async function handlePickupInternal(ctx, request, now2) {
|
|
|
141663
141691
|
// ../mcp-i-cloudflare/package.json
|
|
141664
141692
|
var package_default = {
|
|
141665
141693
|
name: "@kya-os/mcp-i-cloudflare",
|
|
141666
|
-
version: "1.12.
|
|
141694
|
+
version: "1.12.1",
|
|
141667
141695
|
description: "Cloudflare Workers adapter for MCP-I framework",
|
|
141668
141696
|
main: "dist/index.js",
|
|
141669
141697
|
types: "dist/index.d.ts",
|
|
@@ -141881,6 +141909,16 @@ function registrationRateLimited(now2) {
|
|
|
141881
141909
|
|
|
141882
141910
|
// ../mcp-i-cloudflare/dist/delegation-http/anchor-registration-validate.js
|
|
141883
141911
|
var DID_RE = /^did:(key|web):.+$/;
|
|
141912
|
+
var SYNTHETIC_DETECTED_DID_PREFIX = "did:web:detected:";
|
|
141913
|
+
function didIssueMessage(value) {
|
|
141914
|
+
if (typeof value !== "string" || !DID_RE.test(value)) {
|
|
141915
|
+
return "Invalid DID format. Must be did:key: or did:web:";
|
|
141916
|
+
}
|
|
141917
|
+
if (value.startsWith(SYNTHETIC_DETECTED_DID_PREFIX)) {
|
|
141918
|
+
return "Synthetic detected DIDs are not valid KYA-OS identities";
|
|
141919
|
+
}
|
|
141920
|
+
return null;
|
|
141921
|
+
}
|
|
141884
141922
|
function isRecord2(value) {
|
|
141885
141923
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
141886
141924
|
}
|
|
@@ -141914,17 +141952,17 @@ function validateChallenge(issues, raw2) {
|
|
|
141914
141952
|
checkOptionalString(issues, "challenge.pep_surface", raw2.pep_surface, 64);
|
|
141915
141953
|
checkOptionalString(issues, "challenge.verdict", raw2.verdict, 64);
|
|
141916
141954
|
checkOptionalString(issues, "challenge.challenge_pin", raw2.challenge_pin, 512);
|
|
141917
|
-
if (raw2.detected_agent_did !== void 0
|
|
141918
|
-
|
|
141919
|
-
|
|
141920
|
-
|
|
141921
|
-
}
|
|
141955
|
+
if (raw2.detected_agent_did !== void 0) {
|
|
141956
|
+
const issue4 = didIssueMessage(raw2.detected_agent_did);
|
|
141957
|
+
if (issue4) {
|
|
141958
|
+
issues.push({ path: "challenge.detected_agent_did", message: issue4 });
|
|
141959
|
+
}
|
|
141922
141960
|
}
|
|
141923
|
-
if (raw2.audience !== void 0
|
|
141924
|
-
|
|
141925
|
-
|
|
141926
|
-
|
|
141927
|
-
}
|
|
141961
|
+
if (raw2.audience !== void 0) {
|
|
141962
|
+
const issue4 = didIssueMessage(raw2.audience);
|
|
141963
|
+
if (issue4) {
|
|
141964
|
+
issues.push({ path: "challenge.audience", message: issue4 });
|
|
141965
|
+
}
|
|
141928
141966
|
}
|
|
141929
141967
|
if (issues.length > issuesBefore)
|
|
141930
141968
|
return void 0;
|
|
@@ -141946,17 +141984,21 @@ function validateRegistrationBody(raw2) {
|
|
|
141946
141984
|
}
|
|
141947
141985
|
const issues = [];
|
|
141948
141986
|
checkString(issues, "session_id", raw2.session_id, 255);
|
|
141949
|
-
|
|
141987
|
+
{
|
|
141988
|
+
const issue4 = didIssueMessage(raw2.agent_did);
|
|
141989
|
+
if (issue4)
|
|
141990
|
+
issues.push({ path: "agent_did", message: issue4 });
|
|
141991
|
+
}
|
|
141992
|
+
if (typeof raw2.project_id !== "string" || raw2.project_id.length < 1) {
|
|
141950
141993
|
issues.push({
|
|
141951
|
-
path: "
|
|
141952
|
-
message: "
|
|
141994
|
+
path: "project_id",
|
|
141995
|
+
message: "project_id must be a non-empty string"
|
|
141953
141996
|
});
|
|
141954
141997
|
}
|
|
141955
|
-
|
|
141956
|
-
if (typeof raw2.created_at !== "number" || !Number.isInteger(raw2.created_at) || raw2.created_at <= 0) {
|
|
141998
|
+
if (typeof raw2.created_at !== "number" || !Number.isInteger(raw2.created_at) || raw2.created_at <= 0 || raw2.created_at > 864e13) {
|
|
141957
141999
|
issues.push({
|
|
141958
142000
|
path: "created_at",
|
|
141959
|
-
message: "created_at must be a positive unix-ms integer"
|
|
142001
|
+
message: "created_at must be a valid positive unix-ms integer"
|
|
141960
142002
|
});
|
|
141961
142003
|
}
|
|
141962
142004
|
const clientInfo = raw2.client_info;
|
|
@@ -141969,11 +142011,10 @@ function validateRegistrationBody(raw2) {
|
|
|
141969
142011
|
checkString(issues, "client_info.name", clientInfo.name, 255);
|
|
141970
142012
|
checkOptionalString(issues, "client_info.version", clientInfo.version, 50);
|
|
141971
142013
|
}
|
|
141972
|
-
if (raw2.server_did !== void 0
|
|
141973
|
-
|
|
141974
|
-
|
|
141975
|
-
|
|
141976
|
-
});
|
|
142014
|
+
if (raw2.server_did !== void 0) {
|
|
142015
|
+
const issue4 = didIssueMessage(raw2.server_did);
|
|
142016
|
+
if (issue4)
|
|
142017
|
+
issues.push({ path: "server_did", message: issue4 });
|
|
141977
142018
|
}
|
|
141978
142019
|
const challenge = validateChallenge(issues, raw2.challenge);
|
|
141979
142020
|
if (raw2.challenge !== void 0 && typeof raw2.session_id === "string" && raw2.session_id.length < 22) {
|
|
@@ -142002,7 +142043,10 @@ function validateRegistrationBody(raw2) {
|
|
|
142002
142043
|
// ../mcp-i-cloudflare/dist/delegation-http/anchor-registration.js
|
|
142003
142044
|
var DO_INTERNAL_ORIGIN = "https://do.internal";
|
|
142004
142045
|
function isAnchorRegistrationEnabled(cfg, env2) {
|
|
142005
|
-
return cfg !== null && cfg.remoteAnchorRegistration && typeof env2.AGENTSHIELD_API_KEY === "string" && env2.AGENTSHIELD_API_KEY.length > 0
|
|
142046
|
+
return cfg !== null && cfg.remoteAnchorRegistration && typeof env2.AGENTSHIELD_API_KEY === "string" && env2.AGENTSHIELD_API_KEY.length > 0 && // No anchor store, no registration surface: getAnchorStub throws on an
|
|
142047
|
+
// unbound MCP_OBJECT, so an unbound deployment must 404 like every other
|
|
142048
|
+
// unprovisioned state instead of 500ing per request.
|
|
142049
|
+
env2.MCP_OBJECT !== void 0;
|
|
142006
142050
|
}
|
|
142007
142051
|
function deriveRegistrationSid(sessionId) {
|
|
142008
142052
|
if (isAnchorSid(sessionId))
|
|
@@ -142032,41 +142076,37 @@ async function callAnchor(env2, deps, sid, internalPath, body) {
|
|
|
142032
142076
|
}
|
|
142033
142077
|
async function ensureAnchor(env2, cfg, deps, sid, challenge, session) {
|
|
142034
142078
|
const pin = challenge.challengePin && cfg.allowUnverifiedKeyidHolders ? { type: "keyid", valueSha256: sha256Hex(challenge.challengePin) } : void 0;
|
|
142035
|
-
const
|
|
142036
|
-
|
|
142037
|
-
|
|
142038
|
-
|
|
142039
|
-
|
|
142040
|
-
delegationExpiresInS: cfg.delegationExpiresInS,
|
|
142041
|
-
agentDid: challenge.detectedAgentDid ?? session.agentDid,
|
|
142042
|
-
// Cross-resource claim inputs (drive the minted VC's aud / server_did โ
|
|
142043
|
-
// see consent-anchor-bridge's withCrossResourceClaims).
|
|
142044
|
-
...challenge.audience ? { audience: challenge.audience } : {},
|
|
142045
|
-
...session.serverDid ? { serverDid: session.serverDid } : {},
|
|
142046
|
-
...pin ? { pin } : {}
|
|
142047
|
-
});
|
|
142048
|
-
if (created.status !== 201) {
|
|
142049
|
-
return {
|
|
142050
|
-
error: errorResponse(502, "anchor_unavailable", "The anchor store did not accept the registration")
|
|
142051
|
-
};
|
|
142052
|
-
}
|
|
142053
|
-
let reused = false;
|
|
142079
|
+
const anchorUnavailable = {
|
|
142080
|
+
error: errorResponse(502, "anchor_unavailable", "The anchor store did not accept the registration")
|
|
142081
|
+
};
|
|
142082
|
+
let created;
|
|
142083
|
+
let body;
|
|
142054
142084
|
try {
|
|
142055
|
-
|
|
142056
|
-
|
|
142085
|
+
created = await callAnchor(env2, deps, sid, INTERNAL_PICKUP_CREATE, {
|
|
142086
|
+
sid,
|
|
142087
|
+
requiredScopes: challenge.requiredScopes,
|
|
142088
|
+
pollIntervalS: cfg.pollIntervalS,
|
|
142089
|
+
anchorTtlS: cfg.anchorTtlS,
|
|
142090
|
+
delegationExpiresInS: cfg.delegationExpiresInS,
|
|
142091
|
+
agentDid: challenge.detectedAgentDid ?? session.agentDid,
|
|
142092
|
+
registeredAtMs: session.registeredAtMs,
|
|
142093
|
+
// Cross-resource claim inputs (drive the minted VC's aud / server_did โ
|
|
142094
|
+
// see consent-anchor-bridge's withCrossResourceClaims).
|
|
142095
|
+
...challenge.audience ? { audience: challenge.audience } : {},
|
|
142096
|
+
...session.serverDid ? { serverDid: session.serverDid } : {},
|
|
142097
|
+
...pin ? { pin } : {}
|
|
142098
|
+
});
|
|
142099
|
+
if (created.status !== 201)
|
|
142100
|
+
return anchorUnavailable;
|
|
142101
|
+
body = await created.json();
|
|
142102
|
+
} catch (error87) {
|
|
142103
|
+
console.warn(`[kya-http] anchor create failed (sid=${sid}):`, error87 instanceof Error ? error87.message : String(error87));
|
|
142104
|
+
return anchorUnavailable;
|
|
142057
142105
|
}
|
|
142058
|
-
|
|
142059
|
-
|
|
142060
|
-
});
|
|
142061
|
-
if (readBack.status !== 200) {
|
|
142062
|
-
return {
|
|
142063
|
-
error: errorResponse(502, "anchor_unavailable", "The registered anchor could not be read back")
|
|
142064
|
-
};
|
|
142106
|
+
if (!body.anchor || !Array.isArray(body.anchor.requiredScopes)) {
|
|
142107
|
+
return anchorUnavailable;
|
|
142065
142108
|
}
|
|
142066
|
-
return {
|
|
142067
|
-
isNew: !reused,
|
|
142068
|
-
snapshot: await readBack.json()
|
|
142069
|
-
};
|
|
142109
|
+
return { isNew: body.reused !== true, snapshot: body.anchor };
|
|
142070
142110
|
}
|
|
142071
142111
|
async function handleAnchorRegistration(c, env2, cfg, deps) {
|
|
142072
142112
|
if (!registrarAuthorized(env2, c.req.header("Authorization"))) {
|
|
@@ -142092,9 +142132,13 @@ async function handleAnchorRegistration(c, env2, cfg, deps) {
|
|
|
142092
142132
|
return errorResponse(401, "unauthorized", "This endpoint only accepts challenge registration");
|
|
142093
142133
|
}
|
|
142094
142134
|
const sid = deriveRegistrationSid(validated.input.sessionId);
|
|
142135
|
+
if (!challenge.audience) {
|
|
142136
|
+
console.warn(`[kya-http] external registration without challenge.audience (sid=${sid}): the minted credential will FAIL an org-pinned \xA74.3 audience gate; cross-resource use requires the registrar to send challenge.audience`);
|
|
142137
|
+
}
|
|
142095
142138
|
const anchor = await ensureAnchor(env2, cfg, deps, sid, challenge, {
|
|
142096
142139
|
agentDid: validated.input.agentDid,
|
|
142097
|
-
serverDid: validated.input.serverDid
|
|
142140
|
+
serverDid: validated.input.serverDid,
|
|
142141
|
+
registeredAtMs: validated.input.createdAt
|
|
142098
142142
|
});
|
|
142099
142143
|
if ("error" in anchor)
|
|
142100
142144
|
return anchor.error;
|
|
@@ -142118,17 +142162,24 @@ async function handleAnchorRegistration(c, env2, cfg, deps) {
|
|
|
142118
142162
|
console.warn(`[kya-http] registration challenge_proof signing failed (sid=${sid}):`, error87 instanceof Error ? error87.message : String(error87));
|
|
142119
142163
|
return errorResponse(502, "proof_unavailable", "The challenge proof could not be signed");
|
|
142120
142164
|
}
|
|
142165
|
+
const createdAtMs = anchor.snapshot.registeredAtMs ?? validated.input.createdAt;
|
|
142166
|
+
const issuedAtMs = anchor.snapshot.issuedAtMs ?? Date.now();
|
|
142121
142167
|
return new Response(JSON.stringify({
|
|
142122
142168
|
success: true,
|
|
142123
142169
|
data: {
|
|
142124
142170
|
session_id: sid,
|
|
142125
142171
|
registered: true,
|
|
142126
|
-
created_at: new Date(
|
|
142172
|
+
created_at: new Date(createdAtMs).toISOString(),
|
|
142127
142173
|
challenge: {
|
|
142128
142174
|
consent_uri: consentUri,
|
|
142129
142175
|
challenge_proof: challengeProof,
|
|
142130
142176
|
required_scopes: anchor.snapshot.requiredScopes,
|
|
142131
|
-
issued_at:
|
|
142177
|
+
issued_at: issuedAtMs,
|
|
142178
|
+
// ADDITIVE diagnostic (not in the frozen conformance key set, ignored
|
|
142179
|
+
// by both existing parsers): whether the minted credential will carry
|
|
142180
|
+
// the ยง4.3 cross-resource claims. False means no audience was
|
|
142181
|
+
// registered โ the credential only self-verifies at this worker.
|
|
142182
|
+
cross_resource: typeof anchor.snapshot.audience === "string"
|
|
142132
142183
|
}
|
|
142133
142184
|
}
|
|
142134
142185
|
}), {
|
|
@@ -147549,7 +147600,11 @@ async function mintDelegationVcJwt(env2, sid, info, expiresInS) {
|
|
|
147549
147600
|
constraints: {
|
|
147550
147601
|
scopes: info.requiredScopes,
|
|
147551
147602
|
notBefore: nowS,
|
|
147552
|
-
notAfter: nowS + expiresInS
|
|
147603
|
+
notAfter: nowS + expiresInS,
|
|
147604
|
+
// ยง11.7 outer===inner audience invariant (checkpoint's own mints bind the
|
|
147605
|
+
// audience in BOTH the JWT aud and constraints.audience): set the inner
|
|
147606
|
+
// half for cross-resource anchors so verifiers reading either slot agree.
|
|
147607
|
+
...info.audience ? { audience: info.audience } : {}
|
|
147553
147608
|
},
|
|
147554
147609
|
signature: "",
|
|
147555
147610
|
status: "active",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kya-os/create-mcpi-app",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.3",
|
|
4
4
|
"description": "Scaffold a new MCP-I application",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/helpers/index.js",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@kya-os/cli-effects": "^1.0.19",
|
|
60
60
|
"@kya-os/contracts": "^1.9.0",
|
|
61
61
|
"@kya-os/mcp-i": "^1.7.13",
|
|
62
|
-
"@kya-os/mcp-i-cloudflare": "^1.12.
|
|
62
|
+
"@kya-os/mcp-i-cloudflare": "^1.12.1",
|
|
63
63
|
"base-x": "^5.0.0",
|
|
64
64
|
"chalk": "^4.1.2",
|
|
65
65
|
"commander": "^12.1.0",
|