@agentforge-io/sdk-server 4.9.0 → 4.10.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/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
  /**
@@ -2,8 +2,14 @@ import type { AgentForgeClient } from '../client';
2
2
  import type { TemplateDetail, TemplateInstallResult, TemplateSummary } from '../types';
3
3
  export interface ListTemplatesInput {
4
4
  kind?: 'agent' | 'team';
5
- /** Every tag must match (AND), e.g. ['poodledeck', 'type:food']. */
5
+ /** Every tag must match (AND), e.g. ['type:food']. */
6
6
  tags?: string[];
7
+ /** Leave out templates carrying any of these tags. */
8
+ excludeTags?: string[];
9
+ /** 'own': the caller's templates (its tenant's and, for an App in an
10
+ * installed tenant, its home tenant's). 'market': system and public
11
+ * templates of others. Omit for both. */
12
+ scope?: 'own' | 'market';
7
13
  /** Free-text search. */
8
14
  q?: string;
9
15
  /** 1–200. */
@@ -4,6 +4,11 @@
4
4
  // public, filtered by tag) and installs one into the tenant it acts in —
5
5
  // usually an owner's tenant via `af.forTenant(tenantId).templates.install`.
6
6
  //
7
+ // A host authors its templates in its OWN tenant (`scope: 'own'`); they stay
8
+ // its own — listed and installable — in every tenant the App is installed
9
+ // in, without being published. `scope: 'market'` is everyone else's: system
10
+ // and public templates.
11
+ //
7
12
  // Installing copies the team, members, orchestrator, skills and tools, and
8
13
  // creates the template's config variables EMPTY (`configCreated`); fill them
9
14
  // with `config.set`. Rows created by an App secret are owned by the App.
@@ -20,6 +25,10 @@ class TemplatesResource {
20
25
  qs.set('kind', input.kind);
21
26
  for (const tag of input.tags ?? [])
22
27
  qs.append('tag', tag);
28
+ for (const tag of input.excludeTags ?? [])
29
+ qs.append('excludeTag', tag);
30
+ if (input.scope)
31
+ qs.set('scope', input.scope);
23
32
  if (input.q)
24
33
  qs.set('q', input.q);
25
34
  if (input.limit !== undefined)
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.10.0",
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",