githolon 0.105.6 → 0.105.8
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.
|
@@ -360,7 +360,10 @@ var init_custody_transport = __esm({
|
|
|
360
360
|
// vendor/engine/managed-promotion.ts
|
|
361
361
|
function prepareManagedPromotion(report, candidateHash, domain, opts = {}) {
|
|
362
362
|
if (!report.sourceVerified || !report.complete || !report.evolve?.ok) {
|
|
363
|
-
const reason = !report.sourceVerified ? "the source ledger did not verify" : !report.complete ? "some historical premises could not be re-derived" :
|
|
363
|
+
const reason = !report.sourceVerified ? "the source ledger did not verify" : !report.complete ? "some historical premises could not be re-derived" : [
|
|
364
|
+
"the candidate fails deterministic schema evolution",
|
|
365
|
+
...report.evolve.violations.map((violation) => violation.detail)
|
|
366
|
+
].join(": ");
|
|
364
367
|
return { ok: false, stage: "preflight", report, error: `promotion refused: ${reason}` };
|
|
365
368
|
}
|
|
366
369
|
const acceptanceReason = opts.acceptanceReason?.trim();
|
|
@@ -902,17 +905,18 @@ function offerResult(response) {
|
|
|
902
905
|
}
|
|
903
906
|
}
|
|
904
907
|
function applicationQueryProto(eng, ws, query2, options = {}) {
|
|
908
|
+
const hasAuthority = options.principal !== void 0 || options.keys !== void 0 || options.authToken !== void 0 || options.nowUnix !== void 0 || options.authorSecret !== void 0;
|
|
905
909
|
const response = callProto(eng.ex, {
|
|
906
910
|
case: "query",
|
|
907
911
|
value: create(QueryRequestSchema, {
|
|
908
912
|
target: protoTarget(ws, options.branch ?? BRANCH),
|
|
909
|
-
authority: protoAuthority(
|
|
913
|
+
authority: hasAuthority ? protoAuthority(
|
|
910
914
|
options.principal,
|
|
911
915
|
options.keys,
|
|
912
916
|
options.authToken,
|
|
913
917
|
options.nowUnix,
|
|
914
918
|
options.authorSecret
|
|
915
|
-
),
|
|
919
|
+
) : void 0,
|
|
916
920
|
spans: options.spans ?? false,
|
|
917
921
|
query: query2
|
|
918
922
|
})
|
|
@@ -4031,12 +4035,10 @@ var init_engine = __esm({
|
|
|
4031
4035
|
const recordObject = record === void 0 ? void 0 : `${record.type}:${record.id}`;
|
|
4032
4036
|
const derived = namedQueryProto(eng, workspace, QueryOperation.CRYPTO_OWNED_SCOPE_KEY, {
|
|
4033
4037
|
custodyWorkspace: workspace,
|
|
4034
|
-
principal,
|
|
4035
|
-
authorSecret,
|
|
4036
4038
|
scope,
|
|
4037
4039
|
...recordObject === void 0 ? {} : { recordObject, recordEpoch },
|
|
4038
4040
|
...recordWrap === void 0 ? {} : { recordWrap }
|
|
4039
|
-
});
|
|
4041
|
+
}, { principal, authorSecret });
|
|
4040
4042
|
const ownedKeySubject = String(derived.ownedKeySubject || "");
|
|
4041
4043
|
if (!requireSeat) {
|
|
4042
4044
|
return {
|
|
@@ -4053,7 +4055,16 @@ var init_engine = __esm({
|
|
|
4053
4055
|
let hex = "";
|
|
4054
4056
|
for (const byte of enc3.encode(principal)) hex += byte.toString(16).padStart(2, "0");
|
|
4055
4057
|
const object = `nomos-owned-principal:${hex || "00"}`;
|
|
4056
|
-
const rows = qById(
|
|
4058
|
+
const rows = qById(
|
|
4059
|
+
eng,
|
|
4060
|
+
workspace,
|
|
4061
|
+
`reltuple-${object}-nomos_internal_owned_device_key_7c1f5e`,
|
|
4062
|
+
principal,
|
|
4063
|
+
[],
|
|
4064
|
+
"",
|
|
4065
|
+
0,
|
|
4066
|
+
authorSecret
|
|
4067
|
+
);
|
|
4057
4068
|
const row = Array.isArray(rows) ? rows[0] : rows?.rows?.[0];
|
|
4058
4069
|
const leaves = row?.data?.subjects ?? row?.subjects ?? {};
|
|
4059
4070
|
const leaf = (raw) => {
|
|
@@ -4084,14 +4095,12 @@ var init_engine = __esm({
|
|
|
4084
4095
|
const custody = String(leaf(leaves[ownedKeySubject]).ownedCustody || "");
|
|
4085
4096
|
if (!custody) throw new Error("the approved device has no owned-data handoff");
|
|
4086
4097
|
const opened = namedQueryProto(eng, workspace, QueryOperation.CRYPTO_OWNED_SCOPE_KEY, {
|
|
4087
|
-
workspace,
|
|
4088
|
-
principal,
|
|
4089
|
-
authorSecret,
|
|
4098
|
+
custodyWorkspace: workspace,
|
|
4090
4099
|
scope,
|
|
4091
4100
|
ownedCustody: custody,
|
|
4092
4101
|
...recordObject === void 0 ? {} : { recordObject, recordEpoch },
|
|
4093
4102
|
...recordWrap === void 0 ? {} : { recordWrap }
|
|
4094
|
-
});
|
|
4103
|
+
}, { principal, authorSecret });
|
|
4095
4104
|
return {
|
|
4096
4105
|
scope: String(opened.scope || scope),
|
|
4097
4106
|
epoch: Number(opened.epoch) || 0,
|
|
@@ -4112,11 +4121,8 @@ var init_engine = __esm({
|
|
|
4112
4121
|
};
|
|
4113
4122
|
};
|
|
4114
4123
|
cryptoOwnedDeviceRequest = (eng, workspace, principal, authorSecret, scope) => String(namedQueryProto(eng, workspace, QueryOperation.CRYPTO_OWNED_DEVICE_REQUEST, {
|
|
4115
|
-
workspace,
|
|
4116
|
-
principal,
|
|
4117
|
-
authorSecret,
|
|
4118
4124
|
scope
|
|
4119
|
-
}).request || "");
|
|
4125
|
+
}, { principal, authorSecret }).request || "");
|
|
4120
4126
|
cryptoOwnedPrepareApproval = (eng, args) => namedQueryProto(eng, args.workspace, QueryOperation.CRYPTO_OWNED_PREPARE_APPROVAL, args);
|
|
4121
4127
|
cryptoOwnedPrepareRecovery = (eng, args) => namedQueryProto(eng, args.workspace, QueryOperation.CRYPTO_OWNED_PREPARE_RECOVERY, args);
|
|
4122
4128
|
cryptoKeygen = (eng) => namedQueryProto(eng, "root", QueryOperation.CRYPTO_KEYGEN);
|
|
@@ -4154,7 +4160,10 @@ var init_engine = __esm({
|
|
|
4154
4160
|
...authProviderJwks !== void 0 ? { authProviderJwks } : {},
|
|
4155
4161
|
...authProviderAudience !== void 0 ? { authProviderAudience } : {}
|
|
4156
4162
|
}).cert;
|
|
4157
|
-
cryptoWrapKey = (eng, { recipientPub, scopeKey }) =>
|
|
4163
|
+
cryptoWrapKey = (eng, { recipientPub, scopeKey }) => {
|
|
4164
|
+
const result = namedQueryProto(eng, "root", QueryOperation.CRYPTO_WRAP_KEY, { recipientPub, scopeKey });
|
|
4165
|
+
return { hpkeEpk: String(result.hpkeEpk ?? ""), ct: String(result.ct ?? "") };
|
|
4166
|
+
};
|
|
4158
4167
|
cryptoUnwrapKey = (eng, { secret, hpkeEpk, ct }) => namedQueryProto(eng, "root", QueryOperation.CRYPTO_UNWRAP_KEY, { secret, hpkeEpk, ct }).scopeKey;
|
|
4159
4168
|
readPosture = (eng, ws, principal = "", authToken = "", nowUnix = 0, authorSecret = "") => namedQueryProto(
|
|
4160
4169
|
eng,
|
package/dist/dev-server.mjs
CHANGED
|
@@ -618,17 +618,18 @@ function offerResult(response) {
|
|
|
618
618
|
}
|
|
619
619
|
}
|
|
620
620
|
function applicationQueryProto(eng, ws, query2, options = {}) {
|
|
621
|
+
const hasAuthority = options.principal !== void 0 || options.keys !== void 0 || options.authToken !== void 0 || options.nowUnix !== void 0 || options.authorSecret !== void 0;
|
|
621
622
|
const response = callProto(eng.ex, {
|
|
622
623
|
case: "query",
|
|
623
624
|
value: create(QueryRequestSchema, {
|
|
624
625
|
target: protoTarget(ws, options.branch ?? BRANCH),
|
|
625
|
-
authority: protoAuthority(
|
|
626
|
+
authority: hasAuthority ? protoAuthority(
|
|
626
627
|
options.principal,
|
|
627
628
|
options.keys,
|
|
628
629
|
options.authToken,
|
|
629
630
|
options.nowUnix,
|
|
630
631
|
options.authorSecret
|
|
631
|
-
),
|
|
632
|
+
) : void 0,
|
|
632
633
|
spans: options.spans ?? false,
|
|
633
634
|
query: query2
|
|
634
635
|
})
|
|
@@ -2990,8 +2991,8 @@ function resolveGatewayOperation(spec, opName, method) {
|
|
|
2990
2991
|
|
|
2991
2992
|
// ../cloud/cloudflare-shell/src/kernel-registry.generated.ts
|
|
2992
2993
|
var DEPLOYED_KERNELS = [
|
|
2993
|
-
{ prefix: "
|
|
2994
|
-
{ prefix: "
|
|
2994
|
+
{ prefix: "08719339", hash: "08719339b0ecfb39b75543bf40422e84832153cc463b00283c0e84f6e38ce359", version: "kernel-08719339", note: "production (this candidate)", features: ["compoundKeys", "capturedReads", "invariantGate", "surfacedMerge", "fieldProvenance", "nullSemantics", "attestedReads", "conflictSnapshots", "ownedAudience", "temporalEnum"] },
|
|
2995
|
+
{ prefix: "ab5c45c0", hash: "ab5c45c029a57b39711a559d803ed7d23e8eb94c11bbba652df7f8b3abd3c6df", version: "kernel-ab5c45c0", note: "test-mint (this candidate) \u2014 feature-equivalent to production", features: ["compoundKeys", "capturedReads", "invariantGate", "surfacedMerge", "fieldProvenance", "nullSemantics", "attestedReads", "conflictSnapshots", "ownedAudience", "temporalEnum"] }
|
|
2995
2996
|
];
|
|
2996
2997
|
|
|
2997
2998
|
// ../cloud/cloudflare-shell/src/staged-intents.ts
|
|
Binary file
|
|
Binary file
|
package/dist/full-cli.mjs
CHANGED
|
@@ -4419,7 +4419,10 @@ var init_custody_transport = __esm({
|
|
|
4419
4419
|
// ../cloud/web-client/src/_adapter/managed-promotion.ts
|
|
4420
4420
|
function prepareManagedPromotion(report, candidateHash, domain, opts = {}) {
|
|
4421
4421
|
if (!report.sourceVerified || !report.complete || !report.evolve?.ok) {
|
|
4422
|
-
const reason = !report.sourceVerified ? "the source ledger did not verify" : !report.complete ? "some historical premises could not be re-derived" :
|
|
4422
|
+
const reason = !report.sourceVerified ? "the source ledger did not verify" : !report.complete ? "some historical premises could not be re-derived" : [
|
|
4423
|
+
"the candidate fails deterministic schema evolution",
|
|
4424
|
+
...report.evolve.violations.map((violation) => violation.detail)
|
|
4425
|
+
].join(": ");
|
|
4423
4426
|
return { ok: false, stage: "preflight", report, error: `promotion refused: ${reason}` };
|
|
4424
4427
|
}
|
|
4425
4428
|
const acceptanceReason = opts.acceptanceReason?.trim();
|
|
@@ -4862,7 +4865,7 @@ var init_principal = __esm({
|
|
|
4862
4865
|
|
|
4863
4866
|
// ../cloud/web-client/src/dead_letters.ts
|
|
4864
4867
|
function createDeadLetters(ctx) {
|
|
4865
|
-
const { provider, enc: enc8, dec: dec8, b64 } = ctx;
|
|
4868
|
+
const { provider, enc: enc8, dec: dec8, b64: b642 } = ctx;
|
|
4866
4869
|
const DLQ_FILE = "dead-letters.json";
|
|
4867
4870
|
const readDlq = () => {
|
|
4868
4871
|
const d = provider.readWsFile(DLQ_FILE);
|
|
@@ -4884,7 +4887,7 @@ function createDeadLetters(ctx) {
|
|
|
4884
4887
|
directiveId = doc.payload && doc.payload.directiveId || null;
|
|
4885
4888
|
} catch {
|
|
4886
4889
|
}
|
|
4887
|
-
list.push({ id: e.id, oid: String(e.oid || e.id || "").slice(0, 10), source, error: String(error || "").slice(0, 300), domain, directiveId, at: (/* @__PURE__ */ new Date()).toISOString(), changeB64:
|
|
4890
|
+
list.push({ id: e.id, oid: String(e.oid || e.id || "").slice(0, 10), source, error: String(error || "").slice(0, 300), domain, directiveId, at: (/* @__PURE__ */ new Date()).toISOString(), changeB64: b642(e.blob) });
|
|
4888
4891
|
writeDlq(list);
|
|
4889
4892
|
}
|
|
4890
4893
|
return { readDlq, writeDlq, deadLetter };
|
|
@@ -5371,6 +5374,191 @@ var init_serialized_scheduler = __esm({
|
|
|
5371
5374
|
}
|
|
5372
5375
|
});
|
|
5373
5376
|
|
|
5377
|
+
// ../cloud/web-client/src/intent_offer_codec.ts
|
|
5378
|
+
function encodeIntentOfferBytes({ domain, directiveId, payload, domainHash, security, actor }) {
|
|
5379
|
+
const envelope = { v: 2, intent: { domain, directiveId, payload, domainHash } };
|
|
5380
|
+
const securitySidecar = security && typeof security === "object" && !Array.isArray(security) ? { ...security } : {};
|
|
5381
|
+
if (actor) securitySidecar.actor = actor;
|
|
5382
|
+
if (typeof securitySidecar.actor === "string") {
|
|
5383
|
+
const normalized = securitySidecar.actor.trim();
|
|
5384
|
+
if (normalized) securitySidecar.actor = normalized;
|
|
5385
|
+
else delete securitySidecar.actor;
|
|
5386
|
+
}
|
|
5387
|
+
if (Object.keys(securitySidecar).length > 0) envelope.security = securitySidecar;
|
|
5388
|
+
return encoder.encode(JSON.stringify(envelope));
|
|
5389
|
+
}
|
|
5390
|
+
var encoder;
|
|
5391
|
+
var init_intent_offer_codec = __esm({
|
|
5392
|
+
"../cloud/web-client/src/intent_offer_codec.ts"() {
|
|
5393
|
+
"use strict";
|
|
5394
|
+
encoder = new TextEncoder();
|
|
5395
|
+
}
|
|
5396
|
+
});
|
|
5397
|
+
|
|
5398
|
+
// ../cloud/web-client/src/remote_holon.ts
|
|
5399
|
+
function connectRemote(opts) {
|
|
5400
|
+
const { cloud, workspace } = opts;
|
|
5401
|
+
if (!cloud || !workspace) throw new Error("connectRemote requires { cloud, workspace }");
|
|
5402
|
+
const base = cloud.replace(/\/+$/, "");
|
|
5403
|
+
const _fetch = opts.fetch ?? fetch;
|
|
5404
|
+
const wsUrl = (path2) => `${base}/v2/workspaces/${encodeURIComponent(workspace)}${path2}`;
|
|
5405
|
+
const headers = (json) => {
|
|
5406
|
+
const h = {};
|
|
5407
|
+
if (json) h["content-type"] = "application/json";
|
|
5408
|
+
if (opts.authToken) h["x-nomos-auth"] = opts.authToken;
|
|
5409
|
+
else if (opts.principal) h["x-nomos-principal"] = opts.principal;
|
|
5410
|
+
return h;
|
|
5411
|
+
};
|
|
5412
|
+
const readJson = async (r, what) => {
|
|
5413
|
+
if (!r.ok) {
|
|
5414
|
+
const text = await r.text().catch(() => "");
|
|
5415
|
+
throw new Error(`${what} failed (${r.status}): ${text.slice(0, 300)}`);
|
|
5416
|
+
}
|
|
5417
|
+
return r.json();
|
|
5418
|
+
};
|
|
5419
|
+
const getRead = async (path2, what) => readJson(await _fetch(wsUrl(path2), { headers: headers(false) }), what);
|
|
5420
|
+
async function offerDirective(domain, directiveId, payload, o) {
|
|
5421
|
+
const bytes = encodeIntentOfferBytes({
|
|
5422
|
+
domain,
|
|
5423
|
+
directiveId,
|
|
5424
|
+
payload,
|
|
5425
|
+
domainHash: o?.domainHash,
|
|
5426
|
+
actor: o?.actor
|
|
5427
|
+
});
|
|
5428
|
+
const r = await _fetch(wsUrl(`/${encodeURIComponent(directiveId)}`), {
|
|
5429
|
+
method: "POST",
|
|
5430
|
+
headers: headers(true),
|
|
5431
|
+
body: JSON.stringify({ intentBytes: b64(bytes) })
|
|
5432
|
+
});
|
|
5433
|
+
const body = await r.json().catch(() => ({}));
|
|
5434
|
+
if (r.status === 422 || body?.refused === true) {
|
|
5435
|
+
throw new RemoteOfferRefusedError(
|
|
5436
|
+
String(body?.error ?? "the law refused the offer"),
|
|
5437
|
+
r.status
|
|
5438
|
+
);
|
|
5439
|
+
}
|
|
5440
|
+
if (!r.ok || body?.ok === false) {
|
|
5441
|
+
throw new Error(
|
|
5442
|
+
`offer ${directiveId} failed (${r.status}): ${String(body?.error ?? "").slice(0, 300)}`
|
|
5443
|
+
);
|
|
5444
|
+
}
|
|
5445
|
+
const result = {
|
|
5446
|
+
head: String(body.head ?? ""),
|
|
5447
|
+
...Array.isArray(body.created) ? { created: body.created } : {},
|
|
5448
|
+
...Array.isArray(body.affected) ? { affected: body.affected } : {},
|
|
5449
|
+
...typeof body.workspace === "string" ? { workspace: body.workspace } : {},
|
|
5450
|
+
...body.born !== void 0 ? { born: body.born } : {},
|
|
5451
|
+
...body.birthOutcomes !== void 0 ? { birthOutcomes: body.birthOutcomes } : {}
|
|
5452
|
+
};
|
|
5453
|
+
return o?.returnCreated ? result : result.head;
|
|
5454
|
+
}
|
|
5455
|
+
const query3 = (queryId, params) => {
|
|
5456
|
+
const qs = new URLSearchParams();
|
|
5457
|
+
for (const [k, v] of Object.entries(params ?? {})) if (v != null) qs.set(k, String(v));
|
|
5458
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
5459
|
+
return getRead(`/${encodeURIComponent(queryId)}${suffix}`, `query ${queryId}`);
|
|
5460
|
+
};
|
|
5461
|
+
const queryById = (aggregateId) => getRead(`/aggregates/${encodeURIComponent(aggregateId)}`, `queryById ${aggregateId}`);
|
|
5462
|
+
const tally = async (kind, id, groupKey) => {
|
|
5463
|
+
const suffix = groupKey ? `?group=${encodeURIComponent(groupKey)}` : "";
|
|
5464
|
+
const body = await getRead(`/${encodeURIComponent(id)}${suffix}`, `${kind} ${id}`);
|
|
5465
|
+
if (typeof body === "number") return body;
|
|
5466
|
+
const v = body?.[kind] ?? body?.value ?? body?.total;
|
|
5467
|
+
return typeof v === "number" ? v : Number(v ?? 0);
|
|
5468
|
+
};
|
|
5469
|
+
const poll = (read, cb, intervalMs) => {
|
|
5470
|
+
let stopped = false;
|
|
5471
|
+
let timer;
|
|
5472
|
+
const tick = async () => {
|
|
5473
|
+
if (stopped) return;
|
|
5474
|
+
try {
|
|
5475
|
+
cb(await read());
|
|
5476
|
+
} catch {
|
|
5477
|
+
}
|
|
5478
|
+
if (!stopped) timer = setTimeout(tick, intervalMs);
|
|
5479
|
+
};
|
|
5480
|
+
void tick();
|
|
5481
|
+
return () => {
|
|
5482
|
+
stopped = true;
|
|
5483
|
+
if (timer) clearTimeout(timer);
|
|
5484
|
+
};
|
|
5485
|
+
};
|
|
5486
|
+
const defaultInterval = opts.watchIntervalMs ?? 2e3;
|
|
5487
|
+
const principal = opts.principal ?? (opts.authToken ? (() => {
|
|
5488
|
+
try {
|
|
5489
|
+
const seg = opts.authToken.split(".")[1] ?? "";
|
|
5490
|
+
const b = seg.replace(/-/g, "+").replace(/_/g, "/") + "===".slice((seg.length + 3) % 4);
|
|
5491
|
+
const claims = JSON.parse(
|
|
5492
|
+
typeof atob === "function" ? atob(b) : nodeBuffer()?.from(b, "base64").toString("utf8") ?? ""
|
|
5493
|
+
);
|
|
5494
|
+
return claims.sub;
|
|
5495
|
+
} catch {
|
|
5496
|
+
return void 0;
|
|
5497
|
+
}
|
|
5498
|
+
})() : void 0);
|
|
5499
|
+
return {
|
|
5500
|
+
workspace,
|
|
5501
|
+
cloud: base,
|
|
5502
|
+
principal,
|
|
5503
|
+
offerDirective,
|
|
5504
|
+
query: query3,
|
|
5505
|
+
queryById,
|
|
5506
|
+
count: (countId, groupKey) => tally("count", countId, groupKey),
|
|
5507
|
+
sum: (sumId, groupKey) => tally("sum", sumId, groupKey),
|
|
5508
|
+
deadLetters: () => getRead(`/dead-letters`, "deadLetters"),
|
|
5509
|
+
retryDeadLetter: async (id) => {
|
|
5510
|
+
const r = await _fetch(wsUrl(`/dead-letters/retry?id=${encodeURIComponent(id)}`), {
|
|
5511
|
+
method: "POST",
|
|
5512
|
+
headers: headers(false)
|
|
5513
|
+
});
|
|
5514
|
+
const body = await readJson(r, `retryDeadLetter ${id}`);
|
|
5515
|
+
const retried = body.retried?.find((entry) => entry.intentId === id) ?? body.retried?.[0];
|
|
5516
|
+
if (retried) return { ok: true, ...retried.head ? { head: retried.head } : {} };
|
|
5517
|
+
const failed = body.failed?.find((entry) => entry.intentId === id) ?? body.failed?.[0];
|
|
5518
|
+
return { ok: false, error: failed?.error ?? `dead letter '${id}' was not retried` };
|
|
5519
|
+
},
|
|
5520
|
+
discardDeadLetter: async (id) => {
|
|
5521
|
+
const r = await _fetch(wsUrl(`/dead-letters?id=${encodeURIComponent(id)}`), {
|
|
5522
|
+
method: "DELETE",
|
|
5523
|
+
headers: headers(false)
|
|
5524
|
+
});
|
|
5525
|
+
const body = await readJson(r, `discardDeadLetter ${id}`);
|
|
5526
|
+
return { ok: true, removed: Number(body.discarded ?? body.removed ?? 0) };
|
|
5527
|
+
},
|
|
5528
|
+
watch: (queryId, params, cb, o) => poll(() => query3(queryId, params), cb, o?.intervalMs ?? defaultInterval),
|
|
5529
|
+
watchById: (aggregateId, cb, o) => poll(() => queryById(aggregateId), cb, o?.intervalMs ?? defaultInterval),
|
|
5530
|
+
/** The workspace's kernel-derived OpenAPI — the code-mode agent's map. */
|
|
5531
|
+
openapi: () => getRead(`/openapi.json`, "openapi")
|
|
5532
|
+
};
|
|
5533
|
+
}
|
|
5534
|
+
var nodeBuffer, RemoteOfferRefusedError, b64;
|
|
5535
|
+
var init_remote_holon = __esm({
|
|
5536
|
+
"../cloud/web-client/src/remote_holon.ts"() {
|
|
5537
|
+
"use strict";
|
|
5538
|
+
init_intent_offer_codec();
|
|
5539
|
+
nodeBuffer = () => globalThis.Buffer;
|
|
5540
|
+
RemoteOfferRefusedError = class extends Error {
|
|
5541
|
+
refused = true;
|
|
5542
|
+
status;
|
|
5543
|
+
constructor(message, status2) {
|
|
5544
|
+
super(message);
|
|
5545
|
+
this.name = "RemoteOfferRefusedError";
|
|
5546
|
+
this.status = status2;
|
|
5547
|
+
}
|
|
5548
|
+
};
|
|
5549
|
+
b64 = (bytes) => {
|
|
5550
|
+
let s = "";
|
|
5551
|
+
for (let i = 0; i < bytes.length; i += 32768) {
|
|
5552
|
+
s += String.fromCharCode(...bytes.subarray(i, i + 32768));
|
|
5553
|
+
}
|
|
5554
|
+
if (typeof btoa === "function") return btoa(s);
|
|
5555
|
+
const buffer = nodeBuffer();
|
|
5556
|
+
if (buffer) return buffer.from(bytes).toString("base64");
|
|
5557
|
+
throw new Error("base64 encoding is unavailable in this runtime");
|
|
5558
|
+
};
|
|
5559
|
+
}
|
|
5560
|
+
});
|
|
5561
|
+
|
|
5374
5562
|
// ../cloud/web-client/src/index.ts
|
|
5375
5563
|
var src_exports = {};
|
|
5376
5564
|
__export(src_exports, {
|
|
@@ -5385,12 +5573,14 @@ __export(src_exports, {
|
|
|
5385
5573
|
OfferDecisionError: () => OfferDecisionError,
|
|
5386
5574
|
OwnedRecoveryPendingError: () => OwnedRecoveryPendingError,
|
|
5387
5575
|
ParentSignerEnrollmentMissingError: () => ParentSignerEnrollmentMissingError,
|
|
5576
|
+
RemoteOfferRefusedError: () => RemoteOfferRefusedError,
|
|
5388
5577
|
assessKernelCoherence: () => assessKernelCoherence,
|
|
5389
5578
|
authzDiagnosisFromRefusal: () => authzDiagnosisFromRefusal,
|
|
5390
5579
|
birthOutcomeFailure: () => birthOutcomeFailure,
|
|
5391
5580
|
canonicalPrincipal: () => canonicalPrincipal,
|
|
5392
5581
|
checkCompat: () => checkCompat,
|
|
5393
5582
|
connect: () => connect,
|
|
5583
|
+
connectRemote: () => connectRemote,
|
|
5394
5584
|
createWasmEnginePlane: () => createWasmEnginePlane,
|
|
5395
5585
|
createWasmKernelProvider: () => createWasmKernelProvider,
|
|
5396
5586
|
deriveWorkspaceName: () => deriveWorkspaceName,
|
|
@@ -5457,18 +5647,6 @@ function normalizeReferenceVersionTransport(refs) {
|
|
|
5457
5647
|
}
|
|
5458
5648
|
return { unique, order };
|
|
5459
5649
|
}
|
|
5460
|
-
function encodeIntentOfferBytes({ domain, directiveId, payload, domainHash, security, actor }) {
|
|
5461
|
-
const envelope = { v: 2, intent: { domain, directiveId, payload, domainHash } };
|
|
5462
|
-
const securitySidecar = security && typeof security === "object" && !Array.isArray(security) ? { ...security } : {};
|
|
5463
|
-
if (actor) securitySidecar.actor = actor;
|
|
5464
|
-
if (typeof securitySidecar.actor === "string") {
|
|
5465
|
-
const a = securitySidecar.actor.trim();
|
|
5466
|
-
if (a) securitySidecar.actor = a;
|
|
5467
|
-
else delete securitySidecar.actor;
|
|
5468
|
-
}
|
|
5469
|
-
if (Object.keys(securitySidecar).length > 0) envelope.security = securitySidecar;
|
|
5470
|
-
return enc4.encode(JSON.stringify(envelope));
|
|
5471
|
-
}
|
|
5472
5650
|
function decodeIntentOfferBytes(intentBytes) {
|
|
5473
5651
|
const bytes = typeof intentBytes === "string" ? bytesUnb64(intentBytes) : intentBytes;
|
|
5474
5652
|
if (!(bytes instanceof Uint8Array)) throw new Error("offer requires opaque intentBytes");
|
|
@@ -6360,13 +6538,13 @@ ${String(commit).toLowerCase()}`;
|
|
|
6360
6538
|
}, _fetch);
|
|
6361
6539
|
return { ref: sessionRef, bytes: pack.byteLength };
|
|
6362
6540
|
}
|
|
6363
|
-
const
|
|
6541
|
+
const b642 = (bytes) => {
|
|
6364
6542
|
let s = "";
|
|
6365
6543
|
for (let i = 0; i < bytes.length; i += 32768) s += String.fromCharCode.apply(null, Array.from(bytes.subarray(i, i + 32768)));
|
|
6366
6544
|
return btoa(s);
|
|
6367
6545
|
};
|
|
6368
6546
|
const unb64 = (s) => Uint8Array.from(atob(s), (c) => c.charCodeAt(0));
|
|
6369
|
-
const { readDlq, writeDlq, deadLetter } = createDeadLetters({ provider, enc: enc4, dec: dec4, b64 });
|
|
6547
|
+
const { readDlq, writeDlq, deadLetter } = createDeadLetters({ provider, enc: enc4, dec: dec4, b64: b642 });
|
|
6370
6548
|
const edgeRefused = /* @__PURE__ */ new Set();
|
|
6371
6549
|
async function pullInner(edgeRejections = null, prefetchedHead = null, opts = {}) {
|
|
6372
6550
|
let remoteHead = prefetchedHead;
|
|
@@ -7061,7 +7239,7 @@ ${String(commit).toLowerCase()}`;
|
|
|
7061
7239
|
if (returnSealed) {
|
|
7062
7240
|
const d = res.intentOut && provider.readWsFile(res.intentOut);
|
|
7063
7241
|
if (!d) throw new Error(`sealed offer: the author produced no sealed intent bytes (intentOut=${res.intentOut ?? "?"})`);
|
|
7064
|
-
sealedB64 =
|
|
7242
|
+
sealedB64 = b642(d);
|
|
7065
7243
|
}
|
|
7066
7244
|
let created = null;
|
|
7067
7245
|
let affected = null;
|
|
@@ -9829,7 +10007,7 @@ ${String(commit).toLowerCase()}`;
|
|
|
9829
10007
|
* wasm decodes the id's route tag and resolves its folded shard map. Returns `{ ok, tag, shard }`
|
|
9830
10008
|
* (`shard:""` = a known-tag but unplaced home; `tag:null` = not a route-tagged id). The routed wrapper
|
|
9831
10009
|
* uses this to CARRY an offer to the right shard — the DECISION is the holon's, the client only carries. */
|
|
9832
|
-
route: (id) => serialize(async () => JSON.parse(call("query", { queryBytes:
|
|
10010
|
+
route: (id) => serialize(async () => JSON.parse(call("query", { queryBytes: b642(enc4.encode(JSON.stringify({ op: "route", id }))) }))),
|
|
9833
10011
|
/** The PLANNED-PAYLOAD write surface (domain/directiveId/payload) — the routed wrapper delegates to this
|
|
9834
10012
|
* on the resolved shard (the CARRY, not a decision; routing is `route(id)`, the holon's). */
|
|
9835
10013
|
dispatch: (domain, directiveId, payload, opts = {}) => offerDirective(domain, directiveId, payload, opts),
|
|
@@ -11364,10 +11542,13 @@ var init_src2 = __esm({
|
|
|
11364
11542
|
init_governance_offers();
|
|
11365
11543
|
init_serialized_scheduler();
|
|
11366
11544
|
init_kernel_pb();
|
|
11545
|
+
init_intent_offer_codec();
|
|
11546
|
+
init_intent_offer_codec();
|
|
11367
11547
|
init_kernel_provider_wasm();
|
|
11368
11548
|
init_errors();
|
|
11369
11549
|
init_principal();
|
|
11370
11550
|
init_kernel_coherence();
|
|
11551
|
+
init_remote_holon();
|
|
11371
11552
|
enc4 = new TextEncoder();
|
|
11372
11553
|
dec4 = new TextDecoder();
|
|
11373
11554
|
BRANCH = "main";
|
|
@@ -11410,8 +11591,8 @@ var init_src2 = __esm({
|
|
|
11410
11591
|
jwtClaim = (token, claim) => {
|
|
11411
11592
|
try {
|
|
11412
11593
|
const seg = String(token).split(".")[1];
|
|
11413
|
-
const
|
|
11414
|
-
return JSON.parse(new TextDecoder().decode(bytesUnb64(
|
|
11594
|
+
const b642 = seg.replace(/-/g, "+").replace(/_/g, "/") + "===".slice((seg.length + 3) % 4);
|
|
11595
|
+
return JSON.parse(new TextDecoder().decode(bytesUnb64(b642)))[claim];
|
|
11415
11596
|
} catch {
|
|
11416
11597
|
return void 0;
|
|
11417
11598
|
}
|
|
@@ -11768,7 +11949,10 @@ var init_custody_transport2 = __esm({
|
|
|
11768
11949
|
// vendor/engine/managed-promotion.ts
|
|
11769
11950
|
function prepareManagedPromotion2(report, candidateHash, domain, opts = {}) {
|
|
11770
11951
|
if (!report.sourceVerified || !report.complete || !report.evolve?.ok) {
|
|
11771
|
-
const reason = !report.sourceVerified ? "the source ledger did not verify" : !report.complete ? "some historical premises could not be re-derived" :
|
|
11952
|
+
const reason = !report.sourceVerified ? "the source ledger did not verify" : !report.complete ? "some historical premises could not be re-derived" : [
|
|
11953
|
+
"the candidate fails deterministic schema evolution",
|
|
11954
|
+
...report.evolve.violations.map((violation) => violation.detail)
|
|
11955
|
+
].join(": ");
|
|
11772
11956
|
return { ok: false, stage: "preflight", report, error: `promotion refused: ${reason}` };
|
|
11773
11957
|
}
|
|
11774
11958
|
const acceptanceReason = opts.acceptanceReason?.trim();
|
|
@@ -12310,17 +12494,18 @@ function offerResult(response) {
|
|
|
12310
12494
|
}
|
|
12311
12495
|
}
|
|
12312
12496
|
function applicationQueryProto(eng, ws, query3, options = {}) {
|
|
12497
|
+
const hasAuthority = options.principal !== void 0 || options.keys !== void 0 || options.authToken !== void 0 || options.nowUnix !== void 0 || options.authorSecret !== void 0;
|
|
12313
12498
|
const response = callProto(eng.ex, {
|
|
12314
12499
|
case: "query",
|
|
12315
12500
|
value: create2(QueryRequestSchema2, {
|
|
12316
12501
|
target: protoTarget2(ws, options.branch ?? BRANCH2),
|
|
12317
|
-
authority: protoAuthority(
|
|
12502
|
+
authority: hasAuthority ? protoAuthority(
|
|
12318
12503
|
options.principal,
|
|
12319
12504
|
options.keys,
|
|
12320
12505
|
options.authToken,
|
|
12321
12506
|
options.nowUnix,
|
|
12322
12507
|
options.authorSecret
|
|
12323
|
-
),
|
|
12508
|
+
) : void 0,
|
|
12324
12509
|
spans: options.spans ?? false,
|
|
12325
12510
|
query: query3
|
|
12326
12511
|
})
|
|
@@ -15150,7 +15335,7 @@ var init_engine = __esm({
|
|
|
15150
15335
|
}))
|
|
15151
15336
|
});
|
|
15152
15337
|
repoArgOfGitdir = (gitdir) => gitdir.replace(/\/nomos\.git$/, "");
|
|
15153
|
-
bytesFromB64 = (
|
|
15338
|
+
bytesFromB64 = (b642) => Uint8Array.from(atob(b642), (c) => c.charCodeAt(0));
|
|
15154
15339
|
kgit = {
|
|
15155
15340
|
// resolveRef → tip oid hex, or null if the ref is absent (replaces git.resolveRef(...).catch(()=>null)).
|
|
15156
15341
|
resolveRef: (eng, gitdir, ref) => custodyProtoCase(eng, {
|
|
@@ -15439,12 +15624,10 @@ var init_engine = __esm({
|
|
|
15439
15624
|
const recordObject = record === void 0 ? void 0 : `${record.type}:${record.id}`;
|
|
15440
15625
|
const derived = namedQueryProto(eng, workspace, QueryOperation2.CRYPTO_OWNED_SCOPE_KEY, {
|
|
15441
15626
|
custodyWorkspace: workspace,
|
|
15442
|
-
principal,
|
|
15443
|
-
authorSecret,
|
|
15444
15627
|
scope,
|
|
15445
15628
|
...recordObject === void 0 ? {} : { recordObject, recordEpoch },
|
|
15446
15629
|
...recordWrap === void 0 ? {} : { recordWrap }
|
|
15447
|
-
});
|
|
15630
|
+
}, { principal, authorSecret });
|
|
15448
15631
|
const ownedKeySubject = String(derived.ownedKeySubject || "");
|
|
15449
15632
|
if (!requireSeat) {
|
|
15450
15633
|
return {
|
|
@@ -15461,7 +15644,16 @@ var init_engine = __esm({
|
|
|
15461
15644
|
let hex = "";
|
|
15462
15645
|
for (const byte of enc7.encode(principal)) hex += byte.toString(16).padStart(2, "0");
|
|
15463
15646
|
const object = `nomos-owned-principal:${hex || "00"}`;
|
|
15464
|
-
const rows = qById(
|
|
15647
|
+
const rows = qById(
|
|
15648
|
+
eng,
|
|
15649
|
+
workspace,
|
|
15650
|
+
`reltuple-${object}-nomos_internal_owned_device_key_7c1f5e`,
|
|
15651
|
+
principal,
|
|
15652
|
+
[],
|
|
15653
|
+
"",
|
|
15654
|
+
0,
|
|
15655
|
+
authorSecret
|
|
15656
|
+
);
|
|
15465
15657
|
const row = Array.isArray(rows) ? rows[0] : rows?.rows?.[0];
|
|
15466
15658
|
const leaves = row?.data?.subjects ?? row?.subjects ?? {};
|
|
15467
15659
|
const leaf = (raw) => {
|
|
@@ -15492,14 +15684,12 @@ var init_engine = __esm({
|
|
|
15492
15684
|
const custody = String(leaf(leaves[ownedKeySubject]).ownedCustody || "");
|
|
15493
15685
|
if (!custody) throw new Error("the approved device has no owned-data handoff");
|
|
15494
15686
|
const opened = namedQueryProto(eng, workspace, QueryOperation2.CRYPTO_OWNED_SCOPE_KEY, {
|
|
15495
|
-
workspace,
|
|
15496
|
-
principal,
|
|
15497
|
-
authorSecret,
|
|
15687
|
+
custodyWorkspace: workspace,
|
|
15498
15688
|
scope,
|
|
15499
15689
|
ownedCustody: custody,
|
|
15500
15690
|
...recordObject === void 0 ? {} : { recordObject, recordEpoch },
|
|
15501
15691
|
...recordWrap === void 0 ? {} : { recordWrap }
|
|
15502
|
-
});
|
|
15692
|
+
}, { principal, authorSecret });
|
|
15503
15693
|
return {
|
|
15504
15694
|
scope: String(opened.scope || scope),
|
|
15505
15695
|
epoch: Number(opened.epoch) || 0,
|
|
@@ -15520,11 +15710,8 @@ var init_engine = __esm({
|
|
|
15520
15710
|
};
|
|
15521
15711
|
};
|
|
15522
15712
|
cryptoOwnedDeviceRequest = (eng, workspace, principal, authorSecret, scope) => String(namedQueryProto(eng, workspace, QueryOperation2.CRYPTO_OWNED_DEVICE_REQUEST, {
|
|
15523
|
-
workspace,
|
|
15524
|
-
principal,
|
|
15525
|
-
authorSecret,
|
|
15526
15713
|
scope
|
|
15527
|
-
}).request || "");
|
|
15714
|
+
}, { principal, authorSecret }).request || "");
|
|
15528
15715
|
cryptoOwnedPrepareApproval = (eng, args) => namedQueryProto(eng, args.workspace, QueryOperation2.CRYPTO_OWNED_PREPARE_APPROVAL, args);
|
|
15529
15716
|
cryptoOwnedPrepareRecovery = (eng, args) => namedQueryProto(eng, args.workspace, QueryOperation2.CRYPTO_OWNED_PREPARE_RECOVERY, args);
|
|
15530
15717
|
cryptoKeygen = (eng) => namedQueryProto(eng, "root", QueryOperation2.CRYPTO_KEYGEN);
|
|
@@ -15562,7 +15749,10 @@ var init_engine = __esm({
|
|
|
15562
15749
|
...authProviderJwks !== void 0 ? { authProviderJwks } : {},
|
|
15563
15750
|
...authProviderAudience !== void 0 ? { authProviderAudience } : {}
|
|
15564
15751
|
}).cert;
|
|
15565
|
-
cryptoWrapKey = (eng, { recipientPub, scopeKey }) =>
|
|
15752
|
+
cryptoWrapKey = (eng, { recipientPub, scopeKey }) => {
|
|
15753
|
+
const result = namedQueryProto(eng, "root", QueryOperation2.CRYPTO_WRAP_KEY, { recipientPub, scopeKey });
|
|
15754
|
+
return { hpkeEpk: String(result.hpkeEpk ?? ""), ct: String(result.ct ?? "") };
|
|
15755
|
+
};
|
|
15566
15756
|
cryptoUnwrapKey = (eng, { secret, hpkeEpk, ct }) => namedQueryProto(eng, "root", QueryOperation2.CRYPTO_UNWRAP_KEY, { secret, hpkeEpk, ct }).scopeKey;
|
|
15567
15757
|
readPosture = (eng, ws, principal = "", authToken = "", nowUnix = 0, authorSecret = "") => namedQueryProto(
|
|
15568
15758
|
eng,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "githolon",
|
|
3
|
-
"version": "0.105.
|
|
3
|
+
"version": "0.105.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "githolon — the Nomos developer CLI: Rails-style generators for @githolon/dsl domains + the package compiler. Kernel-independent.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@bjorn3/browser_wasi_shim": "0.4.2",
|
|
32
32
|
"@bufbuild/protobuf": "^2.13.0",
|
|
33
|
-
"@githolon/dsl": "^0.105.
|
|
33
|
+
"@githolon/dsl": "^0.105.8",
|
|
34
34
|
"isomorphic-git": "^1.38.4",
|
|
35
35
|
"tsx": "^4.19.2"
|
|
36
36
|
},
|