clementine-agent 1.0.4 → 1.0.6

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.
@@ -11,7 +11,7 @@
11
11
  */
12
12
  import fs from 'node:fs';
13
13
  import path from 'node:path';
14
- import { query, listSubagents, getSubagentMessages, } from '@anthropic-ai/claude-agent-sdk';
14
+ import { query as rawQuery, listSubagents, getSubagentMessages, } from '@anthropic-ai/claude-agent-sdk';
15
15
  import pino from 'pino';
16
16
  import { BASE_DIR, PKG_DIR, VAULT_DIR, DAILY_NOTES_DIR, SOUL_FILE, AGENTS_FILE, MEMORY_FILE, PROFILES_DIR, AGENTS_DIR, ASSISTANT_NAME, OWNER_NAME, MODEL, MODELS, HEARTBEAT_MAX_TURNS, SEARCH_CONTEXT_LIMIT, SEARCH_RECENCY_LIMIT, SYSTEM_PROMPT_MAX_CONTEXT_CHARS, SESSION_EXCHANGE_HISTORY_SIZE, SESSION_EXCHANGE_MAX_CHARS, INJECTED_CONTEXT_MAX_CHARS, UNLEASHED_PHASE_TURNS, UNLEASHED_DEFAULT_MAX_HOURS, UNLEASHED_MAX_PHASES, PROJECTS_META_FILE, GOALS_DIR, CRON_PROGRESS_DIR, CRON_REFLECTIONS_DIR, HANDOFFS_DIR, BUDGET, ENABLE_1M_CONTEXT, IDENTITY_FILE, CLAUDE_CODE_OAUTH_TOKEN, ANTHROPIC_API_KEY as CONFIG_ANTHROPIC_API_KEY, } from '../config.js';
17
17
  import { DEFAULT_CHANNEL_CAPABILITIES } from '../types.js';
@@ -111,6 +111,34 @@ function stripLoneSurrogates(s) {
111
111
  // Replace any surrogate not properly paired with the Unicode replacement char
112
112
  return s.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g, '\uFFFD');
113
113
  }
114
+ /**
115
+ * Wrapper around the SDK's query() that sanitizes lone Unicode surrogates in
116
+ * prompt, systemPrompt, and appendSystemPrompt. Covers every call site in one
117
+ * place so new injection points (history, summaries, tool output) can't leak
118
+ * lone surrogates into the JSON body. Non-string prompts (streaming inputs)
119
+ * pass through untouched.
120
+ */
121
+ const query = ((args) => {
122
+ if (args && typeof args === 'object') {
123
+ const cleaned = { ...args };
124
+ if (typeof cleaned.prompt === 'string') {
125
+ cleaned.prompt = stripLoneSurrogates(cleaned.prompt);
126
+ }
127
+ if (cleaned.options && typeof cleaned.options === 'object') {
128
+ const opts = cleaned.options;
129
+ const newOpts = { ...opts };
130
+ if (typeof opts.systemPrompt === 'string') {
131
+ newOpts.systemPrompt = stripLoneSurrogates(opts.systemPrompt);
132
+ }
133
+ if (typeof opts.appendSystemPrompt === 'string') {
134
+ newOpts.appendSystemPrompt = stripLoneSurrogates(opts.appendSystemPrompt);
135
+ }
136
+ cleaned.options = newOpts;
137
+ }
138
+ return rawQuery(cleaned);
139
+ }
140
+ return rawQuery(args);
141
+ });
114
142
  /** Format a millisecond duration as a human-friendly "X ago" string. */
115
143
  function formatTimeAgo(ms) {
116
144
  const minutes = Math.floor(ms / 60_000);
package/install.sh CHANGED
@@ -87,15 +87,15 @@ step "Checking prerequisites"
87
87
  if command_exists node; then
88
88
  NODE_VERSION=$(node --version)
89
89
  NODE_MAJOR=$(echo "$NODE_VERSION" | sed 's/v//' | cut -d. -f1)
90
- if [ "$NODE_MAJOR" -ge 20 ] && [ "$NODE_MAJOR" -le 24 ]; then
90
+ if [ "$NODE_MAJOR" -ge 20 ]; then
91
91
  ok "Node.js ${NODE_VERSION}"
92
92
  else
93
- fail "Node.js ${NODE_VERSION} — need v20-24 LTS.
93
+ fail "Node.js ${NODE_VERSION} — need v20 or newer.
94
94
  Switch version: nvm install 22 && nvm use 22
95
95
  Then re-run: bash install.sh"
96
96
  fi
97
97
  else
98
- fail "Node.js not found. Clementine requires Node.js 20-24 LTS.
98
+ fail "Node.js not found. Clementine requires Node.js 20 or newer.
99
99
  Install via nvm:
100
100
  curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
101
101
  nvm install 22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clementine-agent",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Clementine — Personal AI Assistant (TypeScript)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",