@funnycode/myclaude 0.1.106 → 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.106",
8
- BUILD_TIME: "2026-07-19T19:22:14.042Z",
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.106",
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,34 +210419,21 @@ 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
  }
210447
210428
  if (chunkEntries.length > 0) {
210448
210429
  await appendToFile(filePath, chunkEntries);
210449
210430
  }
210450
- data = { stream: true, chunks: [] };
210451
210431
  } else {
210452
210432
  data = await cloned.json();
210433
+ await appendToFile(filePath, [
210434
+ jsonStringify({ type: "response", timestamp, data })
210435
+ ]);
210453
210436
  }
210454
- await appendToFile(filePath, [
210455
- jsonStringify({ type: "response", timestamp, data })
210456
- ]);
210457
210437
  } catch (err2) {
210458
210438
  logError2(`dumpPrompts.response handler error: ${err2}`);
210459
210439
  }
@@ -301224,49 +301204,51 @@ function memoizeWithTTL(fn, ttlMs) {
301224
301204
  let lastCachedAt = 0;
301225
301205
  const memoized = memoize_default(fn);
301226
301206
  const originalClear = memoized.cache.clear.bind(memoized.cache);
301227
- const refreshMutexes = new Map;
301228
- const refreshMapMutex = new Mutex;
301207
+ const pendingRefreshes = new Map;
301229
301208
  const wrapped = async (...args) => {
301230
301209
  const now2 = Date.now();
301231
301210
  const cacheExpired = lastCachedAt !== 0 && now2 - lastCachedAt >= ttlMs;
301232
301211
  if (cacheExpired) {
301233
301212
  const key2 = String(args[0] ?? "_default");
301234
- const mapRelease = await refreshMapMutex.acquire();
301235
- let mutex = refreshMutexes.get(key2);
301236
- if (!mutex) {
301237
- mutex = new Mutex;
301238
- refreshMutexes.set(key2, mutex);
301239
- }
301240
- mapRelease();
301241
- const release = await mutex.acquire();
301242
- try {
301243
- const now22 = Date.now();
301244
- if (lastCachedAt !== 0 && now22 - lastCachedAt < ttlMs) {
301245
- return memoized(...args);
301246
- }
301213
+ const existing = pendingRefreshes.get(key2);
301214
+ if (existing) {
301215
+ return existing;
301216
+ }
301217
+ const refreshPromise = (async () => {
301247
301218
  try {
301248
- const freshResult = await fn(...args);
301249
- if (freshResult && typeof freshResult === "object" && "success" in freshResult && freshResult.success === true) {
301250
- originalClear();
301251
- memoized.cache.set(args[0], freshResult);
301252
- lastCachedAt = Date.now();
301253
- return freshResult;
301254
- }
301255
- return memoized(...args);
301256
- } catch (error49) {
301257
- 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);
301258
301237
  }
301259
- } finally {
301260
- release();
301261
- }
301238
+ })();
301239
+ pendingRefreshes.set(key2, refreshPromise);
301240
+ return refreshPromise;
301262
301241
  }
301263
301242
  try {
301264
301243
  const result = await memoized(...args);
301265
301244
  if (result && typeof result === "object" && "success" in result && result.success === true) {
301266
301245
  lastCachedAt = Date.now();
301267
- } else if (result && typeof result === "object" && "success" in result && result.success === false) {}
301246
+ } else if (result && typeof result === "object" && "success" in result && result.success === false) {
301247
+ lastCachedAt = Date.now();
301248
+ }
301268
301249
  return result;
301269
301250
  } catch (error49) {
301251
+ lastCachedAt = Date.now();
301270
301252
  return { success: false };
301271
301253
  }
301272
301254
  };
@@ -342502,8 +342484,7 @@ async function appendSessionLogImpl(sessionId, entry, url3, headers) {
342502
342484
  } else {
342503
342485
  let logs2 = null;
342504
342486
  try {
342505
- const sequentialWrapper = getOrCreateSequential(sessionId);
342506
- logs2 = await sequentialWrapper(sessionId, url3, headers, true);
342487
+ logs2 = await fetchSessionLogsFromUrl(sessionId, url3, headers);
342507
342488
  } catch (fetchError) {
342508
342489
  logError2(new Error(`Session 409: fetch failed for session ${sessionId}, entry ${entry.uuid}: ${fetchError instanceof Error ? fetchError.message : String(fetchError)}`));
342509
342490
  logForDiagnosticsNoPII("error", "session_persist_409_fetch_fail");
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.106",
8
- BUILD_TIME: "2026-07-19T19:22:14.042Z",
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.106",
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,34 +210419,21 @@ 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
  }
210447
210428
  if (chunkEntries.length > 0) {
210448
210429
  await appendToFile(filePath, chunkEntries);
210449
210430
  }
210450
- data = { stream: true, chunks: [] };
210451
210431
  } else {
210452
210432
  data = await cloned.json();
210433
+ await appendToFile(filePath, [
210434
+ jsonStringify({ type: "response", timestamp, data })
210435
+ ]);
210453
210436
  }
