@sequenceholdings/managed-functions 0.4.5 → 0.5.1
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 +147 -12
- package/dist/abrigo-contract.d.ts +2 -92
- package/dist/abrigo-contract.js +12 -53
- package/dist/abrigo-response.d.ts +1 -6
- package/dist/abrigo-response.js +3 -25
- package/dist/abrigo.d.ts +5 -5
- package/dist/abrigo.js +66 -92
- package/dist/agent-evidence.d.ts +5 -5
- package/dist/agent-evidence.js +58 -48
- package/dist/agent-source-evidence-contract.d.ts +2 -1197
- package/dist/agent-source-evidence-contract.js +24 -94
- package/dist/agents-contract.d.ts +2 -99
- package/dist/agents-contract.js +13 -67
- package/dist/agents.d.ts +5 -5
- package/dist/agents.js +79 -44
- package/dist/capabilities.d.ts +1 -1
- package/dist/capabilities.js +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.js +4 -1
- package/dist/directory-config.d.ts +1 -23
- package/dist/directory-config.js +8 -20
- package/dist/directory-contract.d.ts +2 -68
- package/dist/directory-contract.js +13 -55
- package/dist/directory-roster-contract.d.ts +2 -22
- package/dist/directory-roster-contract.js +7 -22
- package/dist/directory.d.ts +4 -8
- package/dist/directory.js +15 -33
- package/dist/group-roster-access.d.ts +7 -0
- package/dist/group-roster-access.js +8 -0
- package/dist/index.d.ts +49 -46
- package/dist/index.js +8 -1
- package/dist/invocation-client.d.ts +4 -4
- package/dist/invocation-client.js +32 -60
- package/dist/invocation-contract.d.ts +2 -59
- package/dist/invocation-contract.js +10 -61
- package/dist/invocation.d.ts +4 -4
- package/dist/invocation.js +42 -63
- package/dist/lattice-provenance-contract.d.ts +2 -607
- package/dist/lattice-provenance-contract.js +14 -154
- package/dist/lattice-provenance.d.ts +3 -3
- package/dist/lattice-provenance.js +46 -97
- package/dist/monitoring-annotations.d.ts +2 -53
- package/dist/monitoring-annotations.js +2 -51
- package/dist/monitoring-contract.d.ts +5 -460
- package/dist/monitoring-contract.js +37 -77
- package/dist/monitoring-events.d.ts +2 -252
- package/dist/monitoring-events.js +15 -125
- package/dist/monitoring.d.ts +3 -3
- package/dist/monitoring.js +41 -41
- package/dist/orm.d.ts +10 -1
- package/dist/orm.js +27 -7
- package/dist/platform-client.d.ts +27 -0
- package/dist/platform-client.js +79 -0
- package/dist/platform-domains.d.ts +1671 -0
- package/dist/platform-domains.js +77 -0
- package/dist/processes-contract.d.ts +2 -149
- package/dist/processes-contract.js +17 -100
- package/dist/processes.d.ts +3 -3
- package/dist/processes.js +64 -49
- package/dist/runtime.cjs +4251 -1666
- package/dist/service-directory-roster.d.ts +12 -3
- package/dist/service-directory-roster.js +11 -17
- package/dist/service-directory.d.ts +4 -8
- package/dist/service-directory.js +16 -67
- package/dist/storage.d.ts +36 -35
- package/dist/storage.js +12 -5
- package/dist/workflow-source-contract.d.ts +2 -524
- package/dist/workflow-source-contract.js +16 -56
- package/dist/workflow-source.d.ts +3 -3
- package/dist/workflow-source.js +106 -43
- package/package.json +4 -3
|
@@ -1,96 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.functionAgentSourceEvidenceVerificationSchema = exports.functionAgentSourceEvidenceRequestSchema = exports.functionAgentSourceEvidenceClaimsSchema = exports.functionAgentHumanConversationEvidenceClaimsSchema = exports.functionAgentRunSourceEvidenceClaimsSchema = exports.functionAgentManagedFunctionSourceEvidenceClaimsSchema = exports.functionAgentHumanSourceEvidenceClaimsSchema = exports.functionAgentConversationEvidenceRequestSchema = exports.functionAgentConversationEvidenceQuerySchema = exports.functionAgentConversationEvidenceCaptureSchema = exports.functionAgentConversationEvidenceResponseSchema = exports.functionAgentSourceEvidenceCaptureSchema = exports.functionAgentSourceResponseSchema = exports.functionAgentConversationResponseSchema = exports.functionAgentSourceExecutionSchema = exports.functionSourceJobAdmissionSchema = exports.AGENT_SOURCE_VERIFY_MAX_BYTES = exports.AGENT_SOURCE_RESPONSE_MAX_BYTES = exports.FUNCTION_AGENT_EVIDENCE_PATH = exports.FUNCTION_AGENT_EVIDENCE_TOKEN_HEADER =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(exports, "
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
11
|
-
exports
|
|
12
|
-
exports
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
exports
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
exports
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
return [];
|
|
28
|
-
const capabilities = Reflect.get(manifest, 'capabilities');
|
|
29
|
-
if (typeof capabilities !== 'object' || capabilities === null)
|
|
30
|
-
return [];
|
|
31
|
-
const agents = Reflect.get(capabilities, 'agents');
|
|
32
|
-
if (typeof agents !== 'object' || agents === null)
|
|
33
|
-
return [];
|
|
34
|
-
const evidence = Reflect.get(agents, 'evidence');
|
|
35
|
-
return evidence === undefined ? [] : agents_contract_1.functionAgentEvidenceScopesSchema.parse(evidence);
|
|
36
|
-
}
|
|
37
|
-
const textPart = zod_1.z.strictObject({ type: zod_1.z.literal('text'), text: zod_1.z.string() });
|
|
38
|
-
const toolPart = zod_1.z.strictObject({
|
|
39
|
-
type: zod_1.z.string().min(1).max(255).refine((type) => type !== 'tool-result' && (type === 'dynamic-tool' || type === 'tool-invocation' || type.startsWith('tool-')), 'Only tool parts are permitted'),
|
|
40
|
-
toolName: zod_1.z.string().max(255).optional(), name: zod_1.z.string().max(255).optional(), toolCallId: identifier.optional(), state: zod_1.z.string().max(255).optional(),
|
|
41
|
-
input: zod_1.z.json().optional(), output: zod_1.z.json().optional(),
|
|
42
|
-
});
|
|
43
|
-
exports.functionAgentConversationResponseSchema = agents_contract_1.functionAgentCompletedRunSchema.extend({
|
|
44
|
-
context: zod_1.z.strictObject({
|
|
45
|
-
messages: zod_1.z.array(zod_1.z.strictObject({ id: identifier, role: zod_1.z.enum(['user', 'assistant']), parts: zod_1.z.array(zod_1.z.union([textPart, toolPart])).max(1000), metadata: zod_1.z.strictObject({ citations: zod_1.z.array(zod_1.z.json()).max(1000) }).optional() })).max(1000),
|
|
46
|
-
compactionSummary: zod_1.z.string().nullable(),
|
|
47
|
-
}),
|
|
48
|
-
});
|
|
49
|
-
exports.functionAgentSourceResponseSchema = zod_1.z.union([agents_contract_1.functionAgentCompletedRunSchema, exports.functionAgentConversationResponseSchema]);
|
|
50
|
-
exports.functionAgentSourceEvidenceCaptureSchema = zod_1.z.strictObject({ response: exports.functionAgentSourceResponseSchema, responseHash: hash, sourceReceipt: zod_1.z.string().min(1).max(16_384) });
|
|
51
|
-
const conversationRevision = zod_1.z.number().int().min(1).max(Number.MAX_SAFE_INTEGER);
|
|
52
|
-
exports.functionAgentConversationEvidenceResponseSchema = zod_1.z.strictObject({
|
|
53
|
-
agent: identifier, threadId: identifier, revision: conversationRevision, cutoffAt: zod_1.z.iso.datetime({ offset: true }),
|
|
54
|
-
context: exports.functionAgentConversationResponseSchema.shape.context.extend({ compactionSummary: zod_1.z.null() }),
|
|
55
|
-
conversation: agents_contract_1.functionAgentCompletedRunSchema.shape.conversation.unwrap(),
|
|
56
|
-
});
|
|
57
|
-
exports.functionAgentConversationEvidenceCaptureSchema = zod_1.z.strictObject({ response: exports.functionAgentConversationEvidenceResponseSchema, responseHash: hash, sourceReceipt: zod_1.z.string().min(1).max(16_384) });
|
|
58
|
-
exports.functionAgentConversationEvidenceQuerySchema = zod_1.z.strictObject({ agent: identifier, threadId: identifier });
|
|
59
|
-
exports.functionAgentConversationEvidenceRequestSchema = exports.functionAgentConversationEvidenceQuerySchema.extend({ operation: zod_1.z.literal('verifyConversationEvidence'), response: exports.functionAgentConversationEvidenceResponseSchema, responseHash: hash, sourceReceipt: zod_1.z.string().min(1).max(16_384) });
|
|
60
|
-
const sourceEvidenceFields = {
|
|
61
|
-
environment: zod_1.z.string(), org: identifier, agentId: identifier, runId: identifier, threadId: identifier,
|
|
62
|
-
familyRunIds: zod_1.z.array(identifier).min(1).max(16), cutoffAt: zod_1.z.iso.datetime({ offset: true }),
|
|
63
|
-
responseHash: hash, sourceExecution: exports.functionAgentSourceExecutionSchema.nullable(), jobAdmission: exports.functionSourceJobAdmissionSchema.nullable(),
|
|
64
|
-
};
|
|
65
|
-
exports.functionAgentHumanSourceEvidenceClaimsSchema = zod_1.z.strictObject({
|
|
66
|
-
...sourceEvidenceFields, sourceKind: zod_1.z.literal('human'), audience: zod_1.z.literal('atlas-agent-source-evidence'),
|
|
67
|
-
actualUserSub: zod_1.z.string().min(1).max(512).refine((sub) => !sub.startsWith('service-account|'), 'Human source evidence requires a user principal'),
|
|
68
|
-
projection: zod_1.z.enum(['completed-v1', 'conversation-v1']),
|
|
69
|
-
});
|
|
70
|
-
exports.functionAgentManagedFunctionSourceEvidenceClaimsSchema = zod_1.z.strictObject({
|
|
71
|
-
...sourceEvidenceFields, sourceKind: zod_1.z.literal('managed_function'), audience: zod_1.z.literal('atlas-managed-function-source-evidence'),
|
|
72
|
-
actualServiceAccountSub: zod_1.z.string().min(1).max(512), projection: zod_1.z.literal('completed-v1'),
|
|
73
|
-
sourceReceiver: zod_1.z.strictObject({ functionId: zod_1.z.uuid(), versionId: zod_1.z.uuid(), invocationId: zod_1.z.uuid(), serviceAccountId: zod_1.z.uuid(), org: identifier }),
|
|
74
|
-
}).refine((source) => source.actualServiceAccountSub === `service-account|${source.sourceReceiver.serviceAccountId}` && source.org === source.sourceReceiver.org, 'The service source must match its actual invocation identity');
|
|
75
|
-
exports.functionAgentRunSourceEvidenceClaimsSchema = zod_1.z.discriminatedUnion('sourceKind', [exports.functionAgentHumanSourceEvidenceClaimsSchema, exports.functionAgentManagedFunctionSourceEvidenceClaimsSchema])
|
|
76
|
-
.refine((source) => source.familyRunIds.includes(source.runId) && new Set(source.familyRunIds).size === source.familyRunIds.length, 'The source family must contain its run and be distinct')
|
|
77
|
-
.refine((source) => source.sourceExecution === null || (source.sourceExecution.agent.id === source.agentId && source.sourceExecution.agent.runId === source.runId && source.sourceExecution.agent.threadId === source.threadId), 'The execution origin must match the captured source')
|
|
78
|
-
.refine((source) => source.jobAdmission === null || (source.jobAdmission.kind === 'agent' && source.jobAdmission.runId === source.runId && source.jobAdmission.resourceId === source.agentId && (source.sourceKind === 'human' || source.jobAdmission.actorSub === source.actualServiceAccountSub)), 'The job admission must match the captured source');
|
|
79
|
-
exports.functionAgentHumanConversationEvidenceClaimsSchema = zod_1.z.strictObject({
|
|
80
|
-
sourceKind: zod_1.z.literal('human'), projection: zod_1.z.literal('thread-conversation-v1'), audience: zod_1.z.literal('atlas-agent-source-evidence'),
|
|
81
|
-
actualUserSub: zod_1.z.string().min(1).max(512).refine((sub) => !sub.startsWith('service-account|'), 'Human conversation evidence requires a user principal'),
|
|
82
|
-
environment: zod_1.z.string(), org: identifier, agentId: identifier, threadId: identifier,
|
|
83
|
-
revision: conversationRevision, cutoffAt: zod_1.z.iso.datetime({ offset: true }), responseHash: hash,
|
|
84
|
-
});
|
|
85
|
-
exports.functionAgentSourceEvidenceClaimsSchema = zod_1.z.union([exports.functionAgentRunSourceEvidenceClaimsSchema, exports.functionAgentHumanConversationEvidenceClaimsSchema]);
|
|
86
|
-
exports.functionAgentSourceEvidenceRequestSchema = zod_1.z.strictObject({ operation: zod_1.z.literal('verifySourceEvidence'), agent: identifier, runId: identifier, response: exports.functionAgentSourceResponseSchema, responseHash: hash, sourceReceipt: zod_1.z.string().min(1).max(16_384) });
|
|
87
|
-
exports.functionAgentSourceEvidenceVerificationSchema = zod_1.z.strictObject({
|
|
88
|
-
source: exports.functionAgentSourceEvidenceClaimsSchema,
|
|
89
|
-
receiver: zod_1.z.strictObject({ functionId: identifier, versionId: identifier, invocationId: identifier, serviceAccountId: identifier, org: identifier }),
|
|
90
|
-
lattice: zod_1.z.strictObject({
|
|
91
|
-
receiverFunctionOrgId: identifier,
|
|
92
|
-
run: zod_1.z.strictObject({ id: identifier, processId: identifier, processVersion: identifier, bundleHash: identifier, entity: zod_1.z.strictObject({ type: identifier, id: identifier }).nullable() }),
|
|
93
|
-
step: zod_1.z.strictObject({ id: identifier, nodeId: identifier, attempt: zod_1.z.number().int().positive(), runAsServiceAccount: zod_1.z.string().nullable() }),
|
|
94
|
-
receiver: zod_1.z.strictObject({ functionId: identifier, versionId: identifier, invocationId: identifier }),
|
|
95
|
-
}).nullable(),
|
|
96
|
-
});
|
|
3
|
+
exports.functionAgentEvidenceScopesSchema = exports.functionAgentSourceEvidenceVerificationSchema = exports.functionAgentSourceEvidenceRequestSchema = exports.functionAgentSourceEvidenceClaimsSchema = exports.functionAgentHumanConversationEvidenceClaimsSchema = exports.functionAgentRunSourceEvidenceClaimsSchema = exports.functionAgentManagedFunctionSourceEvidenceClaimsSchema = exports.functionAgentHumanSourceEvidenceClaimsSchema = exports.functionAgentConversationEvidenceRequestSchema = exports.functionAgentConversationEvidenceQuerySchema = exports.functionAgentConversationEvidenceCaptureSchema = exports.functionAgentConversationEvidenceResponseSchema = exports.functionAgentSourceEvidenceCaptureSchema = exports.functionAgentSourceResponseSchema = exports.functionAgentConversationResponseSchema = exports.readFunctionAgentEvidenceScopes = exports.functionAgentSourceExecutionSchema = exports.functionSourceJobAdmissionSchema = exports.AGENT_SOURCE_VERIFY_MAX_BYTES = exports.AGENT_SOURCE_RESPONSE_MAX_BYTES = exports.FUNCTION_AGENT_EVIDENCE_PATH = exports.FUNCTION_AGENT_EVIDENCE_TOKEN_HEADER = void 0;
|
|
4
|
+
var contracts_1 = require("@sequenceholdings/platform/contracts");
|
|
5
|
+
Object.defineProperty(exports, "FUNCTION_AGENT_EVIDENCE_TOKEN_HEADER", { enumerable: true, get: function () { return contracts_1.FUNCTION_AGENT_EVIDENCE_TOKEN_HEADER; } });
|
|
6
|
+
Object.defineProperty(exports, "FUNCTION_AGENT_EVIDENCE_PATH", { enumerable: true, get: function () { return contracts_1.FUNCTION_AGENT_EVIDENCE_PATH; } });
|
|
7
|
+
Object.defineProperty(exports, "AGENT_SOURCE_RESPONSE_MAX_BYTES", { enumerable: true, get: function () { return contracts_1.AGENT_SOURCE_RESPONSE_MAX_BYTES; } });
|
|
8
|
+
Object.defineProperty(exports, "AGENT_SOURCE_VERIFY_MAX_BYTES", { enumerable: true, get: function () { return contracts_1.AGENT_SOURCE_VERIFY_MAX_BYTES; } });
|
|
9
|
+
Object.defineProperty(exports, "functionSourceJobAdmissionSchema", { enumerable: true, get: function () { return contracts_1.functionSourceJobAdmissionSchema; } });
|
|
10
|
+
Object.defineProperty(exports, "functionAgentSourceExecutionSchema", { enumerable: true, get: function () { return contracts_1.functionAgentSourceExecutionSchema; } });
|
|
11
|
+
Object.defineProperty(exports, "readFunctionAgentEvidenceScopes", { enumerable: true, get: function () { return contracts_1.readFunctionAgentEvidenceScopes; } });
|
|
12
|
+
Object.defineProperty(exports, "functionAgentConversationResponseSchema", { enumerable: true, get: function () { return contracts_1.functionAgentConversationResponseSchema; } });
|
|
13
|
+
Object.defineProperty(exports, "functionAgentSourceResponseSchema", { enumerable: true, get: function () { return contracts_1.functionAgentSourceResponseSchema; } });
|
|
14
|
+
Object.defineProperty(exports, "functionAgentSourceEvidenceCaptureSchema", { enumerable: true, get: function () { return contracts_1.functionAgentSourceEvidenceCaptureSchema; } });
|
|
15
|
+
Object.defineProperty(exports, "functionAgentConversationEvidenceResponseSchema", { enumerable: true, get: function () { return contracts_1.functionAgentConversationEvidenceResponseSchema; } });
|
|
16
|
+
Object.defineProperty(exports, "functionAgentConversationEvidenceCaptureSchema", { enumerable: true, get: function () { return contracts_1.functionAgentConversationEvidenceCaptureSchema; } });
|
|
17
|
+
Object.defineProperty(exports, "functionAgentConversationEvidenceQuerySchema", { enumerable: true, get: function () { return contracts_1.functionAgentConversationEvidenceQuerySchema; } });
|
|
18
|
+
Object.defineProperty(exports, "functionAgentConversationEvidenceRequestSchema", { enumerable: true, get: function () { return contracts_1.functionAgentConversationEvidenceRequestSchema; } });
|
|
19
|
+
Object.defineProperty(exports, "functionAgentHumanSourceEvidenceClaimsSchema", { enumerable: true, get: function () { return contracts_1.functionAgentHumanSourceEvidenceClaimsSchema; } });
|
|
20
|
+
Object.defineProperty(exports, "functionAgentManagedFunctionSourceEvidenceClaimsSchema", { enumerable: true, get: function () { return contracts_1.functionAgentManagedFunctionSourceEvidenceClaimsSchema; } });
|
|
21
|
+
Object.defineProperty(exports, "functionAgentRunSourceEvidenceClaimsSchema", { enumerable: true, get: function () { return contracts_1.functionAgentRunSourceEvidenceClaimsSchema; } });
|
|
22
|
+
Object.defineProperty(exports, "functionAgentHumanConversationEvidenceClaimsSchema", { enumerable: true, get: function () { return contracts_1.functionAgentHumanConversationEvidenceClaimsSchema; } });
|
|
23
|
+
Object.defineProperty(exports, "functionAgentSourceEvidenceClaimsSchema", { enumerable: true, get: function () { return contracts_1.functionAgentSourceEvidenceClaimsSchema; } });
|
|
24
|
+
Object.defineProperty(exports, "functionAgentSourceEvidenceRequestSchema", { enumerable: true, get: function () { return contracts_1.functionAgentSourceEvidenceRequestSchema; } });
|
|
25
|
+
Object.defineProperty(exports, "functionAgentSourceEvidenceVerificationSchema", { enumerable: true, get: function () { return contracts_1.functionAgentSourceEvidenceVerificationSchema; } });
|
|
26
|
+
Object.defineProperty(exports, "functionAgentEvidenceScopesSchema", { enumerable: true, get: function () { return contracts_1.functionAgentEvidenceScopesSchema; } });
|
|
@@ -1,99 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export declare const FUNCTION_AGENT_READ_PATH = "/api/managed-functions/agents/read";
|
|
4
|
-
export declare const FUNCTION_AGENT_CAPTURE_PATH = "/api/managed-functions/agents/capture";
|
|
5
|
-
export declare const functionAgentEvidenceScopesSchema: z.ZodArray<z.ZodString>;
|
|
6
|
-
export declare const functionAgentReadScopesSchema: z.ZodObject<{
|
|
7
|
-
read: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
8
|
-
evidence: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
9
|
-
}, z.core.$strict>;
|
|
10
|
-
export declare function readFunctionAgentScopes(manifest: unknown): string[];
|
|
11
|
-
export declare const functionAgentCompletedRunQuerySchema: z.ZodObject<{
|
|
12
|
-
agent: z.ZodString;
|
|
13
|
-
runId: z.ZodString;
|
|
14
|
-
recoveryProof: z.ZodOptional<z.ZodString>;
|
|
15
|
-
}, z.core.$strict>;
|
|
16
|
-
export type FunctionAgentCompletedRunQuery = z.infer<typeof functionAgentCompletedRunQuerySchema>;
|
|
17
|
-
export declare const functionAgentReadRequestSchema: z.ZodObject<{
|
|
18
|
-
agent: z.ZodString;
|
|
19
|
-
runId: z.ZodString;
|
|
20
|
-
recoveryProof: z.ZodOptional<z.ZodString>;
|
|
21
|
-
operation: z.ZodLiteral<"getCompletedRun">;
|
|
22
|
-
}, z.core.$strict>;
|
|
23
|
-
export declare const functionAgentMessageSchema: z.ZodObject<{
|
|
24
|
-
id: z.ZodString;
|
|
25
|
-
role: z.ZodLiteral<"assistant">;
|
|
26
|
-
parts: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
27
|
-
type: z.ZodLiteral<"text">;
|
|
28
|
-
text: z.ZodString;
|
|
29
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
30
|
-
type: z.ZodLiteral<"dynamic-tool">;
|
|
31
|
-
output: z.ZodObject<{
|
|
32
|
-
content: z.ZodArray<z.ZodObject<{
|
|
33
|
-
type: z.ZodLiteral<"resource">;
|
|
34
|
-
resource: z.ZodObject<{
|
|
35
|
-
uri: z.ZodString;
|
|
36
|
-
text: z.ZodString;
|
|
37
|
-
}, z.core.$strict>;
|
|
38
|
-
}, z.core.$strict>>;
|
|
39
|
-
}, z.core.$strict>;
|
|
40
|
-
}, z.core.$strict>]>>;
|
|
41
|
-
metadata: z.ZodOptional<z.ZodObject<{
|
|
42
|
-
citations: z.ZodArray<z.ZodJSONSchema>;
|
|
43
|
-
}, z.core.$strict>>;
|
|
44
|
-
}, z.core.$strict>;
|
|
45
|
-
export declare const functionAgentCompletedRunSchema: z.ZodObject<{
|
|
46
|
-
runId: z.ZodString;
|
|
47
|
-
agent: z.ZodString;
|
|
48
|
-
threadId: z.ZodString;
|
|
49
|
-
status: z.ZodLiteral<"completed">;
|
|
50
|
-
output: z.ZodJSONSchema;
|
|
51
|
-
messages: z.ZodArray<z.ZodObject<{
|
|
52
|
-
id: z.ZodString;
|
|
53
|
-
role: z.ZodLiteral<"assistant">;
|
|
54
|
-
parts: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
55
|
-
type: z.ZodLiteral<"text">;
|
|
56
|
-
text: z.ZodString;
|
|
57
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
58
|
-
type: z.ZodLiteral<"dynamic-tool">;
|
|
59
|
-
output: z.ZodObject<{
|
|
60
|
-
content: z.ZodArray<z.ZodObject<{
|
|
61
|
-
type: z.ZodLiteral<"resource">;
|
|
62
|
-
resource: z.ZodObject<{
|
|
63
|
-
uri: z.ZodString;
|
|
64
|
-
text: z.ZodString;
|
|
65
|
-
}, z.core.$strict>;
|
|
66
|
-
}, z.core.$strict>>;
|
|
67
|
-
}, z.core.$strict>;
|
|
68
|
-
}, z.core.$strict>]>>;
|
|
69
|
-
metadata: z.ZodOptional<z.ZodObject<{
|
|
70
|
-
citations: z.ZodArray<z.ZodJSONSchema>;
|
|
71
|
-
}, z.core.$strict>>;
|
|
72
|
-
}, z.core.$strict>>;
|
|
73
|
-
conversation: z.ZodOptional<z.ZodObject<{
|
|
74
|
-
messageCount: z.ZodNumber;
|
|
75
|
-
userMessageCount: z.ZodNumber;
|
|
76
|
-
assistantMessageCount: z.ZodNumber;
|
|
77
|
-
messages: z.ZodArray<z.ZodObject<{
|
|
78
|
-
id: z.ZodString;
|
|
79
|
-
role: z.ZodEnum<{
|
|
80
|
-
assistant: "assistant";
|
|
81
|
-
user: "user";
|
|
82
|
-
}>;
|
|
83
|
-
textParts: z.ZodArray<z.ZodString>;
|
|
84
|
-
tools: z.ZodArray<z.ZodObject<{
|
|
85
|
-
partType: z.ZodString;
|
|
86
|
-
toolName: z.ZodNullable<z.ZodString>;
|
|
87
|
-
state: z.ZodNullable<z.ZodString>;
|
|
88
|
-
outputTruthy: z.ZodBoolean;
|
|
89
|
-
}, z.core.$strict>>;
|
|
90
|
-
}, z.core.$strict>>;
|
|
91
|
-
}, z.core.$strict>>;
|
|
92
|
-
}, z.core.$strict>;
|
|
93
|
-
export type FunctionAgentCompletedRun = z.infer<typeof functionAgentCompletedRunSchema>;
|
|
94
|
-
export declare class FunctionAgentReadError extends Error {
|
|
95
|
-
readonly status: number;
|
|
96
|
-
readonly code: string;
|
|
97
|
-
readonly name = "FunctionAgentReadError";
|
|
98
|
-
constructor(status: number, code: string, message: string);
|
|
99
|
-
}
|
|
1
|
+
export { FUNCTION_AGENT_TOKEN_HEADER, FUNCTION_AGENT_READ_PATH, FUNCTION_AGENT_CAPTURE_PATH, functionAgentEvidenceScopesSchema, functionAgentReadScopesSchema, readFunctionAgentScopes, functionAgentCompletedRunQuerySchema, functionAgentReadRequestSchema, functionAgentMessageSchema, functionAgentCompletedRunSchema, FunctionAgentReadError, } from "@sequenceholdings/platform/contracts";
|
|
2
|
+
export type { FunctionAgentCompletedRunQuery, FunctionAgentCompletedRun, } from "@sequenceholdings/platform/contracts";
|
package/dist/agents-contract.js
CHANGED
|
@@ -1,69 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FunctionAgentReadError = exports.functionAgentCompletedRunSchema = exports.functionAgentMessageSchema = exports.functionAgentReadRequestSchema = exports.functionAgentCompletedRunQuerySchema = exports.functionAgentReadScopesSchema = exports.functionAgentEvidenceScopesSchema = exports.FUNCTION_AGENT_CAPTURE_PATH = exports.FUNCTION_AGENT_READ_PATH = exports.FUNCTION_AGENT_TOKEN_HEADER = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
9
|
-
|
|
10
|
-
exports
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
.refine((ids) => ids.reduce((bytes, id) => bytes + id.length, 0) <= 8192, 'Agent ids must fit within 8192 bytes').optional(),
|
|
17
|
-
evidence: exports.functionAgentEvidenceScopesSchema.optional(),
|
|
18
|
-
}).refine((value) => value.read !== undefined || value.evidence !== undefined, 'Declare agent reads or evidence verification');
|
|
19
|
-
function readFunctionAgentScopes(manifest) {
|
|
20
|
-
if (typeof manifest !== 'object' || manifest === null)
|
|
21
|
-
return [];
|
|
22
|
-
const capabilities = Reflect.get(manifest, 'capabilities');
|
|
23
|
-
if (typeof capabilities !== 'object' || capabilities === null)
|
|
24
|
-
return [];
|
|
25
|
-
const agents = Reflect.get(capabilities, 'agents');
|
|
26
|
-
if (agents === undefined)
|
|
27
|
-
return [];
|
|
28
|
-
return exports.functionAgentReadScopesSchema.parse(agents).read ?? [];
|
|
29
|
-
}
|
|
30
|
-
exports.functionAgentCompletedRunQuerySchema = zod_1.z.strictObject({ agent: resourceId, runId: resourceId, recoveryProof: zod_1.z.string().min(1).max(16_384).optional() });
|
|
31
|
-
exports.functionAgentReadRequestSchema = exports.functionAgentCompletedRunQuerySchema.extend({ operation: zod_1.z.literal('getCompletedRun') });
|
|
32
|
-
exports.functionAgentMessageSchema = zod_1.z.strictObject({
|
|
33
|
-
id: zod_1.z.string().min(1).max(255),
|
|
34
|
-
role: zod_1.z.literal('assistant'),
|
|
35
|
-
parts: zod_1.z.array(zod_1.z.union([
|
|
36
|
-
zod_1.z.strictObject({ type: zod_1.z.literal('text'), text: zod_1.z.string() }),
|
|
37
|
-
zod_1.z.strictObject({ type: zod_1.z.literal('dynamic-tool'), output: zod_1.z.strictObject({ content: zod_1.z.array(zod_1.z.strictObject({ type: zod_1.z.literal('resource'), resource: zod_1.z.strictObject({ uri: zod_1.z.string().startsWith('citation://'), text: zod_1.z.string() }) })).max(1000) }) }),
|
|
38
|
-
])).max(1000),
|
|
39
|
-
metadata: zod_1.z.strictObject({ citations: zod_1.z.array(zod_1.z.json()).max(1000) }).optional(),
|
|
40
|
-
});
|
|
41
|
-
exports.functionAgentCompletedRunSchema = zod_1.z.strictObject({
|
|
42
|
-
runId: resourceId,
|
|
43
|
-
agent: resourceId,
|
|
44
|
-
threadId: resourceId,
|
|
45
|
-
status: zod_1.z.literal('completed'),
|
|
46
|
-
output: zod_1.z.json(),
|
|
47
|
-
messages: zod_1.z.array(exports.functionAgentMessageSchema).max(1000),
|
|
48
|
-
conversation: zod_1.z.strictObject({
|
|
49
|
-
messageCount: zod_1.z.number().int().min(0).max(1000),
|
|
50
|
-
userMessageCount: zod_1.z.number().int().min(0).max(1000),
|
|
51
|
-
assistantMessageCount: zod_1.z.number().int().min(0).max(1000),
|
|
52
|
-
messages: zod_1.z.array(zod_1.z.strictObject({
|
|
53
|
-
id: zod_1.z.string().min(1).max(255), role: zod_1.z.enum(['user', 'assistant']),
|
|
54
|
-
textParts: zod_1.z.array(zod_1.z.string()).max(1000),
|
|
55
|
-
tools: zod_1.z.array(zod_1.z.strictObject({ partType: zod_1.z.string().min(1).max(255), toolName: zod_1.z.string().max(255).nullable(), state: zod_1.z.string().max(255).nullable(), outputTruthy: zod_1.z.boolean() })).max(1000),
|
|
56
|
-
})).max(1000),
|
|
57
|
-
}).optional(),
|
|
58
|
-
});
|
|
59
|
-
class FunctionAgentReadError extends Error {
|
|
60
|
-
status;
|
|
61
|
-
code;
|
|
62
|
-
name = 'FunctionAgentReadError';
|
|
63
|
-
constructor(status, code, message) {
|
|
64
|
-
super(message);
|
|
65
|
-
this.status = status;
|
|
66
|
-
this.code = code;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.FunctionAgentReadError = FunctionAgentReadError;
|
|
3
|
+
exports.FunctionAgentReadError = exports.functionAgentCompletedRunSchema = exports.functionAgentMessageSchema = exports.functionAgentReadRequestSchema = exports.functionAgentCompletedRunQuerySchema = exports.readFunctionAgentScopes = exports.functionAgentReadScopesSchema = exports.functionAgentEvidenceScopesSchema = exports.FUNCTION_AGENT_CAPTURE_PATH = exports.FUNCTION_AGENT_READ_PATH = exports.FUNCTION_AGENT_TOKEN_HEADER = void 0;
|
|
4
|
+
var contracts_1 = require("@sequenceholdings/platform/contracts");
|
|
5
|
+
Object.defineProperty(exports, "FUNCTION_AGENT_TOKEN_HEADER", { enumerable: true, get: function () { return contracts_1.FUNCTION_AGENT_TOKEN_HEADER; } });
|
|
6
|
+
Object.defineProperty(exports, "FUNCTION_AGENT_READ_PATH", { enumerable: true, get: function () { return contracts_1.FUNCTION_AGENT_READ_PATH; } });
|
|
7
|
+
Object.defineProperty(exports, "FUNCTION_AGENT_CAPTURE_PATH", { enumerable: true, get: function () { return contracts_1.FUNCTION_AGENT_CAPTURE_PATH; } });
|
|
8
|
+
Object.defineProperty(exports, "functionAgentEvidenceScopesSchema", { enumerable: true, get: function () { return contracts_1.functionAgentEvidenceScopesSchema; } });
|
|
9
|
+
Object.defineProperty(exports, "functionAgentReadScopesSchema", { enumerable: true, get: function () { return contracts_1.functionAgentReadScopesSchema; } });
|
|
10
|
+
Object.defineProperty(exports, "readFunctionAgentScopes", { enumerable: true, get: function () { return contracts_1.readFunctionAgentScopes; } });
|
|
11
|
+
Object.defineProperty(exports, "functionAgentCompletedRunQuerySchema", { enumerable: true, get: function () { return contracts_1.functionAgentCompletedRunQuerySchema; } });
|
|
12
|
+
Object.defineProperty(exports, "functionAgentReadRequestSchema", { enumerable: true, get: function () { return contracts_1.functionAgentReadRequestSchema; } });
|
|
13
|
+
Object.defineProperty(exports, "functionAgentMessageSchema", { enumerable: true, get: function () { return contracts_1.functionAgentMessageSchema; } });
|
|
14
|
+
Object.defineProperty(exports, "functionAgentCompletedRunSchema", { enumerable: true, get: function () { return contracts_1.functionAgentCompletedRunSchema; } });
|
|
15
|
+
Object.defineProperty(exports, "FunctionAgentReadError", { enumerable: true, get: function () { return contracts_1.FunctionAgentReadError; } });
|
package/dist/agents.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type FunctionAgentCompletedRun, type FunctionAgentCompletedRunQuery } from
|
|
2
|
-
import { type FunctionAgentSourceEvidenceCapture } from
|
|
3
|
-
export * from
|
|
1
|
+
import { type FunctionAgentCompletedRun, type FunctionAgentCompletedRunQuery } from "./agents-contract";
|
|
2
|
+
import { type FunctionAgentSourceEvidenceCapture } from "./agent-source-evidence-contract";
|
|
3
|
+
export * from "./agents-contract";
|
|
4
4
|
export interface FunctionServiceAgentsOptions {
|
|
5
5
|
request: {
|
|
6
|
-
headers: Pick<Headers,
|
|
6
|
+
headers: Pick<Headers, "get"> | Readonly<Record<string, string | readonly string[] | undefined>>;
|
|
7
7
|
};
|
|
8
8
|
baseUrl: string;
|
|
9
9
|
fetchImpl?: typeof globalThis.fetch;
|
|
@@ -12,4 +12,4 @@ export interface FunctionServiceAgentsClient {
|
|
|
12
12
|
getCompletedRun(query: FunctionAgentCompletedRunQuery): Promise<FunctionAgentCompletedRun>;
|
|
13
13
|
captureCompletedRun(query: FunctionAgentCompletedRunQuery): Promise<FunctionAgentSourceEvidenceCapture>;
|
|
14
14
|
}
|
|
15
|
-
export declare function createFunctionServiceAgentsClient({ request, baseUrl, fetchImpl }: FunctionServiceAgentsOptions): FunctionServiceAgentsClient;
|
|
15
|
+
export declare function createFunctionServiceAgentsClient({ request, baseUrl, fetchImpl, }: FunctionServiceAgentsOptions): FunctionServiceAgentsClient;
|
package/dist/agents.js
CHANGED
|
@@ -15,18 +15,25 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.createFunctionServiceAgentsClient = createFunctionServiceAgentsClient;
|
|
18
|
+
const adapters_1 = require("@sequenceholdings/platform/adapters");
|
|
18
19
|
const zod_1 = require("zod");
|
|
19
20
|
const agents_contract_1 = require("./agents-contract");
|
|
20
21
|
const agent_source_evidence_contract_1 = require("./agent-source-evidence-contract");
|
|
21
22
|
const processes_contract_1 = require("./processes-contract");
|
|
22
23
|
__exportStar(require("./agents-contract"), exports);
|
|
23
|
-
function header({ request, name }) {
|
|
24
|
+
function header({ request, name, }) {
|
|
24
25
|
const { headers } = request;
|
|
25
|
-
const values = typeof headers.get ===
|
|
26
|
-
|
|
26
|
+
const values = typeof headers.get === "function"
|
|
27
|
+
? [headers.get(name)]
|
|
28
|
+
: Object.entries(headers)
|
|
29
|
+
.filter(([key]) => key.toLowerCase() === name)
|
|
30
|
+
.map(([, value]) => value);
|
|
31
|
+
return values.length === 1 && typeof values[0] === "string"
|
|
32
|
+
? values[0]
|
|
33
|
+
: null;
|
|
27
34
|
}
|
|
28
35
|
function credential(request) {
|
|
29
|
-
const denied = () => new agents_contract_1.FunctionAgentReadError(401,
|
|
36
|
+
const denied = () => new agents_contract_1.FunctionAgentReadError(401, "invalid_context", "This invocation has no valid agent-read credential");
|
|
30
37
|
const token = header({ request, name: agents_contract_1.FUNCTION_AGENT_TOKEN_HEADER });
|
|
31
38
|
if (!token || token.length > 16_384)
|
|
32
39
|
throw denied();
|
|
@@ -35,12 +42,20 @@ function credential(request) {
|
|
|
35
42
|
throw denied();
|
|
36
43
|
let value;
|
|
37
44
|
try {
|
|
38
|
-
value = JSON.parse(Buffer.from(body,
|
|
45
|
+
value = JSON.parse(Buffer.from(body, "base64url").toString("utf8"));
|
|
39
46
|
}
|
|
40
47
|
catch {
|
|
41
48
|
throw denied();
|
|
42
49
|
}
|
|
43
|
-
const claims = zod_1.z
|
|
50
|
+
const claims = zod_1.z
|
|
51
|
+
.object({
|
|
52
|
+
audience: zod_1.z.literal("atlas-managed-function-agent-read"),
|
|
53
|
+
sub: zod_1.z.string().startsWith("service-account|"),
|
|
54
|
+
functionId: zod_1.z.string().min(1),
|
|
55
|
+
invocationId: zod_1.z.string().min(1),
|
|
56
|
+
exp: zod_1.z.number().int(),
|
|
57
|
+
})
|
|
58
|
+
.safeParse(value);
|
|
44
59
|
if (!claims.success)
|
|
45
60
|
throw denied();
|
|
46
61
|
return { token, expiresAt: claims.data.exp };
|
|
@@ -51,15 +66,21 @@ function origin(baseUrl) {
|
|
|
51
66
|
url = new URL(baseUrl);
|
|
52
67
|
}
|
|
53
68
|
catch {
|
|
54
|
-
throw new agents_contract_1.FunctionAgentReadError(400,
|
|
69
|
+
throw new agents_contract_1.FunctionAgentReadError(400, "invalid_configuration", "Configure a trusted Atlas origin");
|
|
55
70
|
}
|
|
56
|
-
const loopback = url.protocol ===
|
|
57
|
-
|
|
58
|
-
|
|
71
|
+
const loopback = url.protocol === "http:" &&
|
|
72
|
+
["localhost", "127.0.0.1", "[::1]"].includes(url.hostname);
|
|
73
|
+
if ((!loopback && url.protocol !== "https:") ||
|
|
74
|
+
url.username ||
|
|
75
|
+
url.password ||
|
|
76
|
+
url.pathname !== "/" ||
|
|
77
|
+
url.search ||
|
|
78
|
+
url.hash)
|
|
79
|
+
throw new agents_contract_1.FunctionAgentReadError(400, "invalid_configuration", "Configure an HTTPS Atlas origin without credentials, path, query or fragment");
|
|
59
80
|
return url.origin;
|
|
60
81
|
}
|
|
61
82
|
function recoveryProcessCredential(request) {
|
|
62
|
-
const denied = () => new agents_contract_1.FunctionAgentReadError(401,
|
|
83
|
+
const denied = () => new agents_contract_1.FunctionAgentReadError(401, "invalid_context", "Recovery requires this invocation’s process-read credential");
|
|
63
84
|
const token = header({ request, name: processes_contract_1.FUNCTION_PROCESS_TOKEN_HEADER });
|
|
64
85
|
if (!token || token.length > 16_384)
|
|
65
86
|
throw denied();
|
|
@@ -68,54 +89,68 @@ function recoveryProcessCredential(request) {
|
|
|
68
89
|
throw denied();
|
|
69
90
|
let value;
|
|
70
91
|
try {
|
|
71
|
-
value = JSON.parse(Buffer.from(body,
|
|
92
|
+
value = JSON.parse(Buffer.from(body, "base64url").toString("utf8"));
|
|
72
93
|
}
|
|
73
94
|
catch {
|
|
74
95
|
throw denied();
|
|
75
96
|
}
|
|
76
|
-
const claims = zod_1.z
|
|
97
|
+
const claims = zod_1.z
|
|
98
|
+
.object({
|
|
99
|
+
audience: zod_1.z.literal("atlas-managed-function-process-read"),
|
|
100
|
+
sub: zod_1.z.string().startsWith("service-account|"),
|
|
101
|
+
functionId: zod_1.z.string().min(1),
|
|
102
|
+
invocationId: zod_1.z.string().min(1),
|
|
103
|
+
exp: zod_1.z.number().int(),
|
|
104
|
+
})
|
|
105
|
+
.safeParse(value);
|
|
77
106
|
if (!claims.success)
|
|
78
107
|
throw denied();
|
|
79
108
|
if (claims.data.exp <= Date.now() / 1000)
|
|
80
|
-
throw new agents_contract_1.FunctionAgentReadError(401,
|
|
109
|
+
throw new agents_contract_1.FunctionAgentReadError(401, "expired_context", "The process-read credential expired; start a new invocation");
|
|
81
110
|
return token;
|
|
82
111
|
}
|
|
83
|
-
function createFunctionServiceAgentsClient({ request, baseUrl, fetchImpl = globalThis.fetch }) {
|
|
112
|
+
function createFunctionServiceAgentsClient({ request, baseUrl, fetchImpl = globalThis.fetch, }) {
|
|
84
113
|
const base = origin(baseUrl);
|
|
85
114
|
const { token, expiresAt } = credential(request);
|
|
86
|
-
const lattice = header({
|
|
115
|
+
const lattice = header({
|
|
116
|
+
request,
|
|
117
|
+
name: "x-sequence-lattice-execution-token",
|
|
118
|
+
});
|
|
87
119
|
async function read(query, capture) {
|
|
88
120
|
if (expiresAt <= Date.now() / 1000)
|
|
89
|
-
throw new agents_contract_1.FunctionAgentReadError(401,
|
|
121
|
+
throw new agents_contract_1.FunctionAgentReadError(401, "expired_context", "The agent-read credential expired; start a new invocation");
|
|
90
122
|
const body = agents_contract_1.functionAgentCompletedRunQuerySchema.parse(query);
|
|
91
|
-
const process = body.recoveryProof
|
|
92
|
-
|
|
123
|
+
const process = body.recoveryProof
|
|
124
|
+
? recoveryProcessCredential(request)
|
|
125
|
+
: null;
|
|
126
|
+
const evidence = capture
|
|
127
|
+
? header({ request, name: agent_source_evidence_contract_1.FUNCTION_AGENT_EVIDENCE_TOKEN_HEADER })
|
|
128
|
+
: null;
|
|
93
129
|
if (capture && !evidence)
|
|
94
|
-
throw new agents_contract_1.FunctionAgentReadError(401,
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
130
|
+
throw new agents_contract_1.FunctionAgentReadError(401, "invalid_context", "Source capture requires this invocation’s separate agent-evidence credential");
|
|
131
|
+
const send = (0, adapters_1.createInvocationDomainTransport)({
|
|
132
|
+
baseUrl: base,
|
|
133
|
+
fetchImpl,
|
|
134
|
+
domain: capture ? "agents-capture" : "agents-read",
|
|
135
|
+
credentials: [
|
|
136
|
+
{ header: agents_contract_1.FUNCTION_AGENT_TOKEN_HEADER, token, expiresAt },
|
|
137
|
+
...(process
|
|
138
|
+
? [{ header: processes_contract_1.FUNCTION_PROCESS_TOKEN_HEADER, token: process }]
|
|
139
|
+
: []),
|
|
140
|
+
...(evidence
|
|
141
|
+
? [{ header: agent_source_evidence_contract_1.FUNCTION_AGENT_EVIDENCE_TOKEN_HEADER, token: evidence }]
|
|
142
|
+
: []),
|
|
143
|
+
...(lattice
|
|
144
|
+
? [{ header: "x-sequence-lattice-execution-token", token: lattice }]
|
|
145
|
+
: []),
|
|
146
|
+
],
|
|
147
|
+
error: (status, code, message) => new agents_contract_1.FunctionAgentReadError(status, code, message),
|
|
148
|
+
failure: { code: "agent_read_failed", message: "Agent read failed" },
|
|
149
|
+
});
|
|
150
|
+
return send({
|
|
151
|
+
...body,
|
|
152
|
+
operation: capture ? "captureCompletedRun" : "getCompletedRun",
|
|
98
153
|
});
|
|
99
|
-
const result = await response.json().catch(() => null);
|
|
100
|
-
if (!response.ok) {
|
|
101
|
-
const error = zod_1.z.object({ code: zod_1.z.string().max(128).optional(), detail: zod_1.z.string().max(2000).optional() }).safeParse(result);
|
|
102
|
-
throw new agents_contract_1.FunctionAgentReadError(response.status, error.success ? (error.data.code ?? 'agent_read_failed') : 'agent_read_failed', error.success ? (error.data.detail ?? 'Agent read failed') : 'Agent read failed');
|
|
103
|
-
}
|
|
104
|
-
return result;
|
|
105
154
|
}
|
|
106
|
-
return {
|
|
107
|
-
async getCompletedRun(query) {
|
|
108
|
-
const result = await read(query, false);
|
|
109
|
-
const parsed = agents_contract_1.functionAgentCompletedRunSchema.safeParse(result);
|
|
110
|
-
if (!parsed.success || parsed.data.runId !== query.runId || parsed.data.agent !== query.agent)
|
|
111
|
-
throw new agents_contract_1.FunctionAgentReadError(502, 'malformed_response', 'Atlas returned an invalid completed agent response');
|
|
112
|
-
return parsed.data;
|
|
113
|
-
},
|
|
114
|
-
async captureCompletedRun(query) {
|
|
115
|
-
const parsed = agent_source_evidence_contract_1.functionAgentSourceEvidenceCaptureSchema.safeParse(await read(query, true));
|
|
116
|
-
if (!parsed.success || parsed.data.response.runId !== query.runId || parsed.data.response.agent !== query.agent || 'context' in parsed.data.response)
|
|
117
|
-
throw new agents_contract_1.FunctionAgentReadError(502, 'malformed_response', 'Atlas returned an invalid neutral source capture');
|
|
118
|
-
return parsed.data;
|
|
119
|
-
},
|
|
120
|
-
};
|
|
155
|
+
return (0, adapters_1.createAgentResponseClient)({ read });
|
|
121
156
|
}
|
package/dist/capabilities.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare const MANAGED_FUNCTION_CAPABILITIES: {
|
|
|
16
16
|
readonly directory_rosters: {
|
|
17
17
|
readonly field: "capabilities.directory.rosters";
|
|
18
18
|
readonly supported: true;
|
|
19
|
-
readonly limit: "1 to 16 explicit groups; up to 50 active tenant members per page; directory Reader and group
|
|
19
|
+
readonly limit: "1 to 16 explicit groups; up to 50 active tenant members per page; directory Reader and group roster Reader required";
|
|
20
20
|
readonly min_cli: "0.6.6";
|
|
21
21
|
readonly min_sdk: "0.4.4";
|
|
22
22
|
};
|
package/dist/capabilities.js
CHANGED
|
@@ -16,7 +16,7 @@ exports.MANAGED_FUNCTION_CAPABILITIES = {
|
|
|
16
16
|
sdk: { package: exports.MANAGED_FUNCTION_SDK_PACKAGE, min: '0.3.0' },
|
|
17
17
|
},
|
|
18
18
|
features: {
|
|
19
|
-
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
|
|
19
|
+
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 roster Reader required', min_cli: '0.6.6', min_sdk: '0.4.4' },
|
|
20
20
|
directory_members: {
|
|
21
21
|
field: 'capabilities.directory.groups', supported: true,
|
|
22
22
|
limit: '1 to 16 concrete groups; resolve 1 to 50 selected active members per call',
|
package/dist/config.d.ts
CHANGED
|
@@ -37,3 +37,4 @@ export declare const cacheManifestSchema: z.ZodObject<{
|
|
|
37
37
|
export type CacheConfiguration = z.infer<typeof cacheManifestSchema>;
|
|
38
38
|
export declare function readCacheConfiguration(manifest: unknown): CacheConfiguration;
|
|
39
39
|
export * from './directory-roster-contract';
|
|
40
|
+
export { groupRosterAccessTargetSchema, groupRosterAccessResultSchema } from '@sequenceholdings/platform/contracts';
|
package/dist/config.js
CHANGED
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.sdkSpecFromPackageJson = exports.sdkVersionFromPackageJson = exports.isPostgresEgress = exports.formatValidationDetail = exports.MANAGED_FUNCTION_SDK_PACKAGE = exports.MANAGED_FUNCTION_CLI_PACKAGE = exports.MANAGED_FUNCTION_CAPABILITIES = exports.managedFunctionWorkloadLimitsSchema = exports.MF_LIMITS_DEFAULTS = exports.MF_LIMITS_CAPS = exports.MANAGED_FUNCTION_LIMITS = exports.readFunctionImmutableRelease = exports.functionImmutableReleaseSchema = exports.shouldReportAtlasHttp = exports.directoryPrincipalResolutionSchema = exports.directoryPrincipalResolveRequestSchema = exports.readFunctionDirectoryScopes = exports.functionDirectoryScopesSchema = exports.FUNCTION_DIRECTORY_RESOLVE_PATH = exports.FUNCTION_DIRECTORY_TOKEN_HEADER = exports.FUNCTION_CALLER_DATA_TOKEN_HEADER = exports.readFunctionWorkflowEvidenceScopes = exports.readFunctionWorkflowScopes = exports.functionWorkflowScopesSchema = exports.functionAgentCompletedRunSchema = exports.functionAgentCompletedRunQuerySchema = exports.functionAgentReadRequestSchema = exports.readFunctionAgentScopes = exports.functionAgentReadScopesSchema = exports.FUNCTION_AGENT_READ_PATH = exports.FUNCTION_AGENT_TOKEN_HEADER = exports.functionProcessCompletedNodeQuerySchema = exports.functionProcessCompletedNodeSchema = exports.functionProcessCompletedAgentReferenceQuerySchema = exports.functionProcessCompletedAgentReferenceSchema = exports.functionProcessRunSummarySchema = exports.functionProcessReadRequestSchema = exports.readFunctionProcessScopes = exports.functionProcessReadScopesSchema = exports.FUNCTION_PROCESS_READ_PATH = exports.FUNCTION_PROCESS_TOKEN_HEADER = exports.readFunctionLatticeContextCapability = exports.functionLatticeContextCapabilitySchema = exports.functionDirectoryManifestSchema = exports.readDirectoryGroups = exports.directoryMembersResponse = exports.directoryMembersInput = exports.directoryScopesSchema = exports.directoryGroupIdSchema = exports.DIRECTORY_TOKEN_HEADER = void 0;
|
|
18
|
-
exports.cacheManifestSchema = exports.CACHE_MAX_TTL_SECONDS = exports.preflightManagedFunction = exports.parseDeployedPolicy = exports.versionIsOlder = exports.sdkVersionLowerBound = void 0;
|
|
18
|
+
exports.groupRosterAccessResultSchema = exports.groupRosterAccessTargetSchema = exports.cacheManifestSchema = exports.CACHE_MAX_TTL_SECONDS = exports.preflightManagedFunction = exports.parseDeployedPolicy = exports.versionIsOlder = exports.sdkVersionLowerBound = void 0;
|
|
19
19
|
exports.readCacheConfiguration = readCacheConfiguration;
|
|
20
20
|
var directory_config_1 = require("./directory-config");
|
|
21
21
|
Object.defineProperty(exports, "DIRECTORY_TOKEN_HEADER", { enumerable: true, get: function () { return directory_config_1.DIRECTORY_TOKEN_HEADER; } });
|
|
@@ -118,3 +118,6 @@ function readCacheConfiguration(manifest) {
|
|
|
118
118
|
return exports.cacheManifestSchema.parse(cache ?? {});
|
|
119
119
|
}
|
|
120
120
|
__exportStar(require("./directory-roster-contract"), exports);
|
|
121
|
+
var contracts_1 = require("@sequenceholdings/platform/contracts");
|
|
122
|
+
Object.defineProperty(exports, "groupRosterAccessTargetSchema", { enumerable: true, get: function () { return contracts_1.groupRosterAccessTargetSchema; } });
|
|
123
|
+
Object.defineProperty(exports, "groupRosterAccessResultSchema", { enumerable: true, get: function () { return contracts_1.groupRosterAccessResultSchema; } });
|
|
@@ -1,23 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const DIRECTORY_TOKEN_HEADER = "x-sequence-directory-token";
|
|
3
|
-
export declare const directoryGroupIdSchema: z.ZodString;
|
|
4
|
-
export declare const directoryScopesSchema: z.ZodObject<{
|
|
5
|
-
groups: z.ZodArray<z.ZodString>;
|
|
6
|
-
}, z.core.$strict>;
|
|
7
|
-
export declare const directoryMembersInput: z.ZodUnion<readonly [z.ZodObject<{
|
|
8
|
-
groupId: z.ZodString;
|
|
9
|
-
userIds: z.ZodArray<z.ZodString>;
|
|
10
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
11
|
-
groupId: z.ZodString;
|
|
12
|
-
subs: z.ZodArray<z.ZodString>;
|
|
13
|
-
}, z.core.$strict>]>;
|
|
14
|
-
export declare const directoryMembersResponse: z.ZodObject<{
|
|
15
|
-
members: z.ZodArray<z.ZodObject<{
|
|
16
|
-
id: z.ZodString;
|
|
17
|
-
sub: z.ZodString;
|
|
18
|
-
name: z.ZodString;
|
|
19
|
-
email: z.ZodString;
|
|
20
|
-
deactivated: z.ZodLiteral<false>;
|
|
21
|
-
}, z.core.$strict>>;
|
|
22
|
-
}, z.core.$strict>;
|
|
23
|
-
export declare function readDirectoryGroups(manifest: unknown): string[];
|
|
1
|
+
export { DIRECTORY_TOKEN_HEADER, directoryGroupIdSchema, directoryScopesSchema, directoryMembersInput, directoryMembersResponse, readDirectoryGroups, } from "@sequenceholdings/platform/contracts";
|