@tinycloud/operations 0.3.4-beta.5 → 0.4.0-beta.7

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.
@@ -1,34 +1,9 @@
1
1
  import { PermissionEntry } from '@tinycloud/sdk-core';
2
2
  import { z } from 'zod';
3
+ import { O as OperationSpaceResolver } from './authority-ofwbEqmj.cjs';
4
+ export { e as evaluateAuthority } from './authority-ofwbEqmj.cjs';
3
5
  import { T as TinyCloudPosture, O as OperationOperatorType } from './contract-xMIIMtpF.cjs';
4
6
 
5
- /**
6
- * A capability in the canonical form persisted in a v1 request artifact.
7
- *
8
- * The SDK remains the semantic authority for containment. This module only
9
- * establishes deterministic exact identity for persistence and display.
10
- */
11
- type CanonicalPermissionEntry = Readonly<PermissionEntry>;
12
- interface AuthorityEvaluation {
13
- readonly satisfied: boolean;
14
- readonly missing: readonly CanonicalPermissionEntry[];
15
- }
16
- /**
17
- * Operation-owned space resolution. The SDK's general capability evaluator
18
- * intentionally preserves its historical short/full-space compatibility; the
19
- * operation kernel supplies this narrower resolver when a space identifies a
20
- * remote owner's resource.
21
- */
22
- type OperationSpaceResolver = (space: string) => string;
23
- /**
24
- * Evaluates required authority with the SDK's public subset primitive.
25
- *
26
- * In particular, this intentionally does not implement matching rules or
27
- * manufacture wildcards. A wildcard can cover a requirement only when it was
28
- * already present in the supplied granted authority and the SDK says so.
29
- */
30
- declare function evaluateAuthority(granted: readonly PermissionEntry[], required: readonly PermissionEntry[]): AuthorityEvaluation;
31
-
32
7
  /** The shared wire schema for SDK PermissionEntry values, including signed ReCap caveats. */
33
8
  declare const PermissionEntrySchema: z.ZodObject<{
34
9
  service: z.ZodString;
@@ -306,6 +281,88 @@ declare const DelegationImportArtifactSchema: z.ZodObject<{
306
281
  }[] | undefined;
307
282
  prompted?: boolean | undefined;
308
283
  }>;
284
+ /**
285
+ * The stored request an imported delegation was checked against, persisted
286
+ * with the delegation. Its fields are exactly the request artifact's, so
287
+ * replay accepts every binding import can write.
288
+ */
289
+ declare const DelegationRequestBindingSchema: z.ZodObject<Pick<{
290
+ kind: z.ZodLiteral<"tinycloud.auth.request">;
291
+ version: z.ZodLiteral<1>;
292
+ requestId: z.ZodString;
293
+ createdAt: z.ZodString;
294
+ profile: z.ZodString;
295
+ posture: z.ZodEnum<["owner-openkey", "delegate-session", "local-owner-key", "unauthenticated"]>;
296
+ operatorType: z.ZodEnum<["human", "agent"]>;
297
+ host: z.ZodString;
298
+ sessionDid: z.ZodString;
299
+ ownerDid: z.ZodOptional<z.ZodString>;
300
+ spaceId: z.ZodOptional<z.ZodString>;
301
+ requestedExpiry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
302
+ requested: z.ZodArray<z.ZodObject<{
303
+ service: z.ZodString;
304
+ space: z.ZodOptional<z.ZodString>;
305
+ path: z.ZodString;
306
+ actions: z.ZodArray<z.ZodString, "many">;
307
+ caveats: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
308
+ skipPrefix: z.ZodOptional<z.ZodBoolean>;
309
+ expiry: z.ZodOptional<z.ZodString>;
310
+ description: z.ZodOptional<z.ZodString>;
311
+ }, "strict", z.ZodTypeAny, {
312
+ service: string;
313
+ path: string;
314
+ actions: string[];
315
+ space?: string | undefined;
316
+ caveats?: Record<string, unknown>[] | undefined;
317
+ skipPrefix?: boolean | undefined;
318
+ expiry?: string | undefined;
319
+ description?: string | undefined;
320
+ }, {
321
+ service: string;
322
+ path: string;
323
+ actions: string[];
324
+ space?: string | undefined;
325
+ caveats?: Record<string, unknown>[] | undefined;
326
+ skipPrefix?: boolean | undefined;
327
+ expiry?: string | undefined;
328
+ description?: string | undefined;
329
+ }>, "many">;
330
+ command: z.ZodOptional<z.ZodObject<{
331
+ argv: z.ZodArray<z.ZodString, "many">;
332
+ cwd: z.ZodString;
333
+ }, "strict", z.ZodTypeAny, {
334
+ argv: string[];
335
+ cwd: string;
336
+ }, {
337
+ argv: string[];
338
+ cwd: string;
339
+ }>>;
340
+ }, "requestId" | "requested">, "strict", z.ZodTypeAny, {
341
+ requestId: string;
342
+ requested: {
343
+ service: string;
344
+ path: string;
345
+ actions: string[];
346
+ space?: string | undefined;
347
+ caveats?: Record<string, unknown>[] | undefined;
348
+ skipPrefix?: boolean | undefined;
349
+ expiry?: string | undefined;
350
+ description?: string | undefined;
351
+ }[];
352
+ }, {
353
+ requestId: string;
354
+ requested: {
355
+ service: string;
356
+ path: string;
357
+ actions: string[];
358
+ space?: string | undefined;
359
+ caveats?: Record<string, unknown>[] | undefined;
360
+ skipPrefix?: boolean | undefined;
361
+ expiry?: string | undefined;
362
+ description?: string | undefined;
363
+ }[];
364
+ }>;
365
+ type DelegationRequestBinding = z.infer<typeof DelegationRequestBindingSchema>;
309
366
  type PermissionRequestArtifact = z.infer<typeof PermissionRequestArtifactSchema>;
