@mulmoclaude/core 7.1.0 → 7.2.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.
Files changed (57) hide show
  1. package/dist/collection/registry/server/index.cjs +6 -5
  2. package/dist/collection/registry/server/index.cjs.map +1 -1
  3. package/dist/collection/registry/server/index.js +6 -5
  4. package/dist/collection/registry/server/index.js.map +1 -1
  5. package/dist/collection/server/index.cjs +2 -2
  6. package/dist/collection/server/index.js +2 -2
  7. package/dist/collection-watchers/index.cjs +2 -2
  8. package/dist/collection-watchers/index.js +2 -2
  9. package/dist/containment-D_vAa6eT.js +40 -0
  10. package/dist/containment-D_vAa6eT.js.map +1 -0
  11. package/dist/containment-Dc3gO4wD.cjs +65 -0
  12. package/dist/containment-Dc3gO4wD.cjs.map +1 -0
  13. package/dist/{discovery-DR4GNqrp.js → discovery-BIQY56d1.js} +4 -4
  14. package/dist/discovery-BIQY56d1.js.map +1 -0
  15. package/dist/{discovery-BkCeYBf6.cjs → discovery-D3e3JaAv.cjs} +4 -4
  16. package/dist/discovery-D3e3JaAv.cjs.map +1 -0
  17. package/dist/feeds/server/index.cjs +2 -2
  18. package/dist/feeds/server/index.js +2 -2
  19. package/dist/files/containment.d.ts +9 -0
  20. package/dist/files/index.cjs +36 -10
  21. package/dist/files/index.cjs.map +1 -1
  22. package/dist/files/index.d.ts +2 -1
  23. package/dist/files/index.js +30 -5
  24. package/dist/files/index.js.map +1 -1
  25. package/dist/files/withinRoot.d.ts +0 -2
  26. package/dist/google/index.cjs +1 -1
  27. package/dist/google/index.js +1 -1
  28. package/dist/{server-CnCUBmSn.cjs → server-BGxmZppB.cjs} +4 -3
  29. package/dist/server-BGxmZppB.cjs.map +1 -0
  30. package/dist/{server-Dp5KWarO.js → server-MKJPGYKI.js} +4 -3
  31. package/dist/server-MKJPGYKI.js.map +1 -0
  32. package/dist/whisper/extra-args.d.ts +14 -0
  33. package/dist/whisper/index.cjs +76 -8
  34. package/dist/whisper/index.cjs.map +1 -1
  35. package/dist/whisper/index.js +76 -8
  36. package/dist/whisper/index.js.map +1 -1
  37. package/dist/whisper/sidecar-helpers.d.ts +3 -2
  38. package/dist/whisper/sidecar.d.ts +2 -2
  39. package/dist/wiki/server/index.cjs +5 -4
  40. package/dist/wiki/server/index.cjs.map +1 -1
  41. package/dist/wiki/server/index.js +3 -2
  42. package/dist/wiki/server/index.js.map +1 -1
  43. package/dist/withinRoot-CHPN9eHD.cjs +53 -0
  44. package/dist/withinRoot-CHPN9eHD.cjs.map +1 -0
  45. package/dist/withinRoot-CheaBWt0.js +42 -0
  46. package/dist/withinRoot-CheaBWt0.js.map +1 -0
  47. package/dist/workspace-setup/index.js +36 -2
  48. package/dist/workspace-setup/index.js.map +1 -1
  49. package/package.json +1 -1
  50. package/dist/discovery-BkCeYBf6.cjs.map +0 -1
  51. package/dist/discovery-DR4GNqrp.js.map +0 -1
  52. package/dist/server-CnCUBmSn.cjs.map +0 -1
  53. package/dist/server-Dp5KWarO.js.map +0 -1
  54. package/dist/withinRoot-Bbj6E-Lf.js +0 -84
  55. package/dist/withinRoot-Bbj6E-Lf.js.map +0 -1
  56. package/dist/withinRoot-FLjxC8oP.cjs +0 -121
  57. package/dist/withinRoot-FLjxC8oP.cjs.map +0 -1
