@standardagents/builder 0.37.7 → 0.37.8
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 +50 -6
- package/dist/built-in-routes.js.map +1 -1
- package/dist/index.js +49 -5
- package/dist/index.js.map +1 -1
- package/dist/runtime.js +49 -5
- package/dist/runtime.js.map +1 -1
- package/package.json +5 -5
package/dist/built-in-routes.js
CHANGED
|
@@ -9431,7 +9431,12 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
|
|
|
9431
9431
|
const threadState = ThreadStateImpl.fromFlowState(state);
|
|
9432
9432
|
for (const executor of executors) {
|
|
9433
9433
|
try {
|
|
9434
|
-
|
|
9434
|
+
const hooked = await executor(threadState, _FlowEngine.rowToHookMessage(result));
|
|
9435
|
+
result = {
|
|
9436
|
+
...result,
|
|
9437
|
+
...hooked,
|
|
9438
|
+
attachments: hooked.attachments === void 0 ? result.attachments : hooked.attachments === null ? null : typeof hooked.attachments === "string" ? hooked.attachments : JSON.stringify(hooked.attachments)
|
|
9439
|
+
};
|
|
9435
9440
|
} catch (error) {
|
|
9436
9441
|
console.error("[Hooks] \u2717 Error running before_create_message hook:", error);
|
|
9437
9442
|
}
|
|
@@ -9451,12 +9456,31 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
|
|
|
9451
9456
|
const threadState = ThreadStateImpl.fromFlowState(state);
|
|
9452
9457
|
for (const executor of executors) {
|
|
9453
9458
|
try {
|
|
9454
|
-
await executor(threadState, message);
|
|
9459
|
+
await executor(threadState, _FlowEngine.rowToHookMessage(message));
|
|
9455
9460
|
} catch (error) {
|
|
9456
9461
|
console.error("[Hooks] \u2717 Error running after_create_message hook:", error);
|
|
9457
9462
|
}
|
|
9458
9463
|
}
|
|
9459
9464
|
}
|
|
9465
|
+
/**
|
|
9466
|
+
* Builder rows store `attachments` as a JSON string; the spec hook surface
|
|
9467
|
+
* carries parsed AttachmentRef[]. Convert at every hook boundary so hooks
|
|
9468
|
+
* see the spec shape and cannot corrupt the stored row shape.
|
|
9469
|
+
*/
|
|
9470
|
+
static rowToHookMessage(row) {
|
|
9471
|
+
const { attachments, ...rest } = row;
|
|
9472
|
+
let parsed = void 0;
|
|
9473
|
+
if (attachments === null) parsed = null;
|
|
9474
|
+
else if (typeof attachments === "string" && attachments) {
|
|
9475
|
+
try {
|
|
9476
|
+
const p = JSON.parse(attachments);
|
|
9477
|
+
parsed = Array.isArray(p) ? p : void 0;
|
|
9478
|
+
} catch {
|
|
9479
|
+
parsed = void 0;
|
|
9480
|
+
}
|
|
9481
|
+
}
|
|
9482
|
+
return { ...rest, attachments: parsed };
|
|
9483
|
+
}
|
|
9460
9484
|
/**
|
|
9461
9485
|
* Run the before_update_message hook if it exists
|
|
9462
9486
|
* This hook allows developers to modify a message before it's updated
|
|
@@ -9495,7 +9519,7 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
|
|
|
9495
9519
|
const threadState = ThreadStateImpl.fromFlowState(state);
|
|
9496
9520
|
for (const executor of executors) {
|
|
9497
9521
|
try {
|
|
9498
|
-
await executor(threadState, message);
|
|
9522
|
+
await executor(threadState, _FlowEngine.rowToHookMessage(message));
|
|
9499
9523
|
} catch (error) {
|
|
9500
9524
|
console.error("[Hooks] \u2717 Error running after_update_message hook:", error);
|
|
9501
9525
|
}
|
|
@@ -10584,7 +10608,11 @@ ${msg.content}` : `${imageDescriptions}${nonImageList}`;
|
|
|
10584
10608
|
const threadState = ThreadStateImpl.fromFlowState(state);
|
|
10585
10609
|
for (const executor of executors) {
|
|
10586
10610
|
try {
|
|
10587
|
-
|
|
10611
|
+
const byId = /* @__PURE__ */ new Map();
|
|
10612
|
+
for (const row of result) if (row.id) byId.set(row.id, row);
|
|
10613
|
+
const hookView = result.map((row) => _FlowEngine.rowToHookMessage(row));
|
|
10614
|
+
const kept = await executor(threadState, hookView);
|
|
10615
|
+
result = kept.map((m) => m.id && byId.get(m.id) || null).filter((row) => row !== null);
|
|
10588
10616
|
} catch (error) {
|
|
10589
10617
|
console.error("[Hooks] \u2717 Error running filter_messages hook:", error);
|
|
10590
10618
|
}
|
|
@@ -13882,9 +13910,25 @@ var init_ThreadStateImpl = __esm({
|
|
|
13882
13910
|
parent_id: msg.parent_id,
|
|
13883
13911
|
depth: msg.depth,
|
|
13884
13912
|
silent: msg.silent,
|
|
13885
|
-
metadata: msg.metadata
|
|
13913
|
+
metadata: msg.metadata,
|
|
13914
|
+
status: msg.status,
|
|
13915
|
+
tool_status: msg.tool_status,
|
|
13916
|
+
attachments: this._parseAttachmentRefs(msg.attachments)
|
|
13886
13917
|
};
|
|
13887
13918
|
};
|
|
13919
|
+
/** Builder rows store attachments as a JSON string of AttachmentRef[];
|
|
13920
|
+
* spec messages carry the parsed refs. Dropping them here is what made
|
|
13921
|
+
* generated assets invisible to every session_state consumer. */
|
|
13922
|
+
_parseAttachmentRefs = (raw) => {
|
|
13923
|
+
if (!raw) return void 0;
|
|
13924
|
+
if (Array.isArray(raw)) return raw;
|
|
13925
|
+
try {
|
|
13926
|
+
const parsed = JSON.parse(raw);
|
|
13927
|
+
return Array.isArray(parsed) ? parsed : void 0;
|
|
13928
|
+
} catch {
|
|
13929
|
+
return void 0;
|
|
13930
|
+
}
|
|
13931
|
+
};
|
|
13888
13932
|
_mapFileRecord = (record24) => {
|
|
13889
13933
|
return {
|
|
13890
13934
|
path: record24.path,
|
|
@@ -67987,7 +68031,7 @@ var config_get_default = defineController2(async ({ config, env: env2, req }) =>
|
|
|
67987
68031
|
});
|
|
67988
68032
|
|
|
67989
68033
|
// src/version.ts
|
|
67990
|
-
var BUILDER_VERSION = "0.37.
|
|
68034
|
+
var BUILDER_VERSION = "0.37.8".length > 0 ? "0.37.8" : "dev";
|
|
67991
68035
|
|
|
67992
68036
|
// src/api/diagnostics.get.ts
|
|
67993
68037
|
init_LLMRequest();
|