310
367
  type DelegationImportArtifact = z.infer<typeof DelegationImportArtifactSchema>;
311
368
  /** The minimal public node-sdk request shape accepted by the legacy reader. */
@@ -388,4 +445,4 @@ interface PrunePermissionRequestsInput {
388
445
  /** Pure retention policy used by the locked persistence operation. */
389
446
  declare function prunePermissionRequests(records: readonly PermissionRequestArtifact[], input: PrunePermissionRequestsInput): PermissionRequestArtifact[];
390
447
 
391
- export { type ArtifactClock, type BuildPermissionRequestArtifactInput, type CreateOrReusePermissionRequestInput, type DelegationImportArtifact, DelegationImportArtifactSchema, type LegacyPermissionRequestArtifact, type LegacyRequestContext, PermissionEntrySchema, type PermissionRequestArtifact, PermissionRequestArtifactSchema, type PermissionRequestIdentityInput, type PermissionRequestResolution, type PrunePermissionRequestsInput, type RequestIdSource, buildPermissionRequestArtifact, createOrReusePermissionRequest, createPermissionRequestIdentity, evaluateAuthority, findPermissionRequest, isDelegationImportArtifact, isPermissionRequestArtifact, listPermissionRequests, prunePermissionRequests, validateDelegationImportArtifact, validatePermissionRequestArtifact };
448
+ export { type ArtifactClock, type BuildPermissionRequestArtifactInput, type CreateOrReusePermissionRequestInput, type DelegationImportArtifact, DelegationImportArtifactSchema, type DelegationRequestBinding, DelegationRequestBindingSchema, type LegacyPermissionRequestArtifact, type LegacyRequestContext, PermissionEntrySchema, type PermissionRequestArtifact, PermissionRequestArtifactSchema, type PermissionRequestIdentityInput, type PermissionRequestResolution, type PrunePermissionRequestsInput, type RequestIdSource, buildPermissionRequestArtifact, createOrReusePermissionRequest, createPermissionRequestIdentity, findPermissionRequest, isDelegationImportArtifact, isPermissionRequestArtifact, listPermissionRequests, prunePermissionRequests, validateDelegationImportArtifact, validatePermissionRequestArtifact };
@@ -1,34 +1,9 @@
1
1
  import { PermissionEntry } from '@tinycloud/sdk-core';
2
2
  import { z } from 'zod';
3
+ import { O as OperationSpaceResolver } from './authority-ofwbEqmj.js';
4
+ export { e as evaluateAuthority } from './authority-ofwbEqmj.js';
3
5
  import { T as TinyCloudPosture, O as OperationOperatorType } from './contract-xMIIMtpF.js';
4
6
 
5
- /**
6
- * A capability in the canonical form persisted in a v1 request artifact.
7
- *
8
- * The SDK remains the semantic authority for containment. This module only
9
- * establishes deterministic exact identity for persistence and display.
10
- */
11
- type CanonicalPermissionEntry = Readonly<PermissionEntry>;
12
- interface AuthorityEvaluation {
13
- readonly satisfied: boolean;
14
- readonly missing: readonly CanonicalPermissionEntry[];
15
- }
16
- /**
17
- * Operation-owned space resolution. The SDK's general capability evaluator
18
- * intentionally preserves its historical short/full-space compatibility; the
19
- * operation kernel supplies this narrower resolver when a space identifies a
20
- * remote owner's resource.
21
- */
22
- type OperationSpaceResolver = (space: string) => string;
23
- /**
24
- * Evaluates required authority with the SDK's public subset primitive.
25
- *
26
- * In particular, this intentionally does not implement matching rules or
27
- * manufacture wildcards. A wildcard can cover a requirement only when it was
28
- * already present in the supplied granted authority and the SDK says so.
29
- */
30
- declare function evaluateAuthority(granted: readonly PermissionEntry[], required: readonly PermissionEntry[]): AuthorityEvaluation;
31
-
32
7
  /** The shared wire schema for SDK PermissionEntry values, including signed ReCap caveats. */
33
8
  declare const PermissionEntrySchema: z.ZodObject<{
34
9
  service: z.ZodString;
@@ -306,6 +281,88 @@ declare const DelegationImportArtifactSchema: z.ZodObject<{
306
281
  }[] | undefined;
307
282
  prompted?: boolean | undefined;
308
283
  }>;
284
+ /**
285
+ * The stored request an imported delegation was checked against, persisted
286
+ * with the delegation. Its fields are exactly the request artifact's, so
287
+ * replay accepts every binding import can write.
288
+ */
289
+ declare const DelegationRequestBindingSchema: z.ZodObject<Pick<{
290
+ kind: z.ZodLiteral<"tinycloud.auth.request">;
291
+ version: z.ZodLiteral<1>;
292
+ requestId: z.ZodString;
293
+ createdAt: z.ZodString;
294
+ profile: z.ZodString;
295
+ posture: z.ZodEnum<["owner-openkey", "delegate-session", "local-owner-key", "unauthenticated"]>;
296
+ operatorType: z.ZodEnum<["human", "agent"]>;
297
+ host: z.ZodString;
298
+ sessionDid: z.ZodString;
299
+ ownerDid: z.ZodOptional<z.ZodString>;
300
+ spaceId: z.ZodOptional<z.ZodString>;
301
+ requestedExpiry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
302
+ requested: z.ZodArray<z.ZodObject<{
303
+ service: z.ZodString;
304
+ space: z.ZodOptional<z.ZodString>;
305
+ path: z.ZodString;
306
+ actions: z.ZodArray<z.ZodString, "many">;
307
+ caveats: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
308
+ skipPrefix: z.ZodOptional<z.ZodBoolean>;
309
+ expiry: z.ZodOptional<z.ZodString>;
310
+ description: z.ZodOptional<z.ZodString>;
311
+ }, "strict", z.ZodTypeAny, {
312
+ service: string;
313
+ path: string;
314
+ actions: string[];
315
+ space?: string | undefined;
316
+ caveats?: Record<string, unknown>[] | undefined;
317
+ skipPrefix?: boolean | undefined;
318
+ expiry?: string | undefined;
319
+ description?: string | undefined;
320
+ }, {
321
+ service: string;
322
+ path: string;
323
+ actions: string[];
324
+ space?: string | undefined;
325
+ caveats?: Record<string, unknown>[] | undefined;
326
+ skipPrefix?: boolean | undefined;
327
+ expiry?: string | undefined;
328
+ description?: string | undefined;
329
+ }>, "many">;
330
+ command: z.ZodOptional<z.ZodObject<{
331
+ argv: z.ZodArray<z.ZodString, "many">;
332
+ cwd: z.ZodString;
333
+ }, "strict", z.ZodTypeAny, {
334
+ argv: string[];
335
+ cwd: string;
336
+ }, {
337
+ argv: string[];
338
+ cwd: string;
339
+ }>>;
340
+ }, "requestId" | "requested">, "strict", z.ZodTypeAny, {
341
+ requestId: string;
342
+ requested: {
343
+ service: string;
344
+ path: string;
345
+ actions: string[];
346
+ space?: string | undefined;
347
+ caveats?: Record<string, unknown>[] | undefined;
348
+ skipPrefix?: boolean | undefined;
349
+ expiry?: string | undefined;
350
+ description?: string | undefined;
351
+ }[];
352
+ }, {
353
+ requestId: string;
354
+ requested: {
355
+ service: string;
356
+ path: string;
357
+ actions: string[];
358
+ space?: string | undefined;
359
+ caveats?: Record<string, unknown>[] | undefined;
360
+ skipPrefix?: boolean | undefined;
361
+ expiry?: string | undefined;
362
+ description?: string | undefined;
363
+ }[];
364
+ }>;
365
+ type DelegationRequestBinding = z.infer<typeof DelegationRequestBindingSchema>;
309
366
  type PermissionRequestArtifact = z.infer<typeof PermissionRequestArtifactSchema>;
310
367
  type DelegationImportArtifact = z.infer<typeof DelegationImportArtifactSchema>;
311
368
  /** The minimal public node-sdk request shape accepted by the legacy reader. */
@@ -388,4 +445,4 @@ interface PrunePermissionRequestsInput {
388
445
  /** Pure retention policy used by the locked persistence operation. */
389
446
  declare function prunePermissionRequests(records: readonly PermissionRequestArtifact[], input: PrunePermissionRequestsInput): PermissionRequestArtifact[];
390
447
 
391
- export { type ArtifactClock, type BuildPermissionRequestArtifactInput, type CreateOrReusePermissionRequestInput, type DelegationImportArtifact, DelegationImportArtifactSchema, type LegacyPermissionRequestArtifact, type LegacyRequestContext, PermissionEntrySchema, type PermissionRequestArtifact, PermissionRequestArtifactSchema, type PermissionRequestIdentityInput, type PermissionRequestResolution, type PrunePermissionRequestsInput, type RequestIdSource, buildPermissionRequestArtifact, createOrReusePermissionRequest, createPermissionRequestIdentity, evaluateAuthority, findPermissionRequest, isDelegationImportArtifact, isPermissionRequestArtifact, listPermissionRequests, prunePermissionRequests, validateDelegationImportArtifact, validatePermissionRequestArtifact };
448
+ export { type ArtifactClock, type BuildPermissionRequestArtifactInput, type CreateOrReusePermissionRequestInput, type DelegationImportArtifact, DelegationImportArtifactSchema, type DelegationRequestBinding, DelegationRequestBindingSchema, type LegacyPermissionRequestArtifact, type LegacyRequestContext, PermissionEntrySchema, type PermissionRequestArtifact, PermissionRequestArtifactSchema, type PermissionRequestIdentityInput, type PermissionRequestResolution, type PrunePermissionRequestsInput, type RequestIdSource, buildPermissionRequestArtifact, createOrReusePermissionRequest, createPermissionRequestIdentity, findPermissionRequest, isDelegationImportArtifact, isPermissionRequestArtifact, listPermissionRequests, prunePermissionRequests, validateDelegationImportArtifact, validatePermissionRequestArtifact };
package/dist/artifacts.js CHANGED
@@ -6945,8 +6945,13 @@ var TEST_LOCK_CLAIM_BARRIER_DIR = "TC_TEST_PROFILE_LOCK_CLAIM_BARRIER_DIR";
6945
6945
  var TEST_LOCK_CLAIMED_BARRIER_DIR = "TC_TEST_PROFILE_LOCK_CLAIMED_BARRIER_DIR";
6946
6946
  var TEST_LOCK_FENCED_BARRIER_DIR = "TC_TEST_PROFILE_LOCK_FENCED_BARRIER_DIR";
6947
6947
  var TEST_LOCK_VERIFIED_BARRIER_DIR = "TC_TEST_PROFILE_LOCK_VERIFIED_BARRIER_DIR";
6948
- var invocationStateRoot = new AsyncLocalStorage();
6949
- var heldProfileLocks = new AsyncLocalStorage();
6948
+ function processWideContext(key) {
6949
+ var _a;
6950
+ const registry = globalThis;
6951
+ return registry[_a = Symbol.for(key)] ?? (registry[_a] = new AsyncLocalStorage());
6952
+ }
6953
+ var invocationStateRoot = processWideContext("tinycloud.operations.invocationStateRoot.v1");
6954
+ var heldProfileLocks = processWideContext("tinycloud.operations.heldProfileLocks.v1");
6950
6955
  var ProfileLockTimeoutError = class extends Error {
6951
6956
  constructor(profile, timeoutMs) {
6952
6957
  super(`Timed out waiting for the profile lock for "${profile}" after ${timeoutMs}ms.`);
@@ -7310,6 +7315,7 @@ var DelegationImportArtifactSchema = z2.object({
7310
7315
  expiry: z2.string().datetime({ offset: true }).optional(),
7311
7316
  prompted: z2.boolean().optional()
7312
7317
  }).strict();
7318
+ var DelegationRequestBindingSchema = PermissionRequestArtifactSchema.pick({ requestId: true, requested: true }).strict();
7313
7319
  function validatePermissionRequestArtifact(value) {
7314
7320
  return PermissionRequestArtifactSchema.parse(value);
7315
7321
  }
@@ -7522,6 +7528,7 @@ function defaultRequestId(now) {
7522
7528
  }
7523
7529
  export {
7524
7530
  DelegationImportArtifactSchema,
7531
+ DelegationRequestBindingSchema,
7525
7532
  PermissionEntrySchema,
7526
7533
  PermissionRequestArtifactSchema,
7527
7534
  buildPermissionRequestArtifact,