@dexto/server 1.6.19 → 1.6.21
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/jsonrpc/methods.cjs +1 -1
- package/dist/a2a/jsonrpc/methods.d.ts +14 -4
- package/dist/a2a/jsonrpc/methods.d.ts.map +1 -1
- package/dist/a2a/jsonrpc/methods.js +1 -1
- package/dist/hono/index.cjs +39 -8
- package/dist/hono/index.d.ts +43 -4503
- package/dist/hono/index.d.ts.map +1 -1
- package/dist/hono/index.js +42 -9
- package/dist/hono/routes/a2a-jsonrpc.d.ts.map +1 -1
- package/dist/hono/routes/a2a-tasks.cjs +173 -34
- package/dist/hono/routes/a2a-tasks.d.ts +1 -498
- package/dist/hono/routes/a2a-tasks.d.ts.map +1 -1
- package/dist/hono/routes/a2a-tasks.js +177 -34
- package/dist/hono/routes/a2a.d.ts.map +1 -1
- package/dist/hono/routes/agents.cjs +410 -329
- package/dist/hono/routes/agents.d.ts +16048 -73
- package/dist/hono/routes/agents.d.ts.map +1 -1
- package/dist/hono/routes/agents.js +418 -330
- package/dist/hono/routes/approvals.cjs +103 -78
- package/dist/hono/routes/approvals.d.ts +2090 -112
- package/dist/hono/routes/approvals.d.ts.map +1 -1
- package/dist/hono/routes/approvals.js +108 -78
- package/dist/hono/routes/dexto-auth.cjs +40 -33
- package/dist/hono/routes/dexto-auth.d.ts +401 -2
- package/dist/hono/routes/dexto-auth.d.ts.map +1 -1
- package/dist/hono/routes/dexto-auth.js +40 -33
- package/dist/hono/routes/discovery.cjs +16 -14
- package/dist/hono/routes/discovery.d.ts +586 -1
- package/dist/hono/routes/discovery.d.ts.map +1 -1
- package/dist/hono/routes/discovery.js +16 -14
- package/dist/hono/routes/greeting.cjs +26 -22
- package/dist/hono/routes/greeting.d.ts +787 -3
- package/dist/hono/routes/greeting.d.ts.map +1 -1
- package/dist/hono/routes/greeting.js +26 -22
- package/dist/hono/routes/health.d.ts +1 -1
- package/dist/hono/routes/key.cjs +60 -52
- package/dist/hono/routes/key.d.ts +1597 -1
- package/dist/hono/routes/key.d.ts.map +1 -1
- package/dist/hono/routes/key.js +60 -52
- package/dist/hono/routes/llm.cjs +381 -348
- package/dist/hono/routes/llm.d.ts +12137 -87
- package/dist/hono/routes/llm.d.ts.map +1 -1
- package/dist/hono/routes/llm.js +385 -348
- package/dist/hono/routes/mcp.cjs +273 -212
- package/dist/hono/routes/mcp.d.ts +6605 -316
- package/dist/hono/routes/mcp.d.ts.map +1 -1
- package/dist/hono/routes/mcp.js +287 -213
- package/dist/hono/routes/memory.cjs +102 -89
- package/dist/hono/routes/memory.d.ts +5368 -4
- package/dist/hono/routes/memory.d.ts.map +1 -1
- package/dist/hono/routes/memory.js +108 -90
- package/dist/hono/routes/messages.cjs +171 -164
- package/dist/hono/routes/messages.d.ts +3899 -10
- package/dist/hono/routes/messages.d.ts.map +1 -1
- package/dist/hono/routes/messages.js +181 -165
- package/dist/hono/routes/models.cjs +106 -64
- package/dist/hono/routes/models.d.ts +2874 -1
- package/dist/hono/routes/models.d.ts.map +1 -1
- package/dist/hono/routes/models.js +108 -64
- package/dist/hono/routes/openrouter.cjs +79 -65
- package/dist/hono/routes/openrouter.d.ts +854 -1
- package/dist/hono/routes/openrouter.d.ts.map +1 -1
- package/dist/hono/routes/openrouter.js +79 -65
- package/dist/hono/routes/prompts.cjs +137 -104
- package/dist/hono/routes/prompts.d.ts +2820 -12
- package/dist/hono/routes/prompts.d.ts.map +1 -1
- package/dist/hono/routes/prompts.js +144 -105
- package/dist/hono/routes/queue.cjs +158 -132
- package/dist/hono/routes/queue.d.ts +5148 -13
- package/dist/hono/routes/queue.d.ts.map +1 -1
- package/dist/hono/routes/queue.js +168 -133
- package/dist/hono/routes/resources.cjs +65 -46
- package/dist/hono/routes/resources.d.ts +1983 -5
- package/dist/hono/routes/resources.d.ts.map +1 -1
- package/dist/hono/routes/resources.js +72 -47
- package/dist/hono/routes/schedules.cjs +233 -226
- package/dist/hono/routes/schedules.d.ts +4202 -26
- package/dist/hono/routes/schedules.d.ts.map +1 -1
- package/dist/hono/routes/schedules.js +233 -226
- package/dist/hono/routes/search.cjs +34 -30
- package/dist/hono/routes/search.d.ts +2837 -14
- package/dist/hono/routes/search.d.ts.map +1 -1
- package/dist/hono/routes/search.js +40 -31
- package/dist/hono/routes/sessions.cjs +404 -392
- package/dist/hono/routes/sessions.d.ts +16585 -30
- package/dist/hono/routes/sessions.d.ts.map +1 -1
- package/dist/hono/routes/sessions.js +408 -393
- package/dist/hono/routes/static.d.ts.map +1 -1
- package/dist/hono/routes/system-prompt.cjs +57 -61
- package/dist/hono/routes/system-prompt.d.ts +1228 -2
- package/dist/hono/routes/system-prompt.d.ts.map +1 -1
- package/dist/hono/routes/system-prompt.js +58 -62
- package/dist/hono/routes/tools.cjs +29 -34
- package/dist/hono/routes/tools.d.ts +1756 -7
- package/dist/hono/routes/tools.d.ts.map +1 -1
- package/dist/hono/routes/tools.js +33 -33
- package/dist/hono/routes/webhooks.cjs +159 -132
- package/dist/hono/routes/webhooks.d.ts +2504 -14
- package/dist/hono/routes/webhooks.d.ts.map +1 -1
- package/dist/hono/routes/webhooks.js +163 -132
- package/dist/hono/routes/workspaces.cjs +84 -79
- package/dist/hono/routes/workspaces.d.ts +2093 -2
- package/dist/hono/routes/workspaces.d.ts.map +1 -1
- package/dist/hono/routes/workspaces.js +89 -80
- package/dist/hono/schemas/responses.cjs +492 -235
- package/dist/hono/schemas/responses.d.ts +1461 -146
- package/dist/hono/schemas/responses.d.ts.map +1 -1
- package/dist/hono/schemas/responses.js +247 -9
- package/dist/hono/types.d.ts +11 -0
- package/dist/hono/types.d.ts.map +1 -1
- package/package.json +7 -7
package/dist/hono/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hono/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/h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AAM,OAAO,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;AAGrD,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/hono/index.js
CHANGED
|
@@ -17,7 +17,9 @@ import { createResourcesRouter } from "./routes/resources.js";
|
|
|
17
17
|
import { createMemoryRouter } from "./routes/memory.js";
|
|
18
18
|
import { createWorkspacesRouter } from "./routes/workspaces.js";
|
|
19
19
|
import { createSchedulesRouter } from "./routes/schedules.js";
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
createAgentsRouter
|
|
22
|
+
} from "./routes/agents.js";
|
|
21
23
|
import { createApprovalsRouter } from "./routes/approvals.js";
|
|
22
24
|
import { createQueueRouter } from "./routes/queue.js";
|
|
23
25
|
import { createOpenRouterRouter } from "./routes/openrouter.js";
|
|
@@ -116,14 +118,45 @@ function createDextoApp(options) {
|
|
|
116
118
|
app.use(middlewarePattern, redactionMiddleware);
|
|
117
119
|
const routePrefix = normalizedPrefix;
|
|
118
120
|
const resolvedGetAgentConfigPath = getAgentConfigPath ?? ((_ctx) => void 0);
|
|
119
|
-
const fullApp = app
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
)
|
|
126
|
-
|
|
121
|
+
const fullApp = app;
|
|
122
|
+
const mountedRouters = [
|
|
123
|
+
["/health", createHealthRouter(getAgent)],
|
|
124
|
+
["/", createA2aRouter(getAgentCard)],
|
|
125
|
+
["/", createA2AJsonRpcRouter(getAgent, sseSubscriber)],
|
|
126
|
+
["/", createA2ATasksRouter(getAgent, sseSubscriber)],
|
|
127
|
+
[routePrefix, createGreetingRouter(getAgent)],
|
|
128
|
+
[routePrefix, createMessagesRouter(getAgent, approvalCoordinator)],
|
|
129
|
+
[routePrefix, createLlmRouter(getAgent)],
|
|
130
|
+
[routePrefix, createSessionsRouter(getAgent)],
|
|
131
|
+
[routePrefix, createSearchRouter(getAgent)],
|
|
132
|
+
[routePrefix, createMcpRouter(getAgent, resolvedGetAgentConfigPath)],
|
|
133
|
+
[routePrefix, createWebhooksRouter(getAgent, webhookSubscriber)],
|
|
134
|
+
[routePrefix, createPromptsRouter(getAgent)],
|
|
135
|
+
[routePrefix, createResourcesRouter(getAgent)],
|
|
136
|
+
[routePrefix, createMemoryRouter(getAgent)],
|
|
137
|
+
[routePrefix, createWorkspacesRouter(getAgent)],
|
|
138
|
+
[routePrefix, createSchedulesRouter(getAgent)],
|
|
139
|
+
[routePrefix, createApprovalsRouter(getAgent, approvalCoordinator)],
|
|
140
|
+
[
|
|
141
|
+
routePrefix,
|
|
142
|
+
createAgentsRouter(
|
|
143
|
+
getAgent,
|
|
144
|
+
agentsContext || dummyAgentsContext,
|
|
145
|
+
resolvedGetAgentConfigPath
|
|
146
|
+
)
|
|
147
|
+
],
|
|
148
|
+
[routePrefix, createQueueRouter(getAgent)],
|
|
149
|
+
[routePrefix, createOpenRouterRouter()],
|
|
150
|
+
[routePrefix, createKeyRouter()],
|
|
151
|
+
[routePrefix, createToolsRouter(getAgent)],
|
|
152
|
+
[routePrefix, createDiscoveryRouter(resolvedGetAgentConfigPath)],
|
|
153
|
+
[routePrefix, createModelsRouter()],
|
|
154
|
+
[routePrefix, createSystemPromptRouter(getAgent)],
|
|
155
|
+
[routePrefix, createDextoAuthRouter(getAgent)]
|
|
156
|
+
];
|
|
157
|
+
for (const [path, router] of mountedRouters) {
|
|
158
|
+
fullApp.route(path, router);
|
|
159
|
+
}
|
|
127
160
|
fullApp.doc("/openapi.json", {
|
|
128
161
|
openapi: "3.0.0",
|
|
129
162
|
info: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"a2a-jsonrpc.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/a2a-jsonrpc.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI9C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAEhF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,KAAK,UAAU,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"a2a-jsonrpc.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/a2a-jsonrpc.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI9C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAEhF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,KAAK,UAAU,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,qBAAqB,8EA4HhG"}
|
|
@@ -25,11 +25,15 @@ var import_zod_openapi = require("@hono/zod-openapi");
|
|
|
25
25
|
var import_methods = require("../../a2a/jsonrpc/methods.js");
|
|
26
26
|
var import_core = require("@dexto/core");
|
|
27
27
|
var import_message = require("../../a2a/adapters/message.js");
|
|
28
|
+
var import_responses = require("../schemas/responses.js");
|
|
29
|
+
function mountA2ATasksSubrouter(app, router) {
|
|
30
|
+
app.route("/", router);
|
|
31
|
+
}
|
|
28
32
|
const PartSchema = import_zod_openapi.z.discriminatedUnion("kind", [
|
|
29
33
|
import_zod_openapi.z.object({
|
|
30
34
|
kind: import_zod_openapi.z.literal("text").describe("Part type discriminator"),
|
|
31
35
|
text: import_zod_openapi.z.string().describe("Text content"),
|
|
32
|
-
metadata:
|
|
36
|
+
metadata: import_responses.JsonObjectSchema.optional().describe("Extension metadata")
|
|
33
37
|
}),
|
|
34
38
|
import_zod_openapi.z.object({
|
|
35
39
|
kind: import_zod_openapi.z.literal("file").describe("Part type discriminator"),
|
|
@@ -45,12 +49,12 @@ const PartSchema = import_zod_openapi.z.discriminatedUnion("kind", [
|
|
|
45
49
|
mimeType: import_zod_openapi.z.string().optional().describe("MIME type")
|
|
46
50
|
})
|
|
47
51
|
]).describe("File data (bytes or URI)"),
|
|
48
|
-
metadata:
|
|
52
|
+
metadata: import_responses.JsonObjectSchema.optional().describe("Extension metadata")
|
|
49
53
|
}),
|
|
50
54
|
import_zod_openapi.z.object({
|
|
51
55
|
kind: import_zod_openapi.z.literal("data").describe("Part type discriminator"),
|
|
52
|
-
data:
|
|
53
|
-
metadata:
|
|
56
|
+
data: import_responses.JsonObjectSchema.describe("Structured JSON data"),
|
|
57
|
+
metadata: import_responses.JsonObjectSchema.optional().describe("Extension metadata")
|
|
54
58
|
})
|
|
55
59
|
]).describe("Message part (text, file, or data)");
|
|
56
60
|
const MessageSchema = import_zod_openapi.z.object({
|
|
@@ -59,7 +63,7 @@ const MessageSchema = import_zod_openapi.z.object({
|
|
|
59
63
|
messageId: import_zod_openapi.z.string().describe("Unique message identifier"),
|
|
60
64
|
taskId: import_zod_openapi.z.string().optional().describe("Associated task ID"),
|
|
61
65
|
contextId: import_zod_openapi.z.string().optional().describe("Context identifier"),
|
|
62
|
-
metadata:
|
|
66
|
+
metadata: import_responses.JsonObjectSchema.optional().describe("Extension metadata"),
|
|
63
67
|
extensions: import_zod_openapi.z.array(import_zod_openapi.z.string()).optional().describe("Extension identifiers"),
|
|
64
68
|
referenceTaskIds: import_zod_openapi.z.array(import_zod_openapi.z.string()).optional().describe("Referenced task IDs"),
|
|
65
69
|
kind: import_zod_openapi.z.literal("message").describe("Object type discriminator")
|
|
@@ -79,15 +83,114 @@ const TaskStatusSchema = import_zod_openapi.z.object({
|
|
|
79
83
|
message: MessageSchema.optional().describe("Status message"),
|
|
80
84
|
timestamp: import_zod_openapi.z.string().optional().describe("ISO 8601 timestamp")
|
|
81
85
|
}).describe("Task status");
|
|
86
|
+
const ArtifactSchema = import_zod_openapi.z.object({
|
|
87
|
+
artifactId: import_zod_openapi.z.string().describe("Unique artifact ID"),
|
|
88
|
+
name: import_zod_openapi.z.string().optional().describe("Artifact name"),
|
|
89
|
+
description: import_zod_openapi.z.string().optional().describe("Artifact description"),
|
|
90
|
+
parts: import_zod_openapi.z.array(PartSchema).describe("Artifact content parts"),
|
|
91
|
+
metadata: import_responses.JsonObjectSchema.optional().describe("Extension metadata"),
|
|
92
|
+
extensions: import_zod_openapi.z.array(import_zod_openapi.z.string()).optional().describe("Extension identifiers")
|
|
93
|
+
}).describe("A2A protocol artifact");
|
|
82
94
|
const TaskSchema = import_zod_openapi.z.object({
|
|
83
95
|
id: import_zod_openapi.z.string().describe("Unique task identifier"),
|
|
84
96
|
contextId: import_zod_openapi.z.string().describe("Context identifier across related tasks"),
|
|
85
97
|
status: TaskStatusSchema.describe("Current task status"),
|
|
86
98
|
history: import_zod_openapi.z.array(MessageSchema).optional().describe("Conversation history"),
|
|
87
|
-
artifacts: import_zod_openapi.z.array(
|
|
88
|
-
metadata:
|
|
99
|
+
artifacts: import_zod_openapi.z.array(ArtifactSchema).optional().describe("Task artifacts"),
|
|
100
|
+
metadata: import_responses.JsonObjectSchema.optional().describe("Extension metadata"),
|
|
89
101
|
kind: import_zod_openapi.z.literal("task").describe("Object type discriminator")
|
|
90
102
|
}).describe("A2A Protocol task");
|
|
103
|
+
const TasksListResponseSchema = import_zod_openapi.z.object({
|
|
104
|
+
tasks: import_zod_openapi.z.array(TaskSchema).describe("Array of tasks"),
|
|
105
|
+
totalSize: import_zod_openapi.z.number().describe("Total number of tasks"),
|
|
106
|
+
pageSize: import_zod_openapi.z.number().describe("Number of tasks in this page"),
|
|
107
|
+
nextPageToken: import_zod_openapi.z.string().describe("Token for next page")
|
|
108
|
+
}).describe("Response body for tasks/list");
|
|
109
|
+
const TaskErrorResponseSchema = import_zod_openapi.z.object({
|
|
110
|
+
error: import_zod_openapi.z.string().describe("Task error message")
|
|
111
|
+
}).strict().describe("A2A task error response");
|
|
112
|
+
function toA2APart(part) {
|
|
113
|
+
switch (part.kind) {
|
|
114
|
+
case "text":
|
|
115
|
+
return {
|
|
116
|
+
kind: "text",
|
|
117
|
+
text: part.text,
|
|
118
|
+
...part.metadata !== void 0 ? { metadata: part.metadata } : {}
|
|
119
|
+
};
|
|
120
|
+
case "file": {
|
|
121
|
+
const file = "bytes" in part.file ? {
|
|
122
|
+
bytes: part.file.bytes,
|
|
123
|
+
...part.file.name !== void 0 ? { name: part.file.name } : {},
|
|
124
|
+
...part.file.mimeType !== void 0 ? { mimeType: part.file.mimeType } : {}
|
|
125
|
+
} : {
|
|
126
|
+
uri: part.file.uri,
|
|
127
|
+
...part.file.name !== void 0 ? { name: part.file.name } : {},
|
|
128
|
+
...part.file.mimeType !== void 0 ? { mimeType: part.file.mimeType } : {}
|
|
129
|
+
};
|
|
130
|
+
return {
|
|
131
|
+
kind: "file",
|
|
132
|
+
file,
|
|
133
|
+
...part.metadata !== void 0 ? { metadata: part.metadata } : {}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
case "data":
|
|
137
|
+
return {
|
|
138
|
+
kind: "data",
|
|
139
|
+
data: part.data,
|
|
140
|
+
...part.metadata !== void 0 ? { metadata: part.metadata } : {}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function toA2AMessage(message) {
|
|
145
|
+
return {
|
|
146
|
+
role: message.role,
|
|
147
|
+
parts: message.parts.map(toA2APart),
|
|
148
|
+
messageId: message.messageId,
|
|
149
|
+
kind: "message",
|
|
150
|
+
...message.taskId !== void 0 ? { taskId: message.taskId } : {},
|
|
151
|
+
...message.contextId !== void 0 ? { contextId: message.contextId } : {},
|
|
152
|
+
...message.metadata !== void 0 ? { metadata: message.metadata } : {},
|
|
153
|
+
...message.extensions !== void 0 ? { extensions: message.extensions } : {},
|
|
154
|
+
...message.referenceTaskIds !== void 0 ? { referenceTaskIds: message.referenceTaskIds } : {}
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
function toMessageSendParams(body) {
|
|
158
|
+
const pushNotificationConfig = body.configuration?.pushNotificationConfig ? {
|
|
159
|
+
url: body.configuration.pushNotificationConfig.url,
|
|
160
|
+
...body.configuration.pushNotificationConfig.headers !== void 0 ? { headers: body.configuration.pushNotificationConfig.headers } : {}
|
|
161
|
+
} : void 0;
|
|
162
|
+
const configuration = body.configuration ? {
|
|
163
|
+
...body.configuration.acceptedOutputModes !== void 0 ? { acceptedOutputModes: body.configuration.acceptedOutputModes } : {},
|
|
164
|
+
...body.configuration.historyLength !== void 0 ? { historyLength: body.configuration.historyLength } : {},
|
|
165
|
+
...pushNotificationConfig !== void 0 ? { pushNotificationConfig } : {},
|
|
166
|
+
...body.configuration.blocking !== void 0 ? { blocking: body.configuration.blocking } : {}
|
|
167
|
+
} : void 0;
|
|
168
|
+
return {
|
|
169
|
+
message: toA2AMessage(body.message),
|
|
170
|
+
...configuration !== void 0 ? { configuration } : {},
|
|
171
|
+
...body.metadata !== void 0 ? { metadata: body.metadata } : {}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
function toListTasksParams(query) {
|
|
175
|
+
return {
|
|
176
|
+
...query.contextId !== void 0 ? { contextId: query.contextId } : {},
|
|
177
|
+
...query.status !== void 0 ? { status: query.status } : {},
|
|
178
|
+
...query.pageSize !== void 0 ? { pageSize: query.pageSize } : {},
|
|
179
|
+
...query.pageToken !== void 0 ? { pageToken: query.pageToken } : {},
|
|
180
|
+
...query.historyLength !== void 0 ? { historyLength: query.historyLength } : {},
|
|
181
|
+
...query.lastUpdatedAfter !== void 0 ? { lastUpdatedAfter: query.lastUpdatedAfter } : {},
|
|
182
|
+
...query.includeArtifacts !== void 0 ? { includeArtifacts: query.includeArtifacts } : {}
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function readCancelTaskParam(value) {
|
|
186
|
+
if (Object.prototype.hasOwnProperty.call(value, "id")) {
|
|
187
|
+
return void 0;
|
|
188
|
+
}
|
|
189
|
+
const raw = Object.entries(value).find(
|
|
190
|
+
([key, candidate]) => key === "id:cancel" && typeof candidate === "string"
|
|
191
|
+
)?.[1];
|
|
192
|
+
return typeof raw === "string" ? raw : void 0;
|
|
193
|
+
}
|
|
91
194
|
const MessageSendRequestSchema = import_zod_openapi.z.object({
|
|
92
195
|
message: MessageSchema.describe("Message to send to the agent"),
|
|
93
196
|
configuration: import_zod_openapi.z.object({
|
|
@@ -99,7 +202,7 @@ const MessageSendRequestSchema = import_zod_openapi.z.object({
|
|
|
99
202
|
}).optional().describe("Push notification configuration"),
|
|
100
203
|
blocking: import_zod_openapi.z.boolean().optional().describe("Wait for task completion")
|
|
101
204
|
}).optional().describe("Optional configuration"),
|
|
102
|
-
metadata:
|
|
205
|
+
metadata: import_responses.JsonObjectSchema.optional().describe("Optional metadata")
|
|
103
206
|
}).describe("Request body for message/send");
|
|
104
207
|
const TaskListQuerySchema = import_zod_openapi.z.object({
|
|
105
208
|
contextId: import_zod_openapi.z.string().optional().describe("Filter by context ID"),
|
|
@@ -160,7 +263,9 @@ function createA2ATasksRouter(getAgent, sseSubscriber) {
|
|
|
160
263
|
schema: TaskSchema
|
|
161
264
|
}
|
|
162
265
|
}
|
|
163
|
-
}
|
|
266
|
+
},
|
|
267
|
+
400: import_responses.BadRequestErrorResponse,
|
|
268
|
+
500: import_responses.InternalErrorResponse
|
|
164
269
|
}
|
|
165
270
|
});
|
|
166
271
|
const listTasksRoute = (0, import_zod_openapi.createRoute)({
|
|
@@ -177,15 +282,12 @@ function createA2ATasksRouter(getAgent, sseSubscriber) {
|
|
|
177
282
|
description: "Task list",
|
|
178
283
|
content: {
|
|
179
284
|
"application/json": {
|
|
180
|
-
schema:
|
|
181
|
-
tasks: import_zod_openapi.z.array(TaskSchema).describe("Array of tasks"),
|
|
182
|
-
totalSize: import_zod_openapi.z.number().describe("Total number of tasks"),
|
|
183
|
-
pageSize: import_zod_openapi.z.number().describe("Number of tasks in this page"),
|
|
184
|
-
nextPageToken: import_zod_openapi.z.string().describe("Token for next page")
|
|
185
|
-
}).describe("Response body for tasks/list")
|
|
285
|
+
schema: TasksListResponseSchema
|
|
186
286
|
}
|
|
187
287
|
}
|
|
188
|
-
}
|
|
288
|
+
},
|
|
289
|
+
400: import_responses.BadRequestErrorResponse,
|
|
290
|
+
500: import_responses.InternalErrorResponse
|
|
189
291
|
}
|
|
190
292
|
});
|
|
191
293
|
const getTaskRoute = (0, import_zod_openapi.createRoute)({
|
|
@@ -209,7 +311,12 @@ function createA2ATasksRouter(getAgent, sseSubscriber) {
|
|
|
209
311
|
}
|
|
210
312
|
},
|
|
211
313
|
404: {
|
|
212
|
-
description: "Task not found"
|
|
314
|
+
description: "Task not found",
|
|
315
|
+
content: {
|
|
316
|
+
"application/json": {
|
|
317
|
+
schema: TaskErrorResponseSchema
|
|
318
|
+
}
|
|
319
|
+
}
|
|
213
320
|
}
|
|
214
321
|
}
|
|
215
322
|
});
|
|
@@ -220,9 +327,22 @@ function createA2ATasksRouter(getAgent, sseSubscriber) {
|
|
|
220
327
|
description: "Cancel a running task (A2A tasks/cancel)",
|
|
221
328
|
tags: ["a2a"],
|
|
222
329
|
request: {
|
|
223
|
-
params: import_zod_openapi.z.
|
|
224
|
-
|
|
225
|
-
|
|
330
|
+
params: import_zod_openapi.z.preprocess(
|
|
331
|
+
(value) => {
|
|
332
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
333
|
+
const raw = readCancelTaskParam(value);
|
|
334
|
+
if (raw !== void 0) {
|
|
335
|
+
return {
|
|
336
|
+
id: raw.endsWith(":cancel") ? raw.slice(0, -":cancel".length) : raw
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return value;
|
|
341
|
+
},
|
|
342
|
+
import_zod_openapi.z.object({
|
|
343
|
+
id: import_zod_openapi.z.string().describe("Task ID")
|
|
344
|
+
})
|
|
345
|
+
)
|
|
226
346
|
},
|
|
227
347
|
responses: {
|
|
228
348
|
200: {
|
|
@@ -234,7 +354,12 @@ function createA2ATasksRouter(getAgent, sseSubscriber) {
|
|
|
234
354
|
}
|
|
235
355
|
},
|
|
236
356
|
404: {
|
|
237
|
-
description: "Task not found"
|
|
357
|
+
description: "Task not found",
|
|
358
|
+
content: {
|
|
359
|
+
"application/json": {
|
|
360
|
+
schema: TaskErrorResponseSchema
|
|
361
|
+
}
|
|
362
|
+
}
|
|
238
363
|
}
|
|
239
364
|
}
|
|
240
365
|
});
|
|
@@ -257,7 +382,7 @@ function createA2ATasksRouter(getAgent, sseSubscriber) {
|
|
|
257
382
|
const agent = await getAgent(ctx);
|
|
258
383
|
const session = await agent.createSession(taskId);
|
|
259
384
|
const stream = sseSubscriber.createStream(session.id);
|
|
260
|
-
const { text, image, file } = (0, import_message.a2aToInternalMessage)(validatedBody.message);
|
|
385
|
+
const { text, image, file } = (0, import_message.a2aToInternalMessage)(toA2AMessage(validatedBody.message));
|
|
261
386
|
agent.run(text, image, file, session.id).catch((error) => {
|
|
262
387
|
import_core.logger.error(`Error in streaming task ${session.id}: ${error}`);
|
|
263
388
|
});
|
|
@@ -275,39 +400,53 @@ function createA2ATasksRouter(getAgent, sseSubscriber) {
|
|
|
275
400
|
return ctx.json({ error: "Failed to initiate streaming" }, 500);
|
|
276
401
|
}
|
|
277
402
|
});
|
|
278
|
-
|
|
403
|
+
const messageSendRouter = new import_zod_openapi.OpenAPIHono().openapi(messageSendRoute, async (ctx) => {
|
|
279
404
|
const handlers = new import_methods.A2AMethodHandlers(await getAgent(ctx));
|
|
280
405
|
const body = ctx.req.valid("json");
|
|
281
406
|
import_core.logger.info("REST: message/send", { hasMessage: !!body.message });
|
|
282
|
-
const result = await handlers.messageSend(body);
|
|
283
|
-
|
|
284
|
-
|
|
407
|
+
const result = await handlers.messageSend(toMessageSendParams(body));
|
|
408
|
+
const response = result;
|
|
409
|
+
return ctx.json(response, 200);
|
|
410
|
+
});
|
|
411
|
+
const listTasksRouter = new import_zod_openapi.OpenAPIHono().openapi(listTasksRoute, async (ctx) => {
|
|
285
412
|
const handlers = new import_methods.A2AMethodHandlers(await getAgent(ctx));
|
|
286
413
|
const query = ctx.req.valid("query");
|
|
287
|
-
const result = await handlers.tasksList(query);
|
|
288
|
-
|
|
289
|
-
|
|
414
|
+
const result = await handlers.tasksList(toListTasksParams(query));
|
|
415
|
+
const response = result;
|
|
416
|
+
return ctx.json(response, 200);
|
|
417
|
+
});
|
|
418
|
+
const getTaskRouter = new import_zod_openapi.OpenAPIHono().openapi(getTaskRoute, async (ctx) => {
|
|
290
419
|
const handlers = new import_methods.A2AMethodHandlers(await getAgent(ctx));
|
|
291
420
|
const { id } = ctx.req.valid("param");
|
|
292
421
|
try {
|
|
293
422
|
const task = await handlers.tasksGet({ id });
|
|
294
|
-
|
|
423
|
+
const response = task;
|
|
424
|
+
return ctx.json(response, 200);
|
|
295
425
|
} catch (error) {
|
|
296
426
|
import_core.logger.warn(`Task ${id} not found: ${error}`);
|
|
297
|
-
|
|
427
|
+
const response = { error: "Task not found" };
|
|
428
|
+
return ctx.json(response, 404);
|
|
298
429
|
}
|
|
299
|
-
})
|
|
430
|
+
});
|
|
431
|
+
const cancelTaskRouter = new import_zod_openapi.OpenAPIHono().openapi(cancelTaskRoute, async (ctx) => {
|
|
300
432
|
const handlers = new import_methods.A2AMethodHandlers(await getAgent(ctx));
|
|
301
433
|
const { id } = ctx.req.valid("param");
|
|
302
434
|
import_core.logger.info(`REST: tasks/cancel ${id}`);
|
|
303
435
|
try {
|
|
304
436
|
const task = await handlers.tasksCancel({ id });
|
|
305
|
-
|
|
437
|
+
const response = task;
|
|
438
|
+
return ctx.json(response, 200);
|
|
306
439
|
} catch (error) {
|
|
307
440
|
import_core.logger.error(`Failed to cancel task ${id}: ${error}`);
|
|
308
|
-
|
|
441
|
+
const response = { error: "Task not found" };
|
|
442
|
+
return ctx.json(response, 404);
|
|
309
443
|
}
|
|
310
444
|
});
|
|
445
|
+
mountA2ATasksSubrouter(app, messageSendRouter);
|
|
446
|
+
mountA2ATasksSubrouter(app, listTasksRouter);
|
|
447
|
+
mountA2ATasksSubrouter(app, getTaskRouter);
|
|
448
|
+
mountA2ATasksSubrouter(app, cancelTaskRouter);
|
|
449
|
+
return app;
|
|
311
450
|
}
|
|
312
451
|
// Annotate the CommonJS export names for ESM import in node:
|
|
313
452
|
0 && (module.exports = {
|