@funnycode/myclaude 0.1.107 → 0.1.109

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/dist/myclaude.js CHANGED
@@ -4,8 +4,8 @@
4
4
  // MACRO - build-time constants (injected by build.ts)
5
5
  // MACRO injected by build script
6
6
  globalThis.MACRO = {
7
- VERSION: "0.1.107",
8
- BUILD_TIME: "2026-07-19T21:12:38.783Z",
7
+ VERSION: "0.1.109",
8
+ BUILD_TIME: "2026-07-20T08:41:51.210Z",
9
9
  PACKAGE_URL: "@funnycode/myclaude",
10
10
  NATIVE_PACKAGE_URL: "@funnycode/myclaude",
11
11
  VERSION_CHANGELOG: '',
@@ -117491,7 +117491,7 @@ var package_default;
117491
117491
  var init_package = __esm(() => {
117492
117492
  package_default = {
117493
117493
  name: "@funnycode/myclaude",
117494
- version: "0.1.107",
117494
+ version: "0.1.109",
117495
117495
  private: false,
117496
117496
  description: "An open-source AI coding assistant in your terminal - powered by Claude",
117497
117497
  license: "MIT",
@@ -210157,6 +210157,23 @@ var init_postSamplingHooks = __esm(() => {
210157
210157
  import { createHash as createHash5 } from "crypto";
210158
210158
  import { promises as fs11 } from "fs";
210159
210159
  import { dirname as dirname27, join as join48 } from "path";
210160
+ function parseEventData(event) {
210161
+ const dataLines = [];
210162
+ for (const line of event.split(`
210163
+ `)) {
210164
+ if (line.startsWith("data: ") && line !== "data: [DONE]") {
210165
+ dataLines.push(line.slice(6));
210166
+ }
210167
+ }
210168
+ if (dataLines.length === 0)
210169
+ return null;
210170
+ try {
210171
+ return jsonParse(dataLines.join(`
210172
+ `));
210173
+ } catch {
210174
+ return null;
210175
+ }
210176
+ }
210160
210177
  function hashString3(str) {
210161
210178
  return createHash5("sha256").update(str).digest("hex");
210162
210179
  }
@@ -210185,12 +210202,13 @@ async function processQueue(agentIdOrSessionId) {
210185
210202
  logForDebugging(`dumpPrompts.processQueue: callback threw: ${err2}`, { level: "error" });
210186
210203
  }
210187
210204
  }
210205
+ processingFlags.delete(agentIdOrSessionId);
210188
210206
  const queue = dumpRequestQueue.get(agentIdOrSessionId);
210189
210207
  if (!queue || queue.length === 0) {
210190
210208
  dumpRequestQueue.delete(agentIdOrSessionId);
210191
- processingFlags.delete(agentIdOrSessionId);
210192
210209
  return;
210193
210210
  }
210211
+ return;
210194
210212
  }
210195
210213
  } catch (err2) {
210196
210214
  logError2(`processQueue: failed for ${agentIdOrSessionId}`, err2);
@@ -210341,24 +210359,12 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
210341
210359
  for (const event of completeEvents.split(`
210342
210360
 
210343
210361
  `)) {
210344
- let dataLines = [];
210345
- for (const line of event.split(`
210346
- `)) {
210347
- if (line.startsWith("data: ") && line !== "data: [DONE]") {
210348
- dataLines.push(line.slice(6));
210349
- }
210350
- }
210351
- if (dataLines.length > 0) {
210352
- try {
210353
- const chunk = jsonParse(dataLines.join(`
210354
- `));
210355
- chunkEntries.push(jsonStringify({ type: "chunk", timestamp, data: chunk }));
210356
- if (chunkEntries.length >= 50) {
210357
- await appendToFile(filePath, chunkEntries);
210358
- chunkEntries.length = 0;
210359
- }
210360
- } catch (err2) {
210361
- logForDebugging(`dumpPrompts.SSE parse error: ${err2}`, { level: "error" });
210362
+ const chunk = parseEventData(event);
210363
+ if (chunk !== null) {
210364
+ chunkEntries.push(jsonStringify({ type: "chunk", timestamp, data: chunk }));
210365
+ if (chunkEntries.length >= 50) {
210366
+ await appendToFile(filePath, chunkEntries);
210367
+ chunkEntries.length = 0;
210362
210368
  }
210363
210369
  }
210364
210370
  }
@@ -210395,24 +210401,12 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
210395
210401
  for (const event of completeEvents.split(`
210396
210402
 
210397
210403
  `)) {
210398
- let dataLines = [];
210399
- for (const line of event.split(`
210400
- `)) {
210401
- if (line.startsWith("data: ") && line !== "data: [DONE]") {
210402
- dataLines.push(line.slice(6));
210403
- }
210404
- }
210405
- if (dataLines.length > 0) {
210406
- try {
210407
- const chunk = jsonParse(dataLines.join(`
210408
- `));
210409
- chunkEntries.push(jsonStringify({ type: "chunk", timestamp, data: chunk }));
210410
- if (chunkEntries.length >= 50) {
210411
- await appendToFile(filePath, chunkEntries);
210412
- chunkEntries.length = 0;
210413
- }
210414
- } catch (err2) {
210415
- logForDebugging(`dumpPrompts.SSE parse error: ${err2}`, { level: "error" });
210404
+ const chunk = parseEventData(event);
210405
+ if (chunk !== null) {
210406
+ chunkEntries.push(jsonStringify({ type: "chunk", timestamp, data: chunk }));
210407
+ if (chunkEntries.length >= 50) {
210408
+ await appendToFile(filePath, chunkEntries);
210409
+ chunkEntries.length = 0;
210416
210410
  }
210417
210411
  }
210418
210412
  }
@@ -210426,21 +210420,9 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
210426
210420
  for (const event of buffer.split(`
210427
210421
 
210428
210422
  `)) {
210429
- let dataLines = [];
210430
- for (const line of event.split(`
210431
- `)) {
210432
- if (line.startsWith("data: ") && line !== "data: [DONE]") {
210433
- dataLines.push(line.slice(6));
210434
- }
210435
- }
210436
- if (dataLines.length > 0) {
210437
- try {
210438
- const chunk = jsonParse(dataLines.join(`
210439
- `));
210440
- chunkEntries.push(jsonStringify({ type: "chunk", timestamp, data: chunk }));
210441
- } catch (err2) {
210442
- logForDebugging(`dumpPrompts.SSE parse error: ${err2}`, { level: "error" });
210443
- }
210423
+ const chunk = parseEventData(event);
210424
+ if (chunk !== null) {
210425
+ chunkEntries.push(jsonStringify({ type: "chunk", timestamp, data: chunk }));
210444
210426
  }
210445
210427
  }
210446
210428
  }
@@ -301223,41 +301205,40 @@ function memoizeWithTTL(fn, ttlMs) {
301223
301205
  let lastCachedAt = 0;
301224
301206
  const memoized = memoize_default(fn);
301225
301207
  const originalClear = memoized.cache.clear.bind(memoized.cache);
301226
- const refreshMutexes = new Map;
301227
- const refreshMapMutex = new Mutex;
301208
+ const pendingRefreshes = new Map;
301228
301209
  const wrapped = async (...args) => {
301229
301210
  const now2 = Date.now();
301230
301211
  const cacheExpired = lastCachedAt !== 0 && now2 - lastCachedAt >= ttlMs;
301231
301212
  if (cacheExpired) {
301232
301213
  const key2 = String(args[0] ?? "_default");
301233
- const mapRelease = await refreshMapMutex.acquire();
301234
- let mutex = refreshMutexes.get(key2);
301235
- if (!mutex) {
301236
- mutex = new Mutex;
301237
- refreshMutexes.set(key2, mutex);
301238
- }
301239
- mapRelease();
301240
- const release = await mutex.acquire();
301241
- try {
301242
- const now22 = Date.now();
301243
- if (lastCachedAt !== 0 && now22 - lastCachedAt < ttlMs) {
301244
- return memoized(...args);
301245
- }
301214
+ const existing = pendingRefreshes.get(key2);
301215
+ if (existing) {
301216
+ return existing;
301217
+ }
301218
+ const refreshPromise = (async () => {
301246
301219
  try {
301247
- const freshResult = await fn(...args);
301248
- if (freshResult && typeof freshResult === "object" && "success" in freshResult && freshResult.success === true) {
301249
- originalClear();
301250
- memoized.cache.set(args[0], freshResult);
301251
- lastCachedAt = Date.now();
301252
- return freshResult;
301253
- }
301254
- return memoized(...args);
301255
- } catch (error49) {
301256
- return memoized(...args);
301220
+ const now22 = Date.now();
301221
+ if (lastCachedAt !== 0 && now22 - lastCachedAt < ttlMs) {
301222
+ return memoized(...args);
301223
+ }
301224
+ try {
301225
+ const freshResult = await fn(...args);
301226
+ if (freshResult && typeof freshResult === "object" && "success" in freshResult && freshResult.success === true) {
301227
+ originalClear();
301228
+ memoized.cache.set(args[0], freshResult);
301229
+ lastCachedAt = Date.now();
301230
+ return freshResult;
301231
+ }
301232
+ return memoized(...args);
301233
+ } catch (error49) {
301234
+ return memoized(...args);
301235
+ }
301236
+ } finally {
301237
+ pendingRefreshes.delete(key2);
301257
301238
  }
301258
- } finally {
301259
- release();
301260
- }
301239
+ })();
301240
+ pendingRefreshes.set(key2, refreshPromise);
301241
+ return refreshPromise;
301261
301242
  }
301262
301243
  try {
301263
301244
  const result = await memoized(...args);
package/dist/myclaude.mjs CHANGED
@@ -4,8 +4,8 @@
4
4
  // MACRO - build-time constants (injected by build.ts)
5
5
  // MACRO injected by build script
6
6
  globalThis.MACRO = {
7
- VERSION: "0.1.107",
8
- BUILD_TIME: "2026-07-19T21:12:38.783Z",
7
+ VERSION: "0.1.109",
8
+ BUILD_TIME: "2026-07-20T08:41:51.210Z",
9
9
  PACKAGE_URL: "@funnycode/myclaude",
10
10
  NATIVE_PACKAGE_URL: "@funnycode/myclaude",
11
11
  VERSION_CHANGELOG: '',
@@ -117491,7 +117491,7 @@ var package_default;
117491
117491
  var init_package = __esm(() => {
117492
117492
  package_default = {
117493
117493
  name: "@funnycode/myclaude",
117494
- version: "0.1.107",
117494
+ version: "0.1.109",
117495
117495
  private: false,
117496
117496
  description: "An open-source AI coding assistant in your terminal - powered by Claude",
117497
117497
  license: "MIT",
@@ -210157,6 +210157,23 @@ var init_postSamplingHooks = __esm(() => {
210157
210157
  import { createHash as createHash5 } from "crypto";
210158
210158
  import { promises as fs11 } from "fs";
210159
210159
  import { dirname as dirname27, join as join48 } from "path";
210160
+ function parseEventData(event) {
210161
+ const dataLines = [];
210162
+ for (const line of event.split(`
210163
+ `)) {
210164
+ if (line.startsWith("data: ") && line !== "data: [DONE]") {
210165
+ dataLines.push(line.slice(6));
210166
+ }
210167
+ }
210168
+ if (dataLines.length === 0)
210169
+ return null;
210170
+ try {
210171
+ return jsonParse(dataLines.join(`
210172
+ `));
210173
+ } catch {
210174
+ return null;
210175
+ }
210176
+ }
210160
210177
  function hashString3(str) {
210161
210178
  return createHash5("sha256").update(str).digest("hex");
210162
210179
  }
@@ -210185,12 +210202,13 @@ async function processQueue(agentIdOrSessionId) {
210185
210202
  logForDebugging(`dumpPrompts.processQueue: callback threw: ${err2}`, { level: "error" });
210186
210203
  }
210187
210204
  }
210205
+ processingFlags.delete(agentIdOrSessionId);
210188
210206
  const queue = dumpRequestQueue.get(agentIdOrSessionId);
210189
210207
  if (!queue || queue.length === 0) {
210190
210208
  dumpRequestQueue.delete(agentIdOrSessionId);
210191
- processingFlags.delete(agentIdOrSessionId);
210192
210209
  return;
210193
210210
  }
210211
+ return;
210194
210212
  }
210195
210213
  } catch (err2) {
210196
210214
  logError2(`processQueue: failed for ${agentIdOrSessionId}`, err2);
@@ -210341,24 +210359,12 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
210341
210359
  for (const event of completeEvents.split(`
210342
210360
 
210343
210361
  `)) {
210344
- let dataLines = [];
210345
- for (const line of event.split(`
210346
- `)) {
210347
- if (line.startsWith("data: ") && line !== "data: [DONE]") {
210348
- dataLines.push(line.slice(6));
210349
- }
210350
- }
210351
- if (dataLines.length > 0) {
210352
- try {
210353
- const chunk = jsonParse(dataLines.join(`
210354
- `));
210355
- chunkEntries.push(jsonStringify({ type: "chunk", timestamp, data: chunk }));
210356
- if (chunkEntries.length >= 50) {
210357
- await appendToFile(filePath, chunkEntries);
210358
- chunkEntries.length = 0;
210359
- }
210360
- } catch (err2) {
210361
- logForDebugging(`dumpPrompts.SSE parse error: ${err2}`, { level: "error" });
210362
+ const chunk = parseEventData(event);
210363
+ if (chunk !== null) {
210364
+ chunkEntries.push(jsonStringify({ type: "chunk", timestamp, data: chunk }));
210365
+ if (chunkEntries.length >= 50) {
210366
+ await appendToFile(filePath, chunkEntries);
210367
+ chunkEntries.length = 0;
210362
210368
  }
210363
210369
  }
210364
210370
  }
@@ -210395,24 +210401,12 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
210395
210401
  for (const event of completeEvents.split(`
210396
210402
 
210397
210403
  `)) {
210398
- let dataLines = [];
210399
- for (const line of event.split(`
210400
- `)) {
210401
- if (line.startsWith("data: ") && line !== "data: [DONE]") {
210402
- dataLines.push(line.slice(6));
210403
- }
210404
- }
210405
- if (dataLines.length > 0) {
210406
- try {
210407
- const chunk = jsonParse(dataLines.join(`
210408
- `));
210409
- chunkEntries.push(jsonStringify({ type: "chunk", timestamp, data: chunk }));
210410
- if (chunkEntries.length >= 50) {
210411
- await appendToFile(filePath, chunkEntries);
210412
- chunkEntries.length = 0;
210413
- }
210414
- } catch (err2) {
210415
- logForDebugging(`dumpPrompts.SSE parse error: ${err2}`, { level: "error" });
210404
+ const chunk = parseEventData(event);
210405
+ if (chunk !== null) {
210406
+ chunkEntries.push(jsonStringify({ type: "chunk", timestamp, data: chunk }));
210407
+ if (chunkEntries.length >= 50) {
210408
+ await appendToFile(filePath, chunkEntries);
210409
+ chunkEntries.length = 0;
210416
210410
  }
210417
210411
  }
210418
210412
  }
@@ -210426,21 +210420,9 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
210426
210420
  for (const event of buffer.split(`
210427
210421
 
210428
210422
  `)) {
210429
- let dataLines = [];
210430
- for (const line of event.split(`
210431
- `)) {
210432
- if (line.startsWith("data: ") && line !== "data: [DONE]") {
210433
- dataLines.push(line.slice(6));
210434
- }
210435
- }
210436
- if (dataLines.length > 0) {
210437
- try {
210438
- const chunk = jsonParse(dataLines.join(`
210439
- `));
210440
- chunkEntries.push(jsonStringify({ type: "chunk", timestamp, data: chunk }));
210441
- } catch (err2) {
210442
- logForDebugging(`dumpPrompts.SSE parse error: ${err2}`, { level: "error" });
210443
- }
210423
+ const chunk = parseEventData(event);
210424
+ if (chunk !== null) {
210425
+ chunkEntries.push(jsonStringify({ type: "chunk", timestamp, data: chunk }));
210444
210426
  }
210445
210427
  }
210446
210428
  }
@@ -301223,41 +301205,40 @@ function memoizeWithTTL(fn, ttlMs) {
301223
301205
  let lastCachedAt = 0;
301224
301206
  const memoized = memoize_default(fn);
301225
301207
  const originalClear = memoized.cache.clear.bind(memoized.cache);
301226
- const refreshMutexes = new Map;
301227
- const refreshMapMutex = new Mutex;
301208
+ const pendingRefreshes = new Map;
301228
301209
  const wrapped = async (...args) => {
301229
301210
  const now2 = Date.now();
301230
301211
  const cacheExpired = lastCachedAt !== 0 && now2 - lastCachedAt >= ttlMs;
301231
301212
  if (cacheExpired) {
301232
301213
  const key2 = String(args[0] ?? "_default");
301233
- const mapRelease = await refreshMapMutex.acquire();
301234
- let mutex = refreshMutexes.get(key2);
301235
- if (!mutex) {
301236
- mutex = new Mutex;
301237
- refreshMutexes.set(key2, mutex);
301238
- }
301239
- mapRelease();
301240
- const release = await mutex.acquire();
301241
- try {
301242
- const now22 = Date.now();
301243
- if (lastCachedAt !== 0 && now22 - lastCachedAt < ttlMs) {
301244
- return memoized(...args);
301245
- }
301214
+ const existing = pendingRefreshes.get(key2);
301215
+ if (existing) {
301216
+ return existing;
301217
+ }
301218
+ const refreshPromise = (async () => {
301246
301219
  try {
301247
- const freshResult = await fn(...args);
301248
- if (freshResult && typeof freshResult === "object" && "success" in freshResult && freshResult.success === true) {
301249
- originalClear();
301250
- memoized.cache.set(args[0], freshResult);
301251
- lastCachedAt = Date.now();
301252
- return freshResult;
301253
- }
301254
- return memoized(...args);
301255
- } catch (error49) {
301256
- return memoized(...args);
301220
+ const now22 = Date.now();
301221
+ if (lastCachedAt !== 0 && now22 - lastCachedAt < ttlMs) {
301222
+ return memoized(...args);
301223
+ }
301224
+ try {
301225
+ const freshResult = await fn(...args);
301226
+ if (freshResult && typeof freshResult === "object" && "success" in freshResult && freshResult.success === true) {
301227
+ originalClear();
301228
+ memoized.cache.set(args[0], freshResult);
301229
+ lastCachedAt = Date.now();
301230
+ return freshResult;
301231
+ }
301232
+ return memoized(...args);
301233
+ } catch (error49) {
301234
+ return memoized(...args);
301235
+ }
301236
+ } finally {
301237
+ pendingRefreshes.delete(key2);
301257
301238
  }
301258
- } finally {
301259
- release();
301260
- }
301239
+ })();
301240
+ pendingRefreshes.set(key2, refreshPromise);
301241
+ return refreshPromise;
301261
301242
  }
301262
301243
  try {
301263
301244
  const result = await memoized(...args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnycode/myclaude",
3
- "version": "0.1.107",
3
+ "version": "0.1.109",
4
4
  "private": false,
5
5
  "description": "An open-source AI coding assistant in your terminal - powered by Claude",
6
6
  "license": "MIT",