@probelabs/probe 0.6.0-rc271 → 0.6.0-rc273

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.
@@ -11508,22 +11508,16 @@ var init_JsonShapeDeserializer = __esm({
11508
11508
  if (Array.isArray(value) && ns.isListSchema()) {
11509
11509
  const listMember = ns.getValueSchema();
11510
11510
  const out = [];
11511
- const sparse = !!ns.getMergedTraits().sparse;
11512
11511
  for (const item of value) {
11513
- if (sparse || item != null) {
11514
- out.push(this._read(listMember, item));
11515
- }
11512
+ out.push(this._read(listMember, item));
11516
11513
  }
11517
11514
  return out;
11518
11515
  }
11519
11516
  if (ns.isMapSchema()) {
11520
11517
  const mapMember = ns.getValueSchema();
11521
11518
  const out = {};
11522
- const sparse = !!ns.getMergedTraits().sparse;
11523
11519
  for (const [_k, _v] of Object.entries(value)) {
11524
- if (sparse || _v != null) {
11525
- out[_k] = this._read(mapMember, _v);
11526
- }
11520
+ out[_k] = this._read(mapMember, _v);
11527
11521
  }
11528
11522
  return out;
11529
11523
  }
@@ -13172,18 +13166,18 @@ var init_XmlShapeDeserializer = __esm({
13172
13166
  return value;
13173
13167
  }
13174
13168
  if (typeof value === "object") {
13175
- const sparse = !!traits.sparse;
13176
13169
  const flat = !!traits.xmlFlattened;
13177
13170
  if (ns.isListSchema()) {
13178
13171
  const listValue = ns.getValueSchema();
13179
13172
  const buffer2 = [];
13180
13173
  const sourceKey = listValue.getMergedTraits().xmlName ?? "member";
13181
13174
  const source = flat ? value : (value[0] ?? value)[sourceKey];
13175
+ if (source == null) {
13176
+ return buffer2;
13177
+ }
13182
13178
  const sourceArray = Array.isArray(source) ? source : [source];
13183
13179
  for (const v5 of sourceArray) {
13184
- if (v5 != null || sparse) {
13185
- buffer2.push(this.readSchema(listValue, v5));
13186
- }
13180
+ buffer2.push(this.readSchema(listValue, v5));
13187
13181
  }
13188
13182
  return buffer2;
13189
13183
  }
@@ -13202,9 +13196,7 @@ var init_XmlShapeDeserializer = __esm({
13202
13196
  for (const entry of entries) {
13203
13197
  const key = entry[keyProperty];
13204
13198
  const value2 = entry[valueProperty];
13205
- if (value2 != null || sparse) {
13206
- buffer[key] = this.readSchema(memberNs, value2);
13207
- }
13199
+ buffer[key] = this.readSchema(memberNs, value2);
13208
13200
  }
13209
13201
  return buffer;
13210
13202
  }
@@ -17546,7 +17538,7 @@ var require_package2 = __commonJS({
17546
17538
  module2.exports = {
17547
17539
  name: "@aws-sdk/client-bedrock-runtime",
17548
17540
  description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
17549
- version: "3.1001.0",
17541
+ version: "3.1002.0",
17550
17542
  scripts: {
17551
17543
  build: "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
17552
17544
  "build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
@@ -17570,21 +17562,21 @@ var require_package2 = __commonJS({
17570
17562
  dependencies: {
17571
17563
  "@aws-crypto/sha256-browser": "5.2.0",
17572
17564
  "@aws-crypto/sha256-js": "5.2.0",
17573
- "@aws-sdk/core": "^3.973.16",
17574
- "@aws-sdk/credential-provider-node": "^3.972.15",
17565
+ "@aws-sdk/core": "^3.973.17",
17566
+ "@aws-sdk/credential-provider-node": "^3.972.16",
17575
17567
  "@aws-sdk/eventstream-handler-node": "^3.972.9",
17576
17568
  "@aws-sdk/middleware-eventstream": "^3.972.6",
17577
17569
  "@aws-sdk/middleware-host-header": "^3.972.6",
17578
17570
  "@aws-sdk/middleware-logger": "^3.972.6",
17579
17571
  "@aws-sdk/middleware-recursion-detection": "^3.972.6",
17580
- "@aws-sdk/middleware-user-agent": "^3.972.16",
17572
+ "@aws-sdk/middleware-user-agent": "^3.972.17",
17581
17573
  "@aws-sdk/middleware-websocket": "^3.972.11",
17582
17574
  "@aws-sdk/region-config-resolver": "^3.972.6",
17583
- "@aws-sdk/token-providers": "3.1001.0",
17575
+ "@aws-sdk/token-providers": "3.1002.0",
17584
17576
  "@aws-sdk/types": "^3.973.4",
17585
17577
  "@aws-sdk/util-endpoints": "^3.996.3",
17586
17578
  "@aws-sdk/util-user-agent-browser": "^3.972.6",
17587
- "@aws-sdk/util-user-agent-node": "^3.973.1",
17579
+ "@aws-sdk/util-user-agent-node": "^3.973.2",
17588
17580
  "@smithy/config-resolver": "^4.4.9",
17589
17581
  "@smithy/core": "^3.23.7",
17590
17582
  "@smithy/eventstream-serde-browser": "^4.2.10",
@@ -18333,7 +18325,7 @@ var init_package = __esm({
18333
18325
  "node_modules/@aws-sdk/nested-clients/package.json"() {
18334
18326
  package_default = {
18335
18327
  name: "@aws-sdk/nested-clients",
18336
- version: "3.996.4",
18328
+ version: "3.996.5",
18337
18329
  description: "Nested clients for AWS SDK packages.",
18338
18330
  main: "./dist-cjs/index.js",
18339
18331
  module: "./dist-es/index.js",
@@ -18362,16 +18354,16 @@ var init_package = __esm({
18362
18354
  dependencies: {
18363
18355
  "@aws-crypto/sha256-browser": "5.2.0",
18364
18356
  "@aws-crypto/sha256-js": "5.2.0",
18365
- "@aws-sdk/core": "^3.973.16",
18357
+ "@aws-sdk/core": "^3.973.17",
18366
18358
  "@aws-sdk/middleware-host-header": "^3.972.6",
18367
18359
  "@aws-sdk/middleware-logger": "^3.972.6",
18368
18360
  "@aws-sdk/middleware-recursion-detection": "^3.972.6",
18369
- "@aws-sdk/middleware-user-agent": "^3.972.16",
18361
+ "@aws-sdk/middleware-user-agent": "^3.972.17",
18370
18362
  "@aws-sdk/region-config-resolver": "^3.972.6",
18371
18363
  "@aws-sdk/types": "^3.973.4",
18372
18364
  "@aws-sdk/util-endpoints": "^3.996.3",
18373
18365
  "@aws-sdk/util-user-agent-browser": "^3.972.6",
18374
- "@aws-sdk/util-user-agent-node": "^3.973.1",
18366
+ "@aws-sdk/util-user-agent-node": "^3.973.2",
18375
18367
  "@smithy/config-resolver": "^4.4.9",
18376
18368
  "@smithy/core": "^3.23.7",
18377
18369
  "@smithy/fetch-http-handler": "^5.3.12",
@@ -31736,8 +31728,7 @@ Instructions:
31736
31728
  - Format as a structured list if multiple items found
31737
31729
  - If nothing relevant is found in this chunk, respond with "No relevant items found in this chunk."
31738
31730
  - Do NOT summarize the code - extract the specific information requested
31739
- - IMPORTANT: When completing, always use the FULL format: <attempt_completion><result>YOUR ANSWER HERE</result></attempt_completion>
31740
- - Do NOT use the shorthand <attempt_complete></attempt_complete> format`;
31731
+ - When done, use the attempt_completion tool with your answer as the result.`;
31741
31732
  try {
31742
31733
  const result = await delegate({
31743
31734
  task,
@@ -31802,7 +31793,7 @@ async function aggregateResults(chunkResults2, aggregation, extractionPrompt, op
31802
31793
  ${stripResultTags(r5.result)}`).join("\n\n");
31803
31794
  const completionNote = `
31804
31795
 
31805
- IMPORTANT: When completing, always use the FULL format: <attempt_completion><result>YOUR ANSWER HERE</result></attempt_completion>`;
31796
+ When done, use the attempt_completion tool with your answer as the result.`;
31806
31797
  const aggregationPrompts = {
31807
31798
  summarize: `Synthesize these analyses into a comprehensive summary. Combine related findings, remove redundancy, and present a coherent overview.
31808
31799
 
@@ -31960,7 +31951,7 @@ Your answer should:
31960
31951
 
31961
31952
  Format your response as a well-structured document that fully answers: "${question}"
31962
31953
 
31963
- IMPORTANT: When completing, use the FULL format: <attempt_completion><result>YOUR ANSWER HERE</result></attempt_completion>`;
31954
+ When done, use the attempt_completion tool with your answer as the result.`;
31964
31955
  try {
31965
31956
  const result = await delegate({
31966
31957
  task: synthesisTask,
@@ -36527,7 +36518,7 @@ function buildSearchDelegateTask({ searchQuery, searchPath, exact, language, all
36527
36518
  "",
36528
36519
  "Strategy for complex queries:",
36529
36520
  "1. Analyze the query - identify key concepts, entities, and relationships",
36530
- '2. Run focused searches for each concept (e.g., "error handling" + "authentication" separately)',
36521
+ '2. Run focused searches for each independent concept (e.g., for "how do payments work and how are emails sent", search "payments" and "emails" separately since they are unrelated)',
36531
36522
  "3. Use extract to verify relevance of promising results",
36532
36523
  "4. Combine all relevant targets in your final response",
36533
36524
  "",
@@ -39191,9 +39182,7 @@ Example: <edit><file_path>${file_path}</file_path><symbol>${allMatches[0].qualif
39191
39182
  if (fileTracker) {
39192
39183
  const check = fileTracker.checkSymbolContent(resolvedPath2, symbol15, symbolInfo.code);
39193
39184
  if (!check.ok && check.reason === "stale") {
39194
- return `Error editing ${file_path}: Symbol "${symbol15}" has changed since you last read it. Use extract to re-read the current content, then retry.
39195
-
39196
- Example: <extract><targets>${file_path}#${symbol15}</targets></extract>`;
39185
+ return `Error editing ${file_path}: Symbol "${symbol15}" has changed since you last read it. Use the extract tool with targets="${file_path}#${symbol15}" to re-read the current content, then retry.`;
39197
39186
  }
39198
39187
  }
39199
39188
  const content = await import_fs6.promises.readFile(resolvedPath2, "utf-8");
@@ -39431,9 +39420,7 @@ Parameters:
39431
39420
  }
39432
39421
  if (options.fileTracker && !options.fileTracker.isFileSeen(resolvedPath2)) {
39433
39422
  const displayPath = toRelativePath(resolvedPath2, workspaceRoot);
39434
- return `Error editing ${displayPath}: This file has not been read yet in this session. Use 'extract' to read the file first, then retry your edit. This ensures you are working with the current file content.
39435
-
39436
- Example: <extract><targets>${displayPath}</targets></extract>`;
39423
+ return `Error editing ${displayPath}: This file has not been read yet in this session. Use the extract tool with targets="${displayPath}" to read the file first, then retry your edit.`;
39437
39424
  }
39438
39425
  if (symbol15 !== void 0 && symbol15 !== null) {
39439
39426
  return await handleSymbolEdit({ resolvedPath: resolvedPath2, file_path, symbol: symbol15, new_string, position, debug, cwd, fileTracker: options.fileTracker });
@@ -39453,7 +39440,7 @@ Example: <extract><targets>${displayPath}</targets></extract>`;
39453
39440
  const displayPath = toRelativePath(resolvedPath2, workspaceRoot);
39454
39441
  return `Error editing ${displayPath}: ${staleCheck.message}
39455
39442
 
39456
- Example: <extract><targets>${displayPath}</targets></extract>`;
39443
+ Use the extract tool with targets="${displayPath}" to re-read the file, then retry.`;
39457
39444
  }
39458
39445
  }
39459
39446
  const content = await import_fs6.promises.readFile(resolvedPath2, "utf-8");
@@ -58640,20 +58627,15 @@ ${taskLines.join("\n")}
58640
58627
 
58641
58628
  // src/agent/tasks/taskTool.js
58642
58629
  function createTaskCompletionBlockedMessage(taskSummary) {
58643
- return `<task_completion_blocked>
58644
- You cannot complete yet. The following tasks are still unresolved:
58630
+ return `You cannot complete yet. The following tasks are still unresolved:
58645
58631
 
58646
58632
  ${taskSummary}
58647
58633
 
58648
- Required action:
58649
- 1. For each "pending" or "in_progress" task, either:
58650
- - Complete the work and mark it: <task><action>complete</action><id>task-X</id></task>
58651
- - Or cancel if no longer needed: <task><action>update</action><id>task-X</id><status>cancelled</status></task>
58652
-
58653
- 2. After ALL tasks are resolved (completed or cancelled), call attempt_completion again.
58634
+ For each pending/in_progress task, either:
58635
+ - Complete it: call task tool with action="complete", id="task-X"
58636
+ - Cancel it: call task tool with action="update", id="task-X", status="cancelled"
58654
58637
 
58655
- Use <task><action>list</action></task> to review current status.
58656
- </task_completion_blocked>`;
58638
+ After all tasks are resolved, call attempt_completion again.`;
58657
58639
  }
58658
58640
  function createTaskTool(options = {}) {
58659
58641
  const { taskManager, tracer, debug = false } = options;
@@ -58876,145 +58858,46 @@ var init_taskTool = __esm({
58876
58858
  dependencies: external_exports.array(external_exports.string()).optional(),
58877
58859
  after: external_exports.string().optional()
58878
58860
  });
58879
- taskSystemPrompt = `[Task Management System]
58880
-
58881
- You have access to a task tracking tool to organize your work on complex requests.
58882
-
58883
- ## When to Create Tasks
58884
-
58885
- CREATE TASKS when the request has **multiple distinct deliverables or goals**:
58886
- - "Fix bug A AND add feature B" \u2192 Two separate tasks
58887
- - "Investigate auth, payments, AND notifications" \u2192 Three independent areas
58888
- - "Implement X, then add tests, then update docs" \u2192 Sequential phases with different outputs
58889
- - User explicitly asks for a plan or task breakdown
58890
-
58891
- SKIP TASKS for single-goal requests, even if they require multiple searches:
58892
- - "How does ranking work?" \u2192 Just investigate and answer (one goal)
58893
- - "What does function X do?" \u2192 Just look it up (one goal)
58894
- - "Explain the authentication flow" \u2192 Just trace and explain (one goal)
58895
- - "Find where errors are logged" \u2192 Just search and report (one goal)
58896
-
58897
- **Key insight**: Multiple *internal steps* (search, read, analyze) are NOT the same as multiple *goals*.
58898
- A single investigation with many steps is still ONE task, not many.
58899
-
58900
- ## Task Granularity
58901
-
58902
- Tasks represent LOGICAL UNITS OF WORK, not individual files or steps:
58903
- - "Fix 8 similar test files" \u2192 ONE task (same type of fix across files)
58904
- - "Update API + tests + docs" \u2192 THREE tasks (different types of work)
58905
- - "Implement feature in 5 files" \u2192 ONE task (single feature)
58906
-
58907
- **Rule of thumb**: If you're creating more than 3-4 tasks, you're probably too granular.
58908
-
58909
- **Anti-patterns to avoid**:
58910
- - One task per file \u274C
58911
- - One task per function \u274C
58912
- - One task per repository (when same type of work) \u274C
58913
-
58914
- **Good patterns**:
58915
- - One task per distinct deliverable \u2713
58916
- - One task per phase (implement, test, document) \u2713
58917
- - One task per different type of work \u2713
58918
-
58919
- MODIFY TASKS when (during execution):
58920
- - You discover the problem is more complex than expected \u2192 Add new tasks
58921
- - A single task covers too much scope \u2192 Split into smaller tasks
58922
- - You find related work that needs attention \u2192 Add dependent tasks
58923
- - A task becomes irrelevant based on findings \u2192 Cancel it
58924
- - Task priorities change based on discoveries \u2192 Update priority
58925
- - You learn new context \u2192 Update task description
58926
-
58927
- ## Task Workflow
58928
-
58929
- **STEP 1 - Plan (at start):**
58930
- Analyze the request and create tasks for each logical step:
58931
-
58932
- <task>
58933
- <action>create</action>
58934
- <tasks>[
58935
- {"title": "Search for authentication module", "priority": "high"},
58936
- {"title": "Analyze login flow implementation", "dependencies": ["task-1"]},
58937
- {"title": "Find session management code", "dependencies": ["task-1"]},
58938
- {"title": "Summarize authentication architecture", "dependencies": ["task-2", "task-3"]}
58939
- ]</tasks>
58940
- </task>
58941
-
58942
- **STEP 2 - Execute (during work):**
58943
- Update task status as you work:
58944
-
58945
- <task>
58946
- <action>update</action>
58947
- <id>task-1</id>
58948
- <status>in_progress</status>
58949
- </task>
58950
-
58951
- ... do the work (search, extract, etc.) ...
58952
-
58953
- <task>
58954
- <action>complete</action>
58955
- <id>task-1</id>
58956
- </task>
58957
-
58958
- **STEP 2b - Adapt (when you discover new work):**
58959
- As you work, you may discover that:
58960
- - A task is more complex than expected \u2192 Split it into subtasks
58961
- - New areas need investigation \u2192 Add new tasks
58962
- - Some tasks are no longer needed \u2192 Cancel them
58963
- - Task order should change \u2192 Update dependencies
58964
-
58965
- *Adding a new task when you discover more work:*
58966
- <task>
58967
- <action>create</action>
58968
- <title>Investigate caching layer</title>
58969
- <description>Found references to Redis caching in auth module</description>
58970
- </task>
58971
-
58972
- *Inserting a task after a specific task (to maintain logical order):*
58973
- <task>
58974
- <action>create</action>
58975
- <title>Check rate limiting</title>
58976
- <after>task-2</after>
58977
- </task>
58978
-
58979
- *Cancelling and splitting a complex task:*
58980
- <task>
58981
- <action>update</action>
58982
- <id>task-3</id>
58983
- <status>cancelled</status>
58984
- </task>
58985
- <task>
58986
- <action>create</action>
58987
- <tasks>[
58988
- {"title": "Review JWT token generation", "priority": "high"},
58989
- {"title": "Review token refresh logic"}
58990
- ]</tasks>
58991
- </task>
58992
-
58993
- **STEP 3 - Finish (before completion):**
58994
- Before calling attempt_completion, ensure ALL tasks are either:
58995
- - \`completed\` - you finished the work
58996
- - \`cancelled\` - no longer needed
58997
-
58998
- If you created tasks, you MUST resolve them all before completing.
58999
-
59000
- ## Key Rules
59001
-
59002
- 1. **Dependencies are enforced**: A task cannot start until its dependencies are completed
59003
- 2. **Circular dependencies are rejected**: task-1 \u2192 task-2 \u2192 task-1 is invalid
59004
- 3. **Completion is blocked**: attempt_completion will fail if tasks remain unresolved
59005
- 4. **List to review**: Use <task><action>list</action></task> to see current task status
59006
- 5. **Tasks are living documents**: Add, split, or cancel tasks as you learn more about the problem
58861
+ taskSystemPrompt = `[Task Management]
58862
+
58863
+ Use the task tool to track progress on complex requests with multiple distinct goals.
58864
+
58865
+ ## When to Use Tasks
58866
+
58867
+ CREATE tasks when the request has **multiple separate deliverables**:
58868
+ - "Fix bug A AND add feature B" \u2192 two tasks
58869
+ - "Investigate auth, payments, AND notifications" \u2192 three tasks
58870
+ - "Implement X, then add tests, then update docs" \u2192 three sequential tasks
58871
+
58872
+ SKIP tasks for single-goal requests, even complex ones:
58873
+ - "How does ranking work?" \u2014 just investigate and answer
58874
+ - "Explain the authentication flow" \u2014 just trace and explain
58875
+ Multiple internal steps (search, read, analyze) for one goal \u2260 multiple tasks.
58876
+
58877
+ ## Granularity
58878
+
58879
+ Tasks = logical units of work, not files or steps.
58880
+ - "Fix 8 similar test files" \u2192 ONE task (same fix repeated)
58881
+ - "Update API + tests + docs" \u2192 THREE tasks (different work types)
58882
+ - Max 3\u20134 tasks. More means you're too granular.
58883
+
58884
+ ## Workflow
58885
+
58886
+ 1. **Plan**: Call task tool with action="create" and a tasks array up front
58887
+ 2. **Execute**: Update status to "in_progress" / "completed" as you work. Add, split, or cancel tasks as you learn more.
58888
+ 3. **Finish**: All tasks must be "completed" or "cancelled" before calling attempt_completion.
58889
+
58890
+ ## Rules
58891
+
58892
+ - Dependencies are enforced: a task cannot start until its dependencies are completed
58893
+ - Circular dependencies are rejected
58894
+ - attempt_completion is blocked while tasks remain unresolved
59007
58895
  `;
59008
- taskGuidancePrompt = `<task_guidance>
59009
- Does this request have MULTIPLE DISTINCT GOALS?
58896
+ taskGuidancePrompt = `Does this request have MULTIPLE DISTINCT GOALS?
59010
58897
  - "Do A AND B AND C" (multiple goals) \u2192 Create tasks for each goal
59011
58898
  - "Investigate/explain/find X" (single goal) \u2192 Skip tasks, just answer directly
59012
-
59013
- Multiple internal steps (search, read, analyze) for ONE goal = NO tasks needed.
59014
- Only create tasks when there are separate deliverables the user is asking for.
59015
-
59016
- If creating tasks, use the task tool with action="create" first.
59017
- </task_guidance>`;
58899
+ Multiple internal steps for ONE goal = NO tasks needed.
58900
+ If creating tasks, use the task tool with action="create" first.`;
59018
58901
  }
59019
58902
  });
59020
58903
 
@@ -97784,9 +97667,10 @@ If the solution is clear, you can jump to implementation right away. If not, ask
97784
97667
  - After every significant change, verify the project still builds and passes linting. Do not wait until the end to discover breakage.
97785
97668
 
97786
97669
  # After Implementation
97787
- - Always run the project's tests before considering the task complete. If tests fail, fix them.
97788
- - Run lint and typecheck commands if known for the project.
97789
- - If a build, lint, or test fails, fix the issue before finishing.
97670
+ - Verify the project builds successfully. If it doesn't, fix the build before moving on.
97671
+ - Run lint and typecheck commands if known for the project. Fix any new warnings or errors you introduced.
97672
+ - Add tests for any new or changed functionality. Tests must cover the main path and important edge cases.
97673
+ - Run the project's full test suite. If any tests fail (including pre-existing ones you may have broken), fix them before finishing.
97790
97674
  - When the task is done, respond to the user with a concise summary of what was implemented, what files were changed, and any relevant details. Include links (e.g. pull request URL) so the user has everything they need.
97791
97675
 
97792
97676
  # GitHub Integration
@@ -106999,6 +106883,19 @@ function isContextLimitError(error2) {
106999
106883
  }
107000
106884
  return false;
107001
106885
  }
106886
+ function messageContainsCompletion(msg) {
106887
+ if (Array.isArray(msg.toolInvocations)) {
106888
+ if (msg.toolInvocations.some((t5) => t5.toolName === "attempt_completion")) return true;
106889
+ }
106890
+ if (Array.isArray(msg.tool_calls)) {
106891
+ if (msg.tool_calls.some((t5) => t5.function?.name === "attempt_completion")) return true;
106892
+ }
106893
+ if (Array.isArray(msg.content)) {
106894
+ if (msg.content.some((p5) => p5.type === "tool-call" && p5.toolName === "attempt_completion")) return true;
106895
+ }
106896
+ const text = typeof msg.content === "string" ? msg.content : "";
106897
+ return text.includes("attempt_completion");
106898
+ }
107002
106899
  function identifyMessageSegments(messages) {
107003
106900
  const segments = [];
107004
106901
  let currentSegment = null;
@@ -107007,27 +106904,23 @@ function identifyMessageSegments(messages) {
107007
106904
  if (msg.role === "system") {
107008
106905
  continue;
107009
106906
  }
106907
+ if (msg.role === "tool" && currentSegment) {
106908
+ currentSegment.monologueIndices.push(i5);
106909
+ continue;
106910
+ }
107010
106911
  if (msg.role === "user") {
107011
- const content = typeof msg.content === "string" ? msg.content : "";
107012
- const isToolResult = content.includes("<tool_result>");
107013
- if (isToolResult && currentSegment) {
107014
- currentSegment.finalIndex = i5;
106912
+ if (currentSegment) {
107015
106913
  segments.push(currentSegment);
107016
- currentSegment = null;
107017
- } else {
107018
- if (currentSegment) {
107019
- segments.push(currentSegment);
107020
- }
107021
- currentSegment = {
107022
- userIndex: i5,
107023
- monologueIndices: [],
107024
- finalIndex: null
107025
- };
107026
106914
  }
106915
+ currentSegment = {
106916
+ userIndex: i5,
106917
+ monologueIndices: [],
106918
+ finalIndex: null
106919
+ };
107027
106920
  }
107028
106921
  if (msg.role === "assistant" && currentSegment) {
107029
- const content = typeof msg.content === "string" ? msg.content : "";
107030
- if (content.includes("<attempt_completion>") || content.includes("attempt_completion")) {
106922
+ const hasCompletion = messageContainsCompletion(msg);
106923
+ if (hasCompletion) {
107031
106924
  currentSegment.monologueIndices.push(i5);
107032
106925
  currentSegment.finalIndex = i5;
107033
106926
  segments.push(currentSegment);