@agentforge-io/sdk-server 4.9.0 → 4.9.1

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/client.d.ts CHANGED
@@ -109,6 +109,15 @@ export declare class AgentForgeClient {
109
109
  * ak_live_ — usado por resources cuya superficie SIEMPRE requiere apiKey
110
110
  * (tenant-admin), regardless de si también hay chatToken. */
111
111
  requireApiKey(): string;
112
+ /**
113
+ * The tenant-wide credential for surfaces that refuse a ChatToken
114
+ * (connector-resources, connectors/oauth/*-for-tenant): the `ak_live_`, or
115
+ * an App's `sk_` secret. The server's ApiKeyGuard accepts both on the same
116
+ * header, and with `forTenant` the secret acts in the installed tenant —
117
+ * that is how a host connects an account (Google…) into each of its
118
+ * tenants. Throws when the client has neither.
119
+ */
120
+ requireTenantCredential(): string;
112
121
  private resolveAuthHeaders;
113
122
  /**
114
123
  * Primitiva de bajo nivel: hace el fetch, mapea status codes a errores
package/dist/client.js CHANGED
@@ -138,9 +138,25 @@ class AgentForgeClient {
138
138
  }
139
139
  return this.apiKey;
140
140
  }
141
+ /**
142
+ * The tenant-wide credential for surfaces that refuse a ChatToken
143
+ * (connector-resources, connectors/oauth/*-for-tenant): the `ak_live_`, or
144
+ * an App's `sk_` secret. The server's ApiKeyGuard accepts both on the same
145
+ * header, and with `forTenant` the secret acts in the installed tenant —
146
+ * that is how a host connects an account (Google…) into each of its
147
+ * tenants. Throws when the client has neither.
148
+ */
149
+ requireTenantCredential() {
150
+ const credential = this.apiKey ?? this.appSecret;
151
+ if (!credential) {
152
+ throw new Error('AgentForgeClient: this call requires an ak_live_ apiKey or an App secret (sk_), ' +
153
+ 'but the client was constructed with neither.');
154
+ }
155
+ return credential;
156
+ }
141
157
  resolveAuthHeaders(opts) {
142
158
  if (opts?.forceApiKey)
143
- return { Authorization: `Bearer ${this.requireApiKey()}` };
159
+ return { Authorization: `Bearer ${this.requireTenantCredential()}` };
144
160
  return this.authHeaders();
145
161
  }
146
162
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge-io/sdk-server",
3
- "version": "4.9.0",
3
+ "version": "4.9.1",
4
4
  "description": "Server-side SDK for backend apps integrating with AgentForge platform. Auth via ChatToken, ak_live_ API key or App secret (sk_live_), with App installations across tenants.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",