omp-superagent 0.1.10 → 0.1.11

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 (149) hide show
  1. package/DESIGN.md +58 -15
  2. package/README.ko.md +7 -0
  3. package/README.md +7 -0
  4. package/THIRD_PARTY_NOTICES.md +35 -436
  5. package/assets/architecture-dark.svg +7 -12
  6. package/assets/architecture.ko-dark.svg +7 -12
  7. package/assets/architecture.ko.svg +7 -12
  8. package/assets/architecture.mmd +5 -13
  9. package/assets/architecture.svg +7 -12
  10. package/config.example.json +1 -0
  11. package/docs/OPERATIONS.en.md +106 -52
  12. package/docs/OPERATIONS.md +98 -44
  13. package/docs/design/execution.md +80 -52
  14. package/docs/design/messaging.md +113 -32
  15. package/docs/releases/0.1.11.md +18 -0
  16. package/gateway/bin/omp-gateway-darwin-arm64 +0 -0
  17. package/gateway/bin/omp-gateway-darwin-x64 +0 -0
  18. package/gateway/bin/omp-gateway-linux-arm64 +0 -0
  19. package/gateway/bin/omp-gateway-linux-x64 +0 -0
  20. package/host-owner/bin/omp-host-owner-darwin-arm64 +0 -0
  21. package/host-owner/bin/omp-host-owner-darwin-x64 +0 -0
  22. package/host-owner/bin/omp-host-owner-linux-arm64 +0 -0
  23. package/host-owner/bin/omp-host-owner-linux-x64 +0 -0
  24. package/package.json +10 -11
  25. package/scripts/{prepare-ulw.ts → prepare-super.ts} +1 -1
  26. package/skills/head/SKILL.md +12 -3
  27. package/skills/head/references/routing.md +1 -1
  28. package/skills/head/references/supervision.md +23 -26
  29. package/skills/lane/SKILL.md +28 -21
  30. package/skills/lane/references/workflow.md +15 -17
  31. package/src/cli.ts +33 -33
  32. package/src/{config.ts → config/config.ts} +7 -3
  33. package/src/config/wake-config.ts +36 -0
  34. package/src/contracts.ts +61 -12
  35. package/src/{cron-jobs.ts → cron/cron-jobs.ts} +21 -13
  36. package/src/{cron-pr-intake.ts → cron/cron-pr-intake.ts} +4 -4
  37. package/src/{cron-schedule.ts → cron/cron-schedule.ts} +3 -3
  38. package/src/extension.ts +43 -25
  39. package/src/{gateway-client.ts → gateway/gateway-client.ts} +89 -32
  40. package/src/{gateway-native.ts → gateway/gateway-native.ts} +4 -4
  41. package/src/{gateway-protocol.ts → gateway/gateway-protocol.ts} +69 -14
  42. package/src/{gateway-wire.ts → gateway/gateway-wire.ts} +12 -7
  43. package/src/gateway-config.ts +1 -1
  44. package/src/gateway-restart-env.ts +3 -3
  45. package/src/{group-access.ts → group/group-access.ts} +8 -3
  46. package/src/{group-policy.ts → group/group-policy.ts} +2 -2
  47. package/src/{group-runner.ts → group/group-runner.ts} +11 -6
  48. package/src/host-extension.ts +164 -36
  49. package/src/host-sdk-helper.ts +62 -65
  50. package/src/{decision-tool.ts → lane/decision-tool.ts} +12 -4
  51. package/src/{decisions.ts → lane/decisions.ts} +12 -10
  52. package/src/{lane-models.ts → lane/lane-models.ts} +1 -1
  53. package/src/{lane-rows.ts → lane/lane-rows.ts} +2 -2
  54. package/src/{lane-watch.ts → lane/lane-watch.ts} +6 -2
  55. package/src/{workflow.ts → lane/workflow.ts} +1 -1
  56. package/src/lane-extension.ts +25 -7
  57. package/src/managed-memory-helper.ts +2 -2
  58. package/src/{managed-ulw-probe.ts → managed-super-probe.ts} +3 -3
  59. package/src/{delivery.ts → messaging/delivery.ts} +1 -1
  60. package/src/{discord-command-registration.ts → messaging/discord-command-registration.ts} +3 -2
  61. package/src/{discord-context.ts → messaging/discord-context.ts} +1 -1
  62. package/src/{messenger-command-catalog.json → messaging/messenger-command-catalog.json} +1 -0
  63. package/src/messaging/messenger-commands.ts +55 -0
  64. package/src/{result-attachment.ts → messaging/result-attachment.ts} +3 -3
  65. package/src/{slack-command-registration.ts → messaging/slack-command-registration.ts} +3 -3
  66. package/src/{telegram-command-registration.ts → messaging/telegram-command-registration.ts} +2 -2
  67. package/src/omp/head-resume.ts +123 -0
  68. package/src/{host-owner-path.ts → omp/host-owner-path.ts} +1 -1
  69. package/src/{host-protocol.ts → omp/host-protocol.ts} +10 -2
  70. package/src/{host-superkit.ts → omp/host-superkit.ts} +1 -1
  71. package/src/{host.ts → omp/host.ts} +26 -17
  72. package/src/{installed-omp.ts → omp/installed-omp.ts} +1 -1
  73. package/src/{managed-memory.ts → omp/managed-memory.ts} +2 -2
  74. package/src/{managed-ulw.ts → omp/managed-super.ts} +42 -16
  75. package/src/omp/native-journal.ts +124 -0
  76. package/src/{native-launch-profile.ts → omp/native-launch-profile.ts} +6 -2
  77. package/src/{native-presets.ts → omp/native-presets.ts} +2 -2
  78. package/src/omp/native-sessions.ts +124 -0
  79. package/src/{omp-usage.ts → omp/omp-usage.ts} +1 -1
  80. package/src/{soul.ts → omp/soul.ts} +2 -2
  81. package/src/omp/stock-head-launch.ts +31 -0
  82. package/src/{autostart.ts → operator/autostart.ts} +3 -3
  83. package/src/{operator.ts → operator/operator.ts} +2 -2
  84. package/src/{setup-judge.ts → operator/setup-judge.ts} +1 -1
  85. package/src/{setup-profiles.ts → operator/setup-profiles.ts} +2 -2
  86. package/src/{setup.ts → operator/setup.ts} +5 -5
  87. package/src/{pr-intake-automation.ts → pr/pr-intake-automation.ts} +1 -1
  88. package/src/{pr-intake-mode.ts → pr/pr-intake-mode.ts} +3 -3
  89. package/src/{pr-intake-review.ts → pr/pr-intake-review.ts} +5 -5
  90. package/src/{pr-intake-work.ts → pr/pr-intake-work.ts} +1 -1
  91. package/src/{pr-review-models.ts → pr/pr-review-models.ts} +2 -2
  92. package/src/{pr-watch.ts → pr/pr-watch.ts} +36 -26
  93. package/src/{message-order.ts → routing/message-order.ts} +1 -1
  94. package/src/{topic-history.ts → routing/topic-history.ts} +2 -2
  95. package/src/{topic-request.ts → routing/topic-request.ts} +4 -2
  96. package/src/{runtime.ts → runtime/controller.ts} +867 -1213
  97. package/src/runtime/deferred-routing.ts +106 -0
  98. package/src/runtime/dm-timeline.ts +194 -0
  99. package/src/{head-recovery.ts → runtime/head-recovery.ts} +1 -1
  100. package/src/{head-rotation.ts → runtime/head-rotation.ts} +32 -5
  101. package/src/runtime/model-journal.ts +119 -0
  102. package/src/runtime/native-frames.ts +131 -0
  103. package/src/{observation-request.ts → runtime/observation-request.ts} +1 -1
  104. package/src/runtime/preset-sync.ts +232 -0
  105. package/src/runtime/preset-watch-paths.ts +137 -0
  106. package/src/runtime/result-attachments.ts +146 -0
  107. package/src/storage/deferred-routing.ts +149 -0
  108. package/src/{store.ts → storage/store.ts} +75 -42
  109. package/src/{worker-bridge.ts → worker/worker-bridge.ts} +2 -2
  110. package/src/{worker-enrollment.ts → worker/worker-enrollment.ts} +2 -2
  111. package/src/{worker-host.ts → worker/worker-host.ts} +7 -3
  112. package/src/{worker-placement.ts → worker/worker-placement.ts} +1 -1
  113. package/src/{worker-profile.ts → worker/worker-profile.ts} +1 -1
  114. package/src/{worker-registration.ts → worker/worker-registration.ts} +2 -2
  115. package/src/{worker-request.ts → worker/worker-request.ts} +5 -5
  116. package/src/{worker-service.ts → worker/worker-service.ts} +2 -2
  117. package/src/{worker-trust.ts → worker/worker-trust.ts} +1 -1
  118. package/src/{worker-wire.ts → worker/worker-wire.ts} +3 -3
  119. package/src/worker-serve-prepare.ts +4 -4
  120. package/src/board-extension.ts +0 -217
  121. package/src/board.ts +0 -467
  122. package/src/gateway-host-helper.ts +0 -13
  123. package/src/messenger-commands.ts +0 -15
  124. package/src/native-sessions.ts +0 -34
  125. /package/src/{credentials.ts → config/credentials.ts} +0 -0
  126. /package/src/{lane-report.ts → lane/lane-report.ts} +0 -0
  127. /package/src/{dialog.ts → messaging/dialog.ts} +0 -0
  128. /package/src/{telegram-command-languages.json → messaging/telegram-command-languages.json} +0 -0
  129. /package/src/{host-broker-services.ts → omp/host-broker-services.ts} +0 -0
  130. /package/src/{host-inventory-manifest.ts → omp/host-inventory-manifest.ts} +0 -0
  131. /package/src/{host-reply-voice.ts → omp/host-reply-voice.ts} +0 -0
  132. /package/src/{host-services.ts → omp/host-services.ts} +0 -0
  133. /package/src/{native-settings.ts → omp/native-settings.ts} +0 -0
  134. /package/src/{superkit-skills.ts → omp/superkit-skills.ts} +0 -0
  135. /package/src/{repository.ts → operator/repository.ts} +0 -0
  136. /package/src/{pr-github-schema.ts → pr/pr-github-schema.ts} +0 -0
  137. /package/src/{pr-github.ts → pr/pr-github.ts} +0 -0
  138. /package/src/{pr-intake-comment.ts → pr/pr-intake-comment.ts} +0 -0
  139. /package/src/{pr-intake-fix.ts → pr/pr-intake-fix.ts} +0 -0
  140. /package/src/{pr-intake-github.ts → pr/pr-intake-github.ts} +0 -0
  141. /package/src/{pr-intake-material.ts → pr/pr-intake-material.ts} +0 -0
  142. /package/src/{pr-intake-tree.ts → pr/pr-intake-tree.ts} +0 -0
  143. /package/src/{head-quota.ts → runtime/head-quota.ts} +0 -0
  144. /package/src/{worker-checkout.ts → worker/worker-checkout.ts} +0 -0
  145. /package/src/{worker-destination.ts → worker/worker-destination.ts} +0 -0
  146. /package/src/{worker-doctor.ts → worker/worker-doctor.ts} +0 -0
  147. /package/src/{worker-ledger.ts → worker/worker-ledger.ts} +0 -0
  148. /package/src/{worker-repository.ts → worker/worker-repository.ts} +0 -0
  149. /package/upstream/{ulw.json → super.json} +0 -0
