omp-superagent 0.1.15 → 0.1.16
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/docs/OPERATIONS.en.md +21 -0
- package/docs/OPERATIONS.md +20 -0
- package/docs/design/execution.md +19 -0
- package/docs/design/messaging.md +17 -1
- package/docs/releases/0.1.16.md +9 -0
- package/gateway/bin/omp-gateway-darwin-arm64 +0 -0
- package/gateway/bin/omp-gateway-darwin-x64 +0 -0
- package/gateway/bin/omp-gateway-linux-arm64 +0 -0
- package/gateway/bin/omp-gateway-linux-x64 +0 -0
- package/package.json +1 -1
- package/skills/head/SKILL.md +7 -0
- package/skills/head/references/routing.md +24 -4
- package/src/config/config.ts +10 -0
- package/src/contracts.ts +4 -3
- package/src/extension.ts +12 -10
- package/src/gateway/gateway-client.ts +10 -3
- package/src/messaging/discord-work-thread.ts +36 -0
- package/src/runtime/controller.ts +281 -65
- package/src/runtime/head-superstack.ts +83 -0
- package/src/runtime/result-attachments.ts +3 -1
- package/src/storage/store.ts +28 -1
package/docs/OPERATIONS.en.md
CHANGED
|
@@ -152,6 +152,13 @@ commands. Pass `jevify` or one of the six names above and a nonempty reason in t
|
|
|
152
152
|
`workflow: {name, reason}` argument to `lane_start` or `lane_message`. Legacy ULW invocations
|
|
153
153
|
are supported only in the original user request, not as new structured selections.
|
|
154
154
|
|
|
155
|
+
Send `/head /superstack <task>` as message text to enable Superstack for the
|
|
156
|
+
shared HEAD's current branch and route the task using the managed skill.
|
|
157
|
+
`/head /superstack` and `/head /superstack off` wait for that Host to become fully
|
|
158
|
+
idle, then enable or disable the mode without starting work.
|
|
159
|
+
It is not a lane workflow or a registered messenger command. An older running
|
|
160
|
+
Host may not have the command; it keeps its launch-time Superkit revision until replaced.
|
|
161
|
+
|
|
155
162
|
Existing source, provenance, and deduplication behavior is preserved. Workflow selection
|
|
156
163
|
is a serialized dispatch, not steering while execution is underway. For a SUPER workflow,
|
|
157
164
|
record why it is more useful than a lighter option and read the selected skill. Invocation
|
|
@@ -1122,6 +1129,8 @@ completed. Do not add a separate preset block to this configuration file.
|
|
|
1122
1129
|
| `discord` | Optional block. If present, `tokenEnv`, `ownerId`, `allowedGuildIds`, and `allowedChannelIds` are all required. |
|
|
1123
1130
|
| `discord.requireAddressing` | Optional boolean, default `false`. With `true`, in parent channels of allowed servers and threads not created by this bot, only ordinary messages from the owner with an actual mention of this bot or a reply to a message it sent are accepted. |
|
|
1124
1131
|
| `discord.editProgressInPlace` | Optional boolean, default `false`. With `true`, intermediate progress updates for a Discord request edit one `⏳` status message in place instead of posting new messages. |
|
|
1132
|
+
| `discord.allowCrossChannelThreads` | Optional boolean, default `false`. With `true`, HEAD can explicitly select a different eligible parent in the same Discord bot account, owner, and guild via `lane_start`. |
|
|
1133
|
+
| `discord.crossChannelThreadScope` | Optional `"allowlist"` (default) or `"guild"`. Only applies when `allowCrossChannelThreads` is `true`. Guild scope allows eligible parents outside `allowedChannelIds` in the same allowed server. It does not change request, command, or history authorization. |
|
|
1125
1134
|
| `telegram` | Optional block. If present, `tokenEnv`, `ownerId`, and `allowedChatIds` are all required. Keep the minus sign on group chat IDs. |
|
|
1126
1135
|
| `slack` | Optional block. If present, `botTokenEnv`, `appTokenEnv`, `ownerId`, `teamId`, and `allowedChannelIds` are all required. |
|
|
1127
1136
|
| `groupRooms` | Optional list. Enables the group modes below only for the specified rooms and users. Even the operator has only ordinary group permissions in those rooms. Defaults to an empty list. |
|
|
@@ -1380,6 +1389,18 @@ asks you to specify the task with `/new` in the same thread and does not create
|
|
|
1380
1389
|
Edited messages, quotes, and attachments do not count as instructions to create a thread.
|
|
1381
1390
|
The plain-text split instruction does not apply in Discord DMs or on other platforms. The Gateway
|
|
1382
1391
|
does not use an LLM for classification or execute lanes.
|
|
1392
|
+
A new Discord thread uses the source conversation's parent by default. `/new` and plain
|
|
1393
|
+
split directives keep that parent. When the operator enables `discord.allowCrossChannelThreads`,
|
|
1394
|
+
HEAD can explicitly select another parent via `lane_start` for an authorized owner request.
|
|
1395
|
+
An ordinary request in an unbound thread stays there. The default `"allowlist"` scope requires
|
|
1396
|
+
the destination in `allowedChannelIds`. Explicit `"guild"` scope also permits an unlisted parent
|
|
1397
|
+
in the same trusted guild, with the same bot account and owner. Restricted `groupRooms` remain
|
|
1398
|
+
ineligible. The bot needs permission to create and post in that thread; `thread_inspect`
|
|
1399
|
+
can verify required forum or media tags. Failure does not choose a different parent.
|
|
1400
|
+
The source receives one notice identifying the channel and thread. Work output stays in the
|
|
1401
|
+
thread; HEAD's own acknowledgments are separate. Unlisted threads do not accept requests
|
|
1402
|
+
or commands or enable history reads. Continue work and answer approvals from the original
|
|
1403
|
+
allowed conversation. This setting does not change Discord permissions.
|
|
1383
1404
|
|
|
1384
1405
|
| Platform | Automatic topic creation |
|
|
1385
1406
|
| --- | --- |
|
package/docs/OPERATIONS.md
CHANGED
|
@@ -126,6 +126,13 @@ HEAD가 저장소와 작업 범위를 판단하는 데 참고하며, 메모를
|
|
|
126
126
|
`lane_start`/`lane_message`의 실제 `workflow: {name, reason}`에는 `jevify` 또는 위 여섯 이름
|
|
127
127
|
중 하나와 비어 있지 않은 이유를 전달한다. 기존 ULW 호출은 원본 사용자 요청에서만 호환되며,
|
|
128
128
|
새 구조화 선택에는 쓰지 않는다.
|
|
129
|
+
|
|
130
|
+
메신저에서 `/head /superstack <작업>`을 보내면 공유 HEAD의 현재 브랜치에서 모드를 켜고
|
|
131
|
+
관리형 Superkit 스킬로 작업의 처리 방식을 고른다. `/head /superstack`과
|
|
132
|
+
`/head /superstack off`는 Host가 완전히 유휴 상태가 된 뒤 작업 시작 없이 모드를 켜거나 끈다.
|
|
133
|
+
레인 워크플로 선택값이나 별도로
|
|
134
|
+
등록된 메신저 명령은 아니다. 실행 중인 구버전 Host는 교체 전까지 시작 시 선택한 Superkit을 쓴다.
|
|
135
|
+
|
|
129
136
|
기존 source/provenance·dedupe를 유지하며 workflow 선택은 실행 중 steering이 아닌 직렬
|
|
130
137
|
dispatch다. SUPER 워크플로는 더 가벼운 대안보다 유용한 이유를 남기고 선택한 스킬을 읽는다.
|
|
131
138
|
호출 이름과 스킬 ID는 다르다. 예를 들어 `super-run`은 `skill://ulw-execute`를 읽는다.
|
|
@@ -947,6 +954,8 @@ high/middle/low는 명시적 `start`의 전용 초기 설정 턴에서 기존
|
|
|
947
954
|
| `discord` | 선택 블록. 존재하면 `tokenEnv`, `ownerId`, `allowedGuildIds`, `allowedChannelIds` 모두 필수. |
|
|
948
955
|
| `discord.requireAddressing` | 선택 불리언, 기본값 `false`. `true`이면 허용된 서버의 부모 채널과 이 봇이 만들지 않은 스레드에서 이 봇의 실제 멘션 또는 이 봇이 보낸 메시지에 대한 답장이 포함된 소유자의 일반 메시지만 접수한다. |
|
|
949
956
|
| `discord.editProgressInPlace` | 선택 불리언, 기본값 `false`. `true`이면 Discord에서 한 요청의 중간 진행 보고를 새 메시지로 쌓지 않고 하나의 `⏳` 상태 메시지로 제자리 수정한다. |
|
|
957
|
+
| `discord.allowCrossChannelThreads` | 선택 불리언, 기본값 `false`. `true`이면 헤드가 `lane_start`로 인계할 때 같은 봇 계정·소유자·서버의 다른 적격 채널을 새 작업 스레드의 부모로 명시할 수 있다. |
|
|
958
|
+
| `discord.crossChannelThreadScope` | 선택 항목. 기본값 `"allowlist"`, 또는 `"guild"`. `allowCrossChannelThreads`가 `true`일 때만 적용된다. `"guild"`는 같은 허용 서버에서 `allowedChannelIds`에 없는 적격 채널까지 배치 대상으로 허용한다. 요청·명령 접수와 기록 조회 권한은 바뀌지 않는다. |
|
|
950
959
|
| `telegram` | 선택 블록. 존재하면 `tokenEnv`, `ownerId`, `allowedChatIds` 모두 필수. 그룹 chat ID의 음수 부호를 보존한다. |
|
|
951
960
|
| `slack` | 선택 블록. 존재하면 `botTokenEnv`, `appTokenEnv`, `ownerId`, `teamId`, `allowedChannelIds` 모두 필수. |
|
|
952
961
|
| `groupRooms` | 선택 목록. 등록한 방과 사용자에게만 아래 그룹 모드를 열며, 해당 방에서는 운영자도 일반 그룹 권한만 갖는다. 기본값은 빈 목록이다. |
|
|
@@ -1166,6 +1175,17 @@ HEAD 답변에서 저장한 리비전을 확인한다. 설정은 재시작 후
|
|
|
1166
1175
|
`이건 따로 빼줘`처럼 작업을 특정하지 않으면 같은 스레드에서 `/new`로 작업을 명시해 달라고
|
|
1167
1176
|
안내하고 새 스레드를 만들지 않는다. 수정 메시지·인용·첨부는 새 스레드 지시가 아니다.
|
|
1168
1177
|
이 평문 분리 지시는 Discord DM이나 다른 플랫폼에는 적용되지 않는다. Gateway는 LLM 분류나 lane 실행을 하지 않는다.
|
|
1178
|
+
새 Discord 스레드는 기본적으로 원래 대화의 부모 채널에 만든다. `/new`와 평문 분리
|
|
1179
|
+
지시는 계속 그 부모를 쓴다. 운영자가 `discord.allowCrossChannelThreads`를 켜면 HEAD가
|
|
1180
|
+
허용된 소유자 요청을 `lane_start`로 인계하면서 다른 부모를 명시할 수 있다. 연결되지 않은
|
|
1181
|
+
스레드의 일반 요청은 그 스레드에 남는다. 기본 `"allowlist"` 범위는 `allowedChannelIds`에
|
|
1182
|
+
있는 채널만 대상으로 삼는다. `"guild"` 범위는 같은 허용 서버·봇 계정·소유자에 한해
|
|
1183
|
+
목록에 없는 적격 채널도 대상으로 삼는다. `groupRooms`로 제한된 방은 제외하며, 봇이
|
|
1184
|
+
스레드를 만들고 메시지를 보낼 권한을 실제로 가져야 한다. forum/media 필수 태그는
|
|
1185
|
+
`thread_inspect`로 확인한다. 실패하면 다른 채널로 대체하지 않는다.
|
|
1186
|
+
원래 대화에는 채널과 스레드를 알리는 배치 안내 한 건을 보낸다. 작업 출력은 새 스레드로
|
|
1187
|
+
보내고 HEAD 자체 확인은 별개다. 목록에 없는 스레드는 요청·명령 접수나 기록 조회에
|
|
1188
|
+
사용하지 않는다. 후속 지시와 승인은 원래 허용된 대화에서 한다. Discord 권한은 바꾸지 않는다.
|
|
1169
1189
|
|
|
1170
1190
|
| 플랫폼 | 자동 주제 생성 |
|
|
1171
1191
|
| --- | --- |
|
package/docs/design/execution.md
CHANGED
|
@@ -602,6 +602,25 @@ keyword interpretation; keep generated metadata fenced. Selection is
|
|
|
602
602
|
serialized, not injected as steering. A conflict or missing advertised
|
|
603
603
|
capability does not silently downgrade a selected SUPER request to ordinary work.
|
|
604
604
|
|
|
605
|
+
HEAD supports native Superstack as a separate branch-local mode, based on
|
|
606
|
+
[omp-superkit `12d19ec96eb44e87acec9492269cbe638392cbef`](https://github.com/dbc-hbin/omp-superkit/tree/12d19ec96eb44e87acec9492269cbe638392cbef).
|
|
607
|
+
For an original owner request routed to HEAD, a leading `/superstack` or
|
|
608
|
+
`superstack` is pinned at admission before checking the native Host's command
|
|
609
|
+
advertisement at dispatch. Discord's physically written text must corroborate
|
|
610
|
+
the selector. Telegram must corroborate it independently of the arguments,
|
|
611
|
+
which may contain protected formatting. Redaction cannot turn a task into a
|
|
612
|
+
toggle. Existing receipts without a selection stay ordinary across replay.
|
|
613
|
+
It is not a messenger control, a lane `workflow` value, or a native goal.
|
|
614
|
+
The native task prefix is followed immediately by the original route envelope,
|
|
615
|
+
so later task prose cannot establish background job ownership. A pending
|
|
616
|
+
selection fences later HEAD prompts and steers. Bare enable and exact `off`
|
|
617
|
+
wait for full native idle and carry no task or envelope. A matching native
|
|
618
|
+
no-model receipt and current-branch journal state confirm the toggle; verified
|
|
619
|
+
non-application cancels, and unavailable evidence holds later work without
|
|
620
|
+
replay. Native flags still govern whether the policy is applied; edits, quoted
|
|
621
|
+
text and reports do not select it. An older Host without the command holds the
|
|
622
|
+
explicit request instead of running it as ordinary work.
|
|
623
|
+
|
|
605
624
|
SUPER's commands and defaults are based on
|
|
606
625
|
[omp-superkit `c11a6e4e185f9c31f484a05a13528ef724337bc1`](https://github.com/dbc-hbin/omp-superkit/tree/c11a6e4e185f9c31f484a05a13528ef724337bc1).
|
|
607
626
|
[Revision `e8825367bed06985ccb1ee1e635dce850e22bbb9`](https://github.com/dbc-hbin/omp-superkit/tree/e8825367bed06985ccb1ee1e635dce850e22bbb9)
|
package/docs/design/messaging.md
CHANGED
|
@@ -390,6 +390,18 @@ See the [operations guide](../OPERATIONS.en.md#4-commands-and-daily-use) for com
|
|
|
390
390
|
quotes. They apply only to original owner messages in physical Discord work
|
|
391
391
|
threads, not edits, quoted text or attachments. DM and other adapters retain
|
|
392
392
|
their existing topic behavior.
|
|
393
|
+
- `/new` and plain split directives keep the source parent. With operator opt-in,
|
|
394
|
+
HEAD may select a different native parent for an original authorized owner
|
|
395
|
+
request via `lane_start`. The default `"allowlist"` scope requires the
|
|
396
|
+
destination in `allowedChannelIds`; opt-in `"guild"` scope also permits an
|
|
397
|
+
eligible unlisted parent in the same allowed guild, bot account and owner.
|
|
398
|
+
Restricted `groupRooms` do not qualify. The Gateway verifies actual Discord
|
|
399
|
+
parent identity, capability and permissions before creation. It does not
|
|
400
|
+
add ACLs or fall back after refusal or uncertain creation. An unlisted
|
|
401
|
+
destination is authorized only for the exact confirmed native work thread.
|
|
402
|
+
The grant permits work delivery, not text or command intake or history
|
|
403
|
+
recovery; approvals remain on the original allowed route. The source receives
|
|
404
|
+
one placement notice; progress and final work reports use the work thread.
|
|
393
405
|
- `/head <request>` explicitly addresses the shared coordination model (Slack:
|
|
394
406
|
`!head` or `/superagent-head`). Manager handoffs keep HEAD's review path.
|
|
395
407
|
When HEAD explicitly uses `lane_message` to continue an existing physical
|
|
@@ -536,7 +548,11 @@ there is no provider fallback or mutation of local quota counters.
|
|
|
536
548
|
Thread capability comes from the authenticated adapter. Permission or network
|
|
537
549
|
failure is not permission to fall back to another destination. Preserve the
|
|
538
550
|
original binding when creating a sibling topic and journal creation intent before
|
|
539
|
-
the remote effect.
|
|
551
|
+
the remote effect. An opted-in cross-channel parent is journaled as the requested
|
|
552
|
+
destination, and only the exact thread the adapter recorded for that parent
|
|
553
|
+
reconciles an uncertain creation; a source-parent thread or another thread in
|
|
554
|
+
the destination channel is not evidence of that attempt. Discord
|
|
555
|
+
`thread_inspect` reads actual thread and parent policy;
|
|
540
556
|
`lane_thread_update` uses the original user source, checks the route and
|
|
541
557
|
permissions, then reads back title, tags or archived state. Exact tag IDs and
|
|
542
558
|
required/moderated tag policy apply. Archiving a thread does not pause its lane,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# omp-superagent 0.1.16
|
|
2
|
+
|
|
3
|
+
- HEAD supports `/head /superstack <task>` on a Host with a compatible managed omp-superkit revision. `/head /superstack` and `/head /superstack off` wait for the Host to become idle, then change the current HEAD branch without starting work. Command selection is pinned at admission, and HEAD confirms a toggle only after reading back the native branch state. Superstack does not create a goal or become a lane workflow.
|
|
4
|
+
- Discord can place new lane threads in a different eligible parent in the same guild when `discord.allowCrossChannelThreads` is enabled. Placement stays in the source parent by default. The optional `discord.crossChannelThreadScope` defaults to `"allowlist"`; `"guild"` permits eligible unlisted destinations without granting them request, command, approval, or history access.
|
|
5
|
+
- Discord adds the configured owner to bot-created work threads. Scoped work-thread continuations and approvals stay bound to their original authorized routes.
|
|
6
|
+
|
|
7
|
+
**Before upgrading**, follow the [upgrade procedure](https://github.com/dbc-hbin/omp-superagent/blob/v0.1.16/docs/OPERATIONS.en.md#update-an-existing-installation) ([한국어](https://github.com/dbc-hbin/omp-superagent/blob/v0.1.16/docs/OPERATIONS.md#기존-설치-업데이트)). Use the old installation to stop affected resident lanes and Gateway/HEAD and verify their exits. `stop main` alone does not stop independent lanes. Keep the original config and journals, install `omp-superagent@0.1.16`, and restart only previously running Gateways.
|
|
8
|
+
|
|
9
|
+
[Changes since 0.1.15](https://github.com/dbc-hbin/omp-superagent/compare/v0.1.15...v0.1.16)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/skills/head/SKILL.md
CHANGED
|
@@ -27,6 +27,13 @@ work, send a separate update, or grant scope or execution authority.
|
|
|
27
27
|
|
|
28
28
|
## Decide before dispatch
|
|
29
29
|
|
|
30
|
+
- Honor an original owner's explicit `/superstack` selection on HEAD. When the
|
|
31
|
+
native Host applies [Superstack](skill://superstack), use it to choose the
|
|
32
|
+
smallest method for the current request. It is independent of SUPER and
|
|
33
|
+
applies to this HEAD branch, not to delegated lanes. A skill read, quoted
|
|
34
|
+
command, or mention does not change that setting; never synthesize a toggle
|
|
35
|
+
or forward it as a lane `workflow` choice. Existing authority, routing,
|
|
36
|
+
pause, and approval rules still apply.
|
|
30
37
|
- Answer repo-free conversation and questions directly. For unbound repository
|
|
31
38
|
work, use the original request, scoped context, and any advisory lane,
|
|
32
39
|
workspace, or session coordinates to find and verify the workspace before
|
|
@@ -129,14 +129,28 @@ controls Host capacity.
|
|
|
129
129
|
contract and name one owner and verification boundary. Checkout separation is not
|
|
130
130
|
permission to merge, delete a checkout, or touch another lane's uncommitted work.
|
|
131
131
|
- Keep the original route by default. For work from an unbound Discord thread,
|
|
132
|
-
place any new lane in that exact thread, not its parent or a sibling.
|
|
132
|
+
place any new lane in that exact thread, not its parent or a sibling. A source
|
|
133
|
+
in a guild parent channel can also explicitly request alternate placement.
|
|
133
134
|
For an explicitly requested split from a Discord thread, use the exact
|
|
134
135
|
authorized parent `destination` with `threadId:null` and no `topicId` to
|
|
135
|
-
create a sibling, never a channel or nested thread.
|
|
136
|
-
|
|
136
|
+
create a sibling thread, never a bare channel destination or nested thread.
|
|
137
|
+
That parent is normally the source thread's own parent. If the operator has
|
|
138
|
+
enabled `discord.allowCrossChannelThreads`, HEAD may choose an eligible
|
|
139
|
+
alternate parent explicitly in `lane_start` for an authorized owner request.
|
|
140
|
+
The `"allowlist"` scope requires an allowed channel; the additional opt-in
|
|
141
|
+
`"guild"` scope can use an unlisted parent in the same trusted guild,
|
|
142
|
+
authenticated bot account and owner. Never select a restricted `groupRooms`
|
|
143
|
+
channel, assume bot permissions, or fall back to another parent. `/new` and
|
|
144
|
+
ordinary split directives still use the source parent. An unlisted thread
|
|
145
|
+
receives work outputs, not messages to the agent; approvals and follow-up
|
|
146
|
+
instructions stay in the original allowed conversation.
|
|
147
|
+
Only use an existing destination when its exact platform/account/authority/guild/channel/thread/topic
|
|
137
148
|
identity is observed and authorized. DMs without native support use honest
|
|
138
149
|
logical topics. Never fabricate a thread ID, interaction source message, or Slack
|
|
139
|
-
timestamp. Reconcile ambiguous creation before any new thread attempt.
|
|
150
|
+
timestamp. Reconcile ambiguous creation before any new thread attempt. For a
|
|
151
|
+
bot-created thread, the gateway attempts to add the configured owner as a
|
|
152
|
+
member so the thread appears in that owner's Discord channel list; a failed
|
|
153
|
+
add does not prevent thread creation or routing.
|
|
140
154
|
- For Discord forum/media creation, use `thread_inspect` and observed tag IDs in
|
|
141
155
|
`lane_start.appliedTags`; respect required tags. For explicit changes to an
|
|
142
156
|
existing managed Discord thread, use `lane_thread_update` with original source
|
|
@@ -188,6 +202,12 @@ necessity, current state/artifact owner, stop and permission limits in the brief
|
|
|
188
202
|
or message, not new API fields. Head selection is permitted for the already
|
|
189
203
|
entrusted objective, not permission to expand it or impersonate the user.
|
|
190
204
|
|
|
205
|
+
- **`/superstack`:** HEAD's native branch-local routing policy, not a lane
|
|
206
|
+
workflow. `/head /superstack <task>` routes that task using the installed
|
|
207
|
+
`skill://superstack` policy. `/head /superstack` and `/head /superstack off`
|
|
208
|
+
change the branch setting without starting or resuming work. Follow the
|
|
209
|
+
actual injected policy; do not submit the command yourself. If the Host
|
|
210
|
+
lacks support, do not claim it ran or treat a skill read as activation.
|
|
191
211
|
- **`jevify`:** Many homogeneous items, a frozen independent classification rubric,
|
|
192
212
|
and a material context/reading benefit. Prefer deterministic search for exact
|
|
193
213
|
rules, direct reading for small sets, contextual reasoning for interdependent
|
package/src/config/config.ts
CHANGED
|
@@ -11,6 +11,8 @@ export interface DiscordConfig {
|
|
|
11
11
|
allowedChannelIds: string[];
|
|
12
12
|
readonly requireAddressing?: boolean;
|
|
13
13
|
readonly editProgressInPlace?: boolean;
|
|
14
|
+
readonly allowCrossChannelThreads?: boolean;
|
|
15
|
+
readonly crossChannelThreadScope?: "allowlist" | "guild";
|
|
14
16
|
voice?: DiscordVoiceConfig;
|
|
15
17
|
}
|
|
16
18
|
|
|
@@ -244,6 +246,12 @@ export function parseConfig(value: unknown, path: string): Config {
|
|
|
244
246
|
const editProgressInPlace = discord?.editProgressInPlace;
|
|
245
247
|
if (editProgressInPlace !== undefined && typeof editProgressInPlace !== "boolean")
|
|
246
248
|
throw new Error("discord.editProgressInPlace must be a boolean");
|
|
249
|
+
const allowCrossChannelThreads = discord?.allowCrossChannelThreads;
|
|
250
|
+
if (allowCrossChannelThreads !== undefined && typeof allowCrossChannelThreads !== "boolean")
|
|
251
|
+
throw new Error("discord.allowCrossChannelThreads must be a boolean");
|
|
252
|
+
const crossChannelThreadScope = discord?.crossChannelThreadScope;
|
|
253
|
+
if (crossChannelThreadScope !== undefined && crossChannelThreadScope !== "allowlist" && crossChannelThreadScope !== "guild")
|
|
254
|
+
throw new Error("discord.crossChannelThreadScope must be allowlist or guild");
|
|
247
255
|
if (raw.remoteMemorySync !== undefined && typeof raw.remoteMemorySync !== "boolean")
|
|
248
256
|
throw new Error("remoteMemorySync must be a boolean");
|
|
249
257
|
const voice = discord?.voice === undefined ? undefined : record(discord.voice, "discord.voice");
|
|
@@ -298,6 +306,8 @@ export function parseConfig(value: unknown, path: string): Config {
|
|
|
298
306
|
allowedChannelIds: discordChannels,
|
|
299
307
|
requireAddressing: requireAddressing ?? false,
|
|
300
308
|
editProgressInPlace: editProgressInPlace ?? false,
|
|
309
|
+
allowCrossChannelThreads: allowCrossChannelThreads ?? false,
|
|
310
|
+
crossChannelThreadScope: crossChannelThreadScope ?? "allowlist",
|
|
301
311
|
...(voiceConfig ? { voice: voiceConfig } : {}),
|
|
302
312
|
} } : {}),
|
|
303
313
|
...(telegram ? { telegram: {
|
package/src/contracts.ts
CHANGED
|
@@ -474,6 +474,7 @@ export interface StorePort {
|
|
|
474
474
|
/** Reopen the verified lane and submit its goal resume together, without admitting a prompt. */
|
|
475
475
|
submitGoalResume(input: Inbound, target: string, sourceId: string, owner: {
|
|
476
476
|
requestId: string; generation: number; sessionId: string; sessionFile: string; cursor: string | null; goalId?: string;
|
|
477
|
+
scopedWorkOwnerId?: string;
|
|
477
478
|
}, priorWorkState?: Lane["workState"]): InputRecord;
|
|
478
479
|
/** Nonterminal native assistant observation; never settles or dispatches its owner. */
|
|
479
480
|
progress(id: string, generation: number, sessionId: string, eventId: string, text: string, editInPlace?: boolean): boolean;
|
|
@@ -622,10 +623,10 @@ export interface Messenger {
|
|
|
622
623
|
showApproval(approval: Approval): Promise<string>;
|
|
623
624
|
dismissApproval(approval: Approval): Promise<void>;
|
|
624
625
|
/** Read-only authenticated capability probe; false is unsupported, not a failed creation. */
|
|
625
|
-
canCreateThread?(route: Route, appliedTags?: readonly string[]): Promise<boolean>;
|
|
626
|
-
createThread(route: Route, title: string, sourceMessageId?: string, appliedTags?: readonly string[]): Promise<Route>;
|
|
626
|
+
canCreateThread?(route: Route, appliedTags?: readonly string[], placementSource?: Route): Promise<boolean>;
|
|
627
|
+
createThread(route: Route, title: string, sourceMessageId?: string, appliedTags?: readonly string[], placementSource?: Route): Promise<Route>;
|
|
627
628
|
/** Optional native thread management; unsupported transports must not simulate it. */
|
|
628
|
-
inspectThread?(route: Route): Promise<ThreadInfo>;
|
|
629
|
+
inspectThread?(route: Route, placementSource?: Route): Promise<ThreadInfo>;
|
|
629
630
|
updateThread?(route: Route, update: ThreadUpdate): Promise<ThreadInfo>;
|
|
630
631
|
inspectDiscordContext?(route: Route): Promise<DiscordContext>;
|
|
631
632
|
discordPurpose?(request: DiscordPurposeRequest): Promise<readonly DiscordPurposeNote[]>;
|
package/src/extension.ts
CHANGED
|
@@ -89,6 +89,13 @@ const laneModelSelection = {
|
|
|
89
89
|
modelReason: Type.String({ minLength: 1 }),
|
|
90
90
|
} as const;
|
|
91
91
|
const threadTagsSchema = Type.Array(Type.String({ pattern: "^[0-9]{1,20}$" }), { maxItems: 5, uniqueItems: true });
|
|
92
|
+
const laneRouteSchema = Type.Object({
|
|
93
|
+
platform: Type.Union([Type.Literal("discord"), Type.Literal("telegram"), Type.Literal("slack"), Type.Literal("kakao")]),
|
|
94
|
+
accountId: Type.String(), authorityId: Type.String(),
|
|
95
|
+
guildId: Type.Union([Type.String(), Type.Null()]), channelId: Type.String(),
|
|
96
|
+
threadId: Type.Union([Type.String(), Type.Null()]),
|
|
97
|
+
topicId: Type.Optional(Type.String()),
|
|
98
|
+
});
|
|
92
99
|
const threadTitleSchema = Type.String({ minLength: 1, maxLength: 100, pattern: "\\S" });
|
|
93
100
|
const threadChangeFields = {
|
|
94
101
|
title: Type.Optional(threadTitleSchema),
|
|
@@ -356,7 +363,7 @@ export default function superagentExtension(pi: ExtensionAPI): void {
|
|
|
356
363
|
});
|
|
357
364
|
pi.registerTool({
|
|
358
365
|
name: "lane_start", label: "Start independent work", loadMode: "essential", approval: "exec",
|
|
359
|
-
description: "Bind an independent topic to its own OMP session at an explicit cwd. By default create a supported native thread/topic, or reuse the source's existing binding; unsupported private chats use a logical topic. For a clearly new topic inside an existing thread, supply
|
|
366
|
+
description: "Bind an independent topic to its own OMP session at an explicit cwd. By default create a supported native thread/topic, or reuse the source's existing binding; unsupported private chats use a logical topic. For a clearly new topic inside an existing thread, supply an authorized parent as destination with threadId:null and no topicId to create a sibling. Use the source parent unless discord.allowCrossChannelThreads is enabled. In the same Discord guild, the default scope allows listed parents; explicit guild scope additionally permits a supported parent that the bot can use. Out-of-list placements do not accept new requests there. An existing independent destination binds directly only under the ordinary route policy. Do not ask the user to run /new merely to create a topic. Consult lane_models and native judge; choose exactly one model {provider,id} or native preset name, with concise modelReason. The resolved model and full preset snapshot persist; retries/global edits do not retarget the lane. Optional workflow {name,reason} is explicit head selection within the user's authorized objective, never inferred from brief/report prose. It binds to this source/handoff; conflicting retries reject. Native capability/permissions own activation; selecting SUPER through RPC does not create a goal. Returns queued identity, not completion. Small main work stays direct. sourceId is the original trusted request ID.",
|
|
360
367
|
parameters: Type.Object({
|
|
361
368
|
sourceId: Type.String(), title: Type.String(), cwd: Type.String(),
|
|
362
369
|
kickoff: Type.String({ minLength: 1, description: "A concise message in the user's language stating the concrete approach. Delivered in the work topic before native lane execution; failed or uncertain delivery holds execution." }),
|
|
@@ -372,13 +379,7 @@ export default function superagentExtension(pi: ExtensionAPI): void {
|
|
|
372
379
|
description: "Execution location for new work at the verified local cwd. Omit for local or an eligible operator-configured default. Remote, platform, or worker requires an approved paired worker and a clean committed Git checkout, with no local fallback. A bound worker can hold execution until ready. Local opts out and cannot be combined with platform or worker.",
|
|
373
380
|
})),
|
|
374
381
|
appliedTags: Type.Optional(threadTagsSchema),
|
|
375
|
-
destination: Type.Optional(
|
|
376
|
-
platform: Type.Union([Type.Literal("discord"), Type.Literal("telegram"), Type.Literal("slack"), Type.Literal("kakao")]),
|
|
377
|
-
accountId: Type.String(), authorityId: Type.String(),
|
|
378
|
-
guildId: Type.Union([Type.String(), Type.Null()]), channelId: Type.String(),
|
|
379
|
-
threadId: Type.Union([Type.String(), Type.Null()]),
|
|
380
|
-
topicId: Type.Optional(Type.String()),
|
|
381
|
-
})),
|
|
382
|
+
destination: Type.Optional(laneRouteSchema),
|
|
382
383
|
}),
|
|
383
384
|
async execute(_id, params, _signal, _onUpdate, ctx) { return result(await requireRuntime(ctx).startLane(params)); },
|
|
384
385
|
});
|
|
@@ -416,12 +417,13 @@ export default function superagentExtension(pi: ExtensionAPI): void {
|
|
|
416
417
|
});
|
|
417
418
|
pi.registerTool({
|
|
418
419
|
name: "thread_inspect", label: "Inspect Discord forum or thread", approval: "read",
|
|
419
|
-
description: "Read the original user source's Discord guild channel/thread,
|
|
420
|
+
description: "Read the original user source's Discord guild channel/thread, an explicitly selected managed lane's thread, or an eligible alternate guild parent (destination with threadId:null and no topicId, instead of laneId). Returns available tag IDs, required-tag policy, applied tags, title and archive state. Use before selecting appliedTags for lane_start. This never creates a topic, changes lane state, or reads message history.",
|
|
420
421
|
parameters: Type.Object({
|
|
421
422
|
sourceId: Type.String({ minLength: 1 }), laneId: Type.Optional(Type.String({ minLength: 1 })),
|
|
423
|
+
destination: Type.Optional(laneRouteSchema),
|
|
422
424
|
}, { additionalProperties: false }),
|
|
423
425
|
async execute(_id, params, _signal, _onUpdate, ctx) {
|
|
424
|
-
return result(await requireRuntime(ctx).inspectThread(params.sourceId, params.laneId));
|
|
426
|
+
return result(await requireRuntime(ctx).inspectThread(params.sourceId, params.laneId, params.destination));
|
|
425
427
|
},
|
|
426
428
|
});
|
|
427
429
|
pi.registerTool({
|
|
@@ -225,14 +225,21 @@ class GatewayMessenger implements GatewayHeadMessenger {
|
|
|
225
225
|
}
|
|
226
226
|
showApproval(approval: Approval): Promise<string> { return this.effect("showApproval", [approval]); }
|
|
227
227
|
dismissApproval(approval: Approval): Promise<void> { return this.effect("dismissApproval", [approval]); }
|
|
228
|
-
canCreateThread(route: Route, appliedTags?: readonly string[]): Promise<boolean> {
|
|
228
|
+
canCreateThread(route: Route, appliedTags?: readonly string[], placementSource?: Route): Promise<boolean> {
|
|
229
|
+
if (placementSource) return this.effect("canCreateThread", [route, appliedTags ?? null, placementSource]);
|
|
229
230
|
return this.effect("canCreateThread", appliedTags === undefined ? [route] : [route, appliedTags]);
|
|
230
231
|
}
|
|
231
|
-
createThread(route: Route, title: string, sourceMessageId?: string, appliedTags?: readonly string[]): Promise<Route> {
|
|
232
|
+
createThread(route: Route, title: string, sourceMessageId?: string, appliedTags?: readonly string[], placementSource?: Route): Promise<Route> {
|
|
233
|
+
if (placementSource) {
|
|
234
|
+
if (sourceMessageId !== undefined) throw new Error("Cross-channel threads cannot use a source message");
|
|
235
|
+
return this.effect("createThread", [route, title, null, appliedTags ?? null, placementSource]);
|
|
236
|
+
}
|
|
232
237
|
return this.effect("createThread", appliedTags !== undefined ? [route, title, sourceMessageId ?? null, appliedTags]
|
|
233
238
|
: sourceMessageId !== undefined ? [route, title, sourceMessageId] : [route, title]);
|
|
234
239
|
}
|
|
235
|
-
inspectThread(route: Route): Promise<ThreadInfo> {
|
|
240
|
+
inspectThread(route: Route, placementSource?: Route): Promise<ThreadInfo> {
|
|
241
|
+
return this.effect("inspectThread", placementSource ? [route, placementSource] : [route]);
|
|
242
|
+
}
|
|
236
243
|
updateThread(route: Route, update: ThreadUpdate): Promise<ThreadInfo> { return this.effect("updateThread", [route, update]); }
|
|
237
244
|
inspectDiscordContext(route: Route): Promise<DiscordContext> { return this.effect("inspectDiscordContext", [route]); }
|
|
238
245
|
messengerPresence(request: MessengerPresenceRequest): Promise<DiscordPresenceStatus> {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { authorizeRoute, type Config } from "../config/config";
|
|
2
|
+
import { routeKey, type Route, type StorePort } from "../contracts";
|
|
3
|
+
import { groupRoom } from "../group/group-policy";
|
|
4
|
+
|
|
5
|
+
export function guildThreadParent(config: Config, source: Route, parent: Route): boolean {
|
|
6
|
+
return config.discord?.allowCrossChannelThreads === true && config.discord.crossChannelThreadScope === "guild"
|
|
7
|
+
&& source.platform === "discord" && parent.platform === "discord" && source.guildId !== null
|
|
8
|
+
&& source.guildId === parent.guildId && source.accountId === parent.accountId && source.authorityId === parent.authorityId
|
|
9
|
+
&& source.channelId !== parent.channelId && parent.threadId === null && parent.topicId === undefined
|
|
10
|
+
&& authorizeRoute(config, source) && !groupRoom(config, parent);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function discordWorkThreadKey(threadId: string): string {
|
|
14
|
+
// Gateway reads the same exact source and thread receipt from SQLite.
|
|
15
|
+
return `discord:work-thread:${threadId}`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function discordWorkThreadOwnerKey(inputId: string): string {
|
|
19
|
+
return `discord:work-thread-owner:${inputId}`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Read the exact placement receipt without making it current authorization. */
|
|
23
|
+
export function recordedDiscordWorkThreadSource(store: Pick<StorePort, "getMeta">, route: Route): Route | null {
|
|
24
|
+
if (route.platform !== "discord" || !route.threadId || route.topicId !== undefined) return null;
|
|
25
|
+
const saved = store.getMeta(discordWorkThreadKey(route.threadId));
|
|
26
|
+
if (!saved) return null;
|
|
27
|
+
const binding: { source: Route; route: Route } = JSON.parse(saved);
|
|
28
|
+
return routeKey(binding.route) === routeKey(route) ? binding.source : null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Delivery authority for a confirmed native lane thread, never request ingress. */
|
|
32
|
+
export function discordWorkThreadSource(config: Config, store: Pick<StorePort, "getMeta">, route: Route): Route | null {
|
|
33
|
+
if (config.discord?.crossChannelThreadScope !== "guild" || config.discord.allowCrossChannelThreads !== true) return null;
|
|
34
|
+
const source = recordedDiscordWorkThreadSource(store, route);
|
|
35
|
+
return source && guildThreadParent(config, source, { ...route, threadId: null }) ? source : null;
|
|
36
|
+
}
|