@animalabs/agent-framework 0.22.3 → 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.
Files changed (234) hide show
  1. package/README.md +105 -3
  2. package/dist/src/agent.d.ts +36 -10
  3. package/dist/src/agent.d.ts.map +1 -1
  4. package/dist/src/agent.js +76 -32
  5. package/dist/src/agent.js.map +1 -1
  6. package/dist/src/code-execution/index.d.ts +1 -1
  7. package/dist/src/code-execution/index.d.ts.map +1 -1
  8. package/dist/src/code-execution/index.js.map +1 -1
  9. package/dist/src/code-execution/py-runner.d.ts +34 -2
  10. package/dist/src/code-execution/py-runner.d.ts.map +1 -1
  11. package/dist/src/code-execution/py-runner.js +72 -16
  12. package/dist/src/code-execution/py-runner.js.map +1 -1
  13. package/dist/src/code-execution/runtime-py.d.ts +3 -2
  14. package/dist/src/code-execution/runtime-py.d.ts.map +1 -1
  15. package/dist/src/code-execution/runtime-py.js +47 -7
  16. package/dist/src/code-execution/runtime-py.js.map +1 -1
  17. package/dist/src/code-execution/tool-definition.d.ts +12 -7
  18. package/dist/src/code-execution/tool-definition.d.ts.map +1 -1
  19. package/dist/src/code-execution/tool-definition.js +59 -11
  20. package/dist/src/code-execution/tool-definition.js.map +1 -1
  21. package/dist/src/config-checks.d.ts +2 -2
  22. package/dist/src/config-checks.d.ts.map +1 -1
  23. package/dist/src/config-checks.js +6 -2
  24. package/dist/src/config-checks.js.map +1 -1
  25. package/dist/src/framework.d.ts +744 -120
  26. package/dist/src/framework.d.ts.map +1 -1
  27. package/dist/src/framework.js +3546 -906
  28. package/dist/src/framework.js.map +1 -1
  29. package/dist/src/gate/event-gate.d.ts.map +1 -1
  30. package/dist/src/gate/event-gate.js +13 -6
  31. package/dist/src/gate/event-gate.js.map +1 -1
  32. package/dist/src/held-writes.d.ts +16 -0
  33. package/dist/src/held-writes.d.ts.map +1 -0
  34. package/dist/src/held-writes.js +56 -0
  35. package/dist/src/held-writes.js.map +1 -0
  36. package/dist/src/index.d.ts +7 -3
  37. package/dist/src/index.d.ts.map +1 -1
  38. package/dist/src/index.js +8 -4
  39. package/dist/src/index.js.map +1 -1
  40. package/dist/src/mcpl/capability-grant.d.ts +4 -0
  41. package/dist/src/mcpl/capability-grant.d.ts.map +1 -1
  42. package/dist/src/mcpl/capability-grant.js +1 -1
  43. package/dist/src/mcpl/capability-grant.js.map +1 -1
  44. package/dist/src/mcpl/channel-registry.d.ts +95 -18
  45. package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
  46. package/dist/src/mcpl/channel-registry.js +578 -150
  47. package/dist/src/mcpl/channel-registry.js.map +1 -1
  48. package/dist/src/mcpl/convert-block.d.ts +2 -2
  49. package/dist/src/mcpl/convert-block.d.ts.map +1 -1
  50. package/dist/src/mcpl/convert-block.js +6 -7
  51. package/dist/src/mcpl/convert-block.js.map +1 -1
  52. package/dist/src/mcpl/index.d.ts +5 -1
  53. package/dist/src/mcpl/index.d.ts.map +1 -1
  54. package/dist/src/mcpl/index.js +3 -1
  55. package/dist/src/mcpl/index.js.map +1 -1
  56. package/dist/src/mcpl/inference-router.d.ts +4 -2
  57. package/dist/src/mcpl/inference-router.d.ts.map +1 -1
  58. package/dist/src/mcpl/inference-router.js +6 -7
  59. package/dist/src/mcpl/inference-router.js.map +1 -1
  60. package/dist/src/mcpl/log-value.d.ts +7 -0
  61. package/dist/src/mcpl/log-value.d.ts.map +1 -1
  62. package/dist/src/mcpl/log-value.js +9 -0
  63. package/dist/src/mcpl/log-value.js.map +1 -1
  64. package/dist/src/mcpl/modern-connection.d.ts +227 -0
  65. package/dist/src/mcpl/modern-connection.d.ts.map +1 -0
  66. package/dist/src/mcpl/modern-connection.js +1088 -0
  67. package/dist/src/mcpl/modern-connection.js.map +1 -0
  68. package/dist/src/mcpl/prefix-rule.d.ts +18 -0
  69. package/dist/src/mcpl/prefix-rule.d.ts.map +1 -0
  70. package/dist/src/mcpl/prefix-rule.js +25 -0
  71. package/dist/src/mcpl/prefix-rule.js.map +1 -0
  72. package/dist/src/mcpl/protocol-family.d.ts +179 -0
  73. package/dist/src/mcpl/protocol-family.d.ts.map +1 -0
  74. package/dist/src/mcpl/protocol-family.js +697 -0
  75. package/dist/src/mcpl/protocol-family.js.map +1 -0
  76. package/dist/src/mcpl/push-coalescer.d.ts +38 -19
  77. package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
  78. package/dist/src/mcpl/push-coalescer.js +52 -23
  79. package/dist/src/mcpl/push-coalescer.js.map +1 -1
  80. package/dist/src/mcpl/reference-fetcher.d.ts +66 -15
  81. package/dist/src/mcpl/reference-fetcher.d.ts.map +1 -1
  82. package/dist/src/mcpl/reference-fetcher.js +243 -76
  83. package/dist/src/mcpl/reference-fetcher.js.map +1 -1
  84. package/dist/src/mcpl/references.d.ts +63 -18
  85. package/dist/src/mcpl/references.d.ts.map +1 -1
  86. package/dist/src/mcpl/references.js +117 -32
  87. package/dist/src/mcpl/references.js.map +1 -1
  88. package/dist/src/mcpl/server-connection.d.ts +326 -30
  89. package/dist/src/mcpl/server-connection.d.ts.map +1 -1
  90. package/dist/src/mcpl/server-connection.js +995 -212
  91. package/dist/src/mcpl/server-connection.js.map +1 -1
  92. package/dist/src/mcpl/server-registry.d.ts +25 -5
  93. package/dist/src/mcpl/server-registry.d.ts.map +1 -1
  94. package/dist/src/mcpl/server-registry.js +51 -12
  95. package/dist/src/mcpl/server-registry.js.map +1 -1
  96. package/dist/src/mcpl/tool-result-normalize.d.ts +54 -0
  97. package/dist/src/mcpl/tool-result-normalize.d.ts.map +1 -0
  98. package/dist/src/mcpl/tool-result-normalize.js +232 -0
  99. package/dist/src/mcpl/tool-result-normalize.js.map +1 -0
  100. package/dist/src/mcpl/transport.d.ts +56 -13
  101. package/dist/src/mcpl/transport.d.ts.map +1 -1
  102. package/dist/src/mcpl/transport.js +206 -70
  103. package/dist/src/mcpl/transport.js.map +1 -1
  104. package/dist/src/mcpl/types.d.ts +66 -20
  105. package/dist/src/mcpl/types.d.ts.map +1 -1
  106. package/dist/src/mcpl/types.js.map +1 -1
  107. package/dist/src/mcpl/visible-content.d.ts +2 -1
  108. package/dist/src/mcpl/visible-content.d.ts.map +1 -1
  109. package/dist/src/mcpl/visible-content.js +2 -1
  110. package/dist/src/mcpl/visible-content.js.map +1 -1
  111. package/dist/src/module-registry.d.ts +16 -6
  112. package/dist/src/module-registry.d.ts.map +1 -1
  113. package/dist/src/module-registry.js +65 -6
  114. package/dist/src/module-registry.js.map +1 -1
  115. package/dist/src/modules/api/index.d.ts +1 -1
  116. package/dist/src/modules/api/index.d.ts.map +1 -1
  117. package/dist/src/modules/api/index.js +3 -2
  118. package/dist/src/modules/api/index.js.map +1 -1
  119. package/dist/src/modules/discord/discord-js-client.d.ts +42 -2
  120. package/dist/src/modules/discord/discord-js-client.d.ts.map +1 -1
  121. package/dist/src/modules/discord/discord-js-client.js +268 -65
  122. package/dist/src/modules/discord/discord-js-client.js.map +1 -1
  123. package/dist/src/modules/discord/index.d.ts +27 -5
  124. package/dist/src/modules/discord/index.d.ts.map +1 -1
  125. package/dist/src/modules/discord/index.js +366 -76
  126. package/dist/src/modules/discord/index.js.map +1 -1
  127. package/dist/src/modules/discord/refusal.d.ts +14 -0
  128. package/dist/src/modules/discord/refusal.d.ts.map +1 -0
  129. package/dist/src/modules/discord/refusal.js +14 -0
  130. package/dist/src/modules/discord/refusal.js.map +1 -0
  131. package/dist/src/modules/discord/types.d.ts +17 -7
  132. package/dist/src/modules/discord/types.d.ts.map +1 -1
  133. package/dist/src/modules/health/index.d.ts.map +1 -1
  134. package/dist/src/modules/health/index.js +6 -2
  135. package/dist/src/modules/health/index.js.map +1 -1
  136. package/dist/src/modules/index.d.ts +1 -1
  137. package/dist/src/modules/index.d.ts.map +1 -1
  138. package/dist/src/modules/index.js +1 -1
  139. package/dist/src/modules/index.js.map +1 -1
  140. package/dist/src/modules/workspace/disk-agreement.d.ts +25 -2
  141. package/dist/src/modules/workspace/disk-agreement.d.ts.map +1 -1
  142. package/dist/src/modules/workspace/disk-agreement.js +45 -5
  143. package/dist/src/modules/workspace/disk-agreement.js.map +1 -1
  144. package/dist/src/modules/workspace/effects.d.ts +2 -1
  145. package/dist/src/modules/workspace/effects.d.ts.map +1 -1
  146. package/dist/src/modules/workspace/effects.js +19 -9
  147. package/dist/src/modules/workspace/effects.js.map +1 -1
  148. package/dist/src/modules/workspace/index.d.ts +214 -42
  149. package/dist/src/modules/workspace/index.d.ts.map +1 -1
  150. package/dist/src/modules/workspace/index.js +667 -113
  151. package/dist/src/modules/workspace/index.js.map +1 -1
  152. package/dist/src/modules/workspace/observe.d.ts +240 -8
  153. package/dist/src/modules/workspace/observe.d.ts.map +1 -1
  154. package/dist/src/modules/workspace/observe.js +554 -24
  155. package/dist/src/modules/workspace/observe.js.map +1 -1
  156. package/dist/src/modules/workspace/types.d.ts +10 -1
  157. package/dist/src/modules/workspace/types.d.ts.map +1 -1
  158. package/dist/src/modules/workspace/types.js.map +1 -1
  159. package/dist/src/modules/workspace/watcher.d.ts +42 -0
  160. package/dist/src/modules/workspace/watcher.d.ts.map +1 -1
  161. package/dist/src/modules/workspace/watcher.js +130 -25
  162. package/dist/src/modules/workspace/watcher.js.map +1 -1
  163. package/dist/src/silent-heartbeat.d.ts +112 -39
  164. package/dist/src/silent-heartbeat.d.ts.map +1 -1
  165. package/dist/src/silent-heartbeat.js +100 -29
  166. package/dist/src/silent-heartbeat.js.map +1 -1
  167. package/dist/src/tool-args.d.ts +40 -0
  168. package/dist/src/tool-args.d.ts.map +1 -0
  169. package/dist/src/tool-args.js +207 -0
  170. package/dist/src/tool-args.js.map +1 -0
  171. package/dist/src/tool-presentation.d.ts.map +1 -1
  172. package/dist/src/tool-presentation.js +9 -2
  173. package/dist/src/tool-presentation.js.map +1 -1
  174. package/dist/src/types/agent.d.ts +27 -17
  175. package/dist/src/types/agent.d.ts.map +1 -1
  176. package/dist/src/types/events.d.ts +8 -0
  177. package/dist/src/types/events.d.ts.map +1 -1
  178. package/dist/src/types/framework.d.ts +17 -2
  179. package/dist/src/types/framework.d.ts.map +1 -1
  180. package/dist/src/types/module.d.ts +54 -10
  181. package/dist/src/types/module.d.ts.map +1 -1
  182. package/dist/src/types/trace.d.ts +2 -2
  183. package/dist/src/types/trace.d.ts.map +1 -1
  184. package/package.json +3 -1
  185. package/src/agent.ts +99 -36
  186. package/src/code-execution/index.ts +1 -0
  187. package/src/code-execution/py-runner.ts +104 -17
  188. package/src/code-execution/runtime-py.ts +47 -7
  189. package/src/code-execution/tool-definition.ts +65 -11
  190. package/src/config-checks.ts +4 -2
  191. package/src/framework.ts +3633 -956
  192. package/src/gate/event-gate.ts +14 -6
  193. package/src/held-writes.ts +59 -0
  194. package/src/index.ts +19 -4
  195. package/src/mcpl/capability-grant.ts +1 -1
  196. package/src/mcpl/channel-registry.ts +613 -160
  197. package/src/mcpl/convert-block.ts +15 -7
  198. package/src/mcpl/index.ts +14 -1
  199. package/src/mcpl/inference-router.ts +8 -7
  200. package/src/mcpl/log-value.ts +10 -0
  201. package/src/mcpl/modern-connection.ts +1182 -0
  202. package/src/mcpl/prefix-rule.ts +32 -0
  203. package/src/mcpl/protocol-family.ts +691 -0
  204. package/src/mcpl/push-coalescer.ts +67 -29
  205. package/src/mcpl/reference-fetcher.ts +288 -82
  206. package/src/mcpl/references.ts +123 -33
  207. package/src/mcpl/server-connection.ts +1050 -221
  208. package/src/mcpl/server-registry.ts +50 -12
  209. package/src/mcpl/tool-result-normalize.ts +294 -0
  210. package/src/mcpl/transport.ts +204 -62
  211. package/src/mcpl/types.ts +67 -20
  212. package/src/mcpl/visible-content.ts +2 -1
  213. package/src/module-registry.ts +68 -13
  214. package/src/modules/api/index.ts +3 -2
  215. package/src/modules/discord/discord-js-client.ts +288 -72
  216. package/src/modules/discord/index.ts +380 -77
  217. package/src/modules/discord/refusal.ts +13 -0
  218. package/src/modules/discord/types.ts +17 -9
  219. package/src/modules/health/index.ts +6 -2
  220. package/src/modules/index.ts +1 -1
  221. package/src/modules/workspace/disk-agreement.ts +46 -5
  222. package/src/modules/workspace/effects.ts +18 -7
  223. package/src/modules/workspace/index.ts +722 -124
  224. package/src/modules/workspace/observe.ts +591 -22
  225. package/src/modules/workspace/types.ts +10 -1
  226. package/src/modules/workspace/watcher.ts +126 -25
  227. package/src/silent-heartbeat.ts +184 -59
  228. package/src/tool-args.ts +213 -0
  229. package/src/tool-presentation.ts +9 -2
  230. package/src/types/agent.ts +27 -17
  231. package/src/types/events.ts +8 -0
  232. package/src/types/framework.ts +17 -2
  233. package/src/types/module.ts +55 -10
  234. package/src/types/trace.ts +2 -2
