stable-harness 0.0.99 → 0.0.100
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/README.md +3 -0
- package/docs/guides/integration-guide.md +6 -0
- package/node_modules/@stable-harness/adapter-deepagents/package.json +2 -2
- package/node_modules/@stable-harness/adapter-langgraph/package.json +2 -2
- package/node_modules/@stable-harness/core/dist/recovery/raw-args.d.ts +10 -0
- package/node_modules/@stable-harness/core/dist/recovery/raw-args.js +1 -1
- package/node_modules/@stable-harness/core/dist/runtime/recovery/adapter-result.d.ts +1 -0
- package/node_modules/@stable-harness/core/dist/runtime/recovery/adapter-result.js +1 -1
- package/node_modules/@stable-harness/core/dist/runtime.js +1 -1
- package/node_modules/@stable-harness/core/package.json +3 -3
- package/node_modules/@stable-harness/governance/package.json +1 -1
- package/node_modules/@stable-harness/memory/package.json +1 -1
- package/node_modules/@stable-harness/protocols/package.json +2 -2
- package/node_modules/@stable-harness/tool-gateway/package.json +1 -1
- package/node_modules/@stable-harness/workspace-yaml/package.json +2 -2
- package/package.json +9 -9
- package/packages/adapter-deepagents/package.json +2 -2
- package/packages/adapter-langgraph/package.json +2 -2
- package/packages/cli/dist/src/cli.js +1 -1
- package/packages/cli/dist/src/daemon/client.js +1 -1
- package/packages/cli/package.json +8 -8
- package/packages/core/dist/recovery/raw-args.d.ts +10 -0
- package/packages/core/dist/recovery/raw-args.js +1 -1
- package/packages/core/dist/runtime/recovery/adapter-result.d.ts +1 -0
- package/packages/core/dist/runtime/recovery/adapter-result.js +1 -1
- package/packages/core/dist/runtime.js +1 -1
- package/packages/core/package.json +3 -3
- package/packages/evaluation/package.json +2 -2
- package/packages/governance/package.json +1 -1
- package/packages/memory/package.json +1 -1
- package/packages/protocols/package.json +2 -2
- package/packages/tool-gateway/package.json +1 -1
- package/packages/workspace-yaml/package.json +2 -2
package/README.md
CHANGED
|
@@ -91,6 +91,9 @@ http://127.0.0.1:8641
|
|
|
91
91
|
http://127.0.0.1:8642/v1
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
+
For request commands, the CLI is daemon-first. It prints whether it connected to
|
|
95
|
+
the workspace daemon or fell back to an in-process local runtime.
|
|
96
|
+
|
|
94
97
|
Build a portable Docker runtime artifact for the workspace:
|
|
95
98
|
|
|
96
99
|
```bash
|
|
@@ -27,6 +27,12 @@ is already running, request commands submit work through HTTP and consume
|
|
|
27
27
|
runtime updates through SSE. When no daemon is available, the CLI falls back to
|
|
28
28
|
an in-process runtime for local development.
|
|
29
29
|
|
|
30
|
+
The CLI prints the selected runtime path to stderr:
|
|
31
|
+
|
|
32
|
+
- `connected to daemon` means the request is handled by the workspace daemon.
|
|
33
|
+
- `no matching daemon found; running in-process` means the CLI started a local
|
|
34
|
+
runtime for this one command.
|
|
35
|
+
|
|
30
36
|
## Embedded Runtime
|
|
31
37
|
|
|
32
38
|
Use the SDK when Stable Harness runs inside your service:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stable-harness/adapter-deepagents",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.100",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**/*.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@langchain/node-vfs": "^0.1.4",
|
|
16
16
|
"@langchain/ollama": "^1.2.7",
|
|
17
17
|
"@langchain/openai": "^1.4.5",
|
|
18
|
-
"@stable-harness/core": "0.0.
|
|
18
|
+
"@stable-harness/core": "0.0.100",
|
|
19
19
|
"deepagents": "^1.10.1",
|
|
20
20
|
"langchain": "^1.4.0"
|
|
21
21
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stable-harness/adapter-langgraph",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.100",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**/*.js",
|
|
@@ -11,6 +11,6 @@
|
|
|
11
11
|
"types": "dist/src/index.d.ts",
|
|
12
12
|
"peerDependencies": {
|
|
13
13
|
"@langchain/langgraph": "^1.3.0",
|
|
14
|
-
"@stable-harness/core": "0.0.
|
|
14
|
+
"@stable-harness/core": "0.0.100"
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -10,4 +10,14 @@ export type RawArgsRecoveryInput = {
|
|
|
10
10
|
policy: unknown;
|
|
11
11
|
};
|
|
12
12
|
export declare function buildRawArgsRecoveryRequest(input: RawArgsRecoveryInput): RuntimeRequest | undefined;
|
|
13
|
+
export declare function buildRawArgsToolEvidenceRecoveryRequest(input: {
|
|
14
|
+
request: RuntimeRequest;
|
|
15
|
+
match: RawArgsToolMatch;
|
|
16
|
+
toolOutput: string;
|
|
17
|
+
}): RuntimeRequest;
|
|
13
18
|
export declare function hasUniqueRawArgsTool(input: Omit<RawArgsRecoveryInput, "request">): boolean;
|
|
19
|
+
export type RawArgsToolMatch = {
|
|
20
|
+
toolId: string;
|
|
21
|
+
args: Record<string, unknown>;
|
|
22
|
+
};
|
|
23
|
+
export declare function matchUniqueRawArgsTool(input: Omit<RawArgsRecoveryInput, "request">): RawArgsToolMatch | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{selectCallCandidateByArgsSchema as e}from"@easynet/better-call";export function buildRawArgsRecoveryRequest(e){if(!toolCallRecoveryEnabled(e.policy))return;const t=
|
|
1
|
+
import{selectCallCandidateByArgsSchema as e}from"@easynet/better-call";export function buildRawArgsRecoveryRequest(e){if(!toolCallRecoveryEnabled(e.policy))return;const t=matchUniqueRawArgsTool(e);return t?function buildRawArgsRecoveryPrompt(e,t){return{...e,input:[e.input,"","Stable runtime recovery: your previous final answer was a JSON argument object for a declared tool, not the final answer.",`Matched configured tool: ${t.toolId}`,"Continue the same user request by calling that tool through the backend's normal structured tool-calling mechanism with the JSON arguments below.","If the tool call succeeds, synthesize the final user-facing answer from the executed evidence.","Do not print JSON argument objects, raw tool-call markup, plans, or future-intent text as the final answer.","","Previous JSON arguments:",JSON.stringify(t.args)].join("\n"),metadata:{...e.metadata,stableHarnessRecovery:"tool_call"}}}(e.request,t):void 0}export function buildRawArgsToolEvidenceRecoveryRequest(e){return{...e.request,input:[e.request.input,"","Stable runtime recovery: your previous final answer repeated a JSON argument object for a declared tool after a structured tool-call recovery request.",`Matched configured tool: ${e.match.toolId}`,"Stable runtime executed that matched declared tool through the governed tool gateway.","Continue the same user request from the executed evidence below.","If another declared tool is needed, call it through the backend's normal structured tool-calling mechanism.","Otherwise, synthesize the final user-facing answer from the executed evidence.","Do not print JSON argument objects, raw tool-call markup, plans, or future-intent text as the final answer.","","Executed JSON arguments:",JSON.stringify(e.match.args),"","Executed tool output:",e.toolOutput].join("\n"),metadata:{...e.request.metadata,stableHarnessRecovery:"tool_call"}}}export function hasUniqueRawArgsTool(e){return toolCallRecoveryEnabled(e.policy)&&Boolean(matchUniqueRawArgsTool(e))}export function matchUniqueRawArgsTool(t){const o=function parseStandaloneJsonObject(e){const t=e.trim(),o=t.match(/^```(?:json)?\s*\n([\s\S]*?)\n```$/iu)?.[1]?.trim(),r=o??t;if(r.startsWith("{")&&r.endsWith("}")&&!(r.length>6e3))try{const e=JSON.parse(r);return!isRecord(e)||function isToolCallEnvelope(e){const t=["tool","tool_name","name","type","subagent_type"].some(t=>"string"==typeof e[t]),o=["args","arguments","parameters","kwargs"].some(t=>t in e);return t&&o}(e)||function isRuntimeControlObject(e){return"string"==typeof e.status||"string"==typeof e.error||"string"==typeof e.controlStatus}(e)?void 0:e}catch{return}}(t.output);if(!o)return;const r=e({args:o,candidates:buildCallCandidates(t)});if(r.ok)return{toolId:r.candidateId,args:r.args};const n=function latestSingleToolCandidate(e,t){for(let o=(e?.length??0)-1;o>=0;o-=1){const r=e[o];if(!r||!("diagnostics"in r)||!isRecord(r.diagnostics))continue;const n=readStringArray(r.diagnostics.toolCandidateIds).filter(e=>t.has(e));if(1===n.length)return n[0];if(n.length>1)return}}(t.events,new Set(t.agent.tools));return n?{toolId:n,args:o}:void 0}function buildCallCandidates(e){return e.agent.tools.map(t=>({id:t,schema:e.workspace.tools.get(t)?.schema??e.toolGateway?.get(t)?.schema}))}function toolCallRecoveryEnabled(e){return!!(isRecord(e)&&isRecord(e.recovery)&&isRecord(e.recovery.toolCall))&&!0===e.recovery.toolCall.enabled}function readStringArray(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e&&e.length>0):[]}function isRecord(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}
|
|
@@ -11,4 +11,5 @@ export declare function recoverAdapterResultOutput(input: {
|
|
|
11
11
|
workspace: CompiledWorkspace;
|
|
12
12
|
toolGateway?: RuntimeToolGateway;
|
|
13
13
|
runAdapter: (request: RuntimeRequest) => Promise<RuntimeOutput>;
|
|
14
|
+
runRecoveredToolCall?: (toolId: string, args: Record<string, unknown>) => Promise<RuntimeOutput>;
|
|
14
15
|
}): Promise<RuntimeOutput>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{assertNoDeclaredActionOmissionOutput as e}from"../../recovery/control-omission.js";import{buildRawArgsRecoveryRequest as t,hasUniqueRawArgsTool as
|
|
1
|
+
import{assertNoDeclaredActionOmissionOutput as e}from"../../recovery/control-omission.js";import{buildRawArgsRecoveryRequest as t,buildRawArgsToolEvidenceRecoveryRequest as o,hasUniqueRawArgsTool as r,matchUniqueRawArgsTool as a}from"../../recovery/raw-args.js";import{assertNoProgressOnlyToolIntentOutput as s,assertNoRawToolCallOutput as l,assertNoRawToolResultOutput as i,assertNoToolExecutionErrorOutput as u,buildEvidenceSynthesisOutput as n,buildResultRecoveryRequest as c,containsRawToolCallOutput as p,rawToolCallFailureMessage as y,rawToolCallOutputPreview as d,toolCallRecoveryEnabled as v}from"../../recovery/tool-call.js";export async function recoverAdapterResultOutput(o){let g=o.result,w=o.request;const R=function resultRecoveryAttempts(e){const t="object"!=typeof e||null===e||Array.isArray(e)?void 0:e.recovery,o="object"!=typeof t||null===t||Array.isArray(t)?void 0:t.toolCall,r="object"!=typeof o||null===o||Array.isArray(o)?void 0:o.maxResultRecoveryAttempts;return"number"==typeof r&&Number.isInteger(r)&&r>0?r:3}(o.recoveryPolicy),m=new Set,_=new Set;for(let e=0;;e+=1){const r=o.store.getRun(o.requestId)?.events??[],s=a({output:g.text,agent:o.agent,workspace:o.workspace,toolGateway:o.toolGateway,events:r,policy:o.recoveryPolicy}),l=s?rawArgsToolKey(s):void 0,i=l&&!m.has(l)?t({request:w,output:g.text,agent:o.agent,workspace:o.workspace,toolGateway:o.toolGateway,events:r,policy:o.recoveryPolicy}):void 0,u=e<R?c({request:w,output:g.text,events:r,availableToolIds:o.agent.tools,policy:o.recoveryPolicy}):void 0,n=i??u;if(!n)break;if(n===i&&m.add(l),w=n,emitRepair(o,"runtime.repair.started","result_output",e+1,"recoverable_result_output",void 0,repairDiagnostics(g.text,o.agent.tools)),g=await o.runAdapter(n),emitRepair(o,"runtime.repair.completed","result_output",e+1,"recoverable_result_output","retried",repairDiagnostics(g.text,o.agent.tools)),n===i){const t=await recoverRepeatedRawArgsByToolGateway(o,w,g,m,_,e+1);t&&(w=t.request,g=t.result)}}return function finalizeRecoveredOutput(t,o){if(!v(t.recoveryPolicy))return o;let a=!1;if(p(o.text,t.recoveryPolicy)&&function rawToolCallFailureReturnsMessage(e){return"message"===("object"!=typeof e?.toolCallRecovery||null===e.toolCallRecovery||Array.isArray(e.toolCallRecovery)?{}:e.toolCallRecovery).onFailure}(t.request.metadata)){const e=o.text;o={...o,text:y(),metadata:{...o.metadata,toolCallRecovery:{failed:!0,reason:"raw_tool_call_output"}}},emitRepair(t,"runtime.repair.completed","result_output",void 0,"raw_tool_call_output","blocked",repairDiagnostics(e,t.agent.tools))}const c=n({request:t.request,output:o.text,events:t.store.getRun(t.requestId)?.events??[],policy:t.recoveryPolicy});return c&&(a=!0,o={...o,text:c,metadata:{...o.metadata,toolCallRecovery:{synthesized:!0,reason:"raw_tool_call_output_with_evidence"}}},emitRepair(t,"runtime.repair.completed","evidence_synthesis",void 0,"raw_tool_call_output_with_evidence","synthesized")),a||(p(o.text,t.recoveryPolicy)&&emitRepair(t,"runtime.repair.completed","result_output",void 0,"raw_tool_call_output","blocked",repairDiagnostics(o.text,t.agent.tools)),l(o.text,t.recoveryPolicy),function assertNoRawArgsToolOutput(e,t){if(r({output:t,agent:e.agent,workspace:e.workspace,toolGateway:e.toolGateway,events:e.store.getRun(e.requestId)?.events??[],policy:e.recoveryPolicy}))throw new Error(`Adapter returned raw tool argument JSON as the final answer after recovery. The backend must execute the matching tool instead. Output preview: ${d(t)}`)}(t,o.text),s(o.text,t.agent.tools,t.recoveryPolicy),i(o.text,t.store.getRun(t.requestId)?.events??[],t.recoveryPolicy),u(o.text,t.recoveryPolicy),e({output:o.text,events:t.store.getRun(t.requestId)?.events??[],availableToolIds:t.agent.tools})),o}(o,g)}async function recoverRepeatedRawArgsByToolGateway(e,t,r,s,l,i){const u=a({output:r.text,agent:e.agent,workspace:e.workspace,toolGateway:e.toolGateway,events:e.store.getRun(e.requestId)?.events??[],policy:e.recoveryPolicy});if(!u||!e.runRecoveredToolCall)return;const n=rawArgsToolKey(u);if(!s.has(n)||l.has(n))return;l.add(n),emitRepair(e,"runtime.repair.started","result_output",i,"raw_args_tool_gateway_recovery",void 0,repairDiagnostics(r.text,e.agent.tools));const c=await e.runRecoveredToolCall(u.toolId,u.args),p=o({request:t,match:u,toolOutput:c.text}),y=await e.runAdapter(p);return emitRepair(e,"runtime.repair.completed","result_output",i,"raw_args_tool_gateway_recovery","retried",repairDiagnostics(y.text,e.agent.tools)),{request:p,result:y}}function emitRepair(e,t,o,r,a,s,l){const i={requestId:e.requestId,sessionId:e.sessionId,agentId:e.agent.id,layer:o,attempt:r,reason:a,...l?{diagnostics:l}:{}};e.emit("runtime.repair.started"===t?{type:t,...i}:{type:t,...i,outcome:s??"retried"})}function repairDiagnostics(e,t){return{outputPreview:d(e),toolCandidateIds:visibleToolCandidates(e,t)}}function visibleToolCandidates(e,t){const o=new Set;for(const r of t??[])new RegExp(`(?:^|[^A-Za-z0-9_-])${escapeRegexp(r)}(?:$|[^A-Za-z0-9_-])`,"u").test(e)&&o.add(r);return[...o]}function escapeRegexp(e){return e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}function rawArgsToolKey(e){return`${e.toolId}:${JSON.stringify(e.args)}`}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{randomUUID as e}from"node:crypto";import{assertExecutionContract as t}from"./execution-contract.js";import{buildAdapterErrorRecoveryPrompt as r,buildExecutionContractRecoveryRequest as a,isRecoverableAdapterError as
|
|
1
|
+
import{randomUUID as e}from"node:crypto";import{assertExecutionContract as t}from"./execution-contract.js";import{buildAdapterErrorRecoveryPrompt as r,buildExecutionContractRecoveryRequest as a,isRecoverableAdapterError as o}from"./recovery/tool-call.js";import{recoverQualityReview as s,resolveQualityPolicy as n}from"./quality/index.js";import{recoverAdapterResultOutput as i}from"./runtime/recovery/adapter-result.js";import{completeRun as u,failRun as c}from"./runtime/completion.js";import{createRuntimeAdministrationMethods as p}from"./runtime/admin/administration.js";import{runDirectToolCall as d}from"./runtime/direct-tool-call.js";import{createApprovalGatedToolGateway as l}from"./runtime/governance/approval-gate.js";import{createSandboxedToolGateway as m}from"./runtime/governance/sandbox.js";import{createRuntimeInspectionMethods as w}from"./runtime/inspection/methods.js";import{createRuntimeCapabilityRegistry as g,normalizeAdapterResult as y}from"./runtime/capabilities.js";import{createMemoryRuntimeCapability as I}from"./runtime/memory.js";import{resolveToolCallRecoveryPolicy as f}from"./runtime/recovery/tool-call-policy.js";import{createRuntimeMemoryAdministration as q}from"./runtime/admin/memory.js";import{createInMemoryRuntimeStore as R}from"./runtime/persistence/stores.js";import{createProgressNarrationCapability as v}from"./runtime/progress-narration.js";import{repairRuntimeSelection as k}from"./runtime/selection-repair.js";import{createLangSmithTracingCapability as b}from"./runtime/tracing/langsmith.js";import{createToolFailureTracker as A}from"./runtime/tool-failure.js";import{runWorkflowRequest as C}from"./workflows/runtime.js";export function createStableHarnessRuntime(t){const y=new Set,x=t.store??R(),j=g([I(t),v({options:t.progressNarration,policy:t.workspace.runtime}),b({policy:t.workspace.runtime,store:x,options:t.langSmithTracing}),...t.capabilities??[]]),emitBase=t=>{const r=function enrichRuntimeEvent(t){return{...t,eventId:t.eventId??e(),emittedAt:t.emittedAt??(new Date).toISOString()}}(t);x.appendEvent(r);for(const e of y)e(r)},emit=e=>{emitBase(e),j.emitSideEffects(e,emitBase)},E=m({gateway:l({gateway:t.toolGateway,approvals:t.approvals,workspace:t.workspace,emit:emit}),workspace:t.workspace,sandbox:t.sandbox,emit:emit}),G={...t,toolGateway:E},T=A(function readToolFailurePolicy(e){if("object"!=typeof e||null===e||Array.isArray(e))return;const t=e.failurePolicy;return"object"!=typeof t||null===t||Array.isArray(t)?void 0:t}(t.workspace.runtime.toolGateway));return{request:async t=>async function runRuntimeRequest(t){const p=t.request.requestId??e(),l=t.request.sessionId??e(),m=[],{agent:w,adapter:g}=await async function resolveExecution(e,t,r){const a=t.agentId?await async function resolveRequestedAgentId(e,t,r){if(e.agents.has(t))return t;const a=await k({id:t,candidates:[...e.agents.values()].map(e=>({id:e.id,description:e.description})),trace:{...r,agentId:t,layer:"agent",owner:"stable_runtime_policy"}});return a.ok?a.id:t}(e.workspace,t.agentId,r):e.workspace.runtime.defaultAgentId,o=e.workspace.agents.get(a);if(!o)throw new Error(`Agent ${a} is not defined in the workspace`);if(t.toolCall||t.workflow)return{agent:o,adapter:void 0};const s=e.adapters.find(e=>e.canRun(o));if(!s)throw new Error(`No runtime adapter can run backend ${o.backend} for agent ${o.id}`);return{agent:o,adapter:s}}(t.input,t.request,{requestId:p,sessionId:l,emit:e=>m.push(e)});t.store.createRun(function createRunRecord(e,t,r,a){return{requestId:t,sessionId:r,agentId:a.id,input:e.input,state:"running",parentRunId:e.parentRunId,metadata:e.metadata,artifacts:[],startedAt:(new Date).toISOString(),events:[]}}(t.request,p,l,w)),m.forEach(t.emit),t.emit({type:"runtime.request.started",requestId:p,sessionId:l,agentId:w.id,input:t.request.input});try{if(t.request.workflow){const e=await C({workspace:t.input.workspace,adapters:t.input.workflowAdapters??[],toolGateway:t.input.toolGateway,request:{input:t.request.input,...t.request.workflow},requestId:p,sessionId:l,agentId:w.id,emit:t.emit});return u({store:t.store,emit:t.emit,requestId:p,sessionId:l,agent:w,result:e,artifacts:t.input.artifacts})}if(t.request.toolCall){const e=await d({gateway:t.input.toolGateway,workspace:t.input.workspace,emit:t.emit,request:t.request,requestId:p,sessionId:l,agent:w,toolFailureTracker:t.toolFailureTracker,toolGuardrails:t.input.toolGuardrails,events:t.store.getRun(p)?.events??[]});return u({store:t.store,emit:t.emit,requestId:p,sessionId:l,agent:w,result:e,artifacts:t.input.artifacts})}return await async function runAdapterRequest(e){if(!e.adapter)throw new Error(`No runtime adapter can run backend ${e.agent.backend} for agent ${e.agent.id}`);const t=e.adapter,c=await e.capabilities.beforeAdapterRun(createCapabilityContext(e)),p=c.memory,d=c.pluginMemories??[],l=f({workspace:e.input.workspace,agent:e.agent}),m=n(e.input.workspace.runtime,e.agent),w=new Map;let g;try{g=await runAdapterOnce(e,t,e.request,p,d,w,l)}catch(a){if(!o(a,l))throw a;e.emit(repairStarted(e,"adapter_error",1,errorMessage(a))),g=await runAdapterOnce(e,t,r(e.request,a,l),p,d,w,l),e.emit(repairCompleted(e,"adapter_error","retried",1,errorMessage(a)))}g=await i({...e,request:e.request,result:g,recoveryPolicy:l,workspace:e.input.workspace,toolGateway:e.input.toolGateway,runAdapter:r=>runAdapterOnce(e,t,r,p,d,w,l),runRecoveredToolCall:(t,r)=>runRecoveredToolCall(e,t,r)}),g=await s(createQualityRuntimeInput(e,p,d,w,l),e.request,g,m),await e.capabilities.beforeAdapterResultContract({...createCapabilityContext(e),result:g});try{assertRequestExecutionContract(e)}catch(r){const o=a({request:e.request,events:e.store.getRun(e.requestId)?.events??[],policy:l});if(!o)throw r;e.emit(repairStarted(e,"execution_contract",1,errorMessage(r))),g=await runAdapterOnce(e,t,o,p,d,w,l),g=await i({...e,request:o,result:g,recoveryPolicy:l,workspace:e.input.workspace,toolGateway:e.input.toolGateway,runAdapter:r=>runAdapterOnce(e,t,r,p,d,w,l),runRecoveredToolCall:(t,r)=>runRecoveredToolCall(e,t,r)}),g=await s(createQualityRuntimeInput(e,p,d,w,l),o,g,m),assertRequestExecutionContract(e),e.emit(repairCompleted(e,"execution_contract","retried",1,errorMessage(r)))}const y=u({store:e.store,emit:e.emit,requestId:e.requestId,sessionId:e.sessionId,agent:e.agent,result:g,artifacts:e.input.artifacts});return await e.capabilities.afterAdapterResponse({...createCapabilityContext(e),result:g,response:y}),y}({...t,adapter:g,requestId:p,sessionId:l,agent:w})}catch(e){return c({store:t.store,emit:t.emit,requestId:p,sessionId:l,agent:w,error:e})}}({input:G,capabilities:j,store:x,emit:emit,request:t,toolFailureTracker:T}),subscribe:e=>(y.add(e),()=>y.delete(e)),...w({workspace:t.workspace,store:x,artifacts:t.artifacts,approvals:t.approvals,emit:emit}),...p({store:x,emit:emit}),...q({memory:t.memory}),cancel(e,t){const r=x.getRun(e);r&&"running"===r.state&&(x.updateRun(e,{state:"cancelled",completedAt:(new Date).toISOString()}),emit({type:"runtime.request.cancelled",requestId:e,sessionId:r.sessionId,agentId:r.agentId,reason:t}))},async stop(){await j.stop(),y.clear()}}}function runRecoveredToolCall(e,t,r){return d({gateway:e.input.toolGateway,workspace:e.input.workspace,emit:e.emit,request:{...e.request,toolCall:{toolId:t,args:r}},requestId:e.requestId,sessionId:e.sessionId,agent:e.agent,toolFailureTracker:e.input.toolFailureTracker,toolGuardrails:e.input.toolGuardrails,events:e.store.getRun(e.requestId)?.events??[]})}function createCapabilityContext(e){return{workspace:e.input.workspace,store:e.store,emit:e.emit,request:e.request,requestId:e.requestId,sessionId:e.sessionId,agent:e.agent}}function createQualityRuntimeInput(e,t,r,a,o){return{workspace:e.input.workspace,agent:e.agent,request:e.request,requestId:e.requestId,sessionId:e.sessionId,events:e.store.getRun(e.requestId)?.events??[],emit:e.emit,getEvents:()=>e.store.getRun(e.requestId)?.events??[],runAdapter:s=>runAdapterOnce(e,e.adapter,s,t,r,a,o),reviewModel:e.input.qualityReviewModel,executionEvaluatorRules:e.input.executionEvaluatorRules,memory:t,pluginMemories:r}}function assertRequestExecutionContract(e){t({store:e.store,emit:e.emit,requestId:e.requestId,sessionId:e.sessionId,agent:e.agent,metadata:e.request.metadata})}async function runAdapterOnce(e,t,r,a,o,s,n){return y(await t.run({workspace:{...e.input.workspace,runtime:n},agent:e.agent,request:r,requestId:e.requestId,sessionId:e.sessionId,memory:a,pluginMemories:o,toolGateway:e.input.toolGateway,toolFailureTracker:e.input.toolFailureTracker,toolGuardrails:e.input.toolGuardrails,executionEvaluatorRules:e.input.executionEvaluatorRules,requestState:s,getEvents:()=>e.store.getRun(e.requestId)?.events??[],emit:e.emit}))}function repairStarted(e,t,r,a){return{type:"runtime.repair.started",requestId:e.requestId,sessionId:e.sessionId,agentId:e.agent.id,layer:t,attempt:r,reason:a}}function repairCompleted(e,t,r,a,o){return{type:"runtime.repair.completed",requestId:e.requestId,sessionId:e.sessionId,agentId:e.agent.id,layer:t,outcome:r,attempt:a,reason:o}}function errorMessage(e){return e instanceof Error?e.message:String(e)}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stable-harness/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.100",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**/*.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
".": "./dist/index.js"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@stable-harness/governance": "0.0.
|
|
15
|
-
"@stable-harness/memory": "0.0.
|
|
14
|
+
"@stable-harness/governance": "0.0.100",
|
|
15
|
+
"@stable-harness/memory": "0.0.100"
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stable-harness/protocols",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.100",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**/*.js",
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
"main": "dist/src/index.js",
|
|
11
11
|
"types": "dist/src/index.d.ts",
|
|
12
12
|
"peerDependencies": {
|
|
13
|
-
"@stable-harness/core": "0.0.
|
|
13
|
+
"@stable-harness/core": "0.0.100"
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stable-harness/workspace-yaml",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.100",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**/*.js",
|
|
@@ -11,6 +11,6 @@
|
|
|
11
11
|
".": "./dist/index.js"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@stable-harness/core": "0.0.
|
|
14
|
+
"@stable-harness/core": "0.0.100"
|
|
15
15
|
}
|
|
16
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stable-harness",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.100",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Stable application runtime and operator control plane for agent workspaces.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -82,14 +82,14 @@
|
|
|
82
82
|
"@langchain/node-vfs": "^0.1.4",
|
|
83
83
|
"@langchain/ollama": "^1.2.7",
|
|
84
84
|
"@langchain/openai": "^1.4.5",
|
|
85
|
-
"@stable-harness/adapter-deepagents": "0.0.
|
|
86
|
-
"@stable-harness/adapter-langgraph": "0.0.
|
|
87
|
-
"@stable-harness/core": "0.0.
|
|
88
|
-
"@stable-harness/governance": "0.0.
|
|
89
|
-
"@stable-harness/memory": "0.0.
|
|
90
|
-
"@stable-harness/protocols": "0.0.
|
|
91
|
-
"@stable-harness/tool-gateway": "0.0.
|
|
92
|
-
"@stable-harness/workspace-yaml": "0.0.
|
|
85
|
+
"@stable-harness/adapter-deepagents": "0.0.100",
|
|
86
|
+
"@stable-harness/adapter-langgraph": "0.0.100",
|
|
87
|
+
"@stable-harness/core": "0.0.100",
|
|
88
|
+
"@stable-harness/governance": "0.0.100",
|
|
89
|
+
"@stable-harness/memory": "0.0.100",
|
|
90
|
+
"@stable-harness/protocols": "0.0.100",
|
|
91
|
+
"@stable-harness/tool-gateway": "0.0.100",
|
|
92
|
+
"@stable-harness/workspace-yaml": "0.0.100",
|
|
93
93
|
"deepagents": "^1.10.1",
|
|
94
94
|
"langchain": "^1.4.0",
|
|
95
95
|
"yaml": "^2.8.2",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stable-harness/adapter-deepagents",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.100",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**/*.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@langchain/node-vfs": "^0.1.4",
|
|
16
16
|
"@langchain/ollama": "^1.2.7",
|
|
17
17
|
"@langchain/openai": "^1.4.5",
|
|
18
|
-
"@stable-harness/core": "0.0.
|
|
18
|
+
"@stable-harness/core": "0.0.100",
|
|
19
19
|
"deepagents": "^1.10.1",
|
|
20
20
|
"langchain": "^1.4.0"
|
|
21
21
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stable-harness/adapter-langgraph",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.100",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**/*.js",
|
|
@@ -11,6 +11,6 @@
|
|
|
11
11
|
"types": "dist/src/index.d.ts",
|
|
12
12
|
"peerDependencies": {
|
|
13
13
|
"@langchain/langgraph": "^1.3.0",
|
|
14
|
-
"@stable-harness/core": "0.0.
|
|
14
|
+
"@stable-harness/core": "0.0.100"
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{realpathSync as e}from"node:fs";import{fileURLToPath as t}from"node:url";import{createBackendModel as r,createDeepAgentsAdapter as o}from"@stable-harness/adapter-deepagents";import{createLangGraphWorkflowAdapter as s}from"@stable-harness/adapter-langgraph";import{createStableHarnessRuntime as i}from"@stable-harness/core";import{projectEvent as a,projectRuntimeTrace as n}from"@stable-harness/core";import{createInMemoryApprovalQueue as u}from"@stable-harness/governance";import{createModuleToolGateway as d}from"@stable-harness/tool-gateway";import{loadWorkspaceFromYaml as l}from"@stable-harness/workspace-yaml";import{helpText as c,parseArgs as p}from"./args.js";import{buildWorkspaceArtifact as m}from"./build.js";import{formatCliRuntimeEvent as f,readCliEventViewConfig as w,shouldEnableCliProgressNarration as v}from"./event-view.js";import{initWorkspace as g}from"./init.js";import{runRequestThroughDaemon as y}from"./daemon/client.js";import{ensureCliMemoryServices as I}from"./memory/lifecycle.js";import{createCliMemoryProviders as
|
|
2
|
+
import{realpathSync as e}from"node:fs";import{fileURLToPath as t}from"node:url";import{createBackendModel as r,createDeepAgentsAdapter as o}from"@stable-harness/adapter-deepagents";import{createLangGraphWorkflowAdapter as s}from"@stable-harness/adapter-langgraph";import{createStableHarnessRuntime as i}from"@stable-harness/core";import{projectEvent as a,projectRuntimeTrace as n}from"@stable-harness/core";import{createInMemoryApprovalQueue as u}from"@stable-harness/governance";import{createModuleToolGateway as d}from"@stable-harness/tool-gateway";import{loadWorkspaceFromYaml as l}from"@stable-harness/workspace-yaml";import{helpText as c,parseArgs as p}from"./args.js";import{buildWorkspaceArtifact as m}from"./build.js";import{formatCliRuntimeEvent as f,readCliEventViewConfig as w,shouldEnableCliProgressNarration as v}from"./event-view.js";import{initWorkspace as g}from"./init.js";import{runRequestThroughDaemon as y}from"./daemon/client.js";import{ensureCliMemoryServices as I}from"./memory/lifecycle.js";import{createCliMemoryProviders as R}from"./memory/providers.js";import{formatDetail as k,inspectWorkflow as h,renderAgent as b,renderWorkflow as q,workspaceStatus as A}from"./output.js";import{serveProtocol as C,stopProtocol as M}from"./server.js";export async function runCli(e=process.argv.slice(2)){const t=p(e);if(t.help)return void process.stdout.write(c());const r=setTimeout(()=>{process.stderr.write(`stable-harness request timed out after ${t.timeoutMs}ms\n`),process.exit(124)},t.timeoutMs),s=t.workspaceRoot;try{if("init"===t.command)return void process.stdout.write(await g(t.prompt||s));const e=await l(s);if(t.workflowRenderId)return void process.stdout.write(q(e,t.workflowRenderId));if(t.workflowInspectId)return void process.stdout.write(h(e,t.workflowInspectId));if(t.agentRenderId)return void process.stdout.write(b(e,t.agentRenderId));if("build"===t.command)return void process.stdout.write(await m({workspace:e,workspaceRoot:s,outputDir:t.buildOutput,target:t.buildTarget}));if("stop"===t.command)return clearTimeout(r),void await M(e,t);const c=w(e.runtime);if(t.shouldRunRequest&&!t.serveOpenAi&&await y({args:t,runtimePolicy:e.runtime,eventView:c}))return;t.shouldRunRequest&&!t.serveOpenAi&&process.stderr.write("stable-harness runtime: no matching daemon found; running in-process\n");const p=await d({tools:e.tools.values(),options:{betterCall:{mode:"repair"}}}),j=u(),$=await async function createCliMemoryProvidersForCommand(e,t){return t.serveOpenAi||t.shouldRunRequest&&!t.toolId?(await I(e),R(e)):[]}(e,t);let P;if(P=i({workspace:e,toolGateway:p,approvals:j,memoryProviders:$,adapters:[o()],workflowAdapters:[createCliWorkflowAdapter(p,()=>P)],progressNarration:v(c,e.runtime)?{enabled:!0,style:"cli"}:void 0,qualityReviewModel:createQualityReviewModel(e)}),t.serveOpenAi)return clearTimeout(r),void await C(P,t);if(!t.shouldRunRequest)return void process.stdout.write(A(e,s));await async function runInProcessRequest(e,t,r){t.trace&&e.subscribe(e=>{const t=a(e);t&&process.stdout.write(`trace:${t.agentId}:${t.label}${k(t.detail)}\n`)}),e.subscribe(e=>{const t=f(e,r);t&&process.stdout.write(`${t}\n`)});const o=await e.request({input:t.prompt,agentId:t.agentId,sessionId:t.sessionId,toolCall:t.toolId?{toolId:t.toolId,args:t.toolArgs}:void 0,workflow:t.workflowRunId?{workflowId:t.workflowRunId,input:t.prompt}:void 0});if(t.trace||t.traceJson){const r=e.getRun(o.requestId),s=r?n(r):[];t.traceJson&&process.stdout.write(`${JSON.stringify({trace:s})}\n`)}process.stdout.write(`${o.output}\n`)}(P,t,c)}finally{clearTimeout(r)}}function createQualityReviewModel(e){const t=function readQualityModelRef(e){const t=isRecord(e)?e:{},r=isRecord(t.reviewer)?t.reviewer:t;return"string"==typeof r.modelRef&&r.modelRef.trim()?r.modelRef.trim():void 0}(e.runtime.quality),o=t?e.models.get(t):void 0,s=o?r(o):void 0;return function isQualityReviewModel(e){return isRecord(e)&&"function"==typeof e.invoke}(s)?s:void 0}function isRecord(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function createCliWorkflowAdapter(e,t){return s({nodeResolvers:{tools:async({id:t,node:r,request:o,requestId:s,sessionId:i,state:a,workspace:n})=>{return(await e.invoke({toolId:t,args:(u=r.config,d=o.input,l=a.outputs,!0===u?.inputFromState?{...u,requestInput:d,outputs:l}:u&&"requiredInput"in u?u.requiredInput:u&&("args"in u||"cwd"in u||"timeoutMs"in u)?u:"object"==typeof d&&null!==d?d:{}),context:{workspaceRoot:n.root,requestId:s,sessionId:i,agentId:`workflow:${r.id}`,approvalIds:readApprovalIds(o.metadata)}})).output;var u,d,l},agents:async({id:e,node:r,request:o,sessionId:s,state:i})=>{var a,n,u,d;return(await t().request({input:(a=e,n=o.input,u=i.outputs,d=r.config,[`Workflow node agents.${a}: synthesize the workflow evidence into the requested final output.`,`Original request: ${"string"==typeof n?n:JSON.stringify(n)}`,"Requirements:","- Produce the final answer now; do not ask follow-up questions.","- Match the original request language unless workflow config explicitly says otherwise.","- Use only the workflow outputs as evidence; call out uncertainty directly.",...d?[`Workflow node config: ${JSON.stringify(d)}`]:[],"Prior workflow outputs:",JSON.stringify(u)].join("\n")),agentId:e,sessionId:s,metadata:o.metadata})).output}}})}function readApprovalIds(e){const t=e?.approvalIds??e?.approvalId;return"string"==typeof t&&t.trim()?[t.trim()]:Array.isArray(t)?t.filter(e=>"string"==typeof e&&e.trim().length>0):void 0}(function isCliEntrypoint(){const r=process.argv[1];if(!r)return!1;try{return e(t(import.meta.url))===e(r)}catch{return!1}})()&&runCli().catch(e=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}\n`),process.exitCode=1});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{randomUUID as t}from"node:crypto";import e from"node:path";import{formatCliRuntimeEvent as r}from"../event-view.js";export async function runRequestThroughDaemon(n){const o=function daemonBaseUrl(t){const e=function protocolConfig(t,...e){for(const r of e){const e=readRecord(t[r]);if(e)return e}}(readRecord(t.protocols)??{},"stableRuntime","stable-runtime","http")??{};return`http://${function configString(t){if("string"!=typeof t||!t.trim())return;const e=t.match(/^\$\{env:([A-Za-z_][A-Za-z0-9_]*)(?::-(.*))?\}$/u);return e?process.env[e[1]]??e[2]:t}(e.host)??process.env.STABLE_HARNESS_RUNTIME_HOST??"127.0.0.1"}:${configNumber(e.port)??configNumber(process.env.STABLE_HARNESS_RUNTIME_PORT)??8641}`}(n.runtimePolicy);if(!await async function isDaemonAvailable(t,r){try{const n=await fetch(`${t}/inspect`,{signal:AbortSignal.timeout(300)});if(!n.ok)return!1;const o=await n.json();return Array.isArray(o.agents)&&Array.isArray(o.runs)&&o.workspaceRoot===e.resolve(r)}catch{return!1}}(o,n.args.workspaceRoot))return!1;const s=t(),a=function streamDaemonEvents(t,e,n){const o=new AbortController;return async function readDaemonEventStream(t,e,n,o){try{const s=await fetch(`${t}/events?requestId=${encodeURIComponent(e)}`,{signal:o}),a=s.body?.getReader();if(!a)return;await async function readSseMessages(t,e){let r="";for(;;){const{value:n,done:o}=await t.read();if(o)return;r+=Buffer.from(n).toString("utf8");const s=r.split("\n\n");r=s.pop()??"";for(const t of s){const r=parseSseEvent(t);r&&e(r)}}}(a,t=>{const e=r(t,n);e&&process.stdout.write(`${e}\n`)})}catch(t){o.aborted||process.stderr.write(`stable-harness daemon event stream failed: ${function errorMessage(t){return t instanceof Error?t.message:String(t)}(t)}\n`)}}(t,e,n,o.signal),{close:()=>o.abort()}}(o,s,n.eventView);try{const t=await async function postRuntimeRequest(t,e,r){const n=await fetch(`${t}/requests`,{method:"POST",body:JSON.stringify(toRuntimeRequest(e,r))});if(!n.ok)throw new Error(`stable-harness daemon request failed: HTTP ${n.status}`);return await n.json()}(o,n.args,s);return(n.args.trace||n.args.traceJson)&&await async function printDaemonTrace(t,e,r){const n=await fetch(`${t}/runs/${encodeURIComponent(e)}/trace`);if(!n.ok)return;const o=await n.json();if(r)process.stdout.write(`${JSON.stringify({trace:o})}\n`);else for(const t of o)process.stdout.write(`trace:${t.agentId}:${t.label}${t.detail?` ${JSON.stringify(t.detail)}`:""}\n`)}(o,t.requestId,n.args.traceJson),process.stdout.write(`${t.output}\n`),!0}finally{a.close()}}function toRuntimeRequest(t,e){return{input:t.prompt,requestId:e,...t.agentId?{agentId:t.agentId}:{},...t.sessionId?{sessionId:t.sessionId}:{},...t.toolId?{toolCall:{toolId:t.toolId,args:t.toolArgs}}:{},...t.workflowRunId?{workflow:{workflowId:t.workflowRunId,input:t.prompt}}:{}}}function parseSseEvent(t){const e=t.split("\n").find(t=>t.startsWith("data: "))?.slice(6);return e?JSON.parse(e):void 0}function readRecord(t){return"object"!=typeof t||null===t||Array.isArray(t)?void 0:t}function configNumber(t){return"number"==typeof t&&Number.isFinite(t)?t:"string"==typeof t&&t.trim()?Number(t):void 0}
|
|
1
|
+
import{randomUUID as t}from"node:crypto";import e from"node:path";import{formatCliRuntimeEvent as r}from"../event-view.js";export async function runRequestThroughDaemon(n){const o=function daemonBaseUrl(t){const e=function protocolConfig(t,...e){for(const r of e){const e=readRecord(t[r]);if(e)return e}}(readRecord(t.protocols)??{},"stableRuntime","stable-runtime","http")??{};return`http://${function configString(t){if("string"!=typeof t||!t.trim())return;const e=t.match(/^\$\{env:([A-Za-z_][A-Za-z0-9_]*)(?::-(.*))?\}$/u);return e?process.env[e[1]]??e[2]:t}(e.host)??process.env.STABLE_HARNESS_RUNTIME_HOST??"127.0.0.1"}:${configNumber(e.port)??configNumber(process.env.STABLE_HARNESS_RUNTIME_PORT)??8641}`}(n.runtimePolicy);if(!await async function isDaemonAvailable(t,r){try{const n=await fetch(`${t}/inspect`,{signal:AbortSignal.timeout(300)});if(!n.ok)return!1;const o=await n.json();return Array.isArray(o.agents)&&Array.isArray(o.runs)&&o.workspaceRoot===e.resolve(r)}catch{return!1}}(o,n.args.workspaceRoot))return!1;process.stderr.write(`stable-harness runtime: connected to daemon at ${o}\n`);const s=t(),a=function streamDaemonEvents(t,e,n){const o=new AbortController;return async function readDaemonEventStream(t,e,n,o){try{const s=await fetch(`${t}/events?requestId=${encodeURIComponent(e)}`,{signal:o}),a=s.body?.getReader();if(!a)return;await async function readSseMessages(t,e){let r="";for(;;){const{value:n,done:o}=await t.read();if(o)return;r+=Buffer.from(n).toString("utf8");const s=r.split("\n\n");r=s.pop()??"";for(const t of s){const r=parseSseEvent(t);r&&e(r)}}}(a,t=>{const e=r(t,n);e&&process.stdout.write(`${e}\n`)})}catch(t){o.aborted||process.stderr.write(`stable-harness daemon event stream failed: ${function errorMessage(t){return t instanceof Error?t.message:String(t)}(t)}\n`)}}(t,e,n,o.signal),{close:()=>o.abort()}}(o,s,n.eventView);try{const t=await async function postRuntimeRequest(t,e,r){const n=await fetch(`${t}/requests`,{method:"POST",body:JSON.stringify(toRuntimeRequest(e,r))});if(!n.ok)throw new Error(`stable-harness daemon request failed: HTTP ${n.status}`);return await n.json()}(o,n.args,s);return(n.args.trace||n.args.traceJson)&&await async function printDaemonTrace(t,e,r){const n=await fetch(`${t}/runs/${encodeURIComponent(e)}/trace`);if(!n.ok)return;const o=await n.json();if(r)process.stdout.write(`${JSON.stringify({trace:o})}\n`);else for(const t of o)process.stdout.write(`trace:${t.agentId}:${t.label}${t.detail?` ${JSON.stringify(t.detail)}`:""}\n`)}(o,t.requestId,n.args.traceJson),process.stdout.write(`${t.output}\n`),!0}finally{a.close()}}function toRuntimeRequest(t,e){return{input:t.prompt,requestId:e,...t.agentId?{agentId:t.agentId}:{},...t.sessionId?{sessionId:t.sessionId}:{},...t.toolId?{toolCall:{toolId:t.toolId,args:t.toolArgs}}:{},...t.workflowRunId?{workflow:{workflowId:t.workflowRunId,input:t.prompt}}:{}}}function parseSseEvent(t){const e=t.split("\n").find(t=>t.startsWith("data: "))?.slice(6);return e?JSON.parse(e):void 0}function readRecord(t){return"object"!=typeof t||null===t||Array.isArray(t)?void 0:t}function configNumber(t){return"number"==typeof t&&Number.isFinite(t)?t:"string"==typeof t&&t.trim()?Number(t):void 0}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stable-harness/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.100",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**/*.js",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"types": "dist/src/index.d.ts",
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"@langchain/langgraph-api": "^1.2.1",
|
|
17
|
-
"@stable-harness/adapter-deepagents": "0.0.
|
|
18
|
-
"@stable-harness/adapter-langgraph": "0.0.
|
|
19
|
-
"@stable-harness/core": "0.0.
|
|
20
|
-
"@stable-harness/memory": "0.0.
|
|
21
|
-
"@stable-harness/protocols": "0.0.
|
|
22
|
-
"@stable-harness/tool-gateway": "0.0.
|
|
23
|
-
"@stable-harness/workspace-yaml": "0.0.
|
|
17
|
+
"@stable-harness/adapter-deepagents": "0.0.100",
|
|
18
|
+
"@stable-harness/adapter-langgraph": "0.0.100",
|
|
19
|
+
"@stable-harness/core": "0.0.100",
|
|
20
|
+
"@stable-harness/memory": "0.0.100",
|
|
21
|
+
"@stable-harness/protocols": "0.0.100",
|
|
22
|
+
"@stable-harness/tool-gateway": "0.0.100",
|
|
23
|
+
"@stable-harness/workspace-yaml": "0.0.100"
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -10,4 +10,14 @@ export type RawArgsRecoveryInput = {
|
|
|
10
10
|
policy: unknown;
|
|
11
11
|
};
|
|
12
12
|
export declare function buildRawArgsRecoveryRequest(input: RawArgsRecoveryInput): RuntimeRequest | undefined;
|
|
13
|
+
export declare function buildRawArgsToolEvidenceRecoveryRequest(input: {
|
|
14
|
+
request: RuntimeRequest;
|
|
15
|
+
match: RawArgsToolMatch;
|
|
16
|
+
toolOutput: string;
|
|
17
|
+
}): RuntimeRequest;
|
|
13
18
|
export declare function hasUniqueRawArgsTool(input: Omit<RawArgsRecoveryInput, "request">): boolean;
|
|
19
|
+
export type RawArgsToolMatch = {
|
|
20
|
+
toolId: string;
|
|
21
|
+
args: Record<string, unknown>;
|
|
22
|
+
};
|
|
23
|
+
export declare function matchUniqueRawArgsTool(input: Omit<RawArgsRecoveryInput, "request">): RawArgsToolMatch | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{selectCallCandidateByArgsSchema as e}from"@easynet/better-call";export function buildRawArgsRecoveryRequest(e){if(!toolCallRecoveryEnabled(e.policy))return;const t=
|
|
1
|
+
import{selectCallCandidateByArgsSchema as e}from"@easynet/better-call";export function buildRawArgsRecoveryRequest(e){if(!toolCallRecoveryEnabled(e.policy))return;const t=matchUniqueRawArgsTool(e);return t?function buildRawArgsRecoveryPrompt(e,t){return{...e,input:[e.input,"","Stable runtime recovery: your previous final answer was a JSON argument object for a declared tool, not the final answer.",`Matched configured tool: ${t.toolId}`,"Continue the same user request by calling that tool through the backend's normal structured tool-calling mechanism with the JSON arguments below.","If the tool call succeeds, synthesize the final user-facing answer from the executed evidence.","Do not print JSON argument objects, raw tool-call markup, plans, or future-intent text as the final answer.","","Previous JSON arguments:",JSON.stringify(t.args)].join("\n"),metadata:{...e.metadata,stableHarnessRecovery:"tool_call"}}}(e.request,t):void 0}export function buildRawArgsToolEvidenceRecoveryRequest(e){return{...e.request,input:[e.request.input,"","Stable runtime recovery: your previous final answer repeated a JSON argument object for a declared tool after a structured tool-call recovery request.",`Matched configured tool: ${e.match.toolId}`,"Stable runtime executed that matched declared tool through the governed tool gateway.","Continue the same user request from the executed evidence below.","If another declared tool is needed, call it through the backend's normal structured tool-calling mechanism.","Otherwise, synthesize the final user-facing answer from the executed evidence.","Do not print JSON argument objects, raw tool-call markup, plans, or future-intent text as the final answer.","","Executed JSON arguments:",JSON.stringify(e.match.args),"","Executed tool output:",e.toolOutput].join("\n"),metadata:{...e.request.metadata,stableHarnessRecovery:"tool_call"}}}export function hasUniqueRawArgsTool(e){return toolCallRecoveryEnabled(e.policy)&&Boolean(matchUniqueRawArgsTool(e))}export function matchUniqueRawArgsTool(t){const o=function parseStandaloneJsonObject(e){const t=e.trim(),o=t.match(/^```(?:json)?\s*\n([\s\S]*?)\n```$/iu)?.[1]?.trim(),r=o??t;if(r.startsWith("{")&&r.endsWith("}")&&!(r.length>6e3))try{const e=JSON.parse(r);return!isRecord(e)||function isToolCallEnvelope(e){const t=["tool","tool_name","name","type","subagent_type"].some(t=>"string"==typeof e[t]),o=["args","arguments","parameters","kwargs"].some(t=>t in e);return t&&o}(e)||function isRuntimeControlObject(e){return"string"==typeof e.status||"string"==typeof e.error||"string"==typeof e.controlStatus}(e)?void 0:e}catch{return}}(t.output);if(!o)return;const r=e({args:o,candidates:buildCallCandidates(t)});if(r.ok)return{toolId:r.candidateId,args:r.args};const n=function latestSingleToolCandidate(e,t){for(let o=(e?.length??0)-1;o>=0;o-=1){const r=e[o];if(!r||!("diagnostics"in r)||!isRecord(r.diagnostics))continue;const n=readStringArray(r.diagnostics.toolCandidateIds).filter(e=>t.has(e));if(1===n.length)return n[0];if(n.length>1)return}}(t.events,new Set(t.agent.tools));return n?{toolId:n,args:o}:void 0}function buildCallCandidates(e){return e.agent.tools.map(t=>({id:t,schema:e.workspace.tools.get(t)?.schema??e.toolGateway?.get(t)?.schema}))}function toolCallRecoveryEnabled(e){return!!(isRecord(e)&&isRecord(e.recovery)&&isRecord(e.recovery.toolCall))&&!0===e.recovery.toolCall.enabled}function readStringArray(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e&&e.length>0):[]}function isRecord(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}
|
|
@@ -11,4 +11,5 @@ export declare function recoverAdapterResultOutput(input: {
|
|
|
11
11
|
workspace: CompiledWorkspace;
|
|
12
12
|
toolGateway?: RuntimeToolGateway;
|
|
13
13
|
runAdapter: (request: RuntimeRequest) => Promise<RuntimeOutput>;
|
|
14
|
+
runRecoveredToolCall?: (toolId: string, args: Record<string, unknown>) => Promise<RuntimeOutput>;
|
|
14
15
|
}): Promise<RuntimeOutput>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{assertNoDeclaredActionOmissionOutput as e}from"../../recovery/control-omission.js";import{buildRawArgsRecoveryRequest as t,hasUniqueRawArgsTool as
|
|
1
|
+
import{assertNoDeclaredActionOmissionOutput as e}from"../../recovery/control-omission.js";import{buildRawArgsRecoveryRequest as t,buildRawArgsToolEvidenceRecoveryRequest as o,hasUniqueRawArgsTool as r,matchUniqueRawArgsTool as a}from"../../recovery/raw-args.js";import{assertNoProgressOnlyToolIntentOutput as s,assertNoRawToolCallOutput as l,assertNoRawToolResultOutput as i,assertNoToolExecutionErrorOutput as u,buildEvidenceSynthesisOutput as n,buildResultRecoveryRequest as c,containsRawToolCallOutput as p,rawToolCallFailureMessage as y,rawToolCallOutputPreview as d,toolCallRecoveryEnabled as v}from"../../recovery/tool-call.js";export async function recoverAdapterResultOutput(o){let g=o.result,w=o.request;const R=function resultRecoveryAttempts(e){const t="object"!=typeof e||null===e||Array.isArray(e)?void 0:e.recovery,o="object"!=typeof t||null===t||Array.isArray(t)?void 0:t.toolCall,r="object"!=typeof o||null===o||Array.isArray(o)?void 0:o.maxResultRecoveryAttempts;return"number"==typeof r&&Number.isInteger(r)&&r>0?r:3}(o.recoveryPolicy),m=new Set,_=new Set;for(let e=0;;e+=1){const r=o.store.getRun(o.requestId)?.events??[],s=a({output:g.text,agent:o.agent,workspace:o.workspace,toolGateway:o.toolGateway,events:r,policy:o.recoveryPolicy}),l=s?rawArgsToolKey(s):void 0,i=l&&!m.has(l)?t({request:w,output:g.text,agent:o.agent,workspace:o.workspace,toolGateway:o.toolGateway,events:r,policy:o.recoveryPolicy}):void 0,u=e<R?c({request:w,output:g.text,events:r,availableToolIds:o.agent.tools,policy:o.recoveryPolicy}):void 0,n=i??u;if(!n)break;if(n===i&&m.add(l),w=n,emitRepair(o,"runtime.repair.started","result_output",e+1,"recoverable_result_output",void 0,repairDiagnostics(g.text,o.agent.tools)),g=await o.runAdapter(n),emitRepair(o,"runtime.repair.completed","result_output",e+1,"recoverable_result_output","retried",repairDiagnostics(g.text,o.agent.tools)),n===i){const t=await recoverRepeatedRawArgsByToolGateway(o,w,g,m,_,e+1);t&&(w=t.request,g=t.result)}}return function finalizeRecoveredOutput(t,o){if(!v(t.recoveryPolicy))return o;let a=!1;if(p(o.text,t.recoveryPolicy)&&function rawToolCallFailureReturnsMessage(e){return"message"===("object"!=typeof e?.toolCallRecovery||null===e.toolCallRecovery||Array.isArray(e.toolCallRecovery)?{}:e.toolCallRecovery).onFailure}(t.request.metadata)){const e=o.text;o={...o,text:y(),metadata:{...o.metadata,toolCallRecovery:{failed:!0,reason:"raw_tool_call_output"}}},emitRepair(t,"runtime.repair.completed","result_output",void 0,"raw_tool_call_output","blocked",repairDiagnostics(e,t.agent.tools))}const c=n({request:t.request,output:o.text,events:t.store.getRun(t.requestId)?.events??[],policy:t.recoveryPolicy});return c&&(a=!0,o={...o,text:c,metadata:{...o.metadata,toolCallRecovery:{synthesized:!0,reason:"raw_tool_call_output_with_evidence"}}},emitRepair(t,"runtime.repair.completed","evidence_synthesis",void 0,"raw_tool_call_output_with_evidence","synthesized")),a||(p(o.text,t.recoveryPolicy)&&emitRepair(t,"runtime.repair.completed","result_output",void 0,"raw_tool_call_output","blocked",repairDiagnostics(o.text,t.agent.tools)),l(o.text,t.recoveryPolicy),function assertNoRawArgsToolOutput(e,t){if(r({output:t,agent:e.agent,workspace:e.workspace,toolGateway:e.toolGateway,events:e.store.getRun(e.requestId)?.events??[],policy:e.recoveryPolicy}))throw new Error(`Adapter returned raw tool argument JSON as the final answer after recovery. The backend must execute the matching tool instead. Output preview: ${d(t)}`)}(t,o.text),s(o.text,t.agent.tools,t.recoveryPolicy),i(o.text,t.store.getRun(t.requestId)?.events??[],t.recoveryPolicy),u(o.text,t.recoveryPolicy),e({output:o.text,events:t.store.getRun(t.requestId)?.events??[],availableToolIds:t.agent.tools})),o}(o,g)}async function recoverRepeatedRawArgsByToolGateway(e,t,r,s,l,i){const u=a({output:r.text,agent:e.agent,workspace:e.workspace,toolGateway:e.toolGateway,events:e.store.getRun(e.requestId)?.events??[],policy:e.recoveryPolicy});if(!u||!e.runRecoveredToolCall)return;const n=rawArgsToolKey(u);if(!s.has(n)||l.has(n))return;l.add(n),emitRepair(e,"runtime.repair.started","result_output",i,"raw_args_tool_gateway_recovery",void 0,repairDiagnostics(r.text,e.agent.tools));const c=await e.runRecoveredToolCall(u.toolId,u.args),p=o({request:t,match:u,toolOutput:c.text}),y=await e.runAdapter(p);return emitRepair(e,"runtime.repair.completed","result_output",i,"raw_args_tool_gateway_recovery","retried",repairDiagnostics(y.text,e.agent.tools)),{request:p,result:y}}function emitRepair(e,t,o,r,a,s,l){const i={requestId:e.requestId,sessionId:e.sessionId,agentId:e.agent.id,layer:o,attempt:r,reason:a,...l?{diagnostics:l}:{}};e.emit("runtime.repair.started"===t?{type:t,...i}:{type:t,...i,outcome:s??"retried"})}function repairDiagnostics(e,t){return{outputPreview:d(e),toolCandidateIds:visibleToolCandidates(e,t)}}function visibleToolCandidates(e,t){const o=new Set;for(const r of t??[])new RegExp(`(?:^|[^A-Za-z0-9_-])${escapeRegexp(r)}(?:$|[^A-Za-z0-9_-])`,"u").test(e)&&o.add(r);return[...o]}function escapeRegexp(e){return e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}function rawArgsToolKey(e){return`${e.toolId}:${JSON.stringify(e.args)}`}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{randomUUID as e}from"node:crypto";import{assertExecutionContract as t}from"./execution-contract.js";import{buildAdapterErrorRecoveryPrompt as r,buildExecutionContractRecoveryRequest as a,isRecoverableAdapterError as
|
|
1
|
+
import{randomUUID as e}from"node:crypto";import{assertExecutionContract as t}from"./execution-contract.js";import{buildAdapterErrorRecoveryPrompt as r,buildExecutionContractRecoveryRequest as a,isRecoverableAdapterError as o}from"./recovery/tool-call.js";import{recoverQualityReview as s,resolveQualityPolicy as n}from"./quality/index.js";import{recoverAdapterResultOutput as i}from"./runtime/recovery/adapter-result.js";import{completeRun as u,failRun as c}from"./runtime/completion.js";import{createRuntimeAdministrationMethods as p}from"./runtime/admin/administration.js";import{runDirectToolCall as d}from"./runtime/direct-tool-call.js";import{createApprovalGatedToolGateway as l}from"./runtime/governance/approval-gate.js";import{createSandboxedToolGateway as m}from"./runtime/governance/sandbox.js";import{createRuntimeInspectionMethods as w}from"./runtime/inspection/methods.js";import{createRuntimeCapabilityRegistry as g,normalizeAdapterResult as y}from"./runtime/capabilities.js";import{createMemoryRuntimeCapability as I}from"./runtime/memory.js";import{resolveToolCallRecoveryPolicy as f}from"./runtime/recovery/tool-call-policy.js";import{createRuntimeMemoryAdministration as q}from"./runtime/admin/memory.js";import{createInMemoryRuntimeStore as R}from"./runtime/persistence/stores.js";import{createProgressNarrationCapability as v}from"./runtime/progress-narration.js";import{repairRuntimeSelection as k}from"./runtime/selection-repair.js";import{createLangSmithTracingCapability as b}from"./runtime/tracing/langsmith.js";import{createToolFailureTracker as A}from"./runtime/tool-failure.js";import{runWorkflowRequest as C}from"./workflows/runtime.js";export function createStableHarnessRuntime(t){const y=new Set,x=t.store??R(),j=g([I(t),v({options:t.progressNarration,policy:t.workspace.runtime}),b({policy:t.workspace.runtime,store:x,options:t.langSmithTracing}),...t.capabilities??[]]),emitBase=t=>{const r=function enrichRuntimeEvent(t){return{...t,eventId:t.eventId??e(),emittedAt:t.emittedAt??(new Date).toISOString()}}(t);x.appendEvent(r);for(const e of y)e(r)},emit=e=>{emitBase(e),j.emitSideEffects(e,emitBase)},E=m({gateway:l({gateway:t.toolGateway,approvals:t.approvals,workspace:t.workspace,emit:emit}),workspace:t.workspace,sandbox:t.sandbox,emit:emit}),G={...t,toolGateway:E},T=A(function readToolFailurePolicy(e){if("object"!=typeof e||null===e||Array.isArray(e))return;const t=e.failurePolicy;return"object"!=typeof t||null===t||Array.isArray(t)?void 0:t}(t.workspace.runtime.toolGateway));return{request:async t=>async function runRuntimeRequest(t){const p=t.request.requestId??e(),l=t.request.sessionId??e(),m=[],{agent:w,adapter:g}=await async function resolveExecution(e,t,r){const a=t.agentId?await async function resolveRequestedAgentId(e,t,r){if(e.agents.has(t))return t;const a=await k({id:t,candidates:[...e.agents.values()].map(e=>({id:e.id,description:e.description})),trace:{...r,agentId:t,layer:"agent",owner:"stable_runtime_policy"}});return a.ok?a.id:t}(e.workspace,t.agentId,r):e.workspace.runtime.defaultAgentId,o=e.workspace.agents.get(a);if(!o)throw new Error(`Agent ${a} is not defined in the workspace`);if(t.toolCall||t.workflow)return{agent:o,adapter:void 0};const s=e.adapters.find(e=>e.canRun(o));if(!s)throw new Error(`No runtime adapter can run backend ${o.backend} for agent ${o.id}`);return{agent:o,adapter:s}}(t.input,t.request,{requestId:p,sessionId:l,emit:e=>m.push(e)});t.store.createRun(function createRunRecord(e,t,r,a){return{requestId:t,sessionId:r,agentId:a.id,input:e.input,state:"running",parentRunId:e.parentRunId,metadata:e.metadata,artifacts:[],startedAt:(new Date).toISOString(),events:[]}}(t.request,p,l,w)),m.forEach(t.emit),t.emit({type:"runtime.request.started",requestId:p,sessionId:l,agentId:w.id,input:t.request.input});try{if(t.request.workflow){const e=await C({workspace:t.input.workspace,adapters:t.input.workflowAdapters??[],toolGateway:t.input.toolGateway,request:{input:t.request.input,...t.request.workflow},requestId:p,sessionId:l,agentId:w.id,emit:t.emit});return u({store:t.store,emit:t.emit,requestId:p,sessionId:l,agent:w,result:e,artifacts:t.input.artifacts})}if(t.request.toolCall){const e=await d({gateway:t.input.toolGateway,workspace:t.input.workspace,emit:t.emit,request:t.request,requestId:p,sessionId:l,agent:w,toolFailureTracker:t.toolFailureTracker,toolGuardrails:t.input.toolGuardrails,events:t.store.getRun(p)?.events??[]});return u({store:t.store,emit:t.emit,requestId:p,sessionId:l,agent:w,result:e,artifacts:t.input.artifacts})}return await async function runAdapterRequest(e){if(!e.adapter)throw new Error(`No runtime adapter can run backend ${e.agent.backend} for agent ${e.agent.id}`);const t=e.adapter,c=await e.capabilities.beforeAdapterRun(createCapabilityContext(e)),p=c.memory,d=c.pluginMemories??[],l=f({workspace:e.input.workspace,agent:e.agent}),m=n(e.input.workspace.runtime,e.agent),w=new Map;let g;try{g=await runAdapterOnce(e,t,e.request,p,d,w,l)}catch(a){if(!o(a,l))throw a;e.emit(repairStarted(e,"adapter_error",1,errorMessage(a))),g=await runAdapterOnce(e,t,r(e.request,a,l),p,d,w,l),e.emit(repairCompleted(e,"adapter_error","retried",1,errorMessage(a)))}g=await i({...e,request:e.request,result:g,recoveryPolicy:l,workspace:e.input.workspace,toolGateway:e.input.toolGateway,runAdapter:r=>runAdapterOnce(e,t,r,p,d,w,l),runRecoveredToolCall:(t,r)=>runRecoveredToolCall(e,t,r)}),g=await s(createQualityRuntimeInput(e,p,d,w,l),e.request,g,m),await e.capabilities.beforeAdapterResultContract({...createCapabilityContext(e),result:g});try{assertRequestExecutionContract(e)}catch(r){const o=a({request:e.request,events:e.store.getRun(e.requestId)?.events??[],policy:l});if(!o)throw r;e.emit(repairStarted(e,"execution_contract",1,errorMessage(r))),g=await runAdapterOnce(e,t,o,p,d,w,l),g=await i({...e,request:o,result:g,recoveryPolicy:l,workspace:e.input.workspace,toolGateway:e.input.toolGateway,runAdapter:r=>runAdapterOnce(e,t,r,p,d,w,l),runRecoveredToolCall:(t,r)=>runRecoveredToolCall(e,t,r)}),g=await s(createQualityRuntimeInput(e,p,d,w,l),o,g,m),assertRequestExecutionContract(e),e.emit(repairCompleted(e,"execution_contract","retried",1,errorMessage(r)))}const y=u({store:e.store,emit:e.emit,requestId:e.requestId,sessionId:e.sessionId,agent:e.agent,result:g,artifacts:e.input.artifacts});return await e.capabilities.afterAdapterResponse({...createCapabilityContext(e),result:g,response:y}),y}({...t,adapter:g,requestId:p,sessionId:l,agent:w})}catch(e){return c({store:t.store,emit:t.emit,requestId:p,sessionId:l,agent:w,error:e})}}({input:G,capabilities:j,store:x,emit:emit,request:t,toolFailureTracker:T}),subscribe:e=>(y.add(e),()=>y.delete(e)),...w({workspace:t.workspace,store:x,artifacts:t.artifacts,approvals:t.approvals,emit:emit}),...p({store:x,emit:emit}),...q({memory:t.memory}),cancel(e,t){const r=x.getRun(e);r&&"running"===r.state&&(x.updateRun(e,{state:"cancelled",completedAt:(new Date).toISOString()}),emit({type:"runtime.request.cancelled",requestId:e,sessionId:r.sessionId,agentId:r.agentId,reason:t}))},async stop(){await j.stop(),y.clear()}}}function runRecoveredToolCall(e,t,r){return d({gateway:e.input.toolGateway,workspace:e.input.workspace,emit:e.emit,request:{...e.request,toolCall:{toolId:t,args:r}},requestId:e.requestId,sessionId:e.sessionId,agent:e.agent,toolFailureTracker:e.input.toolFailureTracker,toolGuardrails:e.input.toolGuardrails,events:e.store.getRun(e.requestId)?.events??[]})}function createCapabilityContext(e){return{workspace:e.input.workspace,store:e.store,emit:e.emit,request:e.request,requestId:e.requestId,sessionId:e.sessionId,agent:e.agent}}function createQualityRuntimeInput(e,t,r,a,o){return{workspace:e.input.workspace,agent:e.agent,request:e.request,requestId:e.requestId,sessionId:e.sessionId,events:e.store.getRun(e.requestId)?.events??[],emit:e.emit,getEvents:()=>e.store.getRun(e.requestId)?.events??[],runAdapter:s=>runAdapterOnce(e,e.adapter,s,t,r,a,o),reviewModel:e.input.qualityReviewModel,executionEvaluatorRules:e.input.executionEvaluatorRules,memory:t,pluginMemories:r}}function assertRequestExecutionContract(e){t({store:e.store,emit:e.emit,requestId:e.requestId,sessionId:e.sessionId,agent:e.agent,metadata:e.request.metadata})}async function runAdapterOnce(e,t,r,a,o,s,n){return y(await t.run({workspace:{...e.input.workspace,runtime:n},agent:e.agent,request:r,requestId:e.requestId,sessionId:e.sessionId,memory:a,pluginMemories:o,toolGateway:e.input.toolGateway,toolFailureTracker:e.input.toolFailureTracker,toolGuardrails:e.input.toolGuardrails,executionEvaluatorRules:e.input.executionEvaluatorRules,requestState:s,getEvents:()=>e.store.getRun(e.requestId)?.events??[],emit:e.emit}))}function repairStarted(e,t,r,a){return{type:"runtime.repair.started",requestId:e.requestId,sessionId:e.sessionId,agentId:e.agent.id,layer:t,attempt:r,reason:a}}function repairCompleted(e,t,r,a,o){return{type:"runtime.repair.completed",requestId:e.requestId,sessionId:e.sessionId,agentId:e.agent.id,layer:t,outcome:r,attempt:a,reason:o}}function errorMessage(e){return e instanceof Error?e.message:String(e)}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stable-harness/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.100",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**/*.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
".": "./dist/index.js"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@stable-harness/governance": "0.0.
|
|
15
|
-
"@stable-harness/memory": "0.0.
|
|
14
|
+
"@stable-harness/governance": "0.0.100",
|
|
15
|
+
"@stable-harness/memory": "0.0.100"
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stable-harness/evaluation",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.100",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**/*.js",
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
"main": "dist/src/index.js",
|
|
11
11
|
"types": "dist/src/index.d.ts",
|
|
12
12
|
"peerDependencies": {
|
|
13
|
-
"@stable-harness/core": "0.0.
|
|
13
|
+
"@stable-harness/core": "0.0.100"
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stable-harness/protocols",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.100",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**/*.js",
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
"main": "dist/src/index.js",
|
|
11
11
|
"types": "dist/src/index.d.ts",
|
|
12
12
|
"peerDependencies": {
|
|
13
|
-
"@stable-harness/core": "0.0.
|
|
13
|
+
"@stable-harness/core": "0.0.100"
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stable-harness/workspace-yaml",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.100",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**/*.js",
|
|
@@ -11,6 +11,6 @@
|
|
|
11
11
|
".": "./dist/index.js"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@stable-harness/core": "0.0.
|
|
14
|
+
"@stable-harness/core": "0.0.100"
|
|
15
15
|
}
|
|
16
16
|
}
|