omp-superagent 0.1.1 → 0.1.2
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/DESIGN.md +189 -48
- package/README.ko.md +30 -16
- package/README.md +39 -20
- package/THIRD_PARTY_NOTICES.md +81 -6
- package/docs/OPERATIONS.md +178 -30
- package/docs/discord-voice.md +96 -0
- package/docs/releases/0.1.2.md +53 -0
- package/package.json +13 -7
- package/scripts/ci.ts +10 -5
- package/scripts/release.ts +14 -6
- package/scripts/test-omp.sh +36 -0
- package/skills/head/SKILL.md +82 -241
- package/skills/head/references/model-selection.md +81 -261
- package/skills/head/references/routing.md +179 -354
- package/skills/head/references/supervision.md +120 -310
- package/skills/lane/SKILL.md +53 -175
- package/skills/lane/references/workflow.md +93 -347
- package/src/cli.ts +96 -10
- package/src/codex-live-bridge.py +73 -0
- package/src/codex-live.ts +244 -0
- package/src/codex-voice-requirements.txt +5 -0
- package/src/codex_live_auth.py +192 -0
- package/src/codex_live_media.py +219 -0
- package/src/codex_live_provider.py +192 -0
- package/src/config.ts +77 -2
- package/src/contracts.ts +70 -6
- package/src/decision-tool.ts +59 -0
- package/src/decisions.ts +143 -0
- package/src/delivery.ts +10 -0
- package/src/discord-context.ts +118 -0
- package/src/discord-voice-draft.ts +124 -0
- package/src/discord-voice-link.ts +270 -0
- package/src/discord-voice.ts +150 -0
- package/src/discord.ts +312 -45
- package/src/extension.ts +178 -21
- package/src/gateway-client.ts +11 -4
- package/src/gateway-server.ts +52 -4
- package/src/gateway-store.ts +16 -2
- package/src/gateway.ts +27 -11
- package/src/host-broker-services.ts +108 -0
- package/src/host-extension.ts +159 -47
- package/src/host-owner.ts +16 -0
- package/src/host-protocol.ts +9 -1
- package/src/host-services.ts +54 -0
- package/src/host.ts +3 -2
- package/src/installed-omp.ts +34 -26
- package/src/lane-extension.ts +5 -0
- package/src/lane-rows.ts +12 -0
- package/src/messengers.ts +38 -9
- package/src/native-presets.ts +91 -3
- package/src/native-settings.ts +3 -1
- package/src/openai-live.ts +377 -0
- package/src/pr-github-schema.ts +110 -0
- package/src/pr-github.ts +170 -0
- package/src/pr-watch.ts +200 -0
- package/src/runtime.ts +419 -54
- package/src/slack.ts +14 -11
- package/src/store.ts +86 -30
- package/src/telegram.ts +28 -12
- package/scripts/check-omp.ts +0 -4
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Discord 음성채팅
|
|
2
|
+
|
|
3
|
+
별도 OpenAI Live 모델이 소유자의 말을 듣고 음성으로 바로 답합니다. OMP의 HEAD 모델을 교체하지 않습니다.
|
|
4
|
+
일반 메시지·음성 첨부와 별개이며, 음성 모델은 셸을 쓰거나 레인을 시작하거나 승인을 대신할 수 없습니다.
|
|
5
|
+
|
|
6
|
+
## 준비
|
|
7
|
+
|
|
8
|
+
1. Discord 서버에 **봇과 소유자만 들어갈 수 있는 일반 음성 채널**과 작업 초안·답변용 텍스트 채널을 준비하세요.
|
|
9
|
+
서버는 `discord.allowedGuildIds`, 텍스트 채널은 `discord.allowedChannelIds`에 있어야 합니다.
|
|
10
|
+
봇에는 음성 채널 보기·연결·발언, 텍스트 채널 보기·보내기·기록 읽기 권한이 필요합니다.
|
|
11
|
+
권한으로 제삼자의 입장을 제한하세요. 참여자 변경 통지는 실시간 접근 제어를 대신할 수 없습니다.
|
|
12
|
+
2. 기존 설정의 `discord` 안에 `voice` 객체를 추가하세요. **Codex 구독**을 쓰려면 아래처럼 설정합니다.
|
|
13
|
+
ID는 본인의 채널 ID로 바꾸세요. `model`, `backendModel`, `apiKeyEnv`는 구독 설정에 넣지 않습니다.
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
"voice": {
|
|
17
|
+
"auth": "subscription",
|
|
18
|
+
"channelId": "111111111111111111",
|
|
19
|
+
"textChannelId": "222222222222222222",
|
|
20
|
+
"voice": "cove",
|
|
21
|
+
"maxSessionSeconds": 300
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**API 과금**을 선택하려면 대신 다음 예시를 사용하세요. 기존 `auth` 없는 설정도 이 모드입니다. 계정에서 사용 가능한
|
|
26
|
+
[Live 모델](https://developers.openai.com/api/docs/models/gpt-live-1),
|
|
27
|
+
[Responses 위임 모델](https://developers.openai.com/api/docs/guides/live-delegation),
|
|
28
|
+
[목소리](https://developers.openai.com/api/docs/guides/live-conversations#voice-options)를 선택하세요. 아래는 기본값이 아닌 예시입니다.
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
"voice": {
|
|
32
|
+
"auth": "api",
|
|
33
|
+
"channelId": "111111111111111111",
|
|
34
|
+
"textChannelId": "222222222222222222",
|
|
35
|
+
"apiKeyEnv": "SUPERAGENT_VOICE_OPENAI_KEY",
|
|
36
|
+
"model": "gpt-live-1",
|
|
37
|
+
"backendModel": "gpt-6-luna",
|
|
38
|
+
"voice": "marin",
|
|
39
|
+
"maxSessionSeconds": 300
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
3. **구독 모드:** Gateway를 실행하는 OS 사용자로 Codex CLI에 ChatGPT 계정 로그인이 되어 있어야 합니다
|
|
44
|
+
(`codex login`, API 키 방식 아님). Discord나 이 프로젝트의 설정 파일에 Codex 토큰을 붙여 넣지 마세요.
|
|
45
|
+
로그인 성공이 음성 사용 권한을 보장하지는 않습니다. 구독 음성 연결은 공개 Live API와 다른
|
|
46
|
+
WebRTC 프로토콜을 쓰므로 Codex나 서비스 변경으로 호환성이 깨질 수 있습니다.
|
|
47
|
+
**API 모드:** `apiKeyEnv`가 가리키는 변수에 OpenAI 키를 설정하세요. Gateway의 환경 또는 기존 비공개 `FILE.env`를 사용하고,
|
|
48
|
+
JSON에 키를 넣지 마세요. Discord 토큰과는 다른 변수여야 합니다. Gateway는 해당 변수를 HEAD·레인 환경에서 제외합니다.
|
|
49
|
+
4. 프로젝트의 잠금 파일로 의존성을 설치하세요(`bun install --frozen-lockfile`).
|
|
50
|
+
음성 링크는 `@discordjs/voice`, DAVE 및 Opus가 필요합니다. 음성 모듈은 연결 시 로드하며 설치·진단 중 봇을 접속시키지 않습니다.
|
|
51
|
+
설정 변경은 다음 Gateway 시작에 반영됩니다.
|
|
52
|
+
|
|
53
|
+
### 구독 모드의 WebRTC 브리지 설치
|
|
54
|
+
|
|
55
|
+
Gateway를 실행하는 OS 사용자로 아래 명령을 한 번 실행하세요(macOS/Linux, 프로젝트 루트 기준).
|
|
56
|
+
Codex CLI는 별도로 설치합니다. 로그인 조회에 사용한 버전은 `codex-cli 0.166.0`입니다.
|
|
57
|
+
브리지는 사용자 설치 위치(`~/.local/bin/codex`)와 표준 시스템 설치 위치만 검색하며 프로젝트의 `PATH`는 쓰지 않습니다.
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
VENV="$HOME/.local/share/omp-superagent/codex-voice"
|
|
61
|
+
uv venv --python 3.12 "$VENV"
|
|
62
|
+
uv pip install --python "$VENV/bin/python" -r src/codex-voice-requirements.txt
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
다른 가상환경을 쓰려면 Gateway를 시작하는 환경의 `OMP_SA_CODEX_VOICE_PYTHON`에 그 인터프리터의
|
|
66
|
+
절대 경로를 지정하세요. `FILE.env`는 메신저 자격증명 전용이며, macOS 로그인 런처는 터미널의
|
|
67
|
+
환경 변수를 상속하지 않으므로 기본 경로가 편합니다. API 모드나 텍스트 전용 설치에는 Python이 필요 없습니다.
|
|
68
|
+
|
|
69
|
+
`/voice start` 때만 브리지가 Codex의 로컬 `app-server`에 현재 로그인 정보를 요청합니다. Codex 작업 스레드는
|
|
70
|
+
시작하지 않습니다. 오디오는 WebRTC로 OpenAI에 보내고 작업 초안과 상태 이벤트는 같은 통화의 별도 연결로 받습니다.
|
|
71
|
+
Codex 로그인이나 음성 권한이 거절되면 먼저 같은 OS 사용자와 `CODEX_HOME`으로 로그인했는지 확인하세요.
|
|
72
|
+
API 키로 로그인한 Codex, 만료된 자격증명, 별도의 지역·전용 서버 경로가 필요한 워크스페이스는
|
|
73
|
+
지원하지 않습니다. 브리지는 조직의 경로 제한을 무시하거나 다른 계정·API 키로 재시도하지 않습니다.
|
|
74
|
+
|
|
75
|
+
## 사용
|
|
76
|
+
|
|
77
|
+
- 소유자가 지정 음성 채널에 들어간 뒤 **지정 텍스트 채널**에 일반 메시지 `/voice start`를 보냅니다.
|
|
78
|
+
등록형 슬래시 명령이나 DM이 아닙니다. 준비됐다는 알림 후 말하세요.
|
|
79
|
+
- 일반 질문에는 Live가 답합니다. **구독 모드에서 작업을 맡길 때는** 소유자가 먼저 지정 텍스트 채널에 `/voice share`를 보낸 뒤
|
|
80
|
+
작업을 말하세요. 이 명령은 1분간 초안 하나를 **그 채널의 독자에게 공개**하는 허용이며 작업 승인은 아닙니다.
|
|
81
|
+
일반 음성 대화만으로는 모델이 작업으로 오해하더라도 본문을 게시하지 않습니다. API 모드는 기존 방식대로 초안을 게시합니다.
|
|
82
|
+
내용을 확인하고 **그 초안에 Discord 답장으로** `/voice confirm`을 보내세요. 채널에 따로 쓰거나 음성으로 “승인”하는 것은 접수가 아닙니다.
|
|
83
|
+
위험한 작업은 기존 HEAD 승인 절차를 그대로 거칩니다. 초안이 만료됐거나 접수 여부가 불확실하면 기존 텍스트 요청 기록을 확인하세요.
|
|
84
|
+
- HEAD 답변은 기존 텍스트 경로에 남습니다. 해당 음성 세션에는 일치하는 텍스트 답변이 게시됐다는 알림만 전달할 수 있고, 답변 본문을 OpenAI Live에 보내지 않습니다.
|
|
85
|
+
- `/voice stop`, 소유자 퇴장, 다른 참여자 입장, 연결 종료, 설정 시간 만료 또는 Gateway 종료로 음성 세션을 닫습니다.
|
|
86
|
+
자동 재접속·유료 재시도·묵시적 재개가 없습니다. 다시 시작하려면 새 `/voice start`가 필요합니다.
|
|
87
|
+
|
|
88
|
+
## 개인정보·비용
|
|
89
|
+
|
|
90
|
+
음성은 OpenAI로 전송됩니다. 로컬에 녹음 파일이나 대화 전체 전사본을 남기지 않습니다.
|
|
91
|
+
작업 초안은 Discord에, 확인한 요청과 답변은 기존 Gateway/OMP 기록에 남습니다.
|
|
92
|
+
구독 모드는 해당 계정의 음성 권한과 사용량 제한을 따릅니다. 무료 계정 지원이나 공급자의 무보관 정책을 보장하지 않습니다.
|
|
93
|
+
구독 거절·사용량 초과·연결 실패 시 통화를 닫습니다. 유료 API 키가 있어도 대신 사용하지 않습니다.
|
|
94
|
+
API 모드에서는 Live 세션과 Responses 위임에 비용이 발생할 수 있습니다. `maxSessionSeconds`는 명시적 시작 1회의 시간 제한이지
|
|
95
|
+
금액·일일 예산 제한이 아닙니다. 실제 요금은 [OpenAI 가격표](https://developers.openai.com/api/docs/pricing)에서 확인하고 공급자 쪽 지출 한도를 설정하세요.
|
|
96
|
+
실계정 통화 품질이나 지연 시간은 오프라인 테스트로 검증되지 않습니다.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# omp-superagent 0.1.2
|
|
2
|
+
|
|
3
|
+
- Remove the OMP version check during installation. At runtime Superagent checks
|
|
4
|
+
the configured OMP executable's capabilities rather than enforcing a version
|
|
5
|
+
range. Stock OMP 18 and 19 both support session resume and managed service
|
|
6
|
+
ownership; the SDK remains pinned to 19.0.0.
|
|
7
|
+
- HEAD now receives only its core operating skill on each model turn. It reads
|
|
8
|
+
detailed routing, model selection, and supervision from the installed package
|
|
9
|
+
when needed. The routing skill distinguishes independent lane outcomes from
|
|
10
|
+
subtasks of one deliverable, and favors separate worktrees for independent
|
|
11
|
+
edits. A single original input can still create at most one new lane.
|
|
12
|
+
- Add Discord forum tags and managed thread controls, original-message replies
|
|
13
|
+
and channel context, explicit GitHub PR tracking, and native owner decisions
|
|
14
|
+
that HEAD can resolve for routine, reversible choices.
|
|
15
|
+
- Add owner-only Discord voice, off by default, with a Codex subscription or a
|
|
16
|
+
separately billed OpenAI API option. See the [voice setup guide](https://github.com/dbc-hbin/omp-superagent/blob/v0.1.2/docs/discord-voice.md).
|
|
17
|
+
- Support owner-requested HEAD model changes and refresh managed presets when
|
|
18
|
+
their source OMP model roles change.
|
|
19
|
+
|
|
20
|
+
## Install or upgrade
|
|
21
|
+
|
|
22
|
+
Installation requires Git and Bun >= 1.4.4, but does not require OMP on `PATH`.
|
|
23
|
+
Running a Host requires a compatible stock OMP executable and local Unix sockets.
|
|
24
|
+
Before switching a Host from OMP 18 to 19, check its background services;
|
|
25
|
+
the OMP 19 daemon does not take over services from the OMP 18 broker.
|
|
26
|
+
|
|
27
|
+
Install `omp-superagent@0.1.2` from npm, or download the verified
|
|
28
|
+
`omp-superagent-0.1.2.tgz` from this GitHub release if npm publication is pending.
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
bun add --global --trust omp-superagent@0.1.2
|
|
32
|
+
omp-sa --help
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Alternatively, with Bun on `PATH`:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
npm install --global omp-superagent@0.1.2
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Keep lifecycle scripts enabled to prepare the managed ULW integration.
|
|
42
|
+
Installing does not start a bot or replace a running Host. See the
|
|
43
|
+
[operations guide](https://github.com/dbc-hbin/omp-superagent/blob/v0.1.2/docs/OPERATIONS.md)
|
|
44
|
+
before starting or restarting.
|
|
45
|
+
The GitHub `.tar.gz` is the source archive; `.tgz` is the npm package. For a
|
|
46
|
+
downloaded `.tgz`, verify its SHA-256 and use the file path in the install command.
|
|
47
|
+
|
|
48
|
+
Stock OMP **18.20.3, 18.22.2, and 19.0.0** each passed 1,228 regression tests
|
|
49
|
+
on macOS arm64. Release CI additionally checks Linux and macOS with stock
|
|
50
|
+
binaries before publishing. Offline tests do not verify real messenger
|
|
51
|
+
accounts, live voice/provider behavior, login startup, or native TUI attachment.
|
|
52
|
+
The original OMP-19-only GitHub build was made from `7d18ab563cd1`; the
|
|
53
|
+
replacement is built from the commit referenced by the updated `v0.1.2` tag.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omp-superagent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "One messenger-connected OMP head with independent work sessions",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "dbc-hbin",
|
|
@@ -31,22 +31,23 @@
|
|
|
31
31
|
"check": "tsc --noEmit",
|
|
32
32
|
"test": "bun test test",
|
|
33
33
|
"test:ci": "bun --no-env-file scripts/ci.ts",
|
|
34
|
+
"test:baseline": "bash scripts/test-omp.sh",
|
|
34
35
|
"release": "bun --no-env-file scripts/release.ts",
|
|
35
36
|
"start": "bun --no-env-file src/cli.ts start",
|
|
36
37
|
"setup": "bash scripts/setup.sh",
|
|
37
38
|
"prepare:ulw": "bun scripts/prepare-ulw.ts",
|
|
38
|
-
"preinstall": "bun --no-env-file scripts/check-omp.ts",
|
|
39
39
|
"postinstall": "bun scripts/prepare-ulw.ts"
|
|
40
40
|
},
|
|
41
41
|
"engines": {
|
|
42
42
|
"bun": ">=1.4.4"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@oh-my-pi/pi-ai": "
|
|
46
|
-
"@oh-my-pi/pi-catalog": "
|
|
47
|
-
"@oh-my-pi/pi-coding-agent": "
|
|
48
|
-
"@oh-my-pi/pi-
|
|
49
|
-
"@oh-my-pi/pi-
|
|
45
|
+
"@oh-my-pi/pi-ai": "19.0.0",
|
|
46
|
+
"@oh-my-pi/pi-catalog": "19.0.0",
|
|
47
|
+
"@oh-my-pi/pi-coding-agent": "19.0.0",
|
|
48
|
+
"@oh-my-pi/pi-natives": "19.0.0",
|
|
49
|
+
"@oh-my-pi/pi-tui": "19.0.0",
|
|
50
|
+
"@oh-my-pi/pi-utils": "19.0.0",
|
|
50
51
|
"@slack/socket-mode": "^3.2.0",
|
|
51
52
|
"@slack/web-api": "^8.3.0",
|
|
52
53
|
"@sinclair/typebox": "^0.34.41",
|
|
@@ -54,6 +55,11 @@
|
|
|
54
55
|
"discord.js": "^14.25.1",
|
|
55
56
|
"grammy": "^1.46.0"
|
|
56
57
|
},
|
|
58
|
+
"optionalDependencies": {
|
|
59
|
+
"@discordjs/voice": "0.19.2",
|
|
60
|
+
"@noble/ciphers": "2.4.0",
|
|
61
|
+
"opusscript": "0.0.8"
|
|
62
|
+
},
|
|
57
63
|
"devDependencies": {
|
|
58
64
|
"@types/bun": "^1.3.0",
|
|
59
65
|
"typescript": "^7.0.2"
|
package/scripts/ci.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
+
import { mkdtempDisposable } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
2
4
|
import { delimiter, dirname, join, resolve } from "node:path";
|
|
3
|
-
import { discoverInstalledOmp, inspectInstalledOmp } from "../src/installed-omp";
|
|
4
5
|
import { activeManagedUlw } from "../src/managed-ulw";
|
|
6
|
+
import { nativeTestCommand } from "../test/fixtures/native-command";
|
|
5
7
|
|
|
6
8
|
const root = resolve(import.meta.dir, "..");
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
+
const explicitCache = process.env.OMP_TEST_NATIVES_DIR;
|
|
10
|
+
await using temporaryCache = explicitCache ? undefined : await mkdtempDisposable(join(tmpdir(), "omp-sa-natives-"));
|
|
11
|
+
const nativesDir = explicitCache || temporaryCache!.path;
|
|
12
|
+
const command = await nativeTestCommand({ ...process.env, OMP_TEST_NATIVES_DIR: nativesDir });
|
|
9
13
|
const ulw = activeManagedUlw();
|
|
10
14
|
const manifest = await Bun.file(join(ulw, "package.json")).json() as { omp: { extensions: string[] } };
|
|
11
15
|
if (manifest.omp.extensions.length !== 1) throw new Error("Native composition tests require one managed ULW entrypoint");
|
|
@@ -16,13 +20,14 @@ const env = {
|
|
|
16
20
|
OMP_SUPERAGENT_NATIVE_TEST: "1",
|
|
17
21
|
OMP_SUPERAGENT_SETUP_PTY_TEST: "1",
|
|
18
22
|
OMP_TEST_COMMAND: JSON.stringify(command),
|
|
23
|
+
OMP_TEST_NATIVES_DIR: nativesDir,
|
|
19
24
|
OMP_TEST_ULW_EXTENSION: resolve(ulw, manifest.omp.extensions[0]!),
|
|
20
25
|
};
|
|
21
|
-
console.log(`CI: Bun ${Bun.version};
|
|
26
|
+
console.log(`CI: Bun ${Bun.version}; ULW ${ulw}`);
|
|
22
27
|
for (const args of [["run", "check"], ["test", "test"]]) {
|
|
23
28
|
const child = Bun.spawn([process.execPath, "--no-env-file", ...args], {
|
|
24
29
|
cwd: root, env, stdin: "ignore", stdout: "inherit", stderr: "inherit",
|
|
25
30
|
});
|
|
26
31
|
const code = await child.exited;
|
|
27
|
-
if (code !== 0) process.
|
|
32
|
+
if (code !== 0) { process.exitCode = code; break; }
|
|
28
33
|
}
|
package/scripts/release.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { mkdir } from "node:fs/promises";
|
|
|
3
3
|
import { join, resolve } from "node:path";
|
|
4
4
|
|
|
5
5
|
const root = resolve(import.meta.dir, "..");
|
|
6
|
-
const
|
|
7
|
-
if (
|
|
8
|
-
throw new Error("Usage: bun run release [--publish]");
|
|
6
|
+
const [mode, ...extra] = process.argv.slice(2);
|
|
7
|
+
if (extra.length || mode !== undefined && mode !== "--publish" && mode !== "--replace")
|
|
8
|
+
throw new Error("Usage: bun run release [--publish|--replace]");
|
|
9
9
|
|
|
10
10
|
async function run(command: string[]): Promise<string> {
|
|
11
11
|
const child = Bun.spawn(command, { cwd: root, stdin: "ignore", stdout: "pipe", stderr: "inherit" });
|
|
@@ -19,13 +19,14 @@ if (await run(["git", "status", "--porcelain"]))
|
|
|
19
19
|
const { name, version } = JSON.parse(await run(["git", "show", "HEAD:package.json"])) as { name: string; version: string };
|
|
20
20
|
const tag = `v${version}`;
|
|
21
21
|
const revision = await run(["git", "rev-parse", "HEAD"]);
|
|
22
|
-
|
|
23
|
-
if (publish) {
|
|
22
|
+
if (mode !== undefined) {
|
|
24
23
|
if (process.env.GITHUB_REF_TYPE !== "tag" || process.env.GITHUB_REF_NAME !== tag)
|
|
25
24
|
throw new Error(`Publishing requires the ${tag} tag workflow`);
|
|
26
25
|
if (await run(["git", "rev-parse", `${tag}^{commit}`]) !== revision)
|
|
27
26
|
throw new Error("Release tag does not identify the checked-out commit");
|
|
28
27
|
}
|
|
28
|
+
if (mode === "--replace" && process.env.GITHUB_EVENT_NAME !== "workflow_dispatch")
|
|
29
|
+
throw new Error("Replacing a release requires the manual tag workflow");
|
|
29
30
|
const notes = join(root, "docs/releases", `${version}.md`);
|
|
30
31
|
if (!await Bun.file(notes).exists()) throw new Error(`Missing release notes: ${notes}`);
|
|
31
32
|
const directory = join(root, "dist");
|
|
@@ -44,7 +45,14 @@ for (const filename of [sourceFilename, packageFilename]) {
|
|
|
44
45
|
assets.push(path, checksum);
|
|
45
46
|
}
|
|
46
47
|
console.log(`Packaged ${revision}\n${assets.join("\n")}`);
|
|
47
|
-
if (publish) {
|
|
48
|
+
if (mode === "--publish") {
|
|
48
49
|
console.log(await run(["gh", "release", "create", tag, ...assets,
|
|
49
50
|
"--verify-tag", "--title", `${name} ${version}`, "--notes-file", notes]));
|
|
51
|
+
} else if (mode === "--replace") {
|
|
52
|
+
// Check the live tag, not just the checkout used by earlier CI jobs.
|
|
53
|
+
const remote = await run(["git", "ls-remote", "origin", `refs/tags/${tag}`, `refs/tags/${tag}^{}`]);
|
|
54
|
+
if (remote.split("\n").at(-1)?.split("\t")[0] !== revision)
|
|
55
|
+
throw new Error("Remote release tag no longer identifies the verified commit");
|
|
56
|
+
console.log(await run(["gh", "release", "upload", tag, ...assets, "--clobber"]));
|
|
57
|
+
console.log(await run(["gh", "release", "edit", tag, "--verify-tag", "--notes-file", notes]));
|
|
50
58
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Run CI with a stock release in a private directory, without replacing the user's OMP.
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.."
|
|
5
|
+
|
|
6
|
+
if [[ $# -gt 1 || ${OMP_TEST_COMMAND+x} ]]; then
|
|
7
|
+
echo 'Usage: bash scripts/test-omp.sh [release-tag]; use bun run test:ci for OMP_TEST_COMMAND overrides.' >&2
|
|
8
|
+
exit 2
|
|
9
|
+
fi
|
|
10
|
+
tag=${1-"$(bun --no-env-file -p '"v" + require("./package.json").dependencies["@oh-my-pi/pi-coding-agent"]')"}
|
|
11
|
+
if [[ ! $tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
12
|
+
echo "Expected an exact OMP release tag; got '$tag'." >&2
|
|
13
|
+
exit 2
|
|
14
|
+
fi
|
|
15
|
+
asset=$(bun --no-env-file -p '`omp-${process.platform}-${process.arch}`')
|
|
16
|
+
directory=$(mktemp -d "${TMPDIR:-/tmp}/omp-sa-test-cli.XXXXXXXX")
|
|
17
|
+
trap 'rm -rf -- "$directory"' EXIT
|
|
18
|
+
url="https://github.com/can1357/oh-my-pi/releases/download/$tag"
|
|
19
|
+
echo "Testing stock OMP $tag ($asset)"
|
|
20
|
+
for file in SHA256SUMS.txt "$asset"; do
|
|
21
|
+
curl --fail --silent --show-error --location "$url/$file" --output "$directory/$file"
|
|
22
|
+
done
|
|
23
|
+
(
|
|
24
|
+
cd -- "$directory"
|
|
25
|
+
grep -E "^[[:xdigit:]]{64} $asset\$" SHA256SUMS.txt | shasum -a 256 -c -
|
|
26
|
+
mv -- "$asset" omp
|
|
27
|
+
chmod 700 omp
|
|
28
|
+
)
|
|
29
|
+
actual=$("$directory/omp" --version)
|
|
30
|
+
if [[ $actual != "omp/${tag#v}" ]]; then
|
|
31
|
+
echo "OMP release $tag reported '$actual'; refusing to test a different version." >&2
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
# Installing the package must not depend on the CLI under test.
|
|
35
|
+
bun install --frozen-lockfile
|
|
36
|
+
PATH="$directory:$PATH" bun run test:ci
|