@agentforge-io/sdk-server 4.0.20 → 4.0.21

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.d.ts CHANGED
@@ -2,7 +2,7 @@ export { AgentForgeClient } from './client';
2
2
  export type { AgentForgeClientOptions, RequestOptions } from './client';
3
3
  export { AgentForgeError, AgentForgeAuthError, AgentForgeNotFoundError, AgentForgeNetworkError, } from './errors';
4
4
  export { TOOL_CALLBACK_HEADERS, ToolCallbackSignatureError, signToolCallbackPayload, verifyToolCallbackSignature, } from './webhooks';
5
- export type { AgentMe, AgentSummary, ApprovalCopyBundle, ChatStreamChunk, ChatStreamEvent, ChatTokenRecord, ConnectorDefaultsResult, ConnectorDefaultsSource, ConnectorResourceItem, ConnectorStatus, ConnectorToolInfo, ConversationHistory, ConversationStatus, CreateAgentInput, CreateClickupTaskInput, CreateClickupTaskResult, ExternalToolSummary, IssueChatTokenInput, ListAgentsResult, ListConnectorResourcesResult, McpServerConfig, MessageRecord, MessageRole, PublicAppBranding, RegisterToolInput, RegisterToolsInput, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, } from './types';
5
+ export type { AgentMe, AgentSummary, ApprovalCopyBundle, ChatStreamChunk, ChatStreamEvent, ChatTokenRecord, ConnectorDefaultsResult, ConnectorDefaultsSource, ConnectorResourceItem, ConnectorStatus, ConnectorToolInfo, ConversationHistory, ConversationStatus, CreateAgentInput, CreateClickupTaskInput, CreateClickupTaskResult, ExternalToolSummary, IssueChatTokenInput, ListAgentsResult, ListConnectorResourcesResult, McpServerConfig, MessageRecord, MessageRole, PublicAppBranding, AppSelf, AppSelfConnector, AppSelfConnectors, RegisterToolInput, RegisterToolsInput, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, } from './types';
6
6
  export { AgentsResource } from './resources/agents';
7
7
  export { AppsResource } from './resources/apps';
8
8
  export { ChatResource } from './resources/chat';
@@ -1,5 +1,5 @@
1
1
  import type { AgentForgeClient } from '../client';
