@funnycode/myclaude 0.1.102 → 0.1.104
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 +41 -13
- package/dist/myclaude.mjs +41 -13
- package/package.json +1 -1
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.
|
|
8
|
-
BUILD_TIME: "2026-07-
|
|
7
|
+
VERSION: "0.1.104",
|
|
8
|
+
BUILD_TIME: "2026-07-19T15:30:42.756Z",
|
|
9
9
|
PACKAGE_URL: "@funnycode/myclaude",
|
|
10
10
|
NATIVE_PACKAGE_URL: "@funnycode/myclaude",
|
|
11
11
|
VERSION_CHANGELOG: '',
|
|
@@ -38380,6 +38380,7 @@ var init_log3 = __esm(() => {
|
|
|
38380
38380
|
function sequential(fn) {
|
|
38381
38381
|
const queue = [];
|
|
38382
38382
|
let processing = false;
|
|
38383
|
+
let reentrantCount = 0;
|
|
38383
38384
|
async function processQueue() {
|
|
38384
38385
|
if (processing)
|
|
38385
38386
|
return;
|
|
@@ -38389,10 +38390,13 @@ function sequential(fn) {
|
|
|
38389
38390
|
while (queue.length > 0) {
|
|
38390
38391
|
const { args, resolve: resolve5, reject, context } = queue.shift();
|
|
38391
38392
|
try {
|
|
38393
|
+
reentrantCount++;
|
|
38392
38394
|
const result = await fn.apply(context, args);
|
|
38393
38395
|
resolve5(result);
|
|
38394
38396
|
} catch (error49) {
|
|
38395
38397
|
reject(error49);
|
|
38398
|
+
} finally {
|
|
38399
|
+
reentrantCount--;
|
|
38396
38400
|
}
|
|
38397
38401
|
}
|
|
38398
38402
|
processing = false;
|
|
@@ -38401,6 +38405,9 @@ function sequential(fn) {
|
|
|
38401
38405
|
}
|
|
38402
38406
|
}
|
|
38403
38407
|
return function(...args) {
|
|
38408
|
+
if (reentrantCount > 0) {
|
|
38409
|
+
return fn.apply(this, args);
|
|
38410
|
+
}
|
|
38404
38411
|
return new Promise((resolve5, reject) => {
|
|
38405
38412
|
queue.push({ args, resolve: resolve5, reject, context: this });
|
|
38406
38413
|
processQueue();
|
|
@@ -117484,7 +117491,7 @@ var package_default;
|
|
|
117484
117491
|
var init_package = __esm(() => {
|
|
117485
117492
|
package_default = {
|
|
117486
117493
|
name: "@funnycode/myclaude",
|
|
117487
|
-
version: "0.1.
|
|
117494
|
+
version: "0.1.104",
|
|
117488
117495
|
private: false,
|
|
117489
117496
|
description: "An open-source AI coding assistant in your terminal - powered by Claude",
|
|
117490
117497
|
license: "MIT",
|
|
@@ -210291,10 +210298,12 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
|
|
|
210291
210298
|
dumpState.set(agentIdOrSessionId, state);
|
|
210292
210299
|
let timestamp;
|
|
210293
210300
|
if (init2?.method === "POST" && init2.body) {
|
|
210294
|
-
|
|
210295
|
-
|
|
210296
|
-
|
|
210297
|
-
|
|
210301
|
+
if (process.env.USER_TYPE === "ant") {
|
|
210302
|
+
timestamp = new Date().toISOString();
|
|
210303
|
+
enqueueDumpRequest(agentIdOrSessionId, async () => {
|
|
210304
|
+
await dumpRequest(init2.body, timestamp, state, filePath);
|
|
210305
|
+
});
|
|
210306
|
+
}
|
|
210298
210307
|
}
|
|
210299
210308
|
const response = await globalThis.fetch(input, init2);
|
|
210300
210309
|
if (timestamp && response.ok && true && process.env.USER_TYPE === "ant" && process.env.DUMP_PROMPTS === "1") {
|
|
@@ -210306,20 +210315,34 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
|
|
|
210306
210315
|
if (isStreaming && cloned.body) {
|
|
210307
210316
|
const reader = cloned.body.getReader();
|
|
210308
210317
|
const decoder = new TextDecoder;
|
|
210309
|
-
|
|
210318
|
+
const bufferChunks = [];
|
|
210319
|
+
let bufferLength = 0;
|
|
210320
|
+
const MAX_BUFFER_SIZE2 = 10 * 1024 * 1024;
|
|
210310
210321
|
const chunkEntries = [];
|
|
210311
210322
|
try {
|
|
210312
210323
|
while (true) {
|
|
210313
210324
|
const { done, value } = await reader.read();
|
|
210314
210325
|
if (done)
|
|
210315
210326
|
break;
|
|
210316
|
-
|
|
210317
|
-
|
|
210327
|
+
const decoded = decoder.decode(value, { stream: true });
|
|
210328
|
+
bufferChunks.push(decoded);
|
|
210329
|
+
bufferLength += decoded.length;
|
|
210330
|
+
if (bufferLength > MAX_BUFFER_SIZE2) {
|
|
210331
|
+
logForDebugging("dumpPrompts: buffer exceeded max size, skipping event", { level: "warn" });
|
|
210332
|
+
bufferChunks.length = 0;
|
|
210333
|
+
bufferLength = 0;
|
|
210334
|
+
continue;
|
|
210335
|
+
}
|
|
210336
|
+
const buffer2 = bufferChunks.join("");
|
|
210337
|
+
const lastDoubleNewline = buffer2.lastIndexOf(`
|
|
210318
210338
|
|
|
210319
210339
|
`);
|
|
210320
210340
|
if (lastDoubleNewline !== -1) {
|
|
210321
|
-
const completeEvents =
|
|
210322
|
-
|
|
210341
|
+
const completeEvents = buffer2.slice(0, lastDoubleNewline);
|
|
210342
|
+
const incomplete = buffer2.slice(lastDoubleNewline + 2);
|
|
210343
|
+
bufferChunks.length = 0;
|
|
210344
|
+
bufferChunks.push(incomplete);
|
|
210345
|
+
bufferLength = incomplete.length;
|
|
210323
210346
|
for (const event of completeEvents.split(`
|
|
210324
210347
|
|
|
210325
210348
|
`)) {
|
|
@@ -210344,6 +210367,7 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
|
|
|
210344
210367
|
} finally {
|
|
210345
210368
|
reader.releaseLock();
|
|
210346
210369
|
}
|
|
210370
|
+
const buffer = bufferChunks.join("");
|
|
210347
210371
|
if (buffer.trim()) {
|
|
210348
210372
|
for (const event of buffer.split(`
|
|
210349
210373
|
|
|
@@ -301142,16 +301166,19 @@ function memoizeWithTTL(fn, ttlMs) {
|
|
|
301142
301166
|
const memoized = memoize_default(fn);
|
|
301143
301167
|
const originalClear = memoized.cache.clear.bind(memoized.cache);
|
|
301144
301168
|
const refreshMutexes = new Map;
|
|
301169
|
+
const refreshMapMutex = new Mutex;
|
|
301145
301170
|
const wrapped = async (...args) => {
|
|
301146
301171
|
const now2 = Date.now();
|
|
301147
301172
|
const cacheExpired = lastCachedAt !== 0 && now2 - lastCachedAt >= ttlMs;
|
|
301148
301173
|
if (cacheExpired) {
|
|
301149
301174
|
const key2 = String(args[0] ?? "_default");
|
|
301175
|
+
const mapRelease = await refreshMapMutex.acquire();
|
|
301150
301176
|
let mutex = refreshMutexes.get(key2);
|
|
301151
301177
|
if (!mutex) {
|
|
301152
301178
|
mutex = new Mutex;
|
|
301153
301179
|
refreshMutexes.set(key2, mutex);
|
|
301154
301180
|
}
|
|
301181
|
+
mapRelease();
|
|
301155
301182
|
const release = await mutex.acquire();
|
|
301156
301183
|
try {
|
|
301157
301184
|
const now22 = Date.now();
|
|
@@ -342416,7 +342443,8 @@ async function appendSessionLogImpl(sessionId, entry, url3, headers) {
|
|
|
342416
342443
|
} else {
|
|
342417
342444
|
let logs2 = null;
|
|
342418
342445
|
try {
|
|
342419
|
-
|
|
342446
|
+
const sequentialWrapper = getOrCreateSequential(sessionId);
|
|
342447
|
+
logs2 = await sequentialWrapper(sessionId, url3, headers, true);
|
|
342420
342448
|
} catch (fetchError) {
|
|
342421
342449
|
logError2(new Error(`Session 409: fetch failed for session ${sessionId}, entry ${entry.uuid}: ${fetchError instanceof Error ? fetchError.message : String(fetchError)}`));
|
|
342422
342450
|
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.
|
|
8
|
-
BUILD_TIME: "2026-07-
|
|
7
|
+
VERSION: "0.1.104",
|
|
8
|
+
BUILD_TIME: "2026-07-19T15:30:42.756Z",
|
|
9
9
|
PACKAGE_URL: "@funnycode/myclaude",
|
|
10
10
|
NATIVE_PACKAGE_URL: "@funnycode/myclaude",
|
|
11
11
|
VERSION_CHANGELOG: '',
|
|
@@ -38380,6 +38380,7 @@ var init_log3 = __esm(() => {
|
|
|
38380
38380
|
function sequential(fn) {
|
|
38381
38381
|
const queue = [];
|
|
38382
38382
|
let processing = false;
|
|
38383
|
+
let reentrantCount = 0;
|
|
38383
38384
|
async function processQueue() {
|
|
38384
38385
|
if (processing)
|
|
38385
38386
|
return;
|
|
@@ -38389,10 +38390,13 @@ function sequential(fn) {
|
|
|
38389
38390
|
while (queue.length > 0) {
|
|
38390
38391
|
const { args, resolve: resolve5, reject, context } = queue.shift();
|
|
38391
38392
|
try {
|
|
38393
|
+
reentrantCount++;
|
|
38392
38394
|
const result = await fn.apply(context, args);
|
|
38393
38395
|
resolve5(result);
|
|
38394
38396
|
} catch (error49) {
|
|
38395
38397
|
reject(error49);
|
|
38398
|
+
} finally {
|
|
38399
|
+
reentrantCount--;
|
|
38396
38400
|
}
|
|
38397
38401
|
}
|
|
38398
38402
|
processing = false;
|
|
@@ -38401,6 +38405,9 @@ function sequential(fn) {
|
|
|
38401
38405
|
}
|
|
38402
38406
|
}
|
|
38403
38407
|
return function(...args) {
|
|
38408
|
+
if (reentrantCount > 0) {
|
|
38409
|
+
return fn.apply(this, args);
|
|
38410
|
+
}
|
|
38404
38411
|
return new Promise((resolve5, reject) => {
|
|
38405
38412
|
queue.push({ args, resolve: resolve5, reject, context: this });
|
|
38406
38413
|
processQueue();
|
|
@@ -117484,7 +117491,7 @@ var package_default;
|
|
|
117484
117491
|
var init_package = __esm(() => {
|
|
117485
117492
|
package_default = {
|
|
117486
117493
|
name: "@funnycode/myclaude",
|
|
117487
|
-
version: "0.1.
|
|
117494
|
+
version: "0.1.104",
|
|
117488
117495
|
private: false,
|
|
117489
117496
|
description: "An open-source AI coding assistant in your terminal - powered by Claude",
|
|
117490
117497
|
license: "MIT",
|
|
@@ -210291,10 +210298,12 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
|
|
|
210291
210298
|
dumpState.set(agentIdOrSessionId, state);
|
|
210292
210299
|
let timestamp;
|
|
210293
210300
|
if (init2?.method === "POST" && init2.body) {
|
|
210294
|
-
|
|
210295
|
-
|
|
210296
|
-
|
|
210297
|
-
|
|
210301
|
+
if (process.env.USER_TYPE === "ant") {
|
|
210302
|
+
timestamp = new Date().toISOString();
|
|
210303
|
+
enqueueDumpRequest(agentIdOrSessionId, async () => {
|
|
210304
|
+
await dumpRequest(init2.body, timestamp, state, filePath);
|
|
210305
|
+
});
|
|
210306
|
+
}
|
|
210298
210307
|
}
|
|
210299
210308
|
const response = await globalThis.fetch(input, init2);
|
|
210300
210309
|
if (timestamp && response.ok && true && process.env.USER_TYPE === "ant" && process.env.DUMP_PROMPTS === "1") {
|
|
@@ -210306,20 +210315,34 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
|
|
|
210306
210315
|
if (isStreaming && cloned.body) {
|
|
210307
210316
|
const reader = cloned.body.getReader();
|
|
210308
210317
|
const decoder = new TextDecoder;
|
|
210309
|
-
|
|
210318
|
+
const bufferChunks = [];
|
|
210319
|
+
let bufferLength = 0;
|
|
210320
|
+
const MAX_BUFFER_SIZE2 = 10 * 1024 * 1024;
|
|
210310
210321
|
const chunkEntries = [];
|
|
210311
210322
|
try {
|
|
210312
210323
|
while (true) {
|
|
210313
210324
|
const { done, value } = await reader.read();
|
|
210314
210325
|
if (done)
|
|
210315
210326
|
break;
|
|
210316
|
-
|
|
210317
|
-
|
|
210327
|
+
const decoded = decoder.decode(value, { stream: true });
|
|
210328
|
+
bufferChunks.push(decoded);
|
|
210329
|
+
bufferLength += decoded.length;
|
|
210330
|
+
if (bufferLength > MAX_BUFFER_SIZE2) {
|
|
210331
|
+
logForDebugging("dumpPrompts: buffer exceeded max size, skipping event", { level: "warn" });
|
|
210332
|
+
bufferChunks.length = 0;
|
|
210333
|
+
bufferLength = 0;
|
|
210334
|
+
continue;
|
|
210335
|
+
}
|
|
210336
|
+
const buffer2 = bufferChunks.join("");
|
|
210337
|
+
const lastDoubleNewline = buffer2.lastIndexOf(`
|
|
210318
210338
|
|
|
210319
210339
|
`);
|
|
210320
210340
|
if (lastDoubleNewline !== -1) {
|
|
210321
|
-
const completeEvents =
|
|
210322
|
-
|
|
210341
|
+
const completeEvents = buffer2.slice(0, lastDoubleNewline);
|
|
210342
|
+
const incomplete = buffer2.slice(lastDoubleNewline + 2);
|
|
210343
|
+
bufferChunks.length = 0;
|
|
210344
|
+
bufferChunks.push(incomplete);
|
|
210345
|
+
bufferLength = incomplete.length;
|
|
210323
210346
|
for (const event of completeEvents.split(`
|
|
210324
210347
|
|
|
210325
210348
|
`)) {
|
|
@@ -210344,6 +210367,7 @@ function createDumpPromptsFetch(agentIdOrSessionId) {
|
|
|
210344
210367
|
} finally {
|
|
210345
210368
|
reader.releaseLock();
|
|
210346
210369
|
}
|
|
210370
|
+
const buffer = bufferChunks.join("");
|
|
210347
210371
|
if (buffer.trim()) {
|
|
210348
210372
|
for (const event of buffer.split(`
|
|
210349
210373
|
|
|
@@ -301142,16 +301166,19 @@ function memoizeWithTTL(fn, ttlMs) {
|
|
|
301142
301166
|
const memoized = memoize_default(fn);
|
|
301143
301167
|
const originalClear = memoized.cache.clear.bind(memoized.cache);
|
|
301144
301168
|
const refreshMutexes = new Map;
|
|
301169
|
+
const refreshMapMutex = new Mutex;
|
|
301145
301170
|
const wrapped = async (...args) => {
|
|
301146
301171
|
const now2 = Date.now();
|
|
301147
301172
|
const cacheExpired = lastCachedAt !== 0 && now2 - lastCachedAt >= ttlMs;
|
|
301148
301173
|
if (cacheExpired) {
|
|
301149
301174
|
const key2 = String(args[0] ?? "_default");
|
|
301175
|
+
const mapRelease = await refreshMapMutex.acquire();
|
|
301150
301176
|
let mutex = refreshMutexes.get(key2);
|
|
301151
301177
|
if (!mutex) {
|
|
301152
301178
|
mutex = new Mutex;
|
|
301153
301179
|
refreshMutexes.set(key2, mutex);
|
|
301154
301180
|
}
|
|
301181
|
+
mapRelease();
|
|
301155
301182
|
const release = await mutex.acquire();
|
|
301156
301183
|
try {
|
|
301157
301184
|
const now22 = Date.now();
|
|
@@ -342416,7 +342443,8 @@ async function appendSessionLogImpl(sessionId, entry, url3, headers) {
|
|
|
342416
342443
|
} else {
|
|
342417
342444
|
let logs2 = null;
|
|
342418
342445
|
try {
|
|
342419
|
-
|
|
342446
|
+
const sequentialWrapper = getOrCreateSequential(sessionId);
|
|
342447
|
+
logs2 = await sequentialWrapper(sessionId, url3, headers, true);
|
|
342420
342448
|
} catch (fetchError) {
|
|
342421
342449
|
logError2(new Error(`Session 409: fetch failed for session ${sessionId}, entry ${entry.uuid}: ${fetchError instanceof Error ? fetchError.message : String(fetchError)}`));
|
|
342422
342450
|
logForDiagnosticsNoPII("error", "session_persist_409_fetch_fail");
|