@blunking/codexlink 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/README.md CHANGED
@@ -160,12 +160,30 @@ Why this matters:
160
160
  - starting a second operator on `default` will replace the first `default` runtime
161
161
  - a private profile gives that operator a separate runtime slot, state directory, and Mnemo binding
162
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
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
174
+ ```
175
+
176
+ Example:
177
+
178
+ ```powershell
179
+ blun-codex --profile frida telegram-plugin
180
+ ```
181
+
182
+ looks for:
183
+
184
+ ```text
185
+ %USERPROFILE%\.codex\profiles\codexlink\frida.json
186
+ ```
169
187
 
170
188
  ## What it does
171
189
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blunking/codexlink",
3
- "version": "0.1.1",
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,
@@ -21,17 +21,42 @@ function Get-JsonFile {
21
21
  return Get-Content -Raw -Path $Path | ConvertFrom-Json
22
22
  }
23
23
 
24
- function Try-GetJsonFile {
25
- param([string]$Path)
26
- if (-not (Test-Path $Path)) {
27
- return $null
24
+ function Try-GetJsonFile {
25
+ param([string]$Path)
26
+ if (-not (Test-Path $Path)) {
27
+ return $null
28
28
  }
29
29
  try {
30
30
  return Get-Content -Raw -Path $Path | ConvertFrom-Json
31
31
  } catch {
32
32
  return $null
33
- }
34
- }
33
+ }
34
+ }
35
+
36
+ function Get-ProfilePath {
37
+ param(
38
+ [string]$RuntimeRoot,
39
+ [string]$ProfileName
40
+ )
41
+
42
+ $normalized = [string]$ProfileName
43
+ if (-not $normalized) { $normalized = "" }
44
+ $normalized = $normalized.ToLower()
45
+ $candidates = @()
46
+ if ($env:BLUN_CODEX_PROFILE_ROOT) {
47
+ $candidates += (Join-Path $env:BLUN_CODEX_PROFILE_ROOT ($normalized + ".json"))
48
+ }
49
+ $candidates += (Join-Path $env:USERPROFILE (".codex\\profiles\\codexlink\\" + $normalized + ".json"))
50
+ $candidates += (Join-Path $RuntimeRoot ("profiles\\" + $normalized + ".json"))
51
+
52
+ foreach ($candidate in $candidates) {
53
+ if ($candidate -and (Test-Path $candidate)) {
54
+ return $candidate
55
+ }
56
+ }
57
+
58
+ return $candidates[-1]
59
+ }
35
60
 
36
61
  function Ensure-Dir {
37
62
  param([string]$Path)
@@ -276,8 +301,8 @@ function Quote-PowerShellLiteral {
276
301
  }
277
302
 
278
303
  $runtimeRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
279
- $profilePath = Join-Path $runtimeRoot ("profiles\" + $Agent.ToLower() + ".json")
280
- $profile = Get-JsonFile -Path $profilePath
304
+ $profilePath = Get-ProfilePath -RuntimeRoot $runtimeRoot -ProfileName $Agent
305
+ $profile = Get-JsonFile -Path $profilePath
281
306
 
282
307
  $resolvedWorkspace = if ($Workspace) { $Workspace } elseif ($profile.workspace) { $profile.workspace } else { (Get-Location).Path }
283
308
  $resolvedWorkspace = Resolve-ConfiguredPath -Value $resolvedWorkspace
@@ -63,7 +63,7 @@ function Get-OverallStatus {
63
63
  return "ok"
64
64
  }
65
65
 
66
- function Write-DoctorReport {
66
+ function Write-DoctorReport {
67
67
  param(
68
68
  [object]$Result,
69
69
  [string]$TokenSource,
@@ -130,12 +130,37 @@ function Write-DoctorReport {
130
130
  Write-Host ""
131
131
  Write-Host "Die Grundkonfiguration steht, aber es gibt noch Laufzeit-Hinweise." -ForegroundColor Yellow
132
132
  Write-Host "Das ist oft normal, wenn Telegram noch nicht aktiv gestartet wurde oder noch keine Nachricht durchlief."
133
- }
134
- }
135
-
136
- $runtimeRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
137
- $profilePath = Join-Path $runtimeRoot ("profiles\" + $Profile.ToLower() + ".json")
138
- $checks = New-Object 'System.Collections.Generic.List[object]'
133
+ }
134
+ }
135
+
136
+ function Get-ProfilePath {
137
+ param(
138
+ [string]$RuntimeRoot,
139
+ [string]$ProfileName
140
+ )
141
+
142
+ $normalized = [string]$ProfileName
143
+ if (-not $normalized) { $normalized = "" }
144
+ $normalized = $normalized.ToLower()
145
+ $candidates = @()
146
+ if ($env:BLUN_CODEX_PROFILE_ROOT) {
147
+ $candidates += (Join-Path $env:BLUN_CODEX_PROFILE_ROOT ($normalized + ".json"))
148
+ }
149
+ $candidates += (Join-Path $env:USERPROFILE (".codex\\profiles\\codexlink\\" + $normalized + ".json"))
150
+ $candidates += (Join-Path $RuntimeRoot ("profiles\\" + $normalized + ".json"))
151
+
152
+ foreach ($candidate in $candidates) {
153
+ if ($candidate -and (Test-Path $candidate)) {
154
+ return $candidate
155
+ }
156
+ }
157
+
158
+ return $candidates[-1]
159
+ }
160
+
161
+ $runtimeRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
162
+ $profilePath = Get-ProfilePath -RuntimeRoot $runtimeRoot -ProfileName $Profile
163
+ $checks = New-Object 'System.Collections.Generic.List[object]'
139
164
 
140
165
  if (Test-Path $profilePath) {
141
166
  Add-Check -List $checks -Name "profile_file" -Status "ok" -Detail $profilePath
@@ -72,7 +72,7 @@ function Test-AllowedChatIdsFormat {
72
72
  return $true
73
73
  }
74
74
 
75
- function Prompt-RequiredValue {
75
+ function Prompt-RequiredValue {
76
76
  param(
77
77
  [string]$Prompt,
78
78
  [string]$CurrentValue,
@@ -91,12 +91,37 @@ function Prompt-RequiredValue {
91
91
  return $inputValue
92
92
  }
93
93
  Write-Host $ErrorMessage -ForegroundColor Yellow
94
- }
95
- }
96
-
97
- $runtimeRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
98
- $profilePath = Join-Path $runtimeRoot ("profiles\" + $Profile.ToLower() + ".json")
99
- $profileJson = Try-ReadJson -Path $profilePath
94
+ }
95
+ }
96
+
97
+ function Get-ProfilePath {
98
+ param(
99
+ [string]$RuntimeRoot,
100
+ [string]$ProfileName
101
+ )
102
+
103
+ $normalized = [string]$ProfileName
104
+ if (-not $normalized) { $normalized = "" }
105
+ $normalized = $normalized.ToLower()
106
+ $candidates = @()
107
+ if ($env:BLUN_CODEX_PROFILE_ROOT) {
108
+ $candidates += (Join-Path $env:BLUN_CODEX_PROFILE_ROOT ($normalized + ".json"))
109
+ }
110
+ $candidates += (Join-Path $env:USERPROFILE (".codex\\profiles\\codexlink\\" + $normalized + ".json"))
111
+ $candidates += (Join-Path $RuntimeRoot ("profiles\\" + $normalized + ".json"))
112
+
113
+ foreach ($candidate in $candidates) {
114
+ if ($candidate -and (Test-Path $candidate)) {
115
+ return $candidate
116
+ }
117
+ }
118
+
119
+ return $candidates[-1]
120
+ }
121
+
122
+ $runtimeRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
123
+ $profilePath = Get-ProfilePath -RuntimeRoot $runtimeRoot -ProfileName $Profile
124
+ $profileJson = Try-ReadJson -Path $profilePath
100
125
 
101
126
  if (-not $profileJson) {
102
127
  throw "Profile not found or invalid: $profilePath"
@@ -57,8 +57,33 @@ function Get-TelegramPluginRoot {
57
57
  return $null
58
58
  }
59
59
 
60
+ function Get-ProfilePath {
61
+ param(
62
+ [string]$RuntimeRoot,
63
+ [string]$ProfileName
64
+ )
65
+
66
+ $normalized = [string]$ProfileName
67
+ if (-not $normalized) { $normalized = "" }
68
+ $normalized = $normalized.ToLower()
69
+ $candidates = @()
70
+ if ($env:BLUN_CODEX_PROFILE_ROOT) {
71
+ $candidates += (Join-Path $env:BLUN_CODEX_PROFILE_ROOT ($normalized + ".json"))
72
+ }
73
+ $candidates += (Join-Path $env:USERPROFILE (".codex\\profiles\\codexlink\\" + $normalized + ".json"))
74
+ $candidates += (Join-Path $RuntimeRoot ("profiles\\" + $normalized + ".json"))
75
+
76
+ foreach ($candidate in $candidates) {
77
+ if ($candidate -and (Test-Path $candidate)) {
78
+ return $candidate
79
+ }
80
+ }
81
+
82
+ return $candidates[-1]
83
+ }
84
+
60
85
  $runtimeRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
61
- $profilePath = Join-Path $runtimeRoot ("profiles\" + $Profile.ToLower() + ".json")
86
+ $profilePath = Get-ProfilePath -RuntimeRoot $runtimeRoot -ProfileName $Profile
62
87
  $profileJson = Try-ReadJson -Path $profilePath
63
88
  $profileAgent = if ($profileJson -and $profileJson.agent_name) { [string]$profileJson.agent_name } else { $Profile.ToLower() }
64
89
  $runtimeDir = Join-Path $env:USERPROFILE (".codex\\runtimes\\" + $profileAgent)