jev-layer 0.1.0

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.
Files changed (66) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/CONTRIBUTING.md +146 -0
  3. package/LICENSE +21 -0
  4. package/README.md +126 -0
  5. package/README.ru.md +117 -0
  6. package/README.zh-CN.md +117 -0
  7. package/RELEASE.md +53 -0
  8. package/SECURITY.md +56 -0
  9. package/bin/jev.mjs +214 -0
  10. package/config/codex.mcp.toml +8 -0
  11. package/config/generic-mcp.json +13 -0
  12. package/config/hermes.mcp.yaml +9 -0
  13. package/config/jev.example.json +22 -0
  14. package/config/omp.mcp.json +14 -0
  15. package/config/providers.env.example +13 -0
  16. package/docs/COMPATIBILITY.md +15 -0
  17. package/docs/SCHEMA-VERSIONING.md +94 -0
  18. package/examples/capabilities.json +39 -0
  19. package/examples/route-request.json +28 -0
  20. package/integrations/codex/.codex-plugin/plugin.json +19 -0
  21. package/integrations/codex/.mcp.json +11 -0
  22. package/integrations/codex/AGENTS.md +1 -0
  23. package/integrations/codex/run-mcp.mjs +9 -0
  24. package/integrations/codex/skills/jev-route/SKILL.md +17 -0
  25. package/integrations/hermes/__init__.py +51 -0
  26. package/integrations/hermes/plugin.yaml +5 -0
  27. package/integrations/hermes/schemas.py +12 -0
  28. package/integrations/omp/extension.js +105 -0
  29. package/integrations/template/README.md +10 -0
  30. package/integrations/template/adapter.mjs +87 -0
  31. package/package.json +59 -0
  32. package/scripts/benchmark.mjs +35 -0
  33. package/scripts/browser-benchmark.mjs +92 -0
  34. package/scripts/browser-e2e.mjs +117 -0
  35. package/scripts/capability-e2e.mjs +31 -0
  36. package/scripts/clean-install-smoke.mjs +162 -0
  37. package/scripts/codex-mcp-smoke.mjs +119 -0
  38. package/scripts/context-filter-e2e.mjs +45 -0
  39. package/scripts/fail-open-smoke.mjs +120 -0
  40. package/scripts/feature-flags-smoke.mjs +46 -0
  41. package/scripts/mcp-receipt-smoke.mjs +98 -0
  42. package/scripts/openrouter-choice.mjs +59 -0
  43. package/scripts/replay-eval.mjs +124 -0
  44. package/scripts/smoke.mjs +34 -0
  45. package/scripts/supervision-e2e.mjs +109 -0
  46. package/src/browser.mjs +569 -0
  47. package/src/cli.mjs +33 -0
  48. package/src/config.mjs +75 -0
  49. package/src/context-filter.mjs +56 -0
  50. package/src/contract.mjs +72 -0
  51. package/src/discovery.mjs +65 -0
  52. package/src/mcp-server.mjs +210 -0
  53. package/src/providers/demo.mjs +52 -0
  54. package/src/providers/typesafe.mjs +126 -0
  55. package/src/receipts.mjs +226 -0
  56. package/src/registry.mjs +109 -0
  57. package/src/relevance-filter.mjs +99 -0
  58. package/src/route.mjs +221 -0
  59. package/src/supervision.mjs +244 -0
  60. package/test/browser.test.mjs +199 -0
  61. package/test/capability.test.mjs +54 -0
  62. package/test/context-filter.test.mjs +65 -0
  63. package/test/openrouter-provider.test.mjs +55 -0
  64. package/test/receipts.test.mjs +71 -0
  65. package/test/route.test.mjs +74 -0
  66. package/test/supervision.test.mjs +99 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,34 @@