@@ -0,0 +1,65 @@
1
+ const require_rolldown_runtime = require("./rolldown-runtime-CmQyd0Gu.cjs");
2
+ let node_fs = require("node:fs");
3
+ let node_path = require("node:path");
4
+ node_path = require_rolldown_runtime.__toESM(node_path, 1);
5
+ // src/files/containment.ts
6
+ function isWithinRoot(rootReal, candidateReal, separator = node_path.default.sep) {
7
+ if (candidateReal === rootReal) return true;
8
+ const prefix = rootReal.endsWith(separator) ? rootReal : rootReal + separator;
9
+ return candidateReal.startsWith(prefix);
10
+ }
11
+ var isMissing = (err) => typeof err === "object" && err !== null && "code" in err && err.code === "ENOENT";
12
+ function realpathSyncOrNull(absPath) {
13
+ try {
14
+ return node_fs.realpathSync.native(absPath);
15
+ } catch (err) {
16
+ return isMissing(err) ? null : jsRealpathOrNull(absPath);
17
+ }
18
+ }
19
+ function jsRealpathOrNull(absPath) {
20
+ try {
21
+ return (0, node_fs.realpathSync)(absPath);
22
+ } catch {
23
+ return null;
24
+ }
25
+ }
26
+ /** `candidateReal` re-spelled under `rootReal` when both, at their on-disk spelling, are one inside the other; null
27
+ * otherwise. The second look for a check that compared two realpaths taken with different letter case (a JS realpath
28
+ * keeps the case it was given, or a link's), so a target truly inside is not refused. */
29
+ function respelledWithinRoot(rootReal, candidateReal) {
30
+ const rootOnDisk = realpathSyncOrNull(rootReal);
31
+ const candidateOnDisk = realpathSyncOrNull(candidateReal);
32
+ if (rootOnDisk === null || candidateOnDisk === null || !isWithinRoot(rootOnDisk, candidateOnDisk)) return null;
33
+ return node_path.default.join(rootReal, node_path.default.relative(rootOnDisk, candidateOnDisk));
34
+ }
35
+ /** True when `candidateReal` is inside `rootReal`: the case-preserving test, then the second look at the on-disk spelling
36
+ * for two realpaths taken with different letter case. The check every caller uses. */
37
+ function isInsideRoot(rootReal, candidateReal) {
38
+ return isWithinRoot(rootReal, candidateReal) || respelledWithinRoot(rootReal, candidateReal) !== null;
39
+ }
40
+ Object.defineProperty(exports, "isInsideRoot", {
41
+ enumerable: true,
42
+ get: function() {
43
+ return isInsideRoot;
44
+ }
45
+ });
46
+ Object.defineProperty(exports, "isWithinRoot", {
47
+ enumerable: true,
48
+ get: function() {
49
+ return isWithinRoot;
50
+ }
51
+ });
52
+ Object.defineProperty(exports, "realpathSyncOrNull", {
53
+ enumerable: true,
54
+ get: function() {
55
+ return realpathSyncOrNull;
56
+ }
57
+ });
58
+ Object.defineProperty(exports, "respelledWithinRoot", {
59
+ enumerable: true,
60
+ get: function() {
61
+ return respelledWithinRoot;
62
+ }
63
+ });
64
+
65
+ //# sourceMappingURL=containment-Dc3gO4wD.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"containment-Dc3gO4wD.cjs","names":["path","realpathSync"],"sources":["../src/files/containment.ts"],"sourcesContent":["// The containment rule every realpath check in `@mulmoclaude/core/files` shares. A leaf: imports nothing from the\n// other file modules, so they can all depend on it.\n\nimport { realpathSync } from \"node:fs\";\nimport path from \"node:path\";\n\n// A case-preserving prefix test: `path.win32.relative` folds case, which on a case-sensitive Windows folder would take\n// `C:\\root\\x` as inside `C:\\Root`. A root that already ends in a separator (`/`, `C:\\`) is used as the prefix as is.\nexport function isWithinRoot(rootReal: string, candidateReal: string, separator: string = path.sep): boolean {\n if (candidateReal === rootReal) return true;\n const prefix = rootReal.endsWith(separator) ? rootReal : rootReal + separator;\n return candidateReal.startsWith(prefix);\n}\n\nconst isMissing = (err: unknown): boolean => typeof err === \"object\" && err !== null && \"code\" in err && err.code === \"ENOENT\";\n\n// Native first: the JS realpath keeps a link's letter case, so on a case-insensitive disk an inside link looks outside.\n// The JS one is the fallback for drives where the native call throws (EISDIR on some Windows RAM disks).\nexport function realpathSyncOrNull(absPath: string): string | null {\n try {\n return realpathSync.native(absPath);\n } catch (err) {\n return isMissing(err) ? null : jsRealpathOrNull(absPath);\n }\n}\n\nfunction jsRealpathOrNull(absPath: string): string | null {\n try {\n return realpathSync(absPath);\n } catch {\n return null;\n }\n}\n\n/** `candidateReal` re-spelled under `rootReal` when both, at their on-disk spelling, are one inside the other; null\n * otherwise. The second look for a check that compared two realpaths taken with different letter case (a JS realpath\n * keeps the case it was given, or a link's), so a target truly inside is not refused. */\nexport function respelledWithinRoot(rootReal: string, candidateReal: string): string | null {\n const rootOnDisk = realpathSyncOrNull(rootReal);\n const candidateOnDisk = realpathSyncOrNull(candidateReal);\n if (rootOnDisk === null || candidateOnDisk === null || !isWithinRoot(rootOnDisk, candidateOnDisk)) return null;\n return path.join(rootReal, path.relative(rootOnDisk, candidateOnDisk));\n}\n\n/** True when `candidateReal` is inside `rootReal`: the case-preserving test, then the second look at the on-disk spelling\n * for two realpaths taken with different letter case. The check every caller uses. */\nexport function isInsideRoot(rootReal: string, candidateReal: string): boolean {\n return isWithinRoot(rootReal, candidateReal) || respelledWithinRoot(rootReal, candidateReal) !== null;\n}\n"],"mappings":";;;;;AAQA,SAAgB,aAAa,UAAkB,eAAuB,YAAoBA,UAAAA,QAAK,KAAc;CAC3G,IAAI,kBAAkB,UAAU,OAAO;CACvC,MAAM,SAAS,SAAS,SAAS,SAAS,IAAI,WAAW,WAAW;CACpE,OAAO,cAAc,WAAW,MAAM;AACxC;AAEA,IAAM,aAAa,QAA0B,OAAO,QAAQ,YAAY,QAAQ,QAAQ,UAAU,OAAO,IAAI,SAAS;AAItH,SAAgB,mBAAmB,SAAgC;CACjE,IAAI;EACF,OAAOC,QAAAA,aAAa,OAAO,OAAO;CACpC,SAAS,KAAK;EACZ,OAAO,UAAU,GAAG,IAAI,OAAO,iBAAiB,OAAO;CACzD;AACF;AAEA,SAAS,iBAAiB,SAAgC;CACxD,IAAI;EACF,QAAA,GAAOA,QAAAA,aAAAA,CAAa,OAAO;CAC7B,QAAQ;EACN,OAAO;CACT;AACF;;;;AAKA,SAAgB,oBAAoB,UAAkB,eAAsC;CAC1F,MAAM,aAAa,mBAAmB,QAAQ;CAC9C,MAAM,kBAAkB,mBAAmB,aAAa;CACxD,IAAI,eAAe,QAAQ,oBAAoB,QAAQ,CAAC,aAAa,YAAY,eAAe,GAAG,OAAO;CAC1G,OAAOD,UAAAA,QAAK,KAAK,UAAUA,UAAAA,QAAK,SAAS,YAAY,eAAe,CAAC;AACvE;;;AAIA,SAAgB,aAAa,UAAkB,eAAgC;CAC7E,OAAO,aAAa,UAAU,aAAa,KAAK,oBAAoB,UAAU,aAAa,MAAM;AACnG"}
@@ -1,5 +1,6 @@
1
1
  import { a as isErrorWithCode, c as isRecord, r as hasNumberProp, u as isUnknownArray } from "./dist-BmO4oSQy.js";
