@cotal-ai/pi 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/index.js CHANGED
@@ -27449,10 +27449,10 @@ import { isConcreteChannel as isConcreteChannel3, channelInAllow as channelInAll
27449
27449
  import { parsePrincipalKey as parsePrincipalKey2, peerLabel as peerLabel3 } from "@cotal-ai/core";
27450
27450
 
27451
27451
  // ../connector-core/dist/docs-bundle.generated.js
27452
- var DOCS_VERSION = "0.108.1";
27452
+ var DOCS_VERSION = "0.109.0";
27453
27453
  function loadDocsBundle() {
27454
27454
  return {
27455
- "version": "0.108.1",
27455
+ "version": "0.109.0",
27456
27456
  "generatedFrom": "docs/*.md + SPEC.md + spec/cotal-lang.md + spec/cotal.schema.json",
27457
27457
  "pages": [
27458
27458
  {
@@ -45114,6 +45114,8 @@ function claims(ext) {
45114
45114
  }
45115
45115
  var Registry = class {
45116
45116
  #byKey = /* @__PURE__ */ new Map();
45117
+ /** `kind:name` → the declared provider that registers it, and its import once one has started. */
45118
+ #providers = /* @__PURE__ */ new Map();
45117
45119
  /** `kind:alias` → the claiming extension's `kind:name` key, for committed extensions. */
45118
45120
  #aliases = /* @__PURE__ */ new Map();
45119
45121
  /** While a stage is active in the CURRENT async context, {@link register} writes there instead of
@@ -45200,13 +45202,47 @@ var Registry = class {
45200
45202
  return this.#aliases.get(key) ?? key;
45201
45203
  }
45202
45204
  /** Resolve one extension by kind + name or alias. Unknown throws. Staged (uncommitted) registrations are
45203
- * invisible here; only committed ones resolve. */
45205
+ * invisible here; only committed ones resolve. A key whose declared provider has not loaded throws
45206
+ * too, naming that: {@link load} resolves it. */
45204
45207
  resolve(kind, name) {
45205
45208
  const ext = this.#byKey.get(this.#canonical(kind, name));
45206
- if (!ext)
45209
+ if (!ext) {
45210
+ if (this.#providers.has(`${kind}:${name}`))
45211
+ throw new Error(`${kind} "${name}" is declared by a provider this process has not loaded`);
45207
45212
  throw new Error(`no ${kind} registered for "${name}"`);
45213
+ }
45208
45214
  return ext;
45209
45215
  }
45216
+ /** Declare a provider: a module that registers `provides` when it is imported. Nothing is imported
45217
+ * here. A key that another provider already declares is refused, so a key has one provider. */
45218
+ provide(provider) {
45219
+ const keys = provider.provides.map((ref) => `${ref.kind}:${ref.name}`);
45220
+ for (const key of keys)
45221
+ if (this.#providers.has(key))
45222
+ throw new Error(`extension provider already declared: ${key}`);
45223
+ const entry = { provider };
45224
+ for (const key of keys)
45225
+ this.#providers.set(key, entry);
45226
+ }
45227
+ /** Whether a provider was declared for exactly this kind + name, loaded or not. A boolean probe
45228
+ * that never throws and imports nothing. */
45229
+ provides(kind, name) {
45230
+ return this.#providers.has(`${kind}:${name}`);
45231
+ }
45232
+ /** Resolve kind + name, first importing the provider declared for it unless that import has run.
45233
+ * Concurrent calls share one import. A key no provider declares resolves as {@link resolve} does.
45234
+ * A provider that loads without registering the key it declared throws: the declaration is wrong,
45235
+ * and no other extension stands in for it. */
45236
+ async load(kind, name) {
45237
+ const entry = this.#providers.get(`${kind}:${name}`);
45238
+ if (entry) {
45239
+ entry.loading ??= entry.provider.load();
45240
+ await entry.loading;
45241
+ if (!this.#byKey.has(this.#canonical(kind, name)))
45242
+ throw new Error(`the provider declared for ${kind} "${name}" loaded without registering it`);
45243
+ }
45244
+ return this.resolve(kind, name);
45245
+ }
45210
45246
  all(kind) {
45211
45247
  const values = [...this.#byKey.values()];
45212
45248
  return kind === void 0 ? values : values.filter((e) => e.kind === kind);
@@ -65891,10 +65927,10 @@ function date4(params) {
65891
65927
  config(en_default());
65892
65928
 
65893
65929
  // ../connector-core/dist/docs-bundle.generated.js
65894
- var DOCS_VERSION = "0.108.1";
65930
+ var DOCS_VERSION = "0.109.0";
65895
65931
  function loadDocsBundle() {
65896
65932
  return {
65897
- "version": "0.108.1",
65933
+ "version": "0.109.0",
65898
65934
  "generatedFrom": "docs/*.md + SPEC.md + spec/cotal-lang.md + spec/cotal.schema.json",
65899
65935
  "pages": [
65900
65936
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cotal-ai/pi",
3
- "version": "0.108.1",
3
+ "version": "0.109.0",
4
4
  "license": "Apache-2.0",
5
5
  "keywords": [
6
6
  "cotal",
@@ -34,8 +34,8 @@
34
34
  "@earendil-works/pi-tui": ">=0.79.10"
35
35
  },
36
36
  "devDependencies": {
37
- "@cotal-ai/core": "0.108.1",
38
- "@cotal-ai/connector-core": "0.108.1",
37
+ "@cotal-ai/core": "0.109.0",
38
+ "@cotal-ai/connector-core": "0.109.0",
39
39
  "@cotal-ai/smoke-kit": "0.0.0",
40
40
  "@earendil-works/pi-ai": "0.79.10",
41
41
  "@earendil-works/pi-coding-agent": "0.79.10",