@opengeni/core 0.4.3 → 0.4.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/core",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "OpenGeni framework-agnostic core: the domain, access, and billing layers (neutral access, off-HTTP V2 surface). Behavior-preserving extraction from apps/api — keeps Hono's HTTPException for error throwing (typed-errors cleanup deferred).",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -38,14 +38,14 @@
38
38
  "dependencies": {
39
39
  "@modelcontextprotocol/sdk": "^1.29.0",
40
40
  "@opengeni/codex": "^0.2.1",
41
- "@opengeni/config": "^0.3.0",
41
+ "@opengeni/config": "^0.4.0",
42
42
  "@opengeni/contracts": "^0.9.0",
43
- "@opengeni/db": "^0.6.0",
44
- "@opengeni/documents": "^0.2.7",
45
- "@opengeni/events": "^0.2.7",
43
+ "@opengeni/db": "^0.6.1",
44
+ "@opengeni/documents": "^0.2.8",
45
+ "@opengeni/events": "^0.2.8",
46
46
  "@opengeni/observability": "^0.2.1",
47
- "@opengeni/runtime": "^0.4.0",
48
- "@opengeni/storage": "^0.2.7",
47
+ "@opengeni/runtime": "^0.6.0",
48
+ "@opengeni/storage": "^0.2.8",
49
49
  "hono": "^4.12.18"
50
50
  }
51
51
  }
@@ -785,7 +785,7 @@ async function readSkillMetadata(url: URL, fallbackName: string): Promise<{ name
785
785
  return { name, description, category };
786
786
  }
787
787
 
788
- function applyCapabilityEnablement(
788
+ export function applyCapabilityEnablement(
789
789
  item: CapabilityCatalogItem,
790
790
  installation: CapabilityInstallation | undefined,
791
791
  activePackIds: Set<string>,
@@ -813,9 +813,28 @@ function applyCapabilityEnablement(
813
813
  ...item,
814
814
  enabled,
815
815
  enabledReason: enabled ? "enabled" : null,
816
+ connectionRef: enabled && installation ? installationConnectionRef(installation.config) : null,
816
817
  };
817
818
  }
818
819
 
820
+ /**
821
+ * The connection an installation was enabled with, when the enable-time
822
+ * connectionRef fully resolved to one (config.connectionRef is set only by
823
+ * the enable path — see enableCapability). Headers-enabled and credential-
824
+ * free installations never set it, so this returns null for them.
825
+ */
826
+ function installationConnectionRef(config: Record<string, unknown>): CapabilityCatalogItem["connectionRef"] {
827
+ const ref = config.connectionRef;
828
+ if (!ref || typeof ref !== "object") {
829
+ return null;
830
+ }
831
+ const { connectionId, providerDomain, kind } = ref as Record<string, unknown>;
832
+ if (typeof connectionId !== "string" || typeof providerDomain !== "string" || typeof kind !== "string") {
833
+ return null;
834
+ }
835
+ return { connectionId, providerDomain, kind };
836
+ }
837
+
819
838
  function dedupeCatalogItems(items: CapabilityCatalogItem[]): CapabilityCatalogItem[] {
820
839
  const byId = new Map<string, CapabilityCatalogItem>();
821
840
  for (const item of items) {