2
2
  import { r as writeFileAtomic, t as canonicalRoot } from "./root-CqxPNSyK.js";
3
+ import { n as isWithinRoot, t as isInsideRoot } from "./containment-D_vAa6eT.js";
3
4
  import { $ as fieldText, B as SAFE_SLUG_PATTERN, C as decodeRecordTimes, F as localCollectionKeyOf, G as AGENT_INGEST_KIND, H as isSafeRecordId, J as INGEST_KINDS, K as COMPUTED_TYPES, P as isValidCollectionName, Q as storageKindFor, R as sharedCollectionKey, T as encodeRecordTimes, U as isSafeSlug, Z as isReadOnlySchema, b as ACCENT_COLORS, et as fieldTextOrNull, q as FEED_SCHEDULES, t as newItemId, z as SAFE_RECORD_ID_PATTERN } from "./itemId-D_pSpa3U.js";
4
5
  import { n as projectRecordFields } from "./project-mU6-xLfy.js";
5
6
  import { n as backoffDelayMs, r as classifyListenerError } from "./listen-uiEnXcW9.js";
@@ -332,7 +333,7 @@ function isContainedInRoot(absPath, rootPath) {
332
333
  }
333
334
  const ancestorReal = realpathClosestAncestor(absPath);
334
335
  if (ancestorReal === null) return false;
