@blunking/codexlink 0.1.15 → 0.1.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blunking/codexlink",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "BLUN CLI launcher with Telegram channel support for one visible session.",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -521,12 +521,17 @@ if ($useRemoteAppServer) {
521
521
  $codexArgs += $telegramAppServerWsUrl
522
522
  } else {
523
523
  $envFilePath = Join-Path $telegramStateDir ".env"
524
- $stateEnv = Read-DotEnvFile -Path $envFilePath
525
- $stateEnv["BLUN_TELEGRAM_AGENT_NAME"] = $profile.agent_name
526
- $stateEnv["BLUN_TELEGRAM_STATE_DIR"] = $telegramStateDir
527
- if ($telegramAllowedChatId) {
528
- $stateEnv["BLUN_TELEGRAM_ALLOWED_CHAT_ID"] = $telegramAllowedChatId
529
- }
524
+ $stateEnv = Read-DotEnvFile -Path $envFilePath
525
+ $stateEnv["BLUN_TELEGRAM_AGENT_NAME"] = $profile.agent_name
526
+ $stateEnv["BLUN_TELEGRAM_STATE_DIR"] = $telegramStateDir
527
+ $stateEnv["BLUN_CODEX_DISPLAY_NAME"] = $profile.display_name
528
+ $stateEnv["BLUN_CODEX_LANE"] = $profile.lane
529
+ $stateEnv["BLUN_CODEX_PERSONALITY"] = $profile.personality
530
+ $stateEnv["BLUN_CODEX_MODEL"] = $profile.model
531
+ $stateEnv["BLUN_CODEX_REASONING_EFFORT"] = $profile.reasoning_effort
532
+ if ($telegramAllowedChatId) {
533
+ $stateEnv["BLUN_TELEGRAM_ALLOWED_CHAT_ID"] = $telegramAllowedChatId
534
+ }
530
535
  $stateEnv["BLUN_TELEGRAM_PLUGIN_MODE"] = $TelegramMode
531
536
  $stateEnv["BLUN_TELEGRAM_APP_SERVER_WS_URL"] = $telegramAppServerWsUrl
532
537
  $stateEnv["BLUN_TELEGRAM_THREAD_ID"] = ""
@@ -120,11 +120,28 @@ export function isAddressOnlyPing(config, text) {
120
120
  return names.includes(normalizedText);
121
121
  }
122
122
 
123
+ function buildAgentRuntimeContext(config) {
124
+ const name = repairMojibake(String(config.displayName || config.agentName || "CodexLink")).trim() || "CodexLink";
125
+ const lane = repairMojibake(String(config.lane || "")).trim();
126
+ const customPrompt = repairMojibake(String(config.agentPrompt || "")).trim();
127
+ const lines = [
128
+ `[CodexLink Agent Context: You are ${name}.`,
129
+ lane ? `Assigned lane: ${lane}. Stay inside this lane unless the user explicitly redirects you.` : "Stay inside your assigned profile scope.",
130
+ "Treat short greetings or name-only pings as reachability checks, not translation/correction tasks.",
131
+ "For a greeting, reply briefly and naturally as this agent. Do not ask whether to translate, correct, or rewrite unless the user asks for that."
132
+ ];
133
+ if (customPrompt) {
134
+ lines.push(customPrompt);
135
+ }
136
+ lines[lines.length - 1] = `${lines[lines.length - 1]}]`;
137
+ return lines.join("\n");
138
+ }
139
+
123
140
  function buildPrompt(config, message) {
124
141
  const compactText = compactInboundText(message);
125
142
  const isBriefSummary = compactText.startsWith("Brief von ") || compactText.startsWith("Mnemo Idle");
126
143
  const label = isBriefSummary ? "" : compactInboundLabel(message);
127
- const header = [];
144
+ const header = [buildAgentRuntimeContext(config), ""];
128
145
 
129
146
  if (label) {
130
147
  header.push(label);
@@ -60,7 +60,9 @@ export function loadConfig() {
60
60
  return {
61
61
  paths,
62
62
  agentName: env.BLUN_TELEGRAM_AGENT_NAME?.trim() || env.TELEGRAM_AGENT_NAME?.trim() || "default",
63
+ displayName: env.BLUN_CODEX_DISPLAY_NAME?.trim() || env.BLUN_TELEGRAM_AGENT_NAME?.trim() || env.TELEGRAM_AGENT_NAME?.trim() || "CodexLink",
63
64
  lane: env.BLUN_CODEX_LANE?.trim() || "",
65
+ agentPrompt: env.BLUN_CODEX_AGENT_PROMPT?.trim() || "",
64
66
  botToken: env.BLUN_TELEGRAM_BOT_TOKEN?.trim() || env.TELEGRAM_BOT_TOKEN?.trim() || "",
65
67
  allowedChatId: allowedChatIds[0] || "",
66
68
  allowedChatIds,
@@ -71,6 +71,9 @@ function ensureSidecar(scriptName, pidFile, stdoutFile, stderrFile, config, opti
71
71
  BLUN_TELEGRAM_OTHER_AGENT_NAMES: Array.isArray(config.otherAgentNames) ? config.otherAgentNames.join(",") : "",
72
72
  BLUN_TELEGRAM_APP_SERVER_WS_URL: config.appServerWsUrl || "",
73
73
  BLUN_TELEGRAM_CODEX_BIN: config.codexBin || "codex",
74
+ BLUN_CODEX_DISPLAY_NAME: config.displayName || "",
75
+ BLUN_CODEX_LANE: config.lane || "",
76
+ BLUN_CODEX_AGENT_PROMPT: config.agentPrompt || "",
74
77
  BLUN_TELEGRAM_RESUME_TIMEOUT_MS: String(config.resumeTimeoutMs || 15000),
75
78
  BLUN_TELEGRAM_IDLE_COOLDOWN_MS: String(config.idleCooldownMs || 15000),
76
79
  BLUN_TELEGRAM_PROGRESS_FALLBACK_MS: String(config.progressFallbackMs || 20000),