@mulmoclaude/core 2.0.2 → 3.0.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 (49) hide show
  1. package/dist/collection/registry/server/client.d.ts +4 -4
  2. package/dist/collection/registry/server/collectionFiles.d.ts +3 -2
  3. package/dist/collection/registry/server/importCollection.d.ts +3 -2
  4. package/dist/collection/registry/server/index.cjs +27 -26
  5. package/dist/collection/registry/server/index.cjs.map +1 -1
  6. package/dist/collection/registry/server/index.d.ts +3 -2
  7. package/dist/collection/registry/server/index.js +27 -26
  8. package/dist/collection/registry/server/index.js.map +1 -1
  9. package/dist/collection/registry/server/registriesConfig.d.ts +11 -4
  10. package/dist/collection/server/host.d.ts +42 -5
  11. package/dist/collection/server/index.cjs +5 -3
  12. package/dist/collection/server/index.d.ts +1 -1
  13. package/dist/collection/server/index.js +3 -3
  14. package/dist/collection/server/paths.d.ts +0 -3
  15. package/dist/collection-watchers/index.cjs +79 -12
  16. package/dist/collection-watchers/index.cjs.map +1 -1
  17. package/dist/collection-watchers/index.d.ts +1 -1
  18. package/dist/collection-watchers/index.js +79 -13
  19. package/dist/collection-watchers/index.js.map +1 -1
  20. package/dist/collection-watchers/watcher.d.ts +23 -4
  21. package/dist/{discovery-BvnXyUel.js → discovery-4Z-ZWFam.js} +50 -21
  22. package/dist/discovery-4Z-ZWFam.js.map +1 -0
  23. package/dist/{discovery-B_sHig7n.cjs → discovery-CtiZMlsX.cjs} +67 -26
  24. package/dist/discovery-CtiZMlsX.cjs.map +1 -0
  25. package/dist/feeds/server/index.cjs +2 -2
  26. package/dist/feeds/server/index.js +2 -2
  27. package/dist/global-config/index.cjs +69 -0
  28. package/dist/global-config/index.cjs.map +1 -0
  29. package/dist/global-config/index.d.ts +13 -0
  30. package/dist/global-config/index.js +63 -0
  31. package/dist/global-config/index.js.map +1 -0
  32. package/dist/global-config/paths.d.ts +2 -0
  33. package/dist/global-config/schema.d.ts +17 -0
  34. package/dist/google/index.cjs +5 -2
  35. package/dist/google/index.cjs.map +1 -1
  36. package/dist/google/index.js +5 -2
  37. package/dist/google/index.js.map +1 -1
  38. package/dist/google/paths.d.ts +2 -0
  39. package/dist/paths-CkJxNZ7T.js +13 -0
  40. package/dist/paths-CkJxNZ7T.js.map +1 -0
  41. package/dist/paths-ClV946_f.cjs +25 -0
  42. package/dist/paths-ClV946_f.cjs.map +1 -0
  43. package/dist/{server-DJt6USBQ.js → server-CedIocRS.js} +2 -2
  44. package/dist/{server-DJt6USBQ.js.map → server-CedIocRS.js.map} +1 -1
  45. package/dist/{server-DoyGZMPS.cjs → server-DOZFzx5l.cjs} +2 -2
  46. package/dist/{server-DoyGZMPS.cjs.map → server-DOZFzx5l.cjs.map} +1 -1
  47. package/package.json +7 -1
  48. package/dist/discovery-B_sHig7n.cjs.map +0 -1
  49. package/dist/discovery-BvnXyUel.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { RegistryEntry, RegistryIndex } from '../registryIndex.js';
2
- import { RegistryConfigEntry } from './registriesConfig.js';
2
+ import { RegistryConfigEntry, RegistryScope } from './registriesConfig.js';
3
3
  export declare const CACHE_TTL_MS: number;
4
4
  export declare const STALE_RETRY_BACKOFF_MS: number;
5
5
  /** Per-registry fetch outcome. `ok: false` is reported per-registry — the
@@ -23,10 +23,10 @@ export type RegistryDescriptor = RegistryConfigEntry;
23
23
  /** The full ordered registry list: official first, then user-configured ones.
24
24
  * Re-reads the config file on every call so a Discover refresh picks up edits
25
25
  * without a server restart (the config is small + read-rarely). */
