@mantyx/sdk 0.22.0 → 0.23.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/CHANGELOG.md +10 -0
- package/dist/a2a-server.cjs.map +1 -1
- package/dist/a2a-server.d.ts +13 -16
- package/dist/a2a-server.d.ts.map +1 -0
- package/dist/a2a-server.js +1 -1
- package/dist/{chunk-5NKXV5XZ.js → chunk-OUK6ZZ5H.js} +87 -14
- package/dist/chunk-OUK6ZZ5H.js.map +1 -0
- package/dist/{client-C7TzTpNW.d.ts → client.d.ts} +131 -840
- package/dist/client.d.ts.map +1 -0
- package/dist/{computer-use-4QzI3lGU.d.ts → computer-use.d.ts} +21 -22
- package/dist/computer-use.d.ts.map +1 -0
- package/dist/errors.d.ts +153 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/index.cjs +88 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +44 -55
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/local-resolver.d.ts +49 -0
- package/dist/local-resolver.d.ts.map +1 -0
- package/dist/oauth.d.ts +189 -0
- package/dist/oauth.d.ts.map +1 -0
- package/dist/playwright.d.ts +6 -11
- package/dist/playwright.d.ts.map +1 -0
- package/dist/sse.d.ts +27 -0
- package/dist/sse.d.ts.map +1 -0
- package/dist/tools.d.ts +426 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/version.d.ts +5 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/zod-to-json-schema.d.ts +25 -0
- package/dist/zod-to-json-schema.d.ts.map +1 -0
- package/docs/agent-runs-protocol.md +52 -16
- package/package.json +11 -11
- package/dist/a2a-server.d.cts +0 -176
- package/dist/chunk-5NKXV5XZ.js.map +0 -1
- package/dist/client-C7TzTpNW.d.cts +0 -2033
- package/dist/computer-use-1m6E_VIl.d.cts +0 -193
- package/dist/index.d.cts +0 -61
- package/dist/playwright.d.cts +0 -88
package/dist/a2a-server.d.cts
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { AgentCard } from '@a2a-js/sdk';
|
|
2
|
-
export { AgentCard, Message, MessageSendParams, Task, TaskArtifactUpdateEvent, TaskStatusUpdateEvent } from '@a2a-js/sdk';
|
|
3
|
-
import { AgentExecutor, RequestContext, ExecutionEventBus } from '@a2a-js/sdk/server';
|
|
4
|
-
export { AgentExecutor, ExecutionEventBus, RequestContext } from '@a2a-js/sdk/server';
|
|
5
|
-
import { M as MantyxClient, T as ToolRef, R as ReasoningLevel, O as OutputSchema } from './client-C7TzTpNW.cjs';
|
|
6
|
-
import 'zod';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Expose a MANTYX agent over the [Agent2Agent (A2A)](https://google-a2a.github.io/A2A/)
|
|
10
|
-
* protocol so other agents can talk to it as a peer.
|
|
11
|
-
*
|
|
12
|
-
* This module is loaded from a separate sub-export (`@mantyx/sdk/a2a-server`) so
|
|
13
|
-
* apps that don't need it never pay the bundle cost of the official A2A SDK or
|
|
14
|
-
* Express. To use it, install the optional peer deps:
|
|
15
|
-
*
|
|
16
|
-
* npm install @a2a-js/sdk express
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* import { MantyxClient } from "@mantyx/sdk";
|
|
20
|
-
* import { serveAgentOverA2A } from "@mantyx/sdk/a2a-server";
|
|
21
|
-
*
|
|
22
|
-
* const client = new MantyxClient({
|
|
23
|
-
* apiKey: process.env.MANTYX_API_KEY!,
|
|
24
|
-
* workspaceSlug: process.env.MANTYX_WORKSPACE_SLUG!,
|
|
25
|
-
* });
|
|
26
|
-
*
|
|
27
|
-
* const server = await serveAgentOverA2A({
|
|
28
|
-
* client,
|
|
29
|
-
* port: 4000,
|
|
30
|
-
* agent: { agentId: "agent_cm6abc123" },
|
|
31
|
-
* agentCard: {
|
|
32
|
-
* name: "Acme Support",
|
|
33
|
-
* description: "Answers billing and account questions.",
|
|
34
|
-
* protocolVersion: "0.3.0",
|
|
35
|
-
* version: "1.0.0",
|
|
36
|
-
* url: "http://localhost:4000",
|
|
37
|
-
* skills: [{ id: "support", name: "Support", description: "Customer support",
|
|
38
|
-
* tags: ["support"] }],
|
|
39
|
-
* capabilities: { streaming: true, pushNotifications: false },
|
|
40
|
-
* defaultInputModes: ["text"],
|
|
41
|
-
* defaultOutputModes: ["text"],
|
|
42
|
-
* },
|
|
43
|
-
* });
|
|
44
|
-
*
|
|
45
|
-
* console.log(`Listening on ${server.url}`);
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Description of the MANTYX agent that should answer A2A requests.
|
|
50
|
-
*
|
|
51
|
-
* Mirrors the existing `runAgent` / `createSession` argument shape:
|
|
52
|
-
* - `agentId` triggers a persisted workspace agent.
|
|
53
|
-
* - `systemPrompt` (with optional `modelId`, `tools`, …) defines an ephemeral
|
|
54
|
-
* agent inline.
|
|
55
|
-
*
|
|
56
|
-
* Either `agentId` or `systemPrompt` is required.
|
|
57
|
-
*/
|
|
58
|
-
interface MantyxAgentSpec {
|
|
59
|
-
/** Reference to a persisted MANTYX agent. Mutually exclusive with `systemPrompt`. */
|
|
60
|
-
agentId?: string;
|
|
61
|
-
/** System prompt for an inline / ephemeral agent. Mutually exclusive with `agentId`. */
|
|
62
|
-
systemPrompt?: string;
|
|
63
|
-
modelId?: string;
|
|
64
|
-
tools?: ToolRef[];
|
|
65
|
-
reasoningLevel?: ReasoningLevel;
|
|
66
|
-
/**
|
|
67
|
-
* Constrains the model's final assistant text to a JSON document matching
|
|
68
|
-
* a JSON Schema (or Zod schema, auto-converted). See
|
|
69
|
-
* {@link OutputSchema} / `docs/wire-protocol.md` §7.
|
|
70
|
-
*/
|
|
71
|
-
outputSchema?: OutputSchema;
|
|
72
|
-
metadata?: Record<string, string>;
|
|
73
|
-
budgets?: {
|
|
74
|
-
maxToolTurns?: number;
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Optional human-readable display name for runs created against MANTYX.
|
|
78
|
-
* Visible in the dashboard. Has no effect on the A2A side.
|
|
79
|
-
*/
|
|
80
|
-
name?: string;
|
|
81
|
-
}
|
|
82
|
-
interface MantyxAgentExecutorOptions {
|
|
83
|
-
client: MantyxClient;
|
|
84
|
-
agent: MantyxAgentSpec;
|
|
85
|
-
/**
|
|
86
|
-
* How to map an incoming A2A `contextId` onto a MANTYX session.
|
|
87
|
-
*
|
|
88
|
-
* - `"auto"` (default): each unique `contextId` opens a MANTYX session on
|
|
89
|
-
* first contact and reuses it for subsequent messages with the same
|
|
90
|
-
* `contextId`. Gives you multi-turn out of the box.
|
|
91
|
-
* - `"stateless"`: every A2A message becomes an independent `runAgent`. No
|
|
92
|
-
* conversational memory; simpler resource model.
|
|
93
|
-
*/
|
|
94
|
-
conversation?: "auto" | "stateless";
|
|
95
|
-
/**
|
|
96
|
-
* LRU cap on the in-memory `contextId -> AgentSession` table. When the cap
|
|
97
|
-
* is exceeded the oldest session is `end()`-ed and evicted. Default: 1024.
|
|
98
|
-
* Only consulted when `conversation: "auto"`.
|
|
99
|
-
*/
|
|
100
|
-
maxSessions?: number;
|
|
101
|
-
/**
|
|
102
|
-
* Receives streaming MANTYX `assistant_delta` text. The default behaviour
|
|
103
|
-
* forwards every delta as a `TaskStatusUpdateEvent` (state: "working")
|
|
104
|
-
* containing the delta as a `text` part — this is what enables A2A
|
|
105
|
-
* `message/stream` clients to see real-time tokens. Override only if you
|
|
106
|
-
* need to swallow them or transform the wire shape.
|
|
107
|
-
*/
|
|
108
|
-
onAssistantDelta?: (delta: string, ctx: RequestContext, eventBus: ExecutionEventBus) => void;
|
|
109
|
-
}
|
|
110
|
-
interface ServeAgentOverA2AOptions extends MantyxAgentExecutorOptions {
|
|
111
|
-
/** A2A Agent Card published at `/.well-known/agent-card.json`. */
|
|
112
|
-
agentCard: AgentCard;
|
|
113
|
-
/** TCP port to listen on. Default: 0 (let the OS pick). */
|
|
114
|
-
port?: number;
|
|
115
|
-
/** Bind address. Default: `"0.0.0.0"`. */
|
|
116
|
-
host?: string;
|
|
117
|
-
/** Path that serves the Agent Card JSON. Default: `"/.well-known/agent-card.json"`. */
|
|
118
|
-
agentCardPath?: string;
|
|
119
|
-
/** Path that serves the JSON-RPC endpoint. Default: `"/"`. */
|
|
120
|
-
jsonRpcPath?: string;
|
|
121
|
-
/**
|
|
122
|
-
* Path that serves the HTTP+JSON/REST endpoint. Default: `"/v1"`.
|
|
123
|
-
* Set to `false` to disable the REST mount entirely.
|
|
124
|
-
*/
|
|
125
|
-
restPath?: string | false;
|
|
126
|
-
}
|
|
127
|
-
interface ServeAgentOverA2AHandle {
|
|
128
|
-
/** Origin of the running server, e.g. `"http://localhost:4000"`. */
|
|
129
|
-
url: string;
|
|
130
|
-
/** Resolved port number (useful when you let the OS pick one). */
|
|
131
|
-
port: number;
|
|
132
|
-
/** Stop the HTTP server, end every cached MANTYX session, and free MCP transports. */
|
|
133
|
-
close: () => Promise<void>;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Implementation of `@a2a-js/sdk`'s `AgentExecutor` that backs a MANTYX agent.
|
|
137
|
-
*
|
|
138
|
-
* Most callers want `serveAgentOverA2A` instead; reach for this class directly
|
|
139
|
-
* when you need to mount the executor inside an existing Express, Fastify, or
|
|
140
|
-
* Connect app.
|
|
141
|
-
*/
|
|
142
|
-
declare class MantyxAgentExecutor implements AgentExecutor {
|
|
143
|
-
readonly client: MantyxClient;
|
|
144
|
-
readonly agent: MantyxAgentSpec;
|
|
145
|
-
readonly conversation: "auto" | "stateless";
|
|
146
|
-
readonly maxSessions: number;
|
|
147
|
-
readonly onAssistantDelta?: MantyxAgentExecutorOptions["onAssistantDelta"];
|
|
148
|
-
/** contextId -> live MANTYX session. Maintained as an LRU map. */
|
|
149
|
-
private readonly sessions;
|
|
150
|
-
/** taskIds we've been asked to cancel; checked between turns. */
|
|
151
|
-
private readonly cancelled;
|
|
152
|
-
/** Pending AbortControllers per task, used for cooperative cancel. */
|
|
153
|
-
private readonly inFlight;
|
|
154
|
-
constructor(options: MantyxAgentExecutorOptions);
|
|
155
|
-
execute(requestContext: RequestContext, eventBus: ExecutionEventBus): Promise<void>;
|
|
156
|
-
cancelTask(taskId: string, eventBus: ExecutionEventBus): Promise<void>;
|
|
157
|
-
/**
|
|
158
|
-
* Close every cached session. Idempotent. Safe to call from server shutdown
|
|
159
|
-
* paths.
|
|
160
|
-
*/
|
|
161
|
-
close(): Promise<void>;
|
|
162
|
-
private runOnce;
|
|
163
|
-
private getOrCreateSession;
|
|
164
|
-
private evictIfNeeded;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Spin up a small HTTP server that exposes a MANTYX agent as an A2A peer.
|
|
168
|
-
* Mounts the Agent Card, JSON-RPC, and (optionally) REST endpoints from the
|
|
169
|
-
* official `@a2a-js/sdk` library.
|
|
170
|
-
*
|
|
171
|
-
* Throws if `express` / `@a2a-js/sdk` aren't installed; install them as peer
|
|
172
|
-
* deps with `npm install express @a2a-js/sdk`.
|
|
173
|
-
*/
|
|
174
|
-
declare function serveAgentOverA2A(options: ServeAgentOverA2AOptions): Promise<ServeAgentOverA2AHandle>;
|
|
175
|
-
|
|
176
|
-
export { MantyxAgentExecutor, type MantyxAgentExecutorOptions, type MantyxAgentSpec, type ServeAgentOverA2AHandle, type ServeAgentOverA2AOptions, serveAgentOverA2A };
|