@cotal-ai/connector-jcode 0.108.1 → 0.109.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/dist/host.js CHANGED
@@ -45082,6 +45082,8 @@ function claims(ext) {
45082
45082
  }
45083
45083
  var Registry = class {
45084
45084
  #byKey = /* @__PURE__ */ new Map();
45085
+ /** `kind:name` → the declared provider that registers it, and its import once one has started. */
45086
+ #providers = /* @__PURE__ */ new Map();
45085
45087
  /** `kind:alias` → the claiming extension's `kind:name` key, for committed extensions. */
45086
45088
  #aliases = /* @__PURE__ */ new Map();
45087
45089
  /** While a stage is active in the CURRENT async context, {@link register} writes there instead of
@@ -45168,13 +45170,47 @@ var Registry = class {
45168
45170
  return this.#aliases.get(key) ?? key;
45169
45171
  }
45170
45172
  /** Resolve one extension by kind + name or alias. Unknown throws. Staged (uncommitted) registrations are
45171
- * invisible here; only committed ones resolve. */
45173
+ * invisible here; only committed ones resolve. A key whose declared provider has not loaded throws
45174
+ * too, naming that: {@link load} resolves it. */
45172
45175
  resolve(kind, name) {
45173
45176
  const ext = this.#byKey.get(this.#canonical(kind, name));
45174
- if (!ext)
45177
+ if (!ext) {
45178
+ if (this.#providers.has(`${kind}:${name}`))
45179
+ throw new Error(`${kind} "${name}" is declared by a provider this process has not loaded`);
45175
45180
  throw new Error(`no ${kind} registered for "${name}"`);
45181
+ }
45176
45182
  return ext;
45177
45183
  }
45184
+ /** Declare a provider: a module that registers `provides` when it is imported. Nothing is imported
45185
+ * here. A key that another provider already declares is refused, so a key has one provider. */
45186
+ provide(provider) {
45187
+ const keys = provider.provides.map((ref) => `${ref.kind}:${ref.name}`);
45188
+ for (const key of keys)
45189
+ if (this.#providers.has(key))
45190
+ throw new Error(`extension provider already declared: ${key}`);
45191
+ const entry = { provider };
45192
+ for (const key of keys)
45193
+ this.#providers.set(key, entry);
45194
+ }
45195
+ /** Whether a provider was declared for exactly this kind + name, loaded or not. A boolean probe
45196
+ * that never throws and imports nothing. */
45197
+ provides(kind, name) {
45198
+ return this.#providers.has(`${kind}:${name}`);
45199
+ }
45200
+ /** Resolve kind + name, first importing the provider declared for it unless that import has run.
45201
+ * Concurrent calls share one import. A key no provider declares resolves as {@link resolve} does.
45202
+ * A provider that loads without registering the key it declared throws: the declaration is wrong,
45203
+ * and no other extension stands in for it. */
45204
+ async load(kind, name) {
45205
+ const entry = this.#providers.get(`${kind}:${name}`);
45206
+ if (entry) {
45207
+ entry.loading ??= entry.provider.load();
45208
+ await entry.loading;
45209
+ if (!this.#byKey.has(this.#canonical(kind, name)))
45210
+ throw new Error(`the provider declared for ${kind} "${name}" loaded without registering it`);
45211
+ }
45212
+ return this.resolve(kind, name);
45213
+ }
45178
45214
  all(kind) {
45179
45215
  const values = [...this.#byKey.values()];
45180
45216
  return kind === void 0 ? values : values.filter((e) => e.kind === kind);
@@ -65882,10 +65918,10 @@ function date4(params) {
65882
65918
  config(en_default());
65883
65919
 
65884
65920
  // ../connector-core/dist/docs-bundle.generated.js
65885
- var DOCS_VERSION = "0.108.1";
65921
+ var DOCS_VERSION = "0.109.0";
65886
65922
  function loadDocsBundle() {
65887
65923
  return {
65888
- "version": "0.108.1",
65924
+ "version": "0.109.0",
65889
65925
  "generatedFrom": "docs/*.md + SPEC.md + spec/cotal-lang.md + spec/cotal.schema.json",
65890
65926
  "pages": [
65891
65927
  {
package/dist/mcp.js CHANGED
@@ -57541,6 +57541,8 @@ function claims(ext) {
57541
57541
  }
57542
57542
  var Registry = class {
57543
57543
  #byKey = /* @__PURE__ */ new Map();
57544
+ /** `kind:name` → the declared provider that registers it, and its import once one has started. */
57545
+ #providers = /* @__PURE__ */ new Map();
57544
57546
  /** `kind:alias` → the claiming extension's `kind:name` key, for committed extensions. */
57545
57547
  #aliases = /* @__PURE__ */ new Map();
57546
57548
  /** While a stage is active in the CURRENT async context, {@link register} writes there instead of
@@ -57627,13 +57629,47 @@ var Registry = class {
57627
57629
  return this.#aliases.get(key) ?? key;
57628
57630
  }
57629
57631
  /** Resolve one extension by kind + name or alias. Unknown throws. Staged (uncommitted) registrations are
57630
- * invisible here; only committed ones resolve. */
57632
+ * invisible here; only committed ones resolve. A key whose declared provider has not loaded throws
57633
+ * too, naming that: {@link load} resolves it. */
57631
57634
  resolve(kind, name) {
57632
57635
  const ext = this.#byKey.get(this.#canonical(kind, name));
57633
- if (!ext)
57636
+ if (!ext) {
57637
+ if (this.#providers.has(`${kind}:${name}`))
57638
+ throw new Error(`${kind} "${name}" is declared by a provider this process has not loaded`);
57634
57639
  throw new Error(`no ${kind} registered for "${name}"`);
57640
+ }
57635
57641
  return ext;
57636
57642
  }
57643
+ /** Declare a provider: a module that registers `provides` when it is imported. Nothing is imported
57644
+ * here. A key that another provider already declares is refused, so a key has one provider. */
57645
+ provide(provider) {
57646
+ const keys = provider.provides.map((ref) => `${ref.kind}:${ref.name}`);
57647
+ for (const key of keys)
57648
+ if (this.#providers.has(key))
57649
+ throw new Error(`extension provider already declared: ${key}`);
57650
+ const entry = { provider };
57651
+ for (const key of keys)
57652
+ this.#providers.set(key, entry);
57653
+ }
57654
+ /** Whether a provider was declared for exactly this kind + name, loaded or not. A boolean probe
57655
+ * that never throws and imports nothing. */
57656
+ provides(kind, name) {
57657
+ return this.#providers.has(`${kind}:${name}`);
57658
+ }
57659
+ /** Resolve kind + name, first importing the provider declared for it unless that import has run.
57660
+ * Concurrent calls share one import. A key no provider declares resolves as {@link resolve} does.
57661
+ * A provider that loads without registering the key it declared throws: the declaration is wrong,
57662
+ * and no other extension stands in for it. */
57663
+ async load(kind, name) {
57664
+ const entry = this.#providers.get(`${kind}:${name}`);
57665
+ if (entry) {
57666
+ entry.loading ??= entry.provider.load();
57667
+ await entry.loading;
57668
+ if (!this.#byKey.has(this.#canonical(kind, name)))
57669
+ throw new Error(`the provider declared for ${kind} "${name}" loaded without registering it`);
57670
+ }
57671
+ return this.resolve(kind, name);
57672
+ }
57637
57673
  all(kind) {
57638
57674
  const values = [...this.#byKey.values()];
57639
57675
  return kind === void 0 ? values : values.filter((e) => e.kind === kind);
@@ -58085,10 +58121,10 @@ async function submitFeedback(input, options = {}) {
58085
58121
  import { execFileSync } from "node:child_process";
58086
58122
 
58087
58123
  // ../connector-core/dist/docs-bundle.generated.js
58088
- var DOCS_VERSION = "0.108.1";
58124
+ var DOCS_VERSION = "0.109.0";
58089
58125
  function loadDocsBundle() {
58090
58126
  return {
58091
- "version": "0.108.1",
58127
+ "version": "0.109.0",
58092
58128
  "generatedFrom": "docs/*.md + SPEC.md + spec/cotal-lang.md + spec/cotal.schema.json",
58093
58129
  "pages": [
58094
58130
  {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cotal-ai/connector-jcode",
3
3
  "description": "Cotal connector for Jcode: a host-mode mesh peer driven through Jcode's Harness API bridge.",
4
- "version": "0.108.1",
4
+ "version": "0.109.0",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -26,8 +26,8 @@
26
26
  "smol-toml": "^1.8.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@cotal-ai/connector-core": "0.108.1",
30
- "@cotal-ai/core": "0.108.1",
29
+ "@cotal-ai/connector-core": "0.109.0",
30
+ "@cotal-ai/core": "0.109.0",
31
31
  "@cotal-ai/smoke-kit": "0.0.0",
32
32
  "esbuild": "^0.28.0",
33
33
  "tsx": "^4.22.4",