cueme 0.1.9 → 0.1.10

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": "cueme",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Cue command protocol adapter (stdin/stdout JSON)",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
package/src/cli.js CHANGED
@@ -102,6 +102,7 @@ async function main() {
102
102
  ' cueme proto init',
103
103
  ' cueme proto ls',
104
104
  ' cueme proto path <agent>',
105
+ ' cueme fix <issue>',
105
106
  ' cueme join <agent_runtime>',
106
107
  ' cueme cue <agent_id> -',
107
108
  ' cueme pause <agent_id> [prompt|-]',
@@ -138,6 +139,88 @@ async function main() {
138
139
  return;
139
140
  }
140
141
 
142
+ if (sub === 'fix') {
143
+ const issue = pos[0];
144
+ if (!issue) {
145
+ process.stderr.write('error: missing <issue>\n');
146
+ process.stderr.write('Available fixes:\n');
147
+ process.stderr.write(' powershell_utf-8 Fix PowerShell encoding for Chinese characters\n');
148
+ process.exitCode = 2;
149
+ return;
150
+ }
151
+
152
+ if (issue === 'powershell_utf-8') {
153
+ if (process.platform !== 'win32') {
154
+ process.stderr.write('This fix is only for Windows PowerShell\n');
155
+ process.exitCode = 1;
156
+ return;
157
+ }
158
+
159
+ const { execSync } = require('child_process');
160
+ const os = require('os');
161
+ const path = require('path');
162
+
163
+ try {
164
+ // Get PowerShell profile path
165
+ const profilePath = path.join(
166
+ os.homedir(),
167
+ 'Documents',
168
+ 'WindowsPowerShell',
169
+ 'Microsoft.PowerShell_profile.ps1'
170
+ );
171
+
172
+ const encodingConfig = [
173
+ '$utf8NoBom = New-Object System.Text.UTF8Encoding($false)',
174
+ '[Console]::InputEncoding = $utf8NoBom',
175
+ '[Console]::OutputEncoding = $utf8NoBom',
176
+ '$OutputEncoding = $utf8NoBom',
177
+ ].join('\n');
178
+
179
+ // Create PowerShell script to fix encoding
180
+ const psScript = [
181
+ `$profilePath = '${profilePath.replace(/\\/g, '\\')}'`,
182
+ `$encodingConfig = @'`,
183
+ encodingConfig,
184
+ `'@`,
185
+ '',
186
+ '$profileDir = Split-Path -Parent $profilePath',
187
+ 'if (!(Test-Path $profileDir)) {',
188
+ ' New-Item -Path $profileDir -ItemType Directory -Force | Out-Null',
189
+ '}',
190
+ '',
191
+ 'if (!(Test-Path $profilePath)) {',
192
+ ' New-Item -Path $profilePath -ItemType File -Force | Out-Null',
193
+ ' Write-Host "Created PowerShell profile"',
194
+ '}',
195
+ '',
196
+ '$content = Get-Content $profilePath -Raw -ErrorAction SilentlyContinue',
197
+ 'if ($content -notlike "*utf8NoBom*") {',
198
+ ' Add-Content -Path $profilePath -Value "`n$encodingConfig"',
199
+ ' Write-Host "Added UTF-8 encoding to PowerShell profile"',
200
+ ' Write-Host "Please restart PowerShell for changes to take effect"',
201
+ '} else {',
202
+ ' Write-Host "UTF-8 encoding already configured"',
203
+ '}',
204
+ ].join('; ');
205
+
206
+ execSync(`powershell -NoProfile -Command "${psScript}"`, {
207
+ stdio: 'inherit',
208
+ });
209
+
210
+ } catch (err) {
211
+ process.stderr.write(`Failed to fix PowerShell encoding: ${err.message}\n`);
212
+ process.exitCode = 1;
213
+ }
214
+ return;
215
+ }
216
+
217
+ process.stderr.write(`error: unknown issue: ${issue}\n`);
218
+ process.stderr.write('Available fixes:\n');
219
+ process.stderr.write(' powershell_utf-8 Fix PowerShell encoding for Chinese characters\n');
220
+ process.exitCode = 2;
221
+ return;
222
+ }
223
+
141
224
  if (sub === 'join') {
142
225
  const agentRuntime = pos[0];
143
226
  if (!agentRuntime) {
package/src/handler.js CHANGED
@@ -139,20 +139,33 @@ async function handleJoin(db, agent_runtime) {
139
139
  const project_dir = process.cwd();
140
140
  const agent_terminal = detectAgentTerminal();
141
141
  const normalized_runtime = normalizeAgentRuntime(agent_runtime);
142
+
143
+ let message =
144
+ `agent_id=${agent_id}\n` +
145
+ `project_dir=${project_dir}\n` +
146
+ `agent_terminal=${agent_terminal}\n` +
147
+ `agent_runtime=${normalized_runtime}\n\n`;
148
+
149
+ // Windows PowerShell encoding fix reminder
150
+ if (process.platform === 'win32') {
151
+ message +=
152
+ 'Windows detected. To fix encoding issues with Chinese characters:\n' +
153
+ '1. Run: cueme fix powershell_utf-8\n' +
154
+ '2. Restart your terminal\n\n';
155
+ }
156
+
157
+ message +=
158
+ 'Use this agent_id when calling: cueme cue <agent_id> -\n' +
159
+ 'Then provide stdin with tag-block envelope (stdin MUST NOT be empty):\n' +
160
+ '<cueme_prompt>\n...\n</cueme_prompt>\n' +
161
+ '<cueme_payload>\n...\n</cueme_payload>\n\n' +
162
+ 'Remember this agent_id (but do NOT store it in any memory module). Before ending this session, call cue to provide a final summary, ask a question, or make a request.';
163
+
142
164
  return {
143
165
  ok: true,
144
166
  data: {
145
167
  agent_id,
146
- message:
147
- `agent_id=${agent_id}\n` +
148
- `project_dir=${project_dir}\n` +
149
- `agent_terminal=${agent_terminal}\n` +
150
- `agent_runtime=${normalized_runtime}\n\n` +
151
- 'Use this agent_id when calling: cueme cue <agent_id> -\n' +
152
- 'Then provide stdin with tag-block envelope (stdin MUST NOT be empty):\n' +
153
- '<cueme_prompt>\n...\n</cueme_prompt>\n' +
154
- '<cueme_payload>\n...\n</cueme_payload>\n\n' +
155
- 'Remember this agent_id (but do NOT store it in any memory module). Before ending this session, call cue to provide a final summary, ask a question, or make a request.',
168
+ message,
156
169
  },
157
170
  };
158
171
  }