ferix-code 0.0.2-beta.14 → 0.0.2-beta.15

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 (2) hide show
  1. package/dist/index.js +43 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -71,7 +71,7 @@ import { Command } from "commander";
71
71
  // package.json
72
72
  var package_default = {
73
73
  name: "ferix-code",
74
- version: "0.0.2-beta.14",
74
+ version: "0.0.2-beta.15",
75
75
  description: "Composable RALPH loops for AI coding agents - v2 with Effect",
76
76
  type: "module",
77
77
  bin: {
@@ -4024,12 +4024,42 @@ function isTextContent2(json) {
4024
4024
  function isStepFinish(json) {
4025
4025
  return typeof json === "object" && json !== null && "type" in json && json.type === "step_finish";
4026
4026
  }
4027
+ function isToolUse2(json) {
4028
+ if (typeof json !== "object" || json === null) {
4029
+ return false;
4030
+ }
4031
+ const obj = json;
4032
+ if (obj.type !== "tool_use") {
4033
+ return false;
4034
+ }
4035
+ if (typeof obj.part !== "object" || obj.part === null) {
4036
+ return false;
4037
+ }
4038
+ const part = obj.part;
4039
+ if (typeof part.tool !== "string") {
4040
+ return false;
4041
+ }
4042
+ if (typeof part.state !== "object" || part.state === null) {
4043
+ return false;
4044
+ }
4045
+ return true;
4046
+ }
4027
4047
  function extractText2(json) {
4028
4048
  if (isTextContent2(json)) {
4029
4049
  return json.text;
4030
4050
  }
4031
4051
  return null;
4032
4052
  }
4053
+ function extractToolInfo2(json) {
4054
+ if (isToolUse2(json)) {
4055
+ return {
4056
+ type: "complete",
4057
+ name: json.part.tool,
4058
+ partialJson: JSON.stringify(json.part.state.input)
4059
+ };
4060
+ }
4061
+ return null;
4062
+ }
4033
4063
 
4034
4064
  // src/layers/llm/stream-opencode.ts
4035
4065
  function processOpenCodeEvent(json, outputChunks, _toolState, emit) {
@@ -4039,6 +4069,18 @@ function processOpenCodeEvent(json, outputChunks, _toolState, emit) {
4039
4069
  emit.single({ _tag: "Text", text });
4040
4070
  return;
4041
4071
  }
4072
+ const toolInfo = extractToolInfo2(json);
4073
+ if (toolInfo && toolInfo.type === "complete") {
4074
+ emit.single({ _tag: "ToolStart", tool: toolInfo.name });
4075
+ if (toolInfo.partialJson) {
4076
+ const input = safeParseJson(toolInfo.partialJson);
4077
+ if (input !== null) {
4078
+ emit.single({ _tag: "ToolUse", tool: toolInfo.name, input });
4079
+ }
4080
+ }
4081
+ emit.single({ _tag: "ToolEnd", tool: toolInfo.name });
4082
+ return;
4083
+ }
4042
4084
  if (isStepFinish(json)) {
4043
4085
  return;
4044
4086
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ferix-code",
3
- "version": "0.0.2-beta.14",
3
+ "version": "0.0.2-beta.15",
4
4
  "description": "Composable RALPH loops for AI coding agents - v2 with Effect",
5
5
  "type": "module",
6
6
  "bin": {