@mulmoclaude/core 5.11.3 → 5.12.0
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/assets/helps/error-recovery.md +19 -7
- package/assets/helps/sandbox.md +2 -2
- package/assets/helps/spreadsheet.md +9 -1
- package/dist/collection/index.cjs +3 -3
- package/dist/collection/index.js +3 -3
- package/dist/collection/registry/server/index.cjs +3 -3
- package/dist/collection/registry/server/index.js +3 -3
- package/dist/collection/server/index.cjs +2 -2
- package/dist/collection/server/index.js +2 -2
- package/dist/collection-watchers/index.cjs +4 -4
- package/dist/collection-watchers/index.js +4 -4
- package/dist/{discovery-CbwHtcwk.js → discovery-BTl21_hI.js} +3 -3
- package/dist/{discovery-CbwHtcwk.js.map → discovery-BTl21_hI.js.map} +1 -1
- package/dist/{discovery-DgZRmO7F.cjs → discovery-DBJRuDv2.cjs} +3 -3
- package/dist/{discovery-DgZRmO7F.cjs.map → discovery-DBJRuDv2.cjs.map} +1 -1
- package/dist/{dist-MFUV9FYo.js → dist-C0oU4X3A.js} +2 -2
- package/dist/dist-C0oU4X3A.js.map +1 -0
- package/dist/{dist-BZ62pKuU.cjs → dist-CAc42oZn.cjs} +2 -2
- package/dist/dist-CAc42oZn.cjs.map +1 -0
- package/dist/errorMessage-BYNQlnx0.cjs +1 -0
- package/dist/errorMessage-DVcsvx02.js +1 -0
- package/dist/{errors-B0xloJ3E.cjs → errors-DQr4mDbJ.cjs} +2 -2
- package/dist/{errors-B0xloJ3E.cjs.map → errors-DQr4mDbJ.cjs.map} +1 -1
- package/dist/{errors-zTAsW7dS.js → errors-Dgiw-unK.js} +2 -2
- package/dist/{errors-zTAsW7dS.js.map → errors-Dgiw-unK.js.map} +1 -1
- package/dist/feeds/server/index.cjs +5 -5
- package/dist/feeds/server/index.cjs.map +1 -1
- package/dist/feeds/server/index.js +5 -5
- package/dist/feeds/server/index.js.map +1 -1
- package/dist/google/index.cjs +3 -3
- package/dist/google/index.js +3 -3
- package/dist/{listen-N_8XdKz_.cjs → listen-CUJyj9V2.cjs} +2 -2
- package/dist/{listen-N_8XdKz_.cjs.map → listen-CUJyj9V2.cjs.map} +1 -1
- package/dist/{listen-DUlzSOzX.js → listen-CnLfYFdW.js} +2 -2
- package/dist/{listen-DUlzSOzX.js.map → listen-CnLfYFdW.js.map} +1 -1
- package/dist/notifier/index.cjs +1 -1
- package/dist/notifier/index.js +1 -1
- package/dist/{notifier-CiemUClt.cjs → notifier-BF49QNV7.cjs} +2 -2
- package/dist/{notifier-CiemUClt.cjs.map → notifier-BF49QNV7.cjs.map} +1 -1
- package/dist/{notifier-dgkC-h80.js → notifier-XGAgdX2J.js} +2 -2
- package/dist/{notifier-dgkC-h80.js.map → notifier-XGAgdX2J.js.map} +1 -1
- package/dist/plugin-vue/index.cjs +273 -197
- package/dist/plugin-vue/index.cjs.map +1 -1
- package/dist/plugin-vue/index.js +273 -197
- package/dist/plugin-vue/index.js.map +1 -1
- package/dist/prompt-files/index.cjs +1 -1
- package/dist/prompt-files/index.js +1 -1
- package/dist/{promptSafety-DFaOnOWN.js → promptSafety-C9uabl9i.js} +2 -2
- package/dist/{promptSafety-DFaOnOWN.js.map → promptSafety-C9uabl9i.js.map} +1 -1
- package/dist/{promptSafety-yET9jLep.cjs → promptSafety-CKmqbSTK.cjs} +2 -2
- package/dist/{promptSafety-yET9jLep.cjs.map → promptSafety-CKmqbSTK.cjs.map} +1 -1
- package/dist/remote-host/index.cjs +1 -1
- package/dist/remote-host/index.d.ts +7 -1
- package/dist/remote-host/index.js +1 -1
- package/dist/remote-host/server/hostRunner.d.ts +2 -1
- package/dist/remote-host/server/index.cjs +33 -28
- package/dist/remote-host/server/index.cjs.map +1 -1
- package/dist/remote-host/server/index.d.ts +2 -1
- package/dist/remote-host/server/index.js +33 -28
- package/dist/remote-host/server/index.js.map +1 -1
- package/dist/remote-host/server/lifecycle.d.ts +2 -0
- package/dist/remote-host/server/presenceProbe.d.ts +0 -2
- package/dist/remote-host/server/withTimeout.d.ts +2 -0
- package/dist/{remote-host-CoNX9JEC.js → remote-host-5f5LOmDU.js} +8 -4
- package/dist/remote-host-5f5LOmDU.js.map +1 -0
- package/dist/{remote-host-BMjh_F-6.cjs → remote-host-BLWjSIZd.cjs} +8 -4
- package/dist/remote-host-BLWjSIZd.cjs.map +1 -0
- package/dist/remote-view/index.cjs +1 -1
- package/dist/remote-view/index.js +1 -1
- package/dist/scheduler/index.cjs +2 -2
- package/dist/scheduler/index.js +2 -2
- package/dist/{server-BtbbQqBY.js → server-BdRkw2Gh.js} +5 -5
- package/dist/{server-BtbbQqBY.js.map → server-BdRkw2Gh.js.map} +1 -1
- package/dist/{server-CJek9Y3Q.cjs → server-ekmEXF9t.cjs} +5 -5
- package/dist/{server-CJek9Y3Q.cjs.map → server-ekmEXF9t.cjs.map} +1 -1
- package/dist/utils/index.cjs +2 -2
- package/dist/utils/index.js +2 -2
- package/dist/whisper/index.cjs +2 -2
- package/dist/whisper/index.js +2 -2
- package/dist/wiki/index.cjs +1 -1
- package/dist/wiki/index.js +1 -1
- package/dist/workspace-setup/index.js +1 -1
- package/dist/workspace-setup/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/dist-BZ62pKuU.cjs.map +0 -1
- package/dist/dist-MFUV9FYo.js.map +0 -1
- package/dist/errorMessage-OEQzRwsi.cjs +0 -1
- package/dist/errorMessage-VEiXHRnX.js +0 -1
- package/dist/remote-host-BMjh_F-6.cjs.map +0 -1
- package/dist/remote-host-CoNX9JEC.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as isRecord$1, t as errorMessage } from "../../dist-
|
|
2
|
-
import "../../errorMessage-
|
|
3
|
-
import { i as shouldGiveUpListening, n as backoffDelayMs, r as classifyListenerError, t as LISTEN_RETRY_WINDOW_MS } from "../../listen-
|
|
4
|
-
import { a as coerceJsonObject, c as isExpired, i as byCreatedAt, o as commandsCollection, r as buildHostPresence, s as hostDoc } from "../../remote-host-
|
|
1
|
+
import { c as isRecord$1, t as errorMessage } from "../../dist-C0oU4X3A.js";
|
|
2
|
+
import "../../errorMessage-DVcsvx02.js";
|
|
3
|
+
import { i as shouldGiveUpListening, n as backoffDelayMs, r as classifyListenerError, t as LISTEN_RETRY_WINDOW_MS } from "../../listen-CnLfYFdW.js";
|
|
4
|
+
import { a as coerceJsonObject, c as isExpired, i as byCreatedAt, o as commandsCollection, r as buildHostPresence, s as hostDoc } from "../../remote-host-5f5LOmDU.js";
|
|
5
5
|
import { deleteDoc, getDocFromServer, getFirestore, onSnapshot, query, runTransaction, serverTimestamp, setDoc, updateDoc, where } from "firebase/firestore";
|
|
6
6
|
import { performance } from "node:perf_hooks";
|
|
7
7
|
import { GoogleAuthProvider, getAuth, initializeAuth, signInWithCredential, signOut } from "firebase/auth";
|
|
@@ -282,7 +282,7 @@ var buildPresenceBeat = (firestore, channel, handlers, options, onStale) => {
|
|
|
282
282
|
});
|
|
283
283
|
return createPresenceBeat({
|
|
284
284
|
write: (online) => setDoc(presence, {
|
|
285
|
-
...buildHostPresence(channel, handlers, online),
|
|
285
|
+
...buildHostPresence(channel, handlers, online, options.machine),
|
|
286
286
|
updatedAt: serverTimestamp()
|
|
287
287
|
}),
|
|
288
288
|
onError: (message) => report(`presence write failed: ${message}`),
|
|
@@ -325,13 +325,13 @@ var startHostRunner = (firestore, channel, handlers, options = {}) => {
|
|
|
325
325
|
};
|
|
326
326
|
//#endregion
|
|
327
327
|
//#region src/remote-host/server/resilientRunner.ts
|
|
328
|
-
var ONE_SECOND_MS$
|
|
329
|
-
var ONE_MINUTE_MS = 60 * ONE_SECOND_MS$
|
|
330
|
-
var RECONNECT_BASE_MS = ONE_SECOND_MS$
|
|
328
|
+
var ONE_SECOND_MS$2 = 1e3;
|
|
329
|
+
var ONE_MINUTE_MS = 60 * ONE_SECOND_MS$2;
|
|
330
|
+
var RECONNECT_BASE_MS = ONE_SECOND_MS$2;
|
|
331
331
|
var RECONNECT_MAX_MS = ONE_MINUTE_MS;
|
|
332
332
|
var SETTLE_MS = ONE_MINUTE_MS;
|
|
333
333
|
var GIVE_UP_MS = 5 * ONE_MINUTE_MS;
|
|
334
|
-
var PROBE_INTERVAL_MS = 90 * ONE_SECOND_MS$
|
|
334
|
+
var PROBE_INTERVAL_MS = 90 * ONE_SECOND_MS$2;
|
|
335
335
|
var RESUME_GAP_MS = ONE_MINUTE_MS;
|
|
336
336
|
var reconnectDelayMs = (attempt) => Math.min(RECONNECT_MAX_MS, RECONNECT_BASE_MS * 2 ** attempt);
|
|
337
337
|
var errorText = (error) => error instanceof Error ? error.message : String(error);
|
|
@@ -364,7 +364,7 @@ var after = (ctx, delayMs, task) => {
|
|
|
364
364
|
return ctx.schedule(() => {
|
|
365
365
|
const overshootMs = ctx.now() - dueMs;
|
|
366
366
|
if (overshootMs > RESUME_GAP_MS) {
|
|
367
|
-
ctx.deps.log.warn(`host runner resumed after a ${Math.round(overshootMs / ONE_SECOND_MS$
|
|
367
|
+
ctx.deps.log.warn(`host runner resumed after a ${Math.round(overshootMs / ONE_SECOND_MS$2)}s gap; that time does not count as outage`);
|
|
368
368
|
ctx.downSinceMs = null;
|
|
369
369
|
ctx.attempt = 0;
|
|
370
370
|
}
|
|
@@ -437,14 +437,14 @@ async function settle(ctx) {
|
|
|
437
437
|
var giveUp = (ctx) => {
|
|
438
438
|
ctx.stopped = true;
|
|
439
439
|
clearProbe(ctx);
|
|
440
|
-
ctx.deps.log.warn(`host runner stayed down for ${Math.round(GIVE_UP_MS / ONE_SECOND_MS$
|
|
440
|
+
ctx.deps.log.warn(`host runner stayed down for ${Math.round(GIVE_UP_MS / ONE_SECOND_MS$2)}s, giving up (${ctx.lastError ?? "no error reported"})`);
|
|
441
441
|
setState(ctx, "offline");
|
|
442
442
|
ctx.deps.options.onClosed?.();
|
|
443
443
|
};
|
|
444
444
|
function scheduleRelaunch(ctx) {
|
|
445
445
|
const delayMs = reconnectDelayMs(ctx.attempt);
|
|
446
446
|
ctx.attempt += 1;
|
|
447
|
-
ctx.deps.log.warn(`host runner closed (${ctx.lastError ?? "no error reported"}); re-subscribing in ${Math.round(delayMs / ONE_SECOND_MS$
|
|
447
|
+
ctx.deps.log.warn(`host runner closed (${ctx.lastError ?? "no error reported"}); re-subscribing in ${Math.round(delayMs / ONE_SECOND_MS$2)}s`);
|
|
448
448
|
if (ctx.state !== "reconnecting") setState(ctx, "reconnecting");
|
|
449
449
|
ctx.cancelTimer = after(ctx, delayMs, () => launch(ctx));
|
|
450
450
|
}
|
|
@@ -508,6 +508,21 @@ function startResilientHostRunner(deps) {
|
|
|
508
508
|
};
|
|
509
509
|
}
|
|
510
510
|
//#endregion
|
|
511
|
+
//#region src/remote-host/server/withTimeout.ts
|
|
512
|
+
var ONE_SECOND_MS$1 = 1e3;
|
|
513
|
+
/** Reject once `timeoutMs` has passed, so a stalled read answers instead of hanging. */
|
|
514
|
+
var withTimeout = async (work, timeoutMs, what = "presence read") => {
|
|
515
|
+
const timer = { handle: null };
|
|
516
|
+
const deadline = new Promise((_, reject) => {
|
|
517
|
+
timer.handle = setTimeout(() => reject(/* @__PURE__ */ new Error(`${what} did not answer within ${Math.round(timeoutMs / ONE_SECOND_MS$1)}s`)), timeoutMs);
|
|
518
|
+
});
|
|
519
|
+
try {
|
|
520
|
+
return await Promise.race([work, deadline]);
|
|
521
|
+
} finally {
|
|
522
|
+
if (timer.handle) clearTimeout(timer.handle);
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
//#endregion
|
|
511
526
|
//#region src/remote-host/server/presenceProbe.ts
|
|
512
527
|
var ONE_SECOND_MS = 1e3;
|
|
513
528
|
var PRESENCE_STALE_MS = presenceStaleAfterMs();
|
|
@@ -527,18 +542,6 @@ var presenceIsFresh = (data, now, staleAfterMs = PRESENCE_STALE_MS) => {
|
|
|
527
542
|
if (data.online === false) return null;
|
|
528
543
|
return now - updatedAt < staleAfterMs;
|
|
529
544
|
};
|
|
530
|
-
/** Reject once `timeoutMs` has passed, so a stalled read answers instead of hanging. */
|
|
531
|
-
var withTimeout = async (work, timeoutMs) => {
|
|
532
|
-
const timer = { handle: null };
|
|
533
|
-
const deadline = new Promise((_, reject) => {
|
|
534
|
-
timer.handle = setTimeout(() => reject(/* @__PURE__ */ new Error(`presence read did not answer within ${Math.round(timeoutMs / ONE_SECOND_MS)}s`)), timeoutMs);
|
|
535
|
-
});
|
|
536
|
-
try {
|
|
537
|
-
return await Promise.race([work, deadline]);
|
|
538
|
-
} finally {
|
|
539
|
-
if (timer.handle) clearTimeout(timer.handle);
|
|
540
|
-
}
|
|
541
|
-
};
|
|
542
545
|
/** Reads the host's own presence document from the server and reports whether it is fresh. */
|
|
543
546
|
var createPresenceProbe = (deps) => {
|
|
544
547
|
const now = deps.now ?? Date.now;
|
|
@@ -549,12 +552,14 @@ var createPresenceProbe = (deps) => {
|
|
|
549
552
|
//#endregion
|
|
550
553
|
//#region src/remote-host/server/lifecycle.ts
|
|
551
554
|
var noop$1 = () => void 0;
|
|
555
|
+
var RESOLVE_HOST_ID_TIMEOUT_MS = 3e4;
|
|
552
556
|
var silentLogger = {
|
|
553
557
|
info: noop$1,
|
|
554
558
|
warn: noop$1,
|
|
555
559
|
debug: noop$1
|
|
556
560
|
};
|
|
557
561
|
var eventText = (event) => event.message ? `${event.phase} ${event.method} — ${event.message}` : `${event.phase} ${event.method}`;
|
|
562
|
+
var hostIdFor = async (deps, uid) => deps.resolveHostId ? withTimeout(deps.resolveHostId(uid), deps.resolveHostIdTimeoutMs ?? RESOLVE_HOST_ID_TIMEOUT_MS, "resolveHostId") : deps.hostId;
|
|
558
563
|
var createRemoteHost = (deps) => {
|
|
559
564
|
const log = deps.log ?? silentLogger;
|
|
560
565
|
let stopRunner = null;
|
|
@@ -574,11 +579,11 @@ var createRemoteHost = (deps) => {
|
|
|
574
579
|
connected: stopRunner !== null,
|
|
575
580
|
uid: deps.currentUid()
|
|
576
581
|
});
|
|
577
|
-
const attach = (uid, verb) => {
|
|
578
|
-
|
|
582
|
+
const attach = async (uid, verb) => {
|
|
583
|
+
const hostId = await hostIdFor(deps, uid).finally(stopIfRunning);
|
|
579
584
|
const runner = deps.startRunner({
|
|
580
585
|
uid,
|
|
581
|
-
hostId
|
|
586
|
+
hostId
|
|
582
587
|
}, deps.handlers, {
|
|
583
588
|
onEvent: (event) => log.debug(`host event: ${eventText(event)}`),
|
|
584
589
|
onExpire: deps.onExpire,
|
|
@@ -590,7 +595,7 @@ var createRemoteHost = (deps) => {
|
|
|
590
595
|
}
|
|
591
596
|
});
|
|
592
597
|
stopRunner = runner;
|
|
593
|
-
log.info(`${verb} as ${uid}, host runner started (hostId=${
|
|
598
|
+
log.info(`${verb} as ${uid}, host runner started (hostId=${hostId})`);
|
|
594
599
|
return status();
|
|
595
600
|
};
|
|
596
601
|
const connect = (idToken) => serialize(async () => attach(await deps.signIn(idToken), "connected"));
|