stable-harness 0.0.85 → 0.0.86
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/package.json +2 -2
- package/node_modules/@stable-harness/adapter-langgraph/package.json +2 -2
- package/node_modules/@stable-harness/core/dist/runtime/metrics/prometheus.d.ts +4 -0
- package/node_modules/@stable-harness/core/dist/runtime/metrics/prometheus.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/package.json +8 -8
- package/packages/core/dist/runtime/metrics/prometheus.d.ts +4 -0
- package/packages/core/dist/runtime/metrics/prometheus.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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stable-harness/adapter-deepagents",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.86",
|
|
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.86",
|
|
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.86",
|
|
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.86"
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -16,10 +16,14 @@ export declare function collectStableHarnessPrometheusSamples(input?: StableHarn
|
|
|
16
16
|
cost: MetricMap;
|
|
17
17
|
durationBuckets: MetricMap;
|
|
18
18
|
durationSumCount: MetricMap;
|
|
19
|
+
approvals: MetricMap;
|
|
19
20
|
events: MetricMap;
|
|
21
|
+
memory: MetricMap;
|
|
22
|
+
quality: MetricMap;
|
|
20
23
|
repairs: MetricMap;
|
|
21
24
|
runs: MetricMap;
|
|
22
25
|
tokens: MetricMap;
|
|
26
|
+
toolCallRepairs: MetricMap;
|
|
23
27
|
tools: MetricMap;
|
|
24
28
|
};
|
|
25
29
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const STABLE_HARNESS_PROMETHEUS_LABELS=["workspace_id","agent_id","tool_id","model","status","event_type","layer","outcome"];const e=[.5,1,2.5,5,10,30,60,120,240,600,Number.POSITIVE_INFINITY];export function renderStableHarnessPrometheusMetrics(e={}){const t=collectStableHarnessPrometheusSamples(e);return`${["# HELP stable_harness_runs_total Stable Harness runs by low-cardinality status and agent.","# TYPE stable_harness_runs_total counter",...renderMetricLines(t.runs),"# HELP stable_harness_run_duration_seconds Stable Harness run duration histogram.","# TYPE stable_harness_run_duration_seconds histogram",...renderMetricLines(t.durationBuckets),...renderMetricLines(t.durationSumCount),"# HELP stable_harness_events_total Stable Harness runtime events by low-cardinality type.","# TYPE stable_harness_events_total counter",...renderMetricLines(t.events),"# HELP stable_harness_tools_total Stable Harness tool outcomes by tool id.","# TYPE stable_harness_tools_total counter",...renderMetricLines(t.tools),"# HELP stable_harness_repairs_total Stable Harness repair attempts by layer and outcome.","# TYPE stable_harness_repairs_total counter",...renderMetricLines(t.repairs),"# HELP stable_harness_tokens_total Stable Harness token usage reported by runtime metadata.","# TYPE stable_harness_tokens_total counter",...renderMetricLines(t.tokens),"# HELP stable_harness_model_cost_usd_total Stable Harness model cost reported by runtime metadata.","# TYPE stable_harness_model_cost_usd_total counter",...renderMetricLines(t.cost)].filter(Boolean).join("\n")}\n`}export function collectStableHarnessPrometheusSamples(e={}){const t=e.runs??e.runtime?.inspect().runs??[],a=cleanLabel(e.workspaceId??e.runtime?.getRuntimePolicy().workspaceId??"stable-harness"),
|
|
1
|
+
export const STABLE_HARNESS_PROMETHEUS_LABELS=["workspace_id","agent_id","tool_id","model","status","event_type","layer","outcome"];const e=[.5,1,2.5,5,10,30,60,120,240,600,Number.POSITIVE_INFINITY];export function renderStableHarnessPrometheusMetrics(e={}){const t=collectStableHarnessPrometheusSamples(e);return`${["# HELP stable_harness_runs_total Stable Harness runs by low-cardinality status and agent.","# TYPE stable_harness_runs_total counter",...renderMetricLines(t.runs),"# HELP stable_harness_run_duration_seconds Stable Harness run duration histogram.","# TYPE stable_harness_run_duration_seconds histogram",...renderMetricLines(t.durationBuckets),...renderMetricLines(t.durationSumCount),"# HELP stable_harness_events_total Stable Harness runtime events by low-cardinality type.","# TYPE stable_harness_events_total counter",...renderMetricLines(t.events),"# HELP stable_harness_tools_total Stable Harness tool outcomes by tool id.","# TYPE stable_harness_tools_total counter",...renderMetricLines(t.tools),"# HELP stable_harness_repairs_total Stable Harness repair attempts by layer and outcome.","# TYPE stable_harness_repairs_total counter",...renderMetricLines(t.repairs),"# HELP stable_harness_tool_call_repairs_total Stable Harness inventory and tool-call repair outcomes.","# TYPE stable_harness_tool_call_repairs_total counter",...renderMetricLines(t.toolCallRepairs),"# HELP stable_harness_approvals_total Stable Harness approval lifecycle decisions.","# TYPE stable_harness_approvals_total counter",...renderMetricLines(t.approvals),"# HELP stable_harness_memory_events_total Stable Harness memory lifecycle and governance events.","# TYPE stable_harness_memory_events_total counter",...renderMetricLines(t.memory),"# HELP stable_harness_quality_reviews_total Stable Harness quality review verdicts.","# TYPE stable_harness_quality_reviews_total counter",...renderMetricLines(t.quality),"# HELP stable_harness_tokens_total Stable Harness token usage reported by runtime metadata.","# TYPE stable_harness_tokens_total counter",...renderMetricLines(t.tokens),"# HELP stable_harness_model_cost_usd_total Stable Harness model cost reported by runtime metadata.","# TYPE stable_harness_model_cost_usd_total counter",...renderMetricLines(t.cost)].filter(Boolean).join("\n")}\n`}export function collectStableHarnessPrometheusSamples(e={}){const t=e.runs??e.runtime?.inspect().runs??[],a=cleanLabel(e.workspaceId??e.runtime?.getRuntimePolicy().workspaceId??"stable-harness"),r={cost:newCounter(),durationBuckets:newCounter(),durationSumCount:newCounter(),approvals:newCounter(),events:newCounter(),memory:newCounter(),quality:newCounter(),repairs:newCounter(),runs:newCounter(),tokens:newCounter(),toolCallRepairs:newCounter(),tools:newCounter()};for(const e of t){const t=cleanLabel(readString(e.metadata?.workspaceId)??a),s=cleanLabel(e.agentId),n=cleanLabel(e.state);add(r.runs,"stable_harness_runs_total",{agent_id:s,status:n,workspace_id:t},1),addDuration(r,durationSeconds(e),{agent_id:s,workspace_id:t}),addTokenMetrics(r,e,{agent_id:s,model:cleanLabel(readString(e.metadata?.model)??"unknown"),workspace_id:t});for(const a of e.events)add(r.events,"stable_harness_events_total",{agent_id:cleanLabel(a.agentId),event_type:cleanLabel(a.type),workspace_id:t},1),addEventMetrics(r,a,t)}return r}function addEventMetrics(e,t,a){"runtime.tool.direct.started"!==t.type?"runtime.tool.direct.completed"!==t.type?"runtime.tool.failure"!==t.type?"runtime.repair.started"!==t.type?"runtime.repair.completed"!==t.type?"runtime.inventory.repair"!==t.type?"runtime.approval.requested"!==t.type&&"runtime.memory.approval.requested"!==t.type?"runtime.approval.resolved"!==t.type?t.type.startsWith("runtime.memory.")?add(e.memory,"stable_harness_memory_events_total",{event_type:cleanLabel(t.type),status:memoryStatus(t),workspace_id:a},1):"runtime.quality.planning.reviewed"!==t.type&&"runtime.quality.execution.reviewed"!==t.type||add(e.quality,"stable_harness_quality_reviews_total",{phase:t.type.includes(".planning.")?"planning":"execution",verdict:cleanLabel(t.verdict),workspace_id:a},1):add(e.approvals,"stable_harness_approvals_total",{kind:cleanLabel(t.approval.kind),status:cleanLabel(t.approval.status),workspace_id:a},1):add(e.approvals,"stable_harness_approvals_total",{kind:cleanLabel(t.approval.kind),status:"requested",workspace_id:a},1):add(e.toolCallRepairs,"stable_harness_tool_call_repairs_total",{layer:cleanLabel(t.diagnostic.layer),outcome:cleanLabel(t.status),source:cleanLabel(t.diagnostic.matchSource??"runtime"),workspace_id:a},1):add(e.repairs,"stable_harness_repairs_total",{layer:cleanLabel(t.layer),outcome:cleanLabel(t.outcome),workspace_id:a},1):add(e.repairs,"stable_harness_repairs_total",{layer:cleanLabel(t.layer),outcome:"started",workspace_id:a},1):add(e.tools,"stable_harness_tools_total",{status:"failed",tool_id:cleanLabel(t.toolId),workspace_id:a},1):add(e.tools,"stable_harness_tools_total",{status:"completed",tool_id:cleanLabel(t.toolId),workspace_id:a},1):add(e.tools,"stable_harness_tools_total",{status:"started",tool_id:cleanLabel(t.toolId),workspace_id:a},1)}function addTokenMetrics(e,t,a){const r=function readRecord(e){return"object"!=typeof e||null===e||Array.isArray(e)?void 0:e}(t.metadata?.tokenUsage),s=readNumber(r?.inputTokens),n=readNumber(r?.outputTokens),o=readNumber(r?.totalTokens)??readNumber(t.metadata?.totalTokens),l=cleanLabel(readString(r?.source)??"runtime_metadata");add(e.tokens,"stable_harness_tokens_total",{...a,direction:"input",source:l},s??0),add(e.tokens,"stable_harness_tokens_total",{...a,direction:"output",source:l},n??0),add(e.tokens,"stable_harness_tokens_total",{...a,direction:"total",source:l},o??(s??0)+(n??0)),add(e.cost,"stable_harness_model_cost_usd_total",{model:a.model??"unknown",source:l,workspace_id:a.workspace_id??"stable-harness"},readNumber(t.metadata?.costUsd)??readNumber(r?.costUsd)??0)}function memoryStatus(e){return e.type.endsWith(".failed")?"failed":e.type.endsWith(".completed")?"completed":e.type.endsWith(".started")?"started":e.type.endsWith(".requested")?"requested":e.type.includes(".candidate.")?"candidate":e.type.includes(".recall.")?"completed":"event"}function durationSeconds(e){const t=Date.parse(e.startedAt),a=Date.parse(e.completedAt??e.startedAt);return!Number.isFinite(t)||!Number.isFinite(a)||a<t?0:(a-t)/1e3}function addDuration(t,a,r){const s=Number.isFinite(a)&&a>=0?a:0;for(const a of e)s<=a&&add(t.durationBuckets,"stable_harness_run_duration_seconds_bucket",{...r,le:a===Number.POSITIVE_INFINITY?"+Inf":String(a)},1);add(t.durationSumCount,"stable_harness_run_duration_seconds_sum",r,s),add(t.durationSumCount,"stable_harness_run_duration_seconds_count",r,1)}function newCounter(){return new Map}function add(e,t,a,r){const s=Number(r??0);if(!Number.isFinite(s)||0===s)return;const n=function sortLabels(e){return Object.fromEntries(Object.entries(e).sort(([e],[t])=>e.localeCompare(t)))}(a),o=`${t}\n${JSON.stringify(n)}`,l=e.get(o)??{labels:n,name:t,value:0};l.value+=s,e.set(o,l)}function renderMetricLines(e){return[...e.values()].sort((e,t)=>e.name.localeCompare(t.name)||JSON.stringify(e.labels).localeCompare(JSON.stringify(t.labels))).map(e=>`${e.name}${function formatLabels(e){const t=Object.entries(e).filter(([,e])=>""!==e);return 0===t.length?"":`{${t.map(([e,t])=>`${e}="${function escapeLabel(e){return e.replaceAll("\\","\\\\").replaceAll("\n","\\n").replaceAll('"','\\"')}(t)}"`).join(",")}}`}(e.labels)} ${function formatNumber(e){return Number.isFinite(e)?String(Number(e.toFixed(6))):"0"}(e.value)}`)}function cleanLabel(e){return String(e??"unknown").trim().replace(/[^\w:.-]+/gu,"_").slice(0,80)||"unknown"}function readString(e){return"string"==typeof e&&e.trim()?e:void 0}function readNumber(e){return"number"==typeof e&&Number.isFinite(e)?e:"string"==typeof e&&e.trim()&&Number.isFinite(Number(e))?Number(e):void 0}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stable-harness/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.86",
|
|
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.86",
|
|
15
|
+
"@stable-harness/memory": "0.0.86"
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stable-harness/protocols",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.86",
|
|
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.86"
|
|
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.86",
|
|
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.86"
|
|
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.86",
|
|
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.86",
|
|
86
|
+
"@stable-harness/adapter-langgraph": "0.0.86",
|
|
87
|
+
"@stable-harness/core": "0.0.86",
|
|
88
|
+
"@stable-harness/governance": "0.0.86",
|
|
89
|
+
"@stable-harness/memory": "0.0.86",
|
|
90
|
+
"@stable-harness/protocols": "0.0.86",
|
|
91
|
+
"@stable-harness/tool-gateway": "0.0.86",
|
|
92
|
+
"@stable-harness/workspace-yaml": "0.0.86",
|
|
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.86",
|
|
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.86",
|
|
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.86",
|
|
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.86"
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stable-harness/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.86",
|
|
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.86",
|
|
18
|
+
"@stable-harness/adapter-langgraph": "0.0.86",
|
|
19
|
+
"@stable-harness/core": "0.0.86",
|
|
20
|
+
"@stable-harness/memory": "0.0.86",
|
|
21
|
+
"@stable-harness/protocols": "0.0.86",
|
|
22
|
+
"@stable-harness/tool-gateway": "0.0.86",
|
|
23
|
+
"@stable-harness/workspace-yaml": "0.0.86"
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -16,10 +16,14 @@ export declare function collectStableHarnessPrometheusSamples(input?: StableHarn
|
|
|
16
16
|
cost: MetricMap;
|
|
17
17
|
durationBuckets: MetricMap;
|
|
18
18
|
durationSumCount: MetricMap;
|
|
19
|
+
approvals: MetricMap;
|
|
19
20
|
events: MetricMap;
|
|
21
|
+
memory: MetricMap;
|
|
22
|
+
quality: MetricMap;
|
|
20
23
|
repairs: MetricMap;
|
|
21
24
|
runs: MetricMap;
|
|
22
25
|
tokens: MetricMap;
|
|
26
|
+
toolCallRepairs: MetricMap;
|
|
23
27
|
tools: MetricMap;
|
|
24
28
|
};
|
|
25
29
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const STABLE_HARNESS_PROMETHEUS_LABELS=["workspace_id","agent_id","tool_id","model","status","event_type","layer","outcome"];const e=[.5,1,2.5,5,10,30,60,120,240,600,Number.POSITIVE_INFINITY];export function renderStableHarnessPrometheusMetrics(e={}){const t=collectStableHarnessPrometheusSamples(e);return`${["# HELP stable_harness_runs_total Stable Harness runs by low-cardinality status and agent.","# TYPE stable_harness_runs_total counter",...renderMetricLines(t.runs),"# HELP stable_harness_run_duration_seconds Stable Harness run duration histogram.","# TYPE stable_harness_run_duration_seconds histogram",...renderMetricLines(t.durationBuckets),...renderMetricLines(t.durationSumCount),"# HELP stable_harness_events_total Stable Harness runtime events by low-cardinality type.","# TYPE stable_harness_events_total counter",...renderMetricLines(t.events),"# HELP stable_harness_tools_total Stable Harness tool outcomes by tool id.","# TYPE stable_harness_tools_total counter",...renderMetricLines(t.tools),"# HELP stable_harness_repairs_total Stable Harness repair attempts by layer and outcome.","# TYPE stable_harness_repairs_total counter",...renderMetricLines(t.repairs),"# HELP stable_harness_tokens_total Stable Harness token usage reported by runtime metadata.","# TYPE stable_harness_tokens_total counter",...renderMetricLines(t.tokens),"# HELP stable_harness_model_cost_usd_total Stable Harness model cost reported by runtime metadata.","# TYPE stable_harness_model_cost_usd_total counter",...renderMetricLines(t.cost)].filter(Boolean).join("\n")}\n`}export function collectStableHarnessPrometheusSamples(e={}){const t=e.runs??e.runtime?.inspect().runs??[],a=cleanLabel(e.workspaceId??e.runtime?.getRuntimePolicy().workspaceId??"stable-harness"),
|
|
1
|
+
export const STABLE_HARNESS_PROMETHEUS_LABELS=["workspace_id","agent_id","tool_id","model","status","event_type","layer","outcome"];const e=[.5,1,2.5,5,10,30,60,120,240,600,Number.POSITIVE_INFINITY];export function renderStableHarnessPrometheusMetrics(e={}){const t=collectStableHarnessPrometheusSamples(e);return`${["# HELP stable_harness_runs_total Stable Harness runs by low-cardinality status and agent.","# TYPE stable_harness_runs_total counter",...renderMetricLines(t.runs),"# HELP stable_harness_run_duration_seconds Stable Harness run duration histogram.","# TYPE stable_harness_run_duration_seconds histogram",...renderMetricLines(t.durationBuckets),...renderMetricLines(t.durationSumCount),"# HELP stable_harness_events_total Stable Harness runtime events by low-cardinality type.","# TYPE stable_harness_events_total counter",...renderMetricLines(t.events),"# HELP stable_harness_tools_total Stable Harness tool outcomes by tool id.","# TYPE stable_harness_tools_total counter",...renderMetricLines(t.tools),"# HELP stable_harness_repairs_total Stable Harness repair attempts by layer and outcome.","# TYPE stable_harness_repairs_total counter",...renderMetricLines(t.repairs),"# HELP stable_harness_tool_call_repairs_total Stable Harness inventory and tool-call repair outcomes.","# TYPE stable_harness_tool_call_repairs_total counter",...renderMetricLines(t.toolCallRepairs),"# HELP stable_harness_approvals_total Stable Harness approval lifecycle decisions.","# TYPE stable_harness_approvals_total counter",...renderMetricLines(t.approvals),"# HELP stable_harness_memory_events_total Stable Harness memory lifecycle and governance events.","# TYPE stable_harness_memory_events_total counter",...renderMetricLines(t.memory),"# HELP stable_harness_quality_reviews_total Stable Harness quality review verdicts.","# TYPE stable_harness_quality_reviews_total counter",...renderMetricLines(t.quality),"# HELP stable_harness_tokens_total Stable Harness token usage reported by runtime metadata.","# TYPE stable_harness_tokens_total counter",...renderMetricLines(t.tokens),"# HELP stable_harness_model_cost_usd_total Stable Harness model cost reported by runtime metadata.","# TYPE stable_harness_model_cost_usd_total counter",...renderMetricLines(t.cost)].filter(Boolean).join("\n")}\n`}export function collectStableHarnessPrometheusSamples(e={}){const t=e.runs??e.runtime?.inspect().runs??[],a=cleanLabel(e.workspaceId??e.runtime?.getRuntimePolicy().workspaceId??"stable-harness"),r={cost:newCounter(),durationBuckets:newCounter(),durationSumCount:newCounter(),approvals:newCounter(),events:newCounter(),memory:newCounter(),quality:newCounter(),repairs:newCounter(),runs:newCounter(),tokens:newCounter(),toolCallRepairs:newCounter(),tools:newCounter()};for(const e of t){const t=cleanLabel(readString(e.metadata?.workspaceId)??a),s=cleanLabel(e.agentId),n=cleanLabel(e.state);add(r.runs,"stable_harness_runs_total",{agent_id:s,status:n,workspace_id:t},1),addDuration(r,durationSeconds(e),{agent_id:s,workspace_id:t}),addTokenMetrics(r,e,{agent_id:s,model:cleanLabel(readString(e.metadata?.model)??"unknown"),workspace_id:t});for(const a of e.events)add(r.events,"stable_harness_events_total",{agent_id:cleanLabel(a.agentId),event_type:cleanLabel(a.type),workspace_id:t},1),addEventMetrics(r,a,t)}return r}function addEventMetrics(e,t,a){"runtime.tool.direct.started"!==t.type?"runtime.tool.direct.completed"!==t.type?"runtime.tool.failure"!==t.type?"runtime.repair.started"!==t.type?"runtime.repair.completed"!==t.type?"runtime.inventory.repair"!==t.type?"runtime.approval.requested"!==t.type&&"runtime.memory.approval.requested"!==t.type?"runtime.approval.resolved"!==t.type?t.type.startsWith("runtime.memory.")?add(e.memory,"stable_harness_memory_events_total",{event_type:cleanLabel(t.type),status:memoryStatus(t),workspace_id:a},1):"runtime.quality.planning.reviewed"!==t.type&&"runtime.quality.execution.reviewed"!==t.type||add(e.quality,"stable_harness_quality_reviews_total",{phase:t.type.includes(".planning.")?"planning":"execution",verdict:cleanLabel(t.verdict),workspace_id:a},1):add(e.approvals,"stable_harness_approvals_total",{kind:cleanLabel(t.approval.kind),status:cleanLabel(t.approval.status),workspace_id:a},1):add(e.approvals,"stable_harness_approvals_total",{kind:cleanLabel(t.approval.kind),status:"requested",workspace_id:a},1):add(e.toolCallRepairs,"stable_harness_tool_call_repairs_total",{layer:cleanLabel(t.diagnostic.layer),outcome:cleanLabel(t.status),source:cleanLabel(t.diagnostic.matchSource??"runtime"),workspace_id:a},1):add(e.repairs,"stable_harness_repairs_total",{layer:cleanLabel(t.layer),outcome:cleanLabel(t.outcome),workspace_id:a},1):add(e.repairs,"stable_harness_repairs_total",{layer:cleanLabel(t.layer),outcome:"started",workspace_id:a},1):add(e.tools,"stable_harness_tools_total",{status:"failed",tool_id:cleanLabel(t.toolId),workspace_id:a},1):add(e.tools,"stable_harness_tools_total",{status:"completed",tool_id:cleanLabel(t.toolId),workspace_id:a},1):add(e.tools,"stable_harness_tools_total",{status:"started",tool_id:cleanLabel(t.toolId),workspace_id:a},1)}function addTokenMetrics(e,t,a){const r=function readRecord(e){return"object"!=typeof e||null===e||Array.isArray(e)?void 0:e}(t.metadata?.tokenUsage),s=readNumber(r?.inputTokens),n=readNumber(r?.outputTokens),o=readNumber(r?.totalTokens)??readNumber(t.metadata?.totalTokens),l=cleanLabel(readString(r?.source)??"runtime_metadata");add(e.tokens,"stable_harness_tokens_total",{...a,direction:"input",source:l},s??0),add(e.tokens,"stable_harness_tokens_total",{...a,direction:"output",source:l},n??0),add(e.tokens,"stable_harness_tokens_total",{...a,direction:"total",source:l},o??(s??0)+(n??0)),add(e.cost,"stable_harness_model_cost_usd_total",{model:a.model??"unknown",source:l,workspace_id:a.workspace_id??"stable-harness"},readNumber(t.metadata?.costUsd)??readNumber(r?.costUsd)??0)}function memoryStatus(e){return e.type.endsWith(".failed")?"failed":e.type.endsWith(".completed")?"completed":e.type.endsWith(".started")?"started":e.type.endsWith(".requested")?"requested":e.type.includes(".candidate.")?"candidate":e.type.includes(".recall.")?"completed":"event"}function durationSeconds(e){const t=Date.parse(e.startedAt),a=Date.parse(e.completedAt??e.startedAt);return!Number.isFinite(t)||!Number.isFinite(a)||a<t?0:(a-t)/1e3}function addDuration(t,a,r){const s=Number.isFinite(a)&&a>=0?a:0;for(const a of e)s<=a&&add(t.durationBuckets,"stable_harness_run_duration_seconds_bucket",{...r,le:a===Number.POSITIVE_INFINITY?"+Inf":String(a)},1);add(t.durationSumCount,"stable_harness_run_duration_seconds_sum",r,s),add(t.durationSumCount,"stable_harness_run_duration_seconds_count",r,1)}function newCounter(){return new Map}function add(e,t,a,r){const s=Number(r??0);if(!Number.isFinite(s)||0===s)return;const n=function sortLabels(e){return Object.fromEntries(Object.entries(e).sort(([e],[t])=>e.localeCompare(t)))}(a),o=`${t}\n${JSON.stringify(n)}`,l=e.get(o)??{labels:n,name:t,value:0};l.value+=s,e.set(o,l)}function renderMetricLines(e){return[...e.values()].sort((e,t)=>e.name.localeCompare(t.name)||JSON.stringify(e.labels).localeCompare(JSON.stringify(t.labels))).map(e=>`${e.name}${function formatLabels(e){const t=Object.entries(e).filter(([,e])=>""!==e);return 0===t.length?"":`{${t.map(([e,t])=>`${e}="${function escapeLabel(e){return e.replaceAll("\\","\\\\").replaceAll("\n","\\n").replaceAll('"','\\"')}(t)}"`).join(",")}}`}(e.labels)} ${function formatNumber(e){return Number.isFinite(e)?String(Number(e.toFixed(6))):"0"}(e.value)}`)}function cleanLabel(e){return String(e??"unknown").trim().replace(/[^\w:.-]+/gu,"_").slice(0,80)||"unknown"}function readString(e){return"string"==typeof e&&e.trim()?e:void 0}function readNumber(e){return"number"==typeof e&&Number.isFinite(e)?e:"string"==typeof e&&e.trim()&&Number.isFinite(Number(e))?Number(e):void 0}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stable-harness/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.86",
|
|
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.86",
|
|
15
|
+
"@stable-harness/memory": "0.0.86"
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stable-harness/evaluation",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.86",
|
|
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.86"
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stable-harness/protocols",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.86",
|
|
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.86"
|
|
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.86",
|
|
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.86"
|
|
15
15
|
}
|
|
16
16
|
}
|