package/DESIGN.md CHANGED
@@ -18,28 +18,32 @@ or lanes. This is not a multitenant service or an OS sandbox.
18
18
  - [Messaging and authority](docs/design/messaging.md): ingress, routing, controls,
19
19
  approvals, recovery, delivery, and Discord voice.
20
20
  - [Execution and coordination](docs/design/execution.md): lanes, native Host lifecycle,
21
- models, workflows, managed integration, monitoring, and the board.
21
+ models, workflows, managed integration, monitoring, and direct lane coordination.
22
22
  - Setup and operations ([English](docs/OPERATIONS.en.md) · [한국어](docs/OPERATIONS.md)): configuration, commands, and recovery procedures.
23
23
  - [Versioned release records](docs/releases/): dated evidence and its limits.
24
24
 
25
25
  <picture>
26
26
  <source media="(prefers-color-scheme: dark)" srcset="assets/architecture-dark.svg">
27
27
  <source media="(prefers-color-scheme: light)" srcset="assets/architecture.svg">
28
- <img src="assets/architecture.svg" width="100%" alt="One Gateway connects the messengers to the head. The head controls independent lanes and shares an informational board with them.">
28
+ <img src="assets/architecture.svg" width="100%" alt="One Gateway connects the messengers to the head controller, which routes bound topics directly and coordinates independent lanes.">
29
29
  </picture>
