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