@finalai/agent-provider 0.19.0 → 0.20.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/dist/modules/channel.d.mts +1 -1
- package/dist/modules/channel.mjs.map +1 -1
- package/dist/modules/conformance/agent.d.mts +1 -1
- package/dist/modules/conformance/agent.mjs +24 -53
- package/dist/modules/conformance/agent.mjs.map +2 -2
- package/dist/modules/conformance/fixtures.d.mts +1 -1
- package/dist/modules/conformance/fixtures.mjs.map +2 -2
- package/dist/modules/conformance/harness-kit.d.mts +1 -1
- package/dist/modules/conformance/harness-kit.mjs +28 -36
- package/dist/modules/conformance/harness-kit.mjs.map +2 -2
- package/dist/modules/conformance/local-harness.d.mts +1 -1
- package/dist/modules/conformance/local-harness.mjs.map +1 -1
- package/dist/modules/conformance/stdio.mjs +1 -1
- package/dist/modules/conformance/stdio.mjs.map +1 -1
- package/dist/modules/conformance/v1-agent.d.mts +1 -1
- package/dist/modules/conformance/v1-agent.mjs +11 -13
- package/dist/modules/conformance/v1-agent.mjs.map +2 -2
- package/dist/modules/harness-provider.d.mts +1 -1
- package/dist/modules/harness-provider.mjs +1 -1
- package/dist/modules/harness-provider.mjs.map +1 -1
- package/dist/modules/harness.d.mts +1 -1
- package/dist/modules/harness.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
client,
|
|
3
3
|
methods,
|
|
4
4
|
PROTOCOL_VERSION
|
|
5
|
-
} from "@agentclientprotocol/sdk/experimental/v2";
|
|
5
|
+
} from "@agentclientprotocol/sdk/experimental/v2/unstable";
|
|
6
6
|
import {
|
|
7
7
|
accumulateAgentMessages,
|
|
8
8
|
acpSchemas,
|
|
@@ -174,7 +174,6 @@ const toolBlocksOf = (updates) => updates.flatMap((update) => {
|
|
|
174
174
|
});
|
|
175
175
|
const requestIdSchema = z.object({ id: z.union([z.string(), z.number()]), method: z.string() });
|
|
176
176
|
const responseIdSchema = z.object({ id: z.union([z.string(), z.number(), z.null()]) });
|
|
177
|
-
const isBatch = (wire) => Array.isArray(wire);
|
|
178
177
|
const BIG_RESULT_BYTES = 3 * 1024 * 1024;
|
|
179
178
|
const providerErrorSchema = z.object({
|
|
180
179
|
[FINAL_META_KEY]: z.object({
|
|
@@ -389,11 +388,9 @@ const runHarnessConformance = async (args) => {
|
|
|
389
388
|
const writer = inner.writable.getWriter();
|
|
390
389
|
const writable = new WritableStream({
|
|
391
390
|
write: async (wire) => {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
promptDrop.id = JSON.stringify(request.data.id);
|
|
396
|
-
}
|
|
391
|
+
const request = requestIdSchema.safeParse(wire);
|
|
392
|
+
if (promptDrop.armed && promptDrop.id == null && request.success && request.data.method === methods.agent.session.prompt) {
|
|
393
|
+
promptDrop.id = JSON.stringify(request.data.id);
|
|
397
394
|
}
|
|
398
395
|
await writer.write(wire);
|
|
399
396
|
},
|
|
@@ -405,7 +402,7 @@ const runHarnessConformance = async (args) => {
|
|
|
405
402
|
transform: (wire, controller) => {
|
|
406
403
|
inboundFrameBytes.push(serializedFrameBytes(wire));
|
|
407
404
|
const response = responseIdSchema.safeParse(wire);
|
|
408
|
-
if (promptDrop.id != null && !
|
|
405
|
+
if (promptDrop.id != null && !("method" in wire) && response.success && JSON.stringify(response.data.id) === promptDrop.id) {
|
|
409
406
|
promptDrop.id = null;
|
|
410
407
|
promptDrop.armed = false;
|
|
411
408
|
promptDrop.dropped = true;
|
|
@@ -1305,15 +1302,13 @@ const runHarnessConformance = async (args) => {
|
|
|
1305
1302
|
const watch = watchInitializeVersion({
|
|
1306
1303
|
writable: new WritableStream({
|
|
1307
1304
|
write: async (wire) => {
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
closeIds.set(JSON.stringify(close.data.id), close.data.params.sessionId);
|
|
1316
|
-
}
|
|
1305
|
+
const close = z.object({
|
|
1306
|
+
id: z.union([z.string(), z.number()]),
|
|
1307
|
+
method: z.literal("session/close"),
|
|
1308
|
+
params: z.object({ sessionId: z.string() })
|
|
1309
|
+
}).safeParse(wire);
|
|
1310
|
+
if (close.success)
|
|
1311
|
+
closeIds.set(JSON.stringify(close.data.id), close.data.params.sessionId);
|
|
1317
1312
|
await outgoing.write(wire);
|
|
1318
1313
|
},
|
|
1319
1314
|
close: () => outgoing.close(),
|
|
@@ -1322,27 +1317,24 @@ const runHarnessConformance = async (args) => {
|
|
|
1322
1317
|
readable: dialed.readable.pipeThrough(
|
|
1323
1318
|
new TransformStream({
|
|
1324
1319
|
transform: (wire, controller) => {
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
state: z.string()
|
|
1333
|
-
})
|
|
1320
|
+
const state = z.object({
|
|
1321
|
+
method: z.literal("session/update"),
|
|
1322
|
+
params: z.object({
|
|
1323
|
+
sessionId: z.string(),
|
|
1324
|
+
update: z.object({
|
|
1325
|
+
sessionUpdate: z.literal("state_update"),
|
|
1326
|
+
state: z.string()
|
|
1334
1327
|
})
|
|
1335
|
-
})
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
const reply = z.object({ id: z.union([z.string(), z.number()]), result: z.unknown() }).safeParse(message);
|
|
1342
|
-
const sessionId2 = reply.success ? closeIds.get(JSON.stringify(reply.data.id)) : null;
|
|
1343
|
-
if (sessionId2 != null && idleSeen.has(sessionId2))
|
|
1344
|
-
settledBeforeReply.add(sessionId2);
|
|
1328
|
+
})
|
|
1329
|
+
}).safeParse(wire);
|
|
1330
|
+
if (state.success) {
|
|
1331
|
+
if (state.data.params.update.state === "idle")
|
|
1332
|
+
idleSeen.add(state.data.params.sessionId);
|
|
1333
|
+
else idleSeen.delete(state.data.params.sessionId);
|
|
1345
1334
|
}
|
|
1335
|
+
const reply = z.object({ id: z.union([z.string(), z.number()]), result: z.unknown() }).safeParse(wire);
|
|
1336
|
+
const sessionId2 = reply.success ? closeIds.get(JSON.stringify(reply.data.id)) : null;
|
|
1337
|
+
if (sessionId2 != null && idleSeen.has(sessionId2)) settledBeforeReply.add(sessionId2);
|
|
1346
1338
|
controller.enqueue(wire);
|
|
1347
1339
|
}
|
|
1348
1340
|
})
|