agents 0.11.3 → 0.11.4
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/browser/ai.js +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/tanstack-ai.js +1 -1
- package/dist/{classPrivateFieldGet2-BVdP0e3Z.js → classPrivateFieldGet2-DAZNVUKb.js} +5 -5
- package/dist/{client-PEDsNnfY.js → client-B_xdiZbn.js} +4 -3
- package/dist/{client-PEDsNnfY.js.map → client-B_xdiZbn.js.map} +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +7 -7
- package/dist/client.js.map +1 -1
- package/dist/experimental/memory/session/index.js +3 -3
- package/dist/experimental/memory/session/index.js.map +1 -1
- package/dist/experimental/webmcp.d.ts +212 -0
- package/dist/experimental/webmcp.js +298 -0
- package/dist/experimental/webmcp.js.map +1 -0
- package/dist/{index-D49HdAiY.d.ts → index-D9qo_Inc.d.ts} +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -16
- package/dist/index.js.map +1 -1
- package/dist/mcp/client.d.ts +1 -1
- package/dist/mcp/client.js +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +5 -5
- package/dist/mcp/index.js.map +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +8 -8
- package/dist/react.js.map +1 -1
- package/dist/{shared-BtPEbm_U.js → shared-BovR6hRc.js} +3 -3
- package/dist/{shared-BtPEbm_U.js.map → shared-BovR6hRc.js.map} +1 -1
- package/dist/workflows.d.ts +1 -1
- package/package.json +11 -4
package/dist/index.js
CHANGED
|
@@ -2,9 +2,9 @@ import { MessageType } from "./types.js";
|
|
|
2
2
|
import { camelCaseToKebabCase } from "./utils.js";
|
|
3
3
|
import { createHeaderBasedEmailResolver, signAgentHeaders } from "./email.js";
|
|
4
4
|
import { __DO_NOT_USE_WILL_BREAK__agentContext } from "./internal_context.js";
|
|
5
|
-
import { i as _classPrivateFieldInitSpec, n as _classPrivateFieldSet2, t as _classPrivateFieldGet2 } from "./classPrivateFieldGet2-
|
|
5
|
+
import { i as _classPrivateFieldInitSpec, n as _classPrivateFieldSet2, t as _classPrivateFieldGet2 } from "./classPrivateFieldGet2-DAZNVUKb.js";
|
|
6
6
|
import { isErrorRetryable, tryN, validateRetryOptions } from "./retries.js";
|
|
7
|
-
import { o as RPC_DO_PREFIX, r as MCPConnectionState, s as DisposableStore, t as MCPClientManager } from "./client-
|
|
7
|
+
import { o as RPC_DO_PREFIX, r as MCPConnectionState, s as DisposableStore, t as MCPClientManager } from "./client-B_xdiZbn.js";
|
|
8
8
|
import { DurableObjectOAuthClientProvider } from "./mcp/do-oauth-client-provider.js";
|
|
9
9
|
import { genericObservability } from "./observability/index.js";
|
|
10
10
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -19,13 +19,13 @@ let _Symbol$dispose;
|
|
|
19
19
|
* Type guard for RPC request messages
|
|
20
20
|
*/
|
|
21
21
|
function isRPCRequest(msg) {
|
|
22
|
-
return typeof msg === "object" && msg !== null && "type" in msg && msg.type ===
|
|
22
|
+
return typeof msg === "object" && msg !== null && "type" in msg && msg.type === "rpc" && "id" in msg && typeof msg.id === "string" && "method" in msg && typeof msg.method === "string" && "args" in msg && Array.isArray(msg.args);
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Type guard for state update messages
|
|
26
26
|
*/
|
|
27
27
|
function isStateUpdateMessage(msg) {
|
|
28
|
-
return typeof msg === "object" && msg !== null && "type" in msg && msg.type ===
|
|
28
|
+
return typeof msg === "object" && msg !== null && "type" in msg && msg.type === "cf_agent_state" && "state" in msg;
|
|
29
29
|
}
|
|
30
30
|
const callableMetadata = /* @__PURE__ */ new WeakMap();
|
|
31
31
|
/**
|
|
@@ -535,7 +535,7 @@ var Agent = class Agent extends Server {
|
|
|
535
535
|
if (isStateUpdateMessage(parsed)) {
|
|
536
536
|
if (this.isConnectionReadonly(connection)) {
|
|
537
537
|
connection.send(JSON.stringify({
|
|
538
|
-
type:
|
|
538
|
+
type: "cf_agent_state_error",
|
|
539
539
|
error: "Connection is readonly"
|
|
540
540
|
}));
|
|
541
541
|
return;
|
|
@@ -545,7 +545,7 @@ var Agent = class Agent extends Server {
|
|
|
545
545
|
} catch (e) {
|
|
546
546
|
console.error("[Agent] State update rejected:", e);
|
|
547
547
|
connection.send(JSON.stringify({
|
|
548
|
-
type:
|
|
548
|
+
type: "cf_agent_state_error",
|
|
549
549
|
error: "State update rejected"
|
|
550
550
|
}));
|
|
551
551
|
}
|
|
@@ -586,7 +586,7 @@ var Agent = class Agent extends Server {
|
|
|
586
586
|
id,
|
|
587
587
|
result,
|
|
588
588
|
success: true,
|
|
589
|
-
type:
|
|
589
|
+
type: "rpc"
|
|
590
590
|
};
|
|
591
591
|
connection.send(JSON.stringify(response));
|
|
592
592
|
} catch (e) {
|
|
@@ -594,7 +594,7 @@ var Agent = class Agent extends Server {
|
|
|
594
594
|
error: e instanceof Error ? e.message : "Unknown error occurred",
|
|
595
595
|
id: parsed.id,
|
|
596
596
|
success: false,
|
|
597
|
-
type:
|
|
597
|
+
type: "rpc"
|
|
598
598
|
};
|
|
599
599
|
connection.send(JSON.stringify(response));
|
|
600
600
|
console.error("RPC error:", e);
|
|
@@ -630,16 +630,16 @@ var Agent = class Agent extends Server {
|
|
|
630
630
|
connection.send(JSON.stringify({
|
|
631
631
|
name: this.name,
|
|
632
632
|
agent: camelCaseToKebabCase(this._ParentClass.name),
|
|
633
|
-
type:
|
|
633
|
+
type: "cf_agent_identity"
|
|
634
634
|
}));
|
|
635
635
|
}
|
|
636
636
|
if (this.state) connection.send(JSON.stringify({
|
|
637
637
|
state: this.state,
|
|
638
|
-
type:
|
|
638
|
+
type: "cf_agent_state"
|
|
639
639
|
}));
|
|
640
640
|
connection.send(JSON.stringify({
|
|
641
641
|
mcp: this.getMcpServers(),
|
|
642
|
-
type:
|
|
642
|
+
type: "cf_agent_mcp_servers"
|
|
643
643
|
}));
|
|
644
644
|
} else this._setConnectionNoProtocol(connection);
|
|
645
645
|
this._emit("connect", { connectionId: connection.id });
|
|
@@ -744,7 +744,7 @@ var Agent = class Agent extends Server {
|
|
|
744
744
|
`;
|
|
745
745
|
this._broadcastProtocol(JSON.stringify({
|
|
746
746
|
state: nextState,
|
|
747
|
-
type:
|
|
747
|
+
type: "cf_agent_state"
|
|
748
748
|
}), source !== "server" ? [source.id] : []);
|
|
749
749
|
const { connection, request, email } = __DO_NOT_USE_WILL_BREAK__agentContext.getStore() || {};
|
|
750
750
|
this.ctx.waitUntil((async () => {
|
|
@@ -3034,7 +3034,7 @@ var Agent = class Agent extends Server {
|
|
|
3034
3034
|
broadcastMcpServers() {
|
|
3035
3035
|
this._broadcastProtocol(JSON.stringify({
|
|
3036
3036
|
mcp: this.getMcpServers(),
|
|
3037
|
-
type:
|
|
3037
|
+
type: "cf_agent_mcp_servers"
|
|
3038
3038
|
}));
|
|
3039
3039
|
}
|
|
3040
3040
|
/**
|
|
@@ -3225,7 +3225,7 @@ var StreamingResponse = class {
|
|
|
3225
3225
|
id: this._id,
|
|
3226
3226
|
result: chunk,
|
|
3227
3227
|
success: true,
|
|
3228
|
-
type:
|
|
3228
|
+
type: "rpc"
|
|
3229
3229
|
};
|
|
3230
3230
|
this._connection.send(JSON.stringify(response));
|
|
3231
3231
|
return true;
|
|
@@ -3243,7 +3243,7 @@ var StreamingResponse = class {
|
|
|
3243
3243
|
id: this._id,
|
|
3244
3244
|
result: finalChunk,
|
|
3245
3245
|
success: true,
|
|
3246
|
-
type:
|
|
3246
|
+
type: "rpc"
|
|
3247
3247
|
};
|
|
3248
3248
|
this._connection.send(JSON.stringify(response));
|
|
3249
3249
|
return true;
|
|
@@ -3260,7 +3260,7 @@ var StreamingResponse = class {
|
|
|
3260
3260
|
error: message,
|
|
3261
3261
|
id: this._id,
|
|
3262
3262
|
success: false,
|
|
3263
|
-
type:
|
|
3263
|
+
type: "rpc"
|
|
3264
3264
|
};
|
|
3265
3265
|
this._connection.send(JSON.stringify(response));
|
|
3266
3266
|
return true;
|