@funnycode/myclaude 0.1.107 → 0.1.108

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.108",
8
+ BUILD_TIME: "2026-07-20T00:13:36.475Z",
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.108",
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
  }
@@ -210341,24 +210358,12 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
210341
210358
  for (const event of completeEvents.split(`
210342
210359
 
210343
210360
  `)) {
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" });
210361
+ const chunk = parseEventData(event);
210362
+ if (chunk !== null) {
210363
+ chunkEntries.push(jsonStringify({ type: "chunk", timestamp, data: chunk }));
210364
+ if (chunkEntries.length >= 50) {
210365
+ await appendToFile(filePath, chunkEntries);
210366
+ chunkEntries.length = 0;
210362
210367
  }
210363
210368
  }
210364
210369
  }
@@ -210395,24 +210400,12 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
210395
210400
  for (const event of completeEvents.split(`
210396
210401
 
210397
210402
  `)) {
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" });
210403
+ const chunk = parseEventData(event);
210404
+ if (chunk !== null) {
210405
+ chunkEntries.push(jsonStringify({ type: "chunk", timestamp, data: chunk }));
210406
+ if (chunkEntries.length >= 50) {
210407
+ await appendToFile(filePath, chunkEntries);
210408
+ chunkEntries.length = 0;
210416
210409
  }
210417
210410
  }
210418
210411
  }
@@ -210426,21 +210419,9 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
210426
210419
  for (const event of buffer.split(`
210427
210420
 
210428
210421
  `)) {
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
- }
210422
+ const chunk = parseEventData(event);
210423
+ if (chunk !== null) {
210424
+ chunkEntries.push(jsonStringify({ type: "chunk", timestamp, data: chunk }));
210444
210425
  }
210445
210426
  }
210446
210427
  }
@@ -301223,41 +301204,40 @@ function memoizeWithTTL(fn, ttlMs) {
301223
301204
  let lastCachedAt = 0;
301224
301205
  const memoized = memoize_default(fn);
301225
301206
  const originalClear = memoized.cache.clear.bind(memoized.cache);
301226
- const refreshMutexes = new Map;
301227
- const refreshMapMutex = new Mutex;
301207
+ const pendingRefreshes = new Map;
301228
301208
  const wrapped = async (...args) => {
301229
301209
  const now2 = Date.now();
301230
301210
  const cacheExpired = lastCachedAt !== 0 && now2 - lastCachedAt >= ttlMs;
301231
301211
  if (cacheExpired) {
301232
301212
  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
- }
301213
+ const existing = pendingRefreshes.get(key2);
301214
+ if (existing) {
301215
+ return existing;
301216
+ }
301217
+ const refreshPromise = (async () => {
301246
301218
  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);
301219
+ const now22 = Date.now();
301220
+ if (lastCachedAt !== 0 && now22 - lastCachedAt < ttlMs) {
301221
+ return memoized(...args);
301222
+ }
301223
+ try {
301224
+ const freshResult = await fn(...args);
301225
+ if (freshResult && typeof freshResult === "object" && "success" in freshResult && freshResult.success === true) {
301226
+ originalClear();
301227
+ memoized.cache.set(args[0], freshResult);
301228
+ lastCachedAt = Date.now();
301229
+ return freshResult;
301230
+ }
301231
+ return memoized(...args);
301232
+ } catch (error49) {
301233
+ return memoized(...args);
301234
+ }
301235
+ } finally {
301236
+ pendingRefreshes.delete(key2);
301257
301237
  }
301258
- } finally {
301259
- release();
301260
- }
301238
+ })();
301239
+ pendingRefreshes.set(key2, refreshPromise);
301240
+ return refreshPromise;
301261
301241
  }
301262
301242
  try {
301263
301243
  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.108",
8
+ BUILD_TIME: "2026-07-20T00:13:36.475Z",
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.108",
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
  }
@@ -210341,24 +210358,12 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
210341
210358
  for (const event of completeEvents.split(`
210342
210359
 
210343
210360
  `)) {
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" });
210361
+ const chunk = parseEventData(event);
210362
+ if (chunk !== null) {
210363
+ chunkEntries.push(jsonStringify({ type: "chunk", timestamp, data: chunk }));
210364
+ if (chunkEntries.length >= 50) {
210365
+ await appendToFile(filePath, chunkEntries);
210366
+ chunkEntries.length = 0;
210362
210367
  }
210363
210368
  }
210364
210369
  }
@@ -210395,24 +210400,12 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
210395
210400
  for (const event of completeEvents.split(`
210396
210401
 
210397
210402
  `)) {
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" });
210403
+ const chunk = parseEventData(event);
210404
+ if (chunk !== null) {
210405
+ chunkEntries.push(jsonStringify({ type: "chunk", timestamp, data: chunk }));
210406
+ if (chunkEntries.length >= 50) {
210407
+ await appendToFile(filePath, chunkEntries);
210408
+ chunkEntries.length = 0;
210416
210409
  }
210417
210410
  }
210418
210411
  }
@@ -210426,21 +210419,9 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
210426
210419
  for (const event of buffer.split(`
210427
210420
 
210428
210421
  `)) {
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
- }
210422
+ const chunk = parseEventData(event);
210423
+ if (chunk !== null) {
210424
+ chunkEntries.push(jsonStringify({ type: "chunk", timestamp, data: chunk }));
210444
210425
  }
210445
210426
  }
210446
210427
  }
@@ -301223,41 +301204,40 @@ function memoizeWithTTL(fn, ttlMs) {
301223
301204
  let lastCachedAt = 0;
301224
301205
  const memoized = memoize_default(fn);
301225
301206
  const originalClear = memoized.cache.clear.bind(memoized.cache);
301226
- const refreshMutexes = new Map;
301227
- const refreshMapMutex = new Mutex;
301207
+ const pendingRefreshes = new Map;
301228
301208
  const wrapped = async (...args) => {
301229
301209
  const now2 = Date.now();
301230
301210
  const cacheExpired = lastCachedAt !== 0 && now2 - lastCachedAt >= ttlMs;
301231
301211
  if (cacheExpired) {
301232
301212
  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
- }
301213
+ const existing = pendingRefreshes.get(key2);
301214
+ if (existing) {
301215
+ return existing;
301216
+ }
301217
+ const refreshPromise = (async () => {
301246
301218
  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);
301219
+ const now22 = Date.now();
301220
+ if (lastCachedAt !== 0 && now22 - lastCachedAt < ttlMs) {
301221
+ return memoized(...args);
301222
+ }
301223
+ try {
301224
+ const freshResult = await fn(...args);
301225
+ if (freshResult && typeof freshResult === "object" && "success" in freshResult && freshResult.success === true) {
301226
+ originalClear();
301227
+ memoized.cache.set(args[0], freshResult);
301228
+ lastCachedAt = Date.now();
301229
+ return freshResult;
301230
+ }
301231
+ return memoized(...args);
301232
+ } catch (error49) {
301233
+ return memoized(...args);
301234
+ }
301235
+ } finally {
301236
+ pendingRefreshes.delete(key2);
301257
301237
  }
301258
- } finally {
301259
- release();
301260
- }
301238
+ })();
301239
+ pendingRefreshes.set(key2, refreshPromise);
301240
+ return refreshPromise;
301261
301241
  }
301262
301242
  try {
301263
301243
  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.108",
4
4
  "private": false,
5
5
  "description": "An open-source AI coding assistant in your terminal - powered by Claude",
6
6
  "license": "MIT",