@a2a-js/sdk 0.3.10 → 0.3.11
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/{a2a_request_handler-BuP9LgXH.d.ts → a2a_request_handler-BiphzMH4.d.cts} +2 -2
- package/dist/{a2a_request_handler-B3LxMq3P.d.cts → a2a_request_handler-C9bZITjN.d.ts} +2 -2
- package/dist/{chunk-U3QAVT4H.js → chunk-2TNRJNPO.js} +694 -694
- package/dist/client/index.cjs +1327 -1288
- package/dist/client/index.d.cts +7 -3
- package/dist/client/index.d.ts +7 -3
- package/dist/client/index.js +79 -40
- package/dist/client/transports/grpc/index.d.cts +2 -2
- package/dist/client/transports/grpc/index.d.ts +2 -2
- package/dist/client/transports/grpc/index.js +1 -1
- package/dist/{core-BAzQJfA2.d.ts → core-BHroNzI0.d.cts} +2 -2
- package/dist/{core-Ci-lR0jz.d.cts → core-NwQicv77.d.ts} +2 -2
- package/dist/{extensions-DvruCIzw.d.cts → extensions-APfrw8gz.d.cts} +1 -1
- package/dist/{extensions-DvruCIzw.d.ts → extensions-APfrw8gz.d.ts} +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/server/express/index.cjs +2 -2
- package/dist/server/express/index.d.cts +2 -2
- package/dist/server/express/index.d.ts +2 -2
- package/dist/server/express/index.js +3 -3
- package/dist/server/grpc/index.d.cts +2 -2
- package/dist/server/grpc/index.d.ts +2 -2
- package/dist/server/grpc/index.js +1 -1
- package/dist/server/index.cjs +0 -1
- package/dist/server/index.d.cts +3 -4
- package/dist/server/index.d.ts +3 -4
- package/dist/server/index.js +0 -1
- package/package.json +5 -3
|
@@ -1104,552 +1104,638 @@ var generatePushNotificationConfigName = (taskId, configId) => {
|
|
|
1104
1104
|
return `tasks/${taskId}/pushNotificationConfigs/${configId}`;
|
|
1105
1105
|
};
|
|
1106
1106
|
|
|
1107
|
-
// src/types/converters/
|
|
1108
|
-
var
|
|
1109
|
-
static
|
|
1110
|
-
return {
|
|
1111
|
-
protocolVersion: agentCard.protocolVersion,
|
|
1112
|
-
name: agentCard.name,
|
|
1113
|
-
description: agentCard.description,
|
|
1114
|
-
url: agentCard.url,
|
|
1115
|
-
preferredTransport: agentCard.preferredTransport ?? "",
|
|
1116
|
-
additionalInterfaces: agentCard.additionalInterfaces?.map((i) => _ToProto.agentInterface(i)) ?? [],
|
|
1117
|
-
provider: _ToProto.agentProvider(agentCard.provider),
|
|
1118
|
-
version: agentCard.version,
|
|
1119
|
-
documentationUrl: agentCard.documentationUrl ?? "",
|
|
1120
|
-
capabilities: _ToProto.agentCapabilities(agentCard.capabilities),
|
|
1121
|
-
securitySchemes: agentCard.securitySchemes ? Object.fromEntries(
|
|
1122
|
-
Object.entries(agentCard.securitySchemes).map(([key, value]) => [
|
|
1123
|
-
key,
|
|
1124
|
-
_ToProto.securityScheme(value)
|
|
1125
|
-
])
|
|
1126
|
-
) : {},
|
|
1127
|
-
security: agentCard.security?.map((s) => _ToProto.security(s)) ?? [],
|
|
1128
|
-
defaultInputModes: agentCard.defaultInputModes,
|
|
1129
|
-
defaultOutputModes: agentCard.defaultOutputModes,
|
|
1130
|
-
skills: agentCard.skills.map((s) => _ToProto.agentSkill(s)),
|
|
1131
|
-
supportsAuthenticatedExtendedCard: agentCard.supportsAuthenticatedExtendedCard,
|
|
1132
|
-
signatures: agentCard.signatures?.map((s) => _ToProto.agentCardSignature(s)) ?? []
|
|
1133
|
-
};
|
|
1134
|
-
}
|
|
1135
|
-
static agentCardSignature(signatures) {
|
|
1107
|
+
// src/types/converters/from_proto.ts
|
|
1108
|
+
var FromProto = class _FromProto {
|
|
1109
|
+
static taskQueryParams(request) {
|
|
1136
1110
|
return {
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
header: signatures.header
|
|
1111
|
+
id: extractTaskId(request.name),
|
|
1112
|
+
historyLength: request.historyLength
|
|
1140
1113
|
};
|
|
1141
1114
|
}
|
|
1142
|
-
static
|
|
1115
|
+
static taskIdParams(request) {
|
|
1143
1116
|
return {
|
|
1144
|
-
id:
|
|
1145
|
-
name: skill.name,
|
|
1146
|
-
description: skill.description,
|
|
1147
|
-
tags: skill.tags ?? [],
|
|
1148
|
-
examples: skill.examples ?? [],
|
|
1149
|
-
inputModes: skill.inputModes ?? [],
|
|
1150
|
-
outputModes: skill.outputModes ?? [],
|
|
1151
|
-
security: skill.security ? skill.security.map((s) => _ToProto.security(s)) : []
|
|
1117
|
+
id: extractTaskId(request.name)
|
|
1152
1118
|
};
|
|
1153
1119
|
}
|
|
1154
|
-
static
|
|
1120
|
+
static getTaskPushNotificationConfigParams(request) {
|
|
1121
|
+
const { taskId, configId } = extractTaskAndPushNotificationConfigId(request.name);
|
|
1155
1122
|
return {
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
return [key, { list: value }];
|
|
1159
|
-
})
|
|
1160
|
-
)
|
|
1123
|
+
id: taskId,
|
|
1124
|
+
pushNotificationConfigId: configId
|
|
1161
1125
|
};
|
|
1162
1126
|
}
|
|
1163
|
-
static
|
|
1164
|
-
switch (scheme.type) {
|
|
1165
|
-
case "apiKey":
|
|
1166
|
-
return {
|
|
1167
|
-
scheme: {
|
|
1168
|
-
$case: "apiKeySecurityScheme",
|
|
1169
|
-
value: {
|
|
1170
|
-
name: scheme.name,
|
|
1171
|
-
location: scheme.in,
|
|
1172
|
-
description: scheme.description ?? ""
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
};
|
|
1176
|
-
case "http":
|
|
1177
|
-
return {
|
|
1178
|
-
scheme: {
|
|
1179
|
-
$case: "httpAuthSecurityScheme",
|
|
1180
|
-
value: {
|
|
1181
|
-
description: scheme.description ?? "",
|
|
1182
|
-
scheme: scheme.scheme,
|
|
1183
|
-
bearerFormat: scheme.bearerFormat ?? ""
|
|
1184
|
-
}
|
|
1185
|
-
}
|
|
1186
|
-
};
|
|
1187
|
-
case "mutualTLS":
|
|
1188
|
-
return {
|
|
1189
|
-
scheme: {
|
|
1190
|
-
$case: "mtlsSecurityScheme",
|
|
1191
|
-
value: {
|
|
1192
|
-
description: scheme.description ?? ""
|
|
1193
|
-
}
|
|
1194
|
-
}
|
|
1195
|
-
};
|
|
1196
|
-
case "oauth2":
|
|
1197
|
-
return {
|
|
1198
|
-
scheme: {
|
|
1199
|
-
$case: "oauth2SecurityScheme",
|
|
1200
|
-
value: {
|
|
1201
|
-
description: scheme.description ?? "",
|
|
1202
|
-
flows: _ToProto.oauthFlows(scheme.flows),
|
|
1203
|
-
oauth2MetadataUrl: scheme.oauth2MetadataUrl ?? ""
|
|
1204
|
-
}
|
|
1205
|
-
}
|
|
1206
|
-
};
|
|
1207
|
-
case "openIdConnect":
|
|
1208
|
-
return {
|
|
1209
|
-
scheme: {
|
|
1210
|
-
$case: "openIdConnectSecurityScheme",
|
|
1211
|
-
value: {
|
|
1212
|
-
description: scheme.description ?? "",
|
|
1213
|
-
openIdConnectUrl: scheme.openIdConnectUrl
|
|
1214
|
-
}
|
|
1215
|
-
}
|
|
1216
|
-
};
|
|
1217
|
-
default:
|
|
1218
|
-
throw A2AError.internalError(`Unsupported security scheme type`);
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
static oauthFlows(flows) {
|
|
1222
|
-
if (flows.implicit) {
|
|
1223
|
-
return {
|
|
1224
|
-
flow: {
|
|
1225
|
-
$case: "implicit",
|
|
1226
|
-
value: {
|
|
1227
|
-
authorizationUrl: flows.implicit.authorizationUrl,
|
|
1228
|
-
scopes: flows.implicit.scopes,
|
|
1229
|
-
refreshUrl: flows.implicit.refreshUrl ?? ""
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
};
|
|
1233
|
-
} else if (flows.password) {
|
|
1234
|
-
return {
|
|
1235
|
-
flow: {
|
|
1236
|
-
$case: "password",
|
|
1237
|
-
value: {
|
|
1238
|
-
tokenUrl: flows.password.tokenUrl,
|
|
1239
|
-
scopes: flows.password.scopes,
|
|
1240
|
-
refreshUrl: flows.password.refreshUrl ?? ""
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
|
-
};
|
|
1244
|
-
} else if (flows.clientCredentials) {
|
|
1245
|
-
return {
|
|
1246
|
-
flow: {
|
|
1247
|
-
$case: "clientCredentials",
|
|
1248
|
-
value: {
|
|
1249
|
-
tokenUrl: flows.clientCredentials.tokenUrl,
|
|
1250
|
-
scopes: flows.clientCredentials.scopes,
|
|
1251
|
-
refreshUrl: flows.clientCredentials.refreshUrl ?? ""
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
};
|
|
1255
|
-
} else if (flows.authorizationCode) {
|
|
1256
|
-
return {
|
|
1257
|
-
flow: {
|
|
1258
|
-
$case: "authorizationCode",
|
|
1259
|
-
value: {
|
|
1260
|
-
authorizationUrl: flows.authorizationCode.authorizationUrl,
|
|
1261
|
-
tokenUrl: flows.authorizationCode.tokenUrl,
|
|
1262
|
-
scopes: flows.authorizationCode.scopes,
|
|
1263
|
-
refreshUrl: flows.authorizationCode.refreshUrl ?? ""
|
|
1264
|
-
}
|
|
1265
|
-
}
|
|
1266
|
-
};
|
|
1267
|
-
} else {
|
|
1268
|
-
throw A2AError.internalError(`Unsupported OAuth flows`);
|
|
1269
|
-
}
|
|
1270
|
-
}
|
|
1271
|
-
static agentInterface(agentInterface) {
|
|
1127
|
+
static listTaskPushNotificationConfigParams(request) {
|
|
1272
1128
|
return {
|
|
1273
|
-
|
|
1274
|
-
url: agentInterface.url
|
|
1129
|
+
id: extractTaskId(request.parent)
|
|
1275
1130
|
};
|
|
1276
1131
|
}
|
|
1277
|
-
static
|
|
1278
|
-
if (!
|
|
1279
|
-
|
|
1132
|
+
static createTaskPushNotificationConfig(request) {
|
|
1133
|
+
if (!request.config?.pushNotificationConfig) {
|
|
1134
|
+
throw A2AError.invalidParams(
|
|
1135
|
+
"Request must include a `config` object with a `pushNotificationConfig`"
|
|
1136
|
+
);
|
|
1280
1137
|
}
|
|
1281
1138
|
return {
|
|
1282
|
-
|
|
1283
|
-
|
|
1139
|
+
taskId: extractTaskId(request.parent),
|
|
1140
|
+
pushNotificationConfig: _FromProto.pushNotificationConfig(
|
|
1141
|
+
request.config.pushNotificationConfig
|
|
1142
|
+
)
|
|
1284
1143
|
};
|
|
1285
1144
|
}
|
|
1286
|
-
static
|
|
1145
|
+
static deleteTaskPushNotificationConfigParams(request) {
|
|
1146
|
+
const { taskId, configId } = extractTaskAndPushNotificationConfigId(request.name);
|
|
1287
1147
|
return {
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
extensions: capabilities.extensions ? capabilities.extensions.map((e) => _ToProto.agentExtension(e)) : []
|
|
1148
|
+
id: taskId,
|
|
1149
|
+
pushNotificationConfigId: configId
|
|
1291
1150
|
};
|
|
1292
1151
|
}
|
|
1293
|
-
static
|
|
1152
|
+
static message(message) {
|
|
1153
|
+
if (!message) {
|
|
1154
|
+
return void 0;
|
|
1155
|
+
}
|
|
1294
1156
|
return {
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1157
|
+
kind: "message",
|
|
1158
|
+
messageId: message.messageId,
|
|
1159
|
+
parts: message.content.map((p) => _FromProto.part(p)),
|
|
1160
|
+
contextId: message.contextId || void 0,
|
|
1161
|
+
taskId: message.taskId || void 0,
|
|
1162
|
+
role: _FromProto.role(message.role),
|
|
1163
|
+
metadata: message.metadata,
|
|
1164
|
+
extensions: message.extensions
|
|
1299
1165
|
};
|
|
1300
1166
|
}
|
|
1301
|
-
static
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1167
|
+
static role(role) {
|
|
1168
|
+
switch (role) {
|
|
1169
|
+
case 2 /* ROLE_AGENT */:
|
|
1170
|
+
return "agent";
|
|
1171
|
+
case 1 /* ROLE_USER */:
|
|
1172
|
+
return "user";
|
|
1173
|
+
default:
|
|
1174
|
+
throw A2AError.invalidParams(`Invalid role: ${role}`);
|
|
1175
|
+
}
|
|
1306
1176
|
}
|
|
1307
|
-
static
|
|
1177
|
+
static messageSendConfiguration(configuration) {
|
|
1178
|
+
if (!configuration) {
|
|
1179
|
+
return void 0;
|
|
1180
|
+
}
|
|
1308
1181
|
return {
|
|
1309
|
-
|
|
1182
|
+
blocking: configuration.blocking,
|
|
1183
|
+
acceptedOutputModes: configuration.acceptedOutputModes,
|
|
1184
|
+
pushNotificationConfig: _FromProto.pushNotificationConfig(configuration.pushNotification)
|
|
1310
1185
|
};
|
|
1311
1186
|
}
|
|
1312
|
-
static
|
|
1187
|
+
static pushNotificationConfig(config) {
|
|
1188
|
+
if (!config) {
|
|
1189
|
+
return void 0;
|
|
1190
|
+
}
|
|
1313
1191
|
return {
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1192
|
+
id: config.id,
|
|
1193
|
+
url: config.url,
|
|
1194
|
+
token: config.token || void 0,
|
|
1195
|
+
authentication: _FromProto.pushNotificationAuthenticationInfo(config.authentication)
|
|
1317
1196
|
};
|
|
1318
1197
|
}
|
|
1319
|
-
static
|
|
1198
|
+
static pushNotificationAuthenticationInfo(authInfo) {
|
|
1199
|
+
if (!authInfo) {
|
|
1200
|
+
return void 0;
|
|
1201
|
+
}
|
|
1320
1202
|
return {
|
|
1321
|
-
|
|
1203
|
+
schemes: authInfo.schemes,
|
|
1204
|
+
credentials: authInfo.credentials
|
|
1322
1205
|
};
|
|
1323
1206
|
}
|
|
1324
|
-
static
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1207
|
+
static part(part) {
|
|
1208
|
+
if (part.part?.$case === "text") {
|
|
1209
|
+
return {
|
|
1210
|
+
kind: "text",
|
|
1211
|
+
text: part.part.value
|
|
1212
|
+
};
|
|
1213
|
+
}
|
|
1214
|
+
if (part.part?.$case === "file") {
|
|
1215
|
+
const filePart = part.part.value;
|
|
1216
|
+
if (filePart.file?.$case === "fileWithUri") {
|
|
1217
|
+
return {
|
|
1218
|
+
kind: "file",
|
|
1219
|
+
file: {
|
|
1220
|
+
uri: filePart.file.value,
|
|
1221
|
+
mimeType: filePart.mimeType
|
|
1222
|
+
}
|
|
1223
|
+
};
|
|
1224
|
+
} else if (filePart.file?.$case === "fileWithBytes") {
|
|
1225
|
+
return {
|
|
1226
|
+
kind: "file",
|
|
1227
|
+
file: {
|
|
1228
|
+
bytes: filePart.file.value.toString("base64"),
|
|
1229
|
+
mimeType: filePart.mimeType
|
|
1230
|
+
}
|
|
1231
|
+
};
|
|
1232
|
+
}
|
|
1233
|
+
throw A2AError.invalidParams("Invalid file part type");
|
|
1234
|
+
}
|
|
1235
|
+
if (part.part?.$case === "data") {
|
|
1236
|
+
return {
|
|
1237
|
+
kind: "data",
|
|
1238
|
+
data: part.part.value.data
|
|
1239
|
+
};
|
|
1240
|
+
}
|
|
1241
|
+
throw A2AError.invalidParams("Invalid part type");
|
|
1332
1242
|
}
|
|
1333
|
-
static
|
|
1243
|
+
static messageSendParams(request) {
|
|
1334
1244
|
return {
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1245
|
+
message: _FromProto.message(request.request),
|
|
1246
|
+
configuration: _FromProto.messageSendConfiguration(request.configuration),
|
|
1247
|
+
metadata: request.metadata
|
|
1338
1248
|
};
|
|
1339
1249
|
}
|
|
1340
|
-
static
|
|
1341
|
-
if (
|
|
1342
|
-
return
|
|
1250
|
+
static sendMessageResult(response) {
|
|
1251
|
+
if (response.payload?.$case === "task") {
|
|
1252
|
+
return _FromProto.task(response.payload.value);
|
|
1253
|
+
} else if (response.payload?.$case === "msg") {
|
|
1254
|
+
return _FromProto.message(response.payload.value);
|
|
1343
1255
|
}
|
|
1256
|
+
throw A2AError.invalidParams("Invalid SendMessageResponse: missing result");
|
|
1257
|
+
}
|
|
1258
|
+
static task(task) {
|
|
1344
1259
|
return {
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1260
|
+
kind: "task",
|
|
1261
|
+
id: task.id,
|
|
1262
|
+
status: _FromProto.taskStatus(task.status),
|
|
1263
|
+
contextId: task.contextId,
|
|
1264
|
+
artifacts: task.artifacts?.map((a) => _FromProto.artifact(a)),
|
|
1265
|
+
history: task.history?.map((h) => _FromProto.message(h)),
|
|
1266
|
+
metadata: task.metadata
|
|
1349
1267
|
};
|
|
1350
1268
|
}
|
|
1351
|
-
static
|
|
1352
|
-
if (!authInfo) {
|
|
1353
|
-
return void 0;
|
|
1354
|
-
}
|
|
1269
|
+
static taskStatus(status) {
|
|
1355
1270
|
return {
|
|
1356
|
-
|
|
1357
|
-
|
|
1271
|
+
message: _FromProto.message(status.update),
|
|
1272
|
+
state: _FromProto.taskState(status.state),
|
|
1273
|
+
timestamp: status.timestamp
|
|
1358
1274
|
};
|
|
1359
1275
|
}
|
|
1360
|
-
static
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
} else if (event.kind === "artifact-update") {
|
|
1383
|
-
return {
|
|
1384
|
-
payload: {
|
|
1385
|
-
$case: "artifactUpdate",
|
|
1386
|
-
value: _ToProto.taskArtifactUpdateEvent(event)
|
|
1387
|
-
}
|
|
1388
|
-
};
|
|
1389
|
-
} else {
|
|
1390
|
-
throw A2AError.internalError("Invalid event type");
|
|
1276
|
+
static taskState(state) {
|
|
1277
|
+
switch (state) {
|
|
1278
|
+
case 1 /* TASK_STATE_SUBMITTED */:
|
|
1279
|
+
return "submitted";
|
|
1280
|
+
case 2 /* TASK_STATE_WORKING */:
|
|
1281
|
+
return "working";
|
|
1282
|
+
case 6 /* TASK_STATE_INPUT_REQUIRED */:
|
|
1283
|
+
return "input-required";
|
|
1284
|
+
case 3 /* TASK_STATE_COMPLETED */:
|
|
1285
|
+
return "completed";
|
|
1286
|
+
case 5 /* TASK_STATE_CANCELLED */:
|
|
1287
|
+
return "canceled";
|
|
1288
|
+
case 4 /* TASK_STATE_FAILED */:
|
|
1289
|
+
return "failed";
|
|
1290
|
+
case 7 /* TASK_STATE_REJECTED */:
|
|
1291
|
+
return "rejected";
|
|
1292
|
+
case 8 /* TASK_STATE_AUTH_REQUIRED */:
|
|
1293
|
+
return "auth-required";
|
|
1294
|
+
case 0 /* TASK_STATE_UNSPECIFIED */:
|
|
1295
|
+
return "unknown";
|
|
1296
|
+
default:
|
|
1297
|
+
throw A2AError.invalidParams(`Invalid task state: ${state}`);
|
|
1391
1298
|
}
|
|
1392
1299
|
}
|
|
1393
|
-
static
|
|
1300
|
+
static artifact(artifact) {
|
|
1394
1301
|
return {
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1302
|
+
artifactId: artifact.artifactId,
|
|
1303
|
+
name: artifact.name || void 0,
|
|
1304
|
+
description: artifact.description || void 0,
|
|
1305
|
+
parts: artifact.parts.map((p) => _FromProto.part(p)),
|
|
1306
|
+
metadata: artifact.metadata
|
|
1400
1307
|
};
|
|
1401
1308
|
}
|
|
1402
|
-
static
|
|
1309
|
+
static taskPushNotificationConfig(request) {
|
|
1403
1310
|
return {
|
|
1404
|
-
taskId:
|
|
1405
|
-
|
|
1406
|
-
contextId: event.contextId,
|
|
1407
|
-
metadata: event.metadata,
|
|
1408
|
-
append: event.append,
|
|
1409
|
-
lastChunk: event.lastChunk
|
|
1311
|
+
taskId: extractTaskId(request.name),
|
|
1312
|
+
pushNotificationConfig: _FromProto.pushNotificationConfig(request.pushNotificationConfig)
|
|
1410
1313
|
};
|
|
1411
1314
|
}
|
|
1412
|
-
static
|
|
1413
|
-
|
|
1414
|
-
return {
|
|
1415
|
-
payload: {
|
|
1416
|
-
$case: "msg",
|
|
1417
|
-
value: _ToProto.message(params)
|
|
1418
|
-
}
|
|
1419
|
-
};
|
|
1420
|
-
} else if (params.kind === "task") {
|
|
1421
|
-
return {
|
|
1422
|
-
payload: {
|
|
1423
|
-
$case: "task",
|
|
1424
|
-
value: _ToProto.task(params)
|
|
1425
|
-
}
|
|
1426
|
-
};
|
|
1427
|
-
}
|
|
1315
|
+
static listTaskPushNotificationConfig(request) {
|
|
1316
|
+
return request.configs.map((c) => _FromProto.taskPushNotificationConfig(c));
|
|
1428
1317
|
}
|
|
1429
|
-
static
|
|
1430
|
-
if (!message) {
|
|
1431
|
-
return void 0;
|
|
1432
|
-
}
|
|
1318
|
+
static agentCard(agentCard) {
|
|
1433
1319
|
return {
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1320
|
+
additionalInterfaces: agentCard.additionalInterfaces?.map((i) => _FromProto.agentInterface(i)),
|
|
1321
|
+
capabilities: agentCard.capabilities ? _FromProto.agentCapabilities(agentCard.capabilities) : {},
|
|
1322
|
+
defaultInputModes: agentCard.defaultInputModes,
|
|
1323
|
+
defaultOutputModes: agentCard.defaultOutputModes,
|
|
1324
|
+
description: agentCard.description,
|
|
1325
|
+
documentationUrl: agentCard.documentationUrl || void 0,
|
|
1326
|
+
name: agentCard.name,
|
|
1327
|
+
preferredTransport: agentCard.preferredTransport,
|
|
1328
|
+
provider: agentCard.provider ? _FromProto.agentProvider(agentCard.provider) : void 0,
|
|
1329
|
+
protocolVersion: agentCard.protocolVersion,
|
|
1330
|
+
security: agentCard.security?.map((s) => _FromProto.security(s)),
|
|
1331
|
+
securitySchemes: agentCard.securitySchemes ? Object.fromEntries(
|
|
1332
|
+
Object.entries(agentCard.securitySchemes).map(([key, value]) => [
|
|
1333
|
+
key,
|
|
1334
|
+
_FromProto.securityScheme(value)
|
|
1335
|
+
])
|
|
1336
|
+
) : {},
|
|
1337
|
+
skills: agentCard.skills.map((s) => _FromProto.skills(s)),
|
|
1338
|
+
signatures: agentCard.signatures?.map((s) => _FromProto.agentCardSignature(s)),
|
|
1339
|
+
supportsAuthenticatedExtendedCard: agentCard.supportsAuthenticatedExtendedCard,
|
|
1340
|
+
url: agentCard.url,
|
|
1341
|
+
version: agentCard.version
|
|
1441
1342
|
};
|
|
1442
1343
|
}
|
|
1443
|
-
static
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
default:
|
|
1450
|
-
throw A2AError.internalError(`Invalid role`);
|
|
1451
|
-
}
|
|
1344
|
+
static agentCapabilities(capabilities) {
|
|
1345
|
+
return {
|
|
1346
|
+
extensions: capabilities.extensions?.map((e) => _FromProto.agentExtension(e)),
|
|
1347
|
+
pushNotifications: capabilities.pushNotifications,
|
|
1348
|
+
streaming: capabilities.streaming
|
|
1349
|
+
};
|
|
1452
1350
|
}
|
|
1453
|
-
static
|
|
1351
|
+
static agentExtension(extension) {
|
|
1454
1352
|
return {
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
history: task.history?.map((m) => _ToProto.message(m)) ?? [],
|
|
1460
|
-
metadata: task.metadata
|
|
1353
|
+
uri: extension.uri,
|
|
1354
|
+
description: extension.description || void 0,
|
|
1355
|
+
required: extension.required,
|
|
1356
|
+
params: extension.params
|
|
1461
1357
|
};
|
|
1462
1358
|
}
|
|
1463
|
-
static
|
|
1359
|
+
static agentInterface(intf) {
|
|
1464
1360
|
return {
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
timestamp: status.timestamp
|
|
1361
|
+
transport: intf.transport,
|
|
1362
|
+
url: intf.url
|
|
1468
1363
|
};
|
|
1469
1364
|
}
|
|
1470
|
-
static
|
|
1365
|
+
static agentProvider(provider) {
|
|
1471
1366
|
return {
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
description: artifact.description ?? "",
|
|
1475
|
-
parts: artifact.parts.map((p) => _ToProto.part(p)),
|
|
1476
|
-
metadata: artifact.metadata,
|
|
1477
|
-
extensions: artifact.extensions ? artifact.extensions : []
|
|
1367
|
+
organization: provider.organization,
|
|
1368
|
+
url: provider.url
|
|
1478
1369
|
};
|
|
1479
1370
|
}
|
|
1480
|
-
static
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
case "
|
|
1495
|
-
return
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1371
|
+
static security(security) {
|
|
1372
|
+
return Object.fromEntries(
|
|
1373
|
+
Object.entries(security.schemes)?.map(([key, value]) => [key, value.list])
|
|
1374
|
+
);
|
|
1375
|
+
}
|
|
1376
|
+
static securityScheme(securitySchemes) {
|
|
1377
|
+
switch (securitySchemes.scheme?.$case) {
|
|
1378
|
+
case "apiKeySecurityScheme":
|
|
1379
|
+
return {
|
|
1380
|
+
type: "apiKey",
|
|
1381
|
+
name: securitySchemes.scheme.value.name,
|
|
1382
|
+
in: securitySchemes.scheme.value.location,
|
|
1383
|
+
description: securitySchemes.scheme.value.description || void 0
|
|
1384
|
+
};
|
|
1385
|
+
case "httpAuthSecurityScheme":
|
|
1386
|
+
return {
|
|
1387
|
+
type: "http",
|
|
1388
|
+
scheme: securitySchemes.scheme.value.scheme,
|
|
1389
|
+
bearerFormat: securitySchemes.scheme.value.bearerFormat || void 0,
|
|
1390
|
+
description: securitySchemes.scheme.value.description || void 0
|
|
1391
|
+
};
|
|
1392
|
+
case "mtlsSecurityScheme":
|
|
1393
|
+
return {
|
|
1394
|
+
type: "mutualTLS",
|
|
1395
|
+
description: securitySchemes.scheme.value.description || void 0
|
|
1396
|
+
};
|
|
1397
|
+
case "oauth2SecurityScheme":
|
|
1398
|
+
return {
|
|
1399
|
+
type: "oauth2",
|
|
1400
|
+
description: securitySchemes.scheme.value.description || void 0,
|
|
1401
|
+
flows: _FromProto.oauthFlows(securitySchemes.scheme.value.flows),
|
|
1402
|
+
oauth2MetadataUrl: securitySchemes.scheme.value.oauth2MetadataUrl || void 0
|
|
1403
|
+
};
|
|
1404
|
+
case "openIdConnectSecurityScheme":
|
|
1405
|
+
return {
|
|
1406
|
+
type: "openIdConnect",
|
|
1407
|
+
description: securitySchemes.scheme.value.description || void 0,
|
|
1408
|
+
openIdConnectUrl: securitySchemes.scheme.value.openIdConnectUrl
|
|
1409
|
+
};
|
|
1500
1410
|
default:
|
|
1501
|
-
|
|
1411
|
+
throw A2AError.internalError(`Unsupported security scheme type`);
|
|
1502
1412
|
}
|
|
1503
1413
|
}
|
|
1504
|
-
static
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
filePart = {
|
|
1514
|
-
file: { $case: "fileWithUri", value: part.file.uri },
|
|
1515
|
-
mimeType: part.file.mimeType
|
|
1414
|
+
static oauthFlows(flows) {
|
|
1415
|
+
switch (flows.flow?.$case) {
|
|
1416
|
+
case "implicit":
|
|
1417
|
+
return {
|
|
1418
|
+
implicit: {
|
|
1419
|
+
authorizationUrl: flows.flow.value.authorizationUrl,
|
|
1420
|
+
scopes: flows.flow.value.scopes,
|
|
1421
|
+
refreshUrl: flows.flow.value.refreshUrl || void 0
|
|
1422
|
+
}
|
|
1516
1423
|
};
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1424
|
+
case "password":
|
|
1425
|
+
return {
|
|
1426
|
+
password: {
|
|
1427
|
+
refreshUrl: flows.flow.value.refreshUrl || void 0,
|
|
1428
|
+
scopes: flows.flow.value.scopes,
|
|
1429
|
+
tokenUrl: flows.flow.value.tokenUrl
|
|
1430
|
+
}
|
|
1521
1431
|
};
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1432
|
+
case "authorizationCode":
|
|
1433
|
+
return {
|
|
1434
|
+
authorizationCode: {
|
|
1435
|
+
refreshUrl: flows.flow.value.refreshUrl || void 0,
|
|
1436
|
+
authorizationUrl: flows.flow.value.authorizationUrl,
|
|
1437
|
+
scopes: flows.flow.value.scopes,
|
|
1438
|
+
tokenUrl: flows.flow.value.tokenUrl
|
|
1439
|
+
}
|
|
1440
|
+
};
|
|
1441
|
+
case "clientCredentials":
|
|
1442
|
+
return {
|
|
1443
|
+
clientCredentials: {
|
|
1444
|
+
refreshUrl: flows.flow.value.refreshUrl || void 0,
|
|
1445
|
+
scopes: flows.flow.value.scopes,
|
|
1446
|
+
tokenUrl: flows.flow.value.tokenUrl
|
|
1447
|
+
}
|
|
1448
|
+
};
|
|
1449
|
+
default:
|
|
1450
|
+
throw A2AError.internalError(`Unsupported OAuth flows`);
|
|
1533
1451
|
}
|
|
1534
|
-
throw A2AError.internalError("Invalid part type");
|
|
1535
1452
|
}
|
|
1536
|
-
static
|
|
1453
|
+
static skills(skill) {
|
|
1537
1454
|
return {
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1455
|
+
id: skill.id,
|
|
1456
|
+
name: skill.name,
|
|
1457
|
+
description: skill.description,
|
|
1458
|
+
tags: skill.tags,
|
|
1459
|
+
examples: skill.examples,
|
|
1460
|
+
inputModes: skill.inputModes,
|
|
1461
|
+
outputModes: skill.outputModes,
|
|
1462
|
+
security: skill.security?.map((s) => _FromProto.security(s))
|
|
1541
1463
|
};
|
|
1542
1464
|
}
|
|
1543
|
-
static
|
|
1544
|
-
|
|
1545
|
-
|
|
1465
|
+
static agentCardSignature(signatures) {
|
|
1466
|
+
return {
|
|
1467
|
+
protected: signatures.protected,
|
|
1468
|
+
signature: signatures.signature,
|
|
1469
|
+
header: signatures.header
|
|
1470
|
+
};
|
|
1471
|
+
}
|
|
1472
|
+
static taskStatusUpdateEvent(event) {
|
|
1473
|
+
return {
|
|
1474
|
+
kind: "status-update",
|
|
1475
|
+
taskId: event.taskId,
|
|
1476
|
+
status: _FromProto.taskStatus(event.status),
|
|
1477
|
+
contextId: event.contextId,
|
|
1478
|
+
metadata: event.metadata,
|
|
1479
|
+
final: event.final
|
|
1480
|
+
};
|
|
1481
|
+
}
|
|
1482
|
+
static taskArtifactUpdateEvent(event) {
|
|
1483
|
+
return {
|
|
1484
|
+
kind: "artifact-update",
|
|
1485
|
+
taskId: event.taskId,
|
|
1486
|
+
artifact: _FromProto.artifact(event.artifact),
|
|
1487
|
+
contextId: event.contextId,
|
|
1488
|
+
metadata: event.metadata,
|
|
1489
|
+
lastChunk: event.lastChunk
|
|
1490
|
+
};
|
|
1491
|
+
}
|
|
1492
|
+
static messageStreamResult(event) {
|
|
1493
|
+
switch (event.payload?.$case) {
|
|
1494
|
+
case "msg":
|
|
1495
|
+
return _FromProto.message(event.payload.value);
|
|
1496
|
+
case "task":
|
|
1497
|
+
return _FromProto.task(event.payload.value);
|
|
1498
|
+
case "statusUpdate":
|
|
1499
|
+
return _FromProto.taskStatusUpdateEvent(event.payload.value);
|
|
1500
|
+
case "artifactUpdate":
|
|
1501
|
+
return _FromProto.taskArtifactUpdateEvent(event.payload.value);
|
|
1502
|
+
default:
|
|
1503
|
+
throw A2AError.internalError("Invalid event type in StreamResponse");
|
|
1546
1504
|
}
|
|
1505
|
+
}
|
|
1506
|
+
};
|
|
1507
|
+
|
|
1508
|
+
// src/types/converters/to_proto.ts
|
|
1509
|
+
var ToProto = class _ToProto {
|
|
1510
|
+
static agentCard(agentCard) {
|
|
1547
1511
|
return {
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1512
|
+
protocolVersion: agentCard.protocolVersion,
|
|
1513
|
+
name: agentCard.name,
|
|
1514
|
+
description: agentCard.description,
|
|
1515
|
+
url: agentCard.url,
|
|
1516
|
+
preferredTransport: agentCard.preferredTransport ?? "",
|
|
1517
|
+
additionalInterfaces: agentCard.additionalInterfaces?.map((i) => _ToProto.agentInterface(i)) ?? [],
|
|
1518
|
+
provider: _ToProto.agentProvider(agentCard.provider),
|
|
1519
|
+
version: agentCard.version,
|
|
1520
|
+
documentationUrl: agentCard.documentationUrl ?? "",
|
|
1521
|
+
capabilities: _ToProto.agentCapabilities(agentCard.capabilities),
|
|
1522
|
+
securitySchemes: agentCard.securitySchemes ? Object.fromEntries(
|
|
1523
|
+
Object.entries(agentCard.securitySchemes).map(([key, value]) => [
|
|
1524
|
+
key,
|
|
1525
|
+
_ToProto.securityScheme(value)
|
|
1526
|
+
])
|
|
1527
|
+
) : {},
|
|
1528
|
+
security: agentCard.security?.map((s) => _ToProto.security(s)) ?? [],
|
|
1529
|
+
defaultInputModes: agentCard.defaultInputModes,
|
|
1530
|
+
defaultOutputModes: agentCard.defaultOutputModes,
|
|
1531
|
+
skills: agentCard.skills.map((s) => _ToProto.agentSkill(s)),
|
|
1532
|
+
supportsAuthenticatedExtendedCard: agentCard.supportsAuthenticatedExtendedCard,
|
|
1533
|
+
signatures: agentCard.signatures?.map((s) => _ToProto.agentCardSignature(s)) ?? []
|
|
1552
1534
|
};
|
|
1553
1535
|
}
|
|
1554
|
-
static
|
|
1536
|
+
static agentCardSignature(signatures) {
|
|
1555
1537
|
return {
|
|
1556
|
-
|
|
1557
|
-
|
|
1538
|
+
protected: signatures.protected,
|
|
1539
|
+
signature: signatures.signature,
|
|
1540
|
+
header: signatures.header
|
|
1558
1541
|
};
|
|
1559
1542
|
}
|
|
1560
|
-
static
|
|
1543
|
+
static agentSkill(skill) {
|
|
1561
1544
|
return {
|
|
1562
|
-
|
|
1545
|
+
id: skill.id,
|
|
1546
|
+
name: skill.name,
|
|
1547
|
+
description: skill.description,
|
|
1548
|
+
tags: skill.tags ?? [],
|
|
1549
|
+
examples: skill.examples ?? [],
|
|
1550
|
+
inputModes: skill.inputModes ?? [],
|
|
1551
|
+
outputModes: skill.outputModes ?? [],
|
|
1552
|
+
security: skill.security ? skill.security.map((s) => _ToProto.security(s)) : []
|
|
1563
1553
|
};
|
|
1564
1554
|
}
|
|
1565
|
-
static
|
|
1555
|
+
static security(security) {
|
|
1566
1556
|
return {
|
|
1567
|
-
|
|
1557
|
+
schemes: Object.fromEntries(
|
|
1558
|
+
Object.entries(security).map(([key, value]) => {
|
|
1559
|
+
return [key, { list: value }];
|
|
1560
|
+
})
|
|
1561
|
+
)
|
|
1568
1562
|
};
|
|
1569
1563
|
}
|
|
1570
|
-
static
|
|
1571
|
-
|
|
1564
|
+
static securityScheme(scheme) {
|
|
1565
|
+
switch (scheme.type) {
|
|
1566
|
+
case "apiKey":
|
|
1567
|
+
return {
|
|
1568
|
+
scheme: {
|
|
1569
|
+
$case: "apiKeySecurityScheme",
|
|
1570
|
+
value: {
|
|
1571
|
+
name: scheme.name,
|
|
1572
|
+
location: scheme.in,
|
|
1573
|
+
description: scheme.description ?? ""
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
};
|
|
1577
|
+
case "http":
|
|
1578
|
+
return {
|
|
1579
|
+
scheme: {
|
|
1580
|
+
$case: "httpAuthSecurityScheme",
|
|
1581
|
+
value: {
|
|
1582
|
+
description: scheme.description ?? "",
|
|
1583
|
+
scheme: scheme.scheme,
|
|
1584
|
+
bearerFormat: scheme.bearerFormat ?? ""
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
};
|
|
1588
|
+
case "mutualTLS":
|
|
1589
|
+
return {
|
|
1590
|
+
scheme: {
|
|
1591
|
+
$case: "mtlsSecurityScheme",
|
|
1592
|
+
value: {
|
|
1593
|
+
description: scheme.description ?? ""
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
};
|
|
1597
|
+
case "oauth2":
|
|
1598
|
+
return {
|
|
1599
|
+
scheme: {
|
|
1600
|
+
$case: "oauth2SecurityScheme",
|
|
1601
|
+
value: {
|
|
1602
|
+
description: scheme.description ?? "",
|
|
1603
|
+
flows: _ToProto.oauthFlows(scheme.flows),
|
|
1604
|
+
oauth2MetadataUrl: scheme.oauth2MetadataUrl ?? ""
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
};
|
|
1608
|
+
case "openIdConnect":
|
|
1609
|
+
return {
|
|
1610
|
+
scheme: {
|
|
1611
|
+
$case: "openIdConnectSecurityScheme",
|
|
1612
|
+
value: {
|
|
1613
|
+
description: scheme.description ?? "",
|
|
1614
|
+
openIdConnectUrl: scheme.openIdConnectUrl
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
};
|
|
1618
|
+
default:
|
|
1619
|
+
throw A2AError.internalError(`Unsupported security scheme type`);
|
|
1620
|
+
}
|
|
1572
1621
|
}
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1622
|
+
static oauthFlows(flows) {
|
|
1623
|
+
if (flows.implicit) {
|
|
1624
|
+
return {
|
|
1625
|
+
flow: {
|
|
1626
|
+
$case: "implicit",
|
|
1627
|
+
value: {
|
|
1628
|
+
authorizationUrl: flows.implicit.authorizationUrl,
|
|
1629
|
+
scopes: flows.implicit.scopes,
|
|
1630
|
+
refreshUrl: flows.implicit.refreshUrl ?? ""
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
};
|
|
1634
|
+
} else if (flows.password) {
|
|
1635
|
+
return {
|
|
1636
|
+
flow: {
|
|
1637
|
+
$case: "password",
|
|
1638
|
+
value: {
|
|
1639
|
+
tokenUrl: flows.password.tokenUrl,
|
|
1640
|
+
scopes: flows.password.scopes,
|
|
1641
|
+
refreshUrl: flows.password.refreshUrl ?? ""
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
};
|
|
1645
|
+
} else if (flows.clientCredentials) {
|
|
1646
|
+
return {
|
|
1647
|
+
flow: {
|
|
1648
|
+
$case: "clientCredentials",
|
|
1649
|
+
value: {
|
|
1650
|
+
tokenUrl: flows.clientCredentials.tokenUrl,
|
|
1651
|
+
scopes: flows.clientCredentials.scopes,
|
|
1652
|
+
refreshUrl: flows.clientCredentials.refreshUrl ?? ""
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
};
|
|
1656
|
+
} else if (flows.authorizationCode) {
|
|
1657
|
+
return {
|
|
1658
|
+
flow: {
|
|
1659
|
+
$case: "authorizationCode",
|
|
1660
|
+
value: {
|
|
1661
|
+
authorizationUrl: flows.authorizationCode.authorizationUrl,
|
|
1662
|
+
tokenUrl: flows.authorizationCode.tokenUrl,
|
|
1663
|
+
scopes: flows.authorizationCode.scopes,
|
|
1664
|
+
refreshUrl: flows.authorizationCode.refreshUrl ?? ""
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
};
|
|
1668
|
+
} else {
|
|
1669
|
+
throw A2AError.internalError(`Unsupported OAuth flows`);
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
static agentInterface(agentInterface) {
|
|
1578
1673
|
return {
|
|
1579
|
-
|
|
1580
|
-
|
|
1674
|
+
transport: agentInterface.transport,
|
|
1675
|
+
url: agentInterface.url
|
|
1676
|
+
};
|
|
1677
|
+
}
|
|
1678
|
+
static agentProvider(agentProvider) {
|
|
1679
|
+
if (!agentProvider) {
|
|
1680
|
+
return void 0;
|
|
1681
|
+
}
|
|
1682
|
+
return {
|
|
1683
|
+
url: agentProvider.url,
|
|
1684
|
+
organization: agentProvider.organization
|
|
1581
1685
|
};
|
|
1582
1686
|
}
|
|
1583
|
-
static
|
|
1687
|
+
static agentCapabilities(capabilities) {
|
|
1584
1688
|
return {
|
|
1585
|
-
|
|
1689
|
+
streaming: capabilities.streaming,
|
|
1690
|
+
pushNotifications: capabilities.pushNotifications,
|
|
1691
|
+
extensions: capabilities.extensions ? capabilities.extensions.map((e) => _ToProto.agentExtension(e)) : []
|
|
1586
1692
|
};
|
|
1587
1693
|
}
|
|
1588
|
-
static
|
|
1589
|
-
const { taskId, configId } = extractTaskAndPushNotificationConfigId(request.name);
|
|
1694
|
+
static agentExtension(extension) {
|
|
1590
1695
|
return {
|
|
1591
|
-
|
|
1592
|
-
|
|
1696
|
+
uri: extension.uri,
|
|
1697
|
+
description: extension.description ?? "",
|
|
1698
|
+
required: extension.required ?? false,
|
|
1699
|
+
params: extension.params
|
|
1593
1700
|
};
|
|
1594
1701
|
}
|
|
1595
|
-
static
|
|
1702
|
+
static listTaskPushNotificationConfig(config) {
|
|
1596
1703
|
return {
|
|
1597
|
-
|
|
1704
|
+
configs: config.map((c) => _ToProto.taskPushNotificationConfig(c)),
|
|
1705
|
+
nextPageToken: ""
|
|
1598
1706
|
};
|
|
1599
1707
|
}
|
|
1600
|
-
static
|
|
1601
|
-
if (!request.config?.pushNotificationConfig) {
|
|
1602
|
-
throw A2AError.invalidParams(
|
|
1603
|
-
"Request must include a `config` object with a `pushNotificationConfig`"
|
|
1604
|
-
);
|
|
1605
|
-
}
|
|
1708
|
+
static getTaskPushNotificationConfigParams(config) {
|
|
1606
1709
|
return {
|
|
1607
|
-
|
|
1608
|
-
pushNotificationConfig: _FromProto.pushNotificationConfig(
|
|
1609
|
-
request.config.pushNotificationConfig
|
|
1610
|
-
)
|
|
1710
|
+
name: generatePushNotificationConfigName(config.id, config.pushNotificationConfigId)
|
|
1611
1711
|
};
|
|
1612
1712
|
}
|
|
1613
|
-
static
|
|
1614
|
-
const { taskId, configId } = extractTaskAndPushNotificationConfigId(request.name);
|
|
1713
|
+
static listTaskPushNotificationConfigParams(config) {
|
|
1615
1714
|
return {
|
|
1616
|
-
|
|
1617
|
-
|
|
1715
|
+
parent: generateTaskName(config.id),
|
|
1716
|
+
pageToken: "",
|
|
1717
|
+
pageSize: 0
|
|
1618
1718
|
};
|
|
1619
1719
|
}
|
|
1620
|
-
static
|
|
1621
|
-
if (!message) {
|
|
1622
|
-
return void 0;
|
|
1623
|
-
}
|
|
1720
|
+
static deleteTaskPushNotificationConfigParams(config) {
|
|
1624
1721
|
return {
|
|
1625
|
-
|
|
1626
|
-
messageId: message.messageId,
|
|
1627
|
-
parts: message.content.map((p) => _FromProto.part(p)),
|
|
1628
|
-
contextId: message.contextId || void 0,
|
|
1629
|
-
taskId: message.taskId || void 0,
|
|
1630
|
-
role: _FromProto.role(message.role),
|
|
1631
|
-
metadata: message.metadata,
|
|
1632
|
-
extensions: message.extensions
|
|
1722
|
+
name: generatePushNotificationConfigName(config.id, config.pushNotificationConfigId)
|
|
1633
1723
|
};
|
|
1634
1724
|
}
|
|
1635
|
-
static
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
}
|
|
1725
|
+
static taskPushNotificationConfig(config) {
|
|
1726
|
+
return {
|
|
1727
|
+
name: generatePushNotificationConfigName(
|
|
1728
|
+
config.taskId,
|
|
1729
|
+
config.pushNotificationConfig.id ?? ""
|
|
1730
|
+
),
|
|
1731
|
+
pushNotificationConfig: _ToProto.pushNotificationConfig(config.pushNotificationConfig)
|
|
1732
|
+
};
|
|
1644
1733
|
}
|
|
1645
|
-
static
|
|
1646
|
-
if (!configuration) {
|
|
1647
|
-
return void 0;
|
|
1648
|
-
}
|
|
1734
|
+
static taskPushNotificationConfigCreate(config) {
|
|
1649
1735
|
return {
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1736
|
+
parent: generateTaskName(config.taskId),
|
|
1737
|
+
config: _ToProto.taskPushNotificationConfig(config),
|
|
1738
|
+
configId: config.pushNotificationConfig.id
|
|
1653
1739
|
};
|
|
1654
1740
|
}
|
|
1655
1741
|
static pushNotificationConfig(config) {
|
|
@@ -1657,10 +1743,10 @@ var FromProto = class _FromProto {
|
|
|
1657
1743
|
return void 0;
|
|
1658
1744
|
}
|
|
1659
1745
|
return {
|
|
1660
|
-
id: config.id,
|
|
1746
|
+
id: config.id ?? "",
|
|
1661
1747
|
url: config.url,
|
|
1662
|
-
token: config.token
|
|
1663
|
-
authentication:
|
|
1748
|
+
token: config.token ?? "",
|
|
1749
|
+
authentication: _ToProto.pushNotificationAuthenticationInfo(config.authentication)
|
|
1664
1750
|
};
|
|
1665
1751
|
}
|
|
1666
1752
|
static pushNotificationAuthenticationInfo(authInfo) {
|
|
@@ -1669,307 +1755,221 @@ var FromProto = class _FromProto {
|
|
|
1669
1755
|
}
|
|
1670
1756
|
return {
|
|
1671
1757
|
schemes: authInfo.schemes,
|
|
1672
|
-
credentials: authInfo.credentials
|
|
1758
|
+
credentials: authInfo.credentials ?? ""
|
|
1673
1759
|
};
|
|
1674
1760
|
}
|
|
1675
|
-
static
|
|
1676
|
-
if (
|
|
1761
|
+
static messageStreamResult(event) {
|
|
1762
|
+
if (event.kind === "message") {
|
|
1677
1763
|
return {
|
|
1678
|
-
|
|
1679
|
-
|
|
1764
|
+
payload: {
|
|
1765
|
+
$case: "msg",
|
|
1766
|
+
value: _ToProto.message(event)
|
|
1767
|
+
}
|
|
1680
1768
|
};
|
|
1681
|
-
}
|
|
1682
|
-
if (part.part?.$case === "file") {
|
|
1683
|
-
const filePart = part.part.value;
|
|
1684
|
-
if (filePart.file?.$case === "fileWithUri") {
|
|
1685
|
-
return {
|
|
1686
|
-
kind: "file",
|
|
1687
|
-
file: {
|
|
1688
|
-
uri: filePart.file.value,
|
|
1689
|
-
mimeType: filePart.mimeType
|
|
1690
|
-
}
|
|
1691
|
-
};
|
|
1692
|
-
} else if (filePart.file?.$case === "fileWithBytes") {
|
|
1693
|
-
return {
|
|
1694
|
-
kind: "file",
|
|
1695
|
-
file: {
|
|
1696
|
-
bytes: filePart.file.value.toString("base64"),
|
|
1697
|
-
mimeType: filePart.mimeType
|
|
1698
|
-
}
|
|
1699
|
-
};
|
|
1700
|
-
}
|
|
1701
|
-
throw A2AError.invalidParams("Invalid file part type");
|
|
1702
|
-
}
|
|
1703
|
-
if (part.part?.$case === "data") {
|
|
1769
|
+
} else if (event.kind === "task") {
|
|
1704
1770
|
return {
|
|
1705
|
-
|
|
1706
|
-
|
|
1771
|
+
payload: {
|
|
1772
|
+
$case: "task",
|
|
1773
|
+
value: _ToProto.task(event)
|
|
1774
|
+
}
|
|
1707
1775
|
};
|
|
1708
|
-
}
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
throw A2AError.invalidParams("Invalid SendMessageResponse: missing result");
|
|
1725
|
-
}
|
|
1726
|
-
static task(task) {
|
|
1727
|
-
return {
|
|
1728
|
-
kind: "task",
|
|
1729
|
-
id: task.id,
|
|
1730
|
-
status: _FromProto.taskStatus(task.status),
|
|
1731
|
-
contextId: task.contextId,
|
|
1732
|
-
artifacts: task.artifacts?.map((a) => _FromProto.artifact(a)),
|
|
1733
|
-
history: task.history?.map((h) => _FromProto.message(h)),
|
|
1734
|
-
metadata: task.metadata
|
|
1735
|
-
};
|
|
1736
|
-
}
|
|
1737
|
-
static taskStatus(status) {
|
|
1738
|
-
return {
|
|
1739
|
-
message: _FromProto.message(status.update),
|
|
1740
|
-
state: _FromProto.taskState(status.state),
|
|
1741
|
-
timestamp: status.timestamp
|
|
1742
|
-
};
|
|
1743
|
-
}
|
|
1744
|
-
static taskState(state) {
|
|
1745
|
-
switch (state) {
|
|
1746
|
-
case 1 /* TASK_STATE_SUBMITTED */:
|
|
1747
|
-
return "submitted";
|
|
1748
|
-
case 2 /* TASK_STATE_WORKING */:
|
|
1749
|
-
return "working";
|
|
1750
|
-
case 6 /* TASK_STATE_INPUT_REQUIRED */:
|
|
1751
|
-
return "input-required";
|
|
1752
|
-
case 3 /* TASK_STATE_COMPLETED */:
|
|
1753
|
-
return "completed";
|
|
1754
|
-
case 5 /* TASK_STATE_CANCELLED */:
|
|
1755
|
-
return "canceled";
|
|
1756
|
-
case 4 /* TASK_STATE_FAILED */:
|
|
1757
|
-
return "failed";
|
|
1758
|
-
case 7 /* TASK_STATE_REJECTED */:
|
|
1759
|
-
return "rejected";
|
|
1760
|
-
case 8 /* TASK_STATE_AUTH_REQUIRED */:
|
|
1761
|
-
return "auth-required";
|
|
1762
|
-
case 0 /* TASK_STATE_UNSPECIFIED */:
|
|
1763
|
-
return "unknown";
|
|
1764
|
-
default:
|
|
1765
|
-
throw A2AError.invalidParams(`Invalid task state: ${state}`);
|
|
1776
|
+
} else if (event.kind === "status-update") {
|
|
1777
|
+
return {
|
|
1778
|
+
payload: {
|
|
1779
|
+
$case: "statusUpdate",
|
|
1780
|
+
value: _ToProto.taskStatusUpdateEvent(event)
|
|
1781
|
+
}
|
|
1782
|
+
};
|
|
1783
|
+
} else if (event.kind === "artifact-update") {
|
|
1784
|
+
return {
|
|
1785
|
+
payload: {
|
|
1786
|
+
$case: "artifactUpdate",
|
|
1787
|
+
value: _ToProto.taskArtifactUpdateEvent(event)
|
|
1788
|
+
}
|
|
1789
|
+
};
|
|
1790
|
+
} else {
|
|
1791
|
+
throw A2AError.internalError("Invalid event type");
|
|
1766
1792
|
}
|
|
1767
1793
|
}
|
|
1768
|
-
static
|
|
1794
|
+
static taskStatusUpdateEvent(event) {
|
|
1769
1795
|
return {
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1796
|
+
taskId: event.taskId,
|
|
1797
|
+
status: _ToProto.taskStatus(event.status),
|
|
1798
|
+
contextId: event.contextId,
|
|
1799
|
+
metadata: event.metadata,
|
|
1800
|
+
final: event.final
|
|
1775
1801
|
};
|
|
1776
1802
|
}
|
|
1777
|
-
static
|
|
1803
|
+
static taskArtifactUpdateEvent(event) {
|
|
1778
1804
|
return {
|
|
1779
|
-
taskId:
|
|
1780
|
-
|
|
1805
|
+
taskId: event.taskId,
|
|
1806
|
+
artifact: _ToProto.artifact(event.artifact),
|
|
1807
|
+
contextId: event.contextId,
|
|
1808
|
+
metadata: event.metadata,
|
|
1809
|
+
append: event.append,
|
|
1810
|
+
lastChunk: event.lastChunk
|
|
1781
1811
|
};
|
|
1782
1812
|
}
|
|
1783
|
-
static
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
securitySchemes: agentCard.securitySchemes ? Object.fromEntries(
|
|
1800
|
-
Object.entries(agentCard.securitySchemes).map(([key, value]) => [
|
|
1801
|
-
key,
|
|
1802
|
-
_FromProto.securityScheme(value)
|
|
1803
|
-
])
|
|
1804
|
-
) : {},
|
|
1805
|
-
skills: agentCard.skills.map((s) => _FromProto.skills(s)),
|
|
1806
|
-
signatures: agentCard.signatures?.map((s) => _FromProto.agentCardSignature(s)),
|
|
1807
|
-
supportsAuthenticatedExtendedCard: agentCard.supportsAuthenticatedExtendedCard,
|
|
1808
|
-
url: agentCard.url,
|
|
1809
|
-
version: agentCard.version
|
|
1810
|
-
};
|
|
1813
|
+
static messageSendResult(params) {
|
|
1814
|
+
if (params.kind === "message") {
|
|
1815
|
+
return {
|
|
1816
|
+
payload: {
|
|
1817
|
+
$case: "msg",
|
|
1818
|
+
value: _ToProto.message(params)
|
|
1819
|
+
}
|
|
1820
|
+
};
|
|
1821
|
+
} else if (params.kind === "task") {
|
|
1822
|
+
return {
|
|
1823
|
+
payload: {
|
|
1824
|
+
$case: "task",
|
|
1825
|
+
value: _ToProto.task(params)
|
|
1826
|
+
}
|
|
1827
|
+
};
|
|
1828
|
+
}
|
|
1811
1829
|
}
|
|
1812
|
-
static
|
|
1830
|
+
static message(message) {
|
|
1831
|
+
if (!message) {
|
|
1832
|
+
return void 0;
|
|
1833
|
+
}
|
|
1813
1834
|
return {
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1835
|
+
messageId: message.messageId,
|
|
1836
|
+
content: message.parts.map((p) => _ToProto.part(p)),
|
|
1837
|
+
contextId: message.contextId ?? "",
|
|
1838
|
+
taskId: message.taskId ?? "",
|
|
1839
|
+
role: _ToProto.role(message.role),
|
|
1840
|
+
metadata: message.metadata,
|
|
1841
|
+
extensions: message.extensions ?? []
|
|
1817
1842
|
};
|
|
1818
1843
|
}
|
|
1819
|
-
static
|
|
1844
|
+
static role(role) {
|
|
1845
|
+
switch (role) {
|
|
1846
|
+
case "agent":
|
|
1847
|
+
return 2 /* ROLE_AGENT */;
|
|
1848
|
+
case "user":
|
|
1849
|
+
return 1 /* ROLE_USER */;
|
|
1850
|
+
default:
|
|
1851
|
+
throw A2AError.internalError(`Invalid role`);
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
static task(task) {
|
|
1820
1855
|
return {
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1856
|
+
id: task.id,
|
|
1857
|
+
contextId: task.contextId,
|
|
1858
|
+
status: _ToProto.taskStatus(task.status),
|
|
1859
|
+
artifacts: task.artifacts?.map((a) => _ToProto.artifact(a)) ?? [],
|
|
1860
|
+
history: task.history?.map((m) => _ToProto.message(m)) ?? [],
|
|
1861
|
+
metadata: task.metadata
|
|
1825
1862
|
};
|
|
1826
1863
|
}
|
|
1827
|
-
static
|
|
1864
|
+
static taskStatus(status) {
|
|
1828
1865
|
return {
|
|
1829
|
-
|
|
1830
|
-
|
|
1866
|
+
state: _ToProto.taskState(status.state),
|
|
1867
|
+
update: _ToProto.message(status.message),
|
|
1868
|
+
timestamp: status.timestamp
|
|
1831
1869
|
};
|
|
1832
1870
|
}
|
|
1833
|
-
static
|
|
1871
|
+
static artifact(artifact) {
|
|
1834
1872
|
return {
|
|
1835
|
-
|
|
1836
|
-
|
|
1873
|
+
artifactId: artifact.artifactId,
|
|
1874
|
+
name: artifact.name ?? "",
|
|
1875
|
+
description: artifact.description ?? "",
|
|
1876
|
+
parts: artifact.parts.map((p) => _ToProto.part(p)),
|
|
1877
|
+
metadata: artifact.metadata,
|
|
1878
|
+
extensions: artifact.extensions ? artifact.extensions : []
|
|
1837
1879
|
};
|
|
1838
1880
|
}
|
|
1839
|
-
static
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
case "
|
|
1854
|
-
return
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
};
|
|
1860
|
-
case "mtlsSecurityScheme":
|
|
1861
|
-
return {
|
|
1862
|
-
type: "mutualTLS",
|
|
1863
|
-
description: securitySchemes.scheme.value.description || void 0
|
|
1864
|
-
};
|
|
1865
|
-
case "oauth2SecurityScheme":
|
|
1866
|
-
return {
|
|
1867
|
-
type: "oauth2",
|
|
1868
|
-
description: securitySchemes.scheme.value.description || void 0,
|
|
1869
|
-
flows: _FromProto.oauthFlows(securitySchemes.scheme.value.flows),
|
|
1870
|
-
oauth2MetadataUrl: securitySchemes.scheme.value.oauth2MetadataUrl || void 0
|
|
1871
|
-
};
|
|
1872
|
-
case "openIdConnectSecurityScheme":
|
|
1873
|
-
return {
|
|
1874
|
-
type: "openIdConnect",
|
|
1875
|
-
description: securitySchemes.scheme.value.description || void 0,
|
|
1876
|
-
openIdConnectUrl: securitySchemes.scheme.value.openIdConnectUrl
|
|
1877
|
-
};
|
|
1881
|
+
static taskState(state) {
|
|
1882
|
+
switch (state) {
|
|
1883
|
+
case "submitted":
|
|
1884
|
+
return 1 /* TASK_STATE_SUBMITTED */;
|
|
1885
|
+
case "working":
|
|
1886
|
+
return 2 /* TASK_STATE_WORKING */;
|
|
1887
|
+
case "input-required":
|
|
1888
|
+
return 6 /* TASK_STATE_INPUT_REQUIRED */;
|
|
1889
|
+
case "rejected":
|
|
1890
|
+
return 7 /* TASK_STATE_REJECTED */;
|
|
1891
|
+
case "auth-required":
|
|
1892
|
+
return 8 /* TASK_STATE_AUTH_REQUIRED */;
|
|
1893
|
+
case "completed":
|
|
1894
|
+
return 3 /* TASK_STATE_COMPLETED */;
|
|
1895
|
+
case "failed":
|
|
1896
|
+
return 4 /* TASK_STATE_FAILED */;
|
|
1897
|
+
case "canceled":
|
|
1898
|
+
return 5 /* TASK_STATE_CANCELLED */;
|
|
1899
|
+
case "unknown":
|
|
1900
|
+
return 0 /* TASK_STATE_UNSPECIFIED */;
|
|
1878
1901
|
default:
|
|
1879
|
-
|
|
1902
|
+
return -1 /* UNRECOGNIZED */;
|
|
1880
1903
|
}
|
|
1881
1904
|
}
|
|
1882
|
-
static
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
password: {
|
|
1895
|
-
refreshUrl: flows.flow.value.refreshUrl || void 0,
|
|
1896
|
-
scopes: flows.flow.value.scopes,
|
|
1897
|
-
tokenUrl: flows.flow.value.tokenUrl
|
|
1898
|
-
}
|
|
1899
|
-
};
|
|
1900
|
-
case "authorizationCode":
|
|
1901
|
-
return {
|
|
1902
|
-
authorizationCode: {
|
|
1903
|
-
refreshUrl: flows.flow.value.refreshUrl || void 0,
|
|
1904
|
-
authorizationUrl: flows.flow.value.authorizationUrl,
|
|
1905
|
-
scopes: flows.flow.value.scopes,
|
|
1906
|
-
tokenUrl: flows.flow.value.tokenUrl
|
|
1907
|
-
}
|
|
1905
|
+
static part(part) {
|
|
1906
|
+
if (part.kind === "text") {
|
|
1907
|
+
return {
|
|
1908
|
+
part: { $case: "text", value: part.text }
|
|
1909
|
+
};
|
|
1910
|
+
}
|
|
1911
|
+
if (part.kind === "file") {
|
|
1912
|
+
let filePart;
|
|
1913
|
+
if ("uri" in part.file) {
|
|
1914
|
+
filePart = {
|
|
1915
|
+
file: { $case: "fileWithUri", value: part.file.uri },
|
|
1916
|
+
mimeType: part.file.mimeType
|
|
1908
1917
|
};
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
scopes: flows.flow.value.scopes,
|
|
1914
|
-
tokenUrl: flows.flow.value.tokenUrl
|
|
1915
|
-
}
|
|
1918
|
+
} else if ("bytes" in part.file) {
|
|
1919
|
+
filePart = {
|
|
1920
|
+
file: { $case: "fileWithBytes", value: Buffer.from(part.file.bytes, "base64") },
|
|
1921
|
+
mimeType: part.file.mimeType
|
|
1916
1922
|
};
|
|
1917
|
-
|
|
1918
|
-
throw A2AError.internalError(
|
|
1923
|
+
} else {
|
|
1924
|
+
throw A2AError.internalError("Invalid file part");
|
|
1925
|
+
}
|
|
1926
|
+
return {
|
|
1927
|
+
part: { $case: "file", value: filePart }
|
|
1928
|
+
};
|
|
1929
|
+
}
|
|
1930
|
+
if (part.kind === "data") {
|
|
1931
|
+
return {
|
|
1932
|
+
part: { $case: "data", value: { data: part.data } }
|
|
1933
|
+
};
|
|
1919
1934
|
}
|
|
1935
|
+
throw A2AError.internalError("Invalid part type");
|
|
1920
1936
|
}
|
|
1921
|
-
static
|
|
1937
|
+
static messageSendParams(params) {
|
|
1922
1938
|
return {
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
tags: skill.tags,
|
|
1927
|
-
examples: skill.examples,
|
|
1928
|
-
inputModes: skill.inputModes,
|
|
1929
|
-
outputModes: skill.outputModes,
|
|
1930
|
-
security: skill.security?.map((s) => _FromProto.security(s))
|
|
1939
|
+
request: _ToProto.message(params.message),
|
|
1940
|
+
configuration: _ToProto.configuration(params.configuration),
|
|
1941
|
+
metadata: params.metadata
|
|
1931
1942
|
};
|
|
1932
1943
|
}
|
|
1933
|
-
static
|
|
1944
|
+
static configuration(configuration) {
|
|
1945
|
+
if (!configuration) {
|
|
1946
|
+
return void 0;
|
|
1947
|
+
}
|
|
1934
1948
|
return {
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1949
|
+
blocking: configuration.blocking,
|
|
1950
|
+
acceptedOutputModes: configuration.acceptedOutputModes ?? [],
|
|
1951
|
+
pushNotification: _ToProto.pushNotificationConfig(configuration.pushNotificationConfig),
|
|
1952
|
+
historyLength: configuration.historyLength ?? 0
|
|
1938
1953
|
};
|
|
1939
1954
|
}
|
|
1940
|
-
static
|
|
1955
|
+
static taskQueryParams(params) {
|
|
1941
1956
|
return {
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
status: _FromProto.taskStatus(event.status),
|
|
1945
|
-
contextId: event.contextId,
|
|
1946
|
-
metadata: event.metadata,
|
|
1947
|
-
final: event.final
|
|
1957
|
+
name: generateTaskName(params.id),
|
|
1958
|
+
historyLength: params.historyLength ?? 0
|
|
1948
1959
|
};
|
|
1949
1960
|
}
|
|
1950
|
-
static
|
|
1961
|
+
static cancelTaskRequest(params) {
|
|
1951
1962
|
return {
|
|
1952
|
-
|
|
1953
|
-
taskId: event.taskId,
|
|
1954
|
-
artifact: _FromProto.artifact(event.artifact),
|
|
1955
|
-
contextId: event.contextId,
|
|
1956
|
-
metadata: event.metadata,
|
|
1957
|
-
lastChunk: event.lastChunk
|
|
1963
|
+
name: generateTaskName(params.id)
|
|
1958
1964
|
};
|
|
1959
1965
|
}
|
|
1960
|
-
static
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
return _FromProto.taskStatusUpdateEvent(event.payload.value);
|
|
1968
|
-
case "artifactUpdate":
|
|
1969
|
-
return _FromProto.taskArtifactUpdateEvent(event.payload.value);
|
|
1970
|
-
default:
|
|
1971
|
-
throw A2AError.internalError("Invalid event type in StreamResponse");
|
|
1972
|
-
}
|
|
1966
|
+
static taskIdParams(params) {
|
|
1967
|
+
return {
|
|
1968
|
+
name: generateTaskName(params.id)
|
|
1969
|
+
};
|
|
1970
|
+
}
|
|
1971
|
+
static getAgentCardRequest() {
|
|
1972
|
+
return {};
|
|
1973
1973
|
}
|
|
1974
1974
|
};
|
|
1975
1975
|
|
|
@@ -1981,6 +1981,6 @@ export {
|
|
|
1981
1981
|
SendMessageResponse,
|
|
1982
1982
|
StreamResponse,
|
|
1983
1983
|
ListTaskPushNotificationConfigResponse,
|
|
1984
|
-
|
|
1985
|
-
|
|
1984
|
+
FromProto,
|
|
1985
|
+
ToProto
|
|
1986
1986
|
};
|