@@ -0,0 +1,232 @@
1
+ /** What a result whose content is present but isn't a list of blocks reads
2
+ * as, on the model's path and a script's alike. */
3
+ export const MALFORMED_CONTENT_NOTICE = '[malformed result: its content is not a list of blocks; the tool may already have completed]';
4
+ /** Stub fields are bounded independently of anything the server sends. */
5
+ const STUB_FIELD_POINTS = 200;
6
+ /** A URI is the reference itself, so it's bounded far more loosely than a
7
+ * stub field: a real one survives, and a pathological one can't flood the
8
+ * model's view. */
9
+ const URI_POINTS = 2048;
10
+ /** The image types providers take inline. Any other image is saved. */
11
+ const NATIVE_IMAGE_TYPES = new Set(['image/png', 'image/jpeg', 'image/gif', 'image/webp']);
12
+ /** The decoded size providers take per inline image: the same 5 MB ceiling
13
+ * the framework's read_image tool guards. A larger image is saved. */
14
+ const NATIVE_IMAGE_MAX_BYTES = 5 * 1024 * 1024;
15
+ /** Why a payload isn't shown inline, unless said otherwise. */
16
+ const UNSUPPORTED = "the model can't take this type";
17
+ /** The first `max` code points of `text`, never splitting a surrogate pair,
18
+ * and how many code points were left out. */
19
+ function headPoints(text, max) {
20
+ let end = 0;
21
+ let points = 0;
22
+ while (end < text.length && points < max) {
23
+ end += text.codePointAt(end) > 0xffff ? 2 : 1;
24
+ points++;
25
+ }
26
+ let omitted = 0;
27
+ for (let i = end; i < text.length; omitted++)
28
+ i += text.codePointAt(i) > 0xffff ? 2 : 1;
29
+ return { head: text.slice(0, end), omitted };
30
+ }
31
+ /** Any value as JSON (a string quoted too). Never throws. */
32
+ function asJson(value) {
33
+ try {
34
+ return JSON.stringify(value) ?? 'null';
35
+ }
36
+ catch {
37
+ return Object.prototype.toString.call(value);
38
+ }
39
+ }
40
+ /** Any value as text: a string as itself, anything else as JSON. Never throws. */
41
+ function asText(value) {
42
+ return typeof value === 'string' ? value : asJson(value);
43
+ }
44
+ function bounded(value, max = STUB_FIELD_POINTS) {
45
+ const { head, omitted } = headPoints(asText(value), max);
46
+ return omitted > 0 ? `${head}…` : head;
47
+ }
48
+ /** A payload's decoded size, its base64 read without the whitespace a
49
+ * wrapped encoding carries. */
50
+ function decodedSize(base64) {
51
+ const compact = base64.replace(/\s+/g, '');
52
+ const padding = compact.endsWith('==') ? 2 : compact.endsWith('=') ? 1 : 0;
53
+ return Math.max(0, Math.floor((compact.length * 3) / 4) - padding);
54
+ }
55
+ function humanSize(bytes) {
56
+ if (bytes < 1024)
57
+ return `${bytes} B`;
58
+ if (bytes < 1024 * 1024)
59
+ return `${(bytes / 1024).toFixed(1)} KB`;
60
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
61
+ }
62
+ const KNOWN_EXTENSIONS = { 'octet-stream': 'bin', 'mpeg': 'mp3', 'plain': 'txt', 'x-wav': 'wav' };
63
+ function extensionFor(mimeType) {
64
+ const subtype = mimeType.split('/')[1]?.split(';')[0]?.trim().toLowerCase() ?? '';
65
+ // The table's own keys only: a subtype such as 'constructor' must not find
66
+ // what Object.prototype holds.
67
+ const ext = Object.hasOwn(KNOWN_EXTENSIONS, subtype) ? KNOWN_EXTENSIONS[subtype] : subtype.replace(/[^a-z0-9]/g, '');
68
+ return ext.length > 0 && ext.length <= 10 ? ext : 'bin';
69
+ }
70
+ /** The image type a provider takes inline, in its canonical spelling, or
71
+ * null when it takes none of these. */
72
+ function nativeImageType(mimeType) {
73
+ if (typeof mimeType !== 'string')
74
+ return null;
75
+ const base = mimeType.split(';')[0].trim().toLowerCase();
76
+ return NATIVE_IMAGE_TYPES.has(base) ? base : null;
77
+ }
78
+ /**
79
+ * Normalize a standard MCP tool result into the framework's `ToolResult`.
80
+ * `label` names saved payloads (one per call; payloads get an index suffix).
81
+ * A payload that can't be retained (no `save`, or saving failed) makes the
82
+ * result a failure to materialize, never a success with part of it lost.
83
+ * Content that is present but isn't a list of blocks makes it a malformed
84
+ * result, never an empty success. A tool's error result with no words, or
85
+ * only whitespace, reads as `noWords`, which the framework words for its
86
+ * server and tool.
87
+ */
88
+ export async function normalizeStandardToolResult(result, label, save, noWords = 'Tool call failed') {
89
+ const malformed = result.content !== undefined && !Array.isArray(result.content);
90
+ const raw = Array.isArray(result.content) ? result.content : [];
91
+ const blocks = [];
92
+ let saved = 0;
93
+ /** Payloads that could be neither shown nor retained. */
94
+ let lost = 0;
95
+ const payloadStub = async (kind, base64, mimeType, opts = {}) => {
96
+ const why = opts.why ?? UNSUPPORTED;
97
+ const size = humanSize(decodedSize(base64));
98
+ const what = `[${kind}${opts.origin ? ` ${bounded(opts.origin, URI_POINTS)}` : ''}: ${bounded(mimeType)}, ${size}`;
99
+ if (!save) {
100
+ lost++;
101
+ return `${what}. Not retained: ${why}, and no workspace is mounted to save it]`;
102
+ }
103
+ const fileName = `${label}-${++saved}.${extensionFor(mimeType)}`;
104
+ const path = await save(fileName, Buffer.from(base64, 'base64'), mimeType).catch((error) => {
105
+ // The stub says only that saving failed; why goes to the host's log.
106
+ console.error(`[mcp] saving tool payload ${fileName} (${kind}, ${JSON.stringify(bounded(mimeType))}, ${size}) failed:`, error);
107
+ return null;
108
+ });
109
+ if (path)
110
+ return `${what}, saved to workspace file ${path}${why === UNSUPPORTED ? '' : `; not shown inline: ${why}`}]`;
111
+ lost++;
112
+ return `${what}. Not retained: ${why}, and saving it to the workspace failed]`;
113
+ };
114
+ for (const entry of raw) {
115
+ if (!entry || typeof entry !== 'object' || Array.isArray(entry)) {
116
+ blocks.push({ type: 'text', text: `[malformed content entry, left out: ${bounded(entry)}]` });
117
+ continue;
118
+ }
119
+ const block = entry;
120
+ switch (block.type) {
121
+ case 'text':
122
+ blocks.push(typeof block.text === 'string'
123
+ ? { type: 'text', text: block.text }
124
+ : { type: 'text', text: '[malformed text block, left out: its text is not a string]' });
125
+ break;
126
+ case 'image':
127
+ case 'audio': {
128
+ const kind = block.type;
129
+ if (typeof block.data !== 'string') {
130
+ blocks.push({ type: 'text', text: `[${kind} without inline data, not fetched${typeof block.uri === 'string' ? `: ${bounded(block.uri, URI_POINTS)}` : ''}]` });
131
+ break;
132
+ }
133
+ // Inline data with no type is still a payload, of no known type.
134
+ const mimeType = typeof block.mimeType === 'string' ? block.mimeType : 'application/octet-stream';
135
+ const native = kind === 'image' ? nativeImageType(block.mimeType) : null;
136
+ if (native && decodedSize(block.data) <= NATIVE_IMAGE_MAX_BYTES) {
137
+ // Passed on without a wrapped encoding's whitespace, which a
138
+ // provider may refuse, and with it the whole request.
139
+ blocks.push({ type: 'image', data: block.data.replace(/\s+/g, ''), mimeType: native });
140
+ }
141
+ else {
142
+ const why = native ? `over the ${humanSize(NATIVE_IMAGE_MAX_BYTES)} a model takes per image` : UNSUPPORTED;
143
+ blocks.push({ type: 'text', text: await payloadStub(kind, block.data, mimeType, { why }) });
144
+ }
145
+ break;
146
+ }
147
+ case 'resource_link': {
148
+ const name = typeof block.name === 'string' ? block.name : undefined;
149
+ const mime = typeof block.mimeType === 'string' ? `, ${bounded(block.mimeType)}` : '';
150
+ blocks.push({ type: 'text', text: `[resource link${name ? ` "${bounded(name)}"` : ''}: ${bounded(block.uri, URI_POINTS)}${mime}; not fetched]` });
151
+ break;
152
+ }
153
+ case 'resource': {
154
+ const resource = (block.resource && typeof block.resource === 'object' ? block.resource : {});
155
+ const uri = typeof resource.uri === 'string' ? resource.uri : undefined;
156
+ const mime = typeof resource.mimeType === 'string' ? resource.mimeType : undefined;
157
+ if (typeof resource.text === 'string') {
158
+ blocks.push({ type: 'text', text: `[resource ${uri === undefined ? '(no uri)' : bounded(uri, URI_POINTS)}${mime ? `, ${bounded(mime)}` : ''}]\n${resource.text}` });
159
+ }
160
+ else if (typeof resource.blob === 'string') {
161
+ blocks.push({ type: 'text', text: await payloadStub('resource', resource.blob, mime ?? 'application/octet-stream', { origin: uri }) });
162
+ }
163
+ else {
164
+ blocks.push({ type: 'text', text: `[resource ${uri === undefined ? '(no uri)' : bounded(uri, URI_POINTS)} with no contents]` });
165
+ }
166
+ break;
167
+ }
168
+ default: {
169
+ // Unknown to this client: shown as data rather than dropped, bounded
170
+ // like a stub field, so a large or binary payload can't flood the
171
+ // model's view.
172
+ const { head, omitted } = headPoints(asText(entry), STUB_FIELD_POINTS);
173
+ blocks.push({ type: 'text', text: omitted > 0 ? `${head}… [${omitted} more characters of this block left out]` : head });
174
+ }
175
+ }
176
+ }
177
+ const failing = !!result.isError || lost > 0 || malformed;
178
+ if (failing) {
179
+ // A failed result is read only as its text: an inline image becomes a
180
+ // payload like any other, saved and named, or marked not retained.
181
+ for (let i = 0; i < blocks.length; i++) {
182
+ const block = blocks[i];
183
+ if (block.type === 'image') {
184
+ blocks[i] = { type: 'text', text: await payloadStub('image', block.data, block.mimeType, { why: 'a failed result is read as its text alone' }) };
185
+ }
186
+ }
187
+ }
188
+ const hasStructured = Object.prototype.hasOwnProperty.call(result, 'structuredContent');
189
+ // Only the server's own text blocks count as its presentation for the
190
+ // model. Stubs this module wrote are notices, not the server's text.
191
+ const serverText = raw.some((entry) => {
192
+ const block = entry;
193
+ return !!block && typeof block === 'object' && block.type === 'text' && typeof block.text === 'string' && block.text.trim().length > 0;
194
+ });
195
+ if (hasStructured && !serverText) {
196
+ blocks.push({ type: 'text', text: asJson(result.structuredContent) });
197
+ }
198
+ const text = blocks.filter((b) => b.type === 'text').map((b) => b.text).join('\n');
199
+ const structured = hasStructured ? { structured: result.structuredContent } : {};
200
+ if (result.isError) {
201
+ return { success: false, error: text.trim() ? text : noWords, isError: true, ...structured };
202
+ }
203
+ if (malformed) {
204
+ return {
205
+ success: false,
206
+ error: `${MALFORMED_CONTENT_NOTICE}${text ? `\n${text}` : ''}`,
207
+ isError: true,
208
+ ...structured,
209
+ };
210
+ }
211
+ if (lost > 0) {
212
+ // The server answered, but part of its answer is gone: report that as a
213
+ // failure to materialize the result, never as a success.
214
+ return {
215
+ success: false,
216
+ error: `[result incomplete: ${lost} payload(s) could not be retained, so this result is not complete; ` +
217
+ `the tool may already have completed]\n${text}`,
218
+ isError: true,
219
+ ...structured,
220
+ };
221
+ }
222
+ const hasImage = blocks.some((b) => b.type === 'image');
223
+ return {
224
+ success: true,
225
+ // Text-only results keep the joined-string convention callers expect.
226
+ // An image keeps the array, so the model sees it natively.
227
+ data: hasImage ? blocks : (text || undefined),
228
+ isError: false,
229
+ ...structured,
230
+ };
231
+ }
232
+ //# sourceMappingURL=tool-result-normalize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-result-normalize.js","sourceRoot":"","sources":["../../../src/mcpl/tool-result-normalize.ts"],"names":[],"mappings":"AAgCA;oDACoD;AACpD,MAAM,CAAC,MAAM,wBAAwB,GACnC,8FAA8F,CAAC;AAMjG,0EAA0E;AAC1E,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAC9B;;oBAEoB;AACpB,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,uEAAuE;AACvE,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;AAC3F;uEACuE;AACvE,MAAM,sBAAsB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAE/C,+DAA+D;AAC/D,MAAM,WAAW,GAAG,gCAAgC,CAAC;AAIrD;8CAC8C;AAC9C,SAAS,UAAU,CAAC,IAAY,EAAE,GAAW;IAC3C,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,OAAO,GAAG,GAAG,IAAI,CAAC,MAAM,IAAI,MAAM,GAAG,GA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OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,UAAU,EAAE,CAAC;IAC/F,CAAC;IACD,IAAI,SAAS,EAAE,CAAC;QACd,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,GAAG,wBAAwB,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;YAC9D,OAAO,EAAE,IAAI;YACb,GAAG,UAAU;SACd,CAAC;IACJ,CAAC;IACD,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC;QACb,wEAAwE;QACxE,yDAAyD;QACzD,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,uBAAuB,IAAI,qEAAqE;gBACrG,yCAAyC,IAAI,EAAE;YACjD,OAAO,EAAE,IAAI;YACb,GAAG,UAAU;SACd,CAAC;IACJ,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;IACxD,OAAO;QACL,OAAO,EAAE,IAAI;QACb,sEAAsE;QACtE,2DAA2D;QAC3D,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,SAAS,CAAC;QAC7C,OAAO,EAAE,KAAK;QACd,GAAG,UAAU;KACd,CAAC;AACJ,CAAC"}
@@ -35,6 +35,9 @@ export interface TransportCloseInfo {
35
35
  * - `'stderr'` `(line: string)` diagnostic line (stdio child stderr; never WS)
36
36
  * - `'error'` `(err: Error)` transport-level error
37
37
  * - `'close'` `(info: TransportCloseInfo)` transport closed (once)
38
+ * - `'unreaped'` `(failure: Error)` a stdio child whose pipe failed
39
+ * outlived SIGKILL too: the transport stays open, owning the child, and
40
+ * close() retries the reap (never WS)
38
41
  *
39
42
  * Inbound `'line'`/`'stderr'` events are buffered until the first matching
40
43
  * listener attaches (and re-buffered whenever there are none), so no message is
@@ -58,6 +61,14 @@ export declare abstract class McplTransport extends EventEmitter {
58
61
  * child's stderr, and '' for a transport that has none.
59
62
  */
60
63
  get stderrTail(): string;
64
+ /**
65
+ * The error a stdio child's stdin or stdout failed with, once one has. The
66
+ * transport is ending the child then, and stays open until it exits, but
67
+ * writes nothing more to it: writeLine drops each line, and both engines
68
+ * refuse a request as not sent. Undefined while writes go out, and always
69
+ * for a transport that has no pipes.
70
+ */
71
+ get pipeFailure(): Error | undefined;
61
72
  /**
62
73
  * Resolves once the server's diagnostic stream has ended or closed, so that
63
74
  * {@link stderrTail} holds what arrived on it, or once `ms` have passed while
@@ -127,6 +138,7 @@ export declare class StdioTransport extends McplTransport {
127
138
  /** True once the child's stderr has ended or closed. */
128
139
  private stderrDone;
129
140
  get stderrTail(): string;
141
+ get pipeFailure(): Error | undefined;
130
142
  stderrEnded(ms: number): Promise<void>;
131
143
  private constructor();
132
144
  /**
@@ -136,7 +148,31 @@ export declare class StdioTransport extends McplTransport {
136
148
  */
137
149
  static spawn(config: McplServerConfig): Promise<StdioTransport>;
138
150
  writeLine(json: string): void;
151
+ private closing;
152
+ /**
153
+ * Close and reap: resolves once the child has actually exited, not merely
154
+ * been signalled (`child.killed` is true as soon as a signal is sent). A
155
+ * child that outlives SIGTERM by {@link STDIO_EXIT_GRACE_MS} gets SIGKILL.
156
+ * If it still hasn't exited after that bound again, close rejects: an
157
+ * explicit cleanup failure, rather than waiting forever or claiming an
158
+ * exit that wasn't seen. Calls share one attempt, and so does a pipe
159
+ * failure that is already ending the child; a later call succeeds if the
160
+ * child has exited since.
161
+ */
139
162
  close(): Promise<void>;
163
+ private reap;
164
+ /** Whether the child has exited, or never started (a spawn error). */
165
+ private exited;
166
+ private terminating;
167
+ /**
168
+ * End the child: SIGTERM, then SIGKILL once it has outlived SIGTERM by
169
+ * {@link STDIO_EXIT_GRACE_MS}. Resolves once it has exited; rejects if it
170
+ * still hasn't that long after SIGKILL. close() and a pipe failure share
171
+ * one attempt, so no second signal or timer goes out. A failed attempt is
172
+ * re-checked, not repeated: a child that has exited since resolves it.
173
+ */
174
+ private terminate;
175
+ private escalate;
140
176
  }
141
177
  export declare class WebSocketTransport extends McplTransport {
142
178
  private readonly ws;
@@ -145,19 +181,23 @@ export declare class WebSocketTransport extends McplTransport {
145
181
  /**
146
182
  * Dial `config.url` and resolve once the socket is OPEN. Appends `?token=`
147
183
  * when `config.token` is set. Rejects on connect error / timeout (and tears
148
- * the socket down) so a failed dial never leaks an open handle.
184
+ * the socket down) so a failed dial never leaks an open handle. `signal`
185
+ * ends a dial whose connection is closed meanwhile, at once, rather than
186
+ * at the open timeout.
149
187
  */
150
- static open(config: McplServerConfig): Promise<WebSocketTransport>;
188
+ static open(config: McplServerConfig, signal?: AbortSignal): Promise<WebSocketTransport>;
151
189
  writeLine(json: string): void;
152
190
  close(): Promise<void>;
153
191
  }
154
192
  /**
155
- * Build the dial URL: validate it's a ws(s):// URL and append the auth token as
156
- * a `token` query param when provided (preserving any existing query).
193
+ * Build the dial URL: validate it's a ws(s):// URL the ws library will dial,
194
+ * which refuses one with a fragment, and append the auth token as a `token`
195
+ * query param when provided (preserving any existing query).
157
196
  */
158
197
  export declare function buildWebSocketUrl(config: McplServerConfig, tokenOverride?: string | null): string;
159
- /** True when the config selects the WebSocket transport (explicit `transport`,
160
- * or a `url` with no `command`). */
198
+ /** True when the config selects the WebSocket transport, as
199
+ * {@link resolveServerBinding} decides it; false for any other transport and
200
+ * for a configuration it refuses. */
161
201
  export declare function isWebSocketTransport(config: McplServerConfig): boolean;
162
202
  /**
163
203
  * Refuse a server config whose `inheritEnv`, `reconnect` or `allowHostCommands`
@@ -166,15 +206,18 @@ export declare function isWebSocketTransport(config: McplServerConfig): boolean;
166
206
  * only `true` as on, so the quotes would hide what the value does. null counts
167
207
  * as not set, so a generated config that writes an unset setting as null
168
208
  * keeps working. `inheritEnv` is checked only for a stdio server, since a
169
- * WebSocket server never reads it. The error names the server, the setting
170
- * and the value's kind, not the value, which could be a secret pasted into
171
- * the wrong field.
209
+ * network server, WebSocket or HTTP, never reads it. The error names the
210
+ * server, the setting and the value's kind, not the value, which could be a
211
+ * secret pasted into the wrong field.
172
212
  */
173
213
  export declare function assertServerConfigBooleans(config: McplServerConfig): void;
174
214
  /**
175
- * Open the transport selected by `config` (WebSocket when `transport` is
176
- * 'websocket' or a bare `url` is given; stdio otherwise). The returned transport
177
- * is connected at the byte level but has NOT performed the MCPL handshake.
215
+ * Open the legacy transport `config` selects, as {@link resolveServerBinding}
216
+ * decides it: stdio for a `command`, MCPL's WebSocket binding for a ws(s)://
217
+ * url. A configuration it refuses, or one for the modern family (an http(s)
218
+ * url, or `protocol: 'modern'`), throws before anything is spawned or dialed.
219
+ * The returned transport is connected at the byte level but has NOT
220
+ * performed the MCPL handshake.
178
221
  */
179
- export declare function openTransport(config: McplServerConfig): Promise<McplTransport>;
222
+ export declare function openTransport(config: McplServerConfig, signal?: AbortSignal): Promise<McplTransport>;
180
223
  //# sourceMappingURL=transport.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../src/mcpl/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAInD;4EAC4E;AAC5E,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;qDACiD;IACjD,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;;;;;GAYG;AAC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