@tinycloud/operations 0.1.0-beta.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/artifacts.cjs.map +1 -1
- package/dist/artifacts.js.map +1 -1
- package/dist/cli-runtime.cjs +476 -102
- package/dist/cli-runtime.cjs.map +1 -1
- package/dist/cli-runtime.js +474 -100
- package/dist/cli-runtime.js.map +1 -1
- package/dist/index.cjs +463 -89
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +461 -87
- package/dist/index.js.map +1 -1
- package/generated/operations.json +4580 -876
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -6528,9 +6528,9 @@ function evaluateAuthority(granted, required) {
|
|
|
6528
6528
|
missing: canonicalizeCapabilities(result.missing)
|
|
6529
6529
|
};
|
|
6530
6530
|
}
|
|
6531
|
-
function evaluateOperationAuthority(granted, required,
|
|
6532
|
-
const canonicalGranted = canonicalizeOperationCapabilities(granted,
|
|
6533
|
-
const canonicalRequired = canonicalizeOperationCapabilities(required,
|
|
6531
|
+
function evaluateOperationAuthority(granted, required, resolveSpace2) {
|
|
6532
|
+
const canonicalGranted = canonicalizeOperationCapabilities(granted, resolveSpace2);
|
|
6533
|
+
const canonicalRequired = canonicalizeOperationCapabilities(required, resolveSpace2);
|
|
6534
6534
|
const missing = [];
|
|
6535
6535
|
for (const requested of canonicalRequired) {
|
|
6536
6536
|
const covered = canonicalGranted.some(
|
|
@@ -6543,21 +6543,21 @@ function evaluateOperationAuthority(granted, required, resolveSpace) {
|
|
|
6543
6543
|
missing: canonicalizeCapabilities(missing)
|
|
6544
6544
|
};
|
|
6545
6545
|
}
|
|
6546
|
-
function isExactCapabilityMemberSubset(hinted, planned,
|
|
6547
|
-
const canonicalHinted = canonicalizeOperationCapabilities(hinted,
|
|
6548
|
-
const canonicalPlanned = canonicalizeOperationCapabilities(planned,
|
|
6546
|
+
function isExactCapabilityMemberSubset(hinted, planned, resolveSpace2) {
|
|
6547
|
+
const canonicalHinted = canonicalizeOperationCapabilities(hinted, resolveSpace2);
|
|
6548
|
+
const canonicalPlanned = canonicalizeOperationCapabilities(planned, resolveSpace2);
|
|
6549
6549
|
return canonicalHinted.length > 0 && canonicalHinted.every((hint) => canonicalPlanned.some(
|
|
6550
6550
|
(plan) => JSON.stringify(hint) === JSON.stringify(plan)
|
|
6551
6551
|
));
|
|
6552
6552
|
}
|
|
6553
|
-
function canonicalizeOperationCapabilities(permissions,
|
|
6553
|
+
function canonicalizeOperationCapabilities(permissions, resolveSpace2) {
|
|
6554
6554
|
return canonicalizeCapabilities(permissions.map((permission) => {
|
|
6555
6555
|
const canonicalPath = canonicalizeOperationPath(permission);
|
|
6556
|
-
if (permission.space === void 0 ||
|
|
6556
|
+
if (permission.space === void 0 || resolveSpace2 === void 0) {
|
|
6557
6557
|
return canonicalPath;
|
|
6558
6558
|
}
|
|
6559
6559
|
try {
|
|
6560
|
-
return { ...canonicalPath, space:
|
|
6560
|
+
return { ...canonicalPath, space: resolveSpace2(permission.space) };
|
|
6561
6561
|
} catch {
|
|
6562
6562
|
return canonicalPath;
|
|
6563
6563
|
}
|
|
@@ -6611,7 +6611,7 @@ function isExactPermission(value) {
|
|
|
6611
6611
|
if (!isExactRecord(value) || Object.getOwnPropertyNames(value).some((key) => !EXACT_PERMISSION_KEYS.has(key)) || Object.getOwnPropertySymbols(value).length > 0) {
|
|
6612
6612
|
return false;
|
|
6613
6613
|
}
|
|
6614
|
-
if (!isExactText(value.service) || !isExactPath(value.path) || value.space !== void 0 && !isExactText(value.space) || !Array.isArray(value.actions) || value.actions.length === 0 || !value.actions.every(isExactText) || new Set(value.actions).size !== value.actions.length || value.skipPrefix === true || value.skipPrefix !== void 0 && value.skipPrefix !== false || value.expiry !== void 0 && !isExactText(value.expiry) || value.description !== void 0 && !isExactText(value.description)) {
|
|
6614
|
+
if (!isExactText(value.service) || !isExactPath(value.path, value.actions) || value.space !== void 0 && !isExactText(value.space) || !Array.isArray(value.actions) || value.actions.length === 0 || !value.actions.every(isExactText) || new Set(value.actions).size !== value.actions.length || value.skipPrefix === true || value.skipPrefix !== void 0 && value.skipPrefix !== false || value.expiry !== void 0 && !isExactText(value.expiry) || value.description !== void 0 && !isExactText(value.description)) {
|
|
6615
6615
|
return false;
|
|
6616
6616
|
}
|
|
6617
6617
|
return !("caveats" in value);
|
|
@@ -6624,8 +6624,12 @@ function isExactRecord(value) {
|
|
|
6624
6624
|
function isExactText(value) {
|
|
6625
6625
|
return typeof value === "string" && value.length > 0 && !value.includes("*");
|
|
6626
6626
|
}
|
|
6627
|
-
function isExactPath(value) {
|
|
6628
|
-
|
|
6627
|
+
function isExactPath(value, actions) {
|
|
6628
|
+
if (typeof value !== "string" || value === "/" || value.includes("*")) return false;
|
|
6629
|
+
if (value === "" || value.endsWith("/")) {
|
|
6630
|
+
return Array.isArray(actions) && actions.includes("tinycloud.kv/list");
|
|
6631
|
+
}
|
|
6632
|
+
return true;
|
|
6629
6633
|
}
|
|
6630
6634
|
function canonicalizeCaveats(caveats) {
|
|
6631
6635
|
return [...caveats].map((caveat) => ({
|
|
@@ -7126,8 +7130,8 @@ function permissionRequestArtifactIdentity(record) {
|
|
|
7126
7130
|
missing: record.requested
|
|
7127
7131
|
});
|
|
7128
7132
|
}
|
|
7129
|
-
function evaluateArtifactAuthority(granted, required,
|
|
7130
|
-
return
|
|
7133
|
+
function evaluateArtifactAuthority(granted, required, resolveSpace2) {
|
|
7134
|
+
return resolveSpace2 === void 0 ? evaluateAuthority(granted, required) : evaluateOperationAuthority(granted, required, resolveSpace2);
|
|
7131
7135
|
}
|
|
7132
7136
|
function defaultRequestId(now) {
|
|
7133
7137
|
return `req_${now.getTime().toString(36)}_${(0, import_node_crypto2.randomUUID)().replace(/-/g, "")}`;
|
|
@@ -7252,7 +7256,7 @@ function operationSpaceResolver(node, ownerSpace) {
|
|
|
7252
7256
|
function resolveOperationSpace(space, node, ownerSpace) {
|
|
7253
7257
|
if (space.startsWith("tinycloud:")) return canonicalizeSpaceUri(space);
|
|
7254
7258
|
const ownerSpaceId = ownerSpace === void 0 ? void 0 : ownedSpaceForName(ownerSpace, space);
|
|
7255
|
-
if (ownerSpaceId !== void 0) return ownerSpaceId;
|
|
7259
|
+
if (ownerSpaceId !== void 0) return canonicalizeSpaceUri(ownerSpaceId);
|
|
7256
7260
|
const candidate = node;
|
|
7257
7261
|
try {
|
|
7258
7262
|
const resolved = candidate.resolveOwnedSpace?.(space);
|
|
@@ -7263,7 +7267,7 @@ function resolveOperationSpace(space, node, ownerSpace) {
|
|
|
7263
7267
|
}
|
|
7264
7268
|
if (typeof candidate.spaceId === "string") {
|
|
7265
7269
|
const resolved = ownedSpaceForName(candidate.spaceId, space);
|
|
7266
|
-
if (resolved !== void 0) return resolved;
|
|
7270
|
+
if (resolved !== void 0) return canonicalizeSpaceUri(resolved);
|
|
7267
7271
|
}
|
|
7268
7272
|
const did = typeof candidate.did === "string" ? candidate.did : void 0;
|
|
7269
7273
|
const pkh = did === void 0 ? null : (0, import_node_sdk.parsePkhDid)(did);
|
|
@@ -7501,14 +7505,14 @@ async function importRequestBoundDelegation(context, input) {
|
|
|
7501
7505
|
);
|
|
7502
7506
|
}
|
|
7503
7507
|
const effectivePermissions = canonicalizeCapabilities(activated.effectivePermissions);
|
|
7504
|
-
const
|
|
7508
|
+
const resolveSpace2 = operationSpaceResolver(
|
|
7505
7509
|
context.runtime.node,
|
|
7506
7510
|
context.summary.space
|
|
7507
7511
|
);
|
|
7508
7512
|
if (request.requested.length === 0 || !evaluateOperationAuthority(
|
|
7509
7513
|
request.requested,
|
|
7510
7514
|
effectivePermissions,
|
|
7511
|
-
|
|
7515
|
+
resolveSpace2
|
|
7512
7516
|
).satisfied) {
|
|
7513
7517
|
return operationFailure(
|
|
7514
7518
|
"DELEGATION_REJECTED",
|
|
@@ -7528,7 +7532,7 @@ async function importRequestBoundDelegation(context, input) {
|
|
|
7528
7532
|
result: audienceMismatch(state.sessionDid, sessionDid)
|
|
7529
7533
|
};
|
|
7530
7534
|
}
|
|
7531
|
-
if (state.request.profile !== context.summary.profile || !samePrincipal(state.request.sessionDid, sessionDid) || normalizeHost(state.request.host) !== normalizeHost(host) || JSON.stringify(canonicalizeOperationCapabilities(state.request.requested,
|
|
7535
|
+
if (state.request.profile !== context.summary.profile || !samePrincipal(state.request.sessionDid, sessionDid) || normalizeHost(state.request.host) !== normalizeHost(host) || JSON.stringify(canonicalizeOperationCapabilities(state.request.requested, resolveSpace2)) !== JSON.stringify(canonicalizeOperationCapabilities(request.requested, resolveSpace2))) {
|
|
7532
7536
|
return {
|
|
7533
7537
|
records,
|
|
7534
7538
|
result: operationFailure(
|
|
@@ -7806,6 +7810,374 @@ var init_auth = __esm({
|
|
|
7806
7810
|
}
|
|
7807
7811
|
});
|
|
7808
7812
|
|
|
7813
|
+
// src/operations/exploration.ts
|
|
7814
|
+
async function planAccountRegistryRead(context, path) {
|
|
7815
|
+
return [{
|
|
7816
|
+
service: "tinycloud.kv",
|
|
7817
|
+
space: resolveSpace(context, "account"),
|
|
7818
|
+
path,
|
|
7819
|
+
actions: ["tinycloud.kv/get", "tinycloud.kv/list"]
|
|
7820
|
+
}];
|
|
7821
|
+
}
|
|
7822
|
+
async function planKvList(context, input) {
|
|
7823
|
+
const space = resolveNonSecretSpace(context, input.space);
|
|
7824
|
+
return [{
|
|
7825
|
+
service: "tinycloud.kv",
|
|
7826
|
+
space,
|
|
7827
|
+
path: input.prefix ?? "",
|
|
7828
|
+
actions: ["tinycloud.kv/list"]
|
|
7829
|
+
}];
|
|
7830
|
+
}
|
|
7831
|
+
async function planKvGet(context, input) {
|
|
7832
|
+
const space = resolveNonSecretSpace(context, input.space);
|
|
7833
|
+
return [{
|
|
7834
|
+
service: "tinycloud.kv",
|
|
7835
|
+
space,
|
|
7836
|
+
path: input.key,
|
|
7837
|
+
actions: ["tinycloud.kv/get"]
|
|
7838
|
+
}];
|
|
7839
|
+
}
|
|
7840
|
+
async function executeAccountSpacesList(context, _input) {
|
|
7841
|
+
try {
|
|
7842
|
+
const entries = await readAccountRegistry(context, "spaces/");
|
|
7843
|
+
if (!entries.ok) return nodeFailure("list account spaces");
|
|
7844
|
+
const spaces = entries.records.map(({ key, value }) => projectAccountSpace(key, value)).sort((left, right) => left.name.localeCompare(right.name) || left.spaceId.localeCompare(right.spaceId));
|
|
7845
|
+
return { status: "ok", output: { spaces, count: spaces.length } };
|
|
7846
|
+
} catch {
|
|
7847
|
+
return nodeFailure("list account spaces");
|
|
7848
|
+
}
|
|
7849
|
+
}
|
|
7850
|
+
async function executeAccountApplicationsList(context, _input) {
|
|
7851
|
+
try {
|
|
7852
|
+
const entries = await readAccountRegistry(context, "applications/");
|
|
7853
|
+
if (!entries.ok) return nodeFailure("list account applications");
|
|
7854
|
+
const applications = entries.records.map(({ key, value }) => projectAccountApplication(key, value)).sort((left, right) => left.appId.localeCompare(right.appId));
|
|
7855
|
+
return { status: "ok", output: { applications, count: applications.length } };
|
|
7856
|
+
} catch {
|
|
7857
|
+
return nodeFailure("list account applications");
|
|
7858
|
+
}
|
|
7859
|
+
}
|
|
7860
|
+
async function executeKvList(context, input) {
|
|
7861
|
+
try {
|
|
7862
|
+
const runtime = runtimeContext(context);
|
|
7863
|
+
const space = resolveNonSecretSpace(runtime, input.space);
|
|
7864
|
+
const result = await runtimeNode(runtime).kvForSpace(space).list(
|
|
7865
|
+
input.prefix === void 0 ? void 0 : { prefix: input.prefix }
|
|
7866
|
+
);
|
|
7867
|
+
if (!result.ok) return nodeFailure("list KV keys");
|
|
7868
|
+
const keys = [...result.data.keys];
|
|
7869
|
+
return {
|
|
7870
|
+
status: "ok",
|
|
7871
|
+
output: { space, prefix: input.prefix ?? "", keys, count: keys.length }
|
|
7872
|
+
};
|
|
7873
|
+
} catch (error) {
|
|
7874
|
+
if (error instanceof OperationInvocationError) {
|
|
7875
|
+
return { status: "error", error: error.operationError };
|
|
7876
|
+
}
|
|
7877
|
+
return nodeFailure("list KV keys");
|
|
7878
|
+
}
|
|
7879
|
+
}
|
|
7880
|
+
async function executeKvGet(context, input) {
|
|
7881
|
+
try {
|
|
7882
|
+
const runtime = runtimeContext(context);
|
|
7883
|
+
const space = resolveNonSecretSpace(runtime, input.space);
|
|
7884
|
+
const result = await runtimeNode(runtime).kvForSpace(space).get(input.key);
|
|
7885
|
+
if (!result.ok) return nodeFailure("read the KV value");
|
|
7886
|
+
const encoded = encodeKvValue(result.data.data);
|
|
7887
|
+
return {
|
|
7888
|
+
status: "ok",
|
|
7889
|
+
output: {
|
|
7890
|
+
space,
|
|
7891
|
+
key: input.key,
|
|
7892
|
+
value: encoded.value,
|
|
7893
|
+
encoding: encoded.encoding,
|
|
7894
|
+
metadata: {
|
|
7895
|
+
...result.data.headers.etag === void 0 ? {} : { etag: result.data.headers.etag },
|
|
7896
|
+
...result.data.headers.contentType === void 0 ? {} : { contentType: result.data.headers.contentType },
|
|
7897
|
+
...result.data.headers.lastModified === void 0 ? {} : { lastModified: result.data.headers.lastModified },
|
|
7898
|
+
...result.data.headers.contentLength === void 0 ? {} : { contentLength: result.data.headers.contentLength }
|
|
7899
|
+
}
|
|
7900
|
+
}
|
|
7901
|
+
};
|
|
7902
|
+
} catch (error) {
|
|
7903
|
+
if (error instanceof OperationInvocationError) {
|
|
7904
|
+
return { status: "error", error: error.operationError };
|
|
7905
|
+
}
|
|
7906
|
+
return nodeFailure("read the KV value");
|
|
7907
|
+
}
|
|
7908
|
+
}
|
|
7909
|
+
function runtimeContext(context) {
|
|
7910
|
+
if (context.runtime === void 0) {
|
|
7911
|
+
throw new TypeError("Authenticated operation runtime is unavailable.");
|
|
7912
|
+
}
|
|
7913
|
+
return context;
|
|
7914
|
+
}
|
|
7915
|
+
function runtimeNode(context) {
|
|
7916
|
+
return runtimeContext(context).runtime.node;
|
|
7917
|
+
}
|
|
7918
|
+
function resolveSpace(context, space) {
|
|
7919
|
+
return operationSpaceResolver(context.runtime.node, context.summary.space)(space);
|
|
7920
|
+
}
|
|
7921
|
+
function resolveNonSecretSpace(context, space) {
|
|
7922
|
+
const resolved = resolveSpace(context, space);
|
|
7923
|
+
if (resolved.split(":").at(-1)?.toLowerCase() === "secrets") {
|
|
7924
|
+
throw new OperationInvocationError(operationError(
|
|
7925
|
+
"INPUT_INVALID",
|
|
7926
|
+
"Generic KV operations cannot access the TinyCloud secrets space; use tinycloud.secrets.get."
|
|
7927
|
+
));
|
|
7928
|
+
}
|
|
7929
|
+
return resolved;
|
|
7930
|
+
}
|
|
7931
|
+
async function readAccountRegistry(context, prefix) {
|
|
7932
|
+
const runtime = runtimeContext(context);
|
|
7933
|
+
const accountSpace = resolveSpace(runtime, "account");
|
|
7934
|
+
const kv = runtimeNode(runtime).kvForSpace(accountSpace);
|
|
7935
|
+
const listed = await kv.list({ prefix });
|
|
7936
|
+
if (!listed.ok) return { ok: false };
|
|
7937
|
+
const records = [];
|
|
7938
|
+
for (const key of listed.data.keys) {
|
|
7939
|
+
const loaded = await kv.get(key);
|
|
7940
|
+
if (!loaded.ok || !isRecord2(loaded.data.data)) return { ok: false };
|
|
7941
|
+
records.push({ key, value: loaded.data.data });
|
|
7942
|
+
}
|
|
7943
|
+
return { ok: true, records };
|
|
7944
|
+
}
|
|
7945
|
+
function projectAccountSpace(key, record) {
|
|
7946
|
+
const suffix = key.startsWith("spaces/") ? key.slice("spaces/".length) : key;
|
|
7947
|
+
const rawSpaceId = stringField2(record, "space_id", "spaceId") ?? suffix;
|
|
7948
|
+
const rawName = stringField2(record, "name") ?? rawSpaceId.split(":").at(-1) ?? rawSpaceId;
|
|
7949
|
+
const rawType = stringField2(record, "type");
|
|
7950
|
+
const rawStatus = stringField2(record, "status");
|
|
7951
|
+
const rawExpiresAt = record.expires_at ?? record.expiresAt;
|
|
7952
|
+
const expiresAt = rawExpiresAt instanceof Date ? rawExpiresAt.toISOString() : typeof rawExpiresAt === "string" && !Number.isNaN(new Date(rawExpiresAt).getTime()) ? new Date(rawExpiresAt).toISOString() : void 0;
|
|
7953
|
+
return {
|
|
7954
|
+
spaceId: rawSpaceId,
|
|
7955
|
+
name: rawName,
|
|
7956
|
+
ownerDid: stringField2(record, "owner_did", "ownerDid", "owner") ?? "",
|
|
7957
|
+
type: rawType === "owned" || rawType === "delegated" ? rawType : "discovered",
|
|
7958
|
+
permissions: Array.isArray(record.permissions) ? record.permissions.filter((value) => typeof value === "string") : [],
|
|
7959
|
+
status: rawStatus === "archived" ? "archived" : "active",
|
|
7960
|
+
...stringField2(record, "registered_at", "registeredAt") === void 0 ? {} : { registeredAt: stringField2(record, "registered_at", "registeredAt") },
|
|
7961
|
+
...stringField2(record, "updated_at", "updatedAt") === void 0 ? {} : { updatedAt: stringField2(record, "updated_at", "updatedAt") },
|
|
7962
|
+
...expiresAt === void 0 ? {} : { expiresAt }
|
|
7963
|
+
};
|
|
7964
|
+
}
|
|
7965
|
+
function projectAccountApplication(key, record) {
|
|
7966
|
+
const manifests = Array.isArray(record.manifests) ? record.manifests.filter(isRecord2) : [];
|
|
7967
|
+
const first = manifests[0];
|
|
7968
|
+
return {
|
|
7969
|
+
appId: stringField2(record, "app_id", "appId") ?? stringField2(first, "app_id") ?? (key.startsWith("applications/") ? key.slice("applications/".length) : key),
|
|
7970
|
+
manifests,
|
|
7971
|
+
...stringField2(record, "updated_at", "updatedAt") === void 0 ? {} : { updatedAt: stringField2(record, "updated_at", "updatedAt") },
|
|
7972
|
+
...stringField2(first, "name") === void 0 ? {} : { name: stringField2(first, "name") },
|
|
7973
|
+
...stringField2(first, "description") === void 0 ? {} : { description: stringField2(first, "description") },
|
|
7974
|
+
...stringField2(record, "manifest_hash", "manifestHash") === void 0 ? {} : { manifestHash: stringField2(record, "manifest_hash", "manifestHash") }
|
|
7975
|
+
};
|
|
7976
|
+
}
|
|
7977
|
+
function stringField2(record, ...keys) {
|
|
7978
|
+
if (record === void 0) return void 0;
|
|
7979
|
+
for (const key of keys) {
|
|
7980
|
+
if (typeof record[key] === "string") return record[key];
|
|
7981
|
+
}
|
|
7982
|
+
return void 0;
|
|
7983
|
+
}
|
|
7984
|
+
function isRecord2(value) {
|
|
7985
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7986
|
+
}
|
|
7987
|
+
function encodeKvValue(value) {
|
|
7988
|
+
if (value instanceof Uint8Array) {
|
|
7989
|
+
return { value: Buffer.from(value).toString("base64"), encoding: "base64" };
|
|
7990
|
+
}
|
|
7991
|
+
return {
|
|
7992
|
+
value,
|
|
7993
|
+
encoding: typeof value === "string" ? "text" : "json"
|
|
7994
|
+
};
|
|
7995
|
+
}
|
|
7996
|
+
function nodeFailure(action) {
|
|
7997
|
+
return {
|
|
7998
|
+
status: "error",
|
|
7999
|
+
error: operationError(
|
|
8000
|
+
"NODE_ERROR",
|
|
8001
|
+
`The TinyCloud node could not ${action}.`,
|
|
8002
|
+
{ retryable: true }
|
|
8003
|
+
)
|
|
8004
|
+
};
|
|
8005
|
+
}
|
|
8006
|
+
var import_zod4, EmptyInputSchema2, SpaceSchema, PrefixSchema, KeySchema, AccountSpaceSchema, AccountSpacesOutputSchema, AccountApplicationSchema, AccountApplicationsOutputSchema, KvListInputSchema, KvListOutputSchema, KvGetInputSchema, KvGetOutputSchema, AUTHENTICATED_POSTURES, EXPLORATION_EXPOSURE, ACCOUNT_SPACES_SENSITIVITY, ACCOUNT_APPLICATIONS_SENSITIVITY, KV_LIST_SENSITIVITY, KV_GET_SENSITIVITY, explorationOperationDefinitions;
|
|
8007
|
+
var init_exploration = __esm({
|
|
8008
|
+
"src/operations/exploration.ts"() {
|
|
8009
|
+
"use strict";
|
|
8010
|
+
import_zod4 = require("zod");
|
|
8011
|
+
init_errors();
|
|
8012
|
+
init_secrets();
|
|
8013
|
+
EmptyInputSchema2 = import_zod4.z.object({}).strict();
|
|
8014
|
+
SpaceSchema = import_zod4.z.string().min(1).refine(
|
|
8015
|
+
(space) => (/^[A-Za-z0-9_-]+$/.test(space) || space.startsWith("tinycloud:")) && !space.includes("*"),
|
|
8016
|
+
"Invalid TinyCloud space."
|
|
8017
|
+
);
|
|
8018
|
+
PrefixSchema = import_zod4.z.string().refine(
|
|
8019
|
+
(prefix) => prefix !== "/" && !prefix.includes("*"),
|
|
8020
|
+
"Invalid KV prefix."
|
|
8021
|
+
);
|
|
8022
|
+
KeySchema = import_zod4.z.string().min(1).refine(
|
|
8023
|
+
(key) => key !== "/" && !key.endsWith("/") && !key.includes("*"),
|
|
8024
|
+
"Invalid KV key."
|
|
8025
|
+
);
|
|
8026
|
+
AccountSpaceSchema = import_zod4.z.object({
|
|
8027
|
+
spaceId: import_zod4.z.string().min(1),
|
|
8028
|
+
name: import_zod4.z.string().min(1),
|
|
8029
|
+
ownerDid: import_zod4.z.string(),
|
|
8030
|
+
type: import_zod4.z.enum(["owned", "delegated", "discovered"]),
|
|
8031
|
+
permissions: import_zod4.z.array(import_zod4.z.string()),
|
|
8032
|
+
status: import_zod4.z.enum(["active", "archived"]),
|
|
8033
|
+
registeredAt: import_zod4.z.string().optional(),
|
|
8034
|
+
updatedAt: import_zod4.z.string().optional(),
|
|
8035
|
+
expiresAt: import_zod4.z.string().datetime({ offset: true }).optional()
|
|
8036
|
+
}).strict();
|
|
8037
|
+
AccountSpacesOutputSchema = import_zod4.z.object({
|
|
8038
|
+
spaces: import_zod4.z.array(AccountSpaceSchema),
|
|
8039
|
+
count: import_zod4.z.number().int().nonnegative()
|
|
8040
|
+
}).strict();
|
|
8041
|
+
AccountApplicationSchema = import_zod4.z.object({
|
|
8042
|
+
appId: import_zod4.z.string().min(1),
|
|
8043
|
+
manifests: import_zod4.z.array(import_zod4.z.record(import_zod4.z.unknown())),
|
|
8044
|
+
updatedAt: import_zod4.z.string().optional(),
|
|
8045
|
+
name: import_zod4.z.string().optional(),
|
|
8046
|
+
description: import_zod4.z.string().optional(),
|
|
8047
|
+
manifestHash: import_zod4.z.string().optional()
|
|
8048
|
+
}).strict();
|
|
8049
|
+
AccountApplicationsOutputSchema = import_zod4.z.object({
|
|
8050
|
+
applications: import_zod4.z.array(AccountApplicationSchema),
|
|
8051
|
+
count: import_zod4.z.number().int().nonnegative()
|
|
8052
|
+
}).strict();
|
|
8053
|
+
KvListInputSchema = import_zod4.z.object({
|
|
8054
|
+
space: SpaceSchema,
|
|
8055
|
+
prefix: PrefixSchema.optional()
|
|
8056
|
+
}).strict();
|
|
8057
|
+
KvListOutputSchema = import_zod4.z.object({
|
|
8058
|
+
space: import_zod4.z.string().min(1),
|
|
8059
|
+
prefix: import_zod4.z.string(),
|
|
8060
|
+
keys: import_zod4.z.array(import_zod4.z.string()),
|
|
8061
|
+
count: import_zod4.z.number().int().nonnegative()
|
|
8062
|
+
}).strict();
|
|
8063
|
+
KvGetInputSchema = import_zod4.z.object({
|
|
8064
|
+
space: SpaceSchema,
|
|
8065
|
+
key: KeySchema
|
|
8066
|
+
}).strict();
|
|
8067
|
+
KvGetOutputSchema = import_zod4.z.object({
|
|
8068
|
+
space: import_zod4.z.string().min(1),
|
|
8069
|
+
key: import_zod4.z.string().min(1),
|
|
8070
|
+
value: import_zod4.z.union([
|
|
8071
|
+
import_zod4.z.string(),
|
|
8072
|
+
import_zod4.z.number(),
|
|
8073
|
+
import_zod4.z.boolean(),
|
|
8074
|
+
import_zod4.z.null(),
|
|
8075
|
+
import_zod4.z.array(import_zod4.z.unknown()),
|
|
8076
|
+
import_zod4.z.record(import_zod4.z.unknown())
|
|
8077
|
+
]),
|
|
8078
|
+
encoding: import_zod4.z.enum(["json", "text", "base64"]),
|
|
8079
|
+
metadata: import_zod4.z.object({
|
|
8080
|
+
etag: import_zod4.z.string().optional(),
|
|
8081
|
+
contentType: import_zod4.z.string().optional(),
|
|
8082
|
+
lastModified: import_zod4.z.string().optional(),
|
|
8083
|
+
contentLength: import_zod4.z.number().int().nonnegative().optional()
|
|
8084
|
+
}).strict()
|
|
8085
|
+
}).strict();
|
|
8086
|
+
AUTHENTICATED_POSTURES = [
|
|
8087
|
+
"owner-openkey",
|
|
8088
|
+
"delegate-session",
|
|
8089
|
+
"local-owner-key"
|
|
8090
|
+
];
|
|
8091
|
+
EXPLORATION_EXPOSURE = {
|
|
8092
|
+
cli: {
|
|
8093
|
+
status: "excluded",
|
|
8094
|
+
reason: "Existing account and KV Commander commands remain the CLI surface."
|
|
8095
|
+
},
|
|
8096
|
+
mcp: { status: "required" },
|
|
8097
|
+
skill: { status: "required" },
|
|
8098
|
+
docs: { status: "required" }
|
|
8099
|
+
};
|
|
8100
|
+
ACCOUNT_SPACES_SENSITIVITY = {
|
|
8101
|
+
input: [],
|
|
8102
|
+
output: ["/spaces"]
|
|
8103
|
+
};
|
|
8104
|
+
ACCOUNT_APPLICATIONS_SENSITIVITY = {
|
|
8105
|
+
input: [],
|
|
8106
|
+
output: ["/applications"]
|
|
8107
|
+
};
|
|
8108
|
+
KV_LIST_SENSITIVITY = {
|
|
8109
|
+
input: ["/prefix"],
|
|
8110
|
+
output: ["/keys"]
|
|
8111
|
+
};
|
|
8112
|
+
KV_GET_SENSITIVITY = {
|
|
8113
|
+
input: ["/key"],
|
|
8114
|
+
output: ["/value"]
|
|
8115
|
+
};
|
|
8116
|
+
explorationOperationDefinitions = [
|
|
8117
|
+
{
|
|
8118
|
+
id: "tinycloud.account.spaces.list",
|
|
8119
|
+
version: 1,
|
|
8120
|
+
title: "List TinyCloud account spaces",
|
|
8121
|
+
description: "List the spaces registered in the selected owner's TinyCloud account.",
|
|
8122
|
+
input: EmptyInputSchema2,
|
|
8123
|
+
output: AccountSpacesOutputSchema,
|
|
8124
|
+
effects: ["read"],
|
|
8125
|
+
runtime: "authenticated",
|
|
8126
|
+
postures: AUTHENTICATED_POSTURES,
|
|
8127
|
+
exposure: EXPLORATION_EXPOSURE,
|
|
8128
|
+
sensitivity: ACCOUNT_SPACES_SENSITIVITY,
|
|
8129
|
+
authority: (context) => planAccountRegistryRead(context, "spaces/"),
|
|
8130
|
+
execute: executeAccountSpacesList
|
|
8131
|
+
},
|
|
8132
|
+
{
|
|
8133
|
+
id: "tinycloud.account.applications.list",
|
|
8134
|
+
version: 1,
|
|
8135
|
+
title: "List TinyCloud account applications",
|
|
8136
|
+
description: "List the application manifests registered in the selected owner's TinyCloud account.",
|
|
8137
|
+
input: EmptyInputSchema2,
|
|
8138
|
+
output: AccountApplicationsOutputSchema,
|
|
8139
|
+
effects: ["read"],
|
|
8140
|
+
runtime: "authenticated",
|
|
8141
|
+
postures: AUTHENTICATED_POSTURES,
|
|
8142
|
+
exposure: EXPLORATION_EXPOSURE,
|
|
8143
|
+
sensitivity: ACCOUNT_APPLICATIONS_SENSITIVITY,
|
|
8144
|
+
authority: (context) => planAccountRegistryRead(context, "applications/"),
|
|
8145
|
+
execute: executeAccountApplicationsList
|
|
8146
|
+
},
|
|
8147
|
+
{
|
|
8148
|
+
id: "tinycloud.kv.list",
|
|
8149
|
+
version: 1,
|
|
8150
|
+
title: "List TinyCloud KV keys",
|
|
8151
|
+
description: "List keys at one exact prefix in a delegated TinyCloud space.",
|
|
8152
|
+
input: KvListInputSchema,
|
|
8153
|
+
output: KvListOutputSchema,
|
|
8154
|
+
effects: ["read"],
|
|
8155
|
+
runtime: "authenticated",
|
|
8156
|
+
postures: AUTHENTICATED_POSTURES,
|
|
8157
|
+
exposure: EXPLORATION_EXPOSURE,
|
|
8158
|
+
sensitivity: KV_LIST_SENSITIVITY,
|
|
8159
|
+
authority: planKvList,
|
|
8160
|
+
execute: executeKvList
|
|
8161
|
+
},
|
|
8162
|
+
{
|
|
8163
|
+
id: "tinycloud.kv.get",
|
|
8164
|
+
version: 1,
|
|
8165
|
+
title: "Get a TinyCloud KV value",
|
|
8166
|
+
description: "Read one exact key from a delegated non-secrets TinyCloud space.",
|
|
8167
|
+
input: KvGetInputSchema,
|
|
8168
|
+
output: KvGetOutputSchema,
|
|
8169
|
+
effects: ["read"],
|
|
8170
|
+
runtime: "authenticated",
|
|
8171
|
+
postures: AUTHENTICATED_POSTURES,
|
|
8172
|
+
exposure: EXPLORATION_EXPOSURE,
|
|
8173
|
+
sensitivity: KV_GET_SENSITIVITY,
|
|
8174
|
+
authority: planKvGet,
|
|
8175
|
+
execute: executeKvGet
|
|
8176
|
+
}
|
|
8177
|
+
];
|
|
8178
|
+
}
|
|
8179
|
+
});
|
|
8180
|
+
|
|
7809
8181
|
// src/operations/secrets-get.ts
|
|
7810
8182
|
async function planSecretGet(context, input) {
|
|
7811
8183
|
const reference = resolveSecretReferenceForOperation(
|
|
@@ -7958,26 +8330,26 @@ function resolveEncryptionNetworkId(node, space) {
|
|
|
7958
8330
|
)
|
|
7959
8331
|
);
|
|
7960
8332
|
}
|
|
7961
|
-
var
|
|
8333
|
+
var import_zod5, SecretsGetInputSchema, SecretsGetOutputSchema, SECRETS_GET_POSTURES, SECRETS_GET_EXPOSURE, SECRETS_GET_SENSITIVITY, secretsGetOperationDefinition, secretsGetOperationDefinitions;
|
|
7962
8334
|
var init_secrets_get = __esm({
|
|
7963
8335
|
"src/operations/secrets-get.ts"() {
|
|
7964
8336
|
"use strict";
|
|
7965
|
-
|
|
8337
|
+
import_zod5 = require("zod");
|
|
7966
8338
|
init_errors();
|
|
7967
8339
|
init_secrets();
|
|
7968
|
-
SecretsGetInputSchema =
|
|
7969
|
-
name:
|
|
7970
|
-
scope:
|
|
7971
|
-
space:
|
|
8340
|
+
SecretsGetInputSchema = import_zod5.z.object({
|
|
8341
|
+
name: import_zod5.z.string(),
|
|
8342
|
+
scope: import_zod5.z.string().optional(),
|
|
8343
|
+
space: import_zod5.z.string().optional()
|
|
7972
8344
|
}).strict().superRefine((input, context) => {
|
|
7973
8345
|
try {
|
|
7974
8346
|
resolveSecretReference(input);
|
|
7975
8347
|
} catch {
|
|
7976
|
-
context.addIssue({ code:
|
|
8348
|
+
context.addIssue({ code: import_zod5.z.ZodIssueCode.custom, message: "Invalid secret reference." });
|
|
7977
8349
|
}
|
|
7978
8350
|
}).transform(normalizeSecretsGetInput);
|
|
7979
|
-
SecretsGetOutputSchema =
|
|
7980
|
-
value:
|
|
8351
|
+
SecretsGetOutputSchema = import_zod5.z.object({
|
|
8352
|
+
value: import_zod5.z.string()
|
|
7981
8353
|
}).strict();
|
|
7982
8354
|
SECRETS_GET_POSTURES = [
|
|
7983
8355
|
"owner-openkey",
|
|
@@ -8070,7 +8442,7 @@ async function inspectPinnedProfileStatus(context, _input) {
|
|
|
8070
8442
|
async function pinnedProfileExists(profile) {
|
|
8071
8443
|
try {
|
|
8072
8444
|
const storedProfile = await readProfile(profile);
|
|
8073
|
-
return
|
|
8445
|
+
return isRecord3(storedProfile);
|
|
8074
8446
|
} catch {
|
|
8075
8447
|
return false;
|
|
8076
8448
|
}
|
|
@@ -8090,7 +8462,7 @@ async function countLiveAdditionalDelegations(profile) {
|
|
|
8090
8462
|
}
|
|
8091
8463
|
function summarizeSession(session) {
|
|
8092
8464
|
if (session === null) return { present: false, expired: null, expiresAt: null };
|
|
8093
|
-
if (!
|
|
8465
|
+
if (!isRecord3(session)) throw new TypeError("Invalid session store.");
|
|
8094
8466
|
const expiry = extractSessionExpiry(session);
|
|
8095
8467
|
if (expiry === null) return { present: true, expired: null, expiresAt: null };
|
|
8096
8468
|
return {
|
|
@@ -8100,7 +8472,7 @@ function summarizeSession(session) {
|
|
|
8100
8472
|
};
|
|
8101
8473
|
}
|
|
8102
8474
|
function storedDelegationExpiry(entry) {
|
|
8103
|
-
if (!
|
|
8475
|
+
if (!isRecord3(entry) || !isRecord3(entry.delegation) || !("expiry" in entry.delegation)) {
|
|
8104
8476
|
throw new TypeError("Invalid stored delegation.");
|
|
8105
8477
|
}
|
|
8106
8478
|
return parseExpiry(entry.delegation.expiry);
|
|
@@ -8129,37 +8501,37 @@ function profileNotFound(profile) {
|
|
|
8129
8501
|
)
|
|
8130
8502
|
};
|
|
8131
8503
|
}
|
|
8132
|
-
function
|
|
8504
|
+
function isRecord3(value) {
|
|
8133
8505
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8134
8506
|
}
|
|
8135
|
-
var
|
|
8507
|
+
var import_zod6, StatusInputSchema, StatusOutputSchema, STATUS_POSTURES, STATUS_EXPOSURE, STATUS_SENSITIVITY, statusOperationDefinitions;
|
|
8136
8508
|
var init_status = __esm({
|
|
8137
8509
|
"src/operations/status.ts"() {
|
|
8138
8510
|
"use strict";
|
|
8139
|
-
|
|
8511
|
+
import_zod6 = require("zod");
|
|
8140
8512
|
init_errors();
|
|
8141
8513
|
init_state();
|
|
8142
|
-
StatusInputSchema =
|
|
8143
|
-
StatusOutputSchema =
|
|
8144
|
-
profile:
|
|
8145
|
-
host:
|
|
8146
|
-
posture:
|
|
8514
|
+
StatusInputSchema = import_zod6.z.object({}).strict();
|
|
8515
|
+
StatusOutputSchema = import_zod6.z.object({
|
|
8516
|
+
profile: import_zod6.z.string().min(1),
|
|
8517
|
+
host: import_zod6.z.string().min(1),
|
|
8518
|
+
posture: import_zod6.z.enum([
|
|
8147
8519
|
"owner-openkey",
|
|
8148
8520
|
"delegate-session",
|
|
8149
8521
|
"local-owner-key",
|
|
8150
8522
|
"unauthenticated"
|
|
8151
8523
|
]),
|
|
8152
|
-
operatorType:
|
|
8153
|
-
principalDid:
|
|
8154
|
-
sessionDid:
|
|
8155
|
-
ownerDid:
|
|
8156
|
-
space:
|
|
8157
|
-
session:
|
|
8158
|
-
present:
|
|
8159
|
-
expired:
|
|
8160
|
-
expiresAt:
|
|
8524
|
+
operatorType: import_zod6.z.enum(["human", "agent"]).optional(),
|
|
8525
|
+
principalDid: import_zod6.z.string().min(1).optional(),
|
|
8526
|
+
sessionDid: import_zod6.z.string().min(1).optional(),
|
|
8527
|
+
ownerDid: import_zod6.z.string().min(1).optional(),
|
|
8528
|
+
space: import_zod6.z.string().min(1).optional(),
|
|
8529
|
+
session: import_zod6.z.object({
|
|
8530
|
+
present: import_zod6.z.boolean(),
|
|
8531
|
+
expired: import_zod6.z.boolean().nullable(),
|
|
8532
|
+
expiresAt: import_zod6.z.string().datetime({ offset: true }).nullable()
|
|
8161
8533
|
}).strict(),
|
|
8162
|
-
liveAdditionalDelegationCount:
|
|
8534
|
+
liveAdditionalDelegationCount: import_zod6.z.number().int().nonnegative()
|
|
8163
8535
|
}).strict();
|
|
8164
8536
|
STATUS_POSTURES = [
|
|
8165
8537
|
"owner-openkey",
|
|
@@ -8199,6 +8571,7 @@ function registeredOperationDefinitions() {
|
|
|
8199
8571
|
operationDefinitions ?? (operationDefinitions = [
|
|
8200
8572
|
...statusOperationDefinitions,
|
|
8201
8573
|
...authOperationDefinitions,
|
|
8574
|
+
...explorationOperationDefinitions,
|
|
8202
8575
|
...secretsGetOperationDefinitions
|
|
8203
8576
|
]);
|
|
8204
8577
|
return operationDefinitions;
|
|
@@ -8229,6 +8602,7 @@ var init_registry = __esm({
|
|
|
8229
8602
|
"src/registry.ts"() {
|
|
8230
8603
|
"use strict";
|
|
8231
8604
|
init_auth();
|
|
8605
|
+
init_exploration();
|
|
8232
8606
|
init_secrets_get();
|
|
8233
8607
|
init_status();
|
|
8234
8608
|
}
|
|
@@ -8309,9 +8683,9 @@ function isOperatorType(value) {
|
|
|
8309
8683
|
return value === "human" || value === "agent";
|
|
8310
8684
|
}
|
|
8311
8685
|
function isStoredProfile(value) {
|
|
8312
|
-
return
|
|
8686
|
+
return isRecord4(value) && isNonEmptyString(value.name) && isNonEmptyString(value.host) && typeof value.chainId === "number" && Number.isFinite(value.chainId) && isNonEmptyString(value.spaceName) && isNonEmptyString(value.did) && isNonEmptyString(value.createdAt) && isOptionalNonEmptyString(value.sessionDid) && isOptionalNonEmptyString(value.ownerDid) && isOptionalNonEmptyString(value.spaceId) && isOptionalPosture(value.posture) && isOptionalOperatorType(value.operatorType) && isOptionalAuthMethod(value.authMethod) && isOptionalNonEmptyString(value.defaultSpace) && isOptionalNonEmptyString(value.privateKey) && isOptionalNonEmptyString(value.address) && isOptionalNonEmptyString(value.openkeyHost);
|
|
8313
8687
|
}
|
|
8314
|
-
function
|
|
8688
|
+
function isRecord4(value) {
|
|
8315
8689
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8316
8690
|
}
|
|
8317
8691
|
function isNonEmptyString(value) {
|
|
@@ -8475,7 +8849,7 @@ function spaceForAuthenticatedPrincipal(principal2) {
|
|
|
8475
8849
|
function normalizeSession(session, key) {
|
|
8476
8850
|
const header = session.delegationHeader;
|
|
8477
8851
|
const jwk = hasPrivateParameter(session.jwk) ? session.jwk : key;
|
|
8478
|
-
if (!
|
|
8852
|
+
if (!isRecord5(header) || typeof header.Authorization !== "string" || typeof session.delegationCid !== "string" || typeof session.spaceId !== "string" || !hasPrivateParameter(jwk) || typeof session.verificationMethod !== "string") {
|
|
8479
8853
|
return void 0;
|
|
8480
8854
|
}
|
|
8481
8855
|
return {
|
|
@@ -8493,7 +8867,7 @@ function normalizeSession(session, key) {
|
|
|
8493
8867
|
}
|
|
8494
8868
|
function normalizeStoredDelegation(entry) {
|
|
8495
8869
|
const raw = entry.delegation;
|
|
8496
|
-
if (!
|
|
8870
|
+
if (!isRecord5(raw) || !isRecord5(raw.delegationHeader)) return void 0;
|
|
8497
8871
|
const expiry = parseExpiry2(raw.expiry);
|
|
8498
8872
|
if (expiry === void 0 || typeof raw.cid !== "string" || typeof raw.spaceId !== "string" || typeof raw.path !== "string" || !Array.isArray(raw.actions) || !raw.actions.every((action) => typeof action === "string") || typeof raw.delegateDID !== "string" || typeof raw.ownerAddress !== "string" || typeof raw.chainId !== "number" || typeof raw.delegationHeader.Authorization !== "string") {
|
|
8499
8873
|
return void 0;
|
|
@@ -8505,13 +8879,13 @@ function parseExpiry2(value) {
|
|
|
8505
8879
|
return expiry !== void 0 && !Number.isNaN(expiry.getTime()) ? expiry : void 0;
|
|
8506
8880
|
}
|
|
8507
8881
|
function hasPrivateParameter(value) {
|
|
8508
|
-
return
|
|
8882
|
+
return isRecord5(value) && typeof value.d === "string" && value.d.length > 0;
|
|
8509
8883
|
}
|
|
8510
8884
|
function normalizeDid(value) {
|
|
8511
8885
|
if (typeof value !== "string" || value.length === 0) return void 0;
|
|
8512
8886
|
return value.split("#", 1)[0];
|
|
8513
8887
|
}
|
|
8514
|
-
function
|
|
8888
|
+
function isRecord5(value) {
|
|
8515
8889
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8516
8890
|
}
|
|
8517
8891
|
function failed(context, error) {
|
|
@@ -9014,14 +9388,14 @@ async function prepareInvocation(operationId, operationVersion, invocationTarget
|
|
|
9014
9388
|
}
|
|
9015
9389
|
async function executePreparedInvocation(prepared, options = {}) {
|
|
9016
9390
|
const { operation, definition, parsedInput, runtimeResolution } = prepared;
|
|
9017
|
-
const
|
|
9018
|
-
const
|
|
9019
|
-
|
|
9020
|
-
|
|
9391
|
+
const runtimeContext2 = runtimeResolution.context.runtime === void 0 ? void 0 : runtimeResolution.context;
|
|
9392
|
+
const resolveSpace2 = runtimeContext2 === void 0 ? void 0 : operationSpaceResolver(
|
|
9393
|
+
runtimeContext2.runtime.node,
|
|
9394
|
+
runtimeContext2.summary.space
|
|
9021
9395
|
);
|
|
9022
9396
|
try {
|
|
9023
9397
|
const planned = await definition.authority(
|
|
9024
|
-
|
|
9398
|
+
runtimeContext2 ?? runtimeResolution.context,
|
|
9025
9399
|
parsedInput.data
|
|
9026
9400
|
);
|
|
9027
9401
|
const required = exactCapabilities2(planned);
|
|
@@ -9036,12 +9410,12 @@ async function executePreparedInvocation(prepared, options = {}) {
|
|
|
9036
9410
|
);
|
|
9037
9411
|
}
|
|
9038
9412
|
const evaluation = evaluateOperationAuthority(
|
|
9039
|
-
|
|
9413
|
+
runtimeContext2?.runtime.granted ?? [],
|
|
9040
9414
|
required,
|
|
9041
|
-
|
|
9415
|
+
resolveSpace2
|
|
9042
9416
|
);
|
|
9043
9417
|
if (!evaluation.satisfied) {
|
|
9044
|
-
if (
|
|
9418
|
+
if (runtimeContext2 === void 0) {
|
|
9045
9419
|
return errorResult(
|
|
9046
9420
|
operation,
|
|
9047
9421
|
runtimeResolution.context.summary,
|
|
@@ -9051,13 +9425,13 @@ async function executePreparedInvocation(prepared, options = {}) {
|
|
|
9051
9425
|
if (options.deferAuthorityRequest) {
|
|
9052
9426
|
try {
|
|
9053
9427
|
const request = buildPermissionRequestArtifact({
|
|
9054
|
-
profile:
|
|
9055
|
-
host:
|
|
9056
|
-
sessionDid:
|
|
9057
|
-
posture:
|
|
9058
|
-
operatorType:
|
|
9059
|
-
...
|
|
9060
|
-
...
|
|
9428
|
+
profile: runtimeContext2.summary.profile,
|
|
9429
|
+
host: runtimeContext2.summary.host,
|
|
9430
|
+
sessionDid: runtimeContext2.summary.sessionDid,
|
|
9431
|
+
posture: runtimeContext2.summary.posture,
|
|
9432
|
+
operatorType: runtimeContext2.summary.operatorType ?? "human",
|
|
9433
|
+
...runtimeContext2.summary.ownerDid === void 0 ? {} : { ownerDid: runtimeContext2.summary.ownerDid },
|
|
9434
|
+
...runtimeContext2.summary.space === void 0 ? {} : { spaceId: runtimeContext2.summary.space },
|
|
9061
9435
|
missing: evaluation.missing
|
|
9062
9436
|
});
|
|
9063
9437
|
return authorityRequiredResult(
|
|
@@ -9066,7 +9440,7 @@ async function executePreparedInvocation(prepared, options = {}) {
|
|
|
9066
9440
|
parsedInput.data,
|
|
9067
9441
|
request,
|
|
9068
9442
|
evaluation.missing,
|
|
9069
|
-
|
|
9443
|
+
runtimeContext2.runtime.node
|
|
9070
9444
|
);
|
|
9071
9445
|
} catch {
|
|
9072
9446
|
return errorResult(
|
|
@@ -9077,7 +9451,7 @@ async function executePreparedInvocation(prepared, options = {}) {
|
|
|
9077
9451
|
}
|
|
9078
9452
|
}
|
|
9079
9453
|
const authority = await persistAuthorityRequest(
|
|
9080
|
-
|
|
9454
|
+
runtimeContext2,
|
|
9081
9455
|
evaluation.missing
|
|
9082
9456
|
);
|
|
9083
9457
|
if (authority.status === "error") {
|
|
@@ -9093,7 +9467,7 @@ async function executePreparedInvocation(prepared, options = {}) {
|
|
|
9093
9467
|
parsedInput.data,
|
|
9094
9468
|
authority.request,
|
|
9095
9469
|
authority.missing,
|
|
9096
|
-
|
|
9470
|
+
runtimeContext2.runtime.node
|
|
9097
9471
|
);
|
|
9098
9472
|
}
|
|
9099
9473
|
const outcome = await definition.execute(
|
|
@@ -9125,7 +9499,7 @@ async function executePreparedInvocation(prepared, options = {}) {
|
|
|
9125
9499
|
if (hinted === void 0 || !isExactCapabilityMemberSubset(
|
|
9126
9500
|
hinted,
|
|
9127
9501
|
required,
|
|
9128
|
-
|
|
9502
|
+
resolveSpace2
|
|
9129
9503
|
)) {
|
|
9130
9504
|
return errorResult(
|
|
9131
9505
|
operation,
|
|
@@ -9136,7 +9510,7 @@ async function executePreparedInvocation(prepared, options = {}) {
|
|
|
9136
9510
|
)
|
|
9137
9511
|
);
|
|
9138
9512
|
}
|
|
9139
|
-
if (
|
|
9513
|
+
if (runtimeContext2 === void 0) {
|
|
9140
9514
|
return errorResult(
|
|
9141
9515
|
operation,
|
|
9142
9516
|
runtimeResolution.context.summary,
|
|
@@ -9146,13 +9520,13 @@ async function executePreparedInvocation(prepared, options = {}) {
|
|
|
9146
9520
|
if (options.deferAuthorityRequest) {
|
|
9147
9521
|
try {
|
|
9148
9522
|
const request = buildPermissionRequestArtifact({
|
|
9149
|
-
profile:
|
|
9150
|
-
host:
|
|
9151
|
-
sessionDid:
|
|
9152
|
-
posture:
|
|
9153
|
-
operatorType:
|
|
9154
|
-
...
|
|
9155
|
-
...
|
|
9523
|
+
profile: runtimeContext2.summary.profile,
|
|
9524
|
+
host: runtimeContext2.summary.host,
|
|
9525
|
+
sessionDid: runtimeContext2.summary.sessionDid,
|
|
9526
|
+
posture: runtimeContext2.summary.posture,
|
|
9527
|
+
operatorType: runtimeContext2.summary.operatorType ?? "human",
|
|
9528
|
+
...runtimeContext2.summary.ownerDid === void 0 ? {} : { ownerDid: runtimeContext2.summary.ownerDid },
|
|
9529
|
+
...runtimeContext2.summary.space === void 0 ? {} : { spaceId: runtimeContext2.summary.space },
|
|
9156
9530
|
missing: hinted
|
|
9157
9531
|
});
|
|
9158
9532
|
return authorityRequiredResult(
|
|
@@ -9161,7 +9535,7 @@ async function executePreparedInvocation(prepared, options = {}) {
|
|
|
9161
9535
|
parsedInput.data,
|
|
9162
9536
|
request,
|
|
9163
9537
|
hinted,
|
|
9164
|
-
|
|
9538
|
+
runtimeContext2.runtime.node,
|
|
9165
9539
|
outcome.requiresCallerInput ?? false
|
|
9166
9540
|
);
|
|
9167
9541
|
} catch {
|
|
@@ -9173,7 +9547,7 @@ async function executePreparedInvocation(prepared, options = {}) {
|
|
|
9173
9547
|
}
|
|
9174
9548
|
}
|
|
9175
9549
|
const authority = await persistAuthorityRequest(
|
|
9176
|
-
|
|
9550
|
+
runtimeContext2,
|
|
9177
9551
|
hinted,
|
|
9178
9552
|
true
|
|
9179
9553
|
);
|
|
@@ -9190,7 +9564,7 @@ async function executePreparedInvocation(prepared, options = {}) {
|
|
|
9190
9564
|
parsedInput.data,
|
|
9191
9565
|
authority.request,
|
|
9192
9566
|
authority.missing,
|
|
9193
|
-
|
|
9567
|
+
runtimeContext2.runtime.node,
|
|
9194
9568
|
outcome.requiresCallerInput ?? false
|
|
9195
9569
|
);
|
|
9196
9570
|
}
|
|
@@ -9293,12 +9667,12 @@ async function persistAuthorityRequest(context, missing, force = false) {
|
|
|
9293
9667
|
};
|
|
9294
9668
|
}
|
|
9295
9669
|
try {
|
|
9296
|
-
const
|
|
9670
|
+
const resolveSpace2 = operationSpaceResolver(
|
|
9297
9671
|
context.runtime.node,
|
|
9298
9672
|
context.summary.space
|
|
9299
9673
|
);
|
|
9300
|
-
const canonicalMissing = canonicalizeOperationCapabilities(missing,
|
|
9301
|
-
const canonicalGranted = canonicalizeOperationCapabilities(context.runtime.granted,
|
|
9674
|
+
const canonicalMissing = canonicalizeOperationCapabilities(missing, resolveSpace2);
|
|
9675
|
+
const canonicalGranted = canonicalizeOperationCapabilities(context.runtime.granted, resolveSpace2);
|
|
9302
9676
|
const resolution = await createOrReusePermissionRequest({
|
|
9303
9677
|
profile: context.summary.profile,
|
|
9304
9678
|
posture: context.summary.posture,
|
|
@@ -9309,7 +9683,7 @@ async function persistAuthorityRequest(context, missing, force = false) {
|
|
|
9309
9683
|
...context.summary.space === void 0 ? {} : { spaceId: context.summary.space },
|
|
9310
9684
|
missing: canonicalMissing,
|
|
9311
9685
|
granted: force ? [] : canonicalGranted,
|
|
9312
|
-
resolveSpace
|
|
9686
|
+
resolveSpace: resolveSpace2
|
|
9313
9687
|
});
|
|
9314
9688
|
if (resolution.status !== "created") {
|
|
9315
9689
|
return {
|