@sequenceholdings/managed-functions 0.4.2 → 0.4.4
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/README.md +86 -2
- package/dist/capabilities.d.ts +28 -0
- package/dist/capabilities.js +6 -0
- package/dist/config.d.ts +2 -1
- package/dist/config.js +5 -2
- package/dist/deployed-policy.js +9 -2
- package/dist/directory-manifest.d.ts +1 -0
- package/dist/directory-manifest.js +3 -1
- package/dist/directory-roster-contract.d.ts +22 -0
- package/dist/directory-roster-contract.js +24 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/dist/invocation-contract.d.ts +25 -2
- package/dist/invocation-contract.js +21 -6
- package/dist/invocation.d.ts +2 -1
- package/dist/invocation.js +48 -38
- package/dist/lattice-provenance-contract.d.ts +88 -0
- package/dist/lattice-provenance-contract.js +10 -1
- package/dist/lattice-provenance.d.ts +2 -1
- package/dist/lattice-provenance.js +3 -0
- package/dist/monitoring-contract.d.ts +2 -2
- package/dist/monitoring-contract.js +2 -2
- package/dist/orm.d.ts +4 -1
- package/dist/preflight-invocation.js +31 -5
- package/dist/preflight-service-directory-roster.d.ts +2 -0
- package/dist/preflight-service-directory-roster.js +17 -0
- package/dist/preflight.js +3 -0
- package/dist/processes-contract.d.ts +20 -0
- package/dist/processes-contract.js +7 -1
- package/dist/processes.d.ts +2 -1
- package/dist/processes.js +6 -0
- package/dist/runtime.cjs +217 -46
- package/dist/service-directory-roster.d.ts +7 -0
- package/dist/service-directory-roster.js +25 -0
- package/dist/service-directory.d.ts +2 -0
- package/dist/service-directory.js +2 -0
- package/package.json +3 -3
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.
|
|
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
|
-
|
|
17837
|
-
|
|
17838
|
-
|
|
17839
|
-
|
|
17840
|
-
|
|
17841
|
-
|
|
17842
|
-
|
|
17843
|
-
|
|
17844
|
-
|
|
17845
|
-
|
|
17846
|
-
|
|
17847
|
-
|
|
17848
|
-
|
|
17849
|
-
|
|
17850
|
-
|
|
17851
|
-
|
|
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");
|
|
17866
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");
|
|
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)({
|
|
@@ -18871,8 +18906,8 @@ var require_monitoring_contract = __commonJS({
|
|
|
18871
18906
|
var monitoring_annotations_12 = require_monitoring_annotations();
|
|
18872
18907
|
exports2.FUNCTION_MONITORING_TOKEN_HEADER = "x-sequence-monitoring-service-token";
|
|
18873
18908
|
exports2.FUNCTION_MONITORING_DELIVERIES_PATH = "/api/managed-functions/monitoring/deliveries";
|
|
18874
|
-
exports2.MONITORING_PRODUCER_CAPABILITY = "
|
|
18875
|
-
exports2.MONITORING_CATALOG_CAPABILITY = "
|
|
18909
|
+
exports2.MONITORING_PRODUCER_CAPABILITY = "emit-monitoring";
|
|
18910
|
+
exports2.MONITORING_CATALOG_CAPABILITY = "read-monitoring-catalog";
|
|
18876
18911
|
exports2.MAX_MONITORING_DELIVERY_BYTES = 512 * 1024;
|
|
18877
18912
|
var producer = zod_12.z.string().min(1).max(41).regex(/^[a-z][a-z0-9_]{0,40}$/);
|
|
18878
18913
|
exports2.functionMonitoringScopesSchema = zod_12.z.strictObject({
|
|
@@ -29268,9 +29303,12 @@ var require_transfer = __commonJS({
|
|
|
29268
29303
|
}
|
|
29269
29304
|
};
|
|
29270
29305
|
exports2.StorageTransferError = StorageTransferError;
|
|
29306
|
+
var BUCKET_HOST = /^[a-z0-9][a-z0-9_-]{1,61}[a-z0-9]\.storage\.googleapis\.com$/;
|
|
29271
29307
|
function checkedUploadUrl(value) {
|
|
29272
29308
|
const url = new URL(value);
|
|
29273
|
-
|
|
29309
|
+
const jsonSession = url.hostname === "storage.googleapis.com" && url.pathname.startsWith("/upload/");
|
|
29310
|
+
const bucketHostSession = BUCKET_HOST.test(url.hostname) && url.pathname !== "/";
|
|
29311
|
+
if (url.protocol !== "https:" || !(jsonSession || bucketHostSession) || !url.searchParams.has("upload_id") || url.port || url.username || url.password) {
|
|
29274
29312
|
throw new StorageTransferError("Invalid storage upload destination");
|
|
29275
29313
|
}
|
|
29276
29314
|
return url.href;
|
|
@@ -29899,19 +29937,50 @@ var require_directory_contract = __commonJS({
|
|
|
29899
29937
|
}
|
|
29900
29938
|
});
|
|
29901
29939
|
|
|
29940
|
+
// dist/directory-roster-contract.js
|
|
29941
|
+
var require_directory_roster_contract = __commonJS({
|
|
29942
|
+
"dist/directory-roster-contract.js"(exports2) {
|
|
29943
|
+
"use strict";
|
|
29944
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
29945
|
+
exports2.directoryRosterPageSchema = exports2.directoryRosterQuerySchema = exports2.functionDirectoryRostersSchema = exports2.FUNCTION_DIRECTORY_ROSTER_PATH = void 0;
|
|
29946
|
+
exports2.readFunctionDirectoryRosterGroups = readFunctionDirectoryRosterGroups;
|
|
29947
|
+
var zod_12 = require_zod();
|
|
29948
|
+
var directory_config_1 = require_directory_config();
|
|
29949
|
+
var directory_contract_1 = require_directory_contract();
|
|
29950
|
+
exports2.FUNCTION_DIRECTORY_ROSTER_PATH = "/api/managed-functions/directory/roster";
|
|
29951
|
+
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");
|
|
29952
|
+
exports2.directoryRosterQuerySchema = zod_12.z.object({
|
|
29953
|
+
tenant: directory_contract_1.directoryTenantSchema,
|
|
29954
|
+
groupId: directory_config_1.directoryGroupIdSchema,
|
|
29955
|
+
limit: zod_12.z.number().int().min(1).max(50).default(50),
|
|
29956
|
+
cursor: zod_12.z.string().max(2048).optional()
|
|
29957
|
+
}).strict();
|
|
29958
|
+
exports2.directoryRosterPageSchema = zod_12.z.object({
|
|
29959
|
+
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),
|
|
29960
|
+
nextCursor: zod_12.z.string().nullable()
|
|
29961
|
+
}).strict();
|
|
29962
|
+
function readFunctionDirectoryRosterGroups(manifest) {
|
|
29963
|
+
const parsed = zod_12.z.object({ capabilities: zod_12.z.object({ directory: zod_12.z.object({ rosters: exports2.functionDirectoryRostersSchema.optional() }).optional() }).optional() }).safeParse(manifest);
|
|
29964
|
+
return parsed.success ? parsed.data.capabilities?.directory?.rosters ?? [] : [];
|
|
29965
|
+
}
|
|
29966
|
+
}
|
|
29967
|
+
});
|
|
29968
|
+
|
|
29902
29969
|
// dist/directory-manifest.js
|
|
29903
29970
|
var require_directory_manifest = __commonJS({
|
|
29904
29971
|
"dist/directory-manifest.js"(exports2) {
|
|
29905
29972
|
"use strict";
|
|
29906
29973
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
29907
29974
|
exports2.functionDirectoryManifestSchema = void 0;
|
|
29975
|
+
var directory_roster_contract_1 = require_directory_roster_contract();
|
|
29908
29976
|
var zod_12 = require_zod();
|
|
29909
29977
|
var directory_config_1 = require_directory_config();
|
|
29910
29978
|
var directory_contract_1 = require_directory_contract();
|
|
29911
29979
|
exports2.functionDirectoryManifestSchema = zod_12.z.strictObject({
|
|
29980
|
+
rosters: directory_roster_contract_1.functionDirectoryRostersSchema.optional(),
|
|
29912
29981
|
groups: directory_config_1.directoryScopesSchema.shape.groups.optional(),
|
|
29913
29982
|
resolve: directory_contract_1.functionDirectoryScopesSchema.shape.resolve.optional()
|
|
29914
|
-
}).refine((value) => value.groups !== void 0 || value.resolve !== void 0, "Declare directory groups, tenant resolution scopes, or both");
|
|
29983
|
+
}).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");
|
|
29915
29984
|
}
|
|
29916
29985
|
});
|
|
29917
29986
|
|
|
@@ -30287,6 +30356,7 @@ var require_capabilities = __commonJS({
|
|
|
30287
30356
|
sdk: { package: exports2.MANAGED_FUNCTION_SDK_PACKAGE, min: "0.3.0" }
|
|
30288
30357
|
},
|
|
30289
30358
|
features: {
|
|
30359
|
+
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" },
|
|
30290
30360
|
directory_members: {
|
|
30291
30361
|
field: "capabilities.directory.groups",
|
|
30292
30362
|
supported: true,
|
|
@@ -30308,6 +30378,13 @@ var require_capabilities = __commonJS({
|
|
|
30308
30378
|
min_cli: "0.5.5",
|
|
30309
30379
|
min_sdk: "0.4.2"
|
|
30310
30380
|
},
|
|
30381
|
+
invocation_caller_capabilities: {
|
|
30382
|
+
field: "capabilities.invocation.caller_capabilities",
|
|
30383
|
+
supported: true,
|
|
30384
|
+
limit: "current human caller capabilities declared by this exact active receiver; at most 256 pins",
|
|
30385
|
+
min_cli: "0.6.6",
|
|
30386
|
+
min_sdk: "0.4.4"
|
|
30387
|
+
},
|
|
30311
30388
|
invocation_identity: {
|
|
30312
30389
|
field: "capabilities.invocation.identity",
|
|
30313
30390
|
supported: true,
|
|
@@ -30498,8 +30575,10 @@ var require_deployed_policy = __commonJS({
|
|
|
30498
30575
|
features: {
|
|
30499
30576
|
immutable_release: normalizeImmutableRelease(features.immutable_release),
|
|
30500
30577
|
invocation_identity: normalizeInvocationIdentity(features.invocation_identity),
|
|
30578
|
+
invocation_caller_capabilities: normalizeInvocationIdentity(features.invocation_caller_capabilities, "capabilities.invocation.caller_capabilities"),
|
|
30501
30579
|
directory_members: normalizeDirectoryMembers(features.directory_members),
|
|
30502
30580
|
directory_resolve: normalizeDirectory(features.directory_resolve),
|
|
30581
|
+
directory_rosters: normalizeRosters(features.directory_rosters),
|
|
30503
30582
|
abrigo_read: normalizeAbrigo(features.abrigo_read),
|
|
30504
30583
|
lattice_context: normalizeLatticeContext(features.lattice_context),
|
|
30505
30584
|
postgres_egress: normalizePostgres(features.postgres_egress),
|
|
@@ -30550,13 +30629,13 @@ var require_deployed_policy = __commonJS({
|
|
|
30550
30629
|
return void 0;
|
|
30551
30630
|
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 };
|
|
30552
30631
|
}
|
|
30553
|
-
function normalizeInvocationIdentity(value) {
|
|
30632
|
+
function normalizeInvocationIdentity(value, defaultField = "capabilities.invocation.identity") {
|
|
30554
30633
|
if (!value || typeof value.supported !== "boolean" || typeof value.limit !== "string")
|
|
30555
30634
|
return void 0;
|
|
30556
30635
|
if (typeof value.min_cli !== "string" || typeof value.min_sdk !== "string")
|
|
30557
30636
|
return void 0;
|
|
30558
30637
|
return {
|
|
30559
|
-
field: typeof value.field === "string" ? value.field :
|
|
30638
|
+
field: typeof value.field === "string" ? value.field : defaultField,
|
|
30560
30639
|
supported: value.supported,
|
|
30561
30640
|
limit: value.limit,
|
|
30562
30641
|
min_cli: value.min_cli,
|
|
@@ -30672,6 +30751,11 @@ var require_deployed_policy = __commonJS({
|
|
|
30672
30751
|
min_sdk: value.min_sdk
|
|
30673
30752
|
};
|
|
30674
30753
|
}
|
|
30754
|
+
function normalizeRosters(value) {
|
|
30755
|
+
if (!value || typeof value.supported !== "boolean" || typeof value.limit !== "string" || typeof value.min_cli !== "string" || typeof value.min_sdk !== "string")
|
|
30756
|
+
return void 0;
|
|
30757
|
+
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 };
|
|
30758
|
+
}
|
|
30675
30759
|
}
|
|
30676
30760
|
});
|
|
30677
30761
|
|
|
@@ -30694,6 +30778,29 @@ var require_preflight_issue = __commonJS({
|
|
|
30694
30778
|
}
|
|
30695
30779
|
});
|
|
30696
30780
|
|
|
30781
|
+
// dist/preflight-service-directory-roster.js
|
|
30782
|
+
var require_preflight_service_directory_roster = __commonJS({
|
|
30783
|
+
"dist/preflight-service-directory-roster.js"(exports2) {
|
|
30784
|
+
"use strict";
|
|
30785
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
30786
|
+
exports2.checkDirectoryRosters = checkDirectoryRosters;
|
|
30787
|
+
var capabilities_1 = require_capabilities();
|
|
30788
|
+
var preflight_issue_1 = require_preflight_issue();
|
|
30789
|
+
var sdk_range_1 = require_sdk_range();
|
|
30790
|
+
function checkDirectoryRosters({ capabilities, tooling, cliVersion, sdkVersion, checkDeployment, issues }) {
|
|
30791
|
+
const deployed = capabilities?.features.directory_rosters;
|
|
30792
|
+
const feature = deployed ?? capabilities_1.MANAGED_FUNCTION_CAPABILITIES.features.directory_rosters;
|
|
30793
|
+
const details = { field: feature.field, limit: feature.limit, tooling, requiredCli: feature.min_cli, requiredSdk: feature.min_sdk, cliVersion, sdkVersion };
|
|
30794
|
+
if (checkDeployment && deployed?.supported !== true) {
|
|
30795
|
+
issues.push((0, preflight_issue_1.createPreflightIssue)({ ...details, problem: "scoped service group rosters are not supported by this deployment" }));
|
|
30796
|
+
return;
|
|
30797
|
+
}
|
|
30798
|
+
if ((0, capabilities_1.versionIsOlder)(cliVersion, feature.min_cli) || sdkVersion && (0, sdk_range_1.sdkConstraintIsOlder)(sdkVersion, feature.min_sdk))
|
|
30799
|
+
issues.push((0, preflight_issue_1.createPreflightIssue)({ ...details, problem: "the installed tooling does not support scoped service group rosters" }));
|
|
30800
|
+
}
|
|
30801
|
+
}
|
|
30802
|
+
});
|
|
30803
|
+
|
|
30697
30804
|
// dist/preflight-processes.js
|
|
30698
30805
|
var require_preflight_processes = __commonJS({
|
|
30699
30806
|
"dist/preflight-processes.js"(exports2) {
|
|
@@ -30831,6 +30938,22 @@ var require_preflight_invocation = __commonJS({
|
|
|
30831
30938
|
}));
|
|
30832
30939
|
return;
|
|
30833
30940
|
}
|
|
30941
|
+
if (parsed.data.caller_capabilities) {
|
|
30942
|
+
const observed = capabilities?.features.invocation_caller_capabilities;
|
|
30943
|
+
const required = capabilities_1.MANAGED_FUNCTION_CAPABILITIES.features.invocation_caller_capabilities;
|
|
30944
|
+
if (checkDeployment && observed?.supported !== true || (0, capabilities_1.versionIsOlder)(cliVersion, required.min_cli) || !sdkVersion || (0, sdk_range_1.sdkConstraintIsOlder)(sdkVersion, required.min_sdk)) {
|
|
30945
|
+
issues.push((0, preflight_issue_1.createPreflightIssue)({
|
|
30946
|
+
limit: required.limit,
|
|
30947
|
+
tooling,
|
|
30948
|
+
requiredCli: required.min_cli,
|
|
30949
|
+
requiredSdk: required.min_sdk,
|
|
30950
|
+
cliVersion,
|
|
30951
|
+
sdkVersion,
|
|
30952
|
+
field: required.field,
|
|
30953
|
+
problem: "Current caller capability reads require deployed support and compatible tooling"
|
|
30954
|
+
}));
|
|
30955
|
+
}
|
|
30956
|
+
}
|
|
30834
30957
|
if (checkDeployment && deployed?.supported !== true) {
|
|
30835
30958
|
issues.push((0, preflight_issue_1.createPreflightIssue)({
|
|
30836
30959
|
...details,
|
|
@@ -31177,6 +31300,7 @@ var require_preflight = __commonJS({
|
|
|
31177
31300
|
"use strict";
|
|
31178
31301
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
31179
31302
|
exports2.preflightManagedFunction = preflightManagedFunction;
|
|
31303
|
+
var preflight_service_directory_roster_1 = require_preflight_service_directory_roster();
|
|
31180
31304
|
var capabilities_1 = require_capabilities();
|
|
31181
31305
|
var sdk_range_1 = require_sdk_range();
|
|
31182
31306
|
var preflight_issue_1 = require_preflight_issue();
|
|
@@ -31389,6 +31513,8 @@ var require_preflight = __commonJS({
|
|
|
31389
31513
|
return;
|
|
31390
31514
|
}
|
|
31391
31515
|
const scoped = (directory2) => ({ ...args, manifest: { ...args.manifest, capabilities: { ...args.manifest.capabilities, directory: directory2 } } });
|
|
31516
|
+
if (parsed.data.rosters)
|
|
31517
|
+
(0, preflight_service_directory_roster_1.checkDirectoryRosters)(args);
|
|
31392
31518
|
if (parsed.data.groups)
|
|
31393
31519
|
(0, preflight_directory_1.checkDirectory)(scoped({ groups: parsed.data.groups }));
|
|
31394
31520
|
if (parsed.data.resolve)
|
|
@@ -31418,8 +31544,8 @@ var require_config2 = __commonJS({
|
|
|
31418
31544
|
for (var p in m2) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding2(exports3, m2, p);
|
|
31419
31545
|
};
|
|
31420
31546
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
31421
|
-
exports2.
|
|
31422
|
-
exports2.cacheManifestSchema = exports2.CACHE_MAX_TTL_SECONDS = exports2.preflightManagedFunction = exports2.parseDeployedPolicy = void 0;
|
|
31547
|
+
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;
|
|
31548
|
+
exports2.cacheManifestSchema = exports2.CACHE_MAX_TTL_SECONDS = exports2.preflightManagedFunction = exports2.parseDeployedPolicy = exports2.versionIsOlder = exports2.sdkVersionLowerBound = void 0;
|
|
31423
31549
|
exports2.readCacheConfiguration = readCacheConfiguration;
|
|
31424
31550
|
var directory_config_1 = require_directory_config();
|
|
31425
31551
|
Object.defineProperty(exports2, "DIRECTORY_TOKEN_HEADER", { enumerable: true, get: function() {
|
|
@@ -31477,6 +31603,12 @@ var require_config2 = __commonJS({
|
|
|
31477
31603
|
Object.defineProperty(exports2, "functionProcessCompletedAgentReferenceQuerySchema", { enumerable: true, get: function() {
|
|
31478
31604
|
return processes_contract_1.functionProcessCompletedAgentReferenceQuerySchema;
|
|
31479
31605
|
} });
|
|
31606
|
+
Object.defineProperty(exports2, "functionProcessCompletedNodeSchema", { enumerable: true, get: function() {
|
|
31607
|
+
return processes_contract_1.functionProcessCompletedNodeSchema;
|
|
31608
|
+
} });
|
|
31609
|
+
Object.defineProperty(exports2, "functionProcessCompletedNodeQuerySchema", { enumerable: true, get: function() {
|
|
31610
|
+
return processes_contract_1.functionProcessCompletedNodeQuerySchema;
|
|
31611
|
+
} });
|
|
31480
31612
|
var agents_contract_1 = require_agents_contract();
|
|
31481
31613
|
Object.defineProperty(exports2, "FUNCTION_AGENT_TOKEN_HEADER", { enumerable: true, get: function() {
|
|
31482
31614
|
return agents_contract_1.FUNCTION_AGENT_TOKEN_HEADER;
|
|
@@ -31612,6 +31744,7 @@ var require_config2 = __commonJS({
|
|
|
31612
31744
|
const cache = typeof manifest === "object" && manifest !== null ? Reflect.get(manifest, "cache") : void 0;
|
|
31613
31745
|
return exports2.cacheManifestSchema.parse(cache ?? {});
|
|
31614
31746
|
}
|
|
31747
|
+
__exportStar2(require_directory_roster_contract(), exports2);
|
|
31615
31748
|
}
|
|
31616
31749
|
});
|
|
31617
31750
|
|
|
@@ -59859,12 +59992,44 @@ var require_valkey = __commonJS({
|
|
|
59859
59992
|
}
|
|
59860
59993
|
});
|
|
59861
59994
|
|
|
59995
|
+
// dist/service-directory-roster.js
|
|
59996
|
+
var require_service_directory_roster = __commonJS({
|
|
59997
|
+
"dist/service-directory-roster.js"(exports2) {
|
|
59998
|
+
"use strict";
|
|
59999
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
60000
|
+
exports2.createServiceRosterReader = createServiceRosterReader;
|
|
60001
|
+
var zod_12 = require_zod();
|
|
60002
|
+
var directory_contract_1 = require_directory_contract();
|
|
60003
|
+
var directory_roster_contract_1 = require_directory_roster_contract();
|
|
60004
|
+
function createServiceRosterReader({ origin, token, expiresAt, fetchImpl }) {
|
|
60005
|
+
return async (input) => {
|
|
60006
|
+
if (expiresAt <= Date.now() / 1e3)
|
|
60007
|
+
throw new directory_contract_1.DirectoryPrincipalResolveError(401, "expired_context", "The directory credential expired; start a new invocation");
|
|
60008
|
+
const query = directory_roster_contract_1.directoryRosterQuerySchema.safeParse(input);
|
|
60009
|
+
if (!query.success)
|
|
60010
|
+
throw new directory_contract_1.DirectoryPrincipalResolveError(400, "invalid_request", "Invalid group roster request");
|
|
60011
|
+
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) });
|
|
60012
|
+
const body = await response.json().catch(() => null);
|
|
60013
|
+
if (!response.ok) {
|
|
60014
|
+
const error = zod_12.z.object({ code: zod_12.z.string().max(128).optional(), detail: zod_12.z.string().max(2e3).optional() }).safeParse(body);
|
|
60015
|
+
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");
|
|
60016
|
+
}
|
|
60017
|
+
const result = directory_roster_contract_1.directoryRosterPageSchema.safeParse(body);
|
|
60018
|
+
if (!result.success || result.data.members.length > query.data.limit || new Set(result.data.members.map((member) => member.id)).size !== result.data.members.length)
|
|
60019
|
+
throw new directory_contract_1.DirectoryPrincipalResolveError(502, "malformed_response", "Atlas returned an invalid group roster");
|
|
60020
|
+
return result.data;
|
|
60021
|
+
};
|
|
60022
|
+
}
|
|
60023
|
+
}
|
|
60024
|
+
});
|
|
60025
|
+
|
|
59862
60026
|
// dist/service-directory.js
|
|
59863
60027
|
var require_service_directory = __commonJS({
|
|
59864
60028
|
"dist/service-directory.js"(exports2) {
|
|
59865
60029
|
"use strict";
|
|
59866
60030
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
59867
60031
|
exports2.createFunctionServiceDirectoryClient = createFunctionServiceDirectoryClient;
|
|
60032
|
+
var service_directory_roster_1 = require_service_directory_roster();
|
|
59868
60033
|
var zod_12 = require_zod();
|
|
59869
60034
|
var directory_contract_1 = require_directory_contract();
|
|
59870
60035
|
function credential({ request }) {
|
|
@@ -59911,6 +60076,7 @@ var require_service_directory = __commonJS({
|
|
|
59911
60076
|
const url = `${origin(baseUrl)}${directory_contract_1.FUNCTION_DIRECTORY_RESOLVE_PATH}`;
|
|
59912
60077
|
const { token, expiresAt } = credential({ request });
|
|
59913
60078
|
return {
|
|
60079
|
+
listGroupMembers: (0, service_directory_roster_1.createServiceRosterReader)({ origin: origin(baseUrl), token, expiresAt, fetchImpl }),
|
|
59914
60080
|
async resolve(input) {
|
|
59915
60081
|
if (expiresAt <= Date.now() / 1e3)
|
|
59916
60082
|
throw new directory_contract_1.DirectoryPrincipalResolveError(401, "expired_context", "The directory credential expired; start a new invocation");
|
|
@@ -59951,7 +60117,7 @@ var __exportStar = exports && exports.__exportStar || function(m2, exports2) {
|
|
|
59951
60117
|
for (var p in m2) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m2, p);
|
|
59952
60118
|
};
|
|
59953
60119
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59954
|
-
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;
|
|
60120
|
+
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;
|
|
59955
60121
|
exports.createManagedFunctionContext = createManagedFunctionContext;
|
|
59956
60122
|
var directory_1 = require_directory();
|
|
59957
60123
|
Object.defineProperty(exports, "createFunctionDirectoryClient", { enumerable: true, get: function() {
|
|
@@ -60158,6 +60324,11 @@ var service_directory_1 = require_service_directory();
|
|
|
60158
60324
|
Object.defineProperty(exports, "createFunctionServiceDirectoryClient", { enumerable: true, get: function() {
|
|
60159
60325
|
return service_directory_1.createFunctionServiceDirectoryClient;
|
|
60160
60326
|
} });
|
|
60327
|
+
__exportStar(require_directory_roster_contract(), exports);
|
|
60328
|
+
var lattice_provenance_contract_5 = require_lattice_provenance_contract();
|
|
60329
|
+
Object.defineProperty(exports, "functionLatticeRunCreatorAccessSchema", { enumerable: true, get: function() {
|
|
60330
|
+
return lattice_provenance_contract_5.functionLatticeRunCreatorAccessSchema;
|
|
60331
|
+
} });
|
|
60161
60332
|
/*! Bundled license information:
|
|
60162
60333
|
|
|
60163
60334
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sequenceholdings/managed-functions",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Managed Function context and opt-in cache runtime",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"zod": "^4.1.13",
|
|
41
41
|
"@opentelemetry/api": "^1.9.0",
|
|
42
42
|
"@opentelemetry/sdk-trace-base": "^2.5.1",
|
|
43
|
-
"@sequenceholdings/storage": "0.1.
|
|
43
|
+
"@sequenceholdings/storage": "0.1.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "^22.0.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"vitest": "^4.1.11",
|
|
49
49
|
"esbuild": "^0.25.0",
|
|
50
50
|
"tsup": "^8.3.0",
|
|
51
|
-
"@sequenceholdings/orm": "2.
|
|
51
|
+
"@sequenceholdings/orm": "2.7.0"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=20"
|