@standardagents/builder 0.28.1 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/built-in-routes.js +62 -10
- package/dist/built-in-routes.js.map +1 -1
- package/dist/{index-BzXyIJPA.d.ts → index-Cp_Zcrhy.d.ts} +10 -15
- package/dist/index.d.ts +1 -1
- package/dist/index.js +111 -25
- package/dist/index.js.map +1 -1
- package/dist/runtime.d.ts +3 -2
- package/dist/runtime.js +111 -25
- package/dist/runtime.js.map +1 -1
- package/dist/test.d.ts +1 -1
- package/package.json +5 -5
package/dist/built-in-routes.js
CHANGED
|
@@ -49,6 +49,39 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
49
49
|
));
|
|
50
50
|
|
|
51
51
|
// src/agents/client-forwarding.ts
|
|
52
|
+
function createRuntimeStreams(openClientStream) {
|
|
53
|
+
return {
|
|
54
|
+
async open(request) {
|
|
55
|
+
const opened = await openClientStream({
|
|
56
|
+
tool: request.capability,
|
|
57
|
+
meta: request.metadata,
|
|
58
|
+
timeoutMs: request.timeoutMs
|
|
59
|
+
});
|
|
60
|
+
if (!opened.ok) {
|
|
61
|
+
const failureData = opened.data;
|
|
62
|
+
return {
|
|
63
|
+
ok: false,
|
|
64
|
+
error: opened.error,
|
|
65
|
+
code: failureData?.code
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
let closed = false;
|
|
69
|
+
return {
|
|
70
|
+
ok: true,
|
|
71
|
+
stream: {
|
|
72
|
+
readable: opened.duplex.readable,
|
|
73
|
+
writable: opened.duplex.writable,
|
|
74
|
+
closed: opened.duplex.done,
|
|
75
|
+
close: (reason) => {
|
|
76
|
+
if (closed) return;
|
|
77
|
+
closed = true;
|
|
78
|
+
opened.duplex.close(reason);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
52
85
|
function encodeStreamChunk(bytes) {
|
|
53
86
|
let binary = "";
|
|
54
87
|
const step = 32768;
|
|
@@ -12544,6 +12577,14 @@ var init_ThreadStateImpl = __esm({
|
|
|
12544
12577
|
}
|
|
12545
12578
|
return this.getMetadataArguments();
|
|
12546
12579
|
}
|
|
12580
|
+
/**
|
|
12581
|
+
* Optional spec byte streams backed by the execution owner's existing
|
|
12582
|
+
* bridge. Streams are live resources: they proxy through ancestors when a
|
|
12583
|
+
* subagent opens one, but they never park or outlive a bridge disconnect.
|
|
12584
|
+
*/
|
|
12585
|
+
get runtimeStreams() {
|
|
12586
|
+
return createRuntimeStreams((request) => this.callClientStream(request));
|
|
12587
|
+
}
|
|
12547
12588
|
getMetadataArguments() {
|
|
12548
12589
|
const value = this._metadata.properties?.[SUBAGENT_INITIAL_ARGUMENTS_THREAD_PROPERTY];
|
|
12549
12590
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -13120,11 +13161,9 @@ var init_ThreadStateImpl = __esm({
|
|
|
13120
13161
|
return local;
|
|
13121
13162
|
}
|
|
13122
13163
|
/**
|
|
13123
|
-
*
|
|
13124
|
-
*
|
|
13125
|
-
*
|
|
13126
|
-
* is attached. Subagents must not call this directly; they proxy whole
|
|
13127
|
-
* requests up to the root thread instead (request-up / stream-down).
|
|
13164
|
+
* Legacy bridge implementation used by `runtimeStreams`. Streams require a
|
|
13165
|
+
* live execution owner and never park. A child thread proxies the complete
|
|
13166
|
+
* request to the nearest bridge-holding ancestor (request-up/stream-down).
|
|
13128
13167
|
*/
|
|
13129
13168
|
async callClientStream(request) {
|
|
13130
13169
|
const instance = this._threadInstance;
|
|
@@ -13150,7 +13189,11 @@ var init_ThreadStateImpl = __esm({
|
|
|
13150
13189
|
return { ok: true, duplex: this.buildProxyDuplex(stub, opened.id) };
|
|
13151
13190
|
}
|
|
13152
13191
|
if (opened.error && !opened.noClient) {
|
|
13153
|
-
return {
|
|
13192
|
+
return {
|
|
13193
|
+
ok: false,
|
|
13194
|
+
error: opened.error,
|
|
13195
|
+
data: opened.code ? { code: opened.code } : void 0
|
|
13196
|
+
};
|
|
13154
13197
|
}
|
|
13155
13198
|
}
|
|
13156
13199
|
} catch {
|
|
@@ -13169,6 +13212,12 @@ var init_ThreadStateImpl = __esm({
|
|
|
13169
13212
|
let settleDone;
|
|
13170
13213
|
const done = new Promise((r) => settleDone = r);
|
|
13171
13214
|
let closed = false;
|
|
13215
|
+
let settled = false;
|
|
13216
|
+
const settle = (result) => {
|
|
13217
|
+
if (settled) return;
|
|
13218
|
+
settled = true;
|
|
13219
|
+
settleDone(result);
|
|
13220
|
+
};
|
|
13172
13221
|
const readable = new ReadableStream({
|
|
13173
13222
|
async pull(controller) {
|
|
13174
13223
|
while (!closed) {
|
|
@@ -13177,7 +13226,7 @@ var init_ThreadStateImpl = __esm({
|
|
|
13177
13226
|
res = await stub.proxyStreamPull(id);
|
|
13178
13227
|
} catch (error) {
|
|
13179
13228
|
controller.error(error instanceof Error ? error : new Error(String(error)));
|
|
13180
|
-
|
|
13229
|
+
settle({ ok: false, error: "proxy stream pull failed" });
|
|
13181
13230
|
return;
|
|
13182
13231
|
}
|
|
13183
13232
|
for (const chunk of res.chunks) {
|
|
@@ -13185,7 +13234,7 @@ var init_ThreadStateImpl = __esm({
|
|
|
13185
13234
|
}
|
|
13186
13235
|
if (res.done) {
|
|
13187
13236
|
controller.close();
|
|
13188
|
-
|
|
13237
|
+
settle(res.error ? { ok: false, error: res.error } : { ok: true });
|
|
13189
13238
|
return;
|
|
13190
13239
|
}
|
|
13191
13240
|
if (res.chunks.length > 0) return;
|
|
@@ -13196,6 +13245,7 @@ var init_ThreadStateImpl = __esm({
|
|
|
13196
13245
|
closed = true;
|
|
13197
13246
|
void stub.proxyStreamAbort(id).catch(() => {
|
|
13198
13247
|
});
|
|
13248
|
+
settle({ ok: false, error: "proxy stream reader canceled" });
|
|
13199
13249
|
}
|
|
13200
13250
|
});
|
|
13201
13251
|
const writable = new WritableStream({
|
|
@@ -13210,16 +13260,18 @@ var init_ThreadStateImpl = __esm({
|
|
|
13210
13260
|
closed = true;
|
|
13211
13261
|
void stub.proxyStreamAbort(id).catch(() => {
|
|
13212
13262
|
});
|
|
13263
|
+
settle({ ok: false, error: "proxy stream writer aborted" });
|
|
13213
13264
|
}
|
|
13214
13265
|
});
|
|
13215
13266
|
return {
|
|
13216
13267
|
readable,
|
|
13217
13268
|
writable,
|
|
13218
13269
|
close: (error) => {
|
|
13270
|
+
if (closed) return;
|
|
13219
13271
|
closed = true;
|
|
13220
13272
|
void stub.proxyStreamAbort(id).catch(() => {
|
|
13221
13273
|
});
|
|
13222
|
-
|
|
13274
|
+
settle(error ? { ok: false, error } : { ok: true });
|
|
13223
13275
|
},
|
|
13224
13276
|
done
|
|
13225
13277
|
};
|
|
@@ -66504,7 +66556,7 @@ var config_get_default = defineController2(async ({ config, env: env2, req }) =>
|
|
|
66504
66556
|
});
|
|
66505
66557
|
|
|
66506
66558
|
// src/version.ts
|
|
66507
|
-
var BUILDER_VERSION = "0.
|
|
66559
|
+
var BUILDER_VERSION = "0.29.0".length > 0 ? "0.29.0" : "dev";
|
|
66508
66560
|
|
|
66509
66561
|
// src/api/diagnostics.get.ts
|
|
66510
66562
|
init_LLMRequest();
|