codex-channel-bgos 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +114 -0
- package/dist/adapter.d.ts +96 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +677 -0
- package/dist/adapter.js.map +1 -0
- package/dist/agent-hints.d.ts +20 -0
- package/dist/agent-hints.d.ts.map +1 -0
- package/dist/agent-hints.js +92 -0
- package/dist/agent-hints.js.map +1 -0
- package/dist/agent-identity.d.ts +36 -0
- package/dist/agent-identity.d.ts.map +1 -0
- package/dist/agent-identity.js +42 -0
- package/dist/agent-identity.js.map +1 -0
- package/dist/attachment-bridge.d.ts +64 -0
- package/dist/attachment-bridge.d.ts.map +1 -0
- package/dist/attachment-bridge.js +216 -0
- package/dist/attachment-bridge.js.map +1 -0
- package/dist/auth-mode.d.ts +34 -0
- package/dist/auth-mode.d.ts.map +1 -0
- package/dist/auth-mode.js +48 -0
- package/dist/auth-mode.js.map +1 -0
- package/dist/bgos-api.d.ts +191 -0
- package/dist/bgos-api.d.ts.map +1 -0
- package/dist/bgos-api.js +225 -0
- package/dist/bgos-api.js.map +1 -0
- package/dist/bgos-ws.d.ts +94 -0
- package/dist/bgos-ws.d.ts.map +1 -0
- package/dist/bgos-ws.js +310 -0
- package/dist/bgos-ws.js.map +1 -0
- package/dist/capabilities.d.ts +28 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +44 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/catalog-sync.d.ts +26 -0
- package/dist/catalog-sync.d.ts.map +1 -0
- package/dist/catalog-sync.js +24 -0
- package/dist/catalog-sync.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +152 -0
- package/dist/cli.js.map +1 -0
- package/dist/codex-host.d.ts +44 -0
- package/dist/codex-host.d.ts.map +1 -0
- package/dist/codex-host.js +142 -0
- package/dist/codex-host.js.map +1 -0
- package/dist/commands-sync.d.ts +24 -0
- package/dist/commands-sync.d.ts.map +1 -0
- package/dist/commands-sync.js +43 -0
- package/dist/commands-sync.js.map +1 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +36 -0
- package/dist/config.js.map +1 -0
- package/dist/default-commands.d.ts +27 -0
- package/dist/default-commands.d.ts.map +1 -0
- package/dist/default-commands.js +64 -0
- package/dist/default-commands.js.map +1 -0
- package/dist/event-mapper.d.ts +43 -0
- package/dist/event-mapper.d.ts.map +1 -0
- package/dist/event-mapper.js +127 -0
- package/dist/event-mapper.js.map +1 -0
- package/dist/heartbeat.d.ts +75 -0
- package/dist/heartbeat.d.ts.map +1 -0
- package/dist/heartbeat.js +186 -0
- package/dist/heartbeat.js.map +1 -0
- package/dist/inbound-handler.d.ts +167 -0
- package/dist/inbound-handler.d.ts.map +1 -0
- package/dist/inbound-handler.js +282 -0
- package/dist/inbound-handler.js.map +1 -0
- package/dist/inbound-input.d.ts +17 -0
- package/dist/inbound-input.d.ts.map +1 -0
- package/dist/inbound-input.js +25 -0
- package/dist/inbound-input.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/install-service.d.ts +8 -0
- package/dist/install-service.d.ts.map +1 -0
- package/dist/install-service.js +66 -0
- package/dist/install-service.js.map +1 -0
- package/dist/last-id-store.d.ts +33 -0
- package/dist/last-id-store.d.ts.map +1 -0
- package/dist/last-id-store.js +101 -0
- package/dist/last-id-store.js.map +1 -0
- package/dist/load-config.d.ts +30 -0
- package/dist/load-config.d.ts.map +1 -0
- package/dist/load-config.js +86 -0
- package/dist/load-config.js.map +1 -0
- package/dist/media-classify.d.ts +37 -0
- package/dist/media-classify.d.ts.map +1 -0
- package/dist/media-classify.js +108 -0
- package/dist/media-classify.js.map +1 -0
- package/dist/media-guard.d.ts +13 -0
- package/dist/media-guard.d.ts.map +1 -0
- package/dist/media-guard.js +159 -0
- package/dist/media-guard.js.map +1 -0
- package/dist/outbound-retry.d.ts +24 -0
- package/dist/outbound-retry.d.ts.map +1 -0
- package/dist/outbound-retry.js +75 -0
- package/dist/outbound-retry.js.map +1 -0
- package/dist/outbound.d.ts +223 -0
- package/dist/outbound.d.ts.map +1 -0
- package/dist/outbound.js +366 -0
- package/dist/outbound.js.map +1 -0
- package/dist/outbox.d.ts +16 -0
- package/dist/outbox.d.ts.map +1 -0
- package/dist/outbox.js +88 -0
- package/dist/outbox.js.map +1 -0
- package/dist/pair-cli.d.ts +44 -0
- package/dist/pair-cli.d.ts.map +1 -0
- package/dist/pair-cli.js +182 -0
- package/dist/pair-cli.js.map +1 -0
- package/dist/pending-unknown-store.d.ts +26 -0
- package/dist/pending-unknown-store.d.ts.map +1 -0
- package/dist/pending-unknown-store.js +135 -0
- package/dist/pending-unknown-store.js.map +1 -0
- package/dist/processed-ids.d.ts +36 -0
- package/dist/processed-ids.d.ts.map +1 -0
- package/dist/processed-ids.js +55 -0
- package/dist/processed-ids.js.map +1 -0
- package/dist/reply-markers.d.ts +42 -0
- package/dist/reply-markers.d.ts.map +1 -0
- package/dist/reply-markers.js +124 -0
- package/dist/reply-markers.js.map +1 -0
- package/dist/setup/supervisor.d.ts +16 -0
- package/dist/setup/supervisor.d.ts.map +1 -0
- package/dist/setup/supervisor.js +61 -0
- package/dist/setup/supervisor.js.map +1 -0
- package/dist/thread-map.d.ts +12 -0
- package/dist/thread-map.d.ts.map +1 -0
- package/dist/thread-map.js +72 -0
- package/dist/thread-map.js.map +1 -0
- package/dist/tool-progress.d.ts +103 -0
- package/dist/tool-progress.d.ts.map +1 -0
- package/dist/tool-progress.js +216 -0
- package/dist/tool-progress.js.map +1 -0
- package/dist/types.d.ts +244 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +16 -0
- package/dist/types.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +28 -0
- package/dist/version.js.map +1 -0
- package/dist/voice-rpc.d.ts +37 -0
- package/dist/voice-rpc.d.ts.map +1 -0
- package/dist/voice-rpc.js +44 -0
- package/dist/voice-rpc.js.map +1 -0
- package/package.json +47 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payload shapes mirrored from the BGOS backend. Independent types so the
|
|
3
|
+
* plugin doesn't depend on backend code.
|
|
4
|
+
*
|
|
5
|
+
* Keep these in sync with:
|
|
6
|
+
* docs/superpowers/specs/2026-04-25-codex-bgos-integration-design.md §7
|
|
7
|
+
* backend/src/dto/integrations/*.ts
|
|
8
|
+
*/
|
|
9
|
+
export type IntegrationDirection = "bgos_initiated" | "codex_initiated";
|
|
10
|
+
export interface PairExchangeResponse {
|
|
11
|
+
pairing_token: string;
|
|
12
|
+
pairing_id: number;
|
|
13
|
+
user_id: string;
|
|
14
|
+
}
|
|
15
|
+
export interface AgentCatalogEntry {
|
|
16
|
+
agent_route: string;
|
|
17
|
+
name: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
avatar_url?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface IntegrationPairing {
|
|
22
|
+
id: number;
|
|
23
|
+
device_label: string;
|
|
24
|
+
integration: string;
|
|
25
|
+
token_prefix: string;
|
|
26
|
+
last_seen_at: string | null;
|
|
27
|
+
created_at: string;
|
|
28
|
+
agent_catalog: AgentCatalogEntry[];
|
|
29
|
+
}
|
|
30
|
+
export interface InboundFile {
|
|
31
|
+
id: number;
|
|
32
|
+
filename: string;
|
|
33
|
+
mime: string;
|
|
34
|
+
url?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface InboundMessagePayload {
|
|
37
|
+
assistantId: number;
|
|
38
|
+
userId: string;
|
|
39
|
+
chatId: number;
|
|
40
|
+
messageId: number;
|
|
41
|
+
text: string;
|
|
42
|
+
files: InboundFile[];
|
|
43
|
+
messageType: "standard" | "slash_command" | "approval_request" | "agent_error" | "ask_user_input";
|
|
44
|
+
commandName?: string;
|
|
45
|
+
commandArgs?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Agent-to-agent (a2a) side-thread marker. Present ONLY when this inbound
|
|
48
|
+
* originated from a peer agent's side-thread conversation - the backend
|
|
49
|
+
* stamps it on the WS `inbound_message` event (it is NOT carried by the
|
|
50
|
+
* REST `integrations/inbound` poll backfill, nor by ordinary user
|
|
51
|
+
* messages). When set, the reply must go back via `POST /send-message`
|
|
52
|
+
* with `reply_to_id` so the initiating peer's `wait_for_reply` resolves
|
|
53
|
+
* (see inbound-handler.ts). See bgos-agent-capabilities.md §11.
|
|
54
|
+
*/
|
|
55
|
+
peerConversationId?: number;
|
|
56
|
+
/** Turn state on a peer side-thread: `expecting_reply` | `more_coming` |
|
|
57
|
+
* `final`. Present alongside `peerConversationId`. */
|
|
58
|
+
turnState?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface CommandsUpdatedPayload {
|
|
61
|
+
userId: string;
|
|
62
|
+
assistantId: number;
|
|
63
|
+
commands: CommandManifestEntry[];
|
|
64
|
+
}
|
|
65
|
+
export interface PairReadyPayload {
|
|
66
|
+
userId: string;
|
|
67
|
+
pairingId: number;
|
|
68
|
+
agentCatalog: AgentCatalogEntry[];
|
|
69
|
+
}
|
|
70
|
+
export interface AssistantBoundPayload {
|
|
71
|
+
pairingId: number;
|
|
72
|
+
assistantId: number;
|
|
73
|
+
agentRoute: string;
|
|
74
|
+
}
|
|
75
|
+
export interface AssistantUnboundPayload {
|
|
76
|
+
pairingId: number;
|
|
77
|
+
assistantId: number;
|
|
78
|
+
}
|
|
79
|
+
export interface PairingRevokedPayload {
|
|
80
|
+
pairingId: number;
|
|
81
|
+
/** Why the pairing became unusable. `'revoked'` (user deleted the pairing)
|
|
82
|
+
* or `'rotated'` (token rotated: re-pair with the new token). Absent on
|
|
83
|
+
* older backends; the adapter treats an absent reason as `'revoked'`. */
|
|
84
|
+
reason?: "revoked" | "rotated" | string;
|
|
85
|
+
}
|
|
86
|
+
export interface CallbackResultPayload {
|
|
87
|
+
messageId: number;
|
|
88
|
+
optionId: number;
|
|
89
|
+
success: boolean;
|
|
90
|
+
error?: string;
|
|
91
|
+
assistantId?: number;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Inbound button-click event (`inbound_click`). Emitted to `assistant:<id>`
|
|
95
|
+
* when the user taps an inline button. Unlike `callback_result` (the n8n
|
|
96
|
+
* success/error lane, which has NO callbackData), this carries the raw
|
|
97
|
+
* `callbackData` so the adapter can route approval clicks (`ea:*`) through the
|
|
98
|
+
* ApprovalHandler and forward everything else to the fork's onButtonClick hook.
|
|
99
|
+
*/
|
|
100
|
+
export interface InboundClickPayload {
|
|
101
|
+
assistantId: number;
|
|
102
|
+
userId: string;
|
|
103
|
+
chatId: number;
|
|
104
|
+
messageId: number;
|
|
105
|
+
optionId: number;
|
|
106
|
+
callbackData: string;
|
|
107
|
+
buttonText?: string;
|
|
108
|
+
}
|
|
109
|
+
/** Option = button on a message (Telegram inline-keyboard equivalent). */
|
|
110
|
+
export interface MessageOption {
|
|
111
|
+
text: string;
|
|
112
|
+
callbackData: string;
|
|
113
|
+
style?: "default" | "success" | "danger" | "primary";
|
|
114
|
+
}
|
|
115
|
+
export interface ApprovalMeta {
|
|
116
|
+
tool: string;
|
|
117
|
+
agent_route: string;
|
|
118
|
+
risk: "low" | "medium" | "high";
|
|
119
|
+
request_id: string;
|
|
120
|
+
expired?: boolean;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Inline agent identity. When present, the backend resolves it to
|
|
124
|
+
* `messages.from_agent_inline` (or `from_agent_peer_id` if `peerId`/
|
|
125
|
+
* `assistantId` matches a peer in the registry) and the BGOS frontend
|
|
126
|
+
* renders the bubble with this name + color + avatar instead of the
|
|
127
|
+
* bound assistant's identity.
|
|
128
|
+
*
|
|
129
|
+
* Used by `/board` to render each agent's contribution as a visually
|
|
130
|
+
* distinct bubble even though they all originate from the single bound
|
|
131
|
+
* Codex assistant. Mirrors `FromAgentInputDto` in the backend.
|
|
132
|
+
*/
|
|
133
|
+
export interface FromAgentInput {
|
|
134
|
+
/** AgentPeer.id from the BGOS registry (preferred when available). */
|
|
135
|
+
peerId?: number;
|
|
136
|
+
/** Source assistant id - for BGOS-native cross-assistant peers. */
|
|
137
|
+
assistantId?: number;
|
|
138
|
+
/** Stable string id (max 128 chars) used to look up the peer. */
|
|
139
|
+
externalId?: string;
|
|
140
|
+
/** Display name (inline fallback). Max 80 chars. */
|
|
141
|
+
name?: string;
|
|
142
|
+
/** Bubble accent color, hex e.g. "#0EA5E9". */
|
|
143
|
+
color?: string;
|
|
144
|
+
/** Avatar URL (https only). Max 2048 chars. */
|
|
145
|
+
avatarUrl?: string;
|
|
146
|
+
/** Agent type. `[a-z0-9_-]+`, max 32 chars. */
|
|
147
|
+
type?: "n8n" | "bgos" | "external" | "codex" | string;
|
|
148
|
+
}
|
|
149
|
+
/** Outbound message payload we POST to /api/v1/messages. */
|
|
150
|
+
export interface OutboundMessagePayload {
|
|
151
|
+
assistantId: number;
|
|
152
|
+
chatId: number;
|
|
153
|
+
text: string;
|
|
154
|
+
sender: "assistant";
|
|
155
|
+
options?: MessageOption[];
|
|
156
|
+
messageType?: "standard" | "slash_command" | "approval_request" | "agent_error" | "tool_progress";
|
|
157
|
+
approvalMeta?: ApprovalMeta;
|
|
158
|
+
/**
|
|
159
|
+
* tool_progress card payload - required when messageType="tool_progress".
|
|
160
|
+
* Codex agents stream tool_use events from Claude's API in real time
|
|
161
|
+
* (src/lib/claude.ts:391 in the fork), so unlike OpenClaw we emit LIVE
|
|
162
|
+
* cards: POST first card with state="running" on the first tool, PATCH
|
|
163
|
+
* to add tools, then PATCH state="done" at end-of-turn. Channel-agnostic
|
|
164
|
+
* wire format documented at
|
|
165
|
+
* docs/superpowers/specs/2026-05-15-tool-progress-message-type-design.md
|
|
166
|
+
*/
|
|
167
|
+
toolProgress?: {
|
|
168
|
+
state: "running" | "done";
|
|
169
|
+
tools: Array<{
|
|
170
|
+
icon: string;
|
|
171
|
+
name: string;
|
|
172
|
+
args?: string;
|
|
173
|
+
status: "running" | "done" | "error";
|
|
174
|
+
}>;
|
|
175
|
+
};
|
|
176
|
+
files?: Array<{
|
|
177
|
+
fileName: string;
|
|
178
|
+
fileMimeType: string;
|
|
179
|
+
size?: number;
|
|
180
|
+
fileData?: string;
|
|
181
|
+
s3Key?: string;
|
|
182
|
+
isImage?: boolean;
|
|
183
|
+
isVideo?: boolean;
|
|
184
|
+
isAudio?: boolean;
|
|
185
|
+
isDocument?: boolean;
|
|
186
|
+
width?: number;
|
|
187
|
+
height?: number;
|
|
188
|
+
}>;
|
|
189
|
+
/**
|
|
190
|
+
* When set, the backend stores `messages.reply_to_id = replyToId` and the
|
|
191
|
+
* UI renders this as a quoted reply. REQUIRED in agent-to-agent (a2a)
|
|
192
|
+
* side-thread chats: the originator's pollForReply correlates the target's
|
|
193
|
+
* reply with the inbound peer message via this field. Without it the
|
|
194
|
+
* backend falls back to positional matching, which works for 1:1 side
|
|
195
|
+
* threads but is less precise.
|
|
196
|
+
*/
|
|
197
|
+
replyToId?: number;
|
|
198
|
+
/**
|
|
199
|
+
* Inline-agent identity override. When set, the backend's
|
|
200
|
+
* agent-peer resolver maps it to `messages.from_agent_peer_id` (registry
|
|
201
|
+
* hit) or `messages.from_agent_inline` (free-form), and the BGOS UI
|
|
202
|
+
* renders the bubble with the supplied name/avatar/color. Required for
|
|
203
|
+
* Codex's `/board` flow so each agent's contribution shows as its own
|
|
204
|
+
* sender even though they share one bound assistant.
|
|
205
|
+
*/
|
|
206
|
+
fromAgent?: FromAgentInput;
|
|
207
|
+
}
|
|
208
|
+
export interface CommandManifestEntry {
|
|
209
|
+
command: string;
|
|
210
|
+
description: string;
|
|
211
|
+
scope?: string;
|
|
212
|
+
order_index?: number;
|
|
213
|
+
}
|
|
214
|
+
export interface PluginConfig {
|
|
215
|
+
baseUrl: string;
|
|
216
|
+
pairingToken: string;
|
|
217
|
+
reconnect: {
|
|
218
|
+
initialDelayMs: number;
|
|
219
|
+
maxDelayMs: number;
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
/** Error thrown when BGOS returns 401 - plugin should clear token + re-pair. */
|
|
223
|
+
export declare class PairingRevokedError extends Error {
|
|
224
|
+
constructor(message?: string);
|
|
225
|
+
}
|
|
226
|
+
/** OpenAI-compat chat message. One of these per prior turn when we dispatch
|
|
227
|
+
* to the gateway, so the agent sees full conversation context. */
|
|
228
|
+
export interface ChatMessage {
|
|
229
|
+
role: "user" | "assistant" | "system";
|
|
230
|
+
content: string;
|
|
231
|
+
}
|
|
232
|
+
/** One entry from `GET /api/v1/chats/:id/messages?userId=`. The backend
|
|
233
|
+
* returns `MessagesDto { messages: MessageWithFilesAndOptionsDto[] }`,
|
|
234
|
+
* where each entry nests a `message` object. */
|
|
235
|
+
export interface BgosMessageEnvelope {
|
|
236
|
+
message: {
|
|
237
|
+
id: number;
|
|
238
|
+
sender: "user" | "assistant" | null;
|
|
239
|
+
text: string | null;
|
|
240
|
+
messageType: string;
|
|
241
|
+
createdAt: string;
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAExE,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACr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B,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;IACH;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;CAC5B;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE;QACT,cAAc,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,gFAAgF;AAChF,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,SAAqC;CAIzD;AAED;mEACmE;AACnE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;iDAEiD;AACjD,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE;QACP,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAAC;QACpC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payload shapes mirrored from the BGOS backend. Independent types so the
|
|
3
|
+
* plugin doesn't depend on backend code.
|
|
4
|
+
*
|
|
5
|
+
* Keep these in sync with:
|
|
6
|
+
* docs/superpowers/specs/2026-04-25-codex-bgos-integration-design.md §7
|
|
7
|
+
* backend/src/dto/integrations/*.ts
|
|
8
|
+
*/
|
|
9
|
+
/** Error thrown when BGOS returns 401 - plugin should clear token + re-pair. */
|
|
10
|
+
export class PairingRevokedError extends Error {
|
|
11
|
+
constructor(message = "Pairing token revoked or invalid") {
|
|
12
|
+
super(message);
|
|
13
|
+
this.name = "PairingRevokedError";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAuPH,gFAAgF;AAChF,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,OAAO,GAAG,kCAAkC;QACtD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAeA,wBAAgB,iBAAiB,IAAI,MAAM,CAW1C"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read this package's own version from its package.json exactly once at load.
|
|
3
|
+
*
|
|
4
|
+
* The daemon reports `daemonVersion` in the heartbeat DTO + the pair-exchange
|
|
5
|
+
* body, and the local heartbeat file records it. Both `dist/version.js` (built)
|
|
6
|
+
* and `src/version.ts` (tests) live one directory under the package root, so
|
|
7
|
+
* `../package.json` resolves in both. Falls back to "0.0.0" if the file cannot
|
|
8
|
+
* be read (never throws: a missing version must not block boot).
|
|
9
|
+
*/
|
|
10
|
+
import { readFileSync } from "node:fs";
|
|
11
|
+
import { dirname, join } from "node:path";
|
|
12
|
+
import { fileURLToPath } from "node:url";
|
|
13
|
+
let cached = null;
|
|
14
|
+
export function getPackageVersion() {
|
|
15
|
+
if (cached !== null)
|
|
16
|
+
return cached;
|
|
17
|
+
try {
|
|
18
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
19
|
+
const raw = readFileSync(join(here, "..", "package.json"), "utf8");
|
|
20
|
+
const parsed = JSON.parse(raw);
|
|
21
|
+
cached = typeof parsed.version === "string" ? parsed.version : "0.0.0";
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
cached = "0.0.0";
|
|
25
|
+
}
|
|
26
|
+
return cached;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,IAAI,MAAM,GAAkB,IAAI,CAAC;AAEjC,MAAM,UAAU,iBAAiB;IAC/B,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IACnC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACrD,MAAM,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC;QACnE,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAyB,CAAC;QACvD,MAAM,GAAG,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IACzE,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,GAAG,OAAO,CAAC;IACnB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Voice control-plane wire types + normalizer.
|
|
3
|
+
*
|
|
4
|
+
* In-app realtime voice (mint / consult / dispatch) is DEFERRED for the Codex
|
|
5
|
+
* adapter v1 (parity with the Hermes / OpenClaw / Gobot decision to ship chat
|
|
6
|
+
* first). We keep the frame types and the normalizer so the WS layer can accept
|
|
7
|
+
* and safely drop `voice_rpc` frames, and so `bgos-api` can expose the ack /
|
|
8
|
+
* result endpoints for a later voice build. No handler is wired: an unhandled
|
|
9
|
+
* frame simply times out on the backend, which surfaces the failure to the app.
|
|
10
|
+
*
|
|
11
|
+
* Types mirror gobot-channel-bgos/src/voice-rpc.ts (originally the OpenClaw
|
|
12
|
+
* normalizer) so a future voice module drops in without a wire change.
|
|
13
|
+
*/
|
|
14
|
+
export type VoiceRpcOp = "mint" | "consult" | "dispatch";
|
|
15
|
+
export interface VoiceRpcFrame {
|
|
16
|
+
rpcId: string;
|
|
17
|
+
op: VoiceRpcOp;
|
|
18
|
+
assistantId: string | number;
|
|
19
|
+
agentRoute: string;
|
|
20
|
+
chatId: string | number | null;
|
|
21
|
+
payload: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
export interface VoiceRpcResultBody {
|
|
24
|
+
ok: boolean;
|
|
25
|
+
payload?: Record<string, unknown>;
|
|
26
|
+
error?: {
|
|
27
|
+
code: string;
|
|
28
|
+
message: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Validate a voice_rpc control frame. Backend emits camelCase:
|
|
33
|
+
* {rpcId, op, assistantId, agentRoute, chatId, payload}. Ops are WHITELISTED,
|
|
34
|
+
* anything else is dropped here.
|
|
35
|
+
*/
|
|
36
|
+
export declare function normalizeVoiceRpc(raw: unknown): VoiceRpcFrame | null;
|
|
37
|
+
//# sourceMappingURL=voice-rpc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice-rpc.d.ts","sourceRoot":"","sources":["../src/voice-rpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;AAEzD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,UAAU,CAAC;IACf,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,aAAa,GAAG,IAAI,CA0BpE"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Voice control-plane wire types + normalizer.
|
|
3
|
+
*
|
|
4
|
+
* In-app realtime voice (mint / consult / dispatch) is DEFERRED for the Codex
|
|
5
|
+
* adapter v1 (parity with the Hermes / OpenClaw / Gobot decision to ship chat
|
|
6
|
+
* first). We keep the frame types and the normalizer so the WS layer can accept
|
|
7
|
+
* and safely drop `voice_rpc` frames, and so `bgos-api` can expose the ack /
|
|
8
|
+
* result endpoints for a later voice build. No handler is wired: an unhandled
|
|
9
|
+
* frame simply times out on the backend, which surfaces the failure to the app.
|
|
10
|
+
*
|
|
11
|
+
* Types mirror gobot-channel-bgos/src/voice-rpc.ts (originally the OpenClaw
|
|
12
|
+
* normalizer) so a future voice module drops in without a wire change.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Validate a voice_rpc control frame. Backend emits camelCase:
|
|
16
|
+
* {rpcId, op, assistantId, agentRoute, chatId, payload}. Ops are WHITELISTED,
|
|
17
|
+
* anything else is dropped here.
|
|
18
|
+
*/
|
|
19
|
+
export function normalizeVoiceRpc(raw) {
|
|
20
|
+
if (!raw || typeof raw !== "object")
|
|
21
|
+
return null;
|
|
22
|
+
const r = raw;
|
|
23
|
+
const rpcId = typeof r.rpcId === "string" ? r.rpcId : "";
|
|
24
|
+
const op = r.op === "mint" || r.op === "consult" || r.op === "dispatch"
|
|
25
|
+
? r.op
|
|
26
|
+
: null;
|
|
27
|
+
if (!rpcId || !op)
|
|
28
|
+
return null;
|
|
29
|
+
return {
|
|
30
|
+
rpcId,
|
|
31
|
+
op,
|
|
32
|
+
assistantId: typeof r.assistantId === "number" || typeof r.assistantId === "string"
|
|
33
|
+
? r.assistantId
|
|
34
|
+
: "",
|
|
35
|
+
agentRoute: typeof r.agentRoute === "string" ? r.agentRoute : "",
|
|
36
|
+
chatId: typeof r.chatId === "number" || typeof r.chatId === "string"
|
|
37
|
+
? r.chatId
|
|
38
|
+
: null,
|
|
39
|
+
payload: r.payload && typeof r.payload === "object"
|
|
40
|
+
? r.payload
|
|
41
|
+
: {},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=voice-rpc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice-rpc.js","sourceRoot":"","sources":["../src/voice-rpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAmBH;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAY;IAC5C,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACjD,MAAM,CAAC,GAAG,GAA8B,CAAC;IACzC,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACzD,MAAM,EAAE,GACN,CAAC,CAAC,EAAE,KAAK,MAAM,IAAI,CAAC,CAAC,EAAE,KAAK,SAAS,IAAI,CAAC,CAAC,EAAE,KAAK,UAAU;QAC1D,CAAC,CAAC,CAAC,CAAC,EAAE;QACN,CAAC,CAAC,IAAI,CAAC;IACX,IAAI,CAAC,KAAK,IAAI,CAAC,EAAE;QAAE,OAAO,IAAI,CAAC;IAC/B,OAAO;QACL,KAAK;QACL,EAAE;QACF,WAAW,EACT,OAAO,CAAC,CAAC,WAAW,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,WAAW,KAAK,QAAQ;YACpE,CAAC,CAAC,CAAC,CAAC,WAAW;YACf,CAAC,CAAC,EAAE;QACR,UAAU,EAAE,OAAO,CAAC,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;QAChE,MAAM,EACJ,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ;YAC1D,CAAC,CAAC,CAAC,CAAC,MAAM;YACV,CAAC,CAAC,IAAI;QACV,OAAO,EACL,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ;YACxC,CAAC,CAAE,CAAC,CAAC,OAAmC;YACxC,CAAC,CAAC,EAAE;KACT,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "codex-channel-bgos",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "BGOS channel adapter for OpenAI Codex: pair, WS + REST client, Codex SDK host, outbound modalities, one-paste connect",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=20"
|
|
10
|
+
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"codex-channel-bgos": "dist/cli.js"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc -p tsconfig.json && node scripts/finalize-daemon.mjs",
|
|
16
|
+
"start": "node dist/cli.js start",
|
|
17
|
+
"test": "vitest run",
|
|
18
|
+
"test:watch": "vitest",
|
|
19
|
+
"lint": "tsc --noEmit -p tsconfig.json"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"codex",
|
|
23
|
+
"openai-codex",
|
|
24
|
+
"codex-channel",
|
|
25
|
+
"bgos",
|
|
26
|
+
"brandgrowthos"
|
|
27
|
+
],
|
|
28
|
+
"author": "BrandGrowthOS",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@openai/codex-sdk": "^0.144.1",
|
|
32
|
+
"axios": "^1.13.2",
|
|
33
|
+
"qrcode": "^1.5.4",
|
|
34
|
+
"socket.io-client": "^4.8.1",
|
|
35
|
+
"zod": "^4.3.5"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/node": "^22.10.5",
|
|
39
|
+
"@types/qrcode": "^1.5.6",
|
|
40
|
+
"typescript": "^5.7.3",
|
|
41
|
+
"vitest": "^2.1.8"
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"dist",
|
|
45
|
+
"README.md"
|
|
46
|
+
]
|
|
47
|
+
}
|