@kelceyp/caw-server 1.0.210 → 1.0.212

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.
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ console.log('caw: User-facing commands coming in OM3.');
3
+ console.log('Use caw-agent-cli for agent CLI commands.');
4
+ process.exit(0);
@@ -21,15 +21,8 @@
21
21
 
22
22
  import { createInterface } from 'readline';
23
23
 
24
- const pad = (n) => String(n).padStart(2, '0');
25
- const pad3 = (n) => String(n).padStart(3, '0');
26
- const formatTimestamp = () => {
27
- const now = new Date();
28
- const h = now.getHours();
29
- const ampm = h >= 12 ? 'pm' : 'am';
30
- const h12 = h % 12 || 12;
31
- return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}` +
32
- ` ${pad(h12)}:${pad(now.getMinutes())}:${pad(now.getSeconds())}.${pad3(now.getMilliseconds())} ${ampm}`;
24
+ const logStderr = (level, msg) => {
25
+ process.stderr.write(JSON.stringify({ level, msg }) + '\n');
33
26
  };
34
27
 
35
28
  const MODEL_NAME = process.env.EMBEDDING_MODEL || 'nomic-ai/nomic-embed-text-v1.5';
@@ -61,17 +54,17 @@ const run = async () => {
61
54
  },
62
55
  progress_callback: (progress) => {
63
56
  if (progress.status === 'download') {
64
- process.stderr.write(`${formatTimestamp()} [EmbeddingWorker] Downloading: ${progress.file} (${Math.round((progress.loaded / progress.total) * 100)}%)\n`);
57
+ logStderr('debug', `Downloading: ${progress.file} (${Math.round((progress.loaded / progress.total) * 100)}%)`);
65
58
  } else if (progress.status === 'ready') {
66
59
  const suffix = progress.file ? `: ${progress.file}` : '';
67
- process.stderr.write(`${formatTimestamp()} [EmbeddingWorker] Ready${suffix}\n`);
60
+ logStderr('debug', `Ready${suffix}`);
68
61
  }
69
62
  }
70
63
  });
71
64
 
72
65
  // Log loaded model details and baseline memory
73
66
  const rss = Math.round(process.memoryUsage().rss / 1024 / 1024);
74
- process.stderr.write(`${formatTimestamp()} [EmbeddingWorker] Model loaded. RSS: ${rss}MB\n`);
67
+ logStderr('info', `Model loaded. RSS: ${rss}MB`);
75
68
 
76
69
  sendLine({ ready: true });
77
70
  } catch (err) {
@@ -116,7 +109,7 @@ const run = async () => {
116
109
  try {
117
110
  output = await pipe(texts, paddingOptions);
118
111
  } catch (_paddingErr) {
119
- process.stderr.write(`${formatTimestamp()} [EmbeddingWorker] padding options unsupported, retrying without padding\n`);
112
+ logStderr('warn', 'padding options unsupported, retrying without padding');
120
113
  output = await pipe(texts, { pooling: 'mean', normalize: false });
121
114
  }
122
115
  } else {
@@ -126,7 +119,7 @@ const run = async () => {
126
119
  embedCallCount++;
127
120
  const embedRss = Math.round(process.memoryUsage().rss / 1024 / 1024);
128
121
  const shapeStr = maxLength !== undefined ? `[${texts.length}×${maxLength}]` : `[${texts.length}×var]`;
129
- process.stderr.write(`${formatTimestamp()} [EmbeddingWorker] Embed #${embedCallCount}: shape=${shapeStr}, RSS: ${embedRss}MB\n`);
122
+ logStderr('debug', `Embed #${embedCallCount}: shape=${shapeStr}, RSS: ${embedRss}MB`);
130
123
  sendLine({ vectors });
131
124
  } catch (err) {
132
125
  sendLine({ error: `Embedding failed: ${err.message}` });