26
- export declare function listRegistries(): RegistryDescriptor[];
26
+ export declare function listRegistries(scope?: RegistryScope): RegistryDescriptor[];
27
27
  /** Look up one registry descriptor by name. Used by the preview / import path,
28
28
  * which has the registry label from the entry and needs the rawBase. */
29
- export declare function findRegistry(name: string): RegistryDescriptor | null;
29
+ export declare function findRegistry(name: string, scope?: RegistryScope): RegistryDescriptor | null;
30
30
  export type IndexLoader = (descriptor: RegistryDescriptor) => Promise<FetchIndexResult>;
31
31
  /** Fetch one registry's index. Same cache + stale-on-failure semantics as the
32
32
  * original single-registry implementation — just keyed by descriptor identity
@@ -55,6 +55,6 @@ export declare function fetchAllRegistries(opts?: {
55
55
  force?: boolean;
56
56
  nowMs?: number;
57
57
  loader?: IndexLoader;
58
- }): Promise<MergedRegistryResult[]>;
58
+ } & RegistryScope): Promise<MergedRegistryResult[]>;
59
59
  /** Test seam: reset the module cache + failure backoff state (all registries). */
60
60
  export declare function resetRegistryCache(): void;
@@ -1,3 +1,4 @@
1
+ import { RegistryScope } from './registriesConfig.js';
1
2
  import { RegistryEntry } from '../registryIndex.js';
2
3
  /** Compose the raw URL for `<dirPath>/<relFile>` under a given registry's
3
4
  * rawBase. Empty and traversal (`.`/`..`) segments are dropped so the URL can
@@ -33,7 +34,7 @@ export declare function parseJsonObject(text: string, label: string): JsonObject
33
34
  /** Resolve an entry's rawBase from its `registryName`. A missing match (the
34
35
  * user removed the registry from config while a cached index still references
35
36
  * it) returns null — the caller surfaces it as a 404 rather than crashing. */
