@agents24/node 0.5.33 → 0.5.34
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/compatibility.json +8 -8
- package/dist/bff.cjs +39 -3
- package/dist/bff.cjs.map +1 -1
- package/dist/bff.d.cts +1 -1
- package/dist/bff.d.ts +1 -1
- package/dist/bff.js +39 -3
- package/dist/bff.js.map +1 -1
- package/dist/{client-IX8nsoyr.d.cts → client-CY0o68YO.d.cts} +25 -0
- package/dist/{client-IX8nsoyr.d.ts → client-CY0o68YO.d.ts} +25 -0
- package/dist/index.cjs +36 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +36 -7
- package/dist/index.js.map +1 -1
- package/dist/types/agents.d.ts +1 -0
- package/dist/types/agents.d.ts.map +1 -1
- package/dist/types/bff-conversation-submission.d.ts.map +1 -1
- package/dist/types/bff-multi-agent.d.ts.map +1 -1
- package/dist/types/bff-request.d.ts +2 -0
- package/dist/types/bff-request.d.ts.map +1 -1
- package/dist/types/bff-single-agent.d.ts.map +1 -1
- package/dist/types/bff-sse.d.ts +3 -0
- package/dist/types/bff-sse.d.ts.map +1 -1
- package/dist/types/embed-types.d.ts +3 -0
- package/dist/types/embed-types.d.ts.map +1 -1
- package/dist/types/embed.d.ts +5 -0
- package/dist/types/embed.d.ts.map +1 -1
- package/dist/types/generated/manifest.d.ts +1 -1
- package/dist/types/generated/manifest.d.ts.map +1 -1
- package/dist/types/runs.d.ts +11 -0
- package/dist/types/runs.d.ts.map +1 -1
- package/dist/types/types.d.ts +6 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +2 -2
package/compatibility.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"contractHash": "
|
|
2
|
+
"contractHash": "b9b9a3f464ed29f9df64462c3104802c5e9a4e7d3ed6f4ecfc078295e4458ed5",
|
|
3
3
|
"contractVersion": "0.3.0",
|
|
4
4
|
"corpus": "conformance/v1/corpus.json",
|
|
5
5
|
"generatedBy": "@agents24/sdk-contract",
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"reactDom": ">=19 <20"
|
|
16
16
|
},
|
|
17
17
|
"@agents24/client": {
|
|
18
|
-
"contract": "
|
|
18
|
+
"contract": "9d624998b7ba0eb7055eaf4720ee4756ae579be0733ed3485d577086f9bf847c",
|
|
19
19
|
"runtime": "run-stream.v3"
|
|
20
20
|
},
|
|
21
21
|
"@agents24/node": {
|
|
22
|
-
"contract": "
|
|
22
|
+
"contract": "b9b9a3f464ed29f9df64462c3104802c5e9a4e7d3ed6f4ecfc078295e4458ed5",
|
|
23
23
|
"node": "^22.0.0 || ^24.0.0"
|
|
24
24
|
},
|
|
25
25
|
"@agents24/react": {
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"react": ">=19 <20"
|
|
28
28
|
},
|
|
29
29
|
"@talmudpedia/runtime-sdk": {
|
|
30
|
-
"contract": "
|
|
30
|
+
"contract": "9d624998b7ba0eb7055eaf4720ee4756ae579be0733ed3485d577086f9bf847c",
|
|
31
31
|
"protocolOwner": "@agents24/client"
|
|
32
32
|
},
|
|
33
33
|
"agents24": {
|
|
34
|
-
"contract": "
|
|
34
|
+
"contract": "b9b9a3f464ed29f9df64462c3104802c5e9a4e7d3ed6f4ecfc078295e4458ed5",
|
|
35
35
|
"python": ">=3.10"
|
|
36
36
|
}
|
|
37
37
|
},
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
},
|
|
48
48
|
"schemaVersion": "agents24.compatibility.v1",
|
|
49
49
|
"targetOperationCounts": {
|
|
50
|
-
"client":
|
|
51
|
-
"node":
|
|
52
|
-
"python":
|
|
50
|
+
"client": 38,
|
|
51
|
+
"node": 202,
|
|
52
|
+
"python": 196
|
|
53
53
|
}
|
|
54
54
|
}
|
package/dist/bff.cjs
CHANGED
|
@@ -189,6 +189,13 @@ function routeId(path, pattern, field) {
|
|
|
189
189
|
throw new BffInputError(400, "INVALID_PATH", `${field} is invalid.`);
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
+
function requestedOutputNames(value) {
|
|
193
|
+
if (value === void 0) return void 0;
|
|
194
|
+
if (!Array.isArray(value) || !value.every((name) => typeof name === "string")) {
|
|
195
|
+
throw new BffInputError(400, "INVALID_REQUESTED_OUTPUTS", "requestedOutputs must be a string array.");
|
|
196
|
+
}
|
|
197
|
+
return value;
|
|
198
|
+
}
|
|
192
199
|
function messageBody(body) {
|
|
193
200
|
const mode = body.mode === "steer" ? "steer" : body.mode === "queue" ? "queue" : null;
|
|
194
201
|
if (!mode) throw new BffInputError(400, "INVALID_MODE", "Message mode must be queue or steer.");
|
|
@@ -205,6 +212,7 @@ function messageBody(body) {
|
|
|
205
212
|
input,
|
|
206
213
|
attachmentIds,
|
|
207
214
|
...requestedModelId ? { requestedModelId } : {},
|
|
215
|
+
...body.requestedOutputs === void 0 ? {} : { requestedOutputs: requestedOutputNames(body.requestedOutputs) },
|
|
208
216
|
toolInputs: objectValue(body.toolInputs),
|
|
209
217
|
...body.metadata === void 0 ? {} : { metadata: objectValue(body.metadata) }
|
|
210
218
|
};
|
|
@@ -296,6 +304,7 @@ async function submitConversationStream(input) {
|
|
|
296
304
|
...resolution.customerTenant === void 0 ? {} : { customer_tenant: resolution.customerTenant },
|
|
297
305
|
...resolution.trustedContext === void 0 ? {} : { trusted_context: resolution.trustedContext },
|
|
298
306
|
...resolution.knowledgeNamespaces === void 0 ? {} : { knowledge_namespaces: resolution.knowledgeNamespaces },
|
|
307
|
+
...value.requestedOutputs === void 0 ? {} : { requested_outputs: value.requestedOutputs },
|
|
299
308
|
tool_inputs: value.toolInputs,
|
|
300
309
|
metadata: objectValue(body.metadata)
|
|
301
310
|
}, {
|
|
@@ -594,6 +603,10 @@ function sseResponse(execute, headers, failurePayload, onFailure, requestSignal,
|
|
|
594
603
|
});
|
|
595
604
|
return new Response(stream, { headers: sseHeaders(headers) });
|
|
596
605
|
}
|
|
606
|
+
function runtimeEventEnabled(request, event) {
|
|
607
|
+
const feature = event.event === "assistant.completed" ? "assistant-completion-v1" : event.event.startsWith("workflow.output.") ? "workflow-outputs-v1" : null;
|
|
608
|
+
return feature === null || Boolean(new URL(request.url).searchParams.get("stream_features")?.split(",").includes(feature));
|
|
609
|
+
}
|
|
597
610
|
|
|
598
611
|
// src/bff-resolver.ts
|
|
599
612
|
var AgentBffResolverError = class extends Error {
|
|
@@ -683,6 +696,21 @@ function createAgents24BffHandlerWithResolver(options, resolveCustomerIdentity)
|
|
|
683
696
|
{ ...threadIdentity, integrationId }
|
|
684
697
|
), resolution.responseHeaders);
|
|
685
698
|
let response;
|
|
699
|
+
if (request.method === "GET" && /^\/runs\/[^/]+\/outputs(?:\/[^/]+)?$/.test(path)) {
|
|
700
|
+
const parts = path.split("/");
|
|
701
|
+
const scope = {
|
|
702
|
+
...threadIdentity,
|
|
703
|
+
integrationId,
|
|
704
|
+
runtimeTarget,
|
|
705
|
+
...resolution.chatScope === void 0 ? {} : { chatScope: resolution.chatScope }
|
|
706
|
+
};
|
|
707
|
+
const result = parts[4] ? await embed.getAgentRunOutput(agentId, decodeURIComponent(parts[2]), decodeURIComponent(parts[4]), scope) : await embed.listAgentRunOutputs(agentId, decodeURIComponent(parts[2]), {
|
|
708
|
+
...scope,
|
|
709
|
+
after: Number(url.searchParams.get("after") || 0),
|
|
710
|
+
limit: Number(url.searchParams.get("limit") || 50)
|
|
711
|
+
});
|
|
712
|
+
return mergeHeaders(json(result), resolution.responseHeaders);
|
|
713
|
+
}
|
|
686
714
|
if (request.method === "GET" && path === "/bootstrap") {
|
|
687
715
|
const raw = await embed.getRuntimeBootstrap(agentId, agentVersionId, runtimeTarget);
|
|
688
716
|
response = json(bootstrapDocument(raw, agentVersionId));
|
|
@@ -722,6 +750,7 @@ function createAgents24BffHandlerWithResolver(options, resolveCustomerIdentity)
|
|
|
722
750
|
...resolution.trustedContext === void 0 ? {} : { trustedContext: resolution.trustedContext },
|
|
723
751
|
...stringValue(body.requestedModelId) ? { requestedModelId: stringValue(body.requestedModelId) } : {},
|
|
724
752
|
...resolution.knowledgeNamespaces === void 0 ? {} : { knowledgeNamespaces: resolution.knowledgeNamespaces },
|
|
753
|
+
...body.requestedOutputs === void 0 ? {} : { requestedOutputs: requestedOutputNames(body.requestedOutputs) },
|
|
725
754
|
toolInputs: objectValue(body.toolInputs),
|
|
726
755
|
...body.metadata === void 0 ? {} : { metadata: objectValue(body.metadata) }
|
|
727
756
|
}, { idempotencyKey }) : await embed.startAgentRun(agentId, {
|
|
@@ -738,6 +767,7 @@ function createAgents24BffHandlerWithResolver(options, resolveCustomerIdentity)
|
|
|
738
767
|
attachment_ids: attachmentIds,
|
|
739
768
|
...stringValue(body.requestedModelId) ? { requested_model_id: stringValue(body.requestedModelId) } : {},
|
|
740
769
|
...resolution.knowledgeNamespaces === void 0 ? {} : { knowledge_namespaces: resolution.knowledgeNamespaces },
|
|
770
|
+
...body.requestedOutputs === void 0 ? {} : { requested_outputs: requestedOutputNames(body.requestedOutputs) },
|
|
741
771
|
tool_inputs: objectValue(body.toolInputs),
|
|
742
772
|
...body.metadata === void 0 ? {} : { metadata: objectValue(body.metadata) },
|
|
743
773
|
client: objectValue(body.client)
|
|
@@ -756,7 +786,7 @@ function createAgents24BffHandlerWithResolver(options, resolveCustomerIdentity)
|
|
|
756
786
|
client: objectValue(body.client),
|
|
757
787
|
cursor: 0
|
|
758
788
|
}, (event) => {
|
|
759
|
-
if (
|
|
789
|
+
if (runtimeEventEnabled(request, event)) return write(event);
|
|
760
790
|
}, { signal, onControl: control, leaseSeconds: 60, streamFeatures: url.searchParams.get("stream_features") || "", onPreview: (frame) => write(frame) });
|
|
761
791
|
}, {
|
|
762
792
|
"X-Run-ID": admittedRunId,
|
|
@@ -779,12 +809,13 @@ function createAgents24BffHandlerWithResolver(options, resolveCustomerIdentity)
|
|
|
779
809
|
...resolution.chatScope === void 0 ? {} : { chat_scope: resolution.chatScope },
|
|
780
810
|
...cursor === void 0 ? {} : { cursor: Number(cursor) }
|
|
781
811
|
}, (event) => {
|
|
782
|
-
if (
|
|
812
|
+
if (runtimeEventEnabled(request, event)) return write(event);
|
|
783
813
|
}, {
|
|
784
814
|
idempotencyKey,
|
|
785
815
|
signal,
|
|
786
816
|
onControl: control,
|
|
787
817
|
leaseSeconds: 60,
|
|
818
|
+
streamFeatures: url.searchParams.get("stream_features") || "",
|
|
788
819
|
...url.searchParams.get("thread_id") ? { threadId: url.searchParams.get("thread_id") } : {}
|
|
789
820
|
});
|
|
790
821
|
}, void 0, void 0, streamFailure(request, "run.attach"), request.signal);
|
|
@@ -1164,6 +1195,10 @@ function createResolvedAgents24BffHandler(options, sharedIdentity) {
|
|
|
1164
1195
|
});
|
|
1165
1196
|
return (await requestedAgent(detail.runtime_selection?.agent_id)).agentId;
|
|
1166
1197
|
};
|
|
1198
|
+
if (request.method === "GET" && /^\/runs\/[^/]+\/outputs(?:\/[^/]+)?$/.test(path)) {
|
|
1199
|
+
const runId = routeId(path, /^\/runs\/([^/]+)\/outputs/, "runId");
|
|
1200
|
+
return dispatchToAgent(await resolveRunAgent(runId));
|
|
1201
|
+
}
|
|
1167
1202
|
if (request.method === "POST" && path === "/chat/stream") {
|
|
1168
1203
|
const body = await requestJson(request);
|
|
1169
1204
|
const threadId = stringValue(body.threadId);
|
|
@@ -1198,6 +1233,7 @@ function createResolvedAgents24BffHandler(options, sharedIdentity) {
|
|
|
1198
1233
|
client_submission_id: stringValue(body.clientSubmissionId),
|
|
1199
1234
|
...body.relayClientId === null ? { relay_client_id: null } : stringValue(body.relayClientId) ? { relay_client_id: stringValue(body.relayClientId) } : {},
|
|
1200
1235
|
attachment_ids: attachmentIds,
|
|
1236
|
+
...body.requestedOutputs === void 0 ? {} : { requested_outputs: requestedOutputNames(body.requestedOutputs) },
|
|
1201
1237
|
...stringValue(body.requestedModelId) ? { requested_model_id: stringValue(body.requestedModelId) } : {},
|
|
1202
1238
|
...resolution.knowledgeNamespaces === void 0 ? {} : { knowledge_namespaces: resolution.knowledgeNamespaces },
|
|
1203
1239
|
tool_inputs: objectValue(body.toolInputs),
|
|
@@ -1216,7 +1252,7 @@ function createResolvedAgents24BffHandler(options, sharedIdentity) {
|
|
|
1216
1252
|
client: objectValue(body.client),
|
|
1217
1253
|
cursor: 0
|
|
1218
1254
|
}, (event) => {
|
|
1219
|
-
if (
|
|
1255
|
+
if (runtimeEventEnabled(request, event)) return write(event);
|
|
1220
1256
|
}, { signal, onControl: control, leaseSeconds: 60, streamFeatures: url.searchParams.get("stream_features") || "", onPreview: (frame) => write(frame) });
|
|
1221
1257
|
}, {
|
|
1222
1258
|
"X-Run-ID": admittedRunId,
|