@tinycloud/operations 0.7.0-beta.34 → 0.7.0-beta.35
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.d.cts +1 -1
- package/dist/artifacts.d.ts +1 -1
- package/dist/cli-runtime.cjs +82 -40
- package/dist/cli-runtime.cjs.map +1 -1
- package/dist/cli-runtime.d.cts +1 -1
- package/dist/cli-runtime.d.ts +1 -1
- package/dist/cli-runtime.js +82 -39
- package/dist/cli-runtime.js.map +1 -1
- package/dist/{contract-zRklonbR.d.cts → contract-DrtFhVsg.d.cts} +1 -1
- package/dist/{contract-zRklonbR.d.ts → contract-DrtFhVsg.d.ts} +1 -1
- package/dist/delegation-binding.d.cts +2 -2
- package/dist/delegation-binding.d.ts +2 -2
- package/dist/index-CVP0YT2f.d.cts +12 -0
- package/dist/index-D-72hsQ_.d.ts +12 -0
- package/dist/index.cjs +82 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -10
- package/dist/index.d.ts +2 -10
- package/dist/index.js +82 -39
- package/dist/index.js.map +1 -1
- package/dist/mcp-authority.cjs +486 -0
- package/dist/mcp-authority.cjs.map +1 -0
- package/dist/mcp-authority.d.cts +19 -0
- package/dist/mcp-authority.d.ts +19 -0
- package/dist/mcp-authority.js +470 -0
- package/dist/mcp-authority.js.map +1 -0
- package/dist/profile.d.cts +1 -1
- package/dist/profile.d.ts +1 -1
- package/dist/recovery.d.cts +1 -1
- package/dist/recovery.d.ts +1 -1
- package/dist/secret-request.d.cts +1 -1
- package/dist/secret-request.d.ts +1 -1
- package/package.json +7 -2
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __esm = (fn, res) => function __init() {
|
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
+
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
+
|
|
33
|
+
// src/contract.ts
|
|
34
|
+
var DELEGATION_CID_PATTERN;
|
|
35
|
+
var init_contract = __esm({
|
|
36
|
+
"src/contract.ts"() {
|
|
37
|
+
"use strict";
|
|
38
|
+
DELEGATION_CID_PATTERN = "^bafkr4i[a-z2-7]{52}$";
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// src/errors.ts
|
|
43
|
+
var init_errors = __esm({
|
|
44
|
+
"src/errors.ts"() {
|
|
45
|
+
"use strict";
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// src/cli-name.ts
|
|
50
|
+
var import_node_path, CLI_NAME;
|
|
51
|
+
var init_cli_name = __esm({
|
|
52
|
+
"src/cli-name.ts"() {
|
|
53
|
+
"use strict";
|
|
54
|
+
import_node_path = require("path");
|
|
55
|
+
CLI_NAME = (0, import_node_path.basename)(process.argv[1] ?? "") === "tinycloud" ? "tinycloud" : "tc";
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// src/revoked-grant.ts
|
|
60
|
+
var import_sdk_services, REVOKED_GRANT_MESSAGE;
|
|
61
|
+
var init_revoked_grant = __esm({
|
|
62
|
+
"src/revoked-grant.ts"() {
|
|
63
|
+
"use strict";
|
|
64
|
+
import_sdk_services = require("@tinycloud/sdk-services");
|
|
65
|
+
init_cli_name();
|
|
66
|
+
REVOKED_GRANT_MESSAGE = `This grant was revoked. Ask the owner for a new grant (\`${CLI_NAME} auth request ...\`).`;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// src/kv-failure.ts
|
|
71
|
+
function nodeRevocationOf(error) {
|
|
72
|
+
if (typeof error !== "object" || error === null || !("service" in error) || error.service !== "kv" || !("code" in error) || error.code !== "AUTH_UNAUTHORIZED" && error.code !== "AUTH_DELEGATION_REVOKED" && error.code !== "AUTH_DELEGATION_ANCESTOR_REVOKED" || !("message" in error) || typeof error.message !== "string" || !("meta" in error) || typeof error.meta !== "object" || error.meta === null || !("status" in error.meta) || error.meta.status !== 401 || (0, import_sdk_services2.authorizationVerdictOf)(error) !== "unauthenticated") return void 0;
|
|
73
|
+
const { code, message } = error;
|
|
74
|
+
const separator = ": 401 - ";
|
|
75
|
+
const start = message.indexOf(separator);
|
|
76
|
+
if (start < 0) return void 0;
|
|
77
|
+
const body = message.slice(start + separator.length);
|
|
78
|
+
const match = NODE_REVOCATION_BODY.exec(body);
|
|
79
|
+
if (match === null || match[0] !== body) return void 0;
|
|
80
|
+
if (match[1] !== void 0 && code !== "AUTH_DELEGATION_ANCESTOR_REVOKED") {
|
|
81
|
+
const revokedCid = match[2];
|
|
82
|
+
return DELEGATION_CID.test(revokedCid) ? { reason: "delegation_revoked", revokedCid } : void 0;
|
|
83
|
+
}
|
|
84
|
+
if (match[3] !== void 0 && code !== "AUTH_DELEGATION_REVOKED") {
|
|
85
|
+
const ancestorCid = match[4];
|
|
86
|
+
const revokedCid = match[5];
|
|
87
|
+
return DELEGATION_CID.test(ancestorCid) && DELEGATION_CID.test(revokedCid) ? { reason: "delegation_ancestor_revoked", revokedCid, ancestorCid } : void 0;
|
|
88
|
+
}
|
|
89
|
+
return void 0;
|
|
90
|
+
}
|
|
91
|
+
var import_sdk_services2, DELEGATION_CID, NODE_REVOCATION_BODY;
|
|
92
|
+
var init_kv_failure = __esm({
|
|
93
|
+
"src/kv-failure.ts"() {
|
|
94
|
+
"use strict";
|
|
95
|
+
import_sdk_services2 = require("@tinycloud/sdk-services");
|
|
96
|
+
init_contract();
|
|
97
|
+
init_errors();
|
|
98
|
+
init_revoked_grant();
|
|
99
|
+
DELEGATION_CID = new RegExp(DELEGATION_CID_PATTERN);
|
|
100
|
+
NODE_REVOCATION_BODY = /^(?:Invalid invocation: )?delegation-(?:(revoked): ([A-Za-z0-9]+)|(ancestor-revoked): ancestor=([A-Za-z0-9]+) invoked=([A-Za-z0-9]+))$/;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// ../sdk-core/src/policy/errors.ts
|
|
105
|
+
var SignedObjectProfileError, SignedObjectCanonicalizationError;
|
|
106
|
+
var init_errors2 = __esm({
|
|
107
|
+
"../sdk-core/src/policy/errors.ts"() {
|
|
108
|
+
"use strict";
|
|
109
|
+
SignedObjectProfileError = class extends Error {
|
|
110
|
+
constructor(code, message) {
|
|
111
|
+
super(message);
|
|
112
|
+
this.name = "SignedObjectProfileError";
|
|
113
|
+
this.code = code;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
SignedObjectCanonicalizationError = class extends SignedObjectProfileError {
|
|
117
|
+
constructor(message) {
|
|
118
|
+
super("canonicalization-mismatch", message);
|
|
119
|
+
this.name = "SignedObjectCanonicalizationError";
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// ../sdk-core/src/policy/jcs.ts
|
|
126
|
+
function jcsCanonicalize(input) {
|
|
127
|
+
return serialize(normalizeJson(input, "$"));
|
|
128
|
+
}
|
|
129
|
+
function normalizeJson(input, path = "$") {
|
|
130
|
+
if (input === null) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
switch (typeof input) {
|
|
134
|
+
case "boolean":
|
|
135
|
+
return input;
|
|
136
|
+
case "number":
|
|
137
|
+
if (!Number.isFinite(input)) {
|
|
138
|
+
throw new SignedObjectCanonicalizationError(
|
|
139
|
+
`${path} must be a finite JSON number`
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
return input;
|
|
143
|
+
case "string":
|
|
144
|
+
assertUnicodeScalarString(input, path);
|
|
145
|
+
return input;
|
|
146
|
+
case "object":
|
|
147
|
+
return normalizeJsonObjectOrArray(input, path);
|
|
148
|
+
case "bigint":
|
|
149
|
+
case "function":
|
|
150
|
+
case "symbol":
|
|
151
|
+
case "undefined":
|
|
152
|
+
default:
|
|
153
|
+
throw new SignedObjectCanonicalizationError(
|
|
154
|
+
`${path} is not a JSON value`
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function serialize(value) {
|
|
159
|
+
if (value === null) {
|
|
160
|
+
return "null";
|
|
161
|
+
}
|
|
162
|
+
switch (typeof value) {
|
|
163
|
+
case "boolean":
|
|
164
|
+
return value ? "true" : "false";
|
|
165
|
+
case "number": {
|
|
166
|
+
const encoded = JSON.stringify(value);
|
|
167
|
+
if (encoded === void 0) {
|
|
168
|
+
throw new SignedObjectCanonicalizationError(
|
|
169
|
+
"number could not be serialized as JSON"
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
return encoded;
|
|
173
|
+
}
|
|
174
|
+
case "string":
|
|
175
|
+
return JSON.stringify(value);
|
|
176
|
+
case "object":
|
|
177
|
+
if (Array.isArray(value)) {
|
|
178
|
+
return `[${value.map((item) => serialize(item)).join(",")}]`;
|
|
179
|
+
}
|
|
180
|
+
return serializeObject(value);
|
|
181
|
+
default:
|
|
182
|
+
throw new SignedObjectCanonicalizationError(
|
|
183
|
+
`unsupported JSON value type ${typeof value}`
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function normalizeJsonObjectOrArray(input, path) {
|
|
188
|
+
assertNoSymbolKeys(input, path);
|
|
189
|
+
if (Array.isArray(input)) {
|
|
190
|
+
for (const key of Object.getOwnPropertyNames(input)) {
|
|
191
|
+
if (key === "length") {
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
if (!isArrayIndexKey(key, input.length)) {
|
|
195
|
+
throw new SignedObjectCanonicalizationError(
|
|
196
|
+
`${path}.${key} is not allowed on a JSON array`
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
const descriptor = Object.getOwnPropertyDescriptor(input, key);
|
|
200
|
+
if (descriptor?.enumerable !== true) {
|
|
201
|
+
throw new SignedObjectCanonicalizationError(
|
|
202
|
+
`${path}[${key}] must be an enumerable JSON array item`
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
if (!("value" in descriptor)) {
|
|
206
|
+
throw new SignedObjectCanonicalizationError(
|
|
207
|
+
`${path}[${key}] must be a JSON data property`
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
const output2 = [];
|
|
212
|
+
for (let index = 0; index < input.length; index++) {
|
|
213
|
+
if (!objectHasOwn(input, index)) {
|
|
214
|
+
throw new SignedObjectCanonicalizationError(
|
|
215
|
+
`${path}[${index}] must not be a sparse array hole`
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
output2.push(normalizeJson(input[index], `${path}[${index}]`));
|
|
219
|
+
}
|
|
220
|
+
return output2;
|
|
221
|
+
}
|
|
222
|
+
const proto = Object.getPrototypeOf(input);
|
|
223
|
+
if (proto !== Object.prototype && proto !== null) {
|
|
224
|
+
throw new SignedObjectCanonicalizationError(
|
|
225
|
+
`${path} must be a plain JSON object`
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
const output = /* @__PURE__ */ Object.create(null);
|
|
229
|
+
for (const key of Object.getOwnPropertyNames(input)) {
|
|
230
|
+
assertUnicodeScalarString(key, `${path} key`);
|
|
231
|
+
if (key === "__proto__" || key === "constructor") {
|
|
232
|
+
throw new SignedObjectCanonicalizationError(
|
|
233
|
+
`${path}.${key} is not allowed`
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
const descriptor = Object.getOwnPropertyDescriptor(input, key);
|
|
237
|
+
if (descriptor?.enumerable !== true) {
|
|
238
|
+
throw new SignedObjectCanonicalizationError(
|
|
239
|
+
`${path}.${key} must be an enumerable JSON object property`
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
if (!("value" in descriptor)) {
|
|
243
|
+
throw new SignedObjectCanonicalizationError(
|
|
244
|
+
`${path}.${key} must be a JSON data property`
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
const value = descriptor.value;
|
|
248
|
+
output[key] = normalizeJson(value, `${path}.${key}`);
|
|
249
|
+
}
|
|
250
|
+
return output;
|
|
251
|
+
}
|
|
252
|
+
function assertNoSymbolKeys(input, path) {
|
|
253
|
+
if (Object.getOwnPropertySymbols(input).length > 0) {
|
|
254
|
+
throw new SignedObjectCanonicalizationError(
|
|
255
|
+
`${path} must not have symbol properties`
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
function isArrayIndexKey(key, length) {
|
|
260
|
+
if (!/^(0|[1-9]\d*)$/.test(key)) {
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
const index = Number(key);
|
|
264
|
+
return Number.isSafeInteger(index) && index >= 0 && index < length;
|
|
265
|
+
}
|
|
266
|
+
function serializeObject(value) {
|
|
267
|
+
const keys = Object.keys(value).sort(compareUtf16CodeUnits);
|
|
268
|
+
const parts = keys.map((key) => `${JSON.stringify(key)}:${serialize(value[key])}`);
|
|
269
|
+
return `{${parts.join(",")}}`;
|
|
270
|
+
}
|
|
271
|
+
function compareUtf16CodeUnits(a, b) {
|
|
272
|
+
const max = Math.min(a.length, b.length);
|
|
273
|
+
for (let index = 0; index < max; index++) {
|
|
274
|
+
const leftCodeUnit = a.charCodeAt(index);
|
|
275
|
+
const rightCodeUnit = b.charCodeAt(index);
|
|
276
|
+
if (leftCodeUnit !== rightCodeUnit) {
|
|
277
|
+
return leftCodeUnit - rightCodeUnit;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return a.length - b.length;
|
|
281
|
+
}
|
|
282
|
+
function assertUnicodeScalarString(value, path) {
|
|
283
|
+
for (let index = 0; index < value.length; index++) {
|
|
284
|
+
const code = value.charCodeAt(index);
|
|
285
|
+
if (code >= 55296 && code <= 56319) {
|
|
286
|
+
const next = value.charCodeAt(index + 1);
|
|
287
|
+
if (Number.isNaN(next) || next < 56320 || next > 57343) {
|
|
288
|
+
throw new SignedObjectCanonicalizationError(
|
|
289
|
+
`${path} contains a lone high surrogate`
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
index++;
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
if (code >= 56320 && code <= 57343) {
|
|
296
|
+
throw new SignedObjectCanonicalizationError(
|
|
297
|
+
`${path} contains a lone low surrogate`
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
var objectHasOwn;
|
|
303
|
+
var init_jcs = __esm({
|
|
304
|
+
"../sdk-core/src/policy/jcs.ts"() {
|
|
305
|
+
"use strict";
|
|
306
|
+
init_errors2();
|
|
307
|
+
objectHasOwn = Object.hasOwn ?? Object.prototype.hasOwnProperty.call.bind(
|
|
308
|
+
Object.prototype.hasOwnProperty
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
// src/authority.ts
|
|
314
|
+
var init_authority = __esm({
|
|
315
|
+
"src/authority.ts"() {
|
|
316
|
+
"use strict";
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
// src/state.ts
|
|
321
|
+
function processWideContext(key) {
|
|
322
|
+
var _a4;
|
|
323
|
+
const registry = globalThis;
|
|
324
|
+
return registry[_a4 = Symbol.for(key)] ?? (registry[_a4] = new import_node_async_hooks.AsyncLocalStorage());
|
|
325
|
+
}
|
|
326
|
+
var import_node_crypto, import_node_async_hooks, import_node_fs, import_promises, import_node_net, import_node_os, import_node_path2, invocationStateRoot, heldProfileLocks, pinnedProfiles, pinnedHomes, _a, canonicalHomes, _a2, processInstanceId, _a3, relinquishedTurns;
|
|
327
|
+
var init_state = __esm({
|
|
328
|
+
"src/state.ts"() {
|
|
329
|
+
"use strict";
|
|
330
|
+
import_node_crypto = require("crypto");
|
|
331
|
+
import_node_async_hooks = require("async_hooks");
|
|
332
|
+
import_node_fs = require("fs");
|
|
333
|
+
import_promises = require("fs/promises");
|
|
334
|
+
import_node_net = require("net");
|
|
335
|
+
import_node_os = require("os");
|
|
336
|
+
import_node_path2 = require("path");
|
|
337
|
+
invocationStateRoot = processWideContext("tinycloud.operations.invocationStateRoot.v1");
|
|
338
|
+
heldProfileLocks = processWideContext("tinycloud.operations.heldProfileLocks.v2");
|
|
339
|
+
pinnedProfiles = processWideContext("tinycloud.operations.pinnedProfiles.v2");
|
|
340
|
+
pinnedHomes = processWideContext("tinycloud.operations.pinnedHomes.v2");
|
|
341
|
+
canonicalHomes = globalThis[_a = /* @__PURE__ */ Symbol.for("tinycloud.operations.canonicalHomes.v1")] ?? (globalThis[_a] = /* @__PURE__ */ new Map());
|
|
342
|
+
processInstanceId = globalThis[_a2 = /* @__PURE__ */ Symbol.for("tinycloud.operations.profileLockInstance.v1")] ?? (globalThis[_a2] = (0, import_node_crypto.randomUUID)());
|
|
343
|
+
relinquishedTurns = globalThis[_a3 = /* @__PURE__ */ Symbol.for("tinycloud.operations.relinquishedProfileTurns.v1")] ?? (globalThis[_a3] = /* @__PURE__ */ new Set());
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
// src/artifacts.ts
|
|
348
|
+
var import_node_crypto2, import_zod, THIRTY_DAYS_MS, PermissionEntrySchema, CommandSchema, LegacyPermissionRequestArtifactSchema, PortableDelegationSchema, PermissionRequestArtifactSchema, DelegationImportArtifactSchema, DelegationRequestBindingSchema;
|
|
349
|
+
var init_artifacts = __esm({
|
|
350
|
+
"src/artifacts.ts"() {
|
|
351
|
+
"use strict";
|
|
352
|
+
import_node_crypto2 = require("crypto");
|
|
353
|
+
import_zod = require("zod");
|
|
354
|
+
init_authority();
|
|
355
|
+
init_state();
|
|
356
|
+
init_authority();
|
|
357
|
+
THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
358
|
+
PermissionEntrySchema = import_zod.z.object({
|
|
359
|
+
service: import_zod.z.string().min(1),
|
|
360
|
+
space: import_zod.z.string().min(1).optional(),
|
|
361
|
+
path: import_zod.z.string(),
|
|
362
|
+
actions: import_zod.z.array(import_zod.z.string().min(1)).min(1),
|
|
363
|
+
caveats: import_zod.z.array(import_zod.z.record(import_zod.z.unknown())).optional(),
|
|
364
|
+
skipPrefix: import_zod.z.boolean().optional(),
|
|
365
|
+
expiry: import_zod.z.string().min(1).optional(),
|
|
366
|
+
description: import_zod.z.string().optional()
|
|
367
|
+
}).strict();
|
|
368
|
+
CommandSchema = import_zod.z.object({
|
|
369
|
+
argv: import_zod.z.array(import_zod.z.string()).min(1),
|
|
370
|
+
cwd: import_zod.z.string().min(1)
|
|
371
|
+
}).strict();
|
|
372
|
+
LegacyPermissionRequestArtifactSchema = import_zod.z.object({
|
|
373
|
+
kind: import_zod.z.literal("tinycloud.auth.request"),
|
|
374
|
+
version: import_zod.z.literal(1),
|
|
375
|
+
requestId: import_zod.z.string(),
|
|
376
|
+
sessionDid: import_zod.z.string().min(1),
|
|
377
|
+
requested: import_zod.z.array(PermissionEntrySchema),
|
|
378
|
+
requestedExpiry: import_zod.z.union([import_zod.z.string(), import_zod.z.number().finite()]).optional()
|
|
379
|
+
}).strict();
|
|
380
|
+
PortableDelegationSchema = import_zod.z.lazy(() => import_zod.z.object({
|
|
381
|
+
cid: import_zod.z.string().min(1),
|
|
382
|
+
spaceId: import_zod.z.string().min(1),
|
|
383
|
+
path: import_zod.z.string(),
|
|
384
|
+
actions: import_zod.z.array(import_zod.z.string().min(1)).min(1),
|
|
385
|
+
delegateDID: import_zod.z.string().min(1),
|
|
386
|
+
ownerAddress: import_zod.z.string().min(1),
|
|
387
|
+
chainId: import_zod.z.number().int().positive(),
|
|
388
|
+
expiry: import_zod.z.union([import_zod.z.string().datetime({ offset: true }), import_zod.z.date()]),
|
|
389
|
+
delegationHeader: import_zod.z.object({ Authorization: import_zod.z.string().min(1) }).strict(),
|
|
390
|
+
host: import_zod.z.string().min(1).optional(),
|
|
391
|
+
disableSubDelegation: import_zod.z.boolean().optional(),
|
|
392
|
+
publicDelegation: PortableDelegationSchema.optional(),
|
|
393
|
+
resources: import_zod.z.array(PermissionEntrySchema).optional()
|
|
394
|
+
}).passthrough());
|
|
395
|
+
PermissionRequestArtifactSchema = import_zod.z.object({
|
|
396
|
+
kind: import_zod.z.literal("tinycloud.auth.request"),
|
|
397
|
+
version: import_zod.z.literal(1),
|
|
398
|
+
requestId: import_zod.z.string().min(1),
|
|
399
|
+
createdAt: import_zod.z.string().datetime({ offset: true }),
|
|
400
|
+
profile: import_zod.z.string().min(1),
|
|
401
|
+
posture: import_zod.z.enum(["owner-openkey", "delegate-session", "local-owner-key", "unauthenticated"]),
|
|
402
|
+
operatorType: import_zod.z.enum(["human", "agent"]),
|
|
403
|
+
host: import_zod.z.string().min(1),
|
|
404
|
+
sessionDid: import_zod.z.string().min(1),
|
|
405
|
+
ownerDid: import_zod.z.string().min(1).optional(),
|
|
406
|
+
spaceId: import_zod.z.string().min(1).optional(),
|
|
407
|
+
requestedExpiry: import_zod.z.union([import_zod.z.string().min(1), import_zod.z.number().finite()]).optional(),
|
|
408
|
+
requested: import_zod.z.array(PermissionEntrySchema),
|
|
409
|
+
command: CommandSchema.optional()
|
|
410
|
+
}).strict();
|
|
411
|
+
DelegationImportArtifactSchema = import_zod.z.object({
|
|
412
|
+
kind: import_zod.z.literal("tinycloud.auth.delegation"),
|
|
413
|
+
version: import_zod.z.literal(1),
|
|
414
|
+
requestId: import_zod.z.string().min(1),
|
|
415
|
+
delegationCid: import_zod.z.string().min(1).optional(),
|
|
416
|
+
delegation: PortableDelegationSchema,
|
|
417
|
+
// This field is presentation metadata only. A later import operation obtains
|
|
418
|
+
// effective permissions from validated, installed delegation authority.
|
|
419
|
+
permissions: import_zod.z.array(PermissionEntrySchema).optional(),
|
|
420
|
+
expiry: import_zod.z.string().datetime({ offset: true }).optional(),
|
|
421
|
+
prompted: import_zod.z.boolean().optional()
|
|
422
|
+
}).strict();
|
|
423
|
+
DelegationRequestBindingSchema = PermissionRequestArtifactSchema.pick({ requestId: true, requested: true }).strict();
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
// src/recovery.ts
|
|
428
|
+
var init_recovery = __esm({
|
|
429
|
+
"src/recovery.ts"() {
|
|
430
|
+
"use strict";
|
|
431
|
+
init_cli_name();
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
// src/secrets.ts
|
|
436
|
+
var nodeSdk;
|
|
437
|
+
var init_secrets = __esm({
|
|
438
|
+
"src/secrets.ts"() {
|
|
439
|
+
"use strict";
|
|
440
|
+
nodeSdk = __toESM(require("@tinycloud/node-sdk"), 1);
|
|
441
|
+
init_errors();
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
// src/mcp-authority.ts
|
|
446
|
+
var mcp_authority_exports = {};
|
|
447
|
+
__export(mcp_authority_exports, {
|
|
448
|
+
nodeRevocationOf: () => nodeRevocationOf,
|
|
449
|
+
operationRetryDescriptor: () => operationRetryDescriptor
|
|
450
|
+
});
|
|
451
|
+
module.exports = __toCommonJS(mcp_authority_exports);
|
|
452
|
+
init_kv_failure();
|
|
453
|
+
|
|
454
|
+
// src/invoke.ts
|
|
455
|
+
var import_node_crypto3 = require("crypto");
|
|
456
|
+
var import_node_path3 = require("path");
|
|
457
|
+
init_cli_name();
|
|
458
|
+
var import_node_sdk2 = require("@tinycloud/node-sdk");
|
|
459
|
+
init_jcs();
|
|
460
|
+
init_errors();
|
|
461
|
+
init_authority();
|
|
462
|
+
init_artifacts();
|
|
463
|
+
|
|
464
|
+
// src/redaction.ts
|
|
465
|
+
var import_node_sdk = require("@tinycloud/node-sdk");
|
|
466
|
+
init_contract();
|
|
467
|
+
init_recovery();
|
|
468
|
+
var DELEGATION_CID2 = new RegExp(DELEGATION_CID_PATTERN);
|
|
469
|
+
|
|
470
|
+
// src/invoke.ts
|
|
471
|
+
init_state();
|
|
472
|
+
init_secrets();
|
|
473
|
+
function operationRetryDescriptor(operation, input, requiresCallerInput = false) {
|
|
474
|
+
return {
|
|
475
|
+
operationId: operation.operationId,
|
|
476
|
+
operationVersion: operation.operationVersion,
|
|
477
|
+
inputDigest: (0, import_node_crypto3.createHash)("sha256").update(jcsCanonicalize(input), "utf8").digest("hex"),
|
|
478
|
+
requiresCallerInput
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
482
|
+
0 && (module.exports = {
|
|
483
|
+
nodeRevocationOf,
|
|
484
|
+
operationRetryDescriptor
|
|
485
|
+
});
|
|
486
|
+
//# sourceMappingURL=mcp-authority.cjs.map
|