@dexto/server 1.4.0 → 1.5.0
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/hono/__tests__/test-fixtures.cjs +1 -1
- package/dist/hono/__tests__/test-fixtures.d.ts.map +1 -1
- package/dist/hono/__tests__/test-fixtures.js +1 -1
- package/dist/hono/index.cjs +41 -5
- package/dist/hono/index.d.ts +451 -452
- package/dist/hono/index.d.ts.map +1 -1
- package/dist/hono/index.js +41 -5
- package/dist/hono/routes/a2a-jsonrpc.cjs +3 -3
- package/dist/hono/routes/a2a-jsonrpc.d.ts +4 -1
- package/dist/hono/routes/a2a-jsonrpc.d.ts.map +1 -1
- package/dist/hono/routes/a2a-jsonrpc.js +3 -3
- package/dist/hono/routes/a2a-tasks.cjs +5 -5
- package/dist/hono/routes/a2a-tasks.d.ts +13 -10
- package/dist/hono/routes/a2a-tasks.d.ts.map +1 -1
- package/dist/hono/routes/a2a-tasks.js +5 -5
- package/dist/hono/routes/agents.cjs +25 -35
- package/dist/hono/routes/agents.d.ts +6 -407
- package/dist/hono/routes/agents.d.ts.map +1 -1
- package/dist/hono/routes/agents.js +25 -35
- package/dist/hono/routes/approvals.cjs +2 -2
- package/dist/hono/routes/approvals.d.ts +4 -1
- package/dist/hono/routes/approvals.d.ts.map +1 -1
- package/dist/hono/routes/approvals.js +2 -2
- package/dist/hono/routes/discovery.cjs +67 -0
- package/dist/hono/routes/discovery.d.ts +44 -0
- package/dist/hono/routes/discovery.d.ts.map +1 -0
- package/dist/hono/routes/discovery.js +43 -0
- package/dist/hono/routes/greeting.cjs +2 -2
- package/dist/hono/routes/greeting.d.ts +2 -2
- package/dist/hono/routes/greeting.d.ts.map +1 -1
- package/dist/hono/routes/greeting.js +2 -2
- package/dist/hono/routes/health.d.ts +2 -2
- package/dist/hono/routes/health.d.ts.map +1 -1
- package/dist/hono/routes/key.cjs +110 -0
- package/dist/hono/routes/key.d.ts +48 -0
- package/dist/hono/routes/key.d.ts.map +1 -0
- package/dist/hono/routes/key.js +90 -0
- package/dist/hono/routes/llm.cjs +12 -34
- package/dist/hono/routes/llm.d.ts +173 -25
- package/dist/hono/routes/llm.d.ts.map +1 -1
- package/dist/hono/routes/llm.js +12 -35
- package/dist/hono/routes/mcp.cjs +8 -8
- package/dist/hono/routes/mcp.d.ts +2 -2
- package/dist/hono/routes/mcp.d.ts.map +1 -1
- package/dist/hono/routes/mcp.js +8 -8
- package/dist/hono/routes/memory.cjs +5 -5
- package/dist/hono/routes/memory.d.ts +4 -1
- package/dist/hono/routes/memory.d.ts.map +1 -1
- package/dist/hono/routes/memory.js +5 -5
- package/dist/hono/routes/messages.cjs +4 -4
- package/dist/hono/routes/messages.d.ts +12 -12
- package/dist/hono/routes/messages.d.ts.map +1 -1
- package/dist/hono/routes/messages.js +4 -4
- package/dist/hono/routes/models.cjs +319 -0
- package/dist/hono/routes/models.d.ts +107 -0
- package/dist/hono/routes/models.d.ts.map +1 -0
- package/dist/hono/routes/models.js +305 -0
- package/dist/hono/routes/openrouter.cjs +153 -0
- package/dist/hono/routes/openrouter.d.ts +54 -0
- package/dist/hono/routes/openrouter.d.ts.map +1 -0
- package/dist/hono/routes/openrouter.js +134 -0
- package/dist/hono/routes/prompts.cjs +5 -5
- package/dist/hono/routes/prompts.d.ts +4 -1
- package/dist/hono/routes/prompts.d.ts.map +1 -1
- package/dist/hono/routes/prompts.js +5 -5
- package/dist/hono/routes/queue.cjs +4 -4
- package/dist/hono/routes/queue.d.ts +4 -1
- package/dist/hono/routes/queue.d.ts.map +1 -1
- package/dist/hono/routes/queue.js +4 -4
- package/dist/hono/routes/resources.cjs +3 -3
- package/dist/hono/routes/resources.d.ts +2 -2
- package/dist/hono/routes/resources.d.ts.map +1 -1
- package/dist/hono/routes/resources.js +3 -3
- package/dist/hono/routes/search.cjs +2 -2
- package/dist/hono/routes/search.d.ts +6 -3
- package/dist/hono/routes/search.d.ts.map +1 -1
- package/dist/hono/routes/search.js +2 -2
- package/dist/hono/routes/sessions.cjs +9 -9
- package/dist/hono/routes/sessions.d.ts +3 -3
- package/dist/hono/routes/sessions.d.ts.map +1 -1
- package/dist/hono/routes/sessions.js +9 -9
- package/dist/hono/routes/tools.cjs +126 -0
- package/dist/hono/routes/tools.d.ts +42 -0
- package/dist/hono/routes/tools.d.ts.map +1 -0
- package/dist/hono/routes/tools.js +102 -0
- package/dist/hono/routes/webhooks.cjs +4 -4
- package/dist/hono/routes/webhooks.d.ts +4 -1
- package/dist/hono/routes/webhooks.d.ts.map +1 -1
- package/dist/hono/routes/webhooks.js +4 -4
- package/dist/hono/schemas/responses.d.ts +41 -41
- package/dist/hono/start-server.cjs +102 -0
- package/dist/hono/start-server.d.ts +61 -0
- package/dist/hono/start-server.d.ts.map +1 -0
- package/dist/hono/start-server.js +78 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/package.json +5 -4
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Server } from 'node:http';
|
|
2
|
+
import type { DextoAgent, AgentCard } from '@dexto/core';
|
|
3
|
+
import type { DextoApp } from './types.js';
|
|
4
|
+
import type { WebUIRuntimeConfig } from './routes/static.js';
|
|
5
|
+
export type StartDextoServerOptions = {
|
|
6
|
+
/** Port to listen on. Defaults to 3000 or process.env.PORT */
|
|
7
|
+
port?: number;
|
|
8
|
+
/** Hostname to bind to. Defaults to 0.0.0.0 */
|
|
9
|
+
hostname?: string;
|
|
10
|
+
/** Override agent card metadata (name, version, etc.) */
|
|
11
|
+
agentCard?: Partial<AgentCard>;
|
|
12
|
+
/** Absolute path to WebUI build output. If provided, static files will be served. */
|
|
13
|
+
webRoot?: string;
|
|
14
|
+
/** Runtime configuration to inject into WebUI (analytics, etc.) */
|
|
15
|
+
webUIConfig?: WebUIRuntimeConfig;
|
|
16
|
+
/** Base URL for agent card. Defaults to http://localhost:{port} */
|
|
17
|
+
baseUrl?: string;
|
|
18
|
+
};
|
|
19
|
+
export type StartDextoServerResult = {
|
|
20
|
+
/** HTTP server instance */
|
|
21
|
+
server: Server;
|
|
22
|
+
/** Hono app instance */
|
|
23
|
+
app: DextoApp;
|
|
24
|
+
/** Stop the server and agent gracefully */
|
|
25
|
+
stop: () => Promise<void>;
|
|
26
|
+
/** Agent card with resolved metadata */
|
|
27
|
+
agentCard: AgentCard;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Start a Dexto server with minimal configuration.
|
|
31
|
+
*
|
|
32
|
+
* This is a high-level helper that:
|
|
33
|
+
* 1. Creates event subscribers and approval coordinator
|
|
34
|
+
* 2. Creates and configures the Hono app
|
|
35
|
+
* 3. Wires up all the infrastructure (SSE, webhooks, approvals)
|
|
36
|
+
* 4. Starts the agent
|
|
37
|
+
* 5. Starts the HTTP server
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* // Register providers (filesystem-tools, process-tools, etc.)
|
|
42
|
+
* import '@dexto/image-local';
|
|
43
|
+
*
|
|
44
|
+
* import { DextoAgent } from '@dexto/core';
|
|
45
|
+
* import { loadAgentConfig } from '@dexto/agent-management';
|
|
46
|
+
* import { startDextoServer } from '@dexto/server';
|
|
47
|
+
*
|
|
48
|
+
* const config = await loadAgentConfig('./agents/default.yml');
|
|
49
|
+
* const agent = new DextoAgent(config, './agents/default.yml');
|
|
50
|
+
*
|
|
51
|
+
* const { server, stop } = await startDextoServer(agent, {
|
|
52
|
+
* port: 3000,
|
|
53
|
+
* agentCard: { name: 'My Agent' }
|
|
54
|
+
* });
|
|
55
|
+
*
|
|
56
|
+
* // Server is now running at http://localhost:3000
|
|
57
|
+
* // To stop: await stop();
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function startDextoServer(agent: DextoAgent, options?: StartDextoServerOptions): Promise<StartDextoServerResult>;
|
|
61
|
+
//# sourceMappingURL=start-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-server.d.ts","sourceRoot":"","sources":["../../src/hono/start-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAM7D,MAAM,MAAM,uBAAuB,GAAG;IAClC,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC/B,qFAAqF;IACrF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACjC,2BAA2B;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,GAAG,EAAE,QAAQ,CAAC;IACd,2CAA2C;IAC3C,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,wCAAwC;IACxC,SAAS,EAAE,SAAS,CAAC;CACxB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,gBAAgB,CAClC,KAAK,EAAE,UAAU,EACjB,OAAO,GAAE,uBAA4B,GACtC,OAAO,CAAC,sBAAsB,CAAC,CA2FjC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { createAgentCard, logger } from "@dexto/core";
|
|
2
|
+
import { createDextoApp } from "./index.js";
|
|
3
|
+
import { createNodeServer } from "./node/index.js";
|
|
4
|
+
import { WebhookEventSubscriber } from "../events/webhook-subscriber.js";
|
|
5
|
+
import { A2ASseEventSubscriber } from "../events/a2a-sse-subscriber.js";
|
|
6
|
+
import { ApprovalCoordinator } from "../approval/approval-coordinator.js";
|
|
7
|
+
import { createManualApprovalHandler } from "../approval/manual-approval-handler.js";
|
|
8
|
+
async function startDextoServer(agent, options = {}) {
|
|
9
|
+
const {
|
|
10
|
+
port: requestedPort,
|
|
11
|
+
hostname = "0.0.0.0",
|
|
12
|
+
agentCard: agentCardOverride = {},
|
|
13
|
+
webRoot,
|
|
14
|
+
webUIConfig,
|
|
15
|
+
baseUrl: baseUrlOverride
|
|
16
|
+
} = options;
|
|
17
|
+
const resolvedPort = requestedPort ?? (process.env.PORT ? Number(process.env.PORT) : 3e3);
|
|
18
|
+
const baseUrl = baseUrlOverride ?? `http://localhost:${resolvedPort}`;
|
|
19
|
+
logger.info(`Initializing Dexto server on ${hostname}:${resolvedPort}...`);
|
|
20
|
+
const agentCard = createAgentCard(
|
|
21
|
+
{
|
|
22
|
+
defaultName: agentCardOverride.name ?? "dexto-agent",
|
|
23
|
+
defaultVersion: agentCardOverride.version ?? "1.0.0",
|
|
24
|
+
defaultBaseUrl: baseUrl
|
|
25
|
+
},
|
|
26
|
+
agentCardOverride
|
|
27
|
+
);
|
|
28
|
+
logger.debug("Creating event infrastructure...");
|
|
29
|
+
const webhookSubscriber = new WebhookEventSubscriber();
|
|
30
|
+
const sseSubscriber = new A2ASseEventSubscriber();
|
|
31
|
+
const approvalCoordinator = new ApprovalCoordinator();
|
|
32
|
+
logger.debug("Creating Hono application...");
|
|
33
|
+
const app = createDextoApp({
|
|
34
|
+
getAgent: (_ctx) => agent,
|
|
35
|
+
getAgentCard: () => agentCard,
|
|
36
|
+
approvalCoordinator,
|
|
37
|
+
webhookSubscriber,
|
|
38
|
+
sseSubscriber,
|
|
39
|
+
...webRoot ? { webRoot } : {},
|
|
40
|
+
...webUIConfig ? { webUIConfig } : {}
|
|
41
|
+
});
|
|
42
|
+
logger.debug("Creating Node.js HTTP server...");
|
|
43
|
+
const { server, webhookSubscriber: bridgeWebhookSubscriber } = createNodeServer(app, {
|
|
44
|
+
getAgent: () => agent,
|
|
45
|
+
port: resolvedPort,
|
|
46
|
+
hostname
|
|
47
|
+
});
|
|
48
|
+
if (bridgeWebhookSubscriber) {
|
|
49
|
+
logger.debug("Registering webhook subscriber with agent...");
|
|
50
|
+
agent.registerSubscriber(bridgeWebhookSubscriber);
|
|
51
|
+
}
|
|
52
|
+
const needsHandler = agent.config.toolConfirmation?.mode === "manual" || agent.config.elicitation.enabled;
|
|
53
|
+
if (needsHandler) {
|
|
54
|
+
logger.debug("Setting up manual approval handler...");
|
|
55
|
+
const handler = createManualApprovalHandler(approvalCoordinator);
|
|
56
|
+
agent.setApprovalHandler(handler);
|
|
57
|
+
}
|
|
58
|
+
logger.debug("Wiring event subscribers to agent...");
|
|
59
|
+
webhookSubscriber.subscribe(agent.agentEventBus);
|
|
60
|
+
sseSubscriber.subscribe(agent.agentEventBus);
|
|
61
|
+
logger.info("Starting agent...");
|
|
62
|
+
await agent.start();
|
|
63
|
+
logger.info(`Server running at http://${hostname}:${resolvedPort}`, null, "green");
|
|
64
|
+
return {
|
|
65
|
+
server,
|
|
66
|
+
app,
|
|
67
|
+
agentCard,
|
|
68
|
+
stop: async () => {
|
|
69
|
+
logger.info("Stopping Dexto server...");
|
|
70
|
+
await agent.stop();
|
|
71
|
+
server.close();
|
|
72
|
+
logger.info("Server stopped", null, "yellow");
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
startDextoServer
|
|
78
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -17,6 +17,7 @@ var index_exports = {};
|
|
|
17
17
|
module.exports = __toCommonJS(index_exports);
|
|
18
18
|
__reExport(index_exports, require("./hono/index.js"), module.exports);
|
|
19
19
|
__reExport(index_exports, require("./hono/node/index.js"), module.exports);
|
|
20
|
+
__reExport(index_exports, require("./hono/start-server.js"), module.exports);
|
|
20
21
|
__reExport(index_exports, require("./events/webhook-subscriber.js"), module.exports);
|
|
21
22
|
__reExport(index_exports, require("./events/a2a-sse-subscriber.js"), module.exports);
|
|
22
23
|
__reExport(index_exports, require("./events/webhook-types.js"), module.exports);
|
|
@@ -28,6 +29,7 @@ __reExport(index_exports, require("./approval/approval-coordinator.js"), module.
|
|
|
28
29
|
0 && (module.exports = {
|
|
29
30
|
...require("./hono/index.js"),
|
|
30
31
|
...require("./hono/node/index.js"),
|
|
32
|
+
...require("./hono/start-server.js"),
|
|
31
33
|
...require("./events/webhook-subscriber.js"),
|
|
32
34
|
...require("./events/a2a-sse-subscriber.js"),
|
|
33
35
|
...require("./events/webhook-types.js"),
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,YAAY,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uCAAuC,CAAC;AACtD,cAAc,oCAAoC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,YAAY,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uCAAuC,CAAC;AACtD,cAAc,oCAAoC,CAAC"}
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dexto/server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -30,9 +30,10 @@
|
|
|
30
30
|
"hono": "^4.6.8",
|
|
31
31
|
"ws": "^8.18.1",
|
|
32
32
|
"yaml": "^2.7.1",
|
|
33
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
34
|
-
"@dexto/agent-management": "1.
|
|
35
|
-
"@dexto/core": "1.
|
|
33
|
+
"@modelcontextprotocol/sdk": "^1.25.2",
|
|
34
|
+
"@dexto/agent-management": "1.5.0",
|
|
35
|
+
"@dexto/core": "1.5.0",
|
|
36
|
+
"@dexto/image-local": "1.5.0"
|
|
36
37
|
},
|
|
37
38
|
"files": [
|
|
38
39
|
"dist",
|