@flutchai/flutch-sdk 0.1.20 → 0.1.23
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/index.cjs +28 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +29 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -177,8 +177,8 @@ function findCallbackMethod(target, handler) {
|
|
|
177
177
|
var CALLBACK_METADATA_KEY, CALLBACK_CLASS_METADATA_KEY;
|
|
178
178
|
var init_callback_decorators = __esm({
|
|
179
179
|
"src/callbacks/callback.decorators.ts"() {
|
|
180
|
-
CALLBACK_METADATA_KEY =
|
|
181
|
-
CALLBACK_CLASS_METADATA_KEY =
|
|
180
|
+
CALLBACK_METADATA_KEY = Symbol("callbacks");
|
|
181
|
+
CALLBACK_CLASS_METADATA_KEY = Symbol("callback_class");
|
|
182
182
|
}
|
|
183
183
|
});
|
|
184
184
|
exports.EndpointRegistry = void 0;
|
|
@@ -450,8 +450,8 @@ exports.ENDPOINT_METADATA_KEY = void 0; var UI_ENDPOINT_CLASS_METADATA_KEY, UI_E
|
|
|
450
450
|
var init_endpoint_decorators = __esm({
|
|
451
451
|
"src/agent-ui/endpoint.decorators.ts"() {
|
|
452
452
|
exports.ENDPOINT_METADATA_KEY = "graph:endpoints";
|
|
453
|
-
UI_ENDPOINT_CLASS_METADATA_KEY =
|
|
454
|
-
UI_ENDPOINT_METHOD_METADATA_KEY =
|
|
453
|
+
UI_ENDPOINT_CLASS_METADATA_KEY = Symbol("ui_endpoint_class");
|
|
454
|
+
UI_ENDPOINT_METHOD_METADATA_KEY = Symbol("ui_endpoint_methods");
|
|
455
455
|
}
|
|
456
456
|
});
|
|
457
457
|
exports.UIEndpointsDiscoveryService = void 0;
|
|
@@ -4448,8 +4448,14 @@ exports.EventProcessor = class EventProcessor {
|
|
|
4448
4448
|
createAccumulator() {
|
|
4449
4449
|
return {
|
|
4450
4450
|
channels: /* @__PURE__ */ new Map([
|
|
4451
|
-
[
|
|
4452
|
-
|
|
4451
|
+
[
|
|
4452
|
+
"text" /* TEXT */,
|
|
4453
|
+
{ contentChain: [], currentBlock: null, pendingToolBlocks: [] }
|
|
4454
|
+
],
|
|
4455
|
+
[
|
|
4456
|
+
"processing" /* PROCESSING */,
|
|
4457
|
+
{ contentChain: [], currentBlock: null, pendingToolBlocks: [] }
|
|
4458
|
+
]
|
|
4453
4459
|
]),
|
|
4454
4460
|
attachments: [],
|
|
4455
4461
|
metadata: {},
|
|
@@ -4513,6 +4519,7 @@ exports.EventProcessor = class EventProcessor {
|
|
|
4513
4519
|
input: block.input || "",
|
|
4514
4520
|
output: ""
|
|
4515
4521
|
};
|
|
4522
|
+
state.pendingToolBlocks.push(state.currentBlock);
|
|
4516
4523
|
this.sendDelta(
|
|
4517
4524
|
channel,
|
|
4518
4525
|
{
|
|
@@ -4631,24 +4638,36 @@ exports.EventProcessor = class EventProcessor {
|
|
|
4631
4638
|
if (event.event === "on_tool_end") {
|
|
4632
4639
|
const channel = event.metadata?.stream_channel ?? "text" /* TEXT */;
|
|
4633
4640
|
const state = acc.channels.get(channel);
|
|
4634
|
-
if (state
|
|
4641
|
+
if (!state) return;
|
|
4642
|
+
const toolBlock = state.pendingToolBlocks.shift();
|
|
4643
|
+
if (toolBlock && toolBlock.type === "tool_use") {
|
|
4635
4644
|
const output = event.data?.output;
|
|
4636
4645
|
const outputString = typeof output === "string" ? output : JSON.stringify(output, null, 2);
|
|
4637
|
-
|
|
4646
|
+
toolBlock.output = outputString;
|
|
4638
4647
|
this.sendDelta(
|
|
4639
4648
|
channel,
|
|
4640
4649
|
{
|
|
4641
4650
|
type: "tool_output_chunk",
|
|
4642
|
-
stepId:
|
|
4651
|
+
stepId: toolBlock.id,
|
|
4643
4652
|
chunk: outputString
|
|
4644
4653
|
},
|
|
4645
4654
|
onPartial
|
|
4646
4655
|
);
|
|
4647
4656
|
this.logger.log("\u2705 Tool execution completed", {
|
|
4648
4657
|
toolName: event.name,
|
|
4658
|
+
toolBlockId: toolBlock.id,
|
|
4649
4659
|
outputPreview: outputString.substring(0, 200) + (outputString.length > 200 ? "..." : ""),
|
|
4650
4660
|
runId: event.run_id
|
|
4651
4661
|
});
|
|
4662
|
+
} else {
|
|
4663
|
+
this.logger.warn(
|
|
4664
|
+
"\u26A0\uFE0F on_tool_end received but no pending tool block found",
|
|
4665
|
+
{
|
|
4666
|
+
toolName: event.name,
|
|
4667
|
+
runId: event.run_id,
|
|
4668
|
+
pendingCount: state.pendingToolBlocks.length
|
|
4669
|
+
}
|
|
4670
|
+
);
|
|
4652
4671
|
}
|
|
4653
4672
|
return;
|
|
4654
4673
|
}
|