335
- return isUnderRealRoot(ancestorReal, rootReal);
336
+ return isInsideRoot(rootReal, ancestorReal);
336
337
  }
337
338
  /** The containment comparison itself, on two paths a caller has ALREADY
338
339
  * canonicalised. Exported because a caller holding a resolved path must not
@@ -344,8 +345,7 @@ function isContainedInRoot(absPath, rootPath) {
344
345
  * like it was outside it (#2972). Canonicalise both sides the same way, then
345
346
  * come here. */
346
347
  function isUnderRealRoot(realPath, realRoot) {
347
- if (realPath === realRoot) return true;
348
- return realPath.startsWith(realRoot + path.sep);
348
+ return isWithinRoot(realRoot, realPath);
349
349
  }
350
350
  /** Resolve a schema-declared dataPath against `rootPath` (default:
351
351
  * the live workspace), refusing anything that escapes — absolute
@@ -3359,4 +3359,4 @@ function toDetail(collection) {
3359
3359
  }
3360
3360
  export { collectionChangePayload as $, readItem as A, SCHEMA_FILE as B, CollectionQueryZ as C, generateItemId as D, deleteItem as E, loadAppManifest as F, resolveTemplatePath as G, isUnderRealRoot as H, parseAppManifest as I, BackendUnavailableError as J, safeRecordId as K, sharedItemsPath as L, writeItem as M, APP_MANIFEST_FILE as N, isRegularFile as O, appManifestReason as P, collectionChangeKey as Q, pageFromFullRead as R, compileJsonlQuery as S, MAX_QUERY_ROWS as T, itemFilePath as U, isContainedInRoot as V, resolveDataDir as W, COLLECTION_ROOT_REQUIRED as X, isBackendUnavailable as Y, archiveDir as Z, dedupeByRecordId as _, createForwardingLogger as _t, toDetail as a, isPresetSlug as at, queryCsv as b, resolveMutateSet as c, peekWorkspaceRoot as ct, storeFor as d, setCollectionChangePublisher as dt, collectionsRegistriesConfigPath as et, checkpointSqliteDatabase as f, setFirestoreAccessor as ft, decodeCsvRecordId as g, stagingSkillDir as gt, csvRowToItem as h, skillsStagingDir as ht, resolvePrimaryField as i, hostSupportsSharedCollections as it, resolveCreateItemId as j, listItems as k, collectionWritable as l, projectSkillsDir as lt, cacheDir as m, sharedCollectionChangePayload as mt, discoverCollections as n, firestoreHandle as nt, toSummary as o, localCollectionKey as ot, MAX_CSV_ROWS as p, setSharedCollectionsSupport as pt, safeSlugName as q, loadCollection as r, getWorkspaceRoot as rt, CollectionSchemaZ as s, log as st, acceptParsedSchema as t, configureCollectionHost as tt, readOnlyRefusal as u, publishCollectionChange as ut, encodeCsvRecordId as v, createHostSlot as vt, DEFAULT_QUERY_ROWS as w, compileCsvQuery as x, normalizeCsvValue as y, projectItemFields as z };
3361
3361
 
3362
- //# sourceMappingURL=discovery-DR4GNqrp.js.map
3362
+ //# sourceMappingURL=discovery-BIQY56d1.js.map