30
30
 
31
31
  [Mermaid source](assets/architecture.mmd)
32
32
 
33
33
  ## Ownership and source map
34
34
 
35
+ `src/` keeps the executable CLI and the extension/helper entry points that installed
36
+ launchers and managed Hosts load by path. Their implementations and shared modules
37
+ are grouped by feature below it. `runtime/` owns HEAD coordination; `storage/`
38
+ owns its durable state. Moving a module does not transfer authority to the Gateway.
39
+
35
40
  | Component | Responsibility | Entry points |
36
41
  | --- | --- | --- |
37
- | CLI and setup | Configuration, credentials, doctor, start/status/stop and one-shot macOS registration. | [CLI](src/cli.ts), [config](src/config.ts), [setup](src/setup.ts), [credentials](src/credentials.ts), [autostart](src/autostart.ts) |
38
- | Gateway | One Rust process authenticates the configured adapters, admits intake durably, proxies scoped messenger effects and supervises exactly one head. It never connects to lane RPC or decides work. | [Gateway](gateway/src/main.rs), [server](gateway/src/server.rs), [ingress ledger](gateway/src/store.rs), [client](src/gateway-client.ts), [adapter hub](gateway/src/adapter.rs) |
39
- | Head | Its controller owns intake, placement, approvals and delivery. The shared model handles ordinary unbound requests, explicit `/head` work and manager coordination, not ordinary bound-topic prompts or their answers. | [Head extension](src/extension.ts), [runtime](src/runtime.ts), [coordination store](src/store.ts) |
40
- | Lane | Runs work in its own native session with its own cwd, model and context. Topic answers go through the controller outbox without a shared-model synthesis turn; manager handoffs report to the head. Neither sends directly to a messenger. | [Lane extension](src/lane-extension.ts), [lane reporting](src/lane-report.ts), [role instructions](skills/lane/SKILL.md) |
41
- | Host | One installed OMP process owns each managed root session. A detached Rust process owns its stdin/stdout and private reconnectable socket; it does not run inference, tools, or supervision policy. | [Host client](src/host.ts), [stdio owner](host-owner/src/main.rs), [SDK helper](src/host-sdk-helper.ts), [native lifecycle extension](src/host-extension.ts) |
42
- | Board | An informational log in `coordination.sqlite` shared by registered head/lane sessions in the same instance. Not a command, approval, or delivery bus. | [Board](src/board.ts), [board extension](src/board-extension.ts) |
42
+ | CLI and setup | Configuration, credentials, doctor, start/status/stop and one-shot macOS registration. | [CLI](src/cli.ts), [config](src/config/config.ts), [setup](src/operator/setup.ts), [credentials](src/config/credentials.ts), [autostart](src/operator/autostart.ts) |
43
+ | Gateway | One Rust process authenticates the configured adapters, admits intake durably, proxies scoped messenger effects and supervises exactly one head. It never connects to lane RPC or decides work. | [Gateway](gateway/src/main.rs), [server](gateway/src/server.rs), [ingress ledger](gateway/src/store.rs), [client](src/gateway/gateway-client.ts), [adapter hub](gateway/src/adapter.rs) |
44
+ | Head | Its controller owns intake, placement, approvals and delivery. The shared model handles ordinary unbound requests, explicit `/head` work and manager coordination, not ordinary bound-topic prompts or their answers. | [Head extension](src/extension.ts), [runtime](src/runtime/controller.ts), [coordination store](src/storage/store.ts) |
45
+ | Lane | Runs work in its own native session with its own cwd, model and context. Topic answers go through the controller outbox without a shared-model synthesis turn; manager handoffs report to the head. Neither sends directly to a messenger. | [Lane extension](src/lane-extension.ts), [lane reporting](src/lane/lane-report.ts), [role instructions](skills/lane/SKILL.md) |
46
+ | Host | One installed OMP process owns each managed root session. A detached Rust process owns its stdin/stdout and private reconnectable socket; it does not run inference, tools, or supervision policy. | [Host client](src/omp/host.ts), [stdio owner](host-owner/src/main.rs), [SDK helper](src/host-sdk-helper.ts), [native lifecycle extension](src/host-extension.ts) |
43
47
 