2
- import type { PublicAppBranding } from '../types';
2
+ import type { PublicAppBranding, AppSelf, AppSelfConnectors } from '../types';
3
3
  export declare class AppsResource {
4
4
  private readonly client;
5
5
  constructor(client: AgentForgeClient);
@@ -20,18 +20,26 @@ export declare class AppsResource {
20
20
  */
21
21
  publicMetadata(publicKey: string): Promise<PublicAppBranding>;
22
22
  /**
23
- * Metadata of the App this client authenticated AS (via `sk_live_` in
24
- * `appSecret`). NOT YET AVAILABLE — the `sk_live_` guard resolves the App
25
- * server-side, but no "self" endpoint returns it. Throws until the backend
26
- * half of §6 lands, so callers get a clear signal instead of a 404.
23
+ * `GET /apps/me` — metadata of the App this client authenticated AS (via
24
+ * `sk_live_` in `appSecret`). Returns branding + status + credential
25
+ * prefixes only — never the plaintext secret or its hash.
26
+ *
27
+ * Requires the client to have an `appSecret`. A `pk_test_`/draft App's
28
+ * `sk_live_` is rejected upstream (403 `not_published`); a client with no
29
+ * `appSecret` gets 401.
30
+ *
31
+ * @example
32
+ * const me = await af.apps.me();
33
+ * if (me.status !== 'published') warnAuthorTheirAppIsDraft();
27
34
  */
28
- me(): Promise<never>;
35
+ me(): Promise<AppSelf>;
29
36
  readonly connectors: {
30
37
  /**
31
- * Connectors enabled for the authenticated App. NOT YET AVAILABLE — same
32
- * reason as `me()`: needs a `sk_live_`-authenticated self endpoint that
33
- * doesn't exist yet.
38
+ * `GET /apps/me/connectors` — connectors resolved for the App this client
39
+ * authenticated AS, with the same whitelist-vs-legacy `mode` the
40
+ * tenant-admin surface returns. Only `enabled` rows are actually usable
41
+ * by the App at runtime.
34
42
  */
35
- list: () => Promise<never>;
43
+ list: () => Promise<AppSelfConnectors>;
36
44
  };
37
45
  }
@@ -11,16 +11,15 @@
11
11
  // `GET /apps/public/:publicKey` (AGF-070f-pk). Used for the
12
12
  // frontend/widget case where only the public key is known.
13
13
  // - `me()` / `connectors.list()` — self-metadata for the App the client
14
- // authenticated AS (via `sk_live_` in `appSecret`). These need
15
- // server-side "self" endpoints that DON'T EXIST YET (the guard resolves
16
- // the App from `sk_live_`, but no controller returns it) — they throw a
17
- // clear NotImplemented until the backend half lands, rather than silently
18
- // hitting a 404. See the §6 note in the task ledger.
14
+ // authenticated AS (via `sk_live_` in `appSecret`). Backed by
15
+ // `GET /apps/me` and `GET /apps/me/connectors` (AGF-070 §6 backend).
16
+ // The client's `appSecret` is sent automatically on the
17
+ // `Authorization: Bearer` header, so the server's `ApiKeyGuard` resolves
18
+ // the calling App and returns ONLY that App — no id/tenant param needed.
19
19
  //
20
- // Auth: `publicMetadata` is unauthenticated (the endpoint is `@Public()`), so
21
- // it works even on a client constructed with only a `baseURL`-less-secret
22
- // path is N/A here — we call the raw endpoint directly. `me()`/`connectors`
23
- // will use the `sk_live_` (`appSecret`) auth once their endpoints exist.
20
+ // Auth: `publicMetadata` is unauthenticated (the endpoint is `@Public()`).
21
+ // `me()`/`connectors.list()` require the client to have been constructed with
22
+ // `appSecret` (`sk_live_...`); without it the server answers 401.
24
23
  Object.defineProperty(exports, "__esModule", { value: true });
25
24
  exports.AppsResource = void 0;
26
25
  class AppsResource {
@@ -28,14 +27,13 @@ class AppsResource {
28
27
  this.client = client;
29
28
  this.connectors = {
30
29
  /**
31
- * Connectors enabled for the authenticated App. NOT YET AVAILABLE — same
32
- * reason as `me()`: needs a `sk_live_`-authenticated self endpoint that
33
- * doesn't exist yet.
30
+ * `GET /apps/me/connectors` — connectors resolved for the App this client
31
+ * authenticated AS, with the same whitelist-vs-legacy `mode` the
32
+ * tenant-admin surface returns. Only `enabled` rows are actually usable
33
+ * by the App at runtime.
34
34
  */
35
35
  list: async () => {
36
- throw new Error('AppsResource.connectors.list() is not available yet — needs a ' +
37
- "sk_live_-authenticated self endpoint (GET /apps/me/connectors) that hasn't " +
38
- 'been implemented. See AGF-070 §6.');
36
+ return this.client.request('GET', '/apps/me/connectors');
39
37
  },
40
38
  };
41
39
  }
@@ -58,15 +56,20 @@ class AppsResource {
58
56
  return this.client.request('GET', `/apps/public/${encodeURIComponent(publicKey)}`);
59
57
  }
60
58
  /**
61
- * Metadata of the App this client authenticated AS (via `sk_live_` in
62
- * `appSecret`). NOT YET AVAILABLE — the `sk_live_` guard resolves the App
63
- * server-side, but no "self" endpoint returns it. Throws until the backend
64
- * half of §6 lands, so callers get a clear signal instead of a 404.
59
+ * `GET /apps/me` — metadata of the App this client authenticated AS (via
60
+ * `sk_live_` in `appSecret`). Returns branding + status + credential
61
+ * prefixes only — never the plaintext secret or its hash.
62
+ *
63
+ * Requires the client to have an `appSecret`. A `pk_test_`/draft App's
64
+ * `sk_live_` is rejected upstream (403 `not_published`); a client with no
65
+ * `appSecret` gets 401.
66
+ *
67
+ * @example
68
+ * const me = await af.apps.me();
69
+ * if (me.status !== 'published') warnAuthorTheirAppIsDraft();
65
70
  */
66
71
  async me() {
67
- throw new Error('AppsResource.me() is not available yet — the server-side self endpoint ' +
68
- "(GET /apps/me, authenticated by sk_live_) hasn't been implemented. " +
69
- 'Use publicMetadata(publicKey) for branding by public key in the meantime.');
72
+ return this.client.request('GET', '/apps/me');
70
73
  }
71
74
  }
72
75
  exports.AppsResource = AppsResource;
package/dist/types.d.ts CHANGED
@@ -48,6 +48,42 @@ export interface PublicAppBranding {
48
48
  logoUrl: string | null;
49
49
  coverUrl: string | null;
50
50
  }
51
+ export interface AppSelf {
52
+ id: string;
53
+ name: string;
54
+ description: string | null;
55
+ logoUrl: string | null;
56
+ coverUrl: string | null;
57
+ content: string | null;
58
+ status: 'draft' | 'published';
59
+ publicKey: string;
60
+ apiSecretPrefix: string;
61
+ publicKeyTest: string | null;
62
+ apiSecretTestPrefix: string | null;
63
+ revokedAt: string | null;
64
+ lastUsedAt: string | null;
65
+ createdAt: string;
66
+ updatedAt: string;
67
+ }
68
+ export interface AppSelfConnector {
69
+ connectorId: string;
70
+ name: string;
71
+ iconUrl?: string;
72
+ /** Available to this App via the tenant's connected connectors. */
73
+ available: boolean;
74
+ /** Enabled for this App (whitelist row `enabled`, or `available` when the
75
+ * App has no whitelist rows and falls back to legacy allow-all). */
76
+ enabled: boolean;
77
+ /** The App has a per-tool permission override for this connector. */
78
+ hasOverride: boolean;
79
+ }
80
+ export interface AppSelfConnectors {
81
+ /** `'whitelist'` — the App has >=1 explicit row; only `enabled` counts.
82
+ * `'legacy'` — zero rows, every tenant-connected connector is implicitly
83
+ * available. */
84
+ mode: 'whitelist' | 'legacy';
85
+ connectors: AppSelfConnector[];
86
+ }
51
87
  export interface RegisterToolInput {
52
88
  name: string;
53
89
  description: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge-io/sdk-server",
3
- "version": "4.0.20",
3
+ "version": "4.0.21",
4
4
  "description": "Server-side SDK for backend apps integrating with AgentForge platform. Auth via ChatToken or ak_live_ API key.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",