omnius 1.0.591 → 1.0.592
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/.aiwg/addons/omnius-docs/README.md +15 -1
- package/.aiwg/addons/omnius-docs/manifest.json +28 -68
- package/.aiwg/addons/omnius-docs/skills/agent-failure-recovery/SKILL.md +2 -1
- package/.aiwg/addons/omnius-docs/skills/browser-interaction-validation/SKILL.md +2 -1
- package/.aiwg/addons/omnius-docs/skills/evidence-directed-delivery/SKILL.md +2 -1
- package/.aiwg/addons/omnius-docs/skills/hardware-evidence-audit/SKILL.md +2 -1
- package/.aiwg/addons/omnius-docs/skills/omnius-docs/SKILL.md +17 -7
- package/.aiwg/addons/omnius-docs/skills/omnius-inference-docs/SKILL.md +27 -0
- package/.aiwg/addons/omnius-docs/skills/omnius-integration-docs/SKILL.md +21 -0
- package/.aiwg/addons/omnius-docs/skills/omnius-ops-docs/SKILL.md +2 -0
- package/.aiwg/addons/omnius-docs/skills/omnius-realtime-docs/SKILL.md +2 -0
- package/.aiwg/addons/omnius-docs/skills/omnius-sponsor-docs/SKILL.md +2 -0
- package/.aiwg/addons/omnius-docs/skills/omnius-telegram-docs/SKILL.md +2 -0
- package/.aiwg/addons/omnius-docs/skills/omnius-tools-docs/SKILL.md +23 -0
- package/.aiwg/addons/omnius-docs/skills/omnius-version-compatibility-docs/SKILL.md +23 -0
- package/.aiwg/addons/omnius-docs/skills/runtime-provenance-audit/SKILL.md +2 -1
- package/.aiwg/addons/omnius-docs/skills/secrets-and-config-audit/SKILL.md +2 -1
- package/.aiwg/addons/omnius-docs/skills/test-surface-audit/SKILL.md +2 -1
- package/.aiwg/addons/omnius-docs/skills/workspace-reality-audit/SKILL.md +2 -1
- package/.aiwg/addons/omnius-rest-docs/README.md +3 -0
- package/.aiwg/addons/omnius-rest-docs/manifest.json +27 -20
- package/.aiwg/addons/omnius-rest-docs/skills/omnius-rest-docs/SKILL.md +9 -5
- package/README.md +36 -0
- package/dist/discovery.d.ts +50 -0
- package/dist/index.js +5975 -4021
- package/dist/library.d.ts +7 -0
- package/dist/library.js +950 -0
- package/dist/postinstall-daemon.cjs +18 -0
- package/dist/providerRegistry.d.ts +80 -0
- package/dist/service-version.d.ts +35 -0
- package/docs/.vitepress/config.mts +8 -0
- package/docs/DISCOVERY.json +20224 -0
- package/docs/DISCOVERY.md +648 -0
- package/docs/HANDOFF-crl-encoder-decoder-fix.md +129 -0
- package/docs/agent-memory/INDEX.md +9 -4
- package/docs/agent-memory/index.md +7 -0
- package/docs/concept-relational-language.md +869 -0
- package/docs/context-management-medium-models-proposal.md +449 -0
- package/docs/dedup-false-positive-meta-analysis.md +96 -0
- package/docs/discovery/catalog-overrides.json +724 -0
- package/docs/duplicate-calls-root-cause-analysis.md +91 -0
- package/docs/duplicate-calls-root-cause-deep.md +155 -0
- package/docs/ephemeral-skill-pack-small-context.md +57 -0
- package/docs/explorations/context-window-todo-association.md +156 -0
- package/docs/explorations/todo-association-verify.json +30 -0
- package/docs/explorations/verification-ledger.json +45 -0
- package/docs/explorations/verify-todo-association.sh +30 -0
- package/docs/flowstate.md +806 -0
- package/docs/getting-started/install.md +24 -0
- package/docs/getting-started/model-providers.md +13 -0
- package/docs/guides/agent-integration.md +87 -0
- package/docs/guides/bring-your-own-inference.md +126 -0
- package/docs/guides/tools-and-web-search.md +95 -0
- package/docs/index.md +14 -0
- package/docs/longhaul-35b-workorders.md +496 -0
- package/docs/memory-integration-analysis.md +303 -0
- package/docs/model-capability-awareness-and-multimodal-memory-root-fix.md +799 -0
- package/docs/multimodal-identity-memory-implementation.md +76 -0
- package/docs/omnius-self-edit-eval-2026-06-10.md +169 -0
- package/docs/opencode-agentic-loop-comparison.md +290 -0
- package/docs/operations/security-and-remote-access.md +2 -2
- package/docs/operations/version-compatibility.md +63 -0
- package/docs/proposals/git-progress-tracking-strategy.md +289 -0
- package/docs/proposals/opencode-modules/backendAdapter.ts +443 -0
- package/docs/proposals/opencode-modules/childSession.ts +288 -0
- package/docs/proposals/opencode-modules/compactionAgent.ts +101 -0
- package/docs/proposals/opencode-modules/orchestrator.ts +387 -0
- package/docs/proposals/opencode-modules/runner.ts +258 -0
- package/docs/reference/auth-map.md +87 -196
- package/docs/reference/configuration.md +27 -0
- package/docs/reference/rest-api.md +7 -0
- package/docs/reference/slash-commands.md +125 -2
- package/docs/research/_archived/README.md +18 -0
- package/docs/research/_archived/context_window_attention_model.py +418 -0
- package/docs/research/_archived/context_window_attention_spec.md +55 -0
- package/docs/research/_archived/context_window_attention_weights.json +68 -0
- package/docs/research/k-splanifolds.pdf +0 -0
- package/docs/research/personality-verbosity-control.md +293 -0
- package/docs/rest/INDEX.md +7 -0
- package/docs/rest/QUICKREF.md +18 -0
- package/docs/rest/REST-DOCS-MANIFEST.json +1 -0
- package/docs/rest/auth-and-scopes.md +7 -1
- package/docs/rest/endpoints/discovery.md +44 -0
- package/docs/rest/endpoints/events.md +5 -0
- package/docs/rest/endpoints/tools.md +9 -0
- package/docs/reviews/adversary-system-review.md +42 -0
- package/docs/sana-and-video-generation-integration-plan.md +712 -0
- package/docs/session-diary-llm-training-analysis.md +218 -0
- package/docs/telegram-dmn-curiosity-outreach-scaffold.md +91 -0
- package/docs/telegram-mid-horizon-download-loop-handoff.md +468 -0
- package/docs/telegram-reflection-corpus-integration-plan.md +306 -0
- package/docs/telegram-unified-tooling-architecture.md +332 -0
- package/docs/threat-model.md +868 -0
- package/docs/trajectory-grounding.md +160 -0
- package/docs/voice-flow-architecture.md +489 -0
- package/docs/work-orders/WO-AM-GAPS.md +638 -0
- package/docs/work-orders/daemon-hud-ui-overhaul.md +82 -0
- package/docs/work-orders/hermes-architecture-deltas/01-public-scrutiny-provenance-control/INDEX.md +21 -0
- package/docs/work-orders/hermes-architecture-deltas/01-public-scrutiny-provenance-control/WORKORDER.md +225 -0
- package/docs/work-orders/hermes-architecture-deltas/02-context-engine-plugin-boundary/INDEX.md +20 -0
- package/docs/work-orders/hermes-architecture-deltas/02-context-engine-plugin-boundary/WORKORDER.md +198 -0
- package/docs/work-orders/hermes-architecture-deltas/03-typed-gateway-event-stream/INDEX.md +19 -0
- package/docs/work-orders/hermes-architecture-deltas/03-typed-gateway-event-stream/WORKORDER.md +172 -0
- package/docs/work-orders/hermes-architecture-deltas/04-task-local-gateway-context/INDEX.md +19 -0
- package/docs/work-orders/hermes-architecture-deltas/04-task-local-gateway-context/WORKORDER.md +169 -0
- package/docs/work-orders/hermes-architecture-deltas/05-process-lifecycle-monitoring-notifications/INDEX.md +22 -0
- package/docs/work-orders/hermes-architecture-deltas/05-process-lifecycle-monitoring-notifications/WORKORDER.md +189 -0
- package/docs/work-orders/hermes-architecture-deltas/06-vision-evidence-routing-ladder/INDEX.md +22 -0
- package/docs/work-orders/hermes-architecture-deltas/06-vision-evidence-routing-ladder/WORKORDER.md +199 -0
- package/docs/work-orders/hermes-architecture-deltas/07-durable-multi-agent-kanban/INDEX.md +20 -0
- package/docs/work-orders/hermes-architecture-deltas/07-durable-multi-agent-kanban/WORKORDER.md +174 -0
- package/docs/work-orders/hermes-architecture-deltas/08-completion-critic-reconciliation-ledger/INDEX.md +22 -0
- package/docs/work-orders/hermes-architecture-deltas/08-completion-critic-reconciliation-ledger/WORKORDER.md +226 -0
- package/docs/work-orders/hermes-architecture-deltas/INDEX.md +38 -0
- package/docs/work-orders/omnius-context-engineering-behavior-fixes.md +281 -0
- package/docs/work-orders/telegram-dropbear-context-rca-workorder.md +202 -0
- package/docs/work-orders/world-class-memory-compiler/README.md +162 -0
- package/docs/work-orders/world-class-memory-compiler/TRACKER.md +179 -0
- package/docs/work-orders/world-class-memory-compiler/WO-01-exact-request-budget.md +79 -0
- package/docs/work-orders/world-class-memory-compiler/WO-02-typed-memory-fabric.md +65 -0
- package/docs/work-orders/world-class-memory-compiler/WO-03-dependency-working-set.md +55 -0
- package/docs/work-orders/world-class-memory-compiler/WO-04-inference-memory-compiler.md +67 -0
- package/docs/work-orders/world-class-memory-compiler/WO-05-artifact-fidelity-materialization.md +72 -0
- package/docs/work-orders/world-class-memory-compiler/WO-06-temporal-hybrid-retrieval.md +49 -0
- package/docs/work-orders/world-class-memory-compiler/WO-07-evaluation-harness.md +45 -0
- package/docs/work-orders/world-class-memory-compiler/WO-08-rollout-legacy-removal.md +45 -0
- package/docs/x402-remote-inference-plan.md +323 -0
- package/npm-shrinkwrap.json +108 -117
- package/package.json +7 -6
- package/templates/AGENTS.md +6 -0
- package/templates/OMNIUS.md +20 -0
package/docs/work-orders/hermes-architecture-deltas/03-typed-gateway-event-stream/WORKORDER.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Workorder: Typed Gateway Event Stream
|
|
2
|
+
|
|
3
|
+
## Objective
|
|
4
|
+
|
|
5
|
+
Replace fragile renderer-facing string events with a typed event stream that separates what happened in the runner from how each gateway renders it.
|
|
6
|
+
|
|
7
|
+
## Problem Statement
|
|
8
|
+
|
|
9
|
+
Telegram currently mixes runner state, progress, admin live panel text, public progress text, and completion status through loosely typed events and string filtering. This creates recurring risks:
|
|
10
|
+
- `task_complete.summary` can leak into visible replies if filtering drifts.
|
|
11
|
+
- `incomplete_verification` can be rendered like a successful completion.
|
|
12
|
+
- Progress messages depend on status text instead of event intent.
|
|
13
|
+
- Different surfaces duplicate completion and failure interpretation.
|
|
14
|
+
|
|
15
|
+
Hermes has a typed stream event layer and a dispatcher that lets adapters render events without changing agent execution.
|
|
16
|
+
|
|
17
|
+
## Existing Code Anchors
|
|
18
|
+
|
|
19
|
+
Omnius:
|
|
20
|
+
- `packages/orchestrator/src/agenticRunner.ts:15760` emits final `complete` events.
|
|
21
|
+
- `packages/orchestrator/src/agenticRunner.ts:14155` handles streaming `task_complete`.
|
|
22
|
+
- `packages/orchestrator/src/agenticRunner.ts:14382` handles non-streaming `task_complete`.
|
|
23
|
+
- `packages/orchestrator/src/agenticRunner.ts:15586` handles another task completion path.
|
|
24
|
+
- `packages/cli/src/tui/telegram-bridge.ts:2828` has task_complete visibility filtering.
|
|
25
|
+
- `packages/cli/src/tui/telegram-bridge.ts:12504` builds public progress messages.
|
|
26
|
+
- `packages/cli/src/tui/telegram-bridge.ts:12650` determines admin completion success.
|
|
27
|
+
- `packages/cli/src/tui/telegram-bridge.ts:13450` cleans final text for Telegram.
|
|
28
|
+
|
|
29
|
+
Hermes:
|
|
30
|
+
- `/home/robit/Documents/repositories/hermes-agent/gateway/stream_events.py:151` defines `StreamEvent` as a union.
|
|
31
|
+
- `/home/robit/Documents/repositories/hermes-agent/gateway/stream_dispatch.py:88` dispatches typed events to adapters.
|
|
32
|
+
|
|
33
|
+
## Target Architecture
|
|
34
|
+
|
|
35
|
+
Add `packages/orchestrator/src/runEvents.ts`.
|
|
36
|
+
|
|
37
|
+
Suggested event union:
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
type AgentRunEvent =
|
|
41
|
+
| { type: "run_started"; runId: string; surface: string; goalPreview: string }
|
|
42
|
+
| { type: "assistant_visible_text"; runId: string; text: string; source: "model" | "summary_fallback" }
|
|
43
|
+
| { type: "tool_call_started"; runId: string; toolName: string; callId?: string; argsPreview: string }
|
|
44
|
+
| { type: "tool_call_finished"; runId: string; toolName: string; callId?: string; success: boolean; outputPreview: string; evidenceId?: string }
|
|
45
|
+
| { type: "completion_requested"; runId: string; summary: string; sourcePath: "stream" | "batch" | "direct" | "text_detected" }
|
|
46
|
+
| { type: "completion_accepted"; runId: string; summary: string }
|
|
47
|
+
| { type: "completion_held"; runId: string; reasonCode: string; feedback: string }
|
|
48
|
+
| { type: "completion_incomplete_verification"; runId: string; summary: string; missingEvidence: string[] }
|
|
49
|
+
| { type: "run_failed"; runId: string; error: string }
|
|
50
|
+
| { type: "run_finished"; runId: string; status: "completed" | "incomplete" | "incomplete_verification"; success: boolean };
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Adapter responsibilities:
|
|
54
|
+
- Telegram public adapter renders only `assistant_visible_text` and bounded progress events.
|
|
55
|
+
- Telegram admin adapter renders provenance sections and incomplete verification status.
|
|
56
|
+
- TUI adapter renders detailed status and tool events.
|
|
57
|
+
- REST/SSE adapter serializes typed events directly.
|
|
58
|
+
|
|
59
|
+
## Phased Implementation
|
|
60
|
+
|
|
61
|
+
### Phase 0: Event Inventory
|
|
62
|
+
|
|
63
|
+
Tasks:
|
|
64
|
+
- List all current `emit({ type: ... })` shapes in `AgenticRunner`.
|
|
65
|
+
- List all Telegram handlers that branch on event type or status string.
|
|
66
|
+
- Add tests for current task_complete filtering and incomplete verification rendering.
|
|
67
|
+
|
|
68
|
+
Completion metrics:
|
|
69
|
+
- Event inventory exists in a temporary test fixture or doc comment.
|
|
70
|
+
- Current behavior is pinned before refactor.
|
|
71
|
+
|
|
72
|
+
### Phase 1: Define Event Types and Compatibility Adapter
|
|
73
|
+
|
|
74
|
+
Tasks:
|
|
75
|
+
- Add `runEvents.ts` with `AgentRunEvent` union and helpers.
|
|
76
|
+
- Add a compatibility function that maps existing runner events to typed events.
|
|
77
|
+
- Do not change runner emission sites yet.
|
|
78
|
+
|
|
79
|
+
File-by-file notes:
|
|
80
|
+
- `packages/orchestrator/src/runEvents.ts`: new event definitions.
|
|
81
|
+
- `packages/orchestrator/src/index.ts`: export events if CLI imports them.
|
|
82
|
+
- `packages/orchestrator/tests/runEvents.test.ts`: mapping coverage.
|
|
83
|
+
|
|
84
|
+
Completion metrics:
|
|
85
|
+
- Existing events can be converted without data loss for current fields.
|
|
86
|
+
- Unknown legacy events produce a typed diagnostic rather than throwing.
|
|
87
|
+
|
|
88
|
+
### Phase 2: Runner Emits Typed Events
|
|
89
|
+
|
|
90
|
+
Tasks:
|
|
91
|
+
- Replace completion-related emits first:
|
|
92
|
+
- `completion_requested`
|
|
93
|
+
- `completion_held`
|
|
94
|
+
- `completion_accepted`
|
|
95
|
+
- `completion_incomplete_verification`
|
|
96
|
+
- `run_finished`
|
|
97
|
+
- Replace tool call start/finish next.
|
|
98
|
+
- Keep legacy event compatibility until all adapters are migrated.
|
|
99
|
+
|
|
100
|
+
Completion metrics:
|
|
101
|
+
- All four `task_complete` paths emit the same typed completion lifecycle.
|
|
102
|
+
- `incomplete_verification` has its own event type and cannot be mistaken for `completion_accepted`.
|
|
103
|
+
- Tests assert event sequence for approve, request_changes, blocked, and max-cycle incomplete cases.
|
|
104
|
+
|
|
105
|
+
### Phase 3: Telegram Adapter
|
|
106
|
+
|
|
107
|
+
Tasks:
|
|
108
|
+
- Add a `TelegramRunEventAdapter` inside `telegram-bridge.ts` or a new `telegram-run-events.ts`.
|
|
109
|
+
- Move task_complete visibility filtering from scattered checks to adapter rules.
|
|
110
|
+
- Render public progress from typed progress/tool events.
|
|
111
|
+
- Render admin final text based on `run_finished.status`.
|
|
112
|
+
|
|
113
|
+
Completion metrics:
|
|
114
|
+
- Public Telegram never renders `task_complete.summary` directly.
|
|
115
|
+
- Admin Telegram says "completed" only for `status === "completed"`.
|
|
116
|
+
- `incomplete_verification` renders as failed/incomplete with evidence details.
|
|
117
|
+
|
|
118
|
+
### Phase 4: TUI and REST/SSE Adapters
|
|
119
|
+
|
|
120
|
+
Tasks:
|
|
121
|
+
- Update TUI progress renderers to use typed tool events.
|
|
122
|
+
- Update REST/SSE event surface if `/v1/run` streams legacy runner events.
|
|
123
|
+
- Document event schema in `docs/rest/endpoints/events.md` if exposed.
|
|
124
|
+
|
|
125
|
+
Completion metrics:
|
|
126
|
+
- REST clients can distinguish completion accepted from incomplete verification.
|
|
127
|
+
- Existing UI tests pass without relying on status text substrings.
|
|
128
|
+
|
|
129
|
+
### Phase 5: Remove Legacy String Coupling
|
|
130
|
+
|
|
131
|
+
Tasks:
|
|
132
|
+
- Delete compatibility paths once callers are migrated.
|
|
133
|
+
- Add source tests that reject direct renderer parsing of key strings:
|
|
134
|
+
- `task_complete blocked by verification guard`
|
|
135
|
+
- `INCOMPLETE_VERIFICATION`
|
|
136
|
+
- `completed:` as authoritative backend status.
|
|
137
|
+
|
|
138
|
+
Completion metrics:
|
|
139
|
+
- Renderers consume typed status fields.
|
|
140
|
+
- String text remains presentation only.
|
|
141
|
+
|
|
142
|
+
## Required Tests
|
|
143
|
+
|
|
144
|
+
- Runner event sequence: successful completion.
|
|
145
|
+
- Runner event sequence: provenance hold.
|
|
146
|
+
- Runner event sequence: critic request_changes then approve.
|
|
147
|
+
- Runner event sequence: critic blocked.
|
|
148
|
+
- Telegram public adapter suppresses internal completion summaries.
|
|
149
|
+
- Telegram admin adapter refuses completed rendering for `incomplete_verification`.
|
|
150
|
+
- REST/SSE event contract snapshot.
|
|
151
|
+
|
|
152
|
+
## Rollout Plan
|
|
153
|
+
|
|
154
|
+
1. Add typed definitions and compatibility mapper.
|
|
155
|
+
2. Emit typed completion events.
|
|
156
|
+
3. Migrate Telegram admin completion rendering.
|
|
157
|
+
4. Migrate public progress/rendering.
|
|
158
|
+
5. Migrate REST/SSE.
|
|
159
|
+
6. Remove legacy parsing.
|
|
160
|
+
|
|
161
|
+
## Risks
|
|
162
|
+
|
|
163
|
+
- Event duplication during compatibility phase. Mitigation: run IDs and event IDs.
|
|
164
|
+
- UI tests may depend on current strings. Mitigation: update tests to assert typed fields and only snapshot final presentation where necessary.
|
|
165
|
+
- REST consumers may depend on legacy event names. Mitigation: version or dual-emit during one release.
|
|
166
|
+
|
|
167
|
+
## Definition of Done
|
|
168
|
+
|
|
169
|
+
- Completion state is represented by typed events, not renderer string parsing.
|
|
170
|
+
- Telegram public/admin rendering cannot mislabel incomplete verification.
|
|
171
|
+
- All task_complete paths emit the same lifecycle.
|
|
172
|
+
- Event schema is tested and documented.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Task-Local Gateway Context Index
|
|
2
|
+
|
|
3
|
+
Progress: not started.
|
|
4
|
+
|
|
5
|
+
Files in this folder:
|
|
6
|
+
- [WORKORDER.md](WORKORDER.md) - Full phased implementation workorder.
|
|
7
|
+
|
|
8
|
+
Primary Omnius anchors:
|
|
9
|
+
- `packages/cli/src/tui/telegram-bridge.ts:13149` - tool context resolution.
|
|
10
|
+
- `packages/cli/src/tui/telegram-bridge.ts:13368` - sub-agent state creation.
|
|
11
|
+
- `packages/cli/src/tui/telegram-bridge.ts:16746` - Telegram reply preference tool depends on current message.
|
|
12
|
+
- `packages/cli/src/tui/telegram-bridge.ts:16807` - Telegram image analyze tool depends on current media scope.
|
|
13
|
+
|
|
14
|
+
Primary Hermes anchors:
|
|
15
|
+
- `/home/robit/Documents/repositories/hermes-agent/gateway/session_context.py:51` - `ContextVar` session fields.
|
|
16
|
+
- `/home/robit/Documents/repositories/hermes-agent/tools/env_passthrough.py:30` - ContextVar-backed environment allowlist.
|
|
17
|
+
|
|
18
|
+
Completion target:
|
|
19
|
+
- Tools and gateway helpers read current platform/session context from task-local storage instead of captured mutable bridge state when possible.
|
package/docs/work-orders/hermes-architecture-deltas/04-task-local-gateway-context/WORKORDER.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Workorder: Task-Local Gateway Context
|
|
2
|
+
|
|
3
|
+
## Objective
|
|
4
|
+
|
|
5
|
+
Introduce a task-local gateway context based on Node `AsyncLocalStorage` so Telegram, REST, TUI, scheduler, and background runs can share a common current-session context without mutable cross-run leakage.
|
|
6
|
+
|
|
7
|
+
## Problem Statement
|
|
8
|
+
|
|
9
|
+
Current Telegram tools and helpers frequently capture `chatId`, `currentMsg`, `sessionKey`, and tool context in closures. This works, but it makes concurrent run isolation fragile and causes repeated plumbing through many helper constructors.
|
|
10
|
+
|
|
11
|
+
Hermes uses Python `ContextVar` for gateway session context so tools can resolve active platform/chat/thread/user/run state in an async-safe way.
|
|
12
|
+
|
|
13
|
+
## Existing Code Anchors
|
|
14
|
+
|
|
15
|
+
Omnius:
|
|
16
|
+
- `packages/cli/src/tui/telegram-bridge.ts:13149` resolves `ToolContext`.
|
|
17
|
+
- `packages/cli/src/tui/telegram-bridge.ts:13368` creates `TelegramSubAgent`.
|
|
18
|
+
- `packages/cli/src/tui/telegram-bridge.ts:16746` builds reply preference tool using current Telegram message.
|
|
19
|
+
- `packages/cli/src/tui/telegram-bridge.ts:16807` builds image analysis tool using current scoped media.
|
|
20
|
+
- `packages/cli/src/tui/telegram-bridge.ts:17064` builds Telegram file send tool using current chat/admin state.
|
|
21
|
+
- `packages/cli/src/api/serve.ts:7079` registers chat run process leases for API-originated runs.
|
|
22
|
+
|
|
23
|
+
Hermes:
|
|
24
|
+
- `/home/robit/Documents/repositories/hermes-agent/gateway/session_context.py:51` defines session `ContextVar`s.
|
|
25
|
+
- `/home/robit/Documents/repositories/hermes-agent/gateway/session_context.py:87` synchronizes session id with environment.
|
|
26
|
+
- `/home/robit/Documents/repositories/hermes-agent/tools/env_passthrough.py:30` uses `ContextVar` for per-session environment allowlists.
|
|
27
|
+
|
|
28
|
+
## Target Architecture
|
|
29
|
+
|
|
30
|
+
Add `packages/orchestrator/src/runContext.ts` or `packages/cli/src/runtime/run-context.ts` depending on ownership.
|
|
31
|
+
|
|
32
|
+
Suggested type:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
export interface OmniusRunContext {
|
|
36
|
+
runId: string;
|
|
37
|
+
surface: "tui" | "telegram" | "api" | "scheduler" | "background";
|
|
38
|
+
projectRoot?: string;
|
|
39
|
+
ownerKind?: string;
|
|
40
|
+
ownerId?: string;
|
|
41
|
+
telegram?: {
|
|
42
|
+
chatId: string | number;
|
|
43
|
+
chatType: "private" | "group" | "supergroup" | "channel";
|
|
44
|
+
messageId?: number;
|
|
45
|
+
threadId?: number;
|
|
46
|
+
userId?: number;
|
|
47
|
+
username?: string;
|
|
48
|
+
sessionKey: string;
|
|
49
|
+
toolContext: string;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
API:
|
|
55
|
+
- `runWithOmniusContext(ctx, fn)`
|
|
56
|
+
- `getOmniusRunContext()`
|
|
57
|
+
- `requireOmniusRunContext()`
|
|
58
|
+
- `getTelegramRunContext()`
|
|
59
|
+
|
|
60
|
+
## Phased Implementation
|
|
61
|
+
|
|
62
|
+
### Phase 0: Concurrency Regression Tests
|
|
63
|
+
|
|
64
|
+
Tasks:
|
|
65
|
+
- Add tests that run two simulated Telegram messages concurrently and prove media/reply tools resolve the correct chat state.
|
|
66
|
+
- Add a test that no context is visible outside `runWithOmniusContext`.
|
|
67
|
+
|
|
68
|
+
Completion metrics:
|
|
69
|
+
- Current behavior is characterized before migration.
|
|
70
|
+
- Tests fail if global mutable context leaks across runs.
|
|
71
|
+
|
|
72
|
+
### Phase 1: Add Context Store
|
|
73
|
+
|
|
74
|
+
Tasks:
|
|
75
|
+
- Implement `AsyncLocalStorage<OmniusRunContext>`.
|
|
76
|
+
- Add small helpers and type guards.
|
|
77
|
+
- Keep it dependency-free.
|
|
78
|
+
|
|
79
|
+
File-by-file notes:
|
|
80
|
+
- `packages/orchestrator/src/runContext.ts` if runner and execution packages should share it.
|
|
81
|
+
- `packages/cli/src/tui/telegram-bridge.ts` imports helpers when spawning sub-agents.
|
|
82
|
+
- `packages/execution/src/tools/*` should not import CLI internals, so put shared helpers outside CLI if execution tools will consume them.
|
|
83
|
+
|
|
84
|
+
Completion metrics:
|
|
85
|
+
- Unit tests prove nested async calls retain the correct context.
|
|
86
|
+
- Missing context produces clear errors only in helpers that require it.
|
|
87
|
+
|
|
88
|
+
### Phase 2: Wrap Run Entrypoints
|
|
89
|
+
|
|
90
|
+
Tasks:
|
|
91
|
+
- Wrap Telegram sub-agent execution with context.
|
|
92
|
+
- Wrap Telegram quick-chat execution with context.
|
|
93
|
+
- Wrap REST/API run execution with context.
|
|
94
|
+
- Wrap background/scheduler execution if the owner id is available.
|
|
95
|
+
|
|
96
|
+
Completion metrics:
|
|
97
|
+
- Each run emits a context diagnostic with run id and surface.
|
|
98
|
+
- Existing tool behavior remains unchanged.
|
|
99
|
+
|
|
100
|
+
### Phase 3: Migrate Telegram Tools Incrementally
|
|
101
|
+
|
|
102
|
+
Tasks:
|
|
103
|
+
- Update tools that currently capture `currentMsg` to prefer task-local context:
|
|
104
|
+
- reply preference,
|
|
105
|
+
- image/media analysis,
|
|
106
|
+
- file send target defaults,
|
|
107
|
+
- reminder scope,
|
|
108
|
+
- identity memory media resolution.
|
|
109
|
+
- Keep explicit constructor arguments as fallback during migration.
|
|
110
|
+
|
|
111
|
+
Completion metrics:
|
|
112
|
+
- Tools work when called through current explicit path.
|
|
113
|
+
- Tests prove task-local path works without passing current message through every helper.
|
|
114
|
+
|
|
115
|
+
### Phase 4: Process Lease Integration
|
|
116
|
+
|
|
117
|
+
Tasks:
|
|
118
|
+
- When registering process leases, default `ownerKind`, `ownerId`, and `projectRoot` from current run context.
|
|
119
|
+
- Ensure child environment receives:
|
|
120
|
+
- `OMNIUS_PROCESS_LEASE_ID`,
|
|
121
|
+
- `OMNIUS_OWNER_ID`,
|
|
122
|
+
- `OMNIUS_PROJECT_ROOT`,
|
|
123
|
+
- optional `OMNIUS_RUN_ID`.
|
|
124
|
+
|
|
125
|
+
Completion metrics:
|
|
126
|
+
- Shell/background/API spawned children have correct owner fields without duplicate call-site logic.
|
|
127
|
+
- Process lifecycle tests still pass.
|
|
128
|
+
|
|
129
|
+
### Phase 5: Cleanup and Docs
|
|
130
|
+
|
|
131
|
+
Tasks:
|
|
132
|
+
- Remove redundant parameters only after all call sites are migrated.
|
|
133
|
+
- Document the context lifecycle and prohibited usage:
|
|
134
|
+
- never store mutable message objects long-term,
|
|
135
|
+
- never use context outside the current async run,
|
|
136
|
+
- never infer authorization from context alone.
|
|
137
|
+
|
|
138
|
+
Completion metrics:
|
|
139
|
+
- Docs exist under `docs/architecture/`.
|
|
140
|
+
- Source tests prevent direct global current-message variables if any are introduced.
|
|
141
|
+
|
|
142
|
+
## Required Tests
|
|
143
|
+
|
|
144
|
+
- Async context isolation under concurrent Telegram runs.
|
|
145
|
+
- No context outside wrapper.
|
|
146
|
+
- Telegram media tool resolves correct chat with context.
|
|
147
|
+
- API run context sets lease owner.
|
|
148
|
+
- Background task context sets lease owner.
|
|
149
|
+
|
|
150
|
+
## Rollout Plan
|
|
151
|
+
|
|
152
|
+
1. Add context store and tests.
|
|
153
|
+
2. Wrap run entrypoints.
|
|
154
|
+
3. Migrate read-only tools.
|
|
155
|
+
4. Migrate mutating tools with explicit authorization checks preserved.
|
|
156
|
+
5. Remove redundant plumbing.
|
|
157
|
+
|
|
158
|
+
## Risks
|
|
159
|
+
|
|
160
|
+
- Async context can be lost through unawaited promises. Mitigation: tests around timers, streaming callbacks, and tool executors.
|
|
161
|
+
- Authorization confusion. Mitigation: context identifies session but does not grant permission.
|
|
162
|
+
- Package dependency cycles. Mitigation: place shared context in orchestrator or a small shared package, not CLI.
|
|
163
|
+
|
|
164
|
+
## Definition of Done
|
|
165
|
+
|
|
166
|
+
- Current run context is available task-locally across Telegram, API, and background execution.
|
|
167
|
+
- Concurrent sessions do not bleed state.
|
|
168
|
+
- Tools can use context without importing Telegram bridge internals.
|
|
169
|
+
- Process leases can inherit owner metadata from context.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Process Lifecycle Monitoring Notifications Index
|
|
2
|
+
|
|
3
|
+
Progress: not started.
|
|
4
|
+
|
|
5
|
+
Files in this folder:
|
|
6
|
+
- [WORKORDER.md](WORKORDER.md) - Full phased implementation workorder.
|
|
7
|
+
|
|
8
|
+
Primary Omnius anchors:
|
|
9
|
+
- `packages/execution/src/process-lifecycle.ts:18` - 10 minute stale threshold.
|
|
10
|
+
- `packages/execution/src/process-lifecycle.ts:316` - lease registration.
|
|
11
|
+
- `packages/execution/src/process-lifecycle.ts:448` - lease sweep.
|
|
12
|
+
- `packages/execution/src/process-lifecycle.ts:556` - sweeper start.
|
|
13
|
+
- `packages/cli/src/api/serve.ts:6639` - scheduler kill route.
|
|
14
|
+
- `packages/cli/src/api/serve.ts:9139` - port holder handling.
|
|
15
|
+
- `packages/cli/src/daemon.ts:217` - daemon stop lease path.
|
|
16
|
+
|
|
17
|
+
Primary Hermes anchors:
|
|
18
|
+
- `/home/robit/Documents/repositories/hermes-agent/tools/process_registry.py:137` - Hermes process registry class.
|
|
19
|
+
- `/home/robit/Documents/repositories/hermes-agent/gateway/run.py:9621` - process watcher delivery path.
|
|
20
|
+
|
|
21
|
+
Completion target:
|
|
22
|
+
- Omnius keeps its registry-based kill authority, adds better watcher/notification coverage, and removes remaining pattern-only or direct legacy kill paths where lease ownership can be used.
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# Workorder: Process Lifecycle Monitoring Notifications
|
|
2
|
+
|
|
3
|
+
## Objective
|
|
4
|
+
|
|
5
|
+
Extend Omnius's registry-based process lifecycle architecture with active monitoring, user-visible diagnostics, and cleanup of remaining direct legacy kill paths. Keep the lease registry as the only authority for automatic stale process termination.
|
|
6
|
+
|
|
7
|
+
## Problem Statement
|
|
8
|
+
|
|
9
|
+
Omnius already has the stronger ownership model:
|
|
10
|
+
- durable leases,
|
|
11
|
+
- 10 minute stale threshold,
|
|
12
|
+
- identity verification,
|
|
13
|
+
- persistent lease support,
|
|
14
|
+
- sweeper lock and periodic cleanup.
|
|
15
|
+
|
|
16
|
+
The remaining opportunity from Hermes is not to replace that registry. It is to add watcher delivery, richer diagnostics, and to finish absorbing call sites that still use direct `process.kill` for stale or spawned work where a lease can be the authority.
|
|
17
|
+
|
|
18
|
+
## Existing Code Anchors
|
|
19
|
+
|
|
20
|
+
Omnius:
|
|
21
|
+
- `packages/execution/src/process-lifecycle.ts:18` sets `PROCESS_LEASE_STALE_MS = 10 * 60_000`.
|
|
22
|
+
- `packages/execution/src/process-lifecycle.ts:316` registers leases.
|
|
23
|
+
- `packages/execution/src/process-lifecycle.ts:448` sweeps stale leases.
|
|
24
|
+
- `packages/execution/src/process-lifecycle.ts:503` verifies process identity before kill.
|
|
25
|
+
- `packages/execution/src/process-lifecycle.ts:556` starts the periodic sweeper.
|
|
26
|
+
- `packages/execution/src/tools/shell.ts:426` creates shell lease ids.
|
|
27
|
+
- `packages/execution/src/tools/background-task.ts:45` creates background task lease ids.
|
|
28
|
+
- `packages/cli/src/api/serve.ts:6639` handles `/v1/scheduled/kill` through leases.
|
|
29
|
+
- `packages/cli/src/api/serve.ts:9139` handles stale port holders.
|
|
30
|
+
- `packages/cli/src/daemon.ts:217` stops daemon leases before direct signal.
|
|
31
|
+
- `packages/execution/tests/process-lifecycle.test.ts:120` covers stale lease kill.
|
|
32
|
+
- `packages/cli/tests/process-cleanup-regression.test.ts:37` asserts `/destroy processes` is registry-backed.
|
|
33
|
+
|
|
34
|
+
Hermes:
|
|
35
|
+
- `/home/robit/Documents/repositories/hermes-agent/tools/process_registry.py:137` defines `ProcessRegistry`.
|
|
36
|
+
- `/home/robit/Documents/repositories/hermes-agent/gateway/run.py:9621` drains pending process watchers.
|
|
37
|
+
|
|
38
|
+
## Target Architecture
|
|
39
|
+
|
|
40
|
+
Keep current lease registry APIs and add:
|
|
41
|
+
- watcher events emitted by sweeper:
|
|
42
|
+
- `lease_stale_detected`,
|
|
43
|
+
- `lease_kill_attempted`,
|
|
44
|
+
- `lease_killed`,
|
|
45
|
+
- `lease_suspect_unverified`,
|
|
46
|
+
- `legacy_untracked_reported`.
|
|
47
|
+
- a diagnostic endpoint and TUI summary:
|
|
48
|
+
- active leases,
|
|
49
|
+
- stale leases,
|
|
50
|
+
- suspect leases,
|
|
51
|
+
- untracked report-only Omnius-like processes,
|
|
52
|
+
- last sweep summary.
|
|
53
|
+
- adoption hooks for reliable legacy records only:
|
|
54
|
+
- daemon pid files,
|
|
55
|
+
- scheduler job records,
|
|
56
|
+
- expose state,
|
|
57
|
+
- Nexus pid files,
|
|
58
|
+
- in-flight chat records.
|
|
59
|
+
|
|
60
|
+
## Phased Implementation
|
|
61
|
+
|
|
62
|
+
### Phase 0: Direct Kill Inventory
|
|
63
|
+
|
|
64
|
+
Tasks:
|
|
65
|
+
- Audit every `process.kill` in CLI/API/daemon code.
|
|
66
|
+
- Classify each call as:
|
|
67
|
+
- liveness probe,
|
|
68
|
+
- current process shutdown,
|
|
69
|
+
- leased child kill,
|
|
70
|
+
- legacy direct kill needing migration,
|
|
71
|
+
- report-only diagnostic.
|
|
72
|
+
|
|
73
|
+
Completion metrics:
|
|
74
|
+
- A short inventory exists in the work PR.
|
|
75
|
+
- Source tests cover the highest-risk paths.
|
|
76
|
+
|
|
77
|
+
### Phase 1: Sweeper Watcher Events
|
|
78
|
+
|
|
79
|
+
Tasks:
|
|
80
|
+
- Add optional callback to `startProcessLeaseSweeper` and `sweepProcessLeases`.
|
|
81
|
+
- Emit structured events for every sweep action.
|
|
82
|
+
- Keep event emission best-effort and never block cleanup.
|
|
83
|
+
|
|
84
|
+
File-by-file notes:
|
|
85
|
+
- `packages/execution/src/process-lifecycle.ts`: add event callback type.
|
|
86
|
+
- `packages/execution/tests/process-lifecycle.test.ts`: assert watcher callback receives stale, killed, and suspect actions.
|
|
87
|
+
|
|
88
|
+
Completion metrics:
|
|
89
|
+
- Sweeper emits action list and summary.
|
|
90
|
+
- Test fake system verifies callbacks without real process kills.
|
|
91
|
+
|
|
92
|
+
### Phase 2: TUI/API Diagnostics
|
|
93
|
+
|
|
94
|
+
Tasks:
|
|
95
|
+
- Add API endpoint:
|
|
96
|
+
- `GET /v1/processes/leases`
|
|
97
|
+
- optional `POST /v1/processes/sweep`
|
|
98
|
+
- Add TUI `/destroy processes` output sections:
|
|
99
|
+
- killed registered leases,
|
|
100
|
+
- active leases,
|
|
101
|
+
- suspect unverified,
|
|
102
|
+
- untracked report-only diagnostics.
|
|
103
|
+
- Keep `/destroy processes --global` lease registry only; no pattern-authorized kills.
|
|
104
|
+
|
|
105
|
+
Completion metrics:
|
|
106
|
+
- `/destroy processes` output clearly distinguishes killed vs report-only.
|
|
107
|
+
- Unleased Omnius-like processes are never killed automatically.
|
|
108
|
+
- Tests assert response shape and no pattern kill path.
|
|
109
|
+
|
|
110
|
+
### Phase 3: Migrate Remaining Legacy Kill Paths
|
|
111
|
+
|
|
112
|
+
Tasks:
|
|
113
|
+
- For child processes spawned by API `/v1/run`, chat runs, installers, expose, Nexus, voice/model helpers, ensure registration exists before spawn can outlive the parent.
|
|
114
|
+
- Replace direct deadline kills with `stopProcessLease` when a lease exists.
|
|
115
|
+
- Keep direct signal only as fallback for current-process shutdown or when no lease exists and the action is explicitly user-owned.
|
|
116
|
+
|
|
117
|
+
High-priority anchors:
|
|
118
|
+
- `packages/cli/src/api/serve.ts:3627` direct child deadline kill.
|
|
119
|
+
- `packages/cli/src/api/serve.ts:4411` RCA/job child kill.
|
|
120
|
+
- `packages/cli/src/api/serve.ts:4779` task cascade kill.
|
|
121
|
+
- `packages/cli/src/api/serve.ts:7294` chat run deadline kill.
|
|
122
|
+
- `packages/cli/src/api/serve.ts:9139` port holder handling.
|
|
123
|
+
- `packages/cli/src/daemon.ts:241` pid-file direct kill.
|
|
124
|
+
|
|
125
|
+
Completion metrics:
|
|
126
|
+
- Any automatic kill of a spawned child uses a lease when one exists.
|
|
127
|
+
- PID-file adoption marks reliable records before kill where possible.
|
|
128
|
+
- Source tests block new pattern-authorized kill functions.
|
|
129
|
+
|
|
130
|
+
### Phase 4: Reliable Adoption
|
|
131
|
+
|
|
132
|
+
Tasks:
|
|
133
|
+
- Add adoption helpers per reliable source:
|
|
134
|
+
- `adoptDaemonPidFileLease`,
|
|
135
|
+
- `adoptSchedulerLease`,
|
|
136
|
+
- `adoptExposeLease`,
|
|
137
|
+
- `adoptNexusLease`,
|
|
138
|
+
- `adoptInFlightChatLease`.
|
|
139
|
+
- Adoption must record original source and identity basis.
|
|
140
|
+
- Adoption failure produces `suspect_unverified` or report-only output, not kill.
|
|
141
|
+
|
|
142
|
+
Completion metrics:
|
|
143
|
+
- Pre-registry daemon pid can be adopted when identity matches.
|
|
144
|
+
- Unreadable or mismatched PID is report-only.
|
|
145
|
+
- Tests cover PID reuse protection.
|
|
146
|
+
|
|
147
|
+
### Phase 5: Notifications and Rate Limits
|
|
148
|
+
|
|
149
|
+
Tasks:
|
|
150
|
+
- Send compact TUI notification when sweeper kills stale Omnius-owned children.
|
|
151
|
+
- Admin Telegram may optionally receive a summary for high-severity repeated stale cleanup if configured.
|
|
152
|
+
- Rate-limit notifications to avoid chat noise.
|
|
153
|
+
|
|
154
|
+
Completion metrics:
|
|
155
|
+
- Operators see cleanup summaries without flooding.
|
|
156
|
+
- Notification includes lease id, owner, lifecycle, reason, and action.
|
|
157
|
+
|
|
158
|
+
## Required Tests
|
|
159
|
+
|
|
160
|
+
- Active task lease survives sweep.
|
|
161
|
+
- Heartbeat-stale task lease is killed after identity verification.
|
|
162
|
+
- Completed owner kills non-persistent children.
|
|
163
|
+
- Persistent scheduler/reminder lease survives.
|
|
164
|
+
- Expired persistent lease is killed.
|
|
165
|
+
- Unverified PID is reported but not killed.
|
|
166
|
+
- Watcher callback receives action events.
|
|
167
|
+
- Legacy pid adoption succeeds only from reliable files.
|
|
168
|
+
- `/destroy processes` and `/scheduler kill` remain registry-backed.
|
|
169
|
+
|
|
170
|
+
## Rollout Plan
|
|
171
|
+
|
|
172
|
+
1. Add watcher callbacks and diagnostics without changing kill behavior.
|
|
173
|
+
2. Add endpoint/TUI summaries.
|
|
174
|
+
3. Migrate direct child kills one call site at a time.
|
|
175
|
+
4. Add reliable adoption.
|
|
176
|
+
5. Add optional Telegram/admin notifications.
|
|
177
|
+
|
|
178
|
+
## Risks
|
|
179
|
+
|
|
180
|
+
- Killing wrong process if adoption is too broad. Mitigation: adopt only from reliable records and retain identity verification.
|
|
181
|
+
- Leaking stale children during migration. Mitigation: source tests and sweep diagnostics.
|
|
182
|
+
- Notification noise. Mitigation: rate limit and admin-only delivery.
|
|
183
|
+
|
|
184
|
+
## Definition of Done
|
|
185
|
+
|
|
186
|
+
- Automatic cleanup only kills verified registered/adopted leases.
|
|
187
|
+
- Remaining direct kills are documented as current-process or explicit user-owned actions.
|
|
188
|
+
- Sweeper activity is observable through API/TUI and tests.
|
|
189
|
+
- Legacy Omnius-like processes are report-only unless ownership is reliable.
|
package/docs/work-orders/hermes-architecture-deltas/06-vision-evidence-routing-ladder/INDEX.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Vision Evidence Routing Ladder Index
|
|
2
|
+
|
|
3
|
+
Progress: not started.
|
|
4
|
+
|
|
5
|
+
Files in this folder:
|
|
6
|
+
- [WORKORDER.md](WORKORDER.md) - Full phased implementation workorder.
|
|
7
|
+
|
|
8
|
+
Primary Omnius anchors:
|
|
9
|
+
- `packages/cli/src/tui/telegram-bridge.ts:1275` - public Telegram vision/media stack prompt.
|
|
10
|
+
- `packages/cli/src/tui/telegram-bridge.ts:16807` - Telegram image analysis tool.
|
|
11
|
+
- `packages/cli/src/tui/telegram-bridge.ts:17393` - Telegram media processing.
|
|
12
|
+
- `packages/execution/src/tools/vision.ts` - core vision tool.
|
|
13
|
+
- `packages/execution/src/tools/ocr-image-advanced.ts` - OCR tool.
|
|
14
|
+
- `packages/cli/tests/telegram-media-evidence.test.ts` - Telegram media evidence tests.
|
|
15
|
+
|
|
16
|
+
Primary Hermes anchors:
|
|
17
|
+
- `/home/robit/Documents/repositories/hermes-agent/tools/computer_use/vision_routing.py:118` - capture routing decision.
|
|
18
|
+
- `/home/robit/Documents/repositories/hermes-agent/tools/vision_tools.py:599` - native vision fast-path check.
|
|
19
|
+
- `/home/robit/Documents/repositories/hermes-agent/tools/vision_tools.py:797` - auxiliary vision analysis tool.
|
|
20
|
+
|
|
21
|
+
Completion target:
|
|
22
|
+
- Telegram and tool callers resolve image input reliably and choose cheap observation, OCR, or auxiliary vision from the request-derived evidence need.
|