44
48
  OMP owns transcripts, tool history, goals, child tasks, provider auth, and native
45
49
  execution records. Superagent stores the coordination facts needed to recover work:
@@ -47,8 +51,8 @@ intake and receipts, topic bindings, requests and lanes, approvals and delivery
47
51
  outcomes. `coordination.sqlite` is shared by Gateway and head with independent
48
52
  connections. It is not a second OMP transcript. The private Unix sockets under the
49
53
  canonical `stateDir` are instance-owned, not arbitrary URLs or a general RPC proxy.
50
- Native children get neither the manager nor the board. Managed extensions are not
51
- installed globally into ordinary OMP.
54
+ Native children cannot manage lanes, report as a root lane, or request tracked
55
+ decisions. Managed extensions are not installed globally into ordinary OMP.
52
56
 
53
57
  The operator CLI is still Bun, not a second resident Gateway. Command registration
54
58
  and confirmed avatar setup invoke a one-shot Rust REST client with credentials
@@ -73,8 +77,8 @@ part of the native build.
73
77
  2. `start` requires a valid active managed integration and starts or reuses one
74
78
  detached Gateway. A lifetime lock establishes single ownership. The Gateway starts
75
79
  or reconnects to the designated head through private local transport; the root
76
- head loads the manager and board extensions, a root lane loads the lane and board
77
- extensions. The Gateway owns configured messenger secrets and removes their
80
+ head loads the manager extension and a root lane loads the lane extension.
81
+ The Gateway owns configured messenger secrets and removes their
78
82
  environment variables from the managed Hosts; this is not isolation from the OS user.