36
- export declare function rawBaseForEntry(entry: Pick<RegistryEntry, "registryName">): string | null;
37
+ export declare function rawBaseForEntry(entry: Pick<RegistryEntry, "registryName">, scope?: RegistryScope): string | null;
37
38
  export type PreviewResult = {
38
39
  ok: true;
39
40
  entry: RegistryEntry;
@@ -48,4 +49,4 @@ export type PreviewResult = {
48
49
  * index, then fetch + parse its schema.json + meta.json so the Discover tab
49
50
  * can show fields/views before import. With multi-registry support the
50
51
  * `registry` arg disambiguates same-name collections from different sources. */
51
- export declare function previewCollection(author: string, slug: string, registry?: string | null): Promise<PreviewResult>;
52
+ export declare function previewCollection(author: string, slug: string, registry?: string | null, scope?: RegistryScope): Promise<PreviewResult>;
@@ -1,4 +1,5 @@
1
1
  import { RegistryEntry } from '../registryIndex.js';
2
+ import { RegistryScope } from './registriesConfig.js';
2
3
  /** A manifest entry must be a relative path that stays inside the collection dir:
3
4
  * no absolute paths, no backslashes, no empty / `.` / `..` segments. */
4
5
  export declare function isSafeBundlePath(rel: unknown): rel is string;
@@ -22,7 +23,7 @@ export type ManifestFetch = {
22
23
  status: number;
23
24
  error: string;
24
25
  };
25
- export declare function fetchManifest(entry: RegistryEntry): Promise<ManifestFetch>;
26
+ export declare function fetchManifest(entry: RegistryEntry, scope?: RegistryScope): Promise<ManifestFetch>;
26
27
  export type BundleFetch = {
27
28
  ok: true;
28
29
  files: Map<string, string>;
@@ -32,4 +33,4 @@ export type BundleFetch = {
32
33
  error: string;
33
34
  };
34
35
  /** Fetch every manifest file. Paths are already safety-checked by parseManifest. */
35
- export declare function fetchBundle(entry: RegistryEntry, fileList: readonly string[]): Promise<BundleFetch>;
36
+ export declare function fetchBundle(entry: RegistryEntry, fileList: readonly string[], scope?: RegistryScope): Promise<BundleFetch>;
@@ -4,9 +4,9 @@ const require_dist = require("../../../dist-CsgSfWwR.cjs");
4
4
  const require_atomic = require("../../../atomic-DhUk8uiM.cjs");
5
5
  const require_relPath = require("../../../relPath-CTAjGdCL.cjs");
6
6
  const require_utils_fetch = require("../../../utils/fetch.cjs");
7
- const require_discovery = require("../../../discovery-B_sHig7n.cjs");
7
+ const require_discovery = require("../../../discovery-CtiZMlsX.cjs");
8
8
  const require_templatePath = require("../../../templatePath-27vUZowm.cjs");
9
- const require_server = require("../../../server-DoyGZMPS.cjs");
9
+ const require_server = require("../../../server-DOZFzx5l.cjs");
10
10
  const require_skill_bridge_index = require("../../../skill-bridge/index.cjs");
11
11
  const require_types = require("../../../types-CNqkLT4M.cjs");
12
12
  let node_fs = require("node:fs");
@@ -77,11 +77,12 @@ function readConfigTextOrNull(filePath) {
77
77
  throw err;
78
78
  }
79
79
  }
80
- /** Read `config/collections-registries.json` from the configured workspace.
81
- * Missing file ⇒ empty list. Malformed JSON or rejected entries log but never
82
- * throw. */
83
- function loadRegistriesConfig() {
84
- const text = readConfigTextOrNull(require_discovery.collectionsRegistriesConfigPath());
80
+ /** Read `config/collections-registries.json` for a workspace. `workspaceRoot`
81
+ * defaults to the host's configured root; a multi-root host passes the project
82
+ * it is serving. Missing file ⇒ empty list. Malformed JSON or rejected entries
83
+ * log but never throw. */
84
+ function loadRegistriesConfig(opts = {}) {
85
+ const text = readConfigTextOrNull(require_discovery.collectionsRegistriesConfigPath(opts.workspaceRoot ?? require_discovery.getWorkspaceRoot()));
85
86
  if (text === null) return [];
86
87
  let parsed;
87
88
  try {
@@ -113,13 +114,13 @@ function officialDescriptor() {
113
114
  /** The full ordered registry list: official first, then user-configured ones.
114
115
  * Re-reads the config file on every call so a Discover refresh picks up edits
115
116
  * without a server restart (the config is small + read-rarely). */
116
- function listRegistries() {
117
- return [officialDescriptor(), ...loadRegistriesConfig()];
117
+ function listRegistries(scope = {}) {
118
+ return [officialDescriptor(), ...loadRegistriesConfig(scope)];
118
119
  }
119
120
  /** Look up one registry descriptor by name. Used by the preview / import path,
120
121
  * which has the registry label from the entry and needs the rawBase. */
121
- function findRegistry(name) {
122
- return listRegistries().find((reg) => reg.name === name) ?? null;
122
+ function findRegistry(name, scope = {}) {
123
+ return listRegistries(scope).find((reg) => reg.name === name) ?? null;
123
124
  }
124
125
  async function loadFromNetwork(descriptor) {
125
126
  let res;
@@ -221,7 +222,7 @@ async function fetchRegistryIndex(descriptor, opts = {}) {
221
222
  * Failure of any single registry doesn't abort the others — that's the point
222
223
  * of supporting multiple registries. */
223
224
  async function fetchAllRegistries(opts = {}) {
224
- const descriptors = listRegistries();
225
+ const descriptors = listRegistries(opts);
225
226
  return await Promise.all(descriptors.map(async (descriptor) => {
226
227
  const result = await fetchRegistryIndex(descriptor, opts);
227
228
  if (!result.ok) return {
@@ -332,8 +333,8 @@ async function fetchJsonObject(rawBase, dirPath, relFile, label) {
332
333
  /** Resolve an entry's rawBase from its `registryName`. A missing match (the
333
334
  * user removed the registry from config while a cached index still references
334
335
  * it) returns null — the caller surfaces it as a 404 rather than crashing. */
335
- function rawBaseForEntry(entry) {
336
- return findRegistry(entry.registryName)?.rawBaseUrl ?? null;
336
+ function rawBaseForEntry(entry, scope = {}) {
337
+ return findRegistry(entry.registryName, scope)?.rawBaseUrl ?? null;
337
338
  }
338
339
  /** Resolve an entry by author+slug across every cached registry's entries.
339
340
  * When `registry` is passed we constrain to that registry — needed because
@@ -351,14 +352,14 @@ function findEntryInMergedView(merged, author, slug, registry) {
351
352
  * index, then fetch + parse its schema.json + meta.json so the Discover tab
352
353
  * can show fields/views before import. With multi-registry support the
353
354
  * `registry` arg disambiguates same-name collections from different sources. */
354
- async function previewCollection(author, slug, registry = null) {
355
- const entry = findEntryInMergedView(await fetchAllRegistries(), author, slug, registry);
355
+ async function previewCollection(author, slug, registry = null, scope = {}) {
356
+ const entry = findEntryInMergedView(await fetchAllRegistries(scope), author, slug, registry);
356
357
  if (!entry) return {
357
358
  ok: false,
358
359
  status: STATUS_NOT_FOUND$2,
359
360
  error: `unknown collection: ${author}/${slug}`
360
361
  };
361
- const rawBase = rawBaseForEntry(entry);
362
+ const rawBase = rawBaseForEntry(entry, scope);
362
363
  if (!rawBase) return {
363
364
  ok: false,
364
365
  status: STATUS_NOT_FOUND$2,
@@ -412,8 +413,8 @@ function withNormalizedDataPath(schema, localSlug) {
412
413
  dataPath: normalizedDataPath(localSlug)
413
414
  };
414
415
  }
415
- async function fetchManifest(entry) {
416
- const rawBase = rawBaseForEntry(entry);
416
+ async function fetchManifest(entry, scope = {}) {
417
+ const rawBase = rawBaseForEntry(entry, scope);
417
418
  if (!rawBase) return {
418
419
  ok: false,
419
420
  status: STATUS_BAD_GATEWAY,
@@ -443,8 +444,8 @@ async function fetchManifest(entry) {
443
444
  };
444
445
  }
445
446
  /** Fetch every manifest file. Paths are already safety-checked by parseManifest. */
446
- async function fetchBundle(entry, fileList) {
447
- const rawBase = rawBaseForEntry(entry);
447
+ async function fetchBundle(entry, fileList, scope = {}) {
448
+ const rawBase = rawBaseForEntry(entry, scope);
448
449
  if (!rawBase) return {
449
450
  ok: false,
450
451
  status: STATUS_BAD_GATEWAY,
@@ -723,7 +724,7 @@ async function writeImportedCollection(params) {
723
724
  };
724
725
  }
725
726
  async function performImport(author, slug, workspaceRoot, registry = null) {
726
- const merged = await fetchAllRegistries();
727
+ const merged = await fetchAllRegistries({ workspaceRoot });
727
728
  let entry;
728
729
  for (const reg of merged) {
729
730
  if (registry !== null && reg.name !== registry) continue;
@@ -735,13 +736,13 @@ async function performImport(author, slug, workspaceRoot, registry = null) {
735
736
  status: STATUS_NOT_FOUND$1,
736
737
  error: `unknown collection: ${author}/${slug}`
737
738
  };
738
- const manifest = await fetchManifest(entry);
739
+ const manifest = await fetchManifest(entry, { workspaceRoot });
739
740
  if (!manifest.ok) return {
740
741
  ok: false,
741
742
  status: manifest.status,
742
743
  error: manifest.error
743
744
  };
744
- const bundle = await fetchBundle(entry, manifest.files);
745
+ const bundle = await fetchBundle(entry, manifest.files, { workspaceRoot });
745
746
  if (!bundle.ok) return {
746
747
  ok: false,
747
748
  status: bundle.status,
@@ -1032,8 +1033,8 @@ async function performExport(slug, opts, workspaceRoot) {
1032
1033
  /** Build the merged Discover catalog response (`GET …collectionsRegistry.list`).
1033
1034
  * Wraps `fetchAllRegistries` with the per-registry summary + stale-flag shaping
1034
1035
  * every host needs, so a downstream host doesn't re-implement the mapping. */
1035
- async function listRegistry() {
1036
- const merged = await fetchAllRegistries();
1036
+ async function listRegistry(scope = {}) {
1037
+ const merged = await fetchAllRegistries(scope);
1037
1038
  return {
1038
1039
  registries: merged.map((reg) => ({
1039
1040
  name: reg.name,