jev-layer 0.1.0 → 0.2.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 (83) hide show
  1. package/CHANGELOG.md +45 -34
  2. package/CONTRIBUTING.md +146 -146
  3. package/LICENSE +21 -21
  4. package/README.md +123 -126
  5. package/README.ru.md +138 -117
  6. package/README.zh-CN.md +137 -117
  7. package/RELEASE.md +53 -53
  8. package/SECURITY.md +56 -56
  9. package/bin/jev.mjs +213 -213
  10. package/config/codex.mcp.toml +8 -8
  11. package/config/generic-mcp.json +13 -13
  12. package/config/hermes.mcp.yaml +9 -9
  13. package/config/jev.example.json +22 -22
  14. package/config/omp.mcp.json +14 -14
  15. package/config/providers.env.example +13 -13
  16. package/docs/AGENT-IMPLEMENTATION.md +250 -0
  17. package/docs/COMPATIBILITY.md +15 -15
  18. package/docs/HERMES-LOCAL-AGENT-HANDOFF.ru.md +177 -0
  19. package/docs/PROVIDERS.md +67 -0
  20. package/docs/SCHEMA-VERSIONING.md +96 -94
  21. package/docs/architecture.svg +77 -0
  22. package/docs/jev-layer-banner.svg +38 -0
  23. package/examples/capabilities.json +39 -39
  24. package/examples/route-request.json +28 -28
  25. package/integrations/codex/.codex-plugin/plugin.json +19 -19
  26. package/integrations/codex/.mcp.json +11 -11
  27. package/integrations/codex/AGENTS.md +1 -1
  28. package/integrations/codex/run-mcp.mjs +9 -9
  29. package/integrations/codex/skills/jev-route/SKILL.md +17 -17
  30. package/integrations/hermes/__init__.py +150 -51
  31. package/integrations/hermes/plugin.yaml +10 -5
  32. package/integrations/hermes/schemas.py +89 -12
  33. package/integrations/omp/extension.js +105 -105
  34. package/integrations/template/README.md +10 -10
  35. package/integrations/template/adapter.mjs +87 -87
  36. package/package.json +60 -59
  37. package/scripts/benchmark.mjs +35 -35
  38. package/scripts/browser-benchmark.mjs +92 -92
  39. package/scripts/browser-e2e.mjs +117 -117
  40. package/scripts/capability-e2e.mjs +31 -31
  41. package/scripts/clean-install-smoke.mjs +162 -162
  42. package/scripts/codex-mcp-smoke.mjs +119 -119
  43. package/scripts/context-filter-e2e.mjs +45 -45
  44. package/scripts/fail-open-smoke.mjs +120 -120
  45. package/scripts/feature-flags-smoke.mjs +46 -46
  46. package/scripts/mcp-receipt-smoke.mjs +113 -98
  47. package/scripts/model-route-report.mjs +15 -0
  48. package/scripts/openrouter-choice.mjs +59 -59
  49. package/scripts/replay-eval.mjs +124 -124
  50. package/scripts/smoke.mjs +34 -34
  51. package/scripts/supervision-e2e.mjs +138 -109
  52. package/src/browser.mjs +571 -569
  53. package/src/cli.mjs +33 -33
  54. package/src/config.mjs +85 -75
  55. package/src/context-filter.mjs +56 -56
  56. package/src/contract.mjs +72 -72
  57. package/src/discovery.mjs +65 -65
  58. package/src/hermes-adapter.mjs +123 -0
  59. package/src/mcp-server.mjs +267 -210
  60. package/src/model-route-metrics.mjs +89 -0
  61. package/src/model-routing.mjs +87 -0
  62. package/src/providers/demo.mjs +52 -52
  63. package/src/providers/index.mjs +12 -0
  64. package/src/providers/typesafe.mjs +126 -126
  65. package/src/receipts.mjs +227 -226
  66. package/src/registry.mjs +109 -109
  67. package/src/relevance-filter.mjs +99 -99
  68. package/src/route.mjs +219 -221
  69. package/src/shadow-compaction.mjs +170 -0
  70. package/src/supervision.mjs +268 -244
  71. package/test/browser.test.mjs +199 -199
  72. package/test/capability.test.mjs +54 -54
  73. package/test/context-filter.test.mjs +65 -65
  74. package/test/hermes-adapter.test.mjs +62 -0
  75. package/test/model-route-metrics.test.mjs +61 -0
  76. package/test/model-routing.test.mjs +59 -0
  77. package/test/openrouter-provider.test.mjs +55 -55
  78. package/test/provider-transports.test.mjs +205 -0
  79. package/test/providers.test.mjs +126 -0
  80. package/test/receipts.test.mjs +71 -71
  81. package/test/route.test.mjs +74 -74
  82. package/test/shadow-compaction.test.mjs +67 -0
  83. package/test/supervision.test.mjs +117 -99
