@artinet/sdk 0.5.14 → 0.5.16
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 +5 -0
- package/dist/server/express/server.d.ts +24 -24
- package/dist/services/a2a/factory/builder.d.ts +26 -26
- package/dist/services/a2a/factory/builder.js +38 -72
- package/dist/services/a2a/helpers/message-builder.d.ts +1 -1
- package/dist/services/a2a/helpers/message-builder.js +4 -4
- package/dist/services/a2a/methods/get-task.d.ts +47 -47
- package/dist/services/a2a/methods/send-message.js +1 -1
- package/dist/services/a2a/methods/stream-message.js +1 -1
- package/dist/services/a2a/service.d.ts +157 -157
- package/dist/services/a2a/state/load.d.ts +1 -1
- package/dist/transport/trpc/a2a/factory/router.d.ts +1096 -1096
- package/dist/transport/trpc/a2a/routes/info.d.ts +37 -37
- package/dist/transport/trpc/a2a/routes/message/route.d.ts +227 -227
- package/dist/transport/trpc/a2a/routes/tasks/route.d.ts +260 -260
- package/dist/transport/trpc/a2a/trpc.d.ts +120 -120
- package/dist/types/interfaces/services/a2a/service.d.ts +1 -1
- package/dist/types/schemas/a2a/agent.d.ts +840 -840
- package/dist/types/schemas/a2a/agent.js +23 -2
- package/dist/types/schemas/a2a/auth.d.ts +197 -197
- package/dist/types/schemas/a2a/auth.js +19 -4
- package/dist/types/schemas/a2a/error.d.ts +24 -24
- package/dist/types/schemas/a2a/message.d.ts +4525 -4525
- package/dist/types/schemas/a2a/message.js +10 -2
- package/dist/types/schemas/a2a/notification.d.ts +403 -403
- package/dist/types/schemas/a2a/notification.js +7 -3
- package/dist/types/schemas/a2a/parameters.d.ts +264 -264
- package/dist/types/schemas/a2a/parameters.js +14 -1
- package/dist/types/schemas/a2a/protocol.d.ts +6042 -6042
- package/dist/types/schemas/a2a/rpc.d.ts +20 -20
- package/dist/types/schemas/a2a/rpc.js +5 -0
- package/dist/types/schemas/a2a/task.d.ts +2536 -2536
- package/dist/types/schemas/a2a/task.js +12 -11
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -69,6 +69,11 @@ It has [serveral template projects](https://github.com/the-artinet-project/creat
|
|
|
69
69
|
- The `A2AClient` now checks `/.well-known/agent-card.json` as a opposed to `/.well-known/agent.json` in-line with the A2A spec.
|
|
70
70
|
- The `A2AClient` now uses uses the `AgentCard`.url if an `AgentCard` has been successfully retrieved, else it will default to the `baseUrl`.
|
|
71
71
|
- The examples folder will be removed in favor of [`create-agent`](https://github.com/the-artinet-project/create-agent).
|
|
72
|
+
- In `Task` the `contextId` field is now required (inline with the A2A spec).
|
|
73
|
+
- In `AgentSkill` the `tag` field is now required (inline with the A2A spec).
|
|
74
|
+
- Optional fields in Agent2Agent Zod schemas are now nullable for better interoperability.
|
|
75
|
+
- The `EngineBuilder` constructor is now protected and open for extension.
|
|
76
|
+
- `AgentBuilder` will now throw an error if it recieves an invalid `FilePart`.
|
|
72
77
|
|
|
73
78
|
## Installation
|
|
74
79
|
|
|
@@ -23,48 +23,48 @@ export declare function createAgentServer(params: ServerParams & {
|
|
|
23
23
|
parts: ({
|
|
24
24
|
file: {
|
|
25
25
|
bytes: string;
|
|
26
|
-
name?: string | undefined;
|
|
27
|
-
mimeType?: string | undefined;
|
|
28
|
-
uri?: undefined;
|
|
26
|
+
name?: string | null | undefined;
|
|
27
|
+
mimeType?: string | null | undefined;
|
|
28
|
+
uri?: null | undefined;
|
|
29
29
|
} | {
|
|
30
30
|
uri: string;
|
|
31
|
-
name?: string | undefined;
|
|
32
|
-
bytes?: undefined;
|
|
33
|
-
mimeType?: string | undefined;
|
|
31
|
+
name?: string | null | undefined;
|
|
32
|
+
bytes?: null | undefined;
|
|
33
|
+
mimeType?: string | null | undefined;
|
|
34
34
|
};
|
|
35
35
|
kind: "file";
|
|
36
|
-
metadata?: Record<string, unknown> | undefined;
|
|
36
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
37
37
|
} | {
|
|
38
38
|
text: string;
|
|
39
39
|
kind: "text";
|
|
40
|
-
metadata?: Record<string, unknown> | undefined;
|
|
40
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
41
41
|
} | {
|
|
42
42
|
data: Record<string, unknown>;
|
|
43
43
|
kind: "data";
|
|
44
|
-
metadata?: Record<string, unknown> | undefined;
|
|
44
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
45
45
|
})[];
|
|
46
46
|
messageId: string;
|
|
47
|
-
metadata?: Record<string, unknown> | undefined;
|
|
48
|
-
extensions?: string[] | undefined;
|
|
49
|
-
referenceTaskIds?: string[] | undefined;
|
|
50
|
-
taskId?: string | undefined;
|
|
51
|
-
contextId?: string | undefined;
|
|
47
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
48
|
+
extensions?: string[] | null | undefined;
|
|
49
|
+
referenceTaskIds?: string[] | null | undefined;
|
|
50
|
+
taskId?: string | null | undefined;
|
|
51
|
+
contextId?: string | null | undefined;
|
|
52
52
|
};
|
|
53
|
-
metadata?: Record<string, unknown> | undefined;
|
|
53
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
54
54
|
configuration?: {
|
|
55
|
-
historyLength?: number | undefined;
|
|
55
|
+
historyLength?: number | null | undefined;
|
|
56
56
|
pushNotificationConfig?: {
|
|
57
57
|
url: string;
|
|
58
|
-
id?: string | undefined;
|
|
59
|
-
token?: string | undefined;
|
|
58
|
+
id?: string | null | undefined;
|
|
59
|
+
token?: string | null | undefined;
|
|
60
60
|
authentication?: {
|
|
61
61
|
schemes: string[];
|
|
62
|
-
credentials?: string | undefined;
|
|
63
|
-
} | undefined;
|
|
64
|
-
} | undefined;
|
|
65
|
-
acceptedOutputModes?: string[] | undefined;
|
|
66
|
-
blocking?: boolean | undefined;
|
|
67
|
-
} | undefined;
|
|
62
|
+
credentials?: string | null | undefined;
|
|
63
|
+
} | null | undefined;
|
|
64
|
+
} | null | undefined;
|
|
65
|
+
acceptedOutputModes?: string[] | null | undefined;
|
|
66
|
+
blocking?: boolean | null | undefined;
|
|
67
|
+
} | null | undefined;
|
|
68
68
|
}, import("../../types/index.js").TaskAndHistory, import("../../types/index.js").UpdateEvent>;
|
|
69
69
|
};
|
|
70
70
|
export type ExpressAgentServer = ReturnType<typeof createAgentServer>;
|
|
@@ -140,11 +140,11 @@ type OutArgsOf<O> = O extends StepOutputWithForwardArgs<any, infer A> ? A : [];
|
|
|
140
140
|
export declare class EngineBuilder<TCommand extends MessageSendParams = MessageSendParams, TInboundArgs extends readonly unknown[] = []> implements StepBuilder<TCommand, TInboundArgs> {
|
|
141
141
|
private steps;
|
|
142
142
|
/**
|
|
143
|
-
*
|
|
143
|
+
* Protected constructor to enforce factory method usage.
|
|
144
144
|
*
|
|
145
145
|
* @param steps - Initial steps array
|
|
146
146
|
*/
|
|
147
|
-
|
|
147
|
+
protected constructor(steps?: Array<StepWithKind<TCommand, any, any, any, any, any>>);
|
|
148
148
|
/**
|
|
149
149
|
* Creates a new EngineBuilder instance.
|
|
150
150
|
*
|
|
@@ -282,48 +282,48 @@ export declare const AgentBuilder: () => EngineBuilder<{
|
|
|
282
282
|
parts: ({
|
|
283
283
|
file: {
|
|
284
284
|
bytes: string;
|
|
285
|
-
name?: string | undefined;
|
|
286
|
-
mimeType?: string | undefined;
|
|
287
|
-
uri?: undefined;
|
|
285
|
+
name?: string | null | undefined;
|
|
286
|
+
mimeType?: string | null | undefined;
|
|
287
|
+
uri?: null | undefined;
|
|
288
288
|
} | {
|
|
289
289
|
uri: string;
|
|
290
|
-
name?: string | undefined;
|
|
291
|
-
bytes?: undefined;
|
|
292
|
-
mimeType?: string | undefined;
|
|
290
|
+
name?: string | null | undefined;
|
|
291
|
+
bytes?: null | undefined;
|
|
292
|
+
mimeType?: string | null | undefined;
|
|
293
293
|
};
|
|
294
294
|
kind: "file";
|
|
295
|
-
metadata?: Record<string, unknown> | undefined;
|
|
295
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
296
296
|
} | {
|
|
297
297
|
text: string;
|
|
298
298
|
kind: "text";
|
|
299
|
-
metadata?: Record<string, unknown> | undefined;
|
|
299
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
300
300
|
} | {
|
|
301
301
|
data: Record<string, unknown>;
|
|
302
302
|
kind: "data";
|
|
303
|
-
metadata?: Record<string, unknown> | undefined;
|
|
303
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
304
304
|
})[];
|
|
305
305
|
messageId: string;
|
|
306
|
-
metadata?: Record<string, unknown> | undefined;
|
|
307
|
-
extensions?: string[] | undefined;
|
|
308
|
-
referenceTaskIds?: string[] | undefined;
|
|
309
|
-
taskId?: string | undefined;
|
|
310
|
-
contextId?: string | undefined;
|
|
306
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
307
|
+
extensions?: string[] | null | undefined;
|
|
308
|
+
referenceTaskIds?: string[] | null | undefined;
|
|
309
|
+
taskId?: string | null | undefined;
|
|
310
|
+
contextId?: string | null | undefined;
|
|
311
311
|
};
|
|
312
|
-
metadata?: Record<string, unknown> | undefined;
|
|
312
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
313
313
|
configuration?: {
|
|
314
|
-
historyLength?: number | undefined;
|
|
314
|
+
historyLength?: number | null | undefined;
|
|
315
315
|
pushNotificationConfig?: {
|
|
316
316
|
url: string;
|
|
317
|
-
id?: string | undefined;
|
|
318
|
-
token?: string | undefined;
|
|
317
|
+
id?: string | null | undefined;
|
|
318
|
+
token?: string | null | undefined;
|
|
319
319
|
authentication?: {
|
|
320
320
|
schemes: string[];
|
|
321
|
-
credentials?: string | undefined;
|
|
322
|
-
} | undefined;
|
|
323
|
-
} | undefined;
|
|
324
|
-
acceptedOutputModes?: string[] | undefined;
|
|
325
|
-
blocking?: boolean | undefined;
|
|
326
|
-
} | undefined;
|
|
321
|
+
credentials?: string | null | undefined;
|
|
322
|
+
} | null | undefined;
|
|
323
|
+
} | null | undefined;
|
|
324
|
+
acceptedOutputModes?: string[] | null | undefined;
|
|
325
|
+
blocking?: boolean | null | undefined;
|
|
326
|
+
} | null | undefined;
|
|
327
327
|
}, []>;
|
|
328
328
|
/**
|
|
329
329
|
* Creates an agent execution engine from a list of workflow steps.
|
|
@@ -18,6 +18,7 @@ import { TaskState, } from "../../../types/index.js";
|
|
|
18
18
|
import { createAgent } from "./service.js";
|
|
19
19
|
import { v4 as uuidv4 } from "uuid";
|
|
20
20
|
import { getContent } from "../helpers/content.js";
|
|
21
|
+
import { SUBMITTED_UPDATE, WORKING_UPDATE } from "../../../utils/index.js";
|
|
21
22
|
/**
|
|
22
23
|
* Fluent builder for constructing A2A agent execution engines.
|
|
23
24
|
*
|
|
@@ -50,7 +51,7 @@ export class EngineBuilder {
|
|
|
50
51
|
//@typescript-eslint/no-explicit-any
|
|
51
52
|
steps = [];
|
|
52
53
|
/**
|
|
53
|
-
*
|
|
54
|
+
* Protected constructor to enforce factory method usage.
|
|
54
55
|
*
|
|
55
56
|
* @param steps - Initial steps array
|
|
56
57
|
*/
|
|
@@ -231,23 +232,27 @@ const partToMessagePart = (kind, part) => {
|
|
|
231
232
|
}
|
|
232
233
|
case "file": {
|
|
233
234
|
const filePart = part;
|
|
234
|
-
|
|
235
|
-
|
|
235
|
+
if (filePart.uri) {
|
|
236
|
+
return {
|
|
236
237
|
kind: "file",
|
|
237
238
|
file: {
|
|
238
239
|
uri: filePart.uri,
|
|
239
240
|
name: filePart.name,
|
|
240
241
|
mimeType: filePart.mimeType,
|
|
241
242
|
},
|
|
242
|
-
}
|
|
243
|
-
: {
|
|
244
|
-
kind: "file",
|
|
245
|
-
file: {
|
|
246
|
-
bytes: filePart.bytes ?? "",
|
|
247
|
-
name: filePart.name,
|
|
248
|
-
mimeType: filePart.mimeType,
|
|
249
|
-
},
|
|
250
243
|
};
|
|
244
|
+
}
|
|
245
|
+
if (!filePart.bytes) {
|
|
246
|
+
throw new Error("File bytes are required when uri is not provided");
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
kind: "file",
|
|
250
|
+
file: {
|
|
251
|
+
bytes: filePart.bytes,
|
|
252
|
+
name: filePart.name,
|
|
253
|
+
mimeType: filePart.mimeType,
|
|
254
|
+
},
|
|
255
|
+
};
|
|
251
256
|
}
|
|
252
257
|
case "data": {
|
|
253
258
|
return { kind: "data", data: part };
|
|
@@ -287,21 +292,12 @@ export function createAgentExecutor(stepsList) {
|
|
|
287
292
|
content: content,
|
|
288
293
|
args: [],
|
|
289
294
|
};
|
|
290
|
-
const contextId = context.contextId
|
|
291
|
-
const taskId = context.State().task.id
|
|
295
|
+
const contextId = context.contextId;
|
|
296
|
+
const taskId = context.State().task.id;
|
|
292
297
|
if (!contextId || !taskId) {
|
|
293
298
|
throw new Error("Context ID and task ID are required");
|
|
294
299
|
}
|
|
295
|
-
const taskStarted =
|
|
296
|
-
taskId: taskId,
|
|
297
|
-
contextId: contextId,
|
|
298
|
-
kind: "status-update",
|
|
299
|
-
status: {
|
|
300
|
-
state: TaskState.submitted,
|
|
301
|
-
timestamp: new Date().toISOString(),
|
|
302
|
-
},
|
|
303
|
-
final: false,
|
|
304
|
-
};
|
|
300
|
+
const taskStarted = SUBMITTED_UPDATE(taskId, contextId);
|
|
305
301
|
yield taskStarted;
|
|
306
302
|
const finalMessage = {
|
|
307
303
|
taskId: taskId,
|
|
@@ -316,65 +312,35 @@ export function createAgentExecutor(stepsList) {
|
|
|
316
312
|
let parts = [];
|
|
317
313
|
if (Array.isArray(ret)) {
|
|
318
314
|
parts = ret.map((part) => partToMessagePart(step.kind, part));
|
|
319
|
-
const taskStatusUpdate = {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
timestamp: new Date().toISOString(),
|
|
326
|
-
message: {
|
|
327
|
-
messageId: uuidv4(),
|
|
328
|
-
kind: "message",
|
|
329
|
-
role: "agent",
|
|
330
|
-
parts: parts,
|
|
331
|
-
},
|
|
332
|
-
},
|
|
333
|
-
final: false,
|
|
334
|
-
};
|
|
315
|
+
const taskStatusUpdate = WORKING_UPDATE(taskId, contextId, {
|
|
316
|
+
messageId: uuidv4(),
|
|
317
|
+
kind: "message",
|
|
318
|
+
role: "agent",
|
|
319
|
+
parts: parts,
|
|
320
|
+
});
|
|
335
321
|
yield taskStatusUpdate;
|
|
336
322
|
}
|
|
337
|
-
else if (typeof ret === "object") {
|
|
323
|
+
else if (ret !== null && typeof ret === "object") {
|
|
338
324
|
parts = Array.isArray(ret.parts)
|
|
339
325
|
? ret.parts.map((part) => partToMessagePart(step.kind, part))
|
|
340
326
|
: [partToMessagePart(step.kind, ret.parts)];
|
|
341
|
-
const taskStatusUpdate = {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
timestamp: new Date().toISOString(),
|
|
348
|
-
message: {
|
|
349
|
-
messageId: uuidv4(),
|
|
350
|
-
kind: "message",
|
|
351
|
-
role: "agent",
|
|
352
|
-
parts: parts,
|
|
353
|
-
},
|
|
354
|
-
},
|
|
355
|
-
final: false,
|
|
356
|
-
};
|
|
327
|
+
const taskStatusUpdate = WORKING_UPDATE(taskId, contextId, {
|
|
328
|
+
messageId: uuidv4(),
|
|
329
|
+
kind: "message",
|
|
330
|
+
role: "agent",
|
|
331
|
+
parts: parts,
|
|
332
|
+
});
|
|
357
333
|
yield taskStatusUpdate;
|
|
358
334
|
stepArgs.args = ret.args;
|
|
359
335
|
}
|
|
360
336
|
else {
|
|
361
337
|
parts = [partToMessagePart(step.kind, ret)];
|
|
362
|
-
const taskStatusUpdate = {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
timestamp: new Date().toISOString(),
|
|
369
|
-
message: {
|
|
370
|
-
messageId: uuidv4(),
|
|
371
|
-
kind: "message",
|
|
372
|
-
role: "agent",
|
|
373
|
-
parts: parts,
|
|
374
|
-
},
|
|
375
|
-
},
|
|
376
|
-
final: false,
|
|
377
|
-
};
|
|
338
|
+
const taskStatusUpdate = WORKING_UPDATE(taskId, contextId, {
|
|
339
|
+
messageId: uuidv4(),
|
|
340
|
+
kind: "message",
|
|
341
|
+
role: "agent",
|
|
342
|
+
parts: parts,
|
|
343
|
+
});
|
|
378
344
|
yield taskStatusUpdate;
|
|
379
345
|
}
|
|
380
346
|
finalMessage.parts.push(...parts);
|
|
@@ -6,7 +6,7 @@ export declare class MessageBuilder {
|
|
|
6
6
|
}
|
|
7
7
|
export declare class MessageSendConfigurationBuilder {
|
|
8
8
|
configuration: MessageSendConfiguration;
|
|
9
|
-
constructor(configuration?: Partial<MessageSendConfiguration>);
|
|
9
|
+
constructor(configuration?: Partial<MessageSendConfiguration> | null);
|
|
10
10
|
valueOf(): MessageSendConfiguration;
|
|
11
11
|
}
|
|
12
12
|
export declare const createMessageSendParams: (messageSendParams: Partial<MessageSendParams> | string) => MessageSendParams;
|
|
@@ -35,15 +35,15 @@ export class MessageSendConfigurationBuilder {
|
|
|
35
35
|
};
|
|
36
36
|
constructor(configuration = {}) {
|
|
37
37
|
this.configuration.acceptedOutputModes =
|
|
38
|
-
configuration
|
|
38
|
+
configuration?.acceptedOutputModes ??
|
|
39
39
|
this.configuration.acceptedOutputModes;
|
|
40
40
|
this.configuration.historyLength =
|
|
41
|
-
configuration
|
|
41
|
+
configuration?.historyLength ?? this.configuration.historyLength;
|
|
42
42
|
this.configuration.pushNotificationConfig =
|
|
43
|
-
configuration
|
|
43
|
+
configuration?.pushNotificationConfig ??
|
|
44
44
|
this.configuration.pushNotificationConfig;
|
|
45
45
|
this.configuration.blocking =
|
|
46
|
-
configuration
|
|
46
|
+
configuration?.blocking ?? this.configuration.blocking;
|
|
47
47
|
}
|
|
48
48
|
valueOf() {
|
|
49
49
|
return this.configuration;
|
|
@@ -13,100 +13,100 @@ export declare function getTask(input: TaskQueryParams, params: Omit<MethodParam
|
|
|
13
13
|
parts: ({
|
|
14
14
|
file: {
|
|
15
15
|
bytes: string;
|
|
16
|
-
name?: string | undefined;
|
|
17
|
-
mimeType?: string | undefined;
|
|
18
|
-
uri?: undefined;
|
|
16
|
+
name?: string | null | undefined;
|
|
17
|
+
mimeType?: string | null | undefined;
|
|
18
|
+
uri?: null | undefined;
|
|
19
19
|
} | {
|
|
20
20
|
uri: string;
|
|
21
|
-
name?: string | undefined;
|
|
22
|
-
bytes?: undefined;
|
|
23
|
-
mimeType?: string | undefined;
|
|
21
|
+
name?: string | null | undefined;
|
|
22
|
+
bytes?: null | undefined;
|
|
23
|
+
mimeType?: string | null | undefined;
|
|
24
24
|
};
|
|
25
25
|
kind: "file";
|
|
26
|
-
metadata?: Record<string, unknown> | undefined;
|
|
26
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
27
27
|
} | {
|
|
28
28
|
text: string;
|
|
29
29
|
kind: "text";
|
|
30
|
-
metadata?: Record<string, unknown> | undefined;
|
|
30
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
31
31
|
} | {
|
|
32
32
|
data: Record<string, unknown>;
|
|
33
33
|
kind: "data";
|
|
34
|
-
metadata?: Record<string, unknown> | undefined;
|
|
34
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
35
35
|
})[];
|
|
36
36
|
messageId: string;
|
|
37
|
-
metadata?: Record<string, unknown> | undefined;
|
|
38
|
-
extensions?: string[] | undefined;
|
|
39
|
-
referenceTaskIds?: string[] | undefined;
|
|
40
|
-
taskId?: string | undefined;
|
|
41
|
-
contextId?: string | undefined;
|
|
42
|
-
} | undefined;
|
|
43
|
-
timestamp?: string | undefined;
|
|
37
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
38
|
+
extensions?: string[] | null | undefined;
|
|
39
|
+
referenceTaskIds?: string[] | null | undefined;
|
|
40
|
+
taskId?: string | null | undefined;
|
|
41
|
+
contextId?: string | null | undefined;
|
|
42
|
+
} | null | undefined;
|
|
43
|
+
timestamp?: string | null | undefined;
|
|
44
44
|
};
|
|
45
45
|
kind: "task";
|
|
46
|
-
|
|
46
|
+
contextId: string;
|
|
47
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
47
48
|
history?: {
|
|
48
49
|
role: "user" | "agent";
|
|
49
50
|
kind: "message";
|
|
50
51
|
parts: ({
|
|
51
52
|
file: {
|
|
52
53
|
bytes: string;
|
|
53
|
-
name?: string | undefined;
|
|
54
|
-
mimeType?: string | undefined;
|
|
55
|
-
uri?: undefined;
|
|
54
|
+
name?: string | null | undefined;
|
|
55
|
+
mimeType?: string | null | undefined;
|
|
56
|
+
uri?: null | undefined;
|
|
56
57
|
} | {
|
|
57
58
|
uri: string;
|
|
58
|
-
name?: string | undefined;
|
|
59
|
-
bytes?: undefined;
|
|
60
|
-
mimeType?: string | undefined;
|
|
59
|
+
name?: string | null | undefined;
|
|
60
|
+
bytes?: null | undefined;
|
|
61
|
+
mimeType?: string | null | undefined;
|
|
61
62
|
};
|
|
62
63
|
kind: "file";
|
|
63
|
-
metadata?: Record<string, unknown> | undefined;
|
|
64
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
64
65
|
} | {
|
|
65
66
|
text: string;
|
|
66
67
|
kind: "text";
|
|
67
|
-
metadata?: Record<string, unknown> | undefined;
|
|
68
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
68
69
|
} | {
|
|
69
70
|
data: Record<string, unknown>;
|
|
70
71
|
kind: "data";
|
|
71
|
-
metadata?: Record<string, unknown> | undefined;
|
|
72
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
72
73
|
})[];
|
|
73
74
|
messageId: string;
|
|
74
|
-
metadata?: Record<string, unknown> | undefined;
|
|
75
|
-
extensions?: string[] | undefined;
|
|
76
|
-
referenceTaskIds?: string[] | undefined;
|
|
77
|
-
taskId?: string | undefined;
|
|
78
|
-
contextId?: string | undefined;
|
|
79
|
-
}[] | undefined;
|
|
80
|
-
contextId?: string | undefined;
|
|
75
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
76
|
+
extensions?: string[] | null | undefined;
|
|
77
|
+
referenceTaskIds?: string[] | null | undefined;
|
|
78
|
+
taskId?: string | null | undefined;
|
|
79
|
+
contextId?: string | null | undefined;
|
|
80
|
+
}[] | null | undefined;
|
|
81
81
|
artifacts?: {
|
|
82
82
|
artifactId: string;
|
|
83
83
|
parts: ({
|
|
84
84
|
file: {
|
|
85
85
|
bytes: string;
|
|
86
|
-
name?: string | undefined;
|
|
87
|
-
mimeType?: string | undefined;
|
|
88
|
-
uri?: undefined;
|
|
86
|
+
name?: string | null | undefined;
|
|
87
|
+
mimeType?: string | null | undefined;
|
|
88
|
+
uri?: null | undefined;
|
|
89
89
|
} | {
|
|
90
90
|
uri: string;
|
|
91
|
-
name?: string | undefined;
|
|
92
|
-
bytes?: undefined;
|
|
93
|
-
mimeType?: string | undefined;
|
|
91
|
+
name?: string | null | undefined;
|
|
92
|
+
bytes?: null | undefined;
|
|
93
|
+
mimeType?: string | null | undefined;
|
|
94
94
|
};
|
|
95
95
|
kind: "file";
|
|
96
|
-
metadata?: Record<string, unknown> | undefined;
|
|
96
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
97
97
|
} | {
|
|
98
98
|
text: string;
|
|
99
99
|
kind: "text";
|
|
100
|
-
metadata?: Record<string, unknown> | undefined;
|
|
100
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
101
101
|
} | {
|
|
102
102
|
data: Record<string, unknown>;
|
|
103
103
|
kind: "data";
|
|
104
|
-
metadata?: Record<string, unknown> | undefined;
|
|
104
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
105
105
|
})[];
|
|
106
|
-
name?: string | undefined;
|
|
107
|
-
metadata?: Record<string, unknown> | undefined;
|
|
108
|
-
description?: string | undefined;
|
|
109
|
-
extension?: string[] | undefined;
|
|
110
|
-
}[] | undefined;
|
|
106
|
+
name?: string | null | undefined;
|
|
107
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
108
|
+
description?: string | null | undefined;
|
|
109
|
+
extension?: string[] | null | undefined;
|
|
110
|
+
}[] | null | undefined;
|
|
111
111
|
}>;
|
|
112
112
|
export type GetTaskMethod = typeof getTask;
|
|
@@ -6,7 +6,7 @@ import { createContext } from "../factory/context.js";
|
|
|
6
6
|
export async function sendMessage(input, params) {
|
|
7
7
|
const { service, engine, contextManager, signal } = params;
|
|
8
8
|
const contextId = input.message.contextId;
|
|
9
|
-
const context = createContext(input, service, contextManager, signal, contextId, service.eventOverrides);
|
|
9
|
+
const context = createContext(input, service, contextManager, signal, contextId ?? undefined, service.eventOverrides);
|
|
10
10
|
context.events.on("complete", () => {
|
|
11
11
|
contextManager.deleteContext(context.events.contextId);
|
|
12
12
|
});
|
|
@@ -7,7 +7,7 @@ import { createContext } from "../factory/context.js";
|
|
|
7
7
|
export async function* streamMessage(input, params) {
|
|
8
8
|
const { service, engine, contextManager, signal } = params;
|
|
9
9
|
let contextId = input.message.contextId;
|
|
10
|
-
const context = createContext(input, service, contextManager, signal, contextId, service.eventOverrides);
|
|
10
|
+
const context = createContext(input, service, contextManager, signal, contextId ?? undefined, service.eventOverrides);
|
|
11
11
|
const stream = new StreamManager(context);
|
|
12
12
|
contextId = stream.getContextId();
|
|
13
13
|
context.events.on("complete", () => {
|