@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 +233 -115
- package/blun-codex.ps1 +140 -110
- package/package.json +4 -3
- package/start-codex-agent.ps1 +746 -710
- package/telegram-doctor.ps1 +256 -113
- package/telegram-plugin/.env.example +3 -1
- package/telegram-plugin/README.md +7 -3
- package/telegram-plugin/dispatcher.js +2 -2
- package/telegram-plugin/lib/bridge.js +138 -15
- package/telegram-plugin/lib/env.js +15 -4
- package/telegram-plugin/lib/sidecars.js +3 -1
- package/telegram-plugin/lib/storage.js +50 -49
- package/telegram-setup.ps1 +245 -0
- package/telegram-status.ps1 +30 -1
package/telegram-status.ps1
CHANGED
|
@@ -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 =
|
|
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)
|
|
@@ -73,6 +98,7 @@ $envFile = Read-DotEnvFile -Path (Join-Path $stateDir ".env")
|
|
|
73
98
|
$loadedThreads = @()
|
|
74
99
|
$queue = @($state.queue)
|
|
75
100
|
$queued = @($queue | Where-Object { $_.status -eq "queued" })
|
|
101
|
+
$ambient = @($queued | Where-Object { $_.relevance -eq "ambient" })
|
|
76
102
|
$submitted = @($queue | Where-Object { $_.status -eq "submitted" })
|
|
77
103
|
$delivered = @($queue | Where-Object { $_.status -eq "delivered" })
|
|
78
104
|
$errors = @($queue | Where-Object { $_.status -eq "error" })
|
|
@@ -129,12 +155,15 @@ $result = [ordered]@{
|
|
|
129
155
|
state_dir = $stateDir
|
|
130
156
|
plugin_root = $telegramPluginRoot
|
|
131
157
|
active_ws = $envFile["BLUN_TELEGRAM_APP_SERVER_WS_URL"]
|
|
158
|
+
dispatch_mode = $(if ($envFile["BLUN_TELEGRAM_DISPATCH_MODE"]) { $envFile["BLUN_TELEGRAM_DISPATCH_MODE"] } else { "deferred" })
|
|
159
|
+
idle_cooldown_ms = $(if ($envFile["BLUN_TELEGRAM_IDLE_COOLDOWN_MS"]) { $envFile["BLUN_TELEGRAM_IDLE_COOLDOWN_MS"] } else { "15000" })
|
|
132
160
|
env_thread_id = $envFile["BLUN_TELEGRAM_THREAD_ID"]
|
|
133
161
|
state_thread_id = $stateThreadId
|
|
134
162
|
active_thread_id = if ($stateThreadId) { $stateThreadId } else { $envFile["BLUN_TELEGRAM_THREAD_ID"] }
|
|
135
163
|
current_runtime = $currentRuntime
|
|
136
164
|
loaded_threads = $loadedThreads
|
|
137
165
|
queue_depth = $queued.Count
|
|
166
|
+
ambient_queue_depth = $ambient.Count
|
|
138
167
|
submitted_depth = $submitted.Count
|
|
139
168
|
pending_reply_depth = $pendingReplies.Count
|
|
140
169
|
delivered_count = $delivered.Count
|