@theokit/sdk 4.55.0 → 4.57.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 +134 -0
- package/dist/a2a/index.cjs +13 -4
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.d.cts +1 -1
- package/dist/a2a/index.d.ts +1 -1
- package/dist/a2a/index.js +13 -5
- package/dist/a2a/index.js.map +1 -1
- package/dist/a2a/message-bus.d.cts +33 -4
- package/dist/a2a/message-bus.d.ts +33 -4
- package/dist/{agent-R2HOJFZJ.cjs → agent-2T2EJIP6.cjs} +12 -11
- package/dist/{agent-R2HOJFZJ.cjs.map → agent-2T2EJIP6.cjs.map} +1 -1
- package/dist/{agent-HDEVVUBS.js → agent-ZIYCVEZL.js} +11 -10
- package/dist/{agent-HDEVVUBS.js.map → agent-ZIYCVEZL.js.map} +1 -1
- package/dist/agent-session-store-G2BMUZQV.js +7 -0
- package/dist/{agent-session-store-P6V3FINW.js.map → agent-session-store-G2BMUZQV.js.map} +1 -1
- package/dist/agent-session-store-WAKLOKWK.cjs +24 -0
- package/dist/{agent-session-store-ZJ3JSRS4.cjs.map → agent-session-store-WAKLOKWK.cjs.map} +1 -1
- package/dist/{chunk-HLPSLDGL.cjs → chunk-43GFJ5SD.cjs} +7 -7
- package/dist/{chunk-HLPSLDGL.cjs.map → chunk-43GFJ5SD.cjs.map} +1 -1
- package/dist/{chunk-5PHVENFV.js → chunk-7FHZ4VQX.js} +3 -55
- package/dist/chunk-7FHZ4VQX.js.map +1 -0
- package/dist/{chunk-I5BE5M5L.js → chunk-7TCRNXNK.js} +51 -31
- package/dist/chunk-7TCRNXNK.js.map +1 -0
- package/dist/{chunk-JHPGF3FP.cjs → chunk-BUIK7GUA.cjs} +22 -2
- package/dist/chunk-BUIK7GUA.cjs.map +1 -0
- package/dist/{chunk-Q47R5E2X.cjs → chunk-E3WZ6Y4H.cjs} +7 -59
- package/dist/chunk-E3WZ6Y4H.cjs.map +1 -0
- package/dist/{chunk-5UOVYM3P.cjs → chunk-E7JHD6QJ.cjs} +132 -54
- package/dist/chunk-E7JHD6QJ.cjs.map +1 -0
- package/dist/{chunk-DZBSJX6J.js → chunk-FKMUFNQE.js} +21 -4
- package/dist/chunk-FKMUFNQE.js.map +1 -0
- package/dist/{chunk-BMAZLQQ4.js → chunk-G24KZRSA.js} +3 -3
- package/dist/{chunk-BMAZLQQ4.js.map → chunk-G24KZRSA.js.map} +1 -1
- package/dist/{chunk-DAPSQZT4.js → chunk-G6EEYRDD.js} +132 -55
- package/dist/chunk-G6EEYRDD.js.map +1 -0
- package/dist/{chunk-MVAPK2BX.js → chunk-IACR5LEM.js} +3 -3
- package/dist/{chunk-MVAPK2BX.js.map → chunk-IACR5LEM.js.map} +1 -1
- package/dist/{chunk-V2UUGUY4.cjs → chunk-KKK3FZ4A.cjs} +6 -6
- package/dist/{chunk-V2UUGUY4.cjs.map → chunk-KKK3FZ4A.cjs.map} +1 -1
- package/dist/chunk-KRD3GQAA.cjs +71 -0
- package/dist/chunk-KRD3GQAA.cjs.map +1 -0
- package/dist/chunk-KVNWIAO4.js +68 -0
- package/dist/chunk-KVNWIAO4.js.map +1 -0
- package/dist/{chunk-IVNNSANC.js → chunk-LEM2GOMI.js} +3 -3
- package/dist/{chunk-IVNNSANC.js.map → chunk-LEM2GOMI.js.map} +1 -1
- package/dist/{chunk-F5WMX4EA.cjs → chunk-M2JWHKO6.cjs} +107 -87
- package/dist/chunk-M2JWHKO6.cjs.map +1 -0
- package/dist/{chunk-YPJ5NH5N.cjs → chunk-QI7WE46I.cjs} +29 -6
- package/dist/chunk-QI7WE46I.cjs.map +1 -0
- package/dist/{chunk-OHBIUXKM.js → chunk-WG7R5W6R.js} +4 -4
- package/dist/{chunk-OHBIUXKM.js.map → chunk-WG7R5W6R.js.map} +1 -1
- package/dist/{chunk-ITSSOVOB.cjs → chunk-X7O4255I.cjs} +4 -4
- package/dist/{chunk-ITSSOVOB.cjs.map → chunk-X7O4255I.cjs.map} +1 -1
- package/dist/{chunk-GJ6RK75E.js → chunk-YJDH3CKG.js} +29 -6
- package/dist/chunk-YJDH3CKG.js.map +1 -0
- package/dist/{chunk-CTCGWIUD.cjs → chunk-Z4BCLVTI.cjs} +5 -5
- package/dist/{chunk-CTCGWIUD.cjs.map → chunk-Z4BCLVTI.cjs.map} +1 -1
- package/dist/{compact-session-FUJDVF7B.js → compact-session-QGDNP45U.js} +4 -4
- package/dist/{compact-session-FUJDVF7B.js.map → compact-session-QGDNP45U.js.map} +1 -1
- package/dist/{compact-session-LEWF554G.cjs → compact-session-YHFQIXV5.cjs} +12 -12
- package/dist/{compact-session-LEWF554G.cjs.map → compact-session-YHFQIXV5.cjs.map} +1 -1
- package/dist/context/index.cjs +6 -5
- package/dist/context/index.cjs.map +1 -1
- package/dist/context/index.js +3 -2
- package/dist/context/index.js.map +1 -1
- package/dist/cron.cjs +11 -10
- package/dist/cron.js +10 -9
- package/dist/eval.cjs +10 -9
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +9 -8
- package/dist/eval.js.map +1 -1
- package/dist/{fs-session-store-IN7JTTXD.js → fs-session-store-4BHGIWRE.js} +4 -4
- package/dist/{fs-session-store-IN7JTTXD.js.map → fs-session-store-4BHGIWRE.js.map} +1 -1
- package/dist/{fs-session-store-3MOJQGP2.cjs → fs-session-store-XZ7ZTB3A.cjs} +5 -5
- package/dist/{fs-session-store-3MOJQGP2.cjs.map → fs-session-store-XZ7ZTB3A.cjs.map} +1 -1
- package/dist/{index-manager-NG5YENWO.cjs → index-manager-AO4LJQZ4.cjs} +5 -4
- package/dist/{index-manager-NG5YENWO.cjs.map → index-manager-AO4LJQZ4.cjs.map} +1 -1
- package/dist/{index-manager-ZMRJ6ZII.js → index-manager-QDPIYIGV.js} +4 -3
- package/dist/{index-manager-ZMRJ6ZII.js.map → index-manager-QDPIYIGV.js.map} +1 -1
- package/dist/index.cjs +40 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -12
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-WQGGMCQY.cjs → inject-session-MLCJMYDG.cjs} +7 -7
- package/dist/{inject-session-WQGGMCQY.cjs.map → inject-session-MLCJMYDG.cjs.map} +1 -1
- package/dist/{inject-session-BJMJH5BX.js → inject-session-RBQZ45UM.js} +5 -5
- package/dist/{inject-session-BJMJH5BX.js.map → inject-session-RBQZ45UM.js.map} +1 -1
- package/dist/internal/memory/storage/markdown-store.d.ts +14 -2
- package/dist/internal/memory/storage/memory-file.d.ts +54 -0
- package/dist/internal/memory/types.d.ts +28 -0
- package/dist/internal/persistence/session-transcript.d.cts +40 -1
- package/dist/internal/persistence/session-transcript.d.ts +40 -1
- package/dist/persistence.cjs +4 -4
- package/dist/persistence.js +1 -1
- package/dist/sandbox/index.cjs +1 -1
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.js +1 -1
- package/dist/sandbox/index.js.map +1 -1
- package/dist/session-transcript-HF5GEU5M.cjs +63 -0
- package/dist/{session-transcript-JXHFTB7G.cjs.map → session-transcript-HF5GEU5M.cjs.map} +1 -1
- package/dist/session-transcript-P462ZRHX.js +6 -0
- package/dist/{session-transcript-AKDYYGXQ.js.map → session-transcript-P462ZRHX.js.map} +1 -1
- package/docs/error-codes.md +7 -5
- package/docs/harness-capability-map.md +3 -2
- package/package.json +5 -9
- package/dist/agent-session-store-P6V3FINW.js +0 -7
- package/dist/agent-session-store-ZJ3JSRS4.cjs +0 -24
- package/dist/chunk-5PHVENFV.js.map +0 -1
- package/dist/chunk-5UOVYM3P.cjs.map +0 -1
- package/dist/chunk-DAPSQZT4.js.map +0 -1
- package/dist/chunk-DZBSJX6J.js.map +0 -1
- package/dist/chunk-F5WMX4EA.cjs.map +0 -1
- package/dist/chunk-GJ6RK75E.js.map +0 -1
- package/dist/chunk-I5BE5M5L.js.map +0 -1
- package/dist/chunk-JHPGF3FP.cjs.map +0 -1
- package/dist/chunk-Q47R5E2X.cjs.map +0 -1
- package/dist/chunk-YPJ5NH5N.cjs.map +0 -1
- package/dist/session-transcript-AKDYYGXQ.js +0 -6
- package/dist/session-transcript-JXHFTB7G.cjs +0 -51
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,139 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.57.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 43e4247: A memory fact's `kind` can now actually be written. `Remember (feedback): prefer tabs` types the
|
|
8
|
+
fact; a bare `Remember:` leaves it untyped, as before.
|
|
9
|
+
|
|
10
|
+
The field was added so the local memory store would converge with the format Claude Code uses, and
|
|
11
|
+
it worked in one direction only: the SDK read a kind off an existing memory and honoured it, but no
|
|
12
|
+
path could ever produce one. `appendMemoryFact` rebuilt the fact as `{ text }` alone, so a kind was
|
|
13
|
+
severed at the single chokepoint every write passes through — the round-trip through the file format
|
|
14
|
+
was real and unreachable.
|
|
15
|
+
|
|
16
|
+
Only the four kinds the store accepts (`user`, `feedback`, `project`, `reference`) are recognised, so
|
|
17
|
+
an arbitrary parenthetical is never mistaken for one and no fact is silently typed wrong. `modified`
|
|
18
|
+
is still stamped by the SDK and ignored when supplied: a timestamp the caller controls can lie about
|
|
19
|
+
when something was learned, which defeats weighing a note from this morning against one from four
|
|
20
|
+
months ago.
|
|
21
|
+
|
|
22
|
+
- b85dab4: Session transcripts are now named with a UUID, so the Claude Code CLI can actually `--continue` a
|
|
23
|
+
session this SDK wrote.
|
|
24
|
+
|
|
25
|
+
That interoperability is the difference this project claims over a proprietary session store, and it
|
|
26
|
+
did not hold. Measured against CLI 2.1.236: a transcript resumes only when its basename is a UUID —
|
|
27
|
+
`billing-bot.jsonl` and `agent-<uuid>.jsonl` are both ignored, silently, with the session simply not
|
|
28
|
+
offered. Every session written under a human-readable agent id was invisible.
|
|
29
|
+
|
|
30
|
+
The filename is now derived from the agent id with a UUIDv8 over SHA-256, so it is deterministic:
|
|
31
|
+
the same agent id always yields the same transcript and nothing has to be persisted to map one back
|
|
32
|
+
to the other. Version 8 is RFC 9562's slot for an implementation-defined scheme, which is what this
|
|
33
|
+
is — v5 would have been the obvious choice but RFC 4122 fixes its hash to SHA-1, and a weak
|
|
34
|
+
primitive in the tree costs a permanent argument with every scanner that sees it. An
|
|
35
|
+
agent id that is already a UUID passes through unchanged, so a transcript Claude Code wrote keeps its
|
|
36
|
+
own name and the two directions stay symmetric.
|
|
37
|
+
|
|
38
|
+
Existing transcripts are not orphaned: a session whose file already exists under the old name keeps
|
|
39
|
+
using it, so history continues to accumulate in one place rather than being abandoned for an empty
|
|
40
|
+
file under the new name. Those sessions do not gain `--continue` support — their name is what the CLI
|
|
41
|
+
cannot read — but nothing that was written is lost or hidden.
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- 18a68a0: A provider that does not take its credential from the caller is no longer refused for lacking one.
|
|
46
|
+
`createLocalAgent` read the provider descriptor two lines below the `throw` that guaranteed
|
|
47
|
+
execution never reached it, so `ollama/llama3.2` failed with `missing_api_key` before any runtime
|
|
48
|
+
work began — and so did every OAuth profile, Bedrock and Vertex.
|
|
49
|
+
|
|
50
|
+
Only `authType: "api_key"` requires a key from the caller. The other four modes source their own:
|
|
51
|
+
`none` sends no Authorization header at all, and `aws_bearer` / `gcp_oauth` / `oauth_device_code` /
|
|
52
|
+
`oauth_external` build their client with a placeholder and resolve a real token at stream time.
|
|
53
|
+
|
|
54
|
+
Fail-closed is preserved in both directions that matter: an unregistered provider prefix yields no
|
|
55
|
+
profile and is still refused, so a typo cannot become a free pass; and a provider that does
|
|
56
|
+
authenticate is refused exactly as before.
|
|
57
|
+
|
|
58
|
+
- 4565e43: `zod` is now a regular dependency, so `npm install @theokit/sdk` produces a package that imports.
|
|
59
|
+
|
|
60
|
+
It was declared as an OPTIONAL peer dependency while 27 source files imported it — 14 of them at
|
|
61
|
+
module scope, on the paths that load agent context, read credentials and parse persistence. npm
|
|
62
|
+
honoured the declaration and did not install it, so a fresh consumer hit
|
|
63
|
+
`Cannot find package 'zod'` on the first line of the quickstart, from `dist/index.js` itself. 12 of
|
|
64
|
+
the 33 published subpaths could not be loaded at all.
|
|
65
|
+
|
|
66
|
+
Every suite in this repository runs inside the workspace, where `zod` is hoisted whether or not the
|
|
67
|
+
package declares it — which is why 5000+ green tests, `publint` and `attw` all saw nothing. The
|
|
68
|
+
release chain now packs the tarball, installs it outside the workspace and imports every declared
|
|
69
|
+
subpath, so this class of defect fails before publishing rather than after.
|
|
70
|
+
|
|
71
|
+
Consumers already on `zod ^4` are unaffected: the ranges overlap and the tree still resolves to a
|
|
72
|
+
single copy, so a schema you build still crosses into the SDK as the same type.
|
|
73
|
+
|
|
74
|
+
## 4.56.0
|
|
75
|
+
|
|
76
|
+
### Minor Changes
|
|
77
|
+
|
|
78
|
+
- b08f696: `MessageBus.request` now rejects a timeout with `A2ARequestTimeoutError`, carrying
|
|
79
|
+
`code: "a2a_request_timeout"` plus the peer's address and the limit as fields.
|
|
80
|
+
|
|
81
|
+
It used to reject with a plain `Error` and no code, so the only way to identify a timeout was to
|
|
82
|
+
match the message — the practice `docs/error-codes.md` tells consumers never to rely on, and that
|
|
83
|
+
message embeds the address and the limit, so it changes with context exactly as the document warns.
|
|
84
|
+
|
|
85
|
+
The distinction this restores is what a retry policy is built on: a peer that did not answer is
|
|
86
|
+
transient and worth retrying, a peer whose handler threw is likely deterministic. A handler's own
|
|
87
|
+
error still propagates unchanged and is not this type.
|
|
88
|
+
|
|
89
|
+
- f7e70e4: The memory store now writes the layout the Claude Code CLI reads.
|
|
90
|
+
|
|
91
|
+
This SDK's differentiator is that it emits the formats that CLI opens — point `local.sessionDir` at
|
|
92
|
+
`~/.claude` and `--continue` a session your agent wrote. Memory did not hold that line: a fact was a
|
|
93
|
+
bullet under `## Facts`, so pointing a memory directory at `~/.claude/projects/<project>/memory/`
|
|
94
|
+
produced nothing the CLI could read.
|
|
95
|
+
|
|
96
|
+
Now each memory is its own file with the frontmatter Claude Code writes — `name`, `description`, and
|
|
97
|
+
`metadata` carrying `type` and an ISO 8601 `modified` — and `MEMORY.md` is the index that points at
|
|
98
|
+
them.
|
|
99
|
+
|
|
100
|
+
Legacy `## Facts` bullets are still read, so no store loses what it recorded. The brief encoding that
|
|
101
|
+
put a fact's kind in a trailing HTML comment never reached a published version, so there is nothing
|
|
102
|
+
to migrate from it.
|
|
103
|
+
|
|
104
|
+
`parseSimpleYaml` also stops flattening nested maps: `metadata:` with indented keys used to yield
|
|
105
|
+
`metadata: []` plus the nested keys as top-level entries, so `metadata.type` read as `undefined`
|
|
106
|
+
while `type` appeared where it never was.
|
|
107
|
+
|
|
108
|
+
- 5036f04: A memory fact can now say what it IS and when it was learned.
|
|
109
|
+
|
|
110
|
+
`MemoryFact` gains an optional `kind` — `user`, `feedback`, `project` or `reference` — and a
|
|
111
|
+
`modified` timestamp. Without them a durable preference and a project note that went stale were
|
|
112
|
+
indistinguishable: no staleness signal, no way for recall to filter, no basis for selective
|
|
113
|
+
retention, and no way for a surface to separate "what I remember about you" from "what I know about
|
|
114
|
+
this project".
|
|
115
|
+
|
|
116
|
+
Additive, so existing stores keep working. A hand-written bullet under `## Facts` still parses and
|
|
117
|
+
stays untyped — a kind is never inferred, because a wrong one makes recall confident about the wrong
|
|
118
|
+
thing. `modified` is stamped by the SDK and ignored when supplied by a caller: a timestamp a caller
|
|
119
|
+
can set is one that can lie about when something was learned.
|
|
120
|
+
|
|
121
|
+
### Patch Changes
|
|
122
|
+
|
|
123
|
+
- 7587c00: A confined command that spawns a child no longer loses its output.
|
|
124
|
+
|
|
125
|
+
The restricted-network seccomp filter denied `getsockname`, `getpeername`, `setsockopt` and
|
|
126
|
+
`getsockopt`. Those four take an already-open fd, and cBPF cannot dereference one to learn its
|
|
127
|
+
address family — so they were denied on AF_UNIX too, which is what libuv uses for a child's IPC
|
|
128
|
+
channel. Any command that spawned a child died, and the parent's buffered stdout died with it:
|
|
129
|
+
`node --test` returned zero lines through `shell_exec`, and an agent reading test output saw an
|
|
130
|
+
empty string.
|
|
131
|
+
|
|
132
|
+
The four leave the denied set. Everything that takes an address or changes an fd's role —
|
|
133
|
+
`connect`, `bind`, `listen`, `accept`, `accept4`, `sendto`, `sendmmsg`, `recvmmsg`, `shutdown` —
|
|
134
|
+
stays denied, and `socket()` still refuses every family but AF_UNIX. Measured across the fix: an
|
|
135
|
+
AF_INET socket is `EPERM` before and after.
|
|
136
|
+
|
|
3
137
|
## 4.55.0
|
|
4
138
|
|
|
5
139
|
### Minor Changes
|
package/dist/a2a/index.cjs
CHANGED
|
@@ -35,6 +35,17 @@ var AgentMailbox = class {
|
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
// src/a2a/message-bus.ts
|
|
38
|
+
var A2ARequestTimeoutError = class extends Error {
|
|
39
|
+
constructor(to, timeoutMs) {
|
|
40
|
+
super(`A2A request timeout: ${to} did not respond within ${timeoutMs}ms`);
|
|
41
|
+
this.to = to;
|
|
42
|
+
this.timeoutMs = timeoutMs;
|
|
43
|
+
this.name = "A2ARequestTimeoutError";
|
|
44
|
+
}
|
|
45
|
+
to;
|
|
46
|
+
timeoutMs;
|
|
47
|
+
code = "a2a_request_timeout";
|
|
48
|
+
};
|
|
38
49
|
var MessageBus = class {
|
|
39
50
|
_handlers = /* @__PURE__ */ new Map();
|
|
40
51
|
register(agentId, handler) {
|
|
@@ -81,10 +92,7 @@ var MessageBus = class {
|
|
|
81
92
|
return await Promise.race([
|
|
82
93
|
Promise.resolve(handler(message)),
|
|
83
94
|
new Promise((_, reject) => {
|
|
84
|
-
timer = setTimeout(
|
|
85
|
-
() => reject(new Error(`A2A request timeout: ${to} did not respond within ${timeoutMs}ms`)),
|
|
86
|
-
timeoutMs
|
|
87
|
-
);
|
|
95
|
+
timer = setTimeout(() => reject(new A2ARequestTimeoutError(to, timeoutMs)), timeoutMs);
|
|
88
96
|
})
|
|
89
97
|
]);
|
|
90
98
|
} finally {
|
|
@@ -107,6 +115,7 @@ Object.defineProperty(exports, "SubAgent", {
|
|
|
107
115
|
enumerable: true,
|
|
108
116
|
get: function () { return chunk4O5TGQBW_cjs.SubAgent; }
|
|
109
117
|
});
|
|
118
|
+
exports.A2ARequestTimeoutError = A2ARequestTimeoutError;
|
|
110
119
|
exports.AgentMailbox = AgentMailbox;
|
|
111
120
|
exports.MessageBus = MessageBus;
|
|
112
121
|
//# sourceMappingURL=index.cjs.map
|
package/dist/a2a/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/a2a/agent-mailbox.ts","../../src/a2a/message-bus.ts"],"names":["diag"],"mappings":";;;;;;;AAuCO,IAAM,eAAN,MAAmB;AAAA,EACf,OAAA;AAAA,EACQ,IAAA;AAAA,EACT,QAAA,GAAkC,IAAA;AAAA,EAE1C,WAAA,CAAY,SAAiB,GAAA,EAAiB;AAC5C,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AACf,IAAA,IAAA,CAAK,IAAA,GAAO,GAAA;AACZ,IAAA,IAAA,CAAK,IAAA,CAAK,SAAS,OAAA,EAAS,CAAC,QAAQ,IAAA,CAAK,SAAA,CAAU,GAAG,CAAC,CAAA;AAAA,EAC1D;AAAA,EAEA,UAAU,OAAA,EAA+B;AACvC,IAAA,IAAA,CAAK,QAAA,GAAW,OAAA;AAAA,EAClB;AAAA,EAEA,MAAM,IAAA,CAAK,EAAA,EAAY,OAAA,EAA4D;AACjF,IAAA,OAAO,KAAK,IAAA,CAAK,IAAA,CAAK,IAAA,CAAK,OAAA,EAAS,IAAI,OAAO,CAAA;AAAA,EACjD;AAAA,EAEA,MAAM,OAAA,CACJ,EAAA,EACA,OAAA,EACA,IAAA,EACkB;AAClB,IAAA,OAAO,KAAK,IAAA,CAAK,OAAA,CAAQ,KAAK,OAAA,EAAS,EAAA,EAAI,SAAS,IAAI,CAAA;AAAA,EAC1D;AAAA,EAEA,OAAA,GAAgB;AACd,IAAA,IAAA,CAAK,IAAA,CAAK,UAAA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;AAC5B,IAAA,OAAO,IAAA,CAAK,SAAA,CAAU,GAAA,CAAI,OAAO,CAAA;AAAA,EACnC;AAAA,EAEA,UAAA,GAAuB;AACrB,IAAA,OAAO,CAAC,GAAG,IAAA,CAAK,SAAA,CAAU,MAAM,CAAA;AAAA,EAClC;AACF","file":"index.cjs","sourcesContent":["/**\n * AgentMailbox — per-agent inbox for A2A communication (T20.1, ADR D453).\n *\n * Wraps MessageBus registration with a convenient API for sending,\n * receiving, and requesting messages.\n *\n * @public\n */\n\nimport type { MessageBus, RequestOptions } from \"./message-bus.js\";\nimport type { A2AMessage, MessageHandler } from \"./types.js\";\n\n/**\n * One agent's endpoint on a {@link MessageBus}: registers `agentId` on\n * construction and forwards inbound messages to the handler installed by\n * `onMessage`.\n *\n * const mailbox = new AgentMailbox(\"worker\", bus);\n * mailbox.onMessage((m) => `echo:${m.payload}`);\n * await mailbox.send(\"boss\", { type: \"ready\", payload: null });\n *\n * Needs an already-constructed `MessageBus` — the mailbox does not create one, and\n * two mailboxes reach each other only through the SAME bus instance.\n *\n * How it fails: `send` and `request` are thin forwards, so they carry the bus's\n * failures unchanged (plain `Error` for an unregistered peer, plus a timeout\n * rejection for `request`).\n *\n * Traps:\n * - The constructor registers IMMEDIATELY, before `onMessage` can be called. A\n * message arriving in that window is dropped silently, and a peer's `request`\n * RESOLVES WITH `undefined` instead of timing out — install the handler in the\n * same tick as construction.\n * - Constructing a second mailbox with the same `agentId` on the same bus takes\n * the id over silently (`MessageBus.register` overwrites), and the loser's\n * `dispose()` then unregisters the WINNER.\n * - `dispose()` only unregisters and clears the handler. Requests already in\n * flight are neither cancelled nor rejected; they time out on the caller's side.\n */\nexport class AgentMailbox {\n readonly agentId: string;\n private readonly _bus: MessageBus;\n private _handler: MessageHandler | null = null;\n\n constructor(agentId: string, bus: MessageBus) {\n this.agentId = agentId;\n this._bus = bus;\n this._bus.register(agentId, (msg) => this._dispatch(msg));\n }\n\n onMessage(handler: MessageHandler): void {\n this._handler = handler;\n }\n\n async send(to: string, partial: { type: string; payload: unknown }): Promise<void> {\n return this._bus.send(this.agentId, to, partial);\n }\n\n async request(\n to: string,\n partial: { type: string; payload: unknown },\n opts?: RequestOptions,\n ): Promise<unknown> {\n return this._bus.request(this.agentId, to, partial, opts);\n }\n\n dispose(): void {\n this._bus.unregister(this.agentId);\n this._handler = null;\n }\n\n private _dispatch(msg: A2AMessage): unknown {\n if (this._handler) {\n return this._handler(msg);\n }\n }\n}\n","/**\n * MessageBus — in-process typed message router for A2A (T20.1, ADR D453).\n *\n * Routes messages between agents by ID. Supports fire-and-forget (send)\n * and request/response (request with timeout).\n *\n * @public\n */\n\nimport { diag } from \"../internal/diagnostics.js\";\nimport type { A2AMessage, MessageHandler } from \"./types.js\";\n\n/**\n * Per-call knobs for {@link MessageBus.request} / `AgentMailbox.request`.\n */\nexport interface RequestOptions {\n /**\n * How long to wait for the peer handler to settle before rejecting.\n * Default `30_000` (30 s). The rejection is a plain `Error` reading\n * `A2A request timeout: <to> did not respond within <n>ms` — there is no typed\n * timeout class and no `code` field, so a caller that must distinguish a\n * timeout from a handler failure has to match on the message.\n */\n timeoutMs?: number;\n}\n\n/**\n * In-process router that delivers A2A messages between agents keyed by string id.\n *\n * Purely in-memory and single-process: nothing is persisted and nothing crosses a\n * process or network boundary. Register one handler per agent id, then `send`\n * (fire-and-forget) or `request` (await the handler's return value).\n *\n * const bus = new MessageBus();\n * bus.register(\"worker\", (m) => `echo:${m.payload}`);\n * const reply = await bus.request(\"boss\", \"worker\", { type: \"ping\", payload: 1 });\n *\n * Callers supply only `{ type, payload }`; the bus stamps `from`, `to`,\n * `timestamp` and `origin` onto the delivered {@link A2AMessage}.\n *\n * How it fails: `send` and `request` both reject with a plain `Error`\n * (`Agent \"<to>\" not registered on MessageBus`) when `to` has no handler, and\n * `request` additionally rejects on timeout. No typed error class is exported for\n * either, so there is nothing to `instanceof`.\n *\n * Traps:\n * - `register` silently OVERWRITES an existing id; the previous handler simply\n * stops receiving anything. Call `has(id)` first when that matters.\n * - `send` is declared `async` but never awaits the handler. A handler that\n * rejects produces an UNHANDLED rejection that `await bus.send(...)` does not\n * observe — only the \"not registered\" failure reaches the caller. Use\n * `request` when the handler's failure has to be visible.\n * - `from` is whatever the caller passes; the bus never checks that the sender\n * is registered. It is self-asserted provenance, not authentication.\n */\nexport class MessageBus {\n private readonly _handlers = new Map<string, MessageHandler>();\n\n register(agentId: string, handler: MessageHandler): void {\n this._handlers.set(agentId, handler);\n }\n\n unregister(agentId: string): void {\n this._handlers.delete(agentId);\n }\n\n async send(from: string, to: string, partial: { type: string; payload: unknown }): Promise<void> {\n const handler = this._handlers.get(to);\n if (!handler) {\n throw new Error(`Agent \"${to}\" not registered on MessageBus`);\n }\n const message: A2AMessage = {\n ...partial,\n from,\n to,\n timestamp: Date.now(),\n // SE3 — provenance projection of the sender address (thin view over `from`).\n origin: { kind: \"peer\", from },\n };\n // Fire-and-forget: the SENDER does not wait for the result, which is the whole point of\n // `send`. It does not mean nobody is told when delivery fails — that is the difference\n // between asynchronous and silent (#365).\n //\n // The returned promise used to be dropped on the floor. `MessageHandler` may return one, so a\n // rejecting handler became an unhandled rejection: fatal under Node's default\n // `--unhandled-rejections=throw`, and invisible to the caller, whose `await send(...)`\n // resolved cleanly either way. Attaching a catch keeps the call non-blocking and reports the\n // failure instead of discarding it (`error-handling.md` § 5).\n void Promise.resolve(handler(message)).catch((cause: unknown) => {\n const reason = cause instanceof Error ? cause.message : String(cause);\n diag(`[theokit-sdk] a2a: handler for \"${to}\" failed on a fire-and-forget send: ${reason}\\n`);\n });\n }\n\n async request(\n from: string,\n to: string,\n partial: { type: string; payload: unknown },\n opts?: RequestOptions,\n ): Promise<unknown> {\n const handler = this._handlers.get(to);\n if (!handler) {\n throw new Error(`Agent \"${to}\" not registered on MessageBus`);\n }\n const timeoutMs = opts?.timeoutMs ?? 30_000;\n const message: A2AMessage = {\n ...partial,\n from,\n to,\n timestamp: Date.now(),\n // SE3 — provenance projection of the sender address (thin view over `from`).\n origin: { kind: \"peer\", from },\n };\n // Hold the timer so it can be cleared once the race settles — otherwise a\n // successful request leaks a live `setTimeout` that keeps the Node event loop\n // alive (the process hangs after the reply). Cleared in `finally`.\n let timer: ReturnType<typeof setTimeout> | undefined;\n try {\n return await Promise.race([\n Promise.resolve(handler(message)),\n new Promise((_, reject) => {\n timer = setTimeout(\n () =>\n reject(new Error(`A2A request timeout: ${to} did not respond within ${timeoutMs}ms`)),\n timeoutMs,\n );\n }),\n ]);\n } finally {\n if (timer !== undefined) clearTimeout(timer);\n }\n }\n\n has(agentId: string): boolean {\n return this._handlers.has(agentId);\n }\n\n listAgents(): string[] {\n return [...this._handlers.keys()];\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/a2a/agent-mailbox.ts","../../src/a2a/message-bus.ts"],"names":["diag"],"mappings":";;;;;;;AAuCO,IAAM,eAAN,MAAmB;AAAA,EACf,OAAA;AAAA,EACQ,IAAA;AAAA,EACT,QAAA,GAAkC,IAAA;AAAA,EAE1C,WAAA,CAAY,SAAiB,GAAA,EAAiB;AAC5C,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AACf,IAAA,IAAA,CAAK,IAAA,GAAO,GAAA;AACZ,IAAA,IAAA,CAAK,IAAA,CAAK,SAAS,OAAA,EAAS,CAAC,QAAQ,IAAA,CAAK,SAAA,CAAU,GAAG,CAAC,CAAA;AAAA,EAC1D;AAAA,EAEA,UAAU,OAAA,EAA+B;AACvC,IAAA,IAAA,CAAK,QAAA,GAAW,OAAA;AAAA,EAClB;AAAA,EAEA,MAAM,IAAA,CAAK,EAAA,EAAY,OAAA,EAA4D;AACjF,IAAA,OAAO,KAAK,IAAA,CAAK,IAAA,CAAK,IAAA,CAAK,OAAA,EAAS,IAAI,OAAO,CAAA;AAAA,EACjD;AAAA,EAEA,MAAM,OAAA,CACJ,EAAA,EACA,OAAA,EACA,IAAA,EACkB;AAClB,IAAA,OAAO,KAAK,IAAA,CAAK,OAAA,CAAQ,K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J,IAAA,IAAI;AACF,MAAA,OAAO,MAAM,QAAQ,IAAA,CAAK;AAAA,QACxB,OAAA,CAAQ,OAAA,CAAQ,OAAA,CAAQ,OAAO,CAAC,CAAA;AAAA,QAChC,IAAI,OAAA,CAAQ,CAAC,CAAA,EAAG,MAAA,KAAW;AACzB,UAAA,KAAA,GAAQ,UAAA,CAAW,MAAM,MAAA,CAAO,IAAI,uBAAuB,EAAA,EAAI,SAAS,CAAC,CAAA,EAAG,SAAS,CAAA;AAAA,QACvF,CAAC;AAAA,OACF,CAAA;AAAA,IACH,CAAA,SAAE;AACA,MAAA,IAAI,KAAA,KAAU,MAAA,EAAW,YAAA,CAAa,KAAK,CAAA;AAAA,IAC7C;AAAA,EACF;AAAA,EAEA,IAAI,OAAA,EAA0B;AAC5B,IAAA,OAAO,IAAA,CAAK,SAAA,CAAU,GAAA,CAAI,OAAO,CAAA;AAAA,EACnC;AAAA,EAEA,UAAA,GAAuB;AACrB,IAAA,OAAO,CAAC,GAAG,IAAA,CAAK,SAAA,CAAU,MAAM,CAAA;AAAA,EAClC;AACF","file":"index.cjs","sourcesContent":["/**\n * AgentMailbox — per-agent inbox for A2A communication (T20.1, ADR D453).\n *\n * Wraps MessageBus registration with a convenient API for sending,\n * receiving, and requesting messages.\n *\n * @public\n */\n\nimport type { MessageBus, RequestOptions } from \"./message-bus.js\";\nimport type { A2AMessage, MessageHandler } from \"./types.js\";\n\n/**\n * One agent's endpoint on a {@link MessageBus}: registers `agentId` on\n * construction and forwards inbound messages to the handler installed by\n * `onMessage`.\n *\n * const mailbox = new AgentMailbox(\"worker\", bus);\n * mailbox.onMessage((m) => `echo:${m.payload}`);\n * await mailbox.send(\"boss\", { type: \"ready\", payload: null });\n *\n * Needs an already-constructed `MessageBus` — the mailbox does not create one, and\n * two mailboxes reach each other only through the SAME bus instance.\n *\n * How it fails: `send` and `request` are thin forwards, so they carry the bus's\n * failures unchanged (plain `Error` for an unregistered peer, plus a timeout\n * rejection for `request`).\n *\n * Traps:\n * - The constructor registers IMMEDIATELY, before `onMessage` can be called. A\n * message arriving in that window is dropped silently, and a peer's `request`\n * RESOLVES WITH `undefined` instead of timing out — install the handler in the\n * same tick as construction.\n * - Constructing a second mailbox with the same `agentId` on the same bus takes\n * the id over silently (`MessageBus.register` overwrites), and the loser's\n * `dispose()` then unregisters the WINNER.\n * - `dispose()` only unregisters and clears the handler. Requests already in\n * flight are neither cancelled nor rejected; they time out on the caller's side.\n */\nexport class AgentMailbox {\n readonly agentId: string;\n private readonly _bus: MessageBus;\n private _handler: MessageHandler | null = null;\n\n constructor(agentId: string, bus: MessageBus) {\n this.agentId = agentId;\n this._bus = bus;\n this._bus.register(agentId, (msg) => this._dispatch(msg));\n }\n\n onMessage(handler: MessageHandler): void {\n this._handler = handler;\n }\n\n async send(to: string, partial: { type: string; payload: unknown }): Promise<void> {\n return this._bus.send(this.agentId, to, partial);\n }\n\n async request(\n to: string,\n partial: { type: string; payload: unknown },\n opts?: RequestOptions,\n ): Promise<unknown> {\n return this._bus.request(this.agentId, to, partial, opts);\n }\n\n dispose(): void {\n this._bus.unregister(this.agentId);\n this._handler = null;\n }\n\n private _dispatch(msg: A2AMessage): unknown {\n if (this._handler) {\n return this._handler(msg);\n }\n }\n}\n","/**\n * MessageBus — in-process typed message router for A2A (T20.1, ADR D453).\n *\n * Routes messages between agents by ID. Supports fire-and-forget (send)\n * and request/response (request with timeout).\n *\n * @public\n */\n\nimport { diag } from \"../internal/diagnostics.js\";\nimport type { A2AMessage, MessageHandler } from \"./types.js\";\n\n/**\n * A peer did not answer a {@link MessageBus.request} within its timeout.\n *\n * Carries `code: \"a2a_request_timeout\"`, the peer's address and the limit as FIELDS, so a caller\n * branches on the contract rather than on prose — `docs/error-codes.md`: \"Branch on `code`, never\n * on the message: messages carry context (an id, a path, a limit) and change with it, while a code\n * is the contract.\" Until #380 this rejection was a plain `Error` with neither, and the message it\n * carried embeds both the address and the limit, so matching on it changed with context exactly as\n * that document warns.\n *\n * The distinction it restores is what a retry policy is built on. A peer that did not answer in\n * time is transient and worth retrying; a peer whose handler threw is likely deterministic and\n * retrying repeats the failure. A handler's own error propagates unchanged and is NOT this type —\n * an unattended agent can therefore tell the two apart without reading English.\n *\n * @public\n */\nexport class A2ARequestTimeoutError extends Error {\n readonly code = \"a2a_request_timeout\" as const;\n constructor(\n /** The peer that did not answer. */\n public readonly to: string,\n /** The limit it exceeded, in milliseconds. */\n public readonly timeoutMs: number,\n ) {\n super(`A2A request timeout: ${to} did not respond within ${timeoutMs}ms`);\n this.name = \"A2ARequestTimeoutError\";\n }\n}\n\n/**\n * Per-call knobs for {@link MessageBus.request} / `AgentMailbox.request`.\n */\nexport interface RequestOptions {\n /**\n * How long to wait for the peer handler to settle before rejecting.\n * Default `30_000` (30 s). The rejection is an {@link A2ARequestTimeoutError} carrying\n * `code: \"a2a_request_timeout\"`, `to` and `timeoutMs` (#380), so a caller distinguishes a\n * timeout from a handler failure by branching on the code — a handler's own error propagates\n * unchanged and is not that type.\n */\n timeoutMs?: number;\n}\n\n/**\n * In-process router that delivers A2A messages between agents keyed by string id.\n *\n * Purely in-memory and single-process: nothing is persisted and nothing crosses a\n * process or network boundary. Register one handler per agent id, then `send`\n * (fire-and-forget) or `request` (await the handler's return value).\n *\n * const bus = new MessageBus();\n * bus.register(\"worker\", (m) => `echo:${m.payload}`);\n * const reply = await bus.request(\"boss\", \"worker\", { type: \"ping\", payload: 1 });\n *\n * Callers supply only `{ type, payload }`; the bus stamps `from`, `to`,\n * `timestamp` and `origin` onto the delivered {@link A2AMessage}.\n *\n * How it fails: `send` and `request` both reject with a plain `Error`\n * (`Agent \"<to>\" not registered on MessageBus`) when `to` has no handler, and\n * `request` additionally rejects on timeout. No typed error class is exported for\n * either, so there is nothing to `instanceof`.\n *\n * Traps:\n * - `register` silently OVERWRITES an existing id; the previous handler simply\n * stops receiving anything. Call `has(id)` first when that matters.\n * - `send` is declared `async` but never awaits the handler. A handler that\n * rejects produces an UNHANDLED rejection that `await bus.send(...)` does not\n * observe — only the \"not registered\" failure reaches the caller. Use\n * `request` when the handler's failure has to be visible.\n * - `from` is whatever the caller passes; the bus never checks that the sender\n * is registered. It is self-asserted provenance, not authentication.\n */\nexport class MessageBus {\n private readonly _handlers = new Map<string, MessageHandler>();\n\n register(agentId: string, handler: MessageHandler): void {\n this._handlers.set(agentId, handler);\n }\n\n unregister(agentId: string): void {\n this._handlers.delete(agentId);\n }\n\n async send(from: string, to: string, partial: { type: string; payload: unknown }): Promise<void> {\n const handler = this._handlers.get(to);\n if (!handler) {\n throw new Error(`Agent \"${to}\" not registered on MessageBus`);\n }\n const message: A2AMessage = {\n ...partial,\n from,\n to,\n timestamp: Date.now(),\n // SE3 — provenance projection of the sender address (thin view over `from`).\n origin: { kind: \"peer\", from },\n };\n // Fire-and-forget: the SENDER does not wait for the result, which is the whole point of\n // `send`. It does not mean nobody is told when delivery fails — that is the difference\n // between asynchronous and silent (#365).\n //\n // The returned promise used to be dropped on the floor. `MessageHandler` may return one, so a\n // rejecting handler became an unhandled rejection: fatal under Node's default\n // `--unhandled-rejections=throw`, and invisible to the caller, whose `await send(...)`\n // resolved cleanly either way. Attaching a catch keeps the call non-blocking and reports the\n // failure instead of discarding it (`error-handling.md` § 5).\n void Promise.resolve(handler(message)).catch((cause: unknown) => {\n const reason = cause instanceof Error ? cause.message : String(cause);\n diag(`[theokit-sdk] a2a: handler for \"${to}\" failed on a fire-and-forget send: ${reason}\\n`);\n });\n }\n\n async request(\n from: string,\n to: string,\n partial: { type: string; payload: unknown },\n opts?: RequestOptions,\n ): Promise<unknown> {\n const handler = this._handlers.get(to);\n if (!handler) {\n throw new Error(`Agent \"${to}\" not registered on MessageBus`);\n }\n const timeoutMs = opts?.timeoutMs ?? 30_000;\n const message: A2AMessage = {\n ...partial,\n from,\n to,\n timestamp: Date.now(),\n // SE3 — provenance projection of the sender address (thin view over `from`).\n origin: { kind: \"peer\", from },\n };\n // Hold the timer so it can be cleared once the race settles — otherwise a\n // successful request leaks a live `setTimeout` that keeps the Node event loop\n // alive (the process hangs after the reply). Cleared in `finally`.\n let timer: ReturnType<typeof setTimeout> | undefined;\n try {\n return await Promise.race([\n Promise.resolve(handler(message)),\n new Promise((_, reject) => {\n timer = setTimeout(() => reject(new A2ARequestTimeoutError(to, timeoutMs)), timeoutMs);\n }),\n ]);\n } finally {\n if (timer !== undefined) clearTimeout(timer);\n }\n }\n\n has(agentId: string): boolean {\n return this._handlers.has(agentId);\n }\n\n listAgents(): string[] {\n return [...this._handlers.keys()];\n }\n}\n"]}
|
package/dist/a2a/index.d.cts
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export type { ToolContextMessage } from "../types/agent-prims.js";
|
|
7
7
|
export { AgentMailbox } from "./agent-mailbox.js";
|
|
8
|
-
export { MessageBus, type RequestOptions } from "./message-bus.js";
|
|
8
|
+
export { A2ARequestTimeoutError, MessageBus, type RequestOptions } from "./message-bus.js";
|
|
9
9
|
export { type DelegationCompleteContext, type DelegationCompleteDecision, type DelegationStartContext, type DelegationStartDecision, MaxDelegationDepthError, type MessageFilterArgs, SubAgent, type SubAgentSpec, } from "./subagent.js";
|
|
10
10
|
export type { A2AMessage, MessageHandler } from "./types.js";
|
package/dist/a2a/index.d.ts
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export type { ToolContextMessage } from "../types/agent-prims.js";
|
|
7
7
|
export { AgentMailbox } from "./agent-mailbox.js";
|
|
8
|
-
export { MessageBus, type RequestOptions } from "./message-bus.js";
|
|
8
|
+
export { A2ARequestTimeoutError, MessageBus, type RequestOptions } from "./message-bus.js";
|
|
9
9
|
export { type DelegationCompleteContext, type DelegationCompleteDecision, type DelegationStartContext, type DelegationStartDecision, MaxDelegationDepthError, type MessageFilterArgs, SubAgent, type SubAgentSpec, } from "./subagent.js";
|
|
10
10
|
export type { A2AMessage, MessageHandler } from "./types.js";
|
package/dist/a2a/index.js
CHANGED
|
@@ -33,6 +33,17 @@ var AgentMailbox = class {
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
// src/a2a/message-bus.ts
|
|
36
|
+
var A2ARequestTimeoutError = class extends Error {
|
|
37
|
+
constructor(to, timeoutMs) {
|
|
38
|
+
super(`A2A request timeout: ${to} did not respond within ${timeoutMs}ms`);
|
|
39
|
+
this.to = to;
|
|
40
|
+
this.timeoutMs = timeoutMs;
|
|
41
|
+
this.name = "A2ARequestTimeoutError";
|
|
42
|
+
}
|
|
43
|
+
to;
|
|
44
|
+
timeoutMs;
|
|
45
|
+
code = "a2a_request_timeout";
|
|
46
|
+
};
|
|
36
47
|
var MessageBus = class {
|
|
37
48
|
_handlers = /* @__PURE__ */ new Map();
|
|
38
49
|
register(agentId, handler) {
|
|
@@ -79,10 +90,7 @@ var MessageBus = class {
|
|
|
79
90
|
return await Promise.race([
|
|
80
91
|
Promise.resolve(handler(message)),
|
|
81
92
|
new Promise((_, reject) => {
|
|
82
|
-
timer = setTimeout(
|
|
83
|
-
() => reject(new Error(`A2A request timeout: ${to} did not respond within ${timeoutMs}ms`)),
|
|
84
|
-
timeoutMs
|
|
85
|
-
);
|
|
93
|
+
timer = setTimeout(() => reject(new A2ARequestTimeoutError(to, timeoutMs)), timeoutMs);
|
|
86
94
|
})
|
|
87
95
|
]);
|
|
88
96
|
} finally {
|
|
@@ -97,6 +105,6 @@ var MessageBus = class {
|
|
|
97
105
|
}
|
|
98
106
|
};
|
|
99
107
|
|
|
100
|
-
export { AgentMailbox, MessageBus };
|
|
108
|
+
export { A2ARequestTimeoutError, AgentMailbox, MessageBus };
|
|
101
109
|
//# sourceMappingURL=index.js.map
|
|
102
110
|
//# sourceMappingURL=index.js.map
|
package/dist/a2a/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/a2a/agent-mailbox.ts","../../src/a2a/message-bus.ts"],"names":[],"mappings":";;;;;AAuCO,IAAM,eAAN,MAAmB;AAAA,EACf,OAAA;AA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a,GAAA;AACrC,IAAA,MAAM,OAAA,GAAsB;AAAA,MAC1B,GAAG,OAAA;AAAA,MACH,IAAA;AAAA,MACA,EAAA;AAAA,MACA,SAAA,EAAW,KAAK,GAAA,EAAI;AAAA;AAAA,MAEpB,MAAA,EAAQ,EAAE,IAAA,EAAM,MAAA,EAAQ,IAAA;AAAK,KAC/B;AAIA,IAAA,IAAI,KAAA;AACJ,IAAA,IAAI;AACF,MAAA,OAAO,MAAM,QAAQ,IAAA,CAAK;AAAA,QACxB,OAAA,CAAQ,OAAA,CAAQ,OAAA,CAAQ,OAAO,CAAC,CAAA;AAAA,QAChC,IAAI,OAAA,CAAQ,CAAC,CAAA,EAAG,MAAA,KAAW;AACzB,UAAA,KAAA,GAAQ,UAAA;AAAA,YACN,MACE,OAAO,IAAI,KAAA,CAAM,wBAAwB,EAAE,CAAA,wBAAA,EAA2B,SAAS,CAAA,EAAA,CAAI,CAAC,CAAA;AAAA,YACtF;AAAA,WACF;AAAA,QACF,CAAC;AAAA,OACF,CAAA;AAAA,IACH,CAAA,SAAE;AACA,MAAA,IAAI,KAAA,KAAU,MAAA,EAAW,YAAA,CAAa,KAAK,CAAA;AAAA,IAC7C;AAAA,EACF;AAAA,EAEA,IAAI,OAAA,EAA0B;AAC5B,IAAA,OAAO,IAAA,CAAK,SAAA,CAAU,GAAA,CAAI,OAAO,CAAA;AAAA,EACnC;AAAA,EAEA,UAAA,GAAuB;AACrB,IAAA,OAAO,CAAC,GAAG,IAAA,CAAK,SAAA,CAAU,MAAM,CAAA;AAAA,EAClC;AACF","file":"index.js","sourcesContent":["/**\n * AgentMailbox — per-agent inbox for A2A communication (T20.1, ADR D453).\n *\n * Wraps MessageBus registration with a convenient API for sending,\n * receiving, and requesting messages.\n *\n * @public\n */\n\nimport type { MessageBus, RequestOptions } from \"./message-bus.js\";\nimport type { A2AMessage, MessageHandler } from \"./types.js\";\n\n/**\n * One agent's endpoint on a {@link MessageBus}: registers `agentId` on\n * construction and forwards inbound messages to the handler installed by\n * `onMessage`.\n *\n * const mailbox = new AgentMailbox(\"worker\", bus);\n * mailbox.onMessage((m) => `echo:${m.payload}`);\n * await mailbox.send(\"boss\", { type: \"ready\", payload: null });\n *\n * Needs an already-constructed `MessageBus` — the mailbox does not create one, and\n * two mailboxes reach each other only through the SAME bus instance.\n *\n * How it fails: `send` and `request` are thin forwards, so they carry the bus's\n * failures unchanged (plain `Error` for an unregistered peer, plus a timeout\n * rejection for `request`).\n *\n * Traps:\n * - The constructor registers IMMEDIATELY, before `onMessage` can be called. A\n * message arriving in that window is dropped silently, and a peer's `request`\n * RESOLVES WITH `undefined` instead of timing out — install the handler in the\n * same tick as construction.\n * - Constructing a second mailbox with the same `agentId` on the same bus takes\n * the id over silently (`MessageBus.register` overwrites), and the loser's\n * `dispose()` then unregisters the WINNER.\n * - `dispose()` only unregisters and clears the handler. Requests already in\n * flight are neither cancelled nor rejected; they time out on the caller's side.\n */\nexport class AgentMailbox {\n readonly agentId: string;\n private readonly _bus: MessageBus;\n private _handler: MessageHandler | null = null;\n\n constructor(agentId: string, bus: MessageBus) {\n this.agentId = agentId;\n this._bus = bus;\n this._bus.register(agentId, (msg) => this._dispatch(msg));\n }\n\n onMessage(handler: MessageHandler): void {\n this._handler = handler;\n }\n\n async send(to: string, partial: { type: string; payload: unknown }): Promise<void> {\n return this._bus.send(this.agentId, to, partial);\n }\n\n async request(\n to: string,\n partial: { type: string; payload: unknown },\n opts?: RequestOptions,\n ): Promise<unknown> {\n return this._bus.request(this.agentId, to, partial, opts);\n }\n\n dispose(): void {\n this._bus.unregister(this.agentId);\n this._handler = null;\n }\n\n private _dispatch(msg: A2AMessage): unknown {\n if (this._handler) {\n return this._handler(msg);\n }\n }\n}\n","/**\n * MessageBus — in-process typed message router for A2A (T20.1, ADR D453).\n *\n * Routes messages between agents by ID. Supports fire-and-forget (send)\n * and request/response (request with timeout).\n *\n * @public\n */\n\nimport { diag } from \"../internal/diagnostics.js\";\nimport type { A2AMessage, MessageHandler } from \"./types.js\";\n\n/**\n * Per-call knobs for {@link MessageBus.request} / `AgentMailbox.request`.\n */\nexport interface RequestOptions {\n /**\n * How long to wait for the peer handler to settle before rejecting.\n * Default `30_000` (30 s). The rejection is a plain `Error` reading\n * `A2A request timeout: <to> did not respond within <n>ms` — there is no typed\n * timeout class and no `code` field, so a caller that must distinguish a\n * timeout from a handler failure has to match on the message.\n */\n timeoutMs?: number;\n}\n\n/**\n * In-process router that delivers A2A messages between agents keyed by string id.\n *\n * Purely in-memory and single-process: nothing is persisted and nothing crosses a\n * process or network boundary. Register one handler per agent id, then `send`\n * (fire-and-forget) or `request` (await the handler's return value).\n *\n * const bus = new MessageBus();\n * bus.register(\"worker\", (m) => `echo:${m.payload}`);\n * const reply = await bus.request(\"boss\", \"worker\", { type: \"ping\", payload: 1 });\n *\n * Callers supply only `{ type, payload }`; the bus stamps `from`, `to`,\n * `timestamp` and `origin` onto the delivered {@link A2AMessage}.\n *\n * How it fails: `send` and `request` both reject with a plain `Error`\n * (`Agent \"<to>\" not registered on MessageBus`) when `to` has no handler, and\n * `request` additionally rejects on timeout. No typed error class is exported for\n * either, so there is nothing to `instanceof`.\n *\n * Traps:\n * - `register` silently OVERWRITES an existing id; the previous handler simply\n * stops receiving anything. Call `has(id)` first when that matters.\n * - `send` is declared `async` but never awaits the handler. A handler that\n * rejects produces an UNHANDLED rejection that `await bus.send(...)` does not\n * observe — only the \"not registered\" failure reaches the caller. Use\n * `request` when the handler's failure has to be visible.\n * - `from` is whatever the caller passes; the bus never checks that the sender\n * is registered. It is self-asserted provenance, not authentication.\n */\nexport class MessageBus {\n private readonly _handlers = new Map<string, MessageHandler>();\n\n register(agentId: string, handler: MessageHandler): void {\n this._handlers.set(agentId, handler);\n }\n\n unregister(agentId: string): void {\n this._handlers.delete(agentId);\n }\n\n async send(from: string, to: string, partial: { type: string; payload: unknown }): Promise<void> {\n const handler = this._handlers.get(to);\n if (!handler) {\n throw new Error(`Agent \"${to}\" not registered on MessageBus`);\n }\n const message: A2AMessage = {\n ...partial,\n from,\n to,\n timestamp: Date.now(),\n // SE3 — provenance projection of the sender address (thin view over `from`).\n origin: { kind: \"peer\", from },\n };\n // Fire-and-forget: the SENDER does not wait for the result, which is the whole point of\n // `send`. It does not mean nobody is told when delivery fails — that is the difference\n // between asynchronous and silent (#365).\n //\n // The returned promise used to be dropped on the floor. `MessageHandler` may return one, so a\n // rejecting handler became an unhandled rejection: fatal under Node's default\n // `--unhandled-rejections=throw`, and invisible to the caller, whose `await send(...)`\n // resolved cleanly either way. Attaching a catch keeps the call non-blocking and reports the\n // failure instead of discarding it (`error-handling.md` § 5).\n void Promise.resolve(handler(message)).catch((cause: unknown) => {\n const reason = cause instanceof Error ? cause.message : String(cause);\n diag(`[theokit-sdk] a2a: handler for \"${to}\" failed on a fire-and-forget send: ${reason}\\n`);\n });\n }\n\n async request(\n from: string,\n to: string,\n partial: { type: string; payload: unknown },\n opts?: RequestOptions,\n ): Promise<unknown> {\n const handler = this._handlers.get(to);\n if (!handler) {\n throw new Error(`Agent \"${to}\" not registered on MessageBus`);\n }\n const timeoutMs = opts?.timeoutMs ?? 30_000;\n const message: A2AMessage = {\n ...partial,\n from,\n to,\n timestamp: Date.now(),\n // SE3 — provenance projection of the sender address (thin view over `from`).\n origin: { kind: \"peer\", from },\n };\n // Hold the timer so it can be cleared once the race settles — otherwise a\n // successful request leaks a live `setTimeout` that keeps the Node event loop\n // alive (the process hangs after the reply). Cleared in `finally`.\n let timer: ReturnType<typeof setTimeout> | undefined;\n try {\n return await Promise.race([\n Promise.resolve(handler(message)),\n new Promise((_, reject) => {\n timer = setTimeout(\n () =>\n reject(new Error(`A2A request timeout: ${to} did not respond within ${timeoutMs}ms`)),\n timeoutMs,\n );\n }),\n ]);\n } finally {\n if (timer !== undefined) clearTimeout(timer);\n }\n }\n\n has(agentId: string): boolean {\n return this._handlers.has(agentId);\n }\n\n listAgents(): string[] {\n return [...this._handlers.keys()];\n }\n}\n"]}
|
|
1
|
+
{"version":3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,IAAI,OAAA,EAA0B;AAC5B,IAAA,OAAO,IAAA,CAAK,SAAA,CAAU,GAAA,CAAI,OAAO,CAAA;AAAA,EACnC;AAAA,EAEA,UAAA,GAAuB;AACrB,IAAA,OAAO,CAAC,GAAG,IAAA,CAAK,SAAA,CAAU,MAAM,CAAA;AAAA,EAClC;AACF","file":"index.js","sourcesContent":["/**\n * AgentMailbox — per-agent inbox for A2A communication (T20.1, ADR D453).\n *\n * Wraps MessageBus registration with a convenient API for sending,\n * receiving, and requesting messages.\n *\n * @public\n */\n\nimport type { MessageBus, RequestOptions } from \"./message-bus.js\";\nimport type { A2AMessage, MessageHandler } from \"./types.js\";\n\n/**\n * One agent's endpoint on a {@link MessageBus}: registers `agentId` on\n * construction and forwards inbound messages to the handler installed by\n * `onMessage`.\n *\n * const mailbox = new AgentMailbox(\"worker\", bus);\n * mailbox.onMessage((m) => `echo:${m.payload}`);\n * await mailbox.send(\"boss\", { type: \"ready\", payload: null });\n *\n * Needs an already-constructed `MessageBus` — the mailbox does not create one, and\n * two mailboxes reach each other only through the SAME bus instance.\n *\n * How it fails: `send` and `request` are thin forwards, so they carry the bus's\n * failures unchanged (plain `Error` for an unregistered peer, plus a timeout\n * rejection for `request`).\n *\n * Traps:\n * - The constructor registers IMMEDIATELY, before `onMessage` can be called. A\n * message arriving in that window is dropped silently, and a peer's `request`\n * RESOLVES WITH `undefined` instead of timing out — install the handler in the\n * same tick as construction.\n * - Constructing a second mailbox with the same `agentId` on the same bus takes\n * the id over silently (`MessageBus.register` overwrites), and the loser's\n * `dispose()` then unregisters the WINNER.\n * - `dispose()` only unregisters and clears the handler. Requests already in\n * flight are neither cancelled nor rejected; they time out on the caller's side.\n */\nexport class AgentMailbox {\n readonly agentId: string;\n private readonly _bus: MessageBus;\n private _handler: MessageHandler | null = null;\n\n constructor(agentId: string, bus: MessageBus) {\n this.agentId = agentId;\n this._bus = bus;\n this._bus.register(agentId, (msg) => this._dispatch(msg));\n }\n\n onMessage(handler: MessageHandler): void {\n this._handler = handler;\n }\n\n async send(to: string, partial: { type: string; payload: unknown }): Promise<void> {\n return this._bus.send(this.agentId, to, partial);\n }\n\n async request(\n to: string,\n partial: { type: string; payload: unknown },\n opts?: RequestOptions,\n ): Promise<unknown> {\n return this._bus.request(this.agentId, to, partial, opts);\n }\n\n dispose(): void {\n this._bus.unregister(this.agentId);\n this._handler = null;\n }\n\n private _dispatch(msg: A2AMessage): unknown {\n if (this._handler) {\n return this._handler(msg);\n }\n }\n}\n","/**\n * MessageBus — in-process typed message router for A2A (T20.1, ADR D453).\n *\n * Routes messages between agents by ID. Supports fire-and-forget (send)\n * and request/response (request with timeout).\n *\n * @public\n */\n\nimport { diag } from \"../internal/diagnostics.js\";\nimport type { A2AMessage, MessageHandler } from \"./types.js\";\n\n/**\n * A peer did not answer a {@link MessageBus.request} within its timeout.\n *\n * Carries `code: \"a2a_request_timeout\"`, the peer's address and the limit as FIELDS, so a caller\n * branches on the contract rather than on prose — `docs/error-codes.md`: \"Branch on `code`, never\n * on the message: messages carry context (an id, a path, a limit) and change with it, while a code\n * is the contract.\" Until #380 this rejection was a plain `Error` with neither, and the message it\n * carried embeds both the address and the limit, so matching on it changed with context exactly as\n * that document warns.\n *\n * The distinction it restores is what a retry policy is built on. A peer that did not answer in\n * time is transient and worth retrying; a peer whose handler threw is likely deterministic and\n * retrying repeats the failure. A handler's own error propagates unchanged and is NOT this type —\n * an unattended agent can therefore tell the two apart without reading English.\n *\n * @public\n */\nexport class A2ARequestTimeoutError extends Error {\n readonly code = \"a2a_request_timeout\" as const;\n constructor(\n /** The peer that did not answer. */\n public readonly to: string,\n /** The limit it exceeded, in milliseconds. */\n public readonly timeoutMs: number,\n ) {\n super(`A2A request timeout: ${to} did not respond within ${timeoutMs}ms`);\n this.name = \"A2ARequestTimeoutError\";\n }\n}\n\n/**\n * Per-call knobs for {@link MessageBus.request} / `AgentMailbox.request`.\n */\nexport interface RequestOptions {\n /**\n * How long to wait for the peer handler to settle before rejecting.\n * Default `30_000` (30 s). The rejection is an {@link A2ARequestTimeoutError} carrying\n * `code: \"a2a_request_timeout\"`, `to` and `timeoutMs` (#380), so a caller distinguishes a\n * timeout from a handler failure by branching on the code — a handler's own error propagates\n * unchanged and is not that type.\n */\n timeoutMs?: number;\n}\n\n/**\n * In-process router that delivers A2A messages between agents keyed by string id.\n *\n * Purely in-memory and single-process: nothing is persisted and nothing crosses a\n * process or network boundary. Register one handler per agent id, then `send`\n * (fire-and-forget) or `request` (await the handler's return value).\n *\n * const bus = new MessageBus();\n * bus.register(\"worker\", (m) => `echo:${m.payload}`);\n * const reply = await bus.request(\"boss\", \"worker\", { type: \"ping\", payload: 1 });\n *\n * Callers supply only `{ type, payload }`; the bus stamps `from`, `to`,\n * `timestamp` and `origin` onto the delivered {@link A2AMessage}.\n *\n * How it fails: `send` and `request` both reject with a plain `Error`\n * (`Agent \"<to>\" not registered on MessageBus`) when `to` has no handler, and\n * `request` additionally rejects on timeout. No typed error class is exported for\n * either, so there is nothing to `instanceof`.\n *\n * Traps:\n * - `register` silently OVERWRITES an existing id; the previous handler simply\n * stops receiving anything. Call `has(id)` first when that matters.\n * - `send` is declared `async` but never awaits the handler. A handler that\n * rejects produces an UNHANDLED rejection that `await bus.send(...)` does not\n * observe — only the \"not registered\" failure reaches the caller. Use\n * `request` when the handler's failure has to be visible.\n * - `from` is whatever the caller passes; the bus never checks that the sender\n * is registered. It is self-asserted provenance, not authentication.\n */\nexport class MessageBus {\n private readonly _handlers = new Map<string, MessageHandler>();\n\n register(agentId: string, handler: MessageHandler): void {\n this._handlers.set(agentId, handler);\n }\n\n unregister(agentId: string): void {\n this._handlers.delete(agentId);\n }\n\n async send(from: string, to: string, partial: { type: string; payload: unknown }): Promise<void> {\n const handler = this._handlers.get(to);\n if (!handler) {\n throw new Error(`Agent \"${to}\" not registered on MessageBus`);\n }\n const message: A2AMessage = {\n ...partial,\n from,\n to,\n timestamp: Date.now(),\n // SE3 — provenance projection of the sender address (thin view over `from`).\n origin: { kind: \"peer\", from },\n };\n // Fire-and-forget: the SENDER does not wait for the result, which is the whole point of\n // `send`. It does not mean nobody is told when delivery fails — that is the difference\n // between asynchronous and silent (#365).\n //\n // The returned promise used to be dropped on the floor. `MessageHandler` may return one, so a\n // rejecting handler became an unhandled rejection: fatal under Node's default\n // `--unhandled-rejections=throw`, and invisible to the caller, whose `await send(...)`\n // resolved cleanly either way. Attaching a catch keeps the call non-blocking and reports the\n // failure instead of discarding it (`error-handling.md` § 5).\n void Promise.resolve(handler(message)).catch((cause: unknown) => {\n const reason = cause instanceof Error ? cause.message : String(cause);\n diag(`[theokit-sdk] a2a: handler for \"${to}\" failed on a fire-and-forget send: ${reason}\\n`);\n });\n }\n\n async request(\n from: string,\n to: string,\n partial: { type: string; payload: unknown },\n opts?: RequestOptions,\n ): Promise<unknown> {\n const handler = this._handlers.get(to);\n if (!handler) {\n throw new Error(`Agent \"${to}\" not registered on MessageBus`);\n }\n const timeoutMs = opts?.timeoutMs ?? 30_000;\n const message: A2AMessage = {\n ...partial,\n from,\n to,\n timestamp: Date.now(),\n // SE3 — provenance projection of the sender address (thin view over `from`).\n origin: { kind: \"peer\", from },\n };\n // Hold the timer so it can be cleared once the race settles — otherwise a\n // successful request leaks a live `setTimeout` that keeps the Node event loop\n // alive (the process hangs after the reply). Cleared in `finally`.\n let timer: ReturnType<typeof setTimeout> | undefined;\n try {\n return await Promise.race([\n Promise.resolve(handler(message)),\n new Promise((_, reject) => {\n timer = setTimeout(() => reject(new A2ARequestTimeoutError(to, timeoutMs)), timeoutMs);\n }),\n ]);\n } finally {\n if (timer !== undefined) clearTimeout(timer);\n }\n }\n\n has(agentId: string): boolean {\n return this._handlers.has(agentId);\n }\n\n listAgents(): string[] {\n return [...this._handlers.keys()];\n }\n}\n"]}
|
|
@@ -7,16 +7,45 @@
|
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
9
|
import type { MessageHandler } from "./types.js";
|
|
10
|
+
/**
|
|
11
|
+
* A peer did not answer a {@link MessageBus.request} within its timeout.
|
|
12
|
+
*
|
|
13
|
+
* Carries `code: "a2a_request_timeout"`, the peer's address and the limit as FIELDS, so a caller
|
|
14
|
+
* branches on the contract rather than on prose — `docs/error-codes.md`: "Branch on `code`, never
|
|
15
|
+
* on the message: messages carry context (an id, a path, a limit) and change with it, while a code
|
|
16
|
+
* is the contract." Until #380 this rejection was a plain `Error` with neither, and the message it
|
|
17
|
+
* carried embeds both the address and the limit, so matching on it changed with context exactly as
|
|
18
|
+
* that document warns.
|
|
19
|
+
*
|
|
20
|
+
* The distinction it restores is what a retry policy is built on. A peer that did not answer in
|
|
21
|
+
* time is transient and worth retrying; a peer whose handler threw is likely deterministic and
|
|
22
|
+
* retrying repeats the failure. A handler's own error propagates unchanged and is NOT this type —
|
|
23
|
+
* an unattended agent can therefore tell the two apart without reading English.
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export declare class A2ARequestTimeoutError extends Error {
|
|
28
|
+
/** The peer that did not answer. */
|
|
29
|
+
readonly to: string;
|
|
30
|
+
/** The limit it exceeded, in milliseconds. */
|
|
31
|
+
readonly timeoutMs: number;
|
|
32
|
+
readonly code: "a2a_request_timeout";
|
|
33
|
+
constructor(
|
|
34
|
+
/** The peer that did not answer. */
|
|
35
|
+
to: string,
|
|
36
|
+
/** The limit it exceeded, in milliseconds. */
|
|
37
|
+
timeoutMs: number);
|
|
38
|
+
}
|
|
10
39
|
/**
|
|
11
40
|
* Per-call knobs for {@link MessageBus.request} / `AgentMailbox.request`.
|
|
12
41
|
*/
|
|
13
42
|
export interface RequestOptions {
|
|
14
43
|
/**
|
|
15
44
|
* How long to wait for the peer handler to settle before rejecting.
|
|
16
|
-
* Default `30_000` (30 s). The rejection is
|
|
17
|
-
* `
|
|
18
|
-
* timeout
|
|
19
|
-
*
|
|
45
|
+
* Default `30_000` (30 s). The rejection is an {@link A2ARequestTimeoutError} carrying
|
|
46
|
+
* `code: "a2a_request_timeout"`, `to` and `timeoutMs` (#380), so a caller distinguishes a
|
|
47
|
+
* timeout from a handler failure by branching on the code — a handler's own error propagates
|
|
48
|
+
* unchanged and is not that type.
|
|
20
49
|
*/
|
|
21
50
|
timeoutMs?: number;
|
|
22
51
|
}
|
|
@@ -7,16 +7,45 @@
|
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
9
|
import type { MessageHandler } from "./types.js";
|
|
10
|
+
/**
|
|
11
|
+
* A peer did not answer a {@link MessageBus.request} within its timeout.
|
|
12
|
+
*
|
|
13
|
+
* Carries `code: "a2a_request_timeout"`, the peer's address and the limit as FIELDS, so a caller
|
|
14
|
+
* branches on the contract rather than on prose — `docs/error-codes.md`: "Branch on `code`, never
|
|
15
|
+
* on the message: messages carry context (an id, a path, a limit) and change with it, while a code
|
|
16
|
+
* is the contract." Until #380 this rejection was a plain `Error` with neither, and the message it
|
|
17
|
+
* carried embeds both the address and the limit, so matching on it changed with context exactly as
|
|
18
|
+
* that document warns.
|
|
19
|
+
*
|
|
20
|
+
* The distinction it restores is what a retry policy is built on. A peer that did not answer in
|
|
21
|
+
* time is transient and worth retrying; a peer whose handler threw is likely deterministic and
|
|
22
|
+
* retrying repeats the failure. A handler's own error propagates unchanged and is NOT this type —
|
|
23
|
+
* an unattended agent can therefore tell the two apart without reading English.
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export declare class A2ARequestTimeoutError extends Error {
|
|
28
|
+
/** The peer that did not answer. */
|
|
29
|
+
readonly to: string;
|
|
30
|
+
/** The limit it exceeded, in milliseconds. */
|
|
31
|
+
readonly timeoutMs: number;
|
|
32
|
+
readonly code: "a2a_request_timeout";
|
|
33
|
+
constructor(
|
|
34
|
+
/** The peer that did not answer. */
|
|
35
|
+
to: string,
|
|
36
|
+
/** The limit it exceeded, in milliseconds. */
|
|
37
|
+
timeoutMs: number);
|
|
38
|
+
}
|
|
10
39
|
/**
|
|
11
40
|
* Per-call knobs for {@link MessageBus.request} / `AgentMailbox.request`.
|
|
12
41
|
*/
|
|
13
42
|
export interface RequestOptions {
|
|
14
43
|
/**
|
|
15
44
|
* How long to wait for the peer handler to settle before rejecting.
|
|
16
|
-
* Default `30_000` (30 s). The rejection is
|
|
17
|
-
* `
|
|
18
|
-
* timeout
|
|
19
|
-
*
|
|
45
|
+
* Default `30_000` (30 s). The rejection is an {@link A2ARequestTimeoutError} carrying
|
|
46
|
+
* `code: "a2a_request_timeout"`, `to` and `timeoutMs` (#380), so a caller distinguishes a
|
|
47
|
+
* timeout from a handler failure by branching on the code — a handler's own error propagates
|
|
48
|
+
* unchanged and is not that type.
|
|
20
49
|
*/
|
|
21
50
|
timeoutMs?: number;
|
|
22
51
|
}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var chunkM2JWHKO6_cjs = require('./chunk-M2JWHKO6.cjs');
|
|
4
|
+
require('./chunk-KKK3FZ4A.cjs');
|
|
5
|
+
require('./chunk-E7JHD6QJ.cjs');
|
|
6
6
|
require('./chunk-53CBTBWO.cjs');
|
|
7
7
|
require('./chunk-BV2MWEMV.cjs');
|
|
8
8
|
require('./chunk-NGESVVJN.cjs');
|
|
9
9
|
require('./chunk-BUUUWQMB.cjs');
|
|
10
10
|
require('./chunk-EI2Q7SJ5.cjs');
|
|
11
11
|
require('./chunk-GHX4P3V2.cjs');
|
|
12
|
-
require('./chunk-
|
|
13
|
-
require('./chunk-
|
|
12
|
+
require('./chunk-QI7WE46I.cjs');
|
|
13
|
+
require('./chunk-43GFJ5SD.cjs');
|
|
14
14
|
require('./chunk-F3YZMOAU.cjs');
|
|
15
15
|
require('./chunk-4OTIXDMU.cjs');
|
|
16
16
|
require('./chunk-DQKERTND.cjs');
|
|
17
|
-
require('./chunk-
|
|
17
|
+
require('./chunk-Z4BCLVTI.cjs');
|
|
18
18
|
require('./chunk-2ZPEDVLM.cjs');
|
|
19
|
-
require('./chunk-
|
|
19
|
+
require('./chunk-E3WZ6Y4H.cjs');
|
|
20
|
+
require('./chunk-KRD3GQAA.cjs');
|
|
20
21
|
require('./chunk-U2AC6JUP.cjs');
|
|
21
22
|
require('./chunk-MUUQ2WFJ.cjs');
|
|
22
23
|
require('./chunk-WJVHMTKB.cjs');
|
|
@@ -32,7 +33,7 @@ require('./chunk-VKJ7V7EB.cjs');
|
|
|
32
33
|
require('./chunk-ILCGLTSA.cjs');
|
|
33
34
|
require('./chunk-CQGYNZ3K.cjs');
|
|
34
35
|
require('./chunk-4I55V454.cjs');
|
|
35
|
-
require('./chunk-
|
|
36
|
+
require('./chunk-BUIK7GUA.cjs');
|
|
36
37
|
require('./chunk-SKXBJ2NU.cjs');
|
|
37
38
|
require('./chunk-2ADR2GSO.cjs');
|
|
38
39
|
require('./chunk-ZF2LDKQQ.cjs');
|
|
@@ -55,7 +56,7 @@ require('./chunk-NUKRL3I6.cjs');
|
|
|
55
56
|
|
|
56
57
|
Object.defineProperty(exports, "Agent", {
|
|
57
58
|
enumerable: true,
|
|
58
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunkM2JWHKO6_cjs.Agent; }
|
|
59
60
|
});
|
|
60
|
-
//# sourceMappingURL=agent-
|
|
61
|
-
//# sourceMappingURL=agent-
|
|
61
|
+
//# sourceMappingURL=agent-2T2EJIP6.cjs.map
|
|
62
|
+
//# sourceMappingURL=agent-2T2EJIP6.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-2T2EJIP6.cjs"}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
export { Agent } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { Agent } from './chunk-7TCRNXNK.js';
|
|
2
|
+
import './chunk-WG7R5W6R.js';
|
|
3
|
+
import './chunk-G6EEYRDD.js';
|
|
4
4
|
import './chunk-YMA4S2WO.js';
|
|
5
5
|
import './chunk-2SFBB54R.js';
|
|
6
6
|
import './chunk-SUKXXLWD.js';
|
|
7
7
|
import './chunk-K2BQQ445.js';
|
|
8
8
|
import './chunk-XN7NOENA.js';
|
|
9
9
|
import './chunk-H73MEMQB.js';
|
|
10
|
-
import './chunk-
|
|
11
|
-
import './chunk-
|
|
10
|
+
import './chunk-YJDH3CKG.js';
|
|
11
|
+
import './chunk-IACR5LEM.js';
|
|
12
12
|
import './chunk-3E77SX4H.js';
|
|
13
13
|
import './chunk-WTMU7J4U.js';
|
|
14
14
|
import './chunk-5JLFFPCH.js';
|
|
15
|
-
import './chunk-
|
|
15
|
+
import './chunk-G24KZRSA.js';
|
|
16
16
|
import './chunk-HKCKOAIO.js';
|
|
17
|
-
import './chunk-
|
|
17
|
+
import './chunk-7FHZ4VQX.js';
|
|
18
|
+
import './chunk-KVNWIAO4.js';
|
|
18
19
|
import './chunk-UPRJR6IP.js';
|
|
19
20
|
import './chunk-FD2UT76F.js';
|
|
20
21
|
import './chunk-4VPXM6UU.js';
|
|
@@ -30,7 +31,7 @@ import './chunk-RIAM53CP.js';
|
|
|
30
31
|
import './chunk-UC3HT2S4.js';
|
|
31
32
|
import './chunk-OC4NTGMN.js';
|
|
32
33
|
import './chunk-44JAAH4X.js';
|
|
33
|
-
import './chunk-
|
|
34
|
+
import './chunk-FKMUFNQE.js';
|
|
34
35
|
import './chunk-CQ2TQ32Y.js';
|
|
35
36
|
import './chunk-CV7XMBHP.js';
|
|
36
37
|
import './chunk-Q5EWJPRY.js';
|
|
@@ -48,5 +49,5 @@ import './chunk-3OR54XG4.js';
|
|
|
48
49
|
import './chunk-IDCKSLYH.js';
|
|
49
50
|
import './chunk-T7XEKOVW.js';
|
|
50
51
|
import './chunk-T7O6K6PX.js';
|
|
51
|
-
//# sourceMappingURL=agent-
|
|
52
|
-
//# sourceMappingURL=agent-
|
|
52
|
+
//# sourceMappingURL=agent-ZIYCVEZL.js.map
|
|
53
|
+
//# sourceMappingURL=agent-ZIYCVEZL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-ZIYCVEZL.js"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { appendCompactBoundaryRecord, persistTurn, readSessionMessages } from './chunk-G24KZRSA.js';
|
|
2
|
+
import './chunk-FKMUFNQE.js';
|
|
3
|
+
import './chunk-VF7EWVDG.js';
|
|
4
|
+
import './chunk-T7XEKOVW.js';
|
|
5
|
+
import './chunk-T7O6K6PX.js';
|
|
6
|
+
//# sourceMappingURL=agent-session-store-G2BMUZQV.js.map
|
|
7
|
+
//# sourceMappingURL=agent-session-store-G2BMUZQV.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-session-store-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-session-store-G2BMUZQV.js"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkZ4BCLVTI_cjs = require('./chunk-Z4BCLVTI.cjs');
|
|
4
|
+
require('./chunk-BUIK7GUA.cjs');
|
|
5
|
+
require('./chunk-I6TGFUCO.cjs');
|
|
6
|
+
require('./chunk-JTB5Q42C.cjs');
|
|
7
|
+
require('./chunk-NUKRL3I6.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
Object.defineProperty(exports, "appendCompactBoundaryRecord", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkZ4BCLVTI_cjs.appendCompactBoundaryRecord; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "persistTurn", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkZ4BCLVTI_cjs.persistTurn; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "readSessionMessages", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkZ4BCLVTI_cjs.readSessionMessages; }
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=agent-session-store-WAKLOKWK.cjs.map
|
|
24
|
+
//# sourceMappingURL=agent-session-store-WAKLOKWK.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-session-store-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-session-store-WAKLOKWK.cjs"}
|