replit-tools 1.2.37 → 1.2.38

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": "replit-tools",
3
- "version": "1.2.37",
3
+ "version": "1.2.38",
4
4
  "description": "DATA Tools - One command to set up Claude Code and Codex CLI on Replit with full persistence",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -130,22 +130,6 @@ get_recent_sessions() {
130
130
  const id = meta.payload.id;
131
131
  const firstTs = Date.parse(meta.payload.timestamp || meta.timestamp);
132
132
 
133
- const cleanUser = (raw) => {
134
- if (!raw) return '';
135
- let t = raw
136
- .replace(/<environment_context>[\s\S]*?<\/environment_context>/g, '')
137
- .replace(/<user_instructions>[\s\S]*?<\/user_instructions>/g, '')
138
- .replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g, '')
139
- .replace(/<command-name>[\s\S]*?<\/command-name>/g, '')
140
- .replace(/<command-message>[\s\S]*?<\/command-message>/g, '')
141
- .replace(/<command-args>[\s\S]*?<\/command-args>/g, '')
142
- .replace(/<local-command-stdout>[\s\S]*?<\/local-command-stdout>/g, '')
143
- .replace(/<local-command-caveat>[\s\S]*?<\/local-command-caveat>/g, '')
144
- .trim();
145
- if (t.startsWith('# AGENTS.md')) return '';
146
- return t;
147
- };
148
-
149
133
  let lastTs = firstTs;
150
134
  let firstPrompt = '';
151
135
  let lastPrompt = '';
@@ -154,9 +138,9 @@ get_recent_sessions() {
154
138
  try {
155
139
  const j = JSON.parse(ln);
156
140
  if (j.timestamp) lastTs = Math.max(lastTs, Date.parse(j.timestamp));
157
- if (j.type === 'response_item' && j.payload && j.payload.role === 'user' && Array.isArray(j.payload.content)) {
158
- const raw = (j.payload.content.find(c => c.type === 'input_text') || {}).text || '';
159
- const text = cleanUser(raw);
141
+ // event_msg.user_message = actual user-typed input only (no AGENTS.md, no env_context)
142
+ if (j.type === 'event_msg' && j.payload && j.payload.type === 'user_message') {
143
+ const text = (j.payload.message || '').trim();
160
144
  if (text) {
161
145
  if (!firstPrompt) firstPrompt = text;
162
146
  lastPrompt = text;
@@ -166,7 +150,7 @@ get_recent_sessions() {
166
150
  } catch(e) {}
167
151
  }
168
152
 
169
- // Skip sessions with no real user input (sub-agents, programmatic runs)
153
+ // Skip sessions with no real user-typed input (sub-agents, programmatic runs)
170
154
  if (msgCount === 0 || !firstPrompt) continue;
171
155
 
172
156
  const stat = fs.statSync(f);
@@ -395,22 +379,6 @@ get_recent_24h_sessions() {
395
379
  const id = meta.payload.id;
396
380
  const firstTs = Date.parse(meta.payload.timestamp || meta.timestamp);
397
381
 
398
- const cleanUser = (raw) => {
399
- if (!raw) return '';
400
- let t = raw
401
- .replace(/<environment_context>[\s\S]*?<\/environment_context>/g, '')
402
- .replace(/<user_instructions>[\s\S]*?<\/user_instructions>/g, '')
403
- .replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g, '')
404
- .replace(/<command-name>[\s\S]*?<\/command-name>/g, '')
405
- .replace(/<command-message>[\s\S]*?<\/command-message>/g, '')
406
- .replace(/<command-args>[\s\S]*?<\/command-args>/g, '')
407
- .replace(/<local-command-stdout>[\s\S]*?<\/local-command-stdout>/g, '')
408
- .replace(/<local-command-caveat>[\s\S]*?<\/local-command-caveat>/g, '')
409
- .trim();
410
- if (t.startsWith('# AGENTS.md')) return '';
411
- return t;
412
- };
413
-
414
382
  let lastTs = firstTs;
415
383
  let firstPrompt = '';
416
384
  let realMsgCount = 0;
@@ -418,8 +386,9 @@ get_recent_24h_sessions() {
418
386
  try {
419
387
  const j = JSON.parse(ln);
420
388
  if (j.timestamp) lastTs = Math.max(lastTs, Date.parse(j.timestamp));
421
- if (j.type === 'response_item' && j.payload && j.payload.role === 'user' && Array.isArray(j.payload.content)) {
422
- const text = cleanUser((j.payload.content.find(c => c.type === 'input_text') || {}).text || '');
389
+ // event_msg.user_message = actual user-typed input only
390
+ if (j.type === 'event_msg' && j.payload && j.payload.type === 'user_message') {
391
+ const text = (j.payload.message || '').trim();
423
392
  if (text) {
424
393
  if (!firstPrompt) firstPrompt = text;
425
394
  realMsgCount++;
@@ -428,7 +397,7 @@ get_recent_24h_sessions() {
428
397
  } catch(e) {}
429
398
  }
430
399
 
431
- // Skip sub-agent / programmatic sessions with no real user prompt
400
+ // Skip sub-agent / programmatic sessions
432
401
  if (realMsgCount === 0 || !firstPrompt) continue;
433
402
 
434
403
  sessions.set('codex:' + id, { tool: 'codex', id, firstSeen: firstTs, lastSeen: lastTs, firstPrompt });