@blunking/codexlink 0.1.0 → 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/README.md CHANGED
@@ -1,127 +1,245 @@
1
- <div align="center">
2
-
3
- # CodexLink
4
-
5
- **Your agent in your pocket.**
6
-
7
- [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
8
- [![Powered by BLUN](https://img.shields.io/badge/Powered%20by-BLUN-22D3EE.svg)](https://blun.ai)
9
-
10
- </div>
11
-
12
- CodexLink is the BLUN launcher for one visible CLI session with optional Telegram delivery.
13
-
1
+ <div align="center">
2
+
3
+ # CodexLink
4
+
5
+ **Your agent in your pocket.**
6
+
7
+ [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
8
+ [![Powered by BLUN](https://img.shields.io/badge/Powered%20by-BLUN-22D3EE.svg)](https://blun.ai)
9
+
10
+ </div>
11
+
12
+ CodexLink is the BLUN launcher for one visible CLI session with optional Telegram delivery.
13
+
14
14
  It keeps transport and queueing around the operator, without spinning up a hidden second session.
15
15
 
16
- ## Install
17
-
18
- From GitHub:
19
-
20
- ```powershell
21
- npm install -g github:maykbiletti/codexlink
22
- ```
23
-
24
- From npm:
25
-
26
- ```powershell
27
- npm install -g @blunking/codexlink
28
- ```
29
-
30
- Local development:
31
-
32
- ```powershell
33
- cd codexlink
34
- npm install
35
- npm link
36
- ```
37
-
38
- ## Commands
39
-
40
- Normal startup:
41
-
42
- ```powershell
43
- blun-codex
44
- ```
45
-
46
- Alias:
47
-
48
- ```powershell
49
- codexlink
50
- ```
51
-
52
- Telegram mode:
53
-
54
- ```powershell
55
- blun-codex telegram-plugin
56
- ```
57
-
58
- Legacy equivalent:
59
-
60
- ```powershell
61
- blun-codex --telegram plugin
62
- ```
63
-
64
- Status:
65
-
66
- ```powershell
67
- blun-codex telegram-status
16
+ Telegram delivery is serial by default:
17
+
18
+ - inbound messages land in queue first
19
+ - active work is not interrupted immediately
20
+ - direct messages wait until the visible session is quiet
21
+ - ambient group noise stays queued until it is relevant or manually drained
22
+ - escalation-style messages can still jump the line
23
+
24
+ ## Install
25
+
26
+ From GitHub:
27
+
28
+ ```powershell
29
+ npm install -g github:maykbiletti/codexlink
30
+ ```
31
+
32
+ From npm:
33
+
34
+ ```powershell
35
+ npm install -g @blunking/codexlink
36
+ ```
37
+
38
+ Local development:
39
+
40
+ ```powershell
41
+ cd codexlink
42
+ npm install
43
+ npm link
44
+ ```
45
+
46
+ ## Schnellstart
47
+
48
+ Normal starten:
49
+
50
+ ```powershell
51
+ blun-codex
52
+ ```
53
+
54
+ Telegram aktivieren:
55
+
56
+ ```powershell
57
+ blun-codex telegram-plugin
58
+ ```
59
+
60
+ Wenn Telegram noch nicht eingerichtet ist, startet automatisch ein kurzer Setup-Flow und fragt:
61
+
62
+ - Telegram Bot Token
63
+ - erlaubte Chat ID(s)
64
+
65
+ Die Werte werden automatisch lokal an die richtige Stelle geschrieben. Du musst keine `.env`-Datei suchen.
66
+
67
+ Pruefen:
68
+
69
+ ```powershell
70
+ blun-codex telegram-doctor
71
+ ```
72
+
73
+ ## Commands
74
+
75
+ Normal startup:
76
+
77
+ ```powershell
78
+ blun-codex
79
+ ```
80
+
81
+ Alias:
82
+
83
+ ```powershell
84
+ codexlink
85
+ ```
86
+
87
+ Telegram mode:
88
+
89
+ ```powershell
90
+ blun-codex telegram-plugin
91
+ ```
92
+
93
+ Manual setup:
94
+
95
+ ```powershell
96
+ blun-codex telegram-setup
97
+ ```
98
+
99
+ Legacy equivalent:
100
+
101
+ ```powershell
102
+ blun-codex --telegram plugin
103
+ ```
104
+
105
+ Status:
106
+
107
+ ```powershell
108
+ blun-codex telegram-status
109
+ ```
110
+
111
+ Doctor:
112
+
113
+ ```powershell
114
+ blun-codex telegram-doctor
115
+ ```
116
+
117
+ JSON doctor output:
118
+
119
+ ```powershell
120
+ blun-codex telegram-doctor --json
121
+ ```
122
+
123
+ Dry run:
124
+
125
+ ```powershell
126
+ blun-codex telegram-plugin --print-only
127
+ ```
128
+
129
+ ## Eigene Profile
130
+
131
+ Der normale Start braucht kein eigenes Profil.
132
+
133
+ Wenn du nur einen Slot auf deinem Rechner brauchst, reicht:
134
+
135
+ ```powershell
136
+ blun-codex telegram-plugin
137
+ ```
138
+
139
+ Ein eigenes Profil brauchst du nur fuer Fortgeschrittene oder Parallelbetrieb, zum Beispiel wenn mehrere Operatoren auf demselben Rechner laufen.
140
+
141
+ Beispiel:
142
+
143
+ ```powershell
144
+ blun-codex --profile alfred telegram-plugin
145
+ ```
146
+
147
+ ## Private internal profiles
148
+
149
+ If you run more than one internal operator on the same machine, do not start all of them on the shared `default` slot.
150
+
151
+ Use a dedicated private profile per operator:
152
+
153
+ ```powershell
154
+ blun-codex --profile frida telegram-plugin
155
+ ```
156
+
157
+ Why this matters:
158
+
159
+ - `blun-codex telegram-plugin` without `--profile` uses the shared `default` runtime slot
160
+ - starting a second operator on `default` will replace the first `default` runtime
161
+ - a private profile gives that operator a separate runtime slot, state directory, and Mnemo binding
162
+
163
+ For internal/private profiles:
164
+
165
+ - keep the profile local on the machine
166
+ - give it its own `agent_name`
167
+ - give it its own Telegram state directory
168
+ - do not ship internal agent profiles in the public package
169
+
170
+ Local private profiles are loaded from:
171
+
172
+ ```text
173
+ %USERPROFILE%\.codex\profiles\codexlink\<name>.json
68
174
  ```
69
175
 
70
- Doctor:
176
+ Example:
71
177
 
72
178
  ```powershell
73
- blun-codex telegram-doctor
179
+ blun-codex --profile frida telegram-plugin
74
180
  ```
75
181
 
76
- Dry run:
182
+ looks for:
77
183
 
78
- ```powershell
79
- blun-codex telegram-plugin --print-only
184
+ ```text
185
+ %USERPROFILE%\.codex\profiles\codexlink\frida.json
80
186
  ```
81
-
82
- ## What it does
83
-
84
- - starts one consistent local CLI runtime
85
- - writes a launch record into `.codex/runtimes/default/`
86
- - keeps Telegram queue state under `.codex/channels/telegram-default/`
187
+
188
+ ## What it does
189
+
190
+ - starts one consistent local CLI runtime
191
+ - writes a launch record into `.codex/runtimes/default/`
192
+ - keeps Telegram queue state under `.codex/channels/telegram-default/`
87
193
  - attaches Telegram delivery to the same visible session
194
+ - defers automatic Telegram delivery until the foreground session is idle
88
195
  - keeps poller, dispatcher, and reply relay separate from the foreground operator
89
-
90
- ## What it does not do
91
-
92
- - no hidden autonomous answer bot
93
- - no second shadow session
94
- - no per-agent internal company presets in the public package
95
-
96
- ## Public profile
97
-
98
- The shipped default profile is intentionally generic:
99
-
100
- - display name: `CodexLink`
101
- - lane: `general`
102
- - workspace: current directory by default
103
- - model: inherited from the local host unless explicitly set
104
-
105
- If you need custom paths or lane rules, add your own profile JSON next to `profiles/default.json`.
106
-
107
- ## Telegram plugin folder
108
-
109
- The bundled plugin lives under `telegram-plugin/` and contains:
110
-
111
- - `.codex-plugin/plugin.json`
112
- - `.mcp.json`
113
- - `server.js`
114
- - sidecars and bridge helpers
115
-
116
- ## Requirements
117
-
118
- - Windows PowerShell
119
- - Node.js 20+
120
- - a working local `codex` command in `PATH`
121
- - a Telegram bot token when Telegram mode is enabled
122
-
123
- ## Notes
124
-
125
- - the package currently targets local Windows operators first
126
- - the package is installable from GitHub before registry publishing
127
- - once an npm token is available, the same package can be published without changing the command shape
196
+
197
+ ## What it does not do
198
+
199
+ - no hidden autonomous answer bot
200
+ - no second shadow session
201
+ - no per-agent internal company presets in the public package
202
+
203
+ ## Public profile
204
+
205
+ The shipped default profile is intentionally generic:
206
+
207
+ - display name: `CodexLink`
208
+ - lane: `general`
209
+ - workspace: current directory by default
210
+ - model: inherited from the local host unless explicitly set
211
+
212
+ If you need custom paths or lane rules, add your own profile JSON next to `profiles/default.json`.
213
+
214
+ ## Telegram plugin folder
215
+
216
+ The bundled plugin lives under `telegram-plugin/` and contains:
217
+
218
+ - `.codex-plugin/plugin.json`
219
+ - `.mcp.json`
220
+ - `server.js`
221
+ - sidecars and bridge helpers
222
+
223
+ ## Requirements
224
+
225
+ - Windows PowerShell
226
+ - Node.js 20+
227
+ - a working local `codex` command in `PATH`
228
+ - a Telegram bot token when Telegram mode is enabled
229
+
230
+ ## First-run behavior
231
+
232
+ `blun-codex telegram-plugin` now behaves like a guided setup for normal users:
233
+
234
+ 1. check whether Telegram is already configured
235
+ 2. ask for missing Bot Token or allowed Chat ID(s)
236
+ 3. save everything automatically into the local Telegram state folder
237
+ 4. continue into Telegram mode
238
+
239
+ If something is missing later, `blun-codex telegram-doctor` tells you exactly what is missing and what to run next.
240
+
241
+ ## Notes
242
+
243
+ - the package currently targets local Windows operators first
244
+ - the package is installable from GitHub before registry publishing
245
+ - once an npm token is available, the same package can be published without changing the command shape
package/blun-codex.ps1 CHANGED
@@ -1,110 +1,140 @@
1
- $ErrorActionPreference = "Stop"
2
-
3
- $runtimeRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
4
- $profile = "default"
5
- $telegramMode = "inherit"
6
- $workspace = ""
7
- $remoteControl = $false
8
- $printOnly = $false
9
- $promptParts = @()
10
- $parsedArgs = @($args)
11
-
12
- if ($parsedArgs.Count -gt 0) {
13
- switch ($parsedArgs[0]) {
14
- "telegram-status" {
15
- $commandArgs = @()
16
- if ($parsedArgs.Count -gt 1) {
17
- $commandArgs = @($parsedArgs[1..($parsedArgs.Count - 1)])
18
- }
19
- & powershell -ExecutionPolicy Bypass -File (Join-Path $runtimeRoot "telegram-status.ps1") @commandArgs
20
- exit $LASTEXITCODE
21
- }
22
- "telegram-doctor" {
23
- $commandArgs = @()
24
- if ($parsedArgs.Count -gt 1) {
25
- $commandArgs = @($parsedArgs[1..($parsedArgs.Count - 1)])
26
- }
27
- & powershell -ExecutionPolicy Bypass -File (Join-Path $runtimeRoot "telegram-doctor.ps1") @commandArgs
28
- exit $LASTEXITCODE
29
- }
30
- "doctor" {
31
- $commandArgs = @()
32
- if ($parsedArgs.Count -gt 1) {
33
- $commandArgs = @($parsedArgs[1..($parsedArgs.Count - 1)])
34
- }
35
- & powershell -ExecutionPolicy Bypass -File (Join-Path $runtimeRoot "telegram-doctor.ps1") @commandArgs
36
- exit $LASTEXITCODE
37
- }
38
- "telegram-plugin" {
39
- $telegramMode = "plugin"
40
- if ($parsedArgs.Count -gt 1) {
41
- $parsedArgs = @($parsedArgs[1..($parsedArgs.Count - 1)])
42
- } else {
43
- $parsedArgs = @()
44
- }
45
- }
46
- }
47
- }
48
-
49
- for ($i = 0; $i -lt $parsedArgs.Count; $i++) {
50
- $arg = $parsedArgs[$i]
51
- switch ($arg) {
52
- "--profile" {
53
- $i++
54
- if ($i -ge $parsedArgs.Count) { throw "--profile requires a value" }
55
- $profile = $parsedArgs[$i]
56
- continue
57
- }
58
- "--telegram" {
59
- $i++
60
- if ($i -ge $parsedArgs.Count) { throw "--telegram requires a value" }
61
- $telegramMode = $parsedArgs[$i]
62
- continue
63
- }
64
- "--workspace" {
65
- $i++
66
- if ($i -ge $parsedArgs.Count) { throw "--workspace requires a value" }
67
- $workspace = $parsedArgs[$i]
68
- continue
69
- }
70
- "--remote-control" {
71
- $remoteControl = $true
72
- continue
73
- }
74
- "--print-only" {
75
- $printOnly = $true
76
- continue
77
- }
78
- default {
79
- $promptParts += $arg
80
- }
81
- }
82
- }
83
-
84
- $invokeArgs = @(
85
- "-ExecutionPolicy", "Bypass",
86
- "-File", (Join-Path $runtimeRoot "start-codex-agent.ps1"),
87
- "-Agent", $profile,
88
- "-TelegramMode", $telegramMode
89
- )
90
-
91
- if ($workspace) {
92
- $invokeArgs += "-Workspace"
93
- $invokeArgs += $workspace
94
- }
95
-
96
- if ($remoteControl) {
97
- $invokeArgs += "-RemoteControl"
98
- }
99
-
100
- if ($printOnly) {
101
- $invokeArgs += "-PrintOnly"
102
- }
103
-
104
- if ($promptParts.Count -gt 0) {
105
- $invokeArgs += "-Prompt"
106
- $invokeArgs += ($promptParts -join " ")
107
- }
108
-
109
- & powershell @invokeArgs
110
- exit $LASTEXITCODE
1
+ $ErrorActionPreference = "Stop"
2
+
3
+ $runtimeRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
4
+ $profile = "default"
5
+ $telegramMode = "inherit"
6
+ $workspace = ""
7
+ $remoteControl = $false
8
+ $printOnly = $false
9
+ $skipTelegramSetup = $false
10
+ $promptParts = @()
11
+ $parsedArgs = @($args)
12
+
13
+ if ($parsedArgs.Count -gt 0) {
14
+ switch ($parsedArgs[0]) {
15
+ "telegram-status" {
16
+ $commandArgs = @()
17
+ if ($parsedArgs.Count -gt 1) {
18
+ $commandArgs = @($parsedArgs[1..($parsedArgs.Count - 1)])
19
+ }
20
+ & powershell -ExecutionPolicy Bypass -File (Join-Path $runtimeRoot "telegram-status.ps1") @commandArgs
21
+ exit $LASTEXITCODE
22
+ }
23
+ "telegram-doctor" {
24
+ $commandArgs = @()
25
+ if ($parsedArgs.Count -gt 1) {
26
+ $commandArgs = @($parsedArgs[1..($parsedArgs.Count - 1)])
27
+ }
28
+ & powershell -ExecutionPolicy Bypass -File (Join-Path $runtimeRoot "telegram-doctor.ps1") @commandArgs
29
+ exit $LASTEXITCODE
30
+ }
31
+ "telegram-setup" {
32
+ $commandArgs = @()
33
+ if ($parsedArgs.Count -gt 1) {
34
+ $commandArgs = @($parsedArgs[1..($parsedArgs.Count - 1)])
35
+ }
36
+ & powershell -ExecutionPolicy Bypass -File (Join-Path $runtimeRoot "telegram-setup.ps1") @commandArgs
37
+ exit $LASTEXITCODE
38
+ }
39
+ "doctor" {
40
+ $commandArgs = @()
41
+ if ($parsedArgs.Count -gt 1) {
42
+ $commandArgs = @($parsedArgs[1..($parsedArgs.Count - 1)])
43
+ }
44
+ & powershell -ExecutionPolicy Bypass -File (Join-Path $runtimeRoot "telegram-doctor.ps1") @commandArgs
45
+ exit $LASTEXITCODE
46
+ }
47
+ "telegram-plugin" {
48
+ $telegramMode = "plugin"
49
+ if ($parsedArgs.Count -gt 1) {
50
+ $parsedArgs = @($parsedArgs[1..($parsedArgs.Count - 1)])
51
+ } else {
52
+ $parsedArgs = @()
53
+ }
54
+ }
55
+ }
56
+ }
57
+
58
+ for ($i = 0; $i -lt $parsedArgs.Count; $i++) {
59
+ $arg = $parsedArgs[$i]
60
+ switch ($arg) {
61
+ "--profile" {
62
+ $i++
63
+ if ($i -ge $parsedArgs.Count) { throw "--profile requires a value" }
64
+ $profile = $parsedArgs[$i]
65
+ continue
66
+ }
67
+ "--telegram" {
68
+ $i++
69
+ if ($i -ge $parsedArgs.Count) { throw "--telegram requires a value" }
70
+ $telegramMode = $parsedArgs[$i]
71
+ continue
72
+ }
73
+ "--workspace" {
74
+ $i++
75
+ if ($i -ge $parsedArgs.Count) { throw "--workspace requires a value" }
76
+ $workspace = $parsedArgs[$i]
77
+ continue
78
+ }
79
+ "--remote-control" {
80
+ $remoteControl = $true
81
+ continue
82
+ }
83
+ "--print-only" {
84
+ $printOnly = $true
85
+ continue
86
+ }
87
+ "--skip-telegram-setup" {
88
+ $skipTelegramSetup = $true
89
+ continue
90
+ }
91
+ "telegram-plugin" {
92
+ $telegramMode = "plugin"
93
+ continue
94
+ }
95
+ default {
96
+ $promptParts += $arg
97
+ }
98
+ }
99
+ }
100
+
101
+ if ($telegramMode -eq "plugin" -and -not $skipTelegramSetup -and -not $printOnly) {
102
+ $setupArgs = @(
103
+ "-ExecutionPolicy", "Bypass",
104
+ "-File", (Join-Path $runtimeRoot "telegram-setup.ps1"),
105
+ "-Profile", $profile,
106
+ "-EnsureConfigured"
107
+ )
108
+ & powershell @setupArgs
109
+ if ($LASTEXITCODE -ne 0) {
110
+ exit $LASTEXITCODE
111
+ }
112
+ }
113
+
114
+ $invokeArgs = @(
115
+ "-ExecutionPolicy", "Bypass",
116
+ "-File", (Join-Path $runtimeRoot "start-codex-agent.ps1"),
117
+ "-Agent", $profile,
118
+ "-TelegramMode", $telegramMode
119
+ )
120
+
121
+ if ($workspace) {
122
+ $invokeArgs += "-Workspace"
123
+ $invokeArgs += $workspace
124
+ }
125
+
126
+ if ($remoteControl) {
127
+ $invokeArgs += "-RemoteControl"
128
+ }
129
+
130
+ if ($printOnly) {
131
+ $invokeArgs += "-PrintOnly"
132
+ }
133
+
134
+ if ($promptParts.Count -gt 0) {
135
+ $invokeArgs += "-Prompt"
136
+ $invokeArgs += ($promptParts -join " ")
137
+ }
138
+
139
+ & powershell @invokeArgs
140
+ exit $LASTEXITCODE
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blunking/codexlink",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "BLUN CLI launcher with Telegram channel support for one visible session.",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "files": [
12
12
  "bin/",
13
- "profiles/",
13
+ "profiles/default.json",
14
14
  "telegram-plugin/",
15
15
  "README.md",
16
16
  "LICENSE",
@@ -19,7 +19,8 @@
19
19
  "start-codex-agent.ps1",
20
20
  "start-codex.cmd",
21
21
  "telegram-status.ps1",
22
- "telegram-doctor.ps1"
22
+ "telegram-doctor.ps1",
23
+ "telegram-setup.ps1"
23
24
  ],
24
25
  "keywords": [
25
26
  "blun",