@mulmoclaude/core 1.11.0 → 1.13.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 +98 -0
- package/dist/collection/core/project.d.ts +11 -0
- package/dist/collection/index.cjs +3 -2
- 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 +3 -3
- package/dist/collection-watchers/index.js +3 -3
- package/dist/{discovery-B4CZvrXR.js → discovery-D-ZJ6a6z.js} +39 -18
- package/dist/discovery-D-ZJ6a6z.js.map +1 -0
- package/dist/{discovery-NRy3tyUA.cjs → discovery-DAoMnBYM.cjs} +39 -18
- package/dist/discovery-DAoMnBYM.cjs.map +1 -0
- package/dist/{dist-pWpC-b04.cjs → dist-21pMsI1a.cjs} +45 -1
- package/dist/{dist-pWpC-b04.cjs.map → dist-21pMsI1a.cjs.map} +1 -1
- package/dist/{dist-Cwk0e12G.js → dist-DP1FTGnO.js} +16 -2
- package/dist/{dist-Cwk0e12G.js.map → dist-DP1FTGnO.js.map} +1 -1
- package/dist/feeds/server/engine.d.ts +27 -0
- package/dist/feeds/server/index.cjs +72 -7
- package/dist/feeds/server/index.cjs.map +1 -1
- package/dist/feeds/server/index.d.ts +1 -1
- package/dist/feeds/server/index.js +71 -8
- package/dist/feeds/server/index.js.map +1 -1
- package/dist/google/calendarStateLock.d.ts +23 -0
- package/dist/google/calendarSyncDue.d.ts +10 -0
- package/dist/google/calendarSyncStore.d.ts +20 -1
- package/dist/google/collectionProjection.d.ts +0 -8
- package/dist/google/collectionSync.d.ts +104 -15
- package/dist/google/index.cjs +512 -89
- package/dist/google/index.cjs.map +1 -1
- package/dist/google/index.d.ts +6 -3
- package/dist/google/index.js +501 -91
- package/dist/google/index.js.map +1 -1
- package/dist/notifier/index.cjs +1 -1
- package/dist/notifier/index.js +1 -1
- package/dist/notifier/store.d.ts +4 -4
- package/dist/{notifier-tMsAXyXp.cjs → notifier-C3IhYxqh.cjs} +39 -25
- package/dist/notifier-C3IhYxqh.cjs.map +1 -0
- package/dist/{notifier-BdA5qzhe.js → notifier-CMFlw74b.js} +39 -25
- package/dist/notifier-CMFlw74b.js.map +1 -0
- package/dist/project-B9NSyr6L.js +28 -0
- package/dist/project-B9NSyr6L.js.map +1 -0
- package/dist/project-CCtT_fQr.cjs +39 -0
- package/dist/project-CCtT_fQr.cjs.map +1 -0
- package/dist/remote-host/server/index.cjs +1 -1
- package/dist/remote-host/server/index.js +1 -1
- package/dist/remote-view/index.cjs +1 -1
- package/dist/remote-view/index.js +1 -1
- package/dist/scheduler/index.cjs +1 -1
- package/dist/scheduler/index.js +1 -1
- package/dist/{server-7U-3DE2e.cjs → server-B_b0bLSW.cjs} +3 -3
- package/dist/{server-7U-3DE2e.cjs.map → server-B_b0bLSW.cjs.map} +1 -1
- package/dist/{server-DdyIvFhz.js → server-Ci_A3chZ.js} +3 -3
- package/dist/{server-DdyIvFhz.js.map → server-Ci_A3chZ.js.map} +1 -1
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/whisper/index.cjs +1 -1
- package/dist/whisper/index.js +1 -1
- package/dist/wiki/index.cjs +1 -1
- package/dist/wiki/index.js +1 -1
- package/package.json +1 -1
- package/dist/discovery-B4CZvrXR.js.map +0 -1
- package/dist/discovery-NRy3tyUA.cjs.map +0 -1
- package/dist/notifier-BdA5qzhe.js.map +0 -1
- package/dist/notifier-tMsAXyXp.cjs.map +0 -1
- package/dist/project-BWI5w_BT.cjs +0 -17
- package/dist/project-BWI5w_BT.cjs.map +0 -1
- package/dist/project-bU98ycsy.js +0 -12
- package/dist/project-bU98ycsy.js.map +0 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-D6vf50IK.cjs");
|
|
2
|
+
const require_dist = require("./dist-21pMsI1a.cjs");
|
|
2
3
|
const require_atomic = require("./atomic-C_7YpMiM.cjs");
|
|
3
4
|
const require_calendarGrid = require("./calendarGrid-CaS9er8i.cjs");
|
|
4
|
-
const require_project = require("./project-
|
|
5
|
+
const require_project = require("./project-CCtT_fQr.cjs");
|
|
5
6
|
const require_templatePath = require("./templatePath-27vUZowm.cjs");
|
|
6
7
|
let node_fs = require("node:fs");
|
|
7
8
|
let node_path = require("node:path");
|
|
@@ -1057,14 +1058,23 @@ function pageFromFullRead(items, opts, primaryKey, truncated) {
|
|
|
1057
1058
|
}
|
|
1058
1059
|
//#endregion
|
|
1059
1060
|
//#region src/collection/server/sqliteStore.ts
|
|
1061
|
+
/** A constructor's parameter and return types are not observable at runtime,
|
|
1062
|
+
* so the check stops at "DatabaseSync is constructible" — the only member of
|
|
1063
|
+
* the module this store ever touches. */
|
|
1064
|
+
function isSqliteModule(mod) {
|
|
1065
|
+
return require_dist.isRecord(mod) && typeof mod.DatabaseSync === "function";
|
|
1066
|
+
}
|
|
1060
1067
|
var sqliteModule = null;
|
|
1068
|
+
/** Drops the memo first so a later call can retry (e.g. tests stubbing the
|
|
1069
|
+
* runtime), then reports why the backend is unusable. */
|
|
1070
|
+
function sqliteUnavailable(reason) {
|
|
1071
|
+
sqliteModule = null;
|
|
1072
|
+
throw new BackendUnavailableError(`sqlite storage needs the node:sqlite module (Node.js >= 22.5) — this runtime cannot load it: ${reason}`);
|
|
1073
|
+
}
|
|
1061
1074
|
/** Lazy-load node:sqlite once. A runtime without it (Node < 22.5) throws a
|
|
1062
1075
|
* clearly-worded error the caller surfaces — never a bare MODULE_NOT_FOUND. */
|
|
1063
1076
|
function loadSqlite() {
|
|
1064
|
-
sqliteModule ??= import("node:sqlite").then((mod) => mod, (err) =>
|
|
1065
|
-
sqliteModule = null;
|
|
1066
|
-
throw new BackendUnavailableError(`sqlite storage needs the node:sqlite module (Node.js >= 22.5) — this runtime cannot load it: ${String(err)}`);
|
|
1067
|
-
});
|
|
1077
|
+
sqliteModule ??= import("node:sqlite").then((mod) => isSqliteModule(mod) ? mod : sqliteUnavailable("the module exposes no DatabaseSync constructor"), (err) => sqliteUnavailable(String(err)));
|
|
1068
1078
|
return sqliteModule;
|
|
1069
1079
|
}
|
|
1070
1080
|
/** The db file's on-disk state. A symlink or non-regular file is refused
|
|
@@ -1076,7 +1086,7 @@ async function dbFileState(absPath) {
|
|
|
1076
1086
|
try {
|
|
1077
1087
|
return (await (0, node_fs_promises.lstat)(absPath)).isFile() ? "file" : "refused";
|
|
1078
1088
|
} catch (err) {
|
|
1079
|
-
if (err.code === "ENOENT") return "missing";
|
|
1089
|
+
if (require_dist.isErrorWithCode(err) && err.code === "ENOENT") return "missing";
|
|
1080
1090
|
throw err;
|
|
1081
1091
|
}
|
|
1082
1092
|
}
|
|
@@ -1128,27 +1138,39 @@ async function withDb(absPath, workspaceRoot, mode, onUnavailable, operation) {
|
|
|
1128
1138
|
handle.database.close();
|
|
1129
1139
|
}
|
|
1130
1140
|
}
|
|
1141
|
+
var SQLITE_CONSTRAINT_PRIMARYKEY = 1555;
|
|
1142
|
+
var SQLITE_CONSTRAINT_UNIQUE = 2067;
|
|
1131
1143
|
/** node:sqlite throws ERR_SQLITE_ERROR with the SQLite extended result
|
|
1132
|
-
* code on `errcode`.
|
|
1133
|
-
*
|
|
1134
|
-
* covers a plain UNIQUE index. Checked structurally (message text kept
|
|
1135
|
-
* only as a fallback for runtimes that don't expose `errcode`). */
|
|
1144
|
+
* code on `errcode`. Checked structurally (message text kept only as a
|
|
1145
|
+
* fallback for runtimes that don't expose `errcode`). */
|
|
1136
1146
|
function isUniqueConstraintError(err) {
|
|
1137
|
-
|
|
1138
|
-
if (errcode !== void 0) return errcode === 1555 || errcode === 2067;
|
|
1147
|
+
if (require_dist.hasNumberProp(err, "errcode")) return err.errcode === SQLITE_CONSTRAINT_PRIMARYKEY || err.errcode === SQLITE_CONSTRAINT_UNIQUE;
|
|
1139
1148
|
return String(err).includes("UNIQUE constraint");
|
|
1140
1149
|
}
|
|
1141
1150
|
function parseRow(raw) {
|
|
1142
1151
|
if (typeof raw !== "string") return null;
|
|
1143
1152
|
try {
|
|
1144
1153
|
const parsed = JSON.parse(raw);
|
|
1145
|
-
return
|
|
1154
|
+
return require_dist.isRecord(parsed) ? parsed : null;
|
|
1146
1155
|
} catch {
|
|
1147
1156
|
return null;
|
|
1148
1157
|
}
|
|
1149
1158
|
}
|
|
1159
|
+
/** One column of a result row. node:sqlite types rows as `unknown`, so a
|
|
1160
|
+
* value that is not a row object yields no column at all. */
|
|
1161
|
+
function readColumn(row, column) {
|
|
1162
|
+
return require_dist.isRecord(row) ? row[column] : void 0;
|
|
1163
|
+
}
|
|
1150
1164
|
function rowsToItems(rows) {
|
|
1151
|
-
return rows.map((row) => parseRow(row
|
|
1165
|
+
return rows.map((row) => parseRow(readColumn(row, "record"))).filter((item) => item !== null);
|
|
1166
|
+
}
|
|
1167
|
+
/** node:sqlite hands back an integer column as `number`, or as `bigint` once
|
|
1168
|
+
* it leaves the safe-integer range — COUNT(*) can be either. */
|
|
1169
|
+
function countRecords(database) {
|
|
1170
|
+
const count = readColumn(database.prepare("SELECT COUNT(*) AS n FROM records").get(), "n");
|
|
1171
|
+
if (typeof count === "number") return count;
|
|
1172
|
+
if (typeof count === "bigint") return Number(count);
|
|
1173
|
+
throw new Error(`sqlite COUNT(*) returned no numeric row count (got ${typeof count})`);
|
|
1152
1174
|
}
|
|
1153
1175
|
async function sqliteList(absPath, workspaceRoot) {
|
|
1154
1176
|
return withDb(absPath, workspaceRoot, "read", () => [], (database) => rowsToItems(database.prepare("SELECT record FROM records ORDER BY id").all()));
|
|
@@ -1160,7 +1182,7 @@ async function sqlitePage(absPath, primaryKey, opts, workspaceRoot) {
|
|
|
1160
1182
|
truncated: false
|
|
1161
1183
|
};
|
|
1162
1184
|
return withDb(absPath, workspaceRoot, "read", () => emptyPage, (database) => {
|
|
1163
|
-
const total =
|
|
1185
|
+
const total = countRecords(database);
|
|
1164
1186
|
const offset = Math.max(0, opts.offset ?? 0);
|
|
1165
1187
|
const limit = opts.limit === void 0 ? -1 : Math.max(0, opts.limit);
|
|
1166
1188
|
return {
|
|
@@ -1174,8 +1196,7 @@ async function sqliteRead(absPath, itemId, workspaceRoot) {
|
|
|
1174
1196
|
const safeId = safeRecordId(itemId);
|
|
1175
1197
|
if (safeId === null) return null;
|
|
1176
1198
|
return withDb(absPath, workspaceRoot, "read", () => null, (database) => {
|
|
1177
|
-
|
|
1178
|
-
return row === void 0 ? null : parseRow(row.record);
|
|
1199
|
+
return parseRow(readColumn(database.prepare("SELECT record FROM records WHERE id = ?").get(safeId), "record"));
|
|
1179
1200
|
});
|
|
1180
1201
|
}
|
|
1181
1202
|
async function sqliteWrite(absPath, itemId, item, opts) {
|
|
@@ -3006,4 +3027,4 @@ Object.defineProperty(exports, "writeItem", {
|
|
|
3006
3027
|
}
|
|
3007
3028
|
});
|
|
3008
3029
|
|
|
3009
|
-
//# sourceMappingURL=discovery-
|
|
3030
|
+
//# sourceMappingURL=discovery-DAoMnBYM.cjs.map
|