@alfe.ai/agent-api-client 0.0.3 → 0.0.4
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 +19 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
//#region ../../packages-internal/types/dist/integration.d.ts
|
|
2
2
|
|
|
3
|
+
/** Scope at which an integration is installed */
|
|
4
|
+
declare const IntegrationScope: {
|
|
5
|
+
readonly Org: "org";
|
|
6
|
+
readonly Team: "team";
|
|
7
|
+
readonly Project: "project";
|
|
8
|
+
readonly Agent: "agent";
|
|
9
|
+
};
|
|
10
|
+
type IntegrationScope = (typeof IntegrationScope)[keyof typeof IntegrationScope];
|
|
3
11
|
declare const IntegrationDesiredStatus: {
|
|
4
12
|
readonly Active: "active";
|
|
5
13
|
readonly Removed: "removed";
|
|
@@ -14,8 +22,9 @@ declare const IntegrationActualStatus: {
|
|
|
14
22
|
readonly Unknown: "unknown";
|
|
15
23
|
};
|
|
16
24
|
type IntegrationActualStatus = (typeof IntegrationActualStatus)[keyof typeof IntegrationActualStatus];
|
|
17
|
-
interface
|
|
18
|
-
|
|
25
|
+
interface IntegrationInstall {
|
|
26
|
+
scope: IntegrationScope;
|
|
27
|
+
scopeId: string;
|
|
19
28
|
integrationId: string;
|
|
20
29
|
tenantId: string;
|
|
21
30
|
desiredStatus: IntegrationDesiredStatus;
|
|
@@ -26,6 +35,8 @@ interface AgentIntegration {
|
|
|
26
35
|
installedAt: string;
|
|
27
36
|
updatedAt: string;
|
|
28
37
|
}
|
|
38
|
+
/** @deprecated Use IntegrationInstall instead */
|
|
39
|
+
|
|
29
40
|
interface IntegrationConfigSchemaField {
|
|
30
41
|
key: string;
|
|
31
42
|
label: string;
|
|
@@ -69,6 +80,8 @@ interface RegistryEntry {
|
|
|
69
80
|
preview_images?: string[];
|
|
70
81
|
config_schema?: IntegrationConfigSchemaField[];
|
|
71
82
|
supported_agents?: string[];
|
|
83
|
+
/** Scopes where this integration can be installed */
|
|
84
|
+
supported_scopes?: IntegrationScope[];
|
|
72
85
|
}
|
|
73
86
|
//# sourceMappingURL=integration.d.ts.map
|
|
74
87
|
//#endregion
|
|
@@ -82,14 +95,14 @@ declare class AgentApiClient {
|
|
|
82
95
|
private readonly apiUrl;
|
|
83
96
|
constructor(config: AgentApiClientConfig);
|
|
84
97
|
private request;
|
|
85
|
-
listIntegrations(): Promise<
|
|
98
|
+
listIntegrations(): Promise<IntegrationInstall[]>;
|
|
86
99
|
getIntegrationConfig(integrationId: string): Promise<IntegrationConfigResult>;
|
|
87
100
|
updateIntegrationConfig(integrationId: string, config: Record<string, unknown>): Promise<void>;
|
|
88
101
|
installIntegration(integrationId: string, options?: {
|
|
89
102
|
version?: string;
|
|
90
103
|
config?: Record<string, unknown>;
|
|
91
|
-
}): Promise<
|
|
92
|
-
removeIntegration(integrationId: string): Promise<
|
|
104
|
+
}): Promise<IntegrationInstall>;
|
|
105
|
+
removeIntegration(integrationId: string): Promise<IntegrationInstall>;
|
|
93
106
|
getRegistry(): Promise<{
|
|
94
107
|
integrations: RegistryEntry[];
|
|
95
108
|
}>;
|
|
@@ -104,5 +117,5 @@ declare class AgentApiClient {
|
|
|
104
117
|
//# sourceMappingURL=index.d.ts.map
|
|
105
118
|
|
|
106
119
|
//#endregion
|
|
107
|
-
export { AgentApiClient, AgentApiClientConfig, type
|
|
120
|
+
export { AgentApiClient, AgentApiClientConfig, type IntegrationConfigResult, type IntegrationConfigSchemaField, type IntegrationInstall, type RegistryEntry };
|
|
108
121
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["DEFAULT_INTEGRATIONS","IntegrationDesiredStatus","INTEGRATION_DESIRED_STATUSES","IntegrationActualStatus","INTEGRATION_ACTUAL_STATUSES","
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["DEFAULT_INTEGRATIONS","IntegrationScope","INTEGRATION_SCOPES","IntegrationDesiredStatus","INTEGRATION_DESIRED_STATUSES","IntegrationActualStatus","INTEGRATION_ACTUAL_STATUSES","IntegrationInstall","Record","AgentIntegration","OrgIntegration","IntegrationConfigSchemaField","IntegrationConfigResult","RegistryEntry"],"sources":["../../../packages-internal/types/dist/integration.d.ts","../src/index.ts"],"sourcesContent":["/** Integrations auto-installed for ALL agents regardless of hosting type. Cannot be removed. */\nexport declare const DEFAULT_INTEGRATIONS: readonly string[];\n/** Scope at which an integration is installed */\nexport declare const IntegrationScope: {\n readonly Org: \"org\";\n readonly Team: \"team\";\n readonly Project: \"project\";\n readonly Agent: \"agent\";\n};\nexport type IntegrationScope = (typeof IntegrationScope)[keyof typeof IntegrationScope];\nexport declare const INTEGRATION_SCOPES: readonly [\"org\" | \"team\" | \"project\" | \"agent\", ...(\"org\" | \"team\" | \"project\" | \"agent\")[]];\nexport declare const IntegrationDesiredStatus: {\n readonly Active: \"active\";\n readonly Removed: \"removed\";\n};\nexport type IntegrationDesiredStatus = (typeof IntegrationDesiredStatus)[keyof typeof IntegrationDesiredStatus];\nexport declare const INTEGRATION_DESIRED_STATUSES: readonly [\"active\" | \"removed\", ...(\"active\" | \"removed\")[]];\nexport declare const IntegrationActualStatus: {\n readonly Installing: \"installing\";\n readonly Active: \"active\";\n readonly Error: \"error\";\n readonly Removing: \"removing\";\n readonly Inactive: \"inactive\";\n readonly Unknown: \"unknown\";\n};\nexport type IntegrationActualStatus = (typeof IntegrationActualStatus)[keyof typeof IntegrationActualStatus];\nexport declare const INTEGRATION_ACTUAL_STATUSES: readonly [\"active\" | \"error\" | \"installing\" | \"removing\" | \"inactive\" | \"unknown\", ...(\"active\" | \"error\" | \"installing\" | \"removing\" | \"inactive\" | \"unknown\")[]];\nexport interface IntegrationInstall {\n scope: IntegrationScope;\n scopeId: string;\n integrationId: string;\n tenantId: string;\n desiredStatus: IntegrationDesiredStatus;\n actualStatus: IntegrationActualStatus;\n version: string;\n config: Record<string, unknown>;\n errorMessage: string;\n installedAt: string;\n updatedAt: string;\n}\n/** @deprecated Use IntegrationInstall instead */\nexport type AgentIntegration = IntegrationInstall;\n/** Org-scoped integration install */\nexport type OrgIntegration = IntegrationInstall;\nexport interface IntegrationConfigSchemaField {\n key: string;\n label: string;\n type: string;\n description?: string;\n required?: boolean;\n default?: string | number | boolean;\n options?: string[];\n select_options?: {\n value: string;\n label: string;\n }[];\n oauth_provider?: string;\n editable?: string;\n}\nexport interface IntegrationConfigResult {\n integrationId: string;\n config: Record<string, unknown>;\n configSchema: IntegrationConfigSchemaField[];\n}\nexport interface RegistryEntry {\n id: string;\n name: string;\n description: string;\n versions: string[];\n latest: string;\n repository: string;\n commit: string;\n icon?: string;\n author?: {\n name: string;\n url?: string;\n } | string;\n pricing?: {\n type: \"free\" | \"paid\";\n price?: number;\n currency?: string;\n interval?: \"month\" | \"year\";\n };\n features?: string[];\n preview_images?: string[];\n config_schema?: IntegrationConfigSchemaField[];\n supported_agents?: string[];\n /** Scopes where this integration can be installed */\n supported_scopes?: IntegrationScope[];\n}\n//# sourceMappingURL=integration.d.ts.map"],"mappings":";;AASA;AAA4B,cANPC,gBAMO,EAAA;WAAWA,GAAAA,EAAAA,KAAAA;WAA+BA,IAAAA,EAAAA,MAAAA;EAAgB,SAAA,OAAA,EAAA,SAAA;EAEjEE,SAAAA,KAAAA,EAAAA,OAAAA;AAIrB,CAAA;AAAoC,KANxBF,gBAAAA,GAMwB,CAAA,OANGA,gBAMH,CAAA,CAAA,MAAA,OANkCA,gBAMlC,CAAA;AAAkDE,cAJjEA,wBAIiEA,EAAAA;EAAwB,SAAA,MAAA,EAAA,QAAA;EAEzFE,SAAAA,OAAAA,EAAAA,SAOpB;AACD,CAAA;AAAmC,KAVvBF,wBAAAA,GAUuB,CAAA,OAVYA,wBAUZ,CAAA,CAAA,MAAA,OAVmDA,wBAUn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A,MAAAA,ECCxB,oBDDwBA;UAAsCA,OAAAA;EAAuB,gBAAA,CAAA,CAAA,ECuB/E,ODvB+E,CCuBvE,kBDvBuE,EAAA,CAAA;EAE1FE,oBAAAA,CAAkB,aAAA,EAAA,MAAA,CAAA,ECyBkB,ODzBlB,CCyB0B,uBDzB1B,CAAA;EAAA,uBAAA,CAAA,aAAA,EAAA,MAAA,EAAA,MAAA,ECiCvB,MDjCuB,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,ECkC9B,ODlC8B,CAAA,IAAA,CAAA;oBACxBN,CAAAA,aAAAA,EAAAA,MAAAA,EAAAA,QAAAA,EAAAA;IAIQE,OAAAA,CAAAA,EAAAA,MAAAA;IACDE,MAAAA,CAAAA,ECwCyB,MDxCzBA,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;MCyCb,ODvCOG,CCuCC,kBDvCDA,CAAAA;EAAM,iBAAA,CAAA,aAAA,EAAA,MAAA,CAAA,ECkDgC,ODlDhC,CCkDwC,kBDlDxC,CAAA;EASDG,WAAAA,CAAAA,CAAAA,ECgDM,ODhDNA,CAAAA;IAeAC,YAAAA,ECiC8B,aDjCP,EAAA;EAAA,CAAA,CAAA;gBAE5BJ,CAAAA,IAAAA,EAAAA;IACMG,MAAAA,CAAAA,EAAAA,MAAAA;IAA4B,OAAA,EAAA,MAAA;IAE7BE,IAAAA,EAAAA,MAAa,GAAA,WAAA;EAAA,CAAA,CAAA,ECoCxB,ODpCwB,CAAA;IAqBVF,QAAAA,EAAAA,OAAAA"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * @alfe.ai/agent-api-client — Agent self-service API client.\n *\n * Used by agents calling /agents/ endpoints. The agent authenticates\n * with its API key — the backend resolves agentId + tenantId from the token.\n * No agent ID needed in paths or config.\n */\n\nexport type {\n
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * @alfe.ai/agent-api-client — Agent self-service API client.\n *\n * Used by agents calling /agents/ endpoints. The agent authenticates\n * with its API key — the backend resolves agentId + tenantId from the token.\n * No agent ID needed in paths or config.\n */\n\nexport type {\n IntegrationInstall,\n IntegrationConfigResult,\n RegistryEntry,\n IntegrationConfigSchemaField,\n} from \"@alfe/types\";\n\nimport type { IntegrationInstall, IntegrationConfigResult, RegistryEntry } from \"@alfe/types\";\n\nexport interface AgentApiClientConfig {\n apiKey: string;\n apiUrl: string;\n}\n\nexport class AgentApiClient {\n private readonly apiKey: string;\n private readonly apiUrl: string;\n\n constructor(config: AgentApiClientConfig) {\n this.apiKey = config.apiKey;\n this.apiUrl = config.apiUrl;\n }\n\n private async request<T>(path: string, options?: RequestInit): Promise<T> {\n const url = `${this.apiUrl}${path}`;\n const headers = new Headers(options?.headers);\n headers.set(\"Authorization\", `Bearer ${this.apiKey}`);\n headers.set(\"Content-Type\", \"application/json\");\n\n const res = await fetch(url, { ...options, headers });\n\n if (!res.ok) {\n const body = await res.text();\n throw new Error(`Agent API error ${String(res.status)}: ${body}`);\n }\n\n const body = (await res.json()) as { data: T };\n return body.data;\n }\n\n async listIntegrations(): Promise<IntegrationInstall[]> {\n return this.request<IntegrationInstall[]>(\"/agents/integrations\");\n }\n\n async getIntegrationConfig(integrationId: string): Promise<IntegrationConfigResult> {\n return this.request<IntegrationConfigResult>(\n `/agents/integrations/${encodeURIComponent(integrationId)}/config`,\n );\n }\n\n async updateIntegrationConfig(\n integrationId: string,\n config: Record<string, unknown>,\n ): Promise<void> {\n await this.request<unknown>(\n `/agents/integrations/${encodeURIComponent(integrationId)}`,\n {\n method: \"PATCH\",\n body: JSON.stringify({ config }),\n },\n );\n }\n\n async installIntegration(\n integrationId: string,\n options?: { version?: string; config?: Record<string, unknown> },\n ): Promise<IntegrationInstall> {\n return this.request<IntegrationInstall>(\"/agents/integrations\", {\n method: \"POST\",\n body: JSON.stringify({\n integrationId,\n version: options?.version,\n config: options?.config,\n }),\n });\n }\n\n async removeIntegration(integrationId: string): Promise<IntegrationInstall> {\n return this.request<IntegrationInstall>(\n `/agents/integrations/${encodeURIComponent(integrationId)}`,\n { method: \"DELETE\" },\n );\n }\n\n async getRegistry(): Promise<{ integrations: RegistryEntry[] }> {\n return this.request<{ integrations: RegistryEntry[] }>(\"/integrations/registry\");\n }\n\n async recordActivity(data: {\n userId?: string;\n channel: string;\n role: \"user\" | \"assistant\";\n }): Promise<{ recorded: boolean }> {\n return this.request<{ recorded: boolean }>(\"/agents/activity\", {\n method: \"POST\",\n body: JSON.stringify(data),\n });\n }\n}\n"],"mappings":";AAsBA,IAAa,iBAAb,MAA4B;CAC1B;CACA;CAEA,YAAY,QAA8B;AACxC,OAAK,SAAS,OAAO;AACrB,OAAK,SAAS,OAAO;;CAGvB,MAAc,QAAW,MAAc,SAAmC;EACxE,MAAM,MAAM,GAAG,KAAK,SAAS;EAC7B,MAAM,UAAU,IAAI,QAAQ,SAAS,QAAQ;AAC7C,UAAQ,IAAI,iBAAiB,UAAU,KAAK,SAAS;AACrD,UAAQ,IAAI,gBAAgB,mBAAmB;EAE/C,MAAM,MAAM,MAAM,MAAM,KAAK;GAAE,GAAG;GAAS;GAAS,CAAC;AAErD,MAAI,CAAC,IAAI,IAAI;GACX,MAAM,OAAO,MAAM,IAAI,MAAM;AAC7B,SAAM,IAAI,MAAM,mBAAmB,OAAO,IAAI,OAAO,CAAC,IAAI,OAAO;;AAInE,UADc,MAAM,IAAI,MAAM,EAClB;;CAGd,MAAM,mBAAkD;AACtD,SAAO,KAAK,QAA8B,uBAAuB;;CAGnE,MAAM,qBAAqB,eAAyD;AAClF,SAAO,KAAK,QACV,wBAAwB,mBAAmB,cAAc,CAAC,SAC3D;;CAGH,MAAM,wBACJ,eACA,QACe;AACf,QAAM,KAAK,QACT,wBAAwB,mBAAmB,cAAc,IACzD;GACE,QAAQ;GACR,MAAM,KAAK,UAAU,EAAE,QAAQ,CAAC;GACjC,CACF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