1
+ # Changelog
2
+
3
+ All notable changes to jev-layer are recorded here. Entries describe public behavior and compatibility impact; provider-specific experiments are listed only when they affect a public contract.
4
+
5
+ ## [0.1.0]
6
+
7
+ First public-release candidate. This version is prepared but has not been pushed, released on GitHub, or published to npm.
8
+
9
+ ### Added
10
+
11
+ - Portable CLI and stdio MCP routing layer for Hermes, OMP, Codex, and generic MCP-compatible agents.
12
+ - Closed-set capability routing through `jev_route` with deterministic host-side policy checks.
13
+ - `jev_record_execution` and append-only JSONL routing/execution receipts joined by `correlation_id`.
14
+ - Offline replay/evaluation without host execution calls.
15
+ - Opt-in supervision judgments with deterministic host policy.
16
+ - Opt-in deterministic context filtering (`shadow` and `conservative`).
17
+ - Explicit capability discovery for skills, MCP, CLI, DSH, tools, subagents, and models.
18
+ - Experimental, opt-in browser fast-path over host-supplied observations.
19
+ - MIT license, security policy, schema/version policy, contribution guide, adapter template, CI, and multilingual README documentation.
20
+
21
+ ### Compatibility
22
+
23
+ - Node.js `>=20`.
24
+ - Public request, decision, MCP tool, receipt, replay, and adapter contracts remain schema version 1.
25
+ - Release-preparation baseline: OMP `18.2.6`, Hermes `0.21.3` (`b675e6de`), and Codex CLI `0.155.1` observed in the preparation environment. See [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md).
26
+ - Browser reliability is validated against the current real-browser fixtures; browser performance optimization remains experimental.
27
+
28
+ ### Release constraints
29
+
30
+ - Host harnesses retain ownership of permissions, approvals, native execution, retries, recovery, and final results.
31
+ - Provider-backed tests require explicit secret-managed environments and are not required for ordinary PR CI.
32
+ - No npm publication, GitHub release, or remote push is part of this preparation.
33
+
34
+ Proposed repository: https://github.com/typakon4/jev-layer. GitHub release and comparison links become active after repository creation.
@@ -0,0 +1,146 @@
1
+ # Contributing to jev-layer
2
+
3
+ [English](README.md) | [Русский](README.ru.md) | [简体中文](README.zh-CN.md)
4
+
5
+ jev-layer is a portable System-1 decision layer. Contributions must preserve the rule that the host owns execution, permissions, approvals, retries, recovery, and final results. Jev returns bounded decisions; it does not become a security boundary or a second executor.
6
+
7
+ ## Before opening a pull request
8
+
9
+ 1. Read `SECURITY.md` and `docs/SCHEMA-VERSIONING.md`.
10
+ 2. Keep the change narrow. Do not add runtime features while changing an adapter or documentation.
11
+ 3. Add deterministic tests and an offline fixture. Provider-backed tests are optional and must not require secrets in ordinary CI.
12
+ 4. Do not commit API keys, tokens, private keys, `.env` files, machine-specific paths, home directories, or local installation state.
13
+ 5. Preserve existing schema v1 fields and fail-open behavior unless a versioned migration is part of the change.
14
+
15
+ ## Adapter contract (version 1)
16
+
17
+ A harness adapter is a thin integration. It may use the CLI or stdio MCP, but it must preserve the following sequence:
18
+
19
+ | Stage | Required behavior |
20
+ | --- | --- |
21
+ | Capability discovery/input | Build a closed `capabilities[]` set from the host's known capabilities. Include stable `id`, `kind`, `name`, `description`, `permissions`, `risk`, and availability metadata where known. Do not ask Jev to discover or execute hidden host tools. |
22
+ | `jev_route` call | Send `schema_version: 1`, `harness`, `intent`, bounded `context`, `actor_permissions`, `capabilities`, and `policy` to `jev_route`. Preserve the returned `correlation_id` and selected capability id. |
23
+ | Host execution | Resolve the selected id through the harness's native registry. The adapter must not shell out to arbitrary ids, grant permissions, or replace native tool execution. |
24
+ | `jev_record_execution` receipt | After the host decides what happened, call `jev_record_execution` with the same `correlation_id`, `status` (`completed`, `failed`, or `not_started`), `capability_id`, bounded result/error, and optional exit/timing metadata. |
25
+ | Fail-open | If Jev is disabled, unavailable, times out, returns an error, or returns no usable selection, continue through the harness's normal native path. Never guess a capability or treat a Jev failure as permission to execute. |
26
+ | Approval semantics | The host remains the approval authority. Consequential actions require the host's normal approval before execution. A denial records `not_started`; Jev cannot approve, elevate, retry, or override the host. |
27
+
28
+ `jev_browser_step` follows the same ownership rule: the host supplies a structured observation, the host approves consequential browser actions, and the host executes or hands control back. It is experimental and opt-in.
29
+
30
+ ### Minimal adapter pseudocode
31
+
32
+ ```text
33
+ request = {
34
+ schema_version: 1,
35
+ harness: "my-harness",
36
+ intent: host_goal,
37
+ context: bounded_host_context,
38
+ actor_permissions: host_permissions,
39
+ capabilities: host_capabilities,
40
+ policy: host_policy
41
+ }
42
+
43
+ decision = call_jev_route(request)
44
+
45
+ if decision.status != "selected" or decision.selected is null:
46
+ return native_host_path(request)
47
+
48
+ if consequential(decision.selected) and not host_approval(decision.selected):
49
+ call_jev_record_execution({
50
+ correlation_id: decision.correlation_id,
51
+ capability_id: decision.selected,
52
+ status: "not_started",
53
+ error: "host approval denied"
54
+ })
55
+ return native_host_path(request)
56
+
57
+ try:
58
+ host_result = execute_native(decision.selected)
59
+ status = "completed"
60
+ except error:
61
+ host_result = null
62
+ status = "failed"
63
+
64
+ receipt = call_jev_record_execution({
65
+ correlation_id: decision.correlation_id,
66
+ capability_id: decision.selected,
67
+ status,
68
+ result: bounded(host_result),
69
+ error: bounded(error),
70
+ duration_ms: measured_duration
71
+ })
72
+ return { decision, host_result, receipt }
73
+ ```
74
+
75
+ Copy `integrations/template/adapter.mjs` for a small JavaScript starting point with the same injected boundaries.
76
+
77
+ ## Adding a new harness
78
+
79
+ The shortest supported PR path is:
80
+
81
+ 1. Add `integrations/<harness>/` with a thin adapter that calls the existing CLI or MCP contract.
82
+ 2. Add a secret-free config/example snippet under `config/` or the integration directory.
83
+ 3. Add an offline smoke fixture proving route, fail-open, approval denial, host execution, and execution receipt behavior.
84
+ 4. Register compatibility in `README.md`, the translated READMEs, `docs/SCHEMA-VERSIONING.md`, and `RELEASE.md` when the harness is supported.
85
+ 5. Run the required CI commands and submit the PR.
86
+
87
+ Do not add a harness-specific routing implementation. Keep configuration user-owned; never overwrite global harness settings.
88
+
89
+ ## Adding a provider
90
+
91
+ Providers implement the existing provider surface in `src/providers/`: a `name` and an async `decide({ state, candidates })` method. Supervision-capable providers may also implement `evaluate({ state, questions })`. Return the normalized provider response expected by `src/route.mjs`; do not execute capabilities in the provider.
92
+
93
+ - Add the provider to explicit configuration/selection only when it is usable offline or clearly fails open.
94
+ - Add deterministic unit tests using injected responses or the `demo` provider.
95
+ - Keep API keys and endpoints in environment variables or user-owned configuration.
96
+ - Provider-backed tests belong in secret-managed CI, not ordinary pull-request CI.
97
+
98
+ ## Adding a discovery source
99
+
100
+ Use `discoverCapabilities()` and the normalized capability shape in `src/discovery.mjs`. A new source must:
101
+
102
+ - produce stable, namespaced ids;
103
+ - preserve `kind`, `name`, `description`, `source`, `verified`, and availability metadata;
104
+ - deduplicate by id deterministically;
105
+ - read only explicit input or an explicitly supplied manifest path;
106
+ - never scan undocumented global locations or execute discovered entries.
107
+
108
+ Add a fixture covering empty input, malformed entries, duplicate ids, unavailable entries, and the new source's normalized output.
109
+
110
+ ## Adding a browser executor
111
+
112
+ Browser executors are host-owned and optional. Implement `observe()` plus `execute(action)`, and implement `select(action)` when the host has a native select mechanism. The observation must be bounded and structured; the executor must validate target ids, preserve host approval, return the next observation, and report failures without retrying implicitly. Do not add screenshots, text entry, browser workers, or permission logic to jev-layer as part of an executor contribution.
113
+
114
+ ## Adding an eval or replay fixture
115
+
116
+ Add a small JSONL or JSON fixture under `examples/` or a test fixture directory. Include a stable `schema_version`, `harness`, bounded capabilities, and deterministic expected selection/fallback behavior. For receipts, use one `correlation_id` for the routing case and execution receipt. Exercise it with:
117
+
118
+ ```sh
119
+ npm run replay:evaluate -- --provider demo --limit 20
120
+ npm test
121
+ ```
122
+
123
+ A fixture must not call a real provider, host command, network service, or browser. If a real-provider scenario is useful, document it separately and gate it on an explicitly supplied secret.
124
+
125
+ ## Required checks
126
+
127
+ From a clean checkout:
128
+
129
+ ```sh
130
+ npm install
131
+ npm test
132
+ npm run smoke
133
+ npm run fail-open-smoke
134
+ npm run clean-install-smoke
135
+ npm pack --dry-run
136
+ ```
137
+
138
+ Changes touching browser, supervision, context filtering, discovery, or MCP should also run the matching existing E2E/smoke script. CI does not require provider credentials.
139
+
140
+ ## Backward compatibility
141
+
142
+ - Keep schema v1 request, decision, receipt, and replay fields readable.
143
+ - Prefer additive optional fields. Do not rename or remove existing fields in a patch release.
144
+ - Preserve `correlation_id` across route and execution records.
145
+ - Preserve fail-open behavior and host approval ownership.
146
+ - If a breaking contract is unavoidable, document a new schema/adapter version and migration before changing the implementation.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 jev-layer contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,126 @@
1
+ # jev-layer
2
+
3
+ [English](README.md) | [Русский](README.ru.md) | [简体中文](README.zh-CN.md)
4
+
5
+ Portable **System-1 decision layer for agent harnesses**. jev-layer routes bounded choices and records evidence; the host keeps execution, permissions, approvals, retries, recovery, and final results.
6
+
7
+ Supported integration examples: **Hermes, OMP, Codex, and generic MCP-compatible agents**.
8
+
9
+ ## Architecture
10
+
11
+ ```text
12
+ +----------------------+ bounded request +----------------------+
13
+ | Agent harness | --------------------------> | jev-layer |
14
+ | Hermes / OMP / | | route / supervise / |
15
+ | Codex / generic MCP | <-------------------------- | context filter |
16
+ +----------+-----------+ decision + id +----------+-----------+
17
+ | |
18
+ | host validates permissions/approval |
19
+ v v
20
+ +----------+-----------+ execution result +----------+-----------+
21
+ | Native host executor | --------------------------> | receipts + replay |
22
+ | owns all side effects| jev_record_execution | JSONL, correlation_id|
23
+ +----------------------+ +----------------------+
24
+ ```
25
+
26
+ Jev never executes a selected capability. A provider can be deterministic `demo`, OpenRouter Decisions, or TypeSafe; provider-backed tests are not required for normal CI.
27
+
28
+ ## Quick Start
29
+
30
+ Requirements: Node.js 20 or newer. There are no mandatory runtime dependencies.
31
+
32
+ ```sh
33
+ npm install
34
+ npm link
35
+ jev install --project /path/to/workspace
36
+ jev add generic --project /path/to/workspace
37
+ jev doctor --project /path/to/workspace
38
+ ```
39
+
40
+ `npm link` is local only. It does not publish the package. Use `node /path/to/jev-layer/bin/jev.mjs ...` instead if a global link is not wanted. The default `demo` provider is offline and deterministic.
41
+
42
+ To call the stdio MCP server directly:
43
+
44
+ ```sh
45
+ jev mcp
46
+ ```
47
+
48
+ To use a provider with credentials, keep keys outside the repository:
49
+
50
+ ```sh
51
+ export JEV_LAYER_PROVIDER=openrouter
52
+ export OPENROUTER_API_KEY='provided-by-your-secret-store'
53
+ jev doctor --project /path/to/workspace
54
+ ```
55
+
56
+ ## Core surfaces
57
+
58
+ - **Routing:** `jev_route` selects one capability from the host-supplied candidate set. Selection is advisory; the host validates the id and permissions.
59
+ - **Receipts/replay:** `jev_record_execution` joins the host result to the original `correlation_id`. JSONL cases live in `.jev/replay/cases.jsonl` and can be evaluated offline with `npm run replay:evaluate`.
60
+ - **Supervision:** `jev_supervise` returns bounded work-state judgments; deterministic host policy maps them to `continue`, `verify`, `retry`, `finish`, or `escalate`. Jev does not perform those actions.
61
+ - **Context filtering:** optional deterministic `shadow` or `conservative` filtering reduces stale context without LLM summarization.
62
+ - **Experimental browser fast-path:** `jev_browser_step` chooses one bounded action from a host observation. The host supplies observations, approval, native execution, and recovery. It is opt-in and does not start a browser worker.
63
+ - **Fail-open:** disabled, unavailable, invalid, or inconclusive Jev calls return control to the host's normal path. Jev never widens permissions or guesses execution.
64
+
65
+ All optional surfaces are disabled by default:
66
+
67
+ ```sh
68
+ JEV_BROWSER_FAST_PATH=1 jev mcp
69
+ JEV_SUPERVISION=1 jev mcp
70
+ JEV_CONTEXT_FILTER=shadow jev cli --input examples/route-request.json
71
+ ```
72
+
73
+ ## Harness adapters
74
+
75
+ Current examples live under `integrations/`:
76
+
77
+ - `integrations/hermes/`
78
+ - `integrations/omp/`
79
+ - `integrations/codex/`
80
+ - `integrations/template/`
81
+
82
+ The release baseline records OMP `18.2.6`, Hermes `0.21.3` (`b675e6de`), and Codex CLI `0.155.1` observed in the preparation environment. This is a version/contract baseline, not a claim of full provider/model coverage; see [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md).
83
+
84
+ Adapters are intentionally thin. They may call the CLI or stdio MCP, but the host must retain native capability lookup, permissions, approvals, execution, retries, recovery, and final output.
85
+
86
+ ### Adding a new harness
87
+
88
+ The shortest PR path is:
89
+
90
+ 1. copy `integrations/template/adapter.mjs`;
91
+ 2. add `integrations/<harness>/` and a secret-free config/example;
92
+ 3. call `jev_route`, preserve `correlation_id`, execute only through the host registry, then call `jev_record_execution`;
93
+ 4. add an offline smoke fixture for success, fail-open, approval denial, and execution receipt;
94
+ 5. document supported versions and run CI.
95
+
96
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for the adapter contract and [docs/SCHEMA-VERSIONING.md](docs/SCHEMA-VERSIONING.md) for compatibility rules.
97
+
98
+ ## Browser status
99
+
100
+ Browser fast-path **reliability is validated against the current real-browser fixtures**, including action sequencing, visible-link navigation, native select execution, approval denial, and recovery. **Performance optimization remains experimental**. No browser speedup claim is made.
101
+
102
+ ## Security and compatibility
103
+
104
+ - MIT licensed; see [LICENSE](LICENSE).
105
+ - jev-layer is not a security boundary. Host permissions and approvals are authoritative; see [SECURITY.md](SECURITY.md).
106
+ - Schema, MCP tool, receipt, replay, and adapter contracts are currently version 1. Prefer additive changes; do not break v1 silently.
107
+ - Do not commit credentials, logs containing secrets, `.env` files, or machine-specific paths.
108
+
109
+ ## Verification
110
+
111
+ ```sh
112
+ npm test
113
+ npm run smoke
114
+ npm run fail-open-smoke
115
+ npm run clean-install-smoke
116
+ npm pack --dry-run
117
+ ```
118
+
119
+ The GitHub Actions matrix runs these checks on Node.js 20, 22, and 24. Provider-backed tests require an explicitly configured secret-managed environment and are not part of ordinary PR CI.
120
+
121
+ ## Release documents
122
+
123
+ - [CONTRIBUTING.md](CONTRIBUTING.md)
124
+ - [SECURITY.md](SECURITY.md)
125
+ - [RELEASE.md](RELEASE.md)
126
+ - [CHANGELOG.md](CHANGELOG.md)
package/README.ru.md ADDED
@@ -0,0 +1,117 @@
1
+ # jev-layer
2
+
3
+ [English](README.md) | [Русский](README.ru.md) | [简体中文](README.zh-CN.md)
4
+
5
+ Портируемый **System-1 слой принятия решений для agent harnesses**. jev-layer маршрутизирует ограниченные решения и сохраняет доказательства; harness сохраняет владение исполнением, разрешениями, подтверждениями, retry, восстановлением и итоговым результатом.
6
+
7
+ Поддерживаются примеры интеграций **Hermes, OMP, Codex и generic MCP-compatible agents**.
8
+
9
+ ## Архитектура
10
+
11
+ ```text
12
+ +----------------------+ ограниченный запрос +----------------------+
13
+ | Agent harness | --------------------------> | jev-layer |
14
+ | Hermes / OMP / | | route / supervise / |
15
+ | Codex / generic MCP | <-------------------------- | context filter |
16
+ +----------+-----------+ решение + id +----------+-----------+
17
+ | |
18
+ | host проверяет permissions/approval |
19
+ v v
20
+ +----------+-----------+ результат исполнения +----------+-----------+
21
+ | Native host executor | --------------------------> | receipts + replay |
22
+ | владеет side effects | jev_record_execution | JSONL, correlation_id|
23
+ +----------------------+ +----------------------+
24
+ ```
25
+
26
+ Jev не исполняет выбранную capability. Доступны детерминированный `demo`, OpenRouter Decisions и TypeSafe; тесты с provider credentials не требуются для обычного CI.
27
+
28
+ ## Быстрый старт
29
+
30
+ Требуется Node.js 20 или новее. Обязательных runtime-зависимостей нет.
31
+
32
+ ```sh
33
+ npm install
34
+ npm link
35
+ jev install --project /path/to/workspace
36
+ jev add generic --project /path/to/workspace
37
+ jev doctor --project /path/to/workspace
38
+ ```
39
+
40
+ `npm link` используется только локально и ничего не публикует. Вместо него можно запускать `node /path/to/jev-layer/bin/jev.mjs ...`. Provider по умолчанию — офлайн-детерминированный `demo`.
41
+
42
+ Для stdio MCP:
43
+
44
+ ```sh
45
+ jev mcp
46
+ ```
47
+
48
+ Секреты должны находиться вне репозитория:
49
+
50
+ ```sh
51
+ export JEV_LAYER_PROVIDER=openrouter
52
+ export OPENROUTER_API_KEY='provided-by-your-secret-store'
53
+ jev doctor --project /path/to/workspace
54
+ ```
55
+
56
+ ## Основные поверхности
57
+
58
+ - **Routing:** `jev_route` выбирает одну capability из набора, предоставленного host. Host повторно проверяет id и permissions.
59
+ - **Receipts/replay:** `jev_record_execution` связывает результат host с исходным `correlation_id`. JSONL-файлы находятся в `.jev/replay/cases.jsonl` и проверяются офлайн через `npm run replay:evaluate`.
60
+ - **Supervision:** `jev_supervise` возвращает ограниченные judgments о состоянии работы; детерминированная host policy преобразует их в `continue`, `verify`, `retry`, `finish` или `escalate`. Jev эти действия не выполняет.
61
+ - **Context filtering:** опциональная детерминированная фильтрация `shadow` или `conservative` убирает устаревший context без LLM-суммаризации.
62
+ - **Experimental browser fast-path:** `jev_browser_step` выбирает одно ограниченное действие из observation host. Host предоставляет observation, approval, native execution и recovery.
63
+ - **Fail-open:** при отключённом, недоступном, ошибочном или неубедительном Jev вызове управление возвращается в обычный host path. Jev не расширяет permissions и не угадывает execution.
64
+
65
+ Опциональные поверхности по умолчанию отключены:
66
+
67
+ ```sh
68
+ JEV_BROWSER_FAST_PATH=1 jev mcp
69
+ JEV_SUPERVISION=1 jev mcp
70
+ JEV_CONTEXT_FILTER=shadow jev cli --input examples/route-request.json
71
+ ```
72
+
73
+ ## Harness adapters
74
+
75
+ Примеры находятся в `integrations/`:
76
+
77
+ - `integrations/hermes/`
78
+ - `integrations/omp/`
79
+ - `integrations/codex/`
80
+ - `integrations/template/`
81
+
82
+ Для release baseline зафиксированы версии OMP `18.2.6`, Hermes `0.21.3` (`b675e6de`) и Codex CLI `0.155.1`, наблюдавшиеся в среде подготовки. Это базовая проверка версий и контрактов, а не полный набор provider/model tests; подробности — в [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md).
83
+
84
+ ### Добавление нового harness
85
+
86
+ 1. Скопируйте `integrations/template/adapter.mjs`.
87
+ 2. Добавьте `integrations/<harness>/` и secret-free config/example.
88
+ 3. Вызовите `jev_route`, сохраните `correlation_id`, исполняйте только через native registry host, затем вызовите `jev_record_execution`.
89
+ 4. Добавьте offline smoke fixture для успеха, fail-open, отказа в approval и execution receipt.
90
+ 5. Зафиксируйте поддерживаемые версии и пройдите CI.
91
+
92
+ Подробности: [CONTRIBUTING.md](CONTRIBUTING.md), [docs/SCHEMA-VERSIONING.md](docs/SCHEMA-VERSIONING.md).
93
+
94
+ ## Статус browser
95
+
96
+ Надёжность browser fast-path **проверена на текущих real-browser fixtures**: sequencing, visible-link navigation, native select, approval denial и recovery. **Оптимизация производительности остаётся экспериментальной**. Заявлений об ускорении браузера нет.
97
+
98
+ ## Безопасность и совместимость
99
+
100
+ - Лицензия MIT: [LICENSE](LICENSE).
101
+ - jev-layer не является security boundary. Источник истины для permissions и approvals — host: [SECURITY.md](SECURITY.md).
102
+ - MCP tools, routing decisions, receipts, replay cases и adapter contract сейчас имеют version 1. Изменения должны быть additive и не ломать v1 молча.
103
+ - Не коммитьте credentials, секретные logs, `.env` или machine-specific paths.
104
+
105
+ ## Проверка
106
+
107
+ ```sh
108
+ npm test
109
+ npm run smoke
110
+ npm run fail-open-smoke
111
+ npm run clean-install-smoke
112
+ npm pack --dry-run
113
+ ```
114
+
115
+ GitHub Actions запускает эти проверки на Node.js 20, 22 и 24. Provider-backed тесты требуют отдельного secret-managed окружения и не входят в обычный PR CI.
116
+
117
+ Документы: [CONTRIBUTING.md](CONTRIBUTING.md) · [SECURITY.md](SECURITY.md) · [RELEASE.md](RELEASE.md) · [CHANGELOG.md](CHANGELOG.md).
@@ -0,0 +1,117 @@
1
+ # jev-layer
2
+
3
+ [English](README.md) | [Русский](README.ru.md) | [简体中文](README.zh-CN.md)
4
+
5
+ 面向 agent harness 的可移植 **System-1 决策层**。jev-layer 只负责路由有界决策并记录证据;host 保留执行、权限、审批、重试、恢复和最终结果的所有权。
6
+
7
+ 提供 **Hermes、OMP、Codex 和 generic MCP-compatible agents** 的集成示例。
8
+
9
+ ## 架构
10
+
11
+ ```text
12
+ +----------------------+ 有界请求 +----------------------+
13
+ | Agent harness | --------------------------> | jev-layer |
14
+ | Hermes / OMP / | | route / supervise / |
15
+ | Codex / generic MCP | <-------------------------- | context filter |
16
+ +----------+-----------+ 决策 + id +----------+-----------+
17
+ | |
18
+ | host 检查权限和审批 |
19
+ v v
20
+ +----------+-----------+ 执行结果 +----------+-----------+
21
+ | Native host executor | --------------------------> | receipts + replay |
22
+ | 负责所有副作用 | jev_record_execution | JSONL, correlation_id|
23
+ +----------------------+ +----------------------+
24
+ ```
25
+
26
+ Jev 从不执行选中的 capability。可使用离线确定性的 `demo`、OpenRouter Decisions 或 TypeSafe;普通 CI 不需要 provider credentials。
27
+
28
+ ## 快速开始
29
+
30
+ 需要 Node.js 20 或更新版本。没有必需的 runtime 依赖。
31
+
32
+ ```sh
33
+ npm install
34
+ npm link
35
+ jev install --project /path/to/workspace
36
+ jev add generic --project /path/to/workspace
37
+ jev doctor --project /path/to/workspace
38
+ ```
39
+
40
+ `npm link` 仅用于本地安装,不会发布包。如果不想全局 link,可使用 `node /path/to/jev-layer/bin/jev.mjs ...`。默认 provider 是离线确定性的 `demo`。
41
+
42
+ 直接运行 stdio MCP:
43
+
44
+ ```sh
45
+ jev mcp
46
+ ```
47
+
48
+ 凭据必须保存在仓库之外:
49
+
50
+ ```sh
51
+ export JEV_LAYER_PROVIDER=openrouter
52
+ export OPENROUTER_API_KEY='provided-by-your-secret-store'
53
+ jev doctor --project /path/to/workspace
54
+ ```
55
+
56
+ ## 核心能力
57
+
58
+ - **Routing:** `jev_route` 从 host 提供的候选集合中选择一个 capability。host 会再次验证 id 和权限。
59
+ - **Receipts/replay:** `jev_record_execution` 使用原始 `correlation_id` 关联 host 结果。JSONL 位于 `.jev/replay/cases.jsonl`,可用 `npm run replay:evaluate` 离线评估。
60
+ - **Supervision:** `jev_supervise` 返回有界的工作状态判断;确定性的 host policy 将其映射为 `continue`、`verify`、`retry`、`finish` 或 `escalate`。Jev 不执行这些动作。
61
+ - **Context filtering:** 可选的确定性 `shadow` 或 `conservative` 过滤器减少过期 context,不使用 LLM 摘要。
62
+ - **Experimental browser fast-path:** `jev_browser_step` 根据 host observation 选择一个有界浏览器动作。observation、审批、原生执行和恢复都由 host 提供。
63
+ - **Fail-open:** Jev 被禁用、不可用、出错或无法确定时,控制权返回 host 的正常路径。Jev 不扩大权限,也不猜测执行。
64
+
65
+ 所有可选表面默认关闭:
66
+
67
+ ```sh
68
+ JEV_BROWSER_FAST_PATH=1 jev mcp
69
+ JEV_SUPERVISION=1 jev mcp
70
+ JEV_CONTEXT_FILTER=shadow jev cli --input examples/route-request.json
71
+ ```
72
+
73
+ ## Harness adapters
74
+
75
+ 示例位于 `integrations/`:
76
+
77
+ - `integrations/hermes/`
78
+ - `integrations/omp/`
79
+ - `integrations/codex/`
80
+ - `integrations/template/`
81
+
82
+ 发布基线记录了准备环境中观察到的 OMP `18.2.6`、Hermes `0.21.3`(`b675e6de`)和 Codex CLI `0.155.1`。这是版本与契约基线,不代表覆盖所有 provider/model 组合;详见 [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md)。
83
+
84
+ ### 添加新的 harness
85
+
86
+ 1. 复制 `integrations/template/adapter.mjs`。
87
+ 2. 添加 `integrations/<harness>/` 和不含 secret 的 config/example。
88
+ 3. 调用 `jev_route`,保留 `correlation_id`,仅通过 host registry 执行,然后调用 `jev_record_execution`。
89
+ 4. 添加覆盖成功、fail-open、审批拒绝和 execution receipt 的离线 smoke fixture。
90
+ 5. 记录支持的版本并通过 CI。
91
+
92
+ 详见 [CONTRIBUTING.md](CONTRIBUTING.md) 和 [docs/SCHEMA-VERSIONING.md](docs/SCHEMA-VERSIONING.md)。
93
+
94
+ ## Browser 状态
95
+
96
+ Browser fast-path 的**可靠性已通过当前 real-browser fixtures 验证**,包括动作顺序、可见链接导航、原生 select、审批拒绝和恢复。**性能优化仍是实验性的**。不宣称任何浏览器加速倍数。
97
+
98
+ ## 安全与兼容性
99
+
100
+ - MIT 许可证:[LICENSE](LICENSE)。
101
+ - jev-layer 不是 security boundary。权限和审批的权威来源是 host:[SECURITY.md](SECURITY.md)。
102
+ - MCP tools、routing decisions、receipts、replay cases 和 adapter contract 当前都是 version 1。应优先添加可选字段,不要静默破坏 v1。
103
+ - 不要提交 credentials、含 secret 的 logs、`.env` 或 machine-specific paths。
104
+
105
+ ## 验证
106
+
107
+ ```sh
108
+ npm test
109
+ npm run smoke
110
+ npm run fail-open-smoke
111
+ npm run clean-install-smoke
112
+ npm pack --dry-run
113
+ ```
114
+
115
+ GitHub Actions 在 Node.js 20、22 和 24 上运行这些检查。Provider-backed 测试需要单独的 secret-managed 环境,不属于普通 PR CI。
116
+
117
+ 文档:[CONTRIBUTING.md](CONTRIBUTING.md) · [SECURITY.md](SECURITY.md) · [RELEASE.md](RELEASE.md) · [CHANGELOG.md](CHANGELOG.md)。
package/RELEASE.md ADDED
@@ -0,0 +1,53 @@
1
+ # Release checklist
2
+
3
+ [English](README.md) | [Русский](README.ru.md) | [简体中文](README.zh-CN.md)
4
+
5
+ This checklist prepares a public open-source release without publishing or pushing it. Do not run `git push`, create a GitHub release, or run `npm publish` without explicit release approval.
6
+
7
+ ## Before the release commit
8
+
9
+ - [ ] Confirm package name, ownership, repository metadata, and supported Node versions.
10
+ - [ ] Set the intended semantic version in `package.json` and `package-lock.json`.
11
+ - [ ] Keep `private: true` until the publish decision is explicit; set it false only in the release commit that is authorized to publish.
12
+ - [ ] Confirm [LICENSE](LICENSE) is MIT and the copyright notice is correct.
13
+ - [ ] Review `CONTRIBUTING.md` and [SECURITY.md](SECURITY.md).
14
+ - [ ] Review schema v1 compatibility in [docs/SCHEMA-VERSIONING.md](docs/SCHEMA-VERSIONING.md).
15
+ - [ ] Verify every supported adapter and its documented compatibility range.
16
+
17
+ ## Verification
18
+
19
+ - [ ] `npm install`
20
+ - [ ] `npm test`
21
+ - [ ] `npm run smoke`
22
+ - [ ] `npm run fail-open-smoke`
23
+ - [ ] `npm run clean-install-smoke`
24
+ - [ ] Run relevant E2E checks for MCP, receipts, supervision, context filtering, discovery, and browser when changed.
25
+ - [ ] Confirm provider-backed tests are either absent from ordinary CI or run only with secret-managed credentials.
26
+ - [ ] Confirm fail-open and approval-denial paths still preserve host ownership.
27
+
28
+ ## Package and documentation
29
+
30
+ - [ ] Run `npm pack --dry-run` and inspect the file list.
31
+ - [ ] Ensure no `.env`, credentials, private keys, machine-specific paths, or local state is packaged.
32
+ - [ ] Confirm `README.md`, `README.ru.md`, and `README.zh-CN.md` all start with the language links and describe the same public behavior.
33
+ - [ ] Confirm the README includes the architecture diagram, Quick Start, supported harnesses, routing, receipts/replay, supervision, context filtering, browser status, and fail-open behavior.
34
+ - [ ] Update [CHANGELOG.md](CHANGELOG.md) with user-visible changes and compatibility notes.
35
+ - [ ] Add release notes for schema, adapter, or provider changes.
36
+
37
+ ## Tag and release
38
+
39
+ - [ ] Review the final diff and `npm pack --dry-run` output.
40
+ - [ ] Create the version commit.
41
+ - [ ] Create an annotated tag matching the package version, for example `v0.1.0`.
42
+ - [ ] Push the commit and tag only after explicit approval.
43
+ - [ ] Create the GitHub release from the tag only after explicit approval.
44
+ - [ ] Verify the release source archive and documentation links.
45
+
46
+ ## npm publish
47
+
48
+ - [ ] Confirm the package is no longer private and the intended npm account/organization is selected.
49
+ - [ ] Confirm npm 2FA/trusted publishing policy and provenance requirements.
50
+ - [ ] Run `npm publish --dry-run` and inspect the result.
51
+ - [ ] Run `npm publish` only after explicit approval.
52
+ - [ ] Install the published version in a clean temporary directory and run the smoke/clean-install checks.
53
+ - [ ] Record the published version, tag, release URL, and rollback/contact plan in the changelog or release notes.