@sequenceholdings/managed-functions 0.4.3 → 0.4.5

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/runtime.cjs CHANGED
@@ -17111,7 +17111,7 @@ var require_lattice_provenance_contract = __commonJS({
17111
17111
  "dist/lattice-provenance-contract.js"(exports2) {
17112
17112
  "use strict";
17113
17113
  Object.defineProperty(exports2, "__esModule", { value: true });
17114
- exports2.FunctionLatticeContextError = exports2.functionLatticeParallelSnapshotSchema = exports2.functionLatticeHumanCompletionsPageSchema = exports2.functionLatticeHumanCompletionSchema = exports2.functionLatticeExecutionContextSchema = exports2.functionLatticeContextRequestSchema = exports2.functionLatticeParallelSnapshotQuerySchema = exports2.functionLatticeHumanCompletionsQuerySchema = exports2.functionLatticeHumanCompletionQuerySchema = exports2.functionLatticeStartProvenanceSchema = exports2.FUNCTION_LATTICE_CONTEXT_PATH = exports2.FUNCTION_LATTICE_EXECUTION_TOKEN_HEADER = void 0;
17114
+ exports2.FunctionLatticeContextError = exports2.functionLatticeParallelSnapshotSchema = exports2.functionLatticeHumanCompletionsPageSchema = exports2.functionLatticeHumanCompletionSchema = exports2.functionLatticeExecutionContextSchema = exports2.functionLatticeRunCreatorAccessSchema = exports2.functionLatticeContextRequestSchema = exports2.functionLatticeParallelSnapshotQuerySchema = exports2.functionLatticeHumanCompletionsQuerySchema = exports2.functionLatticeHumanCompletionQuerySchema = exports2.functionLatticeStartProvenanceSchema = exports2.FUNCTION_LATTICE_CONTEXT_PATH = exports2.FUNCTION_LATTICE_EXECUTION_TOKEN_HEADER = void 0;
17115
17115
  var zod_12 = require_zod();
17116
17116
  exports2.FUNCTION_LATTICE_EXECUTION_TOKEN_HEADER = "x-sequence-lattice-execution-token";
17117
17117
  exports2.FUNCTION_LATTICE_CONTEXT_PATH = "/api/managed-functions/lattice/context";
@@ -17150,6 +17150,7 @@ var require_lattice_provenance_contract = __commonJS({
17150
17150
  exports2.functionLatticeParallelSnapshotQuerySchema = zod_12.z.strictObject({ nodeId: identifier, ancestorNodeId: identifier });
17151
17151
  exports2.functionLatticeContextRequestSchema = zod_12.z.discriminatedUnion("operation", [
17152
17152
  zod_12.z.strictObject({ operation: zod_12.z.literal("getExecutionContext") }),
17153
+ zod_12.z.strictObject({ operation: zod_12.z.literal("getRunCreatorAccess") }),
17153
17154
  exports2.functionLatticeHumanCompletionQuerySchema.extend({
17154
17155
  operation: zod_12.z.literal("getHumanCompletion")
17155
17156
  }),
@@ -17183,6 +17184,14 @@ var require_lattice_provenance_contract = __commonJS({
17183
17184
  attachedServiceAccountSub: principal
17184
17185
  })
17185
17186
  });
17187
+ exports2.functionLatticeRunCreatorAccessSchema = executionIdentity.extend({
17188
+ creator: zod_12.z.strictObject({
17189
+ sub: principal,
17190
+ tenant: zod_12.z.string().min(1).max(64).nullable(),
17191
+ platformOperator: zod_12.z.boolean()
17192
+ }).nullable(),
17193
+ observedAt: zod_12.z.iso.datetime({ offset: true })
17194
+ });
17186
17195
  exports2.functionLatticeExecutionContextSchema = executionIdentity.extend({
17187
17196
  input: zod_12.z.unknown(),
17188
17197
  ctxSnapshot: zod_12.z.object({
@@ -17401,6 +17410,9 @@ var require_lattice_provenance = __commonJS({
17401
17410
  getExecutionContext() {
17402
17411
  return read({ body: { operation: "getExecutionContext" }, schema: lattice_provenance_contract_12.functionLatticeExecutionContextSchema, executions: (value) => [value] });
17403
17412
  },
17413
+ getRunCreatorAccess() {
17414
+ return read({ body: { operation: "getRunCreatorAccess" }, schema: lattice_provenance_contract_12.functionLatticeRunCreatorAccessSchema, executions: (value) => [value] });
17415
+ },
17404
17416
  async getHumanCompletion(query) {
17405
17417
  const completion = await read({
17406
17418
  body: { ...query, operation: "getHumanCompletion" },
@@ -17435,7 +17447,7 @@ var require_invocation_contract = __commonJS({
17435
17447
  "dist/invocation-contract.js"(exports2) {
17436
17448
  "use strict";
17437
17449
  Object.defineProperty(exports2, "__esModule", { value: true });
17438
- exports2.FunctionInvocationContextError = exports2.functionInvocationContextSchema = exports2.functionInvocationContextRequestSchema = exports2.functionInvocationIdentityCapabilitySchema = exports2.FUNCTION_INVOCATION_CONTEXT_PATH = exports2.FUNCTION_INVOCATION_IDENTITY_TOKEN_HEADER = void 0;
17450
+ exports2.functionInvocationCapabilitiesSchema = exports2.FunctionInvocationContextError = exports2.functionInvocationContextSchema = exports2.functionInvocationContextRequestSchema = exports2.functionInvocationIdentityCapabilitySchema = exports2.FUNCTION_INVOCATION_CONTEXT_PATH = exports2.FUNCTION_INVOCATION_IDENTITY_TOKEN_HEADER = void 0;
17439
17451
  exports2.readFunctionInvocationIdentityCapability = readFunctionInvocationIdentityCapability;
17440
17452
  var zod_12 = require_zod();
17441
17453
  exports2.FUNCTION_INVOCATION_IDENTITY_TOKEN_HEADER = "x-sequence-invocation-identity-token";
@@ -17443,7 +17455,8 @@ var require_invocation_contract = __commonJS({
17443
17455
  var identifier = zod_12.z.string().min(1).max(255);
17444
17456
  var principal = zod_12.z.string().min(1).max(512);
17445
17457
  exports2.functionInvocationIdentityCapabilitySchema = zod_12.z.strictObject({
17446
- identity: zod_12.z.literal(true)
17458
+ identity: zod_12.z.literal(true),
17459
+ caller_capabilities: zod_12.z.literal(true).optional()
17447
17460
  });
17448
17461
  function readFunctionInvocationIdentityCapability(manifest) {
17449
17462
  if (typeof manifest !== "object" || manifest === null)
@@ -17453,9 +17466,10 @@ var require_invocation_contract = __commonJS({
17453
17466
  return false;
17454
17467
  return exports2.functionInvocationIdentityCapabilitySchema.safeParse(Reflect.get(capabilities, "invocation")).success;
17455
17468
  }
17456
- exports2.functionInvocationContextRequestSchema = zod_12.z.strictObject({
17457
- operation: zod_12.z.literal("getInvocationContext")
17458
- });
17469
+ exports2.functionInvocationContextRequestSchema = zod_12.z.discriminatedUnion("operation", [
17470
+ zod_12.z.strictObject({ operation: zod_12.z.literal("getInvocationContext") }),
17471
+ zod_12.z.strictObject({ operation: zod_12.z.literal("getCallerCapabilities") })
17472
+ ]);
17459
17473
  exports2.functionInvocationContextSchema = zod_12.z.strictObject({
17460
17474
  receiver: zod_12.z.strictObject({
17461
17475
  functionId: identifier,
@@ -17481,6 +17495,9 @@ var require_invocation_contract = __commonJS({
17481
17495
  }
17482
17496
  };
17483
17497
  exports2.FunctionInvocationContextError = FunctionInvocationContextError;
17498
+ exports2.functionInvocationCapabilitiesSchema = exports2.functionInvocationContextSchema.extend({
17499
+ capabilities: zod_12.z.array(zod_12.z.string().min(1).max(140).regex(/^[a-z0-9][a-z0-9/_.:-]*$/)).max(256)
17500
+ }).refine((value) => new Set(value.capabilities).size === value.capabilities.length, "Capabilities must be unique");
17484
17501
  }
17485
17502
  });
17486
17503
 
@@ -17833,37 +17850,39 @@ var require_invocation = __commonJS({
17833
17850
  function createFunctionInvocationClient({ request, baseUrl, fetchImpl = globalThis.fetch }) {
17834
17851
  const url = `${trustedOrigin(baseUrl)}${invocation_contract_1.FUNCTION_INVOCATION_CONTEXT_PATH}`;
17835
17852
  const { token, claims } = readCredential({ request });
17836
- return {
17837
- async getInvocationContext() {
17838
- requireFresh(claims);
17839
- let response;
17840
- try {
17841
- response = await fetchImpl(url, {
17842
- method: "POST",
17843
- headers: {
17844
- "content-type": "application/json",
17845
- [invocation_contract_1.FUNCTION_INVOCATION_IDENTITY_TOKEN_HEADER]: token
17846
- },
17847
- body: JSON.stringify(invocation_contract_1.functionInvocationContextRequestSchema.parse({ operation: "getInvocationContext" })),
17848
- redirect: "error",
17849
- signal: AbortSignal.timeout(3e4)
17850
- });
17851
- } catch {
17852
- throw new invocation_contract_1.FunctionInvocationContextError(502, "context_request_failed", "The invocation context request failed");
17853
- }
17854
- if (response.redirected || response.status >= 300 && response.status < 400)
17855
- throw new invocation_contract_1.FunctionInvocationContextError(502, "redirect_refused", "The invocation context request must not redirect");
17856
- const result = await response.json().catch(() => null);
17857
- if (!response.ok) {
17858
- const error = errorSchema.safeParse(result);
17859
- throw new invocation_contract_1.FunctionInvocationContextError(response.status, error.success ? error.data.code : "context_read_failed", error.success && !error.data.detail.includes(token) ? error.data.detail : "Invocation context read failed");
17860
- }
17861
- requireFresh(claims);
17862
- const parsed = invocation_contract_1.functionInvocationContextSchema.safeParse(result);
17863
- if (!parsed.success || !matchesInvocation({ context: parsed.data, claims }))
17864
- throw new invocation_contract_1.FunctionInvocationContextError(502, "malformed_response", "Atlas returned an invalid invocation context response");
17865
- return parsed.data;
17853
+ async function read(operation, schema) {
17854
+ requireFresh(claims);
17855
+ let response;
17856
+ try {
17857
+ response = await fetchImpl(url, {
17858
+ method: "POST",
17859
+ headers: {
17860
+ "content-type": "application/json",
17861
+ [invocation_contract_1.FUNCTION_INVOCATION_IDENTITY_TOKEN_HEADER]: token
17862
+ },
17863
+ body: JSON.stringify(invocation_contract_1.functionInvocationContextRequestSchema.parse({ operation })),
17864
+ redirect: "error",
17865
+ signal: AbortSignal.timeout(3e4)
17866
+ });
17867
+ } catch {
17868
+ throw new invocation_contract_1.FunctionInvocationContextError(502, "context_request_failed", "The invocation context request failed");
17869
+ }
17870
+ if (response.redirected || response.status >= 300 && response.status < 400)
17871
+ throw new invocation_contract_1.FunctionInvocationContextError(502, "redirect_refused", "The invocation context request must not redirect");
17872
+ const result = await response.json().catch(() => null);
17873
+ if (!response.ok) {
17874
+ const error = errorSchema.safeParse(result);
17875
+ throw new invocation_contract_1.FunctionInvocationContextError(response.status, error.success ? error.data.code : "context_read_failed", error.success && !error.data.detail.includes(token) ? error.data.detail : "Invocation context read failed");
17866
17876
  }
17877
+ requireFresh(claims);
17878
+ const parsed = schema.safeParse(result);
17879
+ if (!parsed.success || !matchesInvocation({ context: parsed.data, claims }))
17880
+ throw new invocation_contract_1.FunctionInvocationContextError(502, "malformed_response", "Atlas returned an invalid invocation context response");
17881
+ return parsed.data;
17882
+ }
17883
+ return {
17884
+ getInvocationContext: () => read("getInvocationContext", invocation_contract_1.functionInvocationContextSchema),
17885
+ getCallerCapabilities: () => read("getCallerCapabilities", invocation_contract_1.functionInvocationCapabilitiesSchema)
17867
17886
  };
17868
17887
  }
17869
17888
  }
@@ -17874,7 +17893,7 @@ var require_processes_contract = __commonJS({
17874
17893
  "dist/processes-contract.js"(exports2) {
17875
17894
  "use strict";
17876
17895
  Object.defineProperty(exports2, "__esModule", { value: true });
17877
- exports2.FunctionProcessReadError = exports2.functionProcessReadRequestSchema = exports2.functionProcessRunsPageSchema = exports2.functionProcessCompletedAgentReferenceSchema = exports2.functionProcessCompletedAgentReferenceQuerySchema = exports2.functionProcessRunsPageQuerySchema = exports2.functionProcessRunQuerySchema = exports2.functionProcessRunSummarySchema = exports2.functionProcessRunStatusSchema = exports2.functionProcessReadScopesSchema = exports2.FUNCTION_PROCESS_READ_PATH = exports2.FUNCTION_PROCESS_TOKEN_HEADER = void 0;
17896
+ exports2.FunctionProcessReadError = exports2.functionProcessReadRequestSchema = exports2.functionProcessRunsPageSchema = exports2.functionProcessCompletedAgentReferenceSchema = exports2.functionProcessCompletedAgentReferenceQuerySchema = exports2.functionProcessCompletedNodeSchema = exports2.functionProcessCompletedNodeQuerySchema = exports2.functionProcessRunsPageQuerySchema = exports2.functionProcessRunQuerySchema = exports2.functionProcessRunSummarySchema = exports2.functionProcessRunStatusSchema = exports2.functionProcessReadScopesSchema = exports2.FUNCTION_PROCESS_READ_PATH = exports2.FUNCTION_PROCESS_TOKEN_HEADER = void 0;
17878
17897
  exports2.readFunctionProcessScopes = readFunctionProcessScopes;
17879
17898
  var zod_12 = require_zod();
17880
17899
  exports2.FUNCTION_PROCESS_TOKEN_HEADER = "x-sequence-process-service-token";
@@ -17928,6 +17947,15 @@ var require_processes_contract = __commonJS({
17928
17947
  cursor: zod_12.z.string().min(1).max(8192).optional(),
17929
17948
  archived: zod_12.z.boolean().optional()
17930
17949
  });
17950
+ exports2.functionProcessCompletedNodeQuerySchema = exports2.functionProcessRunQuerySchema.extend({ nodeId: entityId });
17951
+ exports2.functionProcessCompletedNodeSchema = zod_12.z.strictObject({
17952
+ runId: entityId,
17953
+ processId,
17954
+ processVersion: entityId,
17955
+ nodeId: entityId,
17956
+ stepId: entityId,
17957
+ completedAt: zod_12.z.iso.datetime({ offset: true })
17958
+ });
17931
17959
  exports2.functionProcessCompletedAgentReferenceQuerySchema = exports2.functionProcessRunQuerySchema.extend({ nodeId: entityId });
17932
17960
  exports2.functionProcessCompletedAgentReferenceSchema = zod_12.z.strictObject({
17933
17961
  stepId: entityId,
@@ -17943,6 +17971,7 @@ var require_processes_contract = __commonJS({
17943
17971
  });
17944
17972
  exports2.functionProcessReadRequestSchema = zod_12.z.discriminatedUnion("operation", [
17945
17973
  exports2.functionProcessRunQuerySchema.extend({ operation: zod_12.z.literal("getRun") }),
17974
+ exports2.functionProcessCompletedNodeQuerySchema.extend({ operation: zod_12.z.literal("getCompletedNode") }),
17946
17975
  exports2.functionProcessCompletedAgentReferenceQuerySchema.extend({ operation: zod_12.z.literal("getCompletedAgentReference") }),
17947
17976
  exports2.functionProcessRunsPageQuerySchema.extend({
17948
17977
  operation: zod_12.z.literal("listRunsPage")
@@ -18109,6 +18138,12 @@ var require_processes = __commonJS({
18109
18138
  });
18110
18139
  const read = ({ body, schema }) => transport({ body: processes_contract_1.functionProcessReadRequestSchema.parse(body), schema });
18111
18140
  return {
18141
+ async getCompletedNode(query) {
18142
+ const proof = await read({ body: { ...query, operation: "getCompletedNode" }, schema: processes_contract_1.functionProcessCompletedNodeSchema });
18143
+ if (proof.runId !== query.runId || proof.processId !== query.process || proof.nodeId !== query.nodeId)
18144
+ throw new processes_contract_1.FunctionProcessReadError(502, "malformed_response", "Atlas returned a different completed node");
18145
+ return proof;
18146
+ },
18112
18147
  async getCompletedAgentReference(query) {
18113
18148
  const agent = readAgentCredential({ request });
18114
18149
  const readReference = (0, invocation_client_1.createInvocationReadTransport)({
@@ -28978,7 +29013,7 @@ var require_contracts = __commonJS({
28978
29013
  "../storage/dist/contracts.js"(exports2) {
28979
29014
  "use strict";
28980
29015
  Object.defineProperty(exports2, "__esModule", { value: true });
28981
- exports2.storageErrorSchema = exports2.storageAccessSchema = exports2.updateStorageAccessSchema = exports2.storagePrincipalSchema = exports2.reconcileUploadsResultSchema = exports2.reconcileUploadsSchema = exports2.uploadListSchema = exports2.uploadLimitsSchema = exports2.uploadListItemSchema = exports2.uploadSessionSchema = exports2.startUploadBatchSchema = exports2.completeUploadSchema = exports2.startUploadSchema = exports2.storageChecksum = exports2.STORAGE_IMPORT_CONCURRENCY_MAX = exports2.STORAGE_IMPORT_CONCURRENCY_DEFAULT = exports2.STORAGE_UPLOAD_BATCH_LIMIT = exports2.STORAGE_PENDING_UPLOADS_PER_WORKSPACE = exports2.STORAGE_PENDING_UPLOADS_PER_PRINCIPAL = exports2.updateNodeSchema = exports2.createFolderSchema = exports2.listStorageSchema = exports2.storagePage = exports2.listStorageOperationsSchema = exports2.storageOperationScope = exports2.operationSchema = exports2.versionSchema = exports2.nodeSchema = exports2.workspaceSchema = exports2.workspaceManifestSchema = exports2.storageMetadata = exports2.storagePath = exports2.storageName = exports2.storageLifecycle = exports2.storageRole = exports2.storageId = void 0;
29016
+ exports2.storageErrorSchema = exports2.storageAccessSchema = exports2.updateStorageAccessSchema = exports2.storagePrincipalSchema = exports2.reconcileUploadsResultSchema = exports2.reconcileUploadsSchema = exports2.uploadListSchema = exports2.uploadLimitsSchema = exports2.uploadListItemSchema = exports2.uploadSessionSchema = exports2.startUploadBatchSchema = exports2.completeUploadSchema = exports2.startUploadSchema = exports2.storageChecksum = exports2.STORAGE_IMPORT_CONCURRENCY_MAX = exports2.STORAGE_IMPORT_CONCURRENCY_DEFAULT = exports2.STORAGE_UPLOAD_BATCH_LIMIT = exports2.STORAGE_PENDING_UPLOADS_PER_WORKSPACE = exports2.STORAGE_PENDING_UPLOADS_PER_PRINCIPAL = exports2.updateNodeSchema = exports2.createFolderSchema = exports2.listStorageSchema = exports2.storagePage = exports2.listStorageOperationsSchema = exports2.storageOperationScope = exports2.operationSchema = exports2.versionSchema = exports2.nodeWithAncestorsSchema = exports2.nodeSchema = exports2.workspaceSchema = exports2.workspaceManifestSchema = exports2.storageMetadata = exports2.storagePath = exports2.storageName = exports2.storageLifecycle = exports2.storageRole = exports2.storageId = void 0;
28982
29017
  var zod_12 = require_zod();
28983
29018
  var paths_js_1 = require_paths();
28984
29019
  exports2.storageId = zod_12.z.uuid();
@@ -29043,6 +29078,9 @@ var require_contracts = __commonJS({
29043
29078
  size: zod_12.z.number().nullable(),
29044
29079
  contentType: zod_12.z.string().nullable()
29045
29080
  });
29081
+ exports2.nodeWithAncestorsSchema = exports2.nodeSchema.extend({
29082
+ ancestors: zod_12.z.array(exports2.nodeSchema)
29083
+ });
29046
29084
  exports2.versionSchema = zod_12.z.object({
29047
29085
  id: exports2.storageId,
29048
29086
  fileId: exports2.storageId,
@@ -29669,6 +29707,8 @@ var require_client = __commonJS({
29669
29707
  delete: (expectedRevision) => request("DELETE", `${root}${query({ expectedRevision })}`, contracts_js_1.operationSchema),
29670
29708
  list: (options = {}) => replayable("GET", `${root}/nodes${query({ ...options })}`, (0, contracts_js_1.storagePage)(contracts_js_1.nodeSchema)),
29671
29709
  getNode: (id2) => replayable("GET", node(id2), contracts_js_1.nodeSchema),
29710
+ /** getNode plus its readable ancestors, decided in the same request. */
29711
+ getNodeWithAncestors: (id2) => replayable("GET", `${node(id2)}${query({ include: "ancestors" })}`, contracts_js_1.nodeWithAncestorsSchema),
29672
29712
  /**
29673
29713
  * Keyed like upload start, so every resend (storage_busy,
29674
29714
  * permissions_pending, a lost reply) returns the one folder it made.
@@ -29902,19 +29942,50 @@ var require_directory_contract = __commonJS({
29902
29942
  }
29903
29943
  });
29904
29944
 
29945
+ // dist/directory-roster-contract.js
29946
+ var require_directory_roster_contract = __commonJS({
29947
+ "dist/directory-roster-contract.js"(exports2) {
29948
+ "use strict";
29949
+ Object.defineProperty(exports2, "__esModule", { value: true });
29950
+ exports2.directoryRosterPageSchema = exports2.directoryRosterQuerySchema = exports2.functionDirectoryRostersSchema = exports2.FUNCTION_DIRECTORY_ROSTER_PATH = void 0;
29951
+ exports2.readFunctionDirectoryRosterGroups = readFunctionDirectoryRosterGroups;
29952
+ var zod_12 = require_zod();
29953
+ var directory_config_1 = require_directory_config();
29954
+ var directory_contract_1 = require_directory_contract();
29955
+ exports2.FUNCTION_DIRECTORY_ROSTER_PATH = "/api/managed-functions/directory/roster";
29956
+ exports2.functionDirectoryRostersSchema = zod_12.z.array(directory_config_1.directoryGroupIdSchema).min(1).max(16).refine((groups) => new Set(groups).size === groups.length, "Roster groups must be distinct");
29957
+ exports2.directoryRosterQuerySchema = zod_12.z.object({
29958
+ tenant: directory_contract_1.directoryTenantSchema,
29959
+ groupId: directory_config_1.directoryGroupIdSchema,
29960
+ limit: zod_12.z.number().int().min(1).max(50).default(50),
29961
+ cursor: zod_12.z.string().max(2048).optional()
29962
+ }).strict();
29963
+ exports2.directoryRosterPageSchema = zod_12.z.object({
29964
+ members: zod_12.z.array(zod_12.z.object({ id: zod_12.z.string(), sub: zod_12.z.string(), name: zod_12.z.string(), email: zod_12.z.string(), deactivated: zod_12.z.literal(false) }).strict()).max(50),
29965
+ nextCursor: zod_12.z.string().nullable()
29966
+ }).strict();
29967
+ function readFunctionDirectoryRosterGroups(manifest) {
29968
+ const parsed = zod_12.z.object({ capabilities: zod_12.z.object({ directory: zod_12.z.object({ rosters: exports2.functionDirectoryRostersSchema.optional() }).optional() }).optional() }).safeParse(manifest);
29969
+ return parsed.success ? parsed.data.capabilities?.directory?.rosters ?? [] : [];
29970
+ }
29971
+ }
29972
+ });
29973
+
29905
29974
  // dist/directory-manifest.js
29906
29975
  var require_directory_manifest = __commonJS({
29907
29976
  "dist/directory-manifest.js"(exports2) {
29908
29977
  "use strict";
29909
29978
  Object.defineProperty(exports2, "__esModule", { value: true });
29910
29979
  exports2.functionDirectoryManifestSchema = void 0;
29980
+ var directory_roster_contract_1 = require_directory_roster_contract();
29911
29981
  var zod_12 = require_zod();
29912
29982
  var directory_config_1 = require_directory_config();
29913
29983
  var directory_contract_1 = require_directory_contract();
29914
29984
  exports2.functionDirectoryManifestSchema = zod_12.z.strictObject({
29985
+ rosters: directory_roster_contract_1.functionDirectoryRostersSchema.optional(),
29915
29986
  groups: directory_config_1.directoryScopesSchema.shape.groups.optional(),
29916
29987
  resolve: directory_contract_1.functionDirectoryScopesSchema.shape.resolve.optional()
29917
- }).refine((value) => value.groups !== void 0 || value.resolve !== void 0, "Declare directory groups, tenant resolution scopes, or both");
29988
+ }).refine((value) => value.groups !== void 0 || value.resolve !== void 0, "Declare directory groups, tenant resolution scopes, or both").refine((value) => value.rosters === void 0 || value.resolve !== void 0, "Service rosters also require directory resolve tenant scopes");
29918
29989
  }
29919
29990
  });
29920
29991
 
@@ -30290,6 +30361,7 @@ var require_capabilities = __commonJS({
30290
30361
  sdk: { package: exports2.MANAGED_FUNCTION_SDK_PACKAGE, min: "0.3.0" }
30291
30362
  },
30292
30363
  features: {
30364
+ directory_rosters: { field: "capabilities.directory.rosters", supported: true, limit: "1 to 16 explicit groups; up to 50 active tenant members per page; directory Reader and group membership required", min_cli: "0.6.6", min_sdk: "0.4.4" },
30293
30365
  directory_members: {
30294
30366
  field: "capabilities.directory.groups",
30295
30367
  supported: true,
@@ -30311,6 +30383,13 @@ var require_capabilities = __commonJS({
30311
30383
  min_cli: "0.5.5",
30312
30384
  min_sdk: "0.4.2"
30313
30385
  },
30386
+ invocation_caller_capabilities: {
30387
+ field: "capabilities.invocation.caller_capabilities",
30388
+ supported: true,
30389
+ limit: "current human caller capabilities declared by this exact active receiver; at most 256 pins",
30390
+ min_cli: "0.6.6",
30391
+ min_sdk: "0.4.4"
30392
+ },
30314
30393
  invocation_identity: {
30315
30394
  field: "capabilities.invocation.identity",
30316
30395
  supported: true,
@@ -30501,8 +30580,10 @@ var require_deployed_policy = __commonJS({
30501
30580
  features: {
30502
30581
  immutable_release: normalizeImmutableRelease(features.immutable_release),
30503
30582
  invocation_identity: normalizeInvocationIdentity(features.invocation_identity),
30583
+ invocation_caller_capabilities: normalizeInvocationIdentity(features.invocation_caller_capabilities, "capabilities.invocation.caller_capabilities"),
30504
30584
  directory_members: normalizeDirectoryMembers(features.directory_members),
30505
30585
  directory_resolve: normalizeDirectory(features.directory_resolve),
30586
+ directory_rosters: normalizeRosters(features.directory_rosters),
30506
30587
  abrigo_read: normalizeAbrigo(features.abrigo_read),
30507
30588
  lattice_context: normalizeLatticeContext(features.lattice_context),
30508
30589
  postgres_egress: normalizePostgres(features.postgres_egress),
@@ -30553,13 +30634,13 @@ var require_deployed_policy = __commonJS({
30553
30634
  return void 0;
30554
30635
  return { field: typeof value.field === "string" ? value.field : "capabilities.abrigo.read", supported: value.supported, limit: value.limit, min_cli: value.min_cli, min_sdk: value.min_sdk };
30555
30636
  }
30556
- function normalizeInvocationIdentity(value) {
30637
+ function normalizeInvocationIdentity(value, defaultField = "capabilities.invocation.identity") {
30557
30638
  if (!value || typeof value.supported !== "boolean" || typeof value.limit !== "string")
30558
30639
  return void 0;
30559
30640
  if (typeof value.min_cli !== "string" || typeof value.min_sdk !== "string")
30560
30641
  return void 0;
30561
30642
  return {
30562
- field: typeof value.field === "string" ? value.field : "capabilities.invocation.identity",
30643
+ field: typeof value.field === "string" ? value.field : defaultField,
30563
30644
  supported: value.supported,
30564
30645
  limit: value.limit,
30565
30646
  min_cli: value.min_cli,
@@ -30675,6 +30756,11 @@ var require_deployed_policy = __commonJS({
30675
30756
  min_sdk: value.min_sdk
30676
30757
  };
30677
30758
  }
30759
+ function normalizeRosters(value) {
30760
+ if (!value || typeof value.supported !== "boolean" || typeof value.limit !== "string" || typeof value.min_cli !== "string" || typeof value.min_sdk !== "string")
30761
+ return void 0;
30762
+ return { field: typeof value.field === "string" ? value.field : "capabilities.directory.rosters", supported: value.supported, limit: value.limit, min_cli: value.min_cli, min_sdk: value.min_sdk };
30763
+ }
30678
30764
  }
30679
30765
  });
30680
30766
 
@@ -30697,6 +30783,29 @@ var require_preflight_issue = __commonJS({
30697
30783
  }
30698
30784
  });
30699
30785
 
30786
+ // dist/preflight-service-directory-roster.js
30787
+ var require_preflight_service_directory_roster = __commonJS({
30788
+ "dist/preflight-service-directory-roster.js"(exports2) {
30789
+ "use strict";
30790
+ Object.defineProperty(exports2, "__esModule", { value: true });
30791
+ exports2.checkDirectoryRosters = checkDirectoryRosters;
30792
+ var capabilities_1 = require_capabilities();
30793
+ var preflight_issue_1 = require_preflight_issue();
30794
+ var sdk_range_1 = require_sdk_range();
30795
+ function checkDirectoryRosters({ capabilities, tooling, cliVersion, sdkVersion, checkDeployment, issues }) {
30796
+ const deployed = capabilities?.features.directory_rosters;
30797
+ const feature = deployed ?? capabilities_1.MANAGED_FUNCTION_CAPABILITIES.features.directory_rosters;
30798
+ const details = { field: feature.field, limit: feature.limit, tooling, requiredCli: feature.min_cli, requiredSdk: feature.min_sdk, cliVersion, sdkVersion };
30799
+ if (checkDeployment && deployed?.supported !== true) {
30800
+ issues.push((0, preflight_issue_1.createPreflightIssue)({ ...details, problem: "scoped service group rosters are not supported by this deployment" }));
30801
+ return;
30802
+ }
30803
+ if ((0, capabilities_1.versionIsOlder)(cliVersion, feature.min_cli) || sdkVersion && (0, sdk_range_1.sdkConstraintIsOlder)(sdkVersion, feature.min_sdk))
30804
+ issues.push((0, preflight_issue_1.createPreflightIssue)({ ...details, problem: "the installed tooling does not support scoped service group rosters" }));
30805
+ }
30806
+ }
30807
+ });
30808
+
30700
30809
  // dist/preflight-processes.js
30701
30810
  var require_preflight_processes = __commonJS({
30702
30811
  "dist/preflight-processes.js"(exports2) {
@@ -30834,6 +30943,22 @@ var require_preflight_invocation = __commonJS({
30834
30943
  }));
30835
30944
  return;
30836
30945
  }
30946
+ if (parsed.data.caller_capabilities) {
30947
+ const observed = capabilities?.features.invocation_caller_capabilities;
30948
+ const required = capabilities_1.MANAGED_FUNCTION_CAPABILITIES.features.invocation_caller_capabilities;
30949
+ if (checkDeployment && observed?.supported !== true || (0, capabilities_1.versionIsOlder)(cliVersion, required.min_cli) || !sdkVersion || (0, sdk_range_1.sdkConstraintIsOlder)(sdkVersion, required.min_sdk)) {
30950
+ issues.push((0, preflight_issue_1.createPreflightIssue)({
30951
+ limit: required.limit,
30952
+ tooling,
30953
+ requiredCli: required.min_cli,
30954
+ requiredSdk: required.min_sdk,
30955
+ cliVersion,
30956
+ sdkVersion,
30957
+ field: required.field,
30958
+ problem: "Current caller capability reads require deployed support and compatible tooling"
30959
+ }));
30960
+ }
30961
+ }
30837
30962
  if (checkDeployment && deployed?.supported !== true) {
30838
30963
  issues.push((0, preflight_issue_1.createPreflightIssue)({
30839
30964
  ...details,
@@ -31180,6 +31305,7 @@ var require_preflight = __commonJS({
31180
31305
  "use strict";
31181
31306
  Object.defineProperty(exports2, "__esModule", { value: true });
31182
31307
  exports2.preflightManagedFunction = preflightManagedFunction;
31308
+ var preflight_service_directory_roster_1 = require_preflight_service_directory_roster();
31183
31309
  var capabilities_1 = require_capabilities();
31184
31310
  var sdk_range_1 = require_sdk_range();
31185
31311
  var preflight_issue_1 = require_preflight_issue();
@@ -31392,6 +31518,8 @@ var require_preflight = __commonJS({
31392
31518
  return;
31393
31519
  }
31394
31520
  const scoped = (directory2) => ({ ...args, manifest: { ...args.manifest, capabilities: { ...args.manifest.capabilities, directory: directory2 } } });
31521
+ if (parsed.data.rosters)
31522
+ (0, preflight_service_directory_roster_1.checkDirectoryRosters)(args);
31395
31523
  if (parsed.data.groups)
31396
31524
  (0, preflight_directory_1.checkDirectory)(scoped({ groups: parsed.data.groups }));
31397
31525
  if (parsed.data.resolve)
@@ -31421,8 +31549,8 @@ var require_config2 = __commonJS({
31421
31549
  for (var p in m2) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m2, p);
31422
31550
  };
31423
31551
  Object.defineProperty(exports2, "__esModule", { value: true });
31424
- exports2.versionIsOlder = exports2.sdkVersionLowerBound = exports2.sdkSpecFromPackageJson = exports2.sdkVersionFromPackageJson = exports2.isPostgresEgress = exports2.formatValidationDetail = exports2.MANAGED_FUNCTION_SDK_PACKAGE = exports2.MANAGED_FUNCTION_CLI_PACKAGE = exports2.MANAGED_FUNCTION_CAPABILITIES = exports2.managedFunctionWorkloadLimitsSchema = exports2.MF_LIMITS_DEFAULTS = exports2.MF_LIMITS_CAPS = exports2.MANAGED_FUNCTION_LIMITS = exports2.readFunctionImmutableRelease = exports2.functionImmutableReleaseSchema = exports2.shouldReportAtlasHttp = exports2.directoryPrincipalResolutionSchema = exports2.directoryPrincipalResolveRequestSchema = exports2.readFunctionDirectoryScopes = exports2.functionDirectoryScopesSchema = exports2.FUNCTION_DIRECTORY_RESOLVE_PATH = exports2.FUNCTION_DIRECTORY_TOKEN_HEADER = exports2.FUNCTION_CALLER_DATA_TOKEN_HEADER = exports2.readFunctionWorkflowEvidenceScopes = exports2.readFunctionWorkflowScopes = exports2.functionWorkflowScopesSchema = exports2.functionAgentCompletedRunSchema = exports2.functionAgentCompletedRunQuerySchema = exports2.functionAgentReadRequestSchema = exports2.readFunctionAgentScopes = exports2.functionAgentReadScopesSchema = exports2.FUNCTION_AGENT_READ_PATH = exports2.FUNCTION_AGENT_TOKEN_HEADER = exports2.functionProcessCompletedAgentReferenceQuerySchema = exports2.functionProcessCompletedAgentReferenceSchema = exports2.functionProcessRunSummarySchema = exports2.functionProcessReadRequestSchema = exports2.readFunctionProcessScopes = exports2.functionProcessReadScopesSchema = exports2.FUNCTION_PROCESS_READ_PATH = exports2.FUNCTION_PROCESS_TOKEN_HEADER = exports2.readFunctionLatticeContextCapability = exports2.functionLatticeContextCapabilitySchema = exports2.functionDirectoryManifestSchema = exports2.readDirectoryGroups = exports2.directoryMembersResponse = exports2.directoryMembersInput = exports2.directoryScopesSchema = exports2.directoryGroupIdSchema = exports2.DIRECTORY_TOKEN_HEADER = void 0;
31425
- exports2.cacheManifestSchema = exports2.CACHE_MAX_TTL_SECONDS = exports2.preflightManagedFunction = exports2.parseDeployedPolicy = void 0;
31552
+ exports2.sdkSpecFromPackageJson = exports2.sdkVersionFromPackageJson = exports2.isPostgresEgress = exports2.formatValidationDetail = exports2.MANAGED_FUNCTION_SDK_PACKAGE = exports2.MANAGED_FUNCTION_CLI_PACKAGE = exports2.MANAGED_FUNCTION_CAPABILITIES = exports2.managedFunctionWorkloadLimitsSchema = exports2.MF_LIMITS_DEFAULTS = exports2.MF_LIMITS_CAPS = exports2.MANAGED_FUNCTION_LIMITS = exports2.readFunctionImmutableRelease = exports2.functionImmutableReleaseSchema = exports2.shouldReportAtlasHttp = exports2.directoryPrincipalResolutionSchema = exports2.directoryPrincipalResolveRequestSchema = exports2.readFunctionDirectoryScopes = exports2.functionDirectoryScopesSchema = exports2.FUNCTION_DIRECTORY_RESOLVE_PATH = exports2.FUNCTION_DIRECTORY_TOKEN_HEADER = exports2.FUNCTION_CALLER_DATA_TOKEN_HEADER = exports2.readFunctionWorkflowEvidenceScopes = exports2.readFunctionWorkflowScopes = exports2.functionWorkflowScopesSchema = exports2.functionAgentCompletedRunSchema = exports2.functionAgentCompletedRunQuerySchema = exports2.functionAgentReadRequestSchema = exports2.readFunctionAgentScopes = exports2.functionAgentReadScopesSchema = exports2.FUNCTION_AGENT_READ_PATH = exports2.FUNCTION_AGENT_TOKEN_HEADER = exports2.functionProcessCompletedNodeQuerySchema = exports2.functionProcessCompletedNodeSchema = exports2.functionProcessCompletedAgentReferenceQuerySchema = exports2.functionProcessCompletedAgentReferenceSchema = exports2.functionProcessRunSummarySchema = exports2.functionProcessReadRequestSchema = exports2.readFunctionProcessScopes = exports2.functionProcessReadScopesSchema = exports2.FUNCTION_PROCESS_READ_PATH = exports2.FUNCTION_PROCESS_TOKEN_HEADER = exports2.readFunctionLatticeContextCapability = exports2.functionLatticeContextCapabilitySchema = exports2.functionDirectoryManifestSchema = exports2.readDirectoryGroups = exports2.directoryMembersResponse = exports2.directoryMembersInput = exports2.directoryScopesSchema = exports2.directoryGroupIdSchema = exports2.DIRECTORY_TOKEN_HEADER = void 0;
31553
+ exports2.cacheManifestSchema = exports2.CACHE_MAX_TTL_SECONDS = exports2.preflightManagedFunction = exports2.parseDeployedPolicy = exports2.versionIsOlder = exports2.sdkVersionLowerBound = void 0;
31426
31554
  exports2.readCacheConfiguration = readCacheConfiguration;
31427
31555
  var directory_config_1 = require_directory_config();
31428
31556
  Object.defineProperty(exports2, "DIRECTORY_TOKEN_HEADER", { enumerable: true, get: function() {
@@ -31480,6 +31608,12 @@ var require_config2 = __commonJS({
31480
31608
  Object.defineProperty(exports2, "functionProcessCompletedAgentReferenceQuerySchema", { enumerable: true, get: function() {
31481
31609
  return processes_contract_1.functionProcessCompletedAgentReferenceQuerySchema;
31482
31610
  } });
31611
+ Object.defineProperty(exports2, "functionProcessCompletedNodeSchema", { enumerable: true, get: function() {
31612
+ return processes_contract_1.functionProcessCompletedNodeSchema;
31613
+ } });
31614
+ Object.defineProperty(exports2, "functionProcessCompletedNodeQuerySchema", { enumerable: true, get: function() {
31615
+ return processes_contract_1.functionProcessCompletedNodeQuerySchema;
31616
+ } });
31483
31617
  var agents_contract_1 = require_agents_contract();
31484
31618
  Object.defineProperty(exports2, "FUNCTION_AGENT_TOKEN_HEADER", { enumerable: true, get: function() {
31485
31619
  return agents_contract_1.FUNCTION_AGENT_TOKEN_HEADER;
@@ -31615,6 +31749,7 @@ var require_config2 = __commonJS({
31615
31749
  const cache = typeof manifest === "object" && manifest !== null ? Reflect.get(manifest, "cache") : void 0;
31616
31750
  return exports2.cacheManifestSchema.parse(cache ?? {});
31617
31751
  }
31752
+ __exportStar2(require_directory_roster_contract(), exports2);
31618
31753
  }
31619
31754
  });
31620
31755
 
@@ -59862,12 +59997,44 @@ var require_valkey = __commonJS({
59862
59997
  }
59863
59998
  });
59864
59999
 
60000
+ // dist/service-directory-roster.js
60001
+ var require_service_directory_roster = __commonJS({
60002
+ "dist/service-directory-roster.js"(exports2) {
60003
+ "use strict";
60004
+ Object.defineProperty(exports2, "__esModule", { value: true });
60005
+ exports2.createServiceRosterReader = createServiceRosterReader;
60006
+ var zod_12 = require_zod();
60007
+ var directory_contract_1 = require_directory_contract();
60008
+ var directory_roster_contract_1 = require_directory_roster_contract();
60009
+ function createServiceRosterReader({ origin, token, expiresAt, fetchImpl }) {
60010
+ return async (input) => {
60011
+ if (expiresAt <= Date.now() / 1e3)
60012
+ throw new directory_contract_1.DirectoryPrincipalResolveError(401, "expired_context", "The directory credential expired; start a new invocation");
60013
+ const query = directory_roster_contract_1.directoryRosterQuerySchema.safeParse(input);
60014
+ if (!query.success)
60015
+ throw new directory_contract_1.DirectoryPrincipalResolveError(400, "invalid_request", "Invalid group roster request");
60016
+ const response = await fetchImpl(`${origin}${directory_roster_contract_1.FUNCTION_DIRECTORY_ROSTER_PATH}`, { method: "POST", headers: { "content-type": "application/json", [directory_contract_1.FUNCTION_DIRECTORY_TOKEN_HEADER]: token }, body: JSON.stringify(query.data), redirect: "error", signal: AbortSignal.timeout(3e4) });
60017
+ const body = await response.json().catch(() => null);
60018
+ if (!response.ok) {
60019
+ const error = zod_12.z.object({ code: zod_12.z.string().max(128).optional(), detail: zod_12.z.string().max(2e3).optional() }).safeParse(body);
60020
+ throw new directory_contract_1.DirectoryPrincipalResolveError(response.status, error.success ? error.data.code ?? "directory_roster_failed" : "directory_roster_failed", error.success ? error.data.detail ?? "Group roster read failed" : "Group roster read failed");
60021
+ }
60022
+ const result = directory_roster_contract_1.directoryRosterPageSchema.safeParse(body);
60023
+ if (!result.success || result.data.members.length > query.data.limit || new Set(result.data.members.map((member) => member.id)).size !== result.data.members.length)
60024
+ throw new directory_contract_1.DirectoryPrincipalResolveError(502, "malformed_response", "Atlas returned an invalid group roster");
60025
+ return result.data;
60026
+ };
60027
+ }
60028
+ }
60029
+ });
60030
+
59865
60031
  // dist/service-directory.js
59866
60032
  var require_service_directory = __commonJS({
59867
60033
  "dist/service-directory.js"(exports2) {
59868
60034
  "use strict";
59869
60035
  Object.defineProperty(exports2, "__esModule", { value: true });
59870
60036
  exports2.createFunctionServiceDirectoryClient = createFunctionServiceDirectoryClient;
60037
+ var service_directory_roster_1 = require_service_directory_roster();
59871
60038
  var zod_12 = require_zod();
59872
60039
  var directory_contract_1 = require_directory_contract();
59873
60040
  function credential({ request }) {
@@ -59914,6 +60081,7 @@ var require_service_directory = __commonJS({
59914
60081
  const url = `${origin(baseUrl)}${directory_contract_1.FUNCTION_DIRECTORY_RESOLVE_PATH}`;
59915
60082
  const { token, expiresAt } = credential({ request });
59916
60083
  return {
60084
+ listGroupMembers: (0, service_directory_roster_1.createServiceRosterReader)({ origin: origin(baseUrl), token, expiresAt, fetchImpl }),
59917
60085
  async resolve(input) {
59918
60086
  if (expiresAt <= Date.now() / 1e3)
59919
60087
  throw new directory_contract_1.DirectoryPrincipalResolveError(401, "expired_context", "The directory credential expired; start a new invocation");
@@ -59954,7 +60122,7 @@ var __exportStar = exports && exports.__exportStar || function(m2, exports2) {
59954
60122
  for (var p in m2) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m2, p);
59955
60123
  };
59956
60124
  Object.defineProperty(exports, "__esModule", { value: true });
59957
- exports.createFunctionServiceDirectoryClient = exports.readCacheConfiguration = exports.cacheManifestSchema = exports.createCacheManager = exports.CacheError = exports.createFunctionStorageClient = exports.runWithFunctionTracing = exports.installFunctionTracing = exports.functionMonitoringAnnotationSchema = exports.monitoringPublishSchema = exports.monitoringEventsSchema = exports.monitoringPayloadHash = exports.FunctionMonitoringError = exports.createFunctionServiceMonitoringClient = exports.functionSourceJobAdmissionSchema = exports.functionAgentSourceExecutionSchema = exports.functionAgentConversationEvidenceRequestSchema = exports.functionAgentConversationEvidenceCaptureSchema = exports.functionAgentConversationEvidenceResponseSchema = exports.functionAgentSourceEvidenceCaptureSchema = exports.functionAgentSourceEvidenceRequestSchema = exports.functionAgentSourceResponseSchema = exports.createFunctionWorkflowEvidenceClient = exports.createFunctionServiceWorkflowsClient = exports.createFunctionAgentEvidenceClient = exports.FunctionAgentReadError = exports.createFunctionServiceAgentsClient = exports.FunctionProcessReadError = exports.createFunctionServiceProcessesClient = exports.functionLatticeHumanCompletionsPageSchema = exports.functionLatticeHumanCompletionsQuerySchema = exports.functionLatticeHumanCompletionSchema = exports.functionLatticeHumanCompletionQuerySchema = exports.functionLatticeExecutionContextSchema = exports.functionLatticeContextRequestSchema = exports.FunctionLatticeContextError = exports.FUNCTION_LATTICE_EXECUTION_TOKEN_HEADER = exports.FUNCTION_LATTICE_CONTEXT_PATH = exports.createFunctionInvocationClient = exports.functionLatticeStartProvenanceSchema = exports.functionLatticeParallelSnapshotQuerySchema = exports.functionLatticeParallelSnapshotSchema = exports.createFunctionLatticeClient = exports.readFunctionLatticeContextCapability = exports.functionLatticeContextCapabilitySchema = exports.FunctionDirectoryReadError = exports.createFunctionDirectoryClient = void 0;
60125
+ exports.functionLatticeRunCreatorAccessSchema = exports.createFunctionServiceDirectoryClient = exports.readCacheConfiguration = exports.cacheManifestSchema = exports.createCacheManager = exports.CacheError = exports.createFunctionStorageClient = exports.runWithFunctionTracing = exports.installFunctionTracing = exports.functionMonitoringAnnotationSchema = exports.monitoringPublishSchema = exports.monitoringEventsSchema = exports.monitoringPayloadHash = exports.FunctionMonitoringError = exports.createFunctionServiceMonitoringClient = exports.functionSourceJobAdmissionSchema = exports.functionAgentSourceExecutionSchema = exports.functionAgentConversationEvidenceRequestSchema = exports.functionAgentConversationEvidenceCaptureSchema = exports.functionAgentConversationEvidenceResponseSchema = exports.functionAgentSourceEvidenceCaptureSchema = exports.functionAgentSourceEvidenceRequestSchema = exports.functionAgentSourceResponseSchema = exports.createFunctionWorkflowEvidenceClient = exports.createFunctionServiceWorkflowsClient = exports.createFunctionAgentEvidenceClient = exports.FunctionAgentReadError = exports.createFunctionServiceAgentsClient = exports.FunctionProcessReadError = exports.createFunctionServiceProcessesClient = exports.functionLatticeHumanCompletionsPageSchema = exports.functionLatticeHumanCompletionsQuerySchema = exports.functionLatticeHumanCompletionSchema = exports.functionLatticeHumanCompletionQuerySchema = exports.functionLatticeExecutionContextSchema = exports.functionLatticeContextRequestSchema = exports.FunctionLatticeContextError = exports.FUNCTION_LATTICE_EXECUTION_TOKEN_HEADER = exports.FUNCTION_LATTICE_CONTEXT_PATH = exports.createFunctionInvocationClient = exports.functionLatticeStartProvenanceSchema = exports.functionLatticeParallelSnapshotQuerySchema = exports.functionLatticeParallelSnapshotSchema = exports.createFunctionLatticeClient = exports.readFunctionLatticeContextCapability = exports.functionLatticeContextCapabilitySchema = exports.FunctionDirectoryReadError = exports.createFunctionDirectoryClient = void 0;
59958
60126
  exports.createManagedFunctionContext = createManagedFunctionContext;
59959
60127
  var directory_1 = require_directory();
59960
60128
  Object.defineProperty(exports, "createFunctionDirectoryClient", { enumerable: true, get: function() {
@@ -60161,6 +60329,11 @@ var service_directory_1 = require_service_directory();
60161
60329
  Object.defineProperty(exports, "createFunctionServiceDirectoryClient", { enumerable: true, get: function() {
60162
60330
  return service_directory_1.createFunctionServiceDirectoryClient;
60163
60331
  } });
60332
+ __exportStar(require_directory_roster_contract(), exports);
60333
+ var lattice_provenance_contract_5 = require_lattice_provenance_contract();
60334
+ Object.defineProperty(exports, "functionLatticeRunCreatorAccessSchema", { enumerable: true, get: function() {
60335
+ return lattice_provenance_contract_5.functionLatticeRunCreatorAccessSchema;
60336
+ } });
60164
60337
  /*! Bundled license information:
60165
60338
 
60166
60339
  web-streams-polyfill/dist/ponyfill.es2018.js:
@@ -0,0 +1,7 @@
1
+ import { type DirectoryRosterQuery, type DirectoryRosterPage } from './directory-roster-contract';
2
+ export declare function createServiceRosterReader({ origin, token, expiresAt, fetchImpl }: {
3
+ origin: string;
4
+ token: string;
5
+ expiresAt: number;
6
+ fetchImpl: typeof fetch;
7
+ }): (input: DirectoryRosterQuery) => Promise<DirectoryRosterPage>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createServiceRosterReader = createServiceRosterReader;
4
+ const zod_1 = require("zod");
5
+ const directory_contract_1 = require("./directory-contract");
6
+ const directory_roster_contract_1 = require("./directory-roster-contract");
7
+ function createServiceRosterReader({ origin, token, expiresAt, fetchImpl }) {
8
+ return async (input) => {
9
+ if (expiresAt <= Date.now() / 1000)
10
+ throw new directory_contract_1.DirectoryPrincipalResolveError(401, 'expired_context', 'The directory credential expired; start a new invocation');
11
+ const query = directory_roster_contract_1.directoryRosterQuerySchema.safeParse(input);
12
+ if (!query.success)
13
+ throw new directory_contract_1.DirectoryPrincipalResolveError(400, 'invalid_request', 'Invalid group roster request');
14
+ const response = await fetchImpl(`${origin}${directory_roster_contract_1.FUNCTION_DIRECTORY_ROSTER_PATH}`, { method: 'POST', headers: { 'content-type': 'application/json', [directory_contract_1.FUNCTION_DIRECTORY_TOKEN_HEADER]: token }, body: JSON.stringify(query.data), redirect: 'error', signal: AbortSignal.timeout(30_000) });
15
+ const body = await response.json().catch(() => null);
16
+ if (!response.ok) {
17
+ const error = zod_1.z.object({ code: zod_1.z.string().max(128).optional(), detail: zod_1.z.string().max(2000).optional() }).safeParse(body);
18
+ throw new directory_contract_1.DirectoryPrincipalResolveError(response.status, error.success ? error.data.code ?? 'directory_roster_failed' : 'directory_roster_failed', error.success ? error.data.detail ?? 'Group roster read failed' : 'Group roster read failed');
19
+ }
20
+ const result = directory_roster_contract_1.directoryRosterPageSchema.safeParse(body);
21
+ if (!result.success || result.data.members.length > query.data.limit || new Set(result.data.members.map(member => member.id)).size !== result.data.members.length)
22
+ throw new directory_contract_1.DirectoryPrincipalResolveError(502, 'malformed_response', 'Atlas returned an invalid group roster');
23
+ return result.data;
24
+ };
25
+ }
@@ -1,3 +1,4 @@
1
+ import type { DirectoryRosterQuery, DirectoryRosterPage } from './directory-roster-contract';
1
2
  import { type DirectoryPrincipalResolveRequest, type DirectoryPrincipalResolution } from './directory-contract';
2
3
  export interface FunctionServiceDirectoryOptions {
3
4
  request: {
@@ -7,6 +8,7 @@ export interface FunctionServiceDirectoryOptions {
7
8
  fetchImpl?: typeof globalThis.fetch;
8
9
  }
9
10
  export interface FunctionServiceDirectoryClient {
11
+ listGroupMembers(input: DirectoryRosterQuery): Promise<DirectoryRosterPage>;
10
12
  resolve(input: DirectoryPrincipalResolveRequest): Promise<DirectoryPrincipalResolution>;
11
13
  }
12
14
  export declare function createFunctionServiceDirectoryClient({ request, baseUrl, fetchImpl }: FunctionServiceDirectoryOptions): FunctionServiceDirectoryClient;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createFunctionServiceDirectoryClient = createFunctionServiceDirectoryClient;
4
+ const service_directory_roster_1 = require("./service-directory-roster");
4
5
  const zod_1 = require("zod");
5
6
  const directory_contract_1 = require("./directory-contract");
6
7
  function credential({ request }) {
@@ -51,6 +52,7 @@ function createFunctionServiceDirectoryClient({ request, baseUrl, fetchImpl = gl
51
52
  const url = `${origin(baseUrl)}${directory_contract_1.FUNCTION_DIRECTORY_RESOLVE_PATH}`;
52
53
  const { token, expiresAt } = credential({ request });
53
54
  return {
55
+ listGroupMembers: (0, service_directory_roster_1.createServiceRosterReader)({ origin: origin(baseUrl), token, expiresAt, fetchImpl }),
54
56
  async resolve(input) {
55
57
  if (expiresAt <= Date.now() / 1000)
56
58
  throw new directory_contract_1.DirectoryPrincipalResolveError(401, 'expired_context', 'The directory credential expired; start a new invocation');
package/dist/storage.d.ts CHANGED
@@ -134,6 +134,40 @@ export declare function createFunctionStorageClient({ baseUrl, headers, mode, }:
134
134
  size: number | null;
135
135
  contentType: string | null;
136
136
  }>;
137
+ getNodeWithAncestors: (id: string) => Promise<{
138
+ id: string;
139
+ workspaceId: string;
140
+ parentId: string | null;
141
+ name: string;
142
+ kind: "file" | "folder";
143
+ state: "active" | "trashed" | "purging";
144
+ restricted: boolean;
145
+ revision: number;
146
+ currentVersionId: string | null;
147
+ metadata: Record<string, string>;
148
+ createdAt: string;
149
+ updatedAt: string;
150
+ role: "viewer" | "editor" | "admin";
151
+ size: number | null;
152
+ contentType: string | null;
153
+ ancestors: {
154
+ id: string;
155
+ workspaceId: string;
156
+ parentId: string | null;
157
+ name: string;
158
+ kind: "file" | "folder";
159
+ state: "active" | "trashed" | "purging";
160
+ restricted: boolean;
161
+ revision: number;
162
+ currentVersionId: string | null;
163
+ metadata: Record<string, string>;
164
+ createdAt: string;
165
+ updatedAt: string;
166
+ role: "viewer" | "editor" | "admin";
167
+ size: number | null;
168
+ contentType: string | null;
169
+ }[];
170
+ }>;
137
171
  createFolder: (name: string, parentId?: string | null, { idempotencyKey, }?: {
138
172
  idempotencyKey?: string;
139
173
  }) => Promise<{