cueme 0.1.9 → 0.1.11

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.11",
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,84 @@ 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
+ const fs = require('fs');
163
+
164
+ try {
165
+ // Get PowerShell profile path
166
+ const profilePath = path.join(
167
+ os.homedir(),
168
+ 'Documents',
169
+ 'WindowsPowerShell',
170
+ 'Microsoft.PowerShell_profile.ps1'
171
+ );
172
+
173
+ const encodingConfig = [
174
+ '$utf8NoBom = New-Object System.Text.UTF8Encoding($false)',
175
+ '[Console]::InputEncoding = $utf8NoBom',
176
+ '[Console]::OutputEncoding = $utf8NoBom',
177
+ '$OutputEncoding = $utf8NoBom',
178
+ ].join('\n');
179
+
180
+ // Ensure profile directory exists
181
+ const profileDir = path.dirname(profilePath);
182
+ if (!fs.existsSync(profileDir)) {
183
+ fs.mkdirSync(profileDir, { recursive: true });
184
+ process.stdout.write('Created PowerShell profile directory\n');
185
+ }
186
+
187
+ // Check if profile exists and if encoding is already configured
188
+ let needsUpdate = true;
189
+ if (fs.existsSync(profilePath)) {
190
+ const content = fs.readFileSync(profilePath, 'utf8');
191
+ if (content.includes('utf8NoBom')) {
192
+ process.stdout.write('UTF-8 encoding already configured\n');
193
+ needsUpdate = false;
194
+ }
195
+ } else {
196
+ process.stdout.write('Created PowerShell profile\n');
197
+ }
198
+
199
+ // Add encoding configuration if needed
200
+ if (needsUpdate) {
201
+ fs.appendFileSync(profilePath, '\n' + encodingConfig + '\n');
202
+ process.stdout.write('Added UTF-8 encoding to PowerShell profile\n');
203
+ process.stdout.write('Please restart PowerShell for changes to take effect\n');
204
+ }
205
+
206
+ } catch (err) {
207
+ process.stderr.write(`Failed to fix PowerShell encoding: ${err.message}\n`);
208
+ process.exitCode = 1;
209
+ }
210
+ return;
211
+ }
212
+
213
+ process.stderr.write(`error: unknown issue: ${issue}\n`);
214
+ process.stderr.write('Available fixes:\n');
215
+ process.stderr.write(' powershell_utf-8 Fix PowerShell encoding for Chinese characters\n');
216
+ process.exitCode = 2;
217
+ return;
218
+ }
219
+
141
220
  if (sub === 'join') {
142
221
  const agentRuntime = pos[0];
143
222
  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
  }