jev-dev-harness 0.2.14 → 0.2.17
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/CHANGELOG.md +145 -88
- package/LICENSE +21 -21
- package/README.md +687 -656
- package/bin/jev-dev.js +3 -3
- package/bin/jev-mcp.js +8 -8
- package/dashboard/index.html +1122 -1122
- package/dist/cli/delegate.d.ts +4 -0
- package/dist/cli/delegate.d.ts.map +1 -0
- package/dist/cli/delegate.js +62 -0
- package/dist/cli/delegate.js.map +1 -0
- package/dist/cli/doctor.js +46 -46
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +25 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +25 -9
- package/dist/cli/setup.js.map +1 -1
- package/dist/context-ranker/stage-a-filter.d.ts.map +1 -1
- package/dist/context-ranker/stage-a-filter.js +26 -29
- package/dist/context-ranker/stage-a-filter.js.map +1 -1
- package/dist/context-ranker/types.d.ts +1 -0
- package/dist/context-ranker/types.d.ts.map +1 -1
- package/dist/delegate/index.d.ts +129 -0
- package/dist/delegate/index.d.ts.map +1 -0
- package/dist/delegate/index.js +87 -0
- package/dist/delegate/index.js.map +1 -0
- package/dist/hooks/index.d.ts +29 -3
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +176 -48
- package/dist/hooks/index.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +6 -0
- package/dist/mcp/server.js.map +1 -1
- package/dist/shared/efficiency.d.ts +4 -1
- package/dist/shared/efficiency.d.ts.map +1 -1
- package/dist/shared/efficiency.js +8 -4
- package/dist/shared/efficiency.js.map +1 -1
- package/dist/shared/telemetry.d.ts +6 -0
- package/dist/shared/telemetry.d.ts.map +1 -1
- package/dist/shared/telemetry.js +6 -0
- package/dist/shared/telemetry.js.map +1 -1
- package/dist/shared/typesafe-client.d.ts +2 -0
- package/dist/shared/typesafe-client.d.ts.map +1 -1
- package/dist/shared/typesafe-client.js +20 -9
- package/dist/shared/typesafe-client.js.map +1 -1
- package/dist/shared/version.js +1 -1
- package/dist/tool-guard/guard.d.ts.map +1 -1
- package/dist/tool-guard/guard.js +32 -8
- package/dist/tool-guard/guard.js.map +1 -1
- package/docs/RELEASING.md +250 -216
- package/docs/jev/DELEGATED-REVIEW.md +86 -0
- package/docs/jev/JEV-0.2.16-DEFAULTS.md +60 -0
- package/docs/jev/JEV-1.14-EVALUATION.md +99 -99
- package/docs/jev/MEASURED-USAGE.md +155 -155
- package/docs/jev/MULTI-HARNESS-USAGE.md +163 -163
- package/docs/jev/OPENROUTER-NATIVE.md +93 -93
- package/docs/jev/README.md +85 -85
- package/docs/jev/evaluation-jev-1.14-2026-10-15.json +1731 -1731
- package/package.json +139 -134
|
@@ -1,163 +1,163 @@
|
|
|
1
|
-
# Measured usage across harnesses (0.2.11)
|
|
2
|
-
|
|
3
|
-
Jev measures its own calls in every MCP/CLI integration. Main-agent consumption
|
|
4
|
-
requires usage reported by the agent/provider: MCP cannot observe private client
|
|
5
|
-
inference. This feature provides shared import, comparison and optional proxy
|
|
6
|
-
collection, not automatic access to every editor's internal sessions.
|
|
7
|
-
|
|
8
|
-
## Supported data routes
|
|
9
|
-
|
|
10
|
-
| Client | Implemented route | External setup required |
|
|
11
|
-
| --- | --- | --- |
|
|
12
|
-
| Codex | Existing local rollout discovery/import | Equivalent completed runs and validation receipts |
|
|
13
|
-
| Antigravity | Common SDK/export bridge; Gemini adapter; configurable endpoint proxy | SDK hook/export wiring; IDE history is not automatically read |
|
|
14
|
-
| Cursor | Exported `cursor-event` adapter; common bridge/proxy | API access, stable request IDs, conversation/task filtering and all pages; no undocumented CSV parser |
|
|
15
|
-
| TRAE | Common export bridge/provider proxy | Actual reported usage source or configurable BYOK endpoint; no private log parser |
|
|
16
|
-
| VS Code/extensions | Library/MCP/CLI bridge and provider proxy | Wire provider completion hook; text-only APIs cannot supply measured usage |
|
|
17
|
-
| Other CLIs | OpenAI Chat/Responses, Anthropic and Gemini adapters | Export each real request, including workers/retries; or configure endpoint |
|
|
18
|
-
|
|
19
|
-
Native editor smoke tests were not run. Tests cover exports, normalization,
|
|
20
|
-
CLI/MCP entry points and local HTTP JSON/SSE forwarding. Closed services without
|
|
21
|
-
exports/configurable endpoints remain unknown. Quota percentages, tokenizers and
|
|
22
|
-
nominal price tables are not converted into measured tokens or bills.
|
|
23
|
-
|
|
24
|
-
## Common export contract
|
|
25
|
-
|
|
26
|
-
Illustrative structure; numbers below are not measurements of your task:
|
|
27
|
-
|
|
28
|
-
```json
|
|
29
|
-
{
|
|
30
|
-
"schemaVersion": 1, "kind": "agent_usage", "harness": "vscode-extension",
|
|
31
|
-
"sessionId": "independent-chat-id", "turnId": "task-interval-id",
|
|
32
|
-
"initialRevision": "exact-starting-commit", "model": "actual-model",
|
|
33
|
-
"effort": "actual-reasoning-configuration",
|
|
34
|
-
"startedAt": "2026-09-30T10:00:00Z", "endedAt": "2026-09-30T10:01:00Z",
|
|
35
|
-
"status": "completed", "coverage": "partial",
|
|
36
|
-
"includesJevUsage": false, "jevCallsObserved": true,
|
|
37
|
-
"events": [{
|
|
38
|
-
"requestId": "actual-provider-request-id", "provider": "actual-provider",
|
|
39
|
-
"format": "openai-responses",
|
|
40
|
-
"usage": { "input_tokens": 100, "output_tokens": 20, "total_tokens": 120 }
|
|
41
|
-
}]
|
|
42
|
-
}
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Record **one final usage per actual request**, never per stream chunk. Preserve
|
|
46
|
-
stable IDs on reimport. Convert cumulative session snapshots to interval
|
|
47
|
-
differences at the source, not sums. Record each retry with its own ID; attempts
|
|
48
|
-
with no usage must use `usage: null`. Split intervals using different models.
|
|
49
|
-
|
|
50
|
-
`coverage: complete` declares that all agent/worker/retry requests are included.
|
|
51
|
-
Partial coverage or missing totals blocks a task token difference. Reported
|
|
52
|
-
subtotals remain separately labeled. Missing cache, reasoning or cost stays null.
|
|
53
|
-
`includesJevUsage` must be false: Jev overhead is collected separately. Keep
|
|
54
|
-
harness, model, effort, initial commit, environment and validation equivalent.
|
|
55
|
-
|
|
56
|
-
Usage formats:
|
|
57
|
-
|
|
58
|
-
- `openai-chat` / `openai-responses`: the reported `usage` object; cache/reasoning
|
|
59
|
-
are subsets of primary input/output, never added again.
|
|
60
|
-
- `anthropic`: reported `usage`; total input adds uncached input, cache reads and
|
|
61
|
-
writes. Absent cache counters leave total input unknown.
|
|
62
|
-
- `gemini`: REST `usageMetadata` in camelCase. Total includes thinking;
|
|
63
|
-
contradictory totals or nonzero tool-use prompt counters require an explicit
|
|
64
|
-
normalized breakdown. Map SDK snake_case fields explicitly.
|
|
65
|
-
- `cursor-event`: one exported usage event; input adds uncached/read/write
|
|
66
|
-
counters. `chargedCents` is the reported USD charge; nominal `totalCents` and
|
|
67
|
-
request credits are not substituted. Missing token usage is unknown.
|
|
68
|
-
- `normalized`: `inputTokens`, `outputTokens`, `totalTokens`,
|
|
69
|
-
`cachedInputTokens`, `cacheWriteInputTokens`, `reasoningOutputTokens`.
|
|
70
|
-
Cache/reasoning are included in primary totals; fields may be null.
|
|
71
|
-
|
|
72
|
-
Optional `costUsd` must come from a reported charge. Cost coverage is returned as
|
|
73
|
-
costed/captured requests. A partial sum is not a full bill. Monetary comparisons
|
|
74
|
-
still require matching complete billing receipts, never prices inferred from tokens.
|
|
75
|
-
|
|
76
|
-
## Hooks and extensions
|
|
77
|
-
|
|
78
|
-
The package's existing public library exports `exportAgentUsage(path, run)`,
|
|
79
|
-
`importAgentUsage(path)` and `normalizeAgentUsage(format, usage)`:
|
|
80
|
-
|
|
81
|
-
```ts
|
|
82
|
-
import { exportAgentUsage } from "jev-dev-harness";
|
|
83
|
-
exportAgentUsage(outputPath, {
|
|
84
|
-
...completedTaskMetadata,
|
|
85
|
-
schemaVersion: 1, kind: "agent_usage", status: "completed",
|
|
86
|
-
includesJevUsage: false,
|
|
87
|
-
events: collectedResponses.map(response => ({
|
|
88
|
-
requestId: response.requestId, provider: response.provider,
|
|
89
|
-
format: "openai-responses", usage: response.usage ?? null,
|
|
90
|
-
})),
|
|
91
|
-
});
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
The export allowlists metadata/counters, strips response text/prompts/unknown
|
|
95
|
-
fields, rejects duplicate requests and refuses overwrite. Python/shell hooks can
|
|
96
|
-
write the same contract and sanitize it using:
|
|
97
|
-
|
|
98
|
-
```sh
|
|
99
|
-
jev-dev efficiency import --input agent-usage.json --output sanitized-usage.json
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
Antigravity SDK total-only observations can map reported
|
|
103
|
-
`response.usage_metadata.total_token_count` to normalized `totalTokens`; leave
|
|
104
|
-
unreported fields null. VS Code text-only responses must use `usage: null` unless
|
|
105
|
-
the provider reports usage separately. Counting text is not actual request usage.
|
|
106
|
-
|
|
107
|
-
MCP: `jev_import_usage({inputPath, format: "agent_usage_v1"})` reads only specified
|
|
108
|
-
files without inference/writes. Restart installed MCP servers to expose the tool.
|
|
109
|
-
|
|
110
|
-
## Optional automatic capture through the existing proxy
|
|
111
|
-
|
|
112
|
-
Only for clients with configurable API endpoints; it does not intercept closed
|
|
113
|
-
services/TLS. Use a metadata JSON with the common identity/coverage fields above
|
|
114
|
-
(omit events, timestamps, kind/status; the proxy supplies them):
|
|
115
|
-
|
|
116
|
-
```sh
|
|
117
|
-
jev-dev efficiency begin --run-id task-jev-001
|
|
118
|
-
jev-dev proxy generic --upstream https://your-provider.example \
|
|
119
|
-
--usage-metadata task-metadata.json --usage-output agent-usage.json \
|
|
120
|
-
--measurement-run-id task-jev-001
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
Configure the client to use the proxy's localhost endpoint. The router's Jev calls
|
|
124
|
-
use this ledger; all other Jev tools must use the same measurement ID. Baselines
|
|
125
|
-
require `--no-routing` and `jevCallsObserved: false`. Routing-enabled captures
|
|
126
|
-
must declare Jev enabled. Metadata must not contain credentials.
|
|
127
|
-
|
|
128
|
-
Request model must match metadata (Gemini reads it from the models URL).
|
|
129
|
-
If the provider reports a different resolved model, the capture stays unknown;
|
|
130
|
-
use an exact model ID rather than an alias for controlled comparisons.
|
|
131
|
-
Stop gracefully with Ctrl+C/SIGTERM after all requests finish, then close the Jev ledger
|
|
132
|
-
with `efficiency finish`. A forced kill can lose in-memory observations; no
|
|
133
|
-
complete export is claimed. Empty captures are rejected. Capture one task at a time.
|
|
134
|
-
|
|
135
|
-
JSON/SSE responses are forwarded unchanged. Anthropic start/delta fields merge;
|
|
136
|
-
OpenAI/Gemini usage snapshots replace previous ones. Missing, invalid, oversized,
|
|
137
|
-
HTTP-error or failed response usage stays unknown. Only requests routed through
|
|
138
|
-
the proxy are observed; bypassed/hidden retries and external workers are outside
|
|
139
|
-
coverage. Multi-line SSE and unsupported protocols remain unknown. No request is
|
|
140
|
-
modified to force usage reporting: enable it in the client itself.
|
|
141
|
-
|
|
142
|
-
## Comparison compatibility
|
|
143
|
-
|
|
144
|
-
Use the existing [paired validation workflow](MEASURED-USAGE.md) with references:
|
|
145
|
-
|
|
146
|
-
```json
|
|
147
|
-
{"path": "agent-usage.json", "format": "agent_usage_v1"}
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
Missing `format` still means Codex JSONL, preserving 0.2.10 manifests.
|
|
151
|
-
`compareUsageRuns` is the general library function; `compareCodexRuns` remains an
|
|
152
|
-
alias. CLI `efficiency compare`, MCP `jev_compare_usage` and dashboard support
|
|
153
|
-
both sources. Codex-only comparisons retain schemaVersion 1; general comparisons
|
|
154
|
-
use schemaVersion 2 because primary counters and `agentTokenDelta` may be null.
|
|
155
|
-
Consumers must preserve unknown values. Do not sum repeated paired comparisons.
|
|
156
|
-
|
|
157
|
-
## Provider references
|
|
158
|
-
|
|
159
|
-
- [Anthropic cache accounting](https://platform.claude.com/docs/en/build-with-claude/prompt-caching)
|
|
160
|
-
- [Gemini UsageMetadata](https://ai.google.dev/api/generate-content#UsageMetadata)
|
|
161
|
-
- [Antigravity SDK usage](https://www.antigravity.google/docs/sdk/lifecycle/)
|
|
162
|
-
- [Cursor exported usage](https://cursor.com/docs/account/teams/admin-api)
|
|
163
|
-
- [VS Code model API](https://code.visualstudio.com/api/extension-guides/ai/language-model)
|
|
1
|
+
# Measured usage across harnesses (0.2.11)
|
|
2
|
+
|
|
3
|
+
Jev measures its own calls in every MCP/CLI integration. Main-agent consumption
|
|
4
|
+
requires usage reported by the agent/provider: MCP cannot observe private client
|
|
5
|
+
inference. This feature provides shared import, comparison and optional proxy
|
|
6
|
+
collection, not automatic access to every editor's internal sessions.
|
|
7
|
+
|
|
8
|
+
## Supported data routes
|
|
9
|
+
|
|
10
|
+
| Client | Implemented route | External setup required |
|
|
11
|
+
| --- | --- | --- |
|
|
12
|
+
| Codex | Existing local rollout discovery/import | Equivalent completed runs and validation receipts |
|
|
13
|
+
| Antigravity | Common SDK/export bridge; Gemini adapter; configurable endpoint proxy | SDK hook/export wiring; IDE history is not automatically read |
|
|
14
|
+
| Cursor | Exported `cursor-event` adapter; common bridge/proxy | API access, stable request IDs, conversation/task filtering and all pages; no undocumented CSV parser |
|
|
15
|
+
| TRAE | Common export bridge/provider proxy | Actual reported usage source or configurable BYOK endpoint; no private log parser |
|
|
16
|
+
| VS Code/extensions | Library/MCP/CLI bridge and provider proxy | Wire provider completion hook; text-only APIs cannot supply measured usage |
|
|
17
|
+
| Other CLIs | OpenAI Chat/Responses, Anthropic and Gemini adapters | Export each real request, including workers/retries; or configure endpoint |
|
|
18
|
+
|
|
19
|
+
Native editor smoke tests were not run. Tests cover exports, normalization,
|
|
20
|
+
CLI/MCP entry points and local HTTP JSON/SSE forwarding. Closed services without
|
|
21
|
+
exports/configurable endpoints remain unknown. Quota percentages, tokenizers and
|
|
22
|
+
nominal price tables are not converted into measured tokens or bills.
|
|
23
|
+
|
|
24
|
+
## Common export contract
|
|
25
|
+
|
|
26
|
+
Illustrative structure; numbers below are not measurements of your task:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"schemaVersion": 1, "kind": "agent_usage", "harness": "vscode-extension",
|
|
31
|
+
"sessionId": "independent-chat-id", "turnId": "task-interval-id",
|
|
32
|
+
"initialRevision": "exact-starting-commit", "model": "actual-model",
|
|
33
|
+
"effort": "actual-reasoning-configuration",
|
|
34
|
+
"startedAt": "2026-09-30T10:00:00Z", "endedAt": "2026-09-30T10:01:00Z",
|
|
35
|
+
"status": "completed", "coverage": "partial",
|
|
36
|
+
"includesJevUsage": false, "jevCallsObserved": true,
|
|
37
|
+
"events": [{
|
|
38
|
+
"requestId": "actual-provider-request-id", "provider": "actual-provider",
|
|
39
|
+
"format": "openai-responses",
|
|
40
|
+
"usage": { "input_tokens": 100, "output_tokens": 20, "total_tokens": 120 }
|
|
41
|
+
}]
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Record **one final usage per actual request**, never per stream chunk. Preserve
|
|
46
|
+
stable IDs on reimport. Convert cumulative session snapshots to interval
|
|
47
|
+
differences at the source, not sums. Record each retry with its own ID; attempts
|
|
48
|
+
with no usage must use `usage: null`. Split intervals using different models.
|
|
49
|
+
|
|
50
|
+
`coverage: complete` declares that all agent/worker/retry requests are included.
|
|
51
|
+
Partial coverage or missing totals blocks a task token difference. Reported
|
|
52
|
+
subtotals remain separately labeled. Missing cache, reasoning or cost stays null.
|
|
53
|
+
`includesJevUsage` must be false: Jev overhead is collected separately. Keep
|
|
54
|
+
harness, model, effort, initial commit, environment and validation equivalent.
|
|
55
|
+
|
|
56
|
+
Usage formats:
|
|
57
|
+
|
|
58
|
+
- `openai-chat` / `openai-responses`: the reported `usage` object; cache/reasoning
|
|
59
|
+
are subsets of primary input/output, never added again.
|
|
60
|
+
- `anthropic`: reported `usage`; total input adds uncached input, cache reads and
|
|
61
|
+
writes. Absent cache counters leave total input unknown.
|
|
62
|
+
- `gemini`: REST `usageMetadata` in camelCase. Total includes thinking;
|
|
63
|
+
contradictory totals or nonzero tool-use prompt counters require an explicit
|
|
64
|
+
normalized breakdown. Map SDK snake_case fields explicitly.
|
|
65
|
+
- `cursor-event`: one exported usage event; input adds uncached/read/write
|
|
66
|
+
counters. `chargedCents` is the reported USD charge; nominal `totalCents` and
|
|
67
|
+
request credits are not substituted. Missing token usage is unknown.
|
|
68
|
+
- `normalized`: `inputTokens`, `outputTokens`, `totalTokens`,
|
|
69
|
+
`cachedInputTokens`, `cacheWriteInputTokens`, `reasoningOutputTokens`.
|
|
70
|
+
Cache/reasoning are included in primary totals; fields may be null.
|
|
71
|
+
|
|
72
|
+
Optional `costUsd` must come from a reported charge. Cost coverage is returned as
|
|
73
|
+
costed/captured requests. A partial sum is not a full bill. Monetary comparisons
|
|
74
|
+
still require matching complete billing receipts, never prices inferred from tokens.
|
|
75
|
+
|
|
76
|
+
## Hooks and extensions
|
|
77
|
+
|
|
78
|
+
The package's existing public library exports `exportAgentUsage(path, run)`,
|
|
79
|
+
`importAgentUsage(path)` and `normalizeAgentUsage(format, usage)`:
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
import { exportAgentUsage } from "jev-dev-harness";
|
|
83
|
+
exportAgentUsage(outputPath, {
|
|
84
|
+
...completedTaskMetadata,
|
|
85
|
+
schemaVersion: 1, kind: "agent_usage", status: "completed",
|
|
86
|
+
includesJevUsage: false,
|
|
87
|
+
events: collectedResponses.map(response => ({
|
|
88
|
+
requestId: response.requestId, provider: response.provider,
|
|
89
|
+
format: "openai-responses", usage: response.usage ?? null,
|
|
90
|
+
})),
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The export allowlists metadata/counters, strips response text/prompts/unknown
|
|
95
|
+
fields, rejects duplicate requests and refuses overwrite. Python/shell hooks can
|
|
96
|
+
write the same contract and sanitize it using:
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
jev-dev efficiency import --input agent-usage.json --output sanitized-usage.json
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Antigravity SDK total-only observations can map reported
|
|
103
|
+
`response.usage_metadata.total_token_count` to normalized `totalTokens`; leave
|
|
104
|
+
unreported fields null. VS Code text-only responses must use `usage: null` unless
|
|
105
|
+
the provider reports usage separately. Counting text is not actual request usage.
|
|
106
|
+
|
|
107
|
+
MCP: `jev_import_usage({inputPath, format: "agent_usage_v1"})` reads only specified
|
|
108
|
+
files without inference/writes. Restart installed MCP servers to expose the tool.
|
|
109
|
+
|
|
110
|
+
## Optional automatic capture through the existing proxy
|
|
111
|
+
|
|
112
|
+
Only for clients with configurable API endpoints; it does not intercept closed
|
|
113
|
+
services/TLS. Use a metadata JSON with the common identity/coverage fields above
|
|
114
|
+
(omit events, timestamps, kind/status; the proxy supplies them):
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
jev-dev efficiency begin --run-id task-jev-001
|
|
118
|
+
jev-dev proxy generic --upstream https://your-provider.example \
|
|
119
|
+
--usage-metadata task-metadata.json --usage-output agent-usage.json \
|
|
120
|
+
--measurement-run-id task-jev-001
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Configure the client to use the proxy's localhost endpoint. The router's Jev calls
|
|
124
|
+
use this ledger; all other Jev tools must use the same measurement ID. Baselines
|
|
125
|
+
require `--no-routing` and `jevCallsObserved: false`. Routing-enabled captures
|
|
126
|
+
must declare Jev enabled. Metadata must not contain credentials.
|
|
127
|
+
|
|
128
|
+
Request model must match metadata (Gemini reads it from the models URL).
|
|
129
|
+
If the provider reports a different resolved model, the capture stays unknown;
|
|
130
|
+
use an exact model ID rather than an alias for controlled comparisons.
|
|
131
|
+
Stop gracefully with Ctrl+C/SIGTERM after all requests finish, then close the Jev ledger
|
|
132
|
+
with `efficiency finish`. A forced kill can lose in-memory observations; no
|
|
133
|
+
complete export is claimed. Empty captures are rejected. Capture one task at a time.
|
|
134
|
+
|
|
135
|
+
JSON/SSE responses are forwarded unchanged. Anthropic start/delta fields merge;
|
|
136
|
+
OpenAI/Gemini usage snapshots replace previous ones. Missing, invalid, oversized,
|
|
137
|
+
HTTP-error or failed response usage stays unknown. Only requests routed through
|
|
138
|
+
the proxy are observed; bypassed/hidden retries and external workers are outside
|
|
139
|
+
coverage. Multi-line SSE and unsupported protocols remain unknown. No request is
|
|
140
|
+
modified to force usage reporting: enable it in the client itself.
|
|
141
|
+
|
|
142
|
+
## Comparison compatibility
|
|
143
|
+
|
|
144
|
+
Use the existing [paired validation workflow](MEASURED-USAGE.md) with references:
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{"path": "agent-usage.json", "format": "agent_usage_v1"}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Missing `format` still means Codex JSONL, preserving 0.2.10 manifests.
|
|
151
|
+
`compareUsageRuns` is the general library function; `compareCodexRuns` remains an
|
|
152
|
+
alias. CLI `efficiency compare`, MCP `jev_compare_usage` and dashboard support
|
|
153
|
+
both sources. Codex-only comparisons retain schemaVersion 1; general comparisons
|
|
154
|
+
use schemaVersion 2 because primary counters and `agentTokenDelta` may be null.
|
|
155
|
+
Consumers must preserve unknown values. Do not sum repeated paired comparisons.
|
|
156
|
+
|
|
157
|
+
## Provider references
|
|
158
|
+
|
|
159
|
+
- [Anthropic cache accounting](https://platform.claude.com/docs/en/build-with-claude/prompt-caching)
|
|
160
|
+
- [Gemini UsageMetadata](https://ai.google.dev/api/generate-content#UsageMetadata)
|
|
161
|
+
- [Antigravity SDK usage](https://www.antigravity.google/docs/sdk/lifecycle/)
|
|
162
|
+
- [Cursor exported usage](https://cursor.com/docs/account/teams/admin-api)
|
|
163
|
+
- [VS Code model API](https://code.visualstudio.com/api/extension-guides/ai/language-model)
|
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
# Native Jev through OpenRouter
|
|
2
|
-
|
|
3
|
-
The OpenRouter adapter defaults to `typesafe/jev-1.13` and sends typed questions to
|
|
4
|
-
`POST https://openrouter.ai/api/v1/systemone`. It no longer automatically turns
|
|
5
|
-
a rejected Jev request into a chat completion. Explicitly configured chat models
|
|
6
|
-
are still supported and reported as `llm_emulation`.
|
|
7
|
-
|
|
8
|
-
## Configuration
|
|
9
|
-
|
|
10
|
-
Configure the key through your existing secret mechanism. Do not commit it.
|
|
11
|
-
|
|
12
|
-
```dotenv
|
|
13
|
-
JEV_PROVIDER=openrouter
|
|
14
|
-
OPENROUTER_MODEL=typesafe/jev-1.13
|
|
15
|
-
JEV_TIMEOUT_MS=2000
|
|
16
|
-
JEV_STAGE_C_TIMEOUT_MS=2000
|
|
17
|
-
JEV_CONCURRENCY=4
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Existing `OPENROUTER_MODEL` settings and saved OpenRouter models are preserved.
|
|
21
|
-
If your installation explicitly selected DeepSeek, change that model setting to
|
|
22
|
-
`typesafe/jev-1.13` to use native decisions. Provider status prints both the target
|
|
23
|
-
and decision mode. A custom `SafeJevClient.baseURL` uses the `/api` base, without
|
|
24
|
-
`/v1`; the adapter appends `/v1/systemone` or `/v1/chat/completions`.
|
|
25
|
-
|
|
26
|
-
Native TypeSafe and Vercel transports remain available. Pin a native TypeSafe
|
|
27
|
-
model with `TYPESAFE_DEFAULT_MODEL=jev-1.13.0` for reproducible comparisons.
|
|
28
|
-
|
|
29
|
-
## Failure and validation contract
|
|
30
|
-
|
|
31
|
-
- `noul` must be finite and within 0–1. Choice labels must belong to the submitted
|
|
32
|
-
options. Scores must be within the submitted rubric. All requested answers and
|
|
33
|
-
their matching type tags must be present.
|
|
34
|
-
- Choice/score confidence must be present and within 0–1. Missing confidence no
|
|
35
|
-
longer becomes `0.8`. Native probability distributions must include all allowed
|
|
36
|
-
labels, contain finite probabilities, and sum to one within rounding tolerance.
|
|
37
|
-
- Invalid responses are not cached. The context ranker uses its deterministic
|
|
38
|
-
heuristic for candidates whose request fails. No paid secondary model is
|
|
39
|
-
selected automatically.
|
|
40
|
-
- HTTP 400/401/402/403/404/413/422 are not retried. OpenRouter 429 and 5xx responses
|
|
41
|
-
get at most one retry, respecting `Retry-After` and the remaining time budget.
|
|
42
|
-
Network/JSON failures return fallback immediately.
|
|
43
|
-
- The client deadline covers retries and body parsing, with caller cancellation
|
|
44
|
-
propagated. Stage C additionally bounds the complete candidate evaluation,
|
|
45
|
-
including queue time. Its default is the client timeout, with at most four
|
|
46
|
-
in-flight calls. Queued work falls back when the deadline expires.
|
|
47
|
-
- Both OpenRouter paths disable provider fallback and request
|
|
48
|
-
`data_collection: "deny"`. This is not a claim of ZDR eligibility or a
|
|
49
|
-
replacement for application-specific data minimization. Existing redaction
|
|
50
|
-
covers known secret patterns, not all personal information.
|
|
51
|
-
|
|
52
|
-
## Cache and observability
|
|
53
|
-
|
|
54
|
-
Cache keys include provider, base URL, requested model, decision mode, question
|
|
55
|
-
contract and all candidate fields used in the request. Legacy cache entries are
|
|
56
|
-
not reused. Known floating aliases (`latest`, `preview`, `~` and the Vercel Jev
|
|
57
|
-
alias) bypass caching. When changing other aliases or downstream behavior,
|
|
58
|
-
disable/clear the cache for the comparison.
|
|
59
|
-
|
|
60
|
-
Ranked results distinguish `jev`, `llm_emulation`, and `deterministic_fallback`
|
|
61
|
-
and expose the returned model. Metrics and context telemetry retain actual model
|
|
62
|
-
IDs, LLM/native counts, tokens, fallback reasons, and reported cost. Cache hits do
|
|
63
|
-
not add billed tokens or cost again. `reportedCostUsd` sums only responses with
|
|
64
|
-
reported prices; `costedRequests` gives its coverage. An absent price is unknown,
|
|
65
|
-
not free. These metrics do not replace the provider's billing ledger, which can
|
|
66
|
-
include failed attempts, other requests, taxes and credit purchase fees.
|
|
67
|
-
|
|
68
|
-
LLM confidence is self-reported and must not be treated as calibrated Jev
|
|
69
|
-
probability. Native confidence itself also needs task-specific evaluation before
|
|
70
|
-
it is used to authorize actions. The ranker's composite is a relevance heuristic,
|
|
71
|
-
not a probability of correctness.
|
|
72
|
-
|
|
73
|
-
## Evaluation before rollout
|
|
74
|
-
|
|
75
|
-
1. In an isolated checkout, collect 30–50 real tasks and their required files.
|
|
76
|
-
2. Run deterministic-only, pinned native TypeSafe and pinned OpenRouter Jev
|
|
77
|
-
against the same snapshot. Disable cache for cold measurements and report
|
|
78
|
-
warm measurements separately. Keep the same candidate shortlist and budget.
|
|
79
|
-
3. Compare recall@K, downstream task success, input tokens, p50/p95 latency,
|
|
80
|
-
fallback rate and actual cost. Separate partial fallback and LLM emulation.
|
|
81
|
-
4. Inspect missed files before changing thresholds. Synthetic repository tests
|
|
82
|
-
verify mechanics; they do not establish production accuracy or advertised
|
|
83
|
-
latency. Live calls require separately supplied credentials and cost money.
|
|
84
|
-
|
|
85
|
-
The Finainteli classification experiment remains a separate change: backend-only,
|
|
86
|
-
shadow mode, reviewed anonymized transactions and a fixed permitted category set.
|
|
87
|
-
No Finainteli deployment, npm release or live paid benchmark is part of this PR.
|
|
88
|
-
|
|
89
|
-
References checked for the September 29 announcement:
|
|
90
|
-
- https://openrouter.ai/docs/api/api-reference/systemone/submit-a-system-one-request
|
|
91
|
-
- https://openrouter.ai/docs/guides/community/typesafe-sdk
|
|
92
|
-
- https://docs.typesafe.ai/confidence
|
|
93
|
-
- https://docs.typesafe.ai/model-jaggedness/jev-1.13
|
|
1
|
+
# Native Jev through OpenRouter
|
|
2
|
+
|
|
3
|
+
The OpenRouter adapter defaults to `typesafe/jev-1.13` and sends typed questions to
|
|
4
|
+
`POST https://openrouter.ai/api/v1/systemone`. It no longer automatically turns
|
|
5
|
+
a rejected Jev request into a chat completion. Explicitly configured chat models
|
|
6
|
+
are still supported and reported as `llm_emulation`.
|
|
7
|
+
|
|
8
|
+
## Configuration
|
|
9
|
+
|
|
10
|
+
Configure the key through your existing secret mechanism. Do not commit it.
|
|
11
|
+
|
|
12
|
+
```dotenv
|
|
13
|
+
JEV_PROVIDER=openrouter
|
|
14
|
+
OPENROUTER_MODEL=typesafe/jev-1.13
|
|
15
|
+
JEV_TIMEOUT_MS=2000
|
|
16
|
+
JEV_STAGE_C_TIMEOUT_MS=2000
|
|
17
|
+
JEV_CONCURRENCY=4
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Existing `OPENROUTER_MODEL` settings and saved OpenRouter models are preserved.
|
|
21
|
+
If your installation explicitly selected DeepSeek, change that model setting to
|
|
22
|
+
`typesafe/jev-1.13` to use native decisions. Provider status prints both the target
|
|
23
|
+
and decision mode. A custom `SafeJevClient.baseURL` uses the `/api` base, without
|
|
24
|
+
`/v1`; the adapter appends `/v1/systemone` or `/v1/chat/completions`.
|
|
25
|
+
|
|
26
|
+
Native TypeSafe and Vercel transports remain available. Pin a native TypeSafe
|
|
27
|
+
model with `TYPESAFE_DEFAULT_MODEL=jev-1.13.0` for reproducible comparisons.
|
|
28
|
+
|
|
29
|
+
## Failure and validation contract
|
|
30
|
+
|
|
31
|
+
- `noul` must be finite and within 0–1. Choice labels must belong to the submitted
|
|
32
|
+
options. Scores must be within the submitted rubric. All requested answers and
|
|
33
|
+
their matching type tags must be present.
|
|
34
|
+
- Choice/score confidence must be present and within 0–1. Missing confidence no
|
|
35
|
+
longer becomes `0.8`. Native probability distributions must include all allowed
|
|
36
|
+
labels, contain finite probabilities, and sum to one within rounding tolerance.
|
|
37
|
+
- Invalid responses are not cached. The context ranker uses its deterministic
|
|
38
|
+
heuristic for candidates whose request fails. No paid secondary model is
|
|
39
|
+
selected automatically.
|
|
40
|
+
- HTTP 400/401/402/403/404/413/422 are not retried. OpenRouter 429 and 5xx responses
|
|
41
|
+
get at most one retry, respecting `Retry-After` and the remaining time budget.
|
|
42
|
+
Network/JSON failures return fallback immediately.
|
|
43
|
+
- The client deadline covers retries and body parsing, with caller cancellation
|
|
44
|
+
propagated. Stage C additionally bounds the complete candidate evaluation,
|
|
45
|
+
including queue time. Its default is the client timeout, with at most four
|
|
46
|
+
in-flight calls. Queued work falls back when the deadline expires.
|
|
47
|
+
- Both OpenRouter paths disable provider fallback and request
|
|
48
|
+
`data_collection: "deny"`. This is not a claim of ZDR eligibility or a
|
|
49
|
+
replacement for application-specific data minimization. Existing redaction
|
|
50
|
+
covers known secret patterns, not all personal information.
|
|
51
|
+
|
|
52
|
+
## Cache and observability
|
|
53
|
+
|
|
54
|
+
Cache keys include provider, base URL, requested model, decision mode, question
|
|
55
|
+
contract and all candidate fields used in the request. Legacy cache entries are
|
|
56
|
+
not reused. Known floating aliases (`latest`, `preview`, `~` and the Vercel Jev
|
|
57
|
+
alias) bypass caching. When changing other aliases or downstream behavior,
|
|
58
|
+
disable/clear the cache for the comparison.
|
|
59
|
+
|
|
60
|
+
Ranked results distinguish `jev`, `llm_emulation`, and `deterministic_fallback`
|
|
61
|
+
and expose the returned model. Metrics and context telemetry retain actual model
|
|
62
|
+
IDs, LLM/native counts, tokens, fallback reasons, and reported cost. Cache hits do
|
|
63
|
+
not add billed tokens or cost again. `reportedCostUsd` sums only responses with
|
|
64
|
+
reported prices; `costedRequests` gives its coverage. An absent price is unknown,
|
|
65
|
+
not free. These metrics do not replace the provider's billing ledger, which can
|
|
66
|
+
include failed attempts, other requests, taxes and credit purchase fees.
|
|
67
|
+
|
|
68
|
+
LLM confidence is self-reported and must not be treated as calibrated Jev
|
|
69
|
+
probability. Native confidence itself also needs task-specific evaluation before
|
|
70
|
+
it is used to authorize actions. The ranker's composite is a relevance heuristic,
|
|
71
|
+
not a probability of correctness.
|
|
72
|
+
|
|
73
|
+
## Evaluation before rollout
|
|
74
|
+
|
|
75
|
+
1. In an isolated checkout, collect 30–50 real tasks and their required files.
|
|
76
|
+
2. Run deterministic-only, pinned native TypeSafe and pinned OpenRouter Jev
|
|
77
|
+
against the same snapshot. Disable cache for cold measurements and report
|
|
78
|
+
warm measurements separately. Keep the same candidate shortlist and budget.
|
|
79
|
+
3. Compare recall@K, downstream task success, input tokens, p50/p95 latency,
|
|
80
|
+
fallback rate and actual cost. Separate partial fallback and LLM emulation.
|
|
81
|
+
4. Inspect missed files before changing thresholds. Synthetic repository tests
|
|
82
|
+
verify mechanics; they do not establish production accuracy or advertised
|
|
83
|
+
latency. Live calls require separately supplied credentials and cost money.
|
|
84
|
+
|
|
85
|
+
The Finainteli classification experiment remains a separate change: backend-only,
|
|
86
|
+
shadow mode, reviewed anonymized transactions and a fixed permitted category set.
|
|
87
|
+
No Finainteli deployment, npm release or live paid benchmark is part of this PR.
|
|
88
|
+
|
|
89
|
+
References checked for the September 29 announcement:
|
|
90
|
+
- https://openrouter.ai/docs/api/api-reference/systemone/submit-a-system-one-request
|
|
91
|
+
- https://openrouter.ai/docs/guides/community/typesafe-sdk
|
|
92
|
+
- https://docs.typesafe.ai/confidence
|
|
93
|
+
- https://docs.typesafe.ai/model-jaggedness/jev-1.13
|