package/README.md CHANGED
@@ -1,126 +1,123 @@
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)
1
+ <p align="center">
2
+ <img src="docs/jev-layer-banner.svg" alt="jev-layer — portable System-1 decisions for agent harnesses" width="960">
3
+ </p>
4
+
5
+ <h1 align="center">jev-layer</h1>
6
+
7
+ <p align="center">
8
+ <strong>Let an agent make a bounded choice without handing it control.</strong><br>
9
+ Jev recommends. Your harness still checks permissions and executes.
10
+ </p>
11
+
12
+ <p align="center">Hermes · OMP · Codex · generic MCP</p>
13
+
14
+ <p align="center">
15
+ <a href="https://github.com/typakon4/jev-layer/actions/workflows/ci.yml?query=branch%3Amain"><img alt="CI status" src="https://github.com/typakon4/jev-layer/actions/workflows/ci.yml/badge.svg?branch=main"></a>
16
+ <a href="https://www.npmjs.com/package/jev-layer"><img alt="npm version" src="https://img.shields.io/npm/v/jev-layer?logo=npm&amp;label=npm"></a>
17
+ <a href="https://github.com/typakon4/jev-layer/releases"><img alt="latest GitHub release" src="https://img.shields.io/github/v/release/typakon4/jev-layer?display_name=tag&amp;sort=semver"></a>
18
+ <a href="https://github.com/typakon4/jev-layer/blob/main/LICENSE"><img alt="MIT license" src="https://img.shields.io/github/license/typakon4/jev-layer"></a>
19
+ </p>
20
+
21
+ [English](README.md) · [Русский](README.ru.md) · [简体中文](README.zh-CN.md)
22
+
23
+ **Install:** `npm install --global jev-layer` · [Integrate a harness](docs/AGENT-IMPLEMENTATION.md) · [Security model](SECURITY.md)
24
+
25
+ ## What changes
26
+
27
+ | Without Jev | With Jev |
28
+ | --- | --- |
29
+ | Your harness follows its existing path to choose a capability. | The harness can ask `jev_route` to choose from a bounded set it supplies. |
30
+ | Your harness owns permissions, approvals, and execution. | Your harness still owns permissions, approvals, and execution. |
31
+ | Execution results stay in the host's normal workflow. | The host can attach the result to the decision with `jev_record_execution` and replay cases offline. |
32
+
33
+ Jev never executes a selected capability. If it is disabled, unavailable, invalid, or inconclusive, control returns to the host's normal path.
34
+
35
+ ## Quick start
36
+
37
+ Requires Node.js 20 or newer. There are no mandatory runtime dependencies.
38
+
39
+ ```sh
40
+ npm install --global jev-layer
41
+ jev install --project /path/to/workspace
42
+ jev add generic --project /path/to/workspace
43
+ jev doctor --project /path/to/workspace
44
+ ```
45
+
46
+ The default `demo` provider is deterministic and works offline. To run the stdio MCP server directly:
47
+
48
+ ```sh
49
+ jev mcp
50
+ ```
51
+
52
+ ## How it fits into a harness
53
+
54
+ <p align="center">
55
+ <img src="docs/architecture.svg" alt="Architecture: agent harnesses send bounded requests to jev-layer; the host owns permissions and execution; receipts support replay." width="960">
56
+ </p>
57
+
58
+ 1. The host sends Jev a request and the candidate capabilities it already allows.
59
+ 2. Jev returns a bounded recommendation. The host checks it against its own registry and permissions.
60
+ 3. The host decides whether to execute, then can record what happened against the original `correlation_id`.
61
+
62
+ A provider can be deterministic `demo`, OpenRouter Decisions, or TypeSafe. Provider-backed tests are not required for normal CI; see the [provider guide](docs/PROVIDERS.md).
63
+
64
+ ## What else it can do
65
+
66
+ - **Supervision:** `jev_supervise` returns bounded work-state judgments. The host decides whether to continue, verify, retry, finish, or escalate.
67
+ - **Model routing:** `jev_model_route` recommends one host-declared model profile for a future call. It is advisory only; the host measures outcomes before changing provider or model settings. Correlated receipts can be reviewed with `npm run model-route:report -- /path/to/cases.jsonl`.
68
+ - **Shadow compaction:** `jev_shadow_compaction` produces report-only keep/drop candidates for host-supplied context. It does not summarize, mutate, or delete context, and keeps pinned evidence on provider failure.
69
+ - **Context filtering:** optional deterministic `shadow` or `conservative` filtering reduces stale context without LLM summarization.
70
+ - **Experimental browser fast-path:** `jev_browser_step` recommends one bounded action from a host observation. The host supplies approval, native execution, and recovery; Jev does not start a browser worker.
71
+ - **Fail open:** optional Jev surfaces are disabled by default. Jev never widens permissions or guesses execution.
72
+
73
+ Enable optional surfaces explicitly:
74
+
75
+ ```sh
76
+ JEV_BROWSER_FAST_PATH=1 jev mcp
77
+ JEV_SUPERVISION=1 jev mcp
78
+ JEV_CONTEXT_FILTER=shadow jev cli --input examples/route-request.json
79
+ ```
80
+
81
+ For provider credentials, keep keys outside the repository:
82
+
83
+ ```sh
84
+ export JEV_LAYER_PROVIDER=openrouter
85
+ export OPENROUTER_API_KEY='provided-by-your-secret-store'
86
+ jev doctor --project /path/to/workspace
87
+ ```
88
+
89
+ ## Pick an integration
90
+
91
+ Examples and adapters live under `integrations/`:
92
+
93
+ - Hermes: `integrations/hermes/` (see the [local-agent handoff guide](docs/HERMES-LOCAL-AGENT-HANDOFF.ru.md))
94
+ - OMP: `integrations/omp/`
95
+ - Codex: `integrations/codex/`
96
+ - Another harness: start from `integrations/template/`
97
+
98
+ Adapters stay thin. The host retains native capability lookup, permissions, approvals, execution, retries, recovery, and final output. For the adapter contract, see [CONTRIBUTING.md](CONTRIBUTING.md). For compatibility rules, see [docs/SCHEMA-VERSIONING.md](docs/SCHEMA-VERSIONING.md).
99
+
100
+ 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).
101
+
102
+ ## Boundaries
103
+
104
+ - jev-layer is not a security boundary. Host permissions and approvals remain authoritative; see [SECURITY.md](SECURITY.md).
105
+ - Schema, MCP tool, receipt, replay, and adapter contracts are currently version 1. Prefer additive changes; do not break v1 silently.
106
+ - Browser fast-path reliability is validated against current real-browser fixtures. Performance optimization remains experimental; no browser speedup claim is made.
107
+ - Do not commit credentials, logs containing secrets, `.env` files, or machine-specific paths.
108
+
109
+ ## Verify locally
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
+ GitHub Actions runs these checks on Node.js 20, 22, and 24. Provider-backed tests require a secret-managed environment and are not part of ordinary PR CI.
120
+
121
+ ## Project docs
122
+
123
+ [Agent implementation guide](docs/AGENT-IMPLEMENTATION.md) · [Providers](docs/PROVIDERS.md) · [Compatibility](docs/COMPATIBILITY.md) · [Contributing](CONTRIBUTING.md) · [Security](SECURITY.md) · [Release](RELEASE.md) · [Changelog](CHANGELOG.md)
package/README.ru.md CHANGED
@@ -1,117 +1,138 @@
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).
1
+ <p align="center">
2
+ <img src="docs/jev-layer-banner.svg" alt="jev-layer — портируемый System-1 слой решений для agent harnesses" width="960">
3
+ </p>
4
+
5
+ <h1 align="center">jev-layer</h1>
6
+
7
+ <p align="center">
8
+ <strong>Портируемый System-1 слой решений для agent harnesses.</strong><br>
9
+ Host владеет routing, receipts, replay и fail-open интеграциями.
10
+ </p>
11
+
12
+ <p align="center">
13
+ Hermes · OMP · Codex · generic MCP
14
+ </p>
15
+
16
+ <p align="center">
17
+ <a href="https://github.com/typakon4/jev-layer/actions/workflows/ci.yml?query=branch%3Amain"><img alt="CI status" src="https://github.com/typakon4/jev-layer/actions/workflows/ci.yml/badge.svg?branch=main"></a>
18
+ <a href="https://www.npmjs.com/package/jev-layer"><img alt="npm version" src="https://img.shields.io/npm/v/jev-layer?logo=npm&amp;label=npm"></a>
19
+ <a href="https://github.com/typakon4/jev-layer/releases"><img alt="latest GitHub release" src="https://img.shields.io/github/v/release/typakon4/jev-layer?display_name=tag&amp;sort=semver"></a>
20
+ <a href="https://github.com/typakon4/jev-layer/blob/main/LICENSE"><img alt="MIT license" src="https://img.shields.io/github/license/typakon4/jev-layer"></a>
21
+ </p>
22
+
23
+ [English](README.md) · [Русский](README.ru.md) · [简体中文](README.zh-CN.md)
24
+
25
+ jev-layer маршрутизирует ограниченные решения и сохраняет доказательства; harness сохраняет владение исполнением, permissions, approvals, retry, восстановлением и итоговым результатом.
26
+
27
+ > Интегрируете jev-layer в harness? Сначала дайте агенту [Agent implementation guide](docs/AGENT-IMPLEMENTATION.md), а не только ссылку на этот README.
28
+
29
+ ## Архитектура
30
+
31
+ <p align="center">
32
+ <img src="docs/architecture.svg" alt="Архитектура: harness отправляет ограниченный запрос в jev-layer; host владеет permissions и execution; receipts поддерживают replay." width="960">
33
+ </p>
34
+
35
+ Jev не исполняет выбранную capability. Доступны детерминированный `demo`, OpenRouter Decisions и TypeSafe; тесты с provider credentials не требуются для обычного CI.
36
+
37
+ ## Быстрый старт
38
+
39
+ Требуется Node.js 20 или новее. Обязательных runtime-зависимостей нет.
40
+
41
+ Установить опубликованный CLI:
42
+
43
+ ```sh
44
+ npm install --global jev-layer
45
+ ```
46
+
47
+ Или использовать локальный clone:
48
+
49
+ ```sh
50
+ npm install
51
+ npm link
52
+ jev install --project /path/to/workspace
53
+ jev add generic --project /path/to/workspace
54
+ jev doctor --project /path/to/workspace
55
+ ```
56
+
57
+ `npm link` используется только локально и ничего не публикует. Вместо него можно запускать `node /path/to/jev-layer/bin/jev.mjs ...`. Provider по умолчанию — офлайн-детерминированный `demo`.
58
+
59
+ Для stdio MCP:
60
+
61
+ ```sh
62
+ jev mcp
63
+ ```
64
+
65
+ Секреты должны находиться вне репозитория:
66
+
67
+ ```sh
68
+ export JEV_LAYER_PROVIDER=openrouter
69
+ export OPENROUTER_API_KEY='provided-by-your-secret-store'
70
+ jev doctor --project /path/to/workspace
71
+ ```
72
+
73
+ Все три режима (`demo`, `openrouter` и прямой `typesafe`), их endpoints и порядок выбора конфигурации описаны в [руководстве по провайдерам](docs/PROVIDERS.md).
74
+
75
+ ## Основные поверхности
76
+
77
+ - **Routing:** `jev_route` выбирает одну capability из набора, предоставленного host. Host повторно проверяет id и permissions.
78
+ - **Receipts/replay:** `jev_record_execution` связывает результат host с исходным `correlation_id`. JSONL-файлы находятся в `.jev/replay/cases.jsonl` и проверяются офлайн через `npm run replay:evaluate`.
79
+ - **Supervision:** `jev_supervise` возвращает ограниченные judgments о состоянии работы; детерминированная host policy преобразует их в `continue`, `verify`, `retry`, `finish` или `escalate`. Receipt хранит детерминированный `evidence_state`: `present`, `missing` или `contradictory`. Противоречивые evidence не могут привести к `finish`. Jev эти действия не выполняет.
80
+ - **Model routing:** `jev_model_route` возвращает одну рекомендацию из model profiles, которые объявил host, для следующего model call. Это только shadow: прежде чем менять provider/model setting, host обязан измерить outcome, retry, latency и cost. Решение связывается с последующим `jev_record_execution` по `correlation_id`; host записывает `result.model_route = { actual_model_id, retry_count, outcome }`, затем `npm run model-route:report -- /path/to/cases.jsonl` строит read-only evidence report.
81
+ - **Shadow compaction:** `jev_shadow_compaction` делает пакетный консервативный report с keep/drop-кандидатами для context, который передал host. Он никогда не меняет, не суммаризирует и не удаляет context; path, error, command и requirement pin-ятся до provider review, а provider failure оставляет все остальные items.
82
+ - **Context filtering:** опциональная детерминированная фильтрация `shadow` или `conservative` убирает устаревший context без LLM-суммаризации.
83
+ - **Experimental browser fast-path:** `jev_browser_step` выбирает одно ограниченное действие из observation host. Host предоставляет observation, approval, native execution и recovery.
84
+ - **Fail-open:** при отключённом, недоступном, ошибочном или неубедительном Jev вызове управление возвращается в обычный host path. Jev не расширяет permissions и не угадывает execution.
85
+
86
+ Опциональные поверхности по умолчанию отключены:
87
+
88
+ ```sh
89
+ JEV_BROWSER_FAST_PATH=1 jev mcp
90
+ JEV_SUPERVISION=1 jev mcp
91
+ JEV_CONTEXT_FILTER=shadow jev cli --input examples/route-request.json
92
+ ```
93
+
94
+ ## Harness adapters
95
+
96
+ Примеры находятся в `integrations/`:
97
+
98
+ - `integrations/hermes/` — для active plugin topology и safe change workflow см. [handoff локальному агенту (RU)](docs/HERMES-LOCAL-AGENT-HANDOFF.ru.md).
99
+ - `integrations/omp/`
100
+ - `integrations/codex/`
101
+ - `integrations/template/`
102
+
103
+ Для 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).
104
+
105
+ ### Добавление нового harness
106
+
107
+ 1. Скопируйте `integrations/template/adapter.mjs`.
108
+ 2. Добавьте `integrations/<harness>/` и secret-free config/example.
109
+ 3. Вызовите `jev_route`, сохраните `correlation_id`, исполняйте только через native registry host, затем вызовите `jev_record_execution`.
110
+ 4. Добавьте offline smoke fixture для успеха, fail-open, отказа в approval и execution receipt.
111
+ 5. Зафиксируйте поддерживаемые версии и пройдите CI.
112
+
113
+ Подробности: [CONTRIBUTING.md](CONTRIBUTING.md), [docs/SCHEMA-VERSIONING.md](docs/SCHEMA-VERSIONING.md).
114
+
115
+ ## Статус browser
116
+
117
+ Надёжность browser fast-path **проверена на текущих real-browser fixtures**: sequencing, visible-link navigation, native select, approval denial и recovery. **Оптимизация производительности остаётся экспериментальной**. Заявлений об ускорении браузера нет.
118
+
119
+ ## Безопасность и совместимость
120
+
121
+ - Лицензия MIT: [LICENSE](LICENSE).
122
+ - jev-layer не является security boundary. Источник истины для permissions и approvals — host: [SECURITY.md](SECURITY.md).
123
+ - MCP tools, routing decisions, receipts, replay cases и adapter contract сейчас имеют version 1. Изменения должны быть additive и не ломать v1 молча.
124
+ - Не коммитьте credentials, секретные logs, `.env` или machine-specific paths.
125
+
126
+ ## Проверка
127
+
128
+ ```sh
129
+ npm test
130
+ npm run smoke
131
+ npm run fail-open-smoke
132
+ npm run clean-install-smoke
133
+ npm pack --dry-run
134
+ ```
135
+
136
+ GitHub Actions запускает эти проверки на Node.js 20, 22 и 24. Provider-backed тесты требуют отдельного secret-managed окружения и не входят в обычный PR CI.
137
+
138
+ Документы: [CONTRIBUTING.md](CONTRIBUTING.md) · [SECURITY.md](SECURITY.md) · [RELEASE.md](RELEASE.md) · [CHANGELOG.md](CHANGELOG.md) · [Agent implementation guide](docs/AGENT-IMPLEMENTATION.md).