210454
- await appendToFile(filePath, [
210455
- jsonStringify({ type: "response", timestamp, data })
210456
- ]);
210457
210437
  } catch (err2) {
210458
210438
  logError2(`dumpPrompts.response handler error: ${err2}`);
210459
210439
  }
@@ -301224,49 +301204,51 @@ function memoizeWithTTL(fn, ttlMs) {
301224
301204
  let lastCachedAt = 0;
301225
301205
  const memoized = memoize_default(fn);
301226
301206
  const originalClear = memoized.cache.clear.bind(memoized.cache);
301227
- const refreshMutexes = new Map;
301228
- const refreshMapMutex = new Mutex;
301207
+ const pendingRefreshes = new Map;
301229
301208
  const wrapped = async (...args) => {
301230
301209
  const now2 = Date.now();
301231
301210
  const cacheExpired = lastCachedAt !== 0 && now2 - lastCachedAt >= ttlMs;
301232
301211
  if (cacheExpired) {
301233
301212
  const key2 = String(args[0] ?? "_default");
301234
- const mapRelease = await refreshMapMutex.acquire();
301235
- let mutex = refreshMutexes.get(key2);
301236
- if (!mutex) {
301237
- mutex = new Mutex;
301238
- refreshMutexes.set(key2, mutex);
301239
- }
301240
- mapRelease();
301241
- const release = await mutex.acquire();
301242
- try {
301243
- const now22 = Date.now();
301244
- if (lastCachedAt !== 0 && now22 - lastCachedAt < ttlMs) {
301245
- return memoized(...args);
301246
- }
301213
+ const existing = pendingRefreshes.get(key2);
301214
+ if (existing) {
301215
+ return existing;
301216
+ }
301217
+ const refreshPromise = (async () => {
301247
301218
  try {
301248
- const freshResult = await fn(...args);
301249
- if (freshResult && typeof freshResult === "object" && "success" in freshResult && freshResult.success === true) {
301250
- originalClear();
301251
- memoized.cache.set(args[0], freshResult);
301252
- lastCachedAt = Date.now();
301253
- return freshResult;
301254
- }
301255
- return memoized(...args);
301256
- } catch (error49) {
301257
- 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);
301258
301237
  }
301259
- } finally {
301260
- release();
301261
- }
301238
+ })();
301239
+ pendingRefreshes.set(key2, refreshPromise);
301240
+ return refreshPromise;
301262
301241
  }
301263
301242
  try {
301264
301243
  const result = await memoized(...args);
301265
301244
  if (result && typeof result === "object" && "success" in result && result.success === true) {
301266
301245
  lastCachedAt = Date.now();
301267
- } else if (result && typeof result === "object" && "success" in result && result.success === false) {}
301246
+ } else if (result && typeof result === "object" && "success" in result && result.success === false) {
301247
+ lastCachedAt = Date.now();
301248
+ }
301268
301249
  return result;
301269
301250
  } catch (error49) {
301251
+ lastCachedAt = Date.now();
301270
301252
  return { success: false };
301271
301253
  }
301272
301254
  };
@@ -342502,8 +342484,7 @@ async function appendSessionLogImpl(sessionId, entry, url3, headers) {
342502
342484
  } else {
342503
342485
  let logs2 = null;
342504
342486
  try {
342505
- const sequentialWrapper = getOrCreateSequential(sessionId);
342506
- logs2 = await sequentialWrapper(sessionId, url3, headers, true);
342487
+ logs2 = await fetchSessionLogsFromUrl(sessionId, url3, headers);
342507
342488
  } catch (fetchError) {
342508
342489
  logError2(new Error(`Session 409: fetch failed for session ${sessionId}, entry ${entry.uuid}: ${fetchError instanceof Error ? fetchError.message : String(fetchError)}`));
342509
342490
  logForDiagnosticsNoPII("error", "session_persist_409_fetch_fail");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnycode/myclaude",
3
- "version": "0.1.106",
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",