@cotal-ai/connector-opencode 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.
@@ -44981,6 +44981,8 @@ function claims(ext) {
44981
44981
  }
44982
44982
  var Registry = class {
44983
44983
  #byKey = /* @__PURE__ */ new Map();
44984
+ /** `kind:name` → the declared provider that registers it, and its import once one has started. */
44985
+ #providers = /* @__PURE__ */ new Map();
44984
44986
  /** `kind:alias` → the claiming extension's `kind:name` key, for committed extensions. */
44985
44987
  #aliases = /* @__PURE__ */ new Map();
44986
44988
  /** While a stage is active in the CURRENT async context, {@link register} writes there instead of
@@ -45067,13 +45069,47 @@ var Registry = class {
45067
45069
  return this.#aliases.get(key) ?? key;
45068
45070
  }
45069
45071
  /** Resolve one extension by kind + name or alias. Unknown throws. Staged (uncommitted) registrations are
45070
- * invisible here; only committed ones resolve. */
45072
+ * invisible here; only committed ones resolve. A key whose declared provider has not loaded throws
45073
+ * too, naming that: {@link load} resolves it. */
45071
45074
  resolve(kind, name) {
45072
45075
  const ext = this.#byKey.get(this.#canonical(kind, name));
45073
- if (!ext)
45076
+ if (!ext) {
45077
+ if (this.#providers.has(`${kind}:${name}`))
45078
+ throw new Error(`${kind} "${name}" is declared by a provider this process has not loaded`);
45074
45079
  throw new Error(`no ${kind} registered for "${name}"`);
45080
+ }
45075
45081
  return ext;
45076
45082
  }
45083
+ /** Declare a provider: a module that registers `provides` when it is imported. Nothing is imported
45084
+ * here. A key that another provider already declares is refused, so a key has one provider. */
45085
+ provide(provider) {
45086
+ const keys = provider.provides.map((ref) => `${ref.kind}:${ref.name}`);
45087
+ for (const key of keys)
45088
+ if (this.#providers.has(key))
45089
+ throw new Error(`extension provider already declared: ${key}`);
45090
+ const entry = { provider };
45091
+ for (const key of keys)
45092
+ this.#providers.set(key, entry);
45093
+ }
45094
+ /** Whether a provider was declared for exactly this kind + name, loaded or not. A boolean probe
45095
+ * that never throws and imports nothing. */
45096
+ provides(kind, name) {
45097
+ return this.#providers.has(`${kind}:${name}`);
45098
+ }
45099
+ /** Resolve kind + name, first importing the provider declared for it unless that import has run.
45100
+ * Concurrent calls share one import. A key no provider declares resolves as {@link resolve} does.
45101
+ * A provider that loads without registering the key it declared throws: the declaration is wrong,
45102
+ * and no other extension stands in for it. */
45103
+ async load(kind, name) {
45104
+ const entry = this.#providers.get(`${kind}:${name}`);
45105
+ if (entry) {
45106
+ entry.loading ??= entry.provider.load();
45107
+ await entry.loading;
45108
+ if (!this.#byKey.has(this.#canonical(kind, name)))
45109
+ throw new Error(`the provider declared for ${kind} "${name}" loaded without registering it`);
45110
+ }
45111
+ return this.resolve(kind, name);
45112
+ }
45077
45113
  all(kind) {
45078
45114
  const values = [...this.#byKey.values()];
45079
45115
  return kind === void 0 ? values : values.filter((e) => e.kind === kind);
@@ -65593,10 +65629,10 @@ function date4(params) {
65593
65629
  config(en_default());
65594
65630
 
65595
65631
  // ../connector-core/dist/docs-bundle.generated.js
65596
- var DOCS_VERSION = "0.108.1";
65632
+ var DOCS_VERSION = "0.109.0";
65597
65633
  function loadDocsBundle() {
65598
65634
  return {
65599
- "version": "0.108.1",
65635
+ "version": "0.109.0",
65600
65636
  "generatedFrom": "docs/*.md + SPEC.md + spec/cotal-lang.md + spec/cotal.schema.json",
65601
65637
  "pages": [
65602
65638
  {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cotal-ai/connector-opencode",
3
3
  "description": "Cotal connector for OpenCode: a native in-process plugin that joins a session to the mesh.",
4
- "version": "0.108.1",
4
+ "version": "0.109.0",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -21,8 +21,8 @@
21
21
  "@cotal-ai/core": ">=0.1.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@cotal-ai/connector-core": "0.108.1",
25
- "@cotal-ai/core": "0.108.1",
24
+ "@cotal-ai/connector-core": "0.109.0",
25
+ "@cotal-ai/core": "0.109.0",
26
26
  "@cotal-ai/smoke-kit": "0.0.0",
27
27
  "@nats-io/transport-node": "^3.4.0",
28
28
  "@opencode-ai/plugin": "^1.16.2",