79
83
  Gateway start/restart and new Host launches enforce the
80
84
  [native memory preflight](docs/design/execution.md#native-memory-preflight):
@@ -103,6 +107,45 @@ part of the native build.
103
107
  no `KeepAlive`, immediate activation, or second supervisor. `uninstall` removes
104
108
  only future startup. There is no Linux service installer or Windows support.
105
109
 
110
+ ### Idle HEAD hibernation
111
+
112
+ `headIdleMs` controls how long a fully idle HEAD stays resident (default 30
113
+ minutes; `0` disables hibernation). It is independent of lane eviction. Only
114
+ the Host and its stdio owner exit: the same Rust Gateway keeps its messenger
115
+ connections and durable ingress. A registered but unloaded lane does not
116
+ need to be started to park HEAD. An active or unverified lane, scheduled work,
117
+ pending approval, unresolved delivery, or other work needing the controller
118
+ prevents hibernation.
119
+
120
+ If both checks are due and HEAD also qualifies for the existing high-context
121
+ rotation, rotation takes precedence. Hibernation itself never selects a new journal.
122
+
123
+ Before reporting `head.hibernation.stage: "sleeping"`, the Gateway fences
124
+ dispatch and verifies the original Host's clean journal receipt and both
125
+ process exits. A surviving older Host must explicitly attest to hibernation;
126
+ an ordinary rotation response is not sufficient. An authenticated event arriving
127
+ across this boundary stays in the Gateway queue. On demand, one replacement
128
+ reopens the **same** journal in the **same native profile** and verifies the
129
+ model selection before dispatch resumes. The helper and the live Host verify
130
+ both the agent directory and the native data and session-discovery roots.
131
+ The Gateway does not expose its controller socket until all configured adapters
132
+ have authenticated. A wake stays `launching` until the verified replacement's
133
+ connected controller reaches `/ready`; probing the native PID is not completion.
134
+ If the config changes during wake, restoring the exact reserved bytes allows
135
+ that controller to continue without a second launch or replay. An older checkpoint without an
136
+ attested profile remains held: a matching configuration hash or an operator
137
+ stop cannot reconstruct its original profile identity.
138
+ If the Host starts before its Gateway, it waits to attach; this never retries
139
+ a prompt or a messenger effect.
140
+ A fresh Discord login after a lost session or a Slack Socket Mode reconnect
141
+ also wakes HEAD to check for messages missed offline. A replayed Discord
142
+ connection or Telegram's own polling recovery does not require this wake.
143
+ An ordinary wake does not give history priority over already queued messages.
144
+ An actual history gap requires a scan covering the gap, not one that passed
145
+ the route before the reconnect. Neither a CLI `status` read nor an explicit
146
+ Gateway stop is demand for a Host. A proved failure to create the child releases
147
+ only that launch reservation; an uncertain shutdown or launch stays fenced.
148
+
106
149
  ### Idle head rotation
107
150
 
108
151
  The Gateway may replace only the designated head after the runtime attests at
@@ -174,9 +217,9 @@ lifecycle control, not a model turn. It can be admitted while the head is busy:
174
217
 
175
218
  ## Stock OMP and verification scope
176
219
 
177
- The [package manifest](package.json) pins the published SDK to **19.1.1**, with
178
- upstream [v19.1.1 source](https://github.com/can1357/oh-my-pi/commit/31ffee513f27a01bba7d4dfbe12bae239cdc646a).
179
- That pin is not a CLI version allowlist. [CLI inspection](src/installed-omp.ts)
220
+ The [package manifest](package.json) pins the published SDK to **19.2.1**, with
221
+ upstream [v19.2.1 source](https://github.com/can1357/oh-my-pi/commit/b55cd1bb664d8ab46ddc77f2a34eb47555dbf1ac).
222
+ That pin is not a CLI version allowlist. [CLI inspection](src/omp/installed-omp.ts)
180
223
  checks CLI identity, public `rpc-ui`, resume, extension and model flags, and the
181
224
  advertised process interface. A process reuses an inspection only while the
182
225
  configured executable's resolved regular file (path, device, inode, size, mtime,
package/README.ko.md CHANGED
@@ -36,6 +36,13 @@
36
36
  - **메신저 연결과 모델 실행 분리.** Gateway가 요청을 저장하고 헤드의 수명을 관리합니다. 세션·도구·인증·승인은 순정 OMP가 맡습니다.
37
37
  - **로컬 또는 [SSH 워커](#원격-워커-추가)에서 레인 실행.** 설정된 모든 소유자는 같은 신뢰된 운영자로 취급합니다. 멀티테넌트 서비스나 OS 샌드박스가 아닙니다.
38
38
 
39
+ ## 아키텍처
40
+
41
+ <picture>
42
+ <source media="(prefers-color-scheme: dark)" srcset="assets/architecture.ko-dark.svg">
43
+ <img src="assets/architecture.ko.svg" width="100%" alt="메신저는 Gateway에 연결됩니다. 헤드는 요청을 처리하고 독립 레인에 작업을 맡기며, 레인은 결과를 헤드에 보고합니다.">
44
+ </picture>
45
+
39
46
  ## 빠른 시작
40
47
 
41
48
  ### 1. 설치
package/README.md CHANGED
@@ -37,6 +37,13 @@
37
37
  - **Keep chat connected without keeping a model busy.** The Gateway persists intake and manages HEAD's lifecycle. OMP still owns sessions, tools, authentication, and approvals; no core fork is required.
38
38
  - **Run lanes locally or on an [enrolled SSH worker](#add-a-remote-worker).** All configured owners are treated as one trusted operator. This is not a multitenant service or an OS sandbox.
39
39
 
40
+ ## Architecture
41
+
42
+ <picture>
43
+ <source media="(prefers-color-scheme: dark)" srcset="assets/architecture-dark.svg">
44
+ <img src="assets/architecture.svg" width="100%" alt="Messengers connect to the Gateway. HEAD handles requests and coordinates independent lanes, which report back to HEAD.">
45
+ </picture>
46
+
40
47
  ## Quick start
41
48
 
42
49
  ### 1. Install