stable-harness 0.0.60 → 0.0.61
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/node_modules/@stable-harness/adapter-deepagents/dist/src/internal/raw-tool-call-parser.js +1 -1
- package/node_modules/@stable-harness/adapter-deepagents/package.json +1 -1
- package/package.json +2 -2
- package/packages/adapter-deepagents/dist/src/internal/raw-tool-call-parser.js +1 -1
- package/packages/adapter-deepagents/package.json +1 -1
package/node_modules/@stable-harness/adapter-deepagents/dist/src/internal/raw-tool-call-parser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AIMessage as e}from"@langchain/core/messages";export function createRawToolCallParserMiddleware(
|
|
1
|
+
import{AIMessage as e}from"@langchain/core/messages";import{parseToolIntent as o}from"@easynet/better-call";export function createRawToolCallParserMiddleware(o){return{name:"StableHarnessRawToolCallParser",async wrapModelCall(t,n){const r=await n(t);if(!function rawToolCallParsingEnabled(e){const o=isRecord(e.workspace.runtime.recovery)?e.workspace.runtime.recovery:{};return!0===(isRecord(o.toolCall)?o.toolCall:{}).enabled}(o))return r;const a=function parseRawToolCallResponse(o,t){if(0===t.size||!function isModelResponse(e){return isRecord(e)}(o)||function hasToolCalls(e){return Array.isArray(e.tool_calls)&&e.tool_calls.length>0}(o))return;const n=function readContentText(e){return"string"==typeof e?e.trim()?e:void 0:Array.isArray(e)&&e.map(e=>isRecord(e)&&"string"==typeof e.text?e.text:"").join("\n").trim()||void 0}(o.content);if(!n)return;const r=function readRawToolCalls(e,o){const t=[],n=new Set;for(const r of function rawToolIntentCandidates(e,o){const t=[e.trim()];for(const o of e.matchAll(/<\s*(?:tool_call|tool_code)\b[^>]*>(?:[\s\S]*?<\s*\/\s*(?:tool_call|tool_code)\s*>)?/giu))t.push(o[0]);for(const n of o){const o=new RegExp(`(?:^|[\\s<])${escapeRegexp(n)}\\s*\\([^)]*\\)\\s*>?`,"giu");for(const n of e.matchAll(o))t.push(n[0].trim())}return t.push(...function parseJsonObjects(e){const o=[];let t=e.indexOf("{");for(;t>=0;){const n=readBalancedJsonObject(e,t);if(n){try{const e=JSON.parse(n);isRecord(e)&&o.push(e)}catch{}t=e.indexOf("{",t+n.length)}else t=e.indexOf("{",t+1)}return o}(e)),t}(e,o)){const e=parseCandidate(r,o);if(!e||!o.has(e.tool))continue;const a=`${e.tool}:${JSON.stringify(e.args)}`;n.has(a)||(n.add(a),t.push({id:`stable-harness-${e.tool}-${Date.now().toString(36)}`,name:e.tool,args:e.args}))}return t}(n,t);return 0!==r.length?new e({content:"",id:"string"==typeof o.id?o.id:void 0,name:"string"==typeof o.name?o.name:void 0,additional_kwargs:isRecord(o.additional_kwargs)?o.additional_kwargs:{},response_metadata:isRecord(o.response_metadata)?o.response_metadata:{},tool_calls:r.map(e=>({id:e.id,name:e.name,args:e.args,type:"tool_call"}))}):void 0}(r,function visibleToolNames(e){return new Set((e.tools??[]).map(e=>e.name).filter(e=>"string"==typeof e&&e.length>0))}(t));return a??r}}}function parseCandidate(e,t){const n=o(e);if(n)return n;const r=function singleToolName(e){return 1===e.size?[...e][0]:void 0}(t);return r&&isRecord(e)?o({tool:r,args:e}):void 0}function readBalancedJsonObject(e,o){let t=0,n=!1,r=!1;for(let a=o;a<e.length;a+=1){const s=e[a];if(n)r="\\"===s&&!r,'"'!==s||r||(n=!1),"\\"!==s&&(r=!1);else if('"'===s&&(n=!0),"{"===s&&(t+=1),"}"===s&&(t-=1),0===t)return e.slice(o,a+1)}}function escapeRegexp(e){return e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}function isRecord(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"main": "dist/src/index.js",
|
|
11
11
|
"types": "dist/src/index.d.ts",
|
|
12
12
|
"peerDependencies": {
|
|
13
|
-
"@easynet/better-call": "^0.1.
|
|
13
|
+
"@easynet/better-call": "^0.1.67",
|
|
14
14
|
"@langchain/core": "^1.1.46",
|
|
15
15
|
"@langchain/ollama": "^1.2.7",
|
|
16
16
|
"@langchain/openai": "^1.4.5",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stable-harness",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.61",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Stable application runtime and operator control plane for agent workspaces.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"packages/*"
|
|
76
76
|
],
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@easynet/better-call": "^0.1.
|
|
78
|
+
"@easynet/better-call": "^0.1.67",
|
|
79
79
|
"@langchain/core": "^1.1.46",
|
|
80
80
|
"@langchain/langgraph": "^1.3.0",
|
|
81
81
|
"@langchain/langgraph-api": "^1.2.1",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AIMessage as e}from"@langchain/core/messages";export function createRawToolCallParserMiddleware(
|
|
1
|
+
import{AIMessage as e}from"@langchain/core/messages";import{parseToolIntent as o}from"@easynet/better-call";export function createRawToolCallParserMiddleware(o){return{name:"StableHarnessRawToolCallParser",async wrapModelCall(t,n){const r=await n(t);if(!function rawToolCallParsingEnabled(e){const o=isRecord(e.workspace.runtime.recovery)?e.workspace.runtime.recovery:{};return!0===(isRecord(o.toolCall)?o.toolCall:{}).enabled}(o))return r;const a=function parseRawToolCallResponse(o,t){if(0===t.size||!function isModelResponse(e){return isRecord(e)}(o)||function hasToolCalls(e){return Array.isArray(e.tool_calls)&&e.tool_calls.length>0}(o))return;const n=function readContentText(e){return"string"==typeof e?e.trim()?e:void 0:Array.isArray(e)&&e.map(e=>isRecord(e)&&"string"==typeof e.text?e.text:"").join("\n").trim()||void 0}(o.content);if(!n)return;const r=function readRawToolCalls(e,o){const t=[],n=new Set;for(const r of function rawToolIntentCandidates(e,o){const t=[e.trim()];for(const o of e.matchAll(/<\s*(?:tool_call|tool_code)\b[^>]*>(?:[\s\S]*?<\s*\/\s*(?:tool_call|tool_code)\s*>)?/giu))t.push(o[0]);for(const n of o){const o=new RegExp(`(?:^|[\\s<])${escapeRegexp(n)}\\s*\\([^)]*\\)\\s*>?`,"giu");for(const n of e.matchAll(o))t.push(n[0].trim())}return t.push(...function parseJsonObjects(e){const o=[];let t=e.indexOf("{");for(;t>=0;){const n=readBalancedJsonObject(e,t);if(n){try{const e=JSON.parse(n);isRecord(e)&&o.push(e)}catch{}t=e.indexOf("{",t+n.length)}else t=e.indexOf("{",t+1)}return o}(e)),t}(e,o)){const e=parseCandidate(r,o);if(!e||!o.has(e.tool))continue;const a=`${e.tool}:${JSON.stringify(e.args)}`;n.has(a)||(n.add(a),t.push({id:`stable-harness-${e.tool}-${Date.now().toString(36)}`,name:e.tool,args:e.args}))}return t}(n,t);return 0!==r.length?new e({content:"",id:"string"==typeof o.id?o.id:void 0,name:"string"==typeof o.name?o.name:void 0,additional_kwargs:isRecord(o.additional_kwargs)?o.additional_kwargs:{},response_metadata:isRecord(o.response_metadata)?o.response_metadata:{},tool_calls:r.map(e=>({id:e.id,name:e.name,args:e.args,type:"tool_call"}))}):void 0}(r,function visibleToolNames(e){return new Set((e.tools??[]).map(e=>e.name).filter(e=>"string"==typeof e&&e.length>0))}(t));return a??r}}}function parseCandidate(e,t){const n=o(e);if(n)return n;const r=function singleToolName(e){return 1===e.size?[...e][0]:void 0}(t);return r&&isRecord(e)?o({tool:r,args:e}):void 0}function readBalancedJsonObject(e,o){let t=0,n=!1,r=!1;for(let a=o;a<e.length;a+=1){const s=e[a];if(n)r="\\"===s&&!r,'"'!==s||r||(n=!1),"\\"!==s&&(r=!1);else if('"'===s&&(n=!0),"{"===s&&(t+=1),"}"===s&&(t-=1),0===t)return e.slice(o,a+1)}}function escapeRegexp(e){return e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}function isRecord(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"main": "dist/src/index.js",
|
|
11
11
|
"types": "dist/src/index.d.ts",
|
|
12
12
|
"peerDependencies": {
|
|
13
|
-
"@easynet/better-call": "^0.1.
|
|
13
|
+
"@easynet/better-call": "^0.1.67",
|
|
14
14
|
"@langchain/core": "^1.1.46",
|
|
15
15
|
"@langchain/ollama": "^1.2.7",
|
|
16
16
|
"@langchain/openai": "^1.4.5",
|