replit-tools 1.2.38 → 1.2.40

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.38",
3
+ "version": "1.2.40",
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": {
@@ -150,8 +150,12 @@ get_recent_sessions() {
150
150
  } catch(e) {}
151
151
  }
152
152
 
153
- // Skip sessions with no real user-typed input (sub-agents, programmatic runs)
153
+ // Skip sessions with no real user-typed input
154
154
  if (msgCount === 0 || !firstPrompt) continue;
155
+ // Skip sub-agent sessions: first message is an agent system prompt
156
+ if (/^(you are |you're |\\*\\*role\\*\\*|<role>|## role)/i.test(firstPrompt)) continue;
157
+ // Skip if first message is suspiciously long single-shot agent task (no follow-ups)
158
+ if (msgCount === 1 && firstPrompt.length > 500) continue;
155
159
 
156
160
  const stat = fs.statSync(f);
157
161
  sessionData.set('codex:' + id, {
@@ -399,6 +403,9 @@ get_recent_24h_sessions() {
399
403
 
400
404
  // Skip sub-agent / programmatic sessions
401
405
  if (realMsgCount === 0 || !firstPrompt) continue;
406
+ // Skip sub-agent sessions: first message is an agent system prompt
407
+ if (/^(you are |you're |\\*\\*role\\*\\*|<role>|## role)/i.test(firstPrompt)) continue;
408
+ if (realMsgCount === 1 && firstPrompt.length > 500) continue;
402
409
 
403
410
  sessions.set('codex:' + id, { tool: 'codex', id, firstSeen: firstTs, lastSeen: lastTs, firstPrompt });
404
411
  } catch(e) {}
@@ -170,6 +170,61 @@ for f in "${SSH_PERSISTENT}"/*; do
170
170
  esac
171
171
  done
172
172
 
173
+ # =============================================================================
174
+ # Step 2.6: Force forever-persistence settings for Claude + Codex
175
+ # =============================================================================
176
+ # Claude: cleanupPeriodDays = 365250 (~1000 years) so sessions never auto-delete
177
+ # Codex: history.max_bytes = 1 TiB so history.jsonl never rotates
178
+ # (session rollouts under ~/.codex/sessions/ are already kept forever)
179
+ if command -v node &>/dev/null; then
180
+ PERSIST_OUTPUT=$(CLAUDE_PERSISTENT_DIR="${CLAUDE_PERSISTENT}" CODEX_PERSISTENT_DIR="${CODEX_PERSISTENT}" node -e '
181
+ const fs = require("fs");
182
+ const claudeSettingsPath = process.env.CLAUDE_PERSISTENT_DIR + "/settings.json";
183
+ try {
184
+ let s = {};
185
+ if (fs.existsSync(claudeSettingsPath)) {
186
+ try { s = JSON.parse(fs.readFileSync(claudeSettingsPath, "utf8")); } catch(e) { s = {}; }
187
+ }
188
+ if (s.cleanupPeriodDays !== 365250) {
189
+ s.cleanupPeriodDays = 365250;
190
+ fs.writeFileSync(claudeSettingsPath, JSON.stringify(s, null, 2) + "\n");
191
+ console.log("Claude cleanupPeriodDays set to 365250 (~1000 years)");
192
+ }
193
+ } catch(e) { console.error("Could not update Claude settings: " + e.message); }
194
+
195
+ const codexConfigPath = process.env.CODEX_PERSISTENT_DIR + "/config.toml";
196
+ try {
197
+ let c = "";
198
+ if (fs.existsSync(codexConfigPath)) c = fs.readFileSync(codexConfigPath, "utf8");
199
+ const desired = "1099511627776"; // 1 TiB
200
+ const hasHistory = /\[history\]/.test(c);
201
+ let updated = false;
202
+ if (!hasHistory) {
203
+ c = (c.trimEnd() + "\n\n[history]\nmax_bytes = " + desired + "\n").trimStart();
204
+ updated = true;
205
+ } else {
206
+ const m = c.match(/(\[history\][\s\S]*?)max_bytes\s*=\s*(\d+)/);
207
+ if (m) {
208
+ if (m[2] !== desired) {
209
+ c = c.replace(/(\[history\][\s\S]*?max_bytes\s*=\s*)\d+/, "$1" + desired);
210
+ updated = true;
211
+ }
212
+ } else {
213
+ c = c.replace(/\[history\](\s*)/, "[history]$1max_bytes = " + desired + "\n");
214
+ updated = true;
215
+ }
216
+ }
217
+ if (updated) {
218
+ fs.writeFileSync(codexConfigPath, c);
219
+ console.log("Codex history.max_bytes set to 1 TiB");
220
+ }
221
+ } catch(e) { console.error("Could not update Codex config: " + e.message); }
222
+ ' 2>&1)
223
+ if [ -n "${PERSIST_OUTPUT}" ]; then
224
+ while IFS= read -r line; do log "✅ ${line}"; done <<< "${PERSIST_OUTPUT}"
225
+ fi
226
+ fi
227
+
173
228
  # =============================================================================
174
229
  # Step 3: Create ~/.local/share/claude symlink for installed versions
175
230
  # =============================================================================