@polpo-ai/connect 0.15.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/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2026-present Lumea Labs
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # @polpo-ai/connect
2
+
3
+ Shared contracts and client SDK for Polpo Connect.
4
+
5
+ Polpo Connect models external service connections as scoped, revocable capabilities that can be assigned to agents without exposing raw access tokens to the model.
6
+
7
+ This package contains:
8
+
9
+ - connector provider definitions
10
+ - connection and OAuth state types
11
+ - scope normalization and validation helpers
12
+ - connector registry helpers
13
+ - a small HTTP client for Connect APIs
14
+
15
+ Server-side OAuth/token lifecycle lives in `@polpo-ai/connect-server`.
@@ -0,0 +1,58 @@
1
+ import type { ConnectSubject, ConnectionRecord, ConnectorProviderDefinition, RuntimeToken } from "../types.js";
2
+ export interface PolpoConnectClientOptions {
3
+ baseUrl: string;
4
+ headers?: HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
5
+ fetch?: typeof fetch;
6
+ }
7
+ export interface CreateApiKeyConnectionRequest {
8
+ providerId: string;
9
+ apiKey: string;
10
+ scopes?: string[];
11
+ subject?: ConnectSubject;
12
+ name?: string;
13
+ projectId?: string;
14
+ orgId?: string;
15
+ metadata?: Record<string, unknown>;
16
+ }
17
+ export interface StartOAuthRequest {
18
+ providerId: string;
19
+ scopes?: string[];
20
+ subject?: ConnectSubject;
21
+ redirectUri: string;
22
+ projectId?: string;
23
+ orgId?: string;
24
+ connectionName?: string;
25
+ metadata?: Record<string, unknown>;
26
+ }
27
+ export interface StartOAuthResponse {
28
+ authorizationUrl: string;
29
+ state: string;
30
+ expiresAt: string;
31
+ }
32
+ export interface CompleteOAuthRequest {
33
+ state: string;
34
+ code?: string;
35
+ error?: string;
36
+ errorDescription?: string;
37
+ }
38
+ export interface GetTokenRequest {
39
+ scopes?: string[];
40
+ subject?: ConnectSubject;
41
+ actionId?: string;
42
+ forceRefresh?: boolean;
43
+ }
44
+ export declare class PolpoConnectClient {
45
+ private readonly baseUrl;
46
+ private readonly fetchImpl;
47
+ private readonly headers?;
48
+ constructor(options: PolpoConnectClientOptions);
49
+ listProviders(): Promise<ConnectorProviderDefinition[]>;
50
+ listConnections(): Promise<ConnectionRecord[]>;
51
+ createApiKeyConnection(input: CreateApiKeyConnectionRequest): Promise<ConnectionRecord>;
52
+ startOAuth(input: StartOAuthRequest): Promise<StartOAuthResponse>;
53
+ completeOAuth(input: CompleteOAuthRequest): Promise<ConnectionRecord>;
54
+ getToken(connectionId: string, input?: GetTokenRequest): Promise<RuntimeToken>;
55
+ revokeConnection(connectionId: string): Promise<ConnectionRecord>;
56
+ private request;
57
+ }
58
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,2BAA2B,EAC3B,YAAY,EACb,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,WAAW,GAAG,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;IACnE,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED,MAAM,WAAW,6BAA6B;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf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AEpD,OAAO,EAAE,yBAAyB;IAM9C,aAAa,IAAI,OAAO,CAAC,2BAA2B,EAAE,CAAC;IAIvD,eAAe,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAI9C,sBAAsB,CAAC,KAAK,EAAE,6BAA6B,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAIvF,UAAU,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAIjE,aAAa,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAIrE,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,GAAE,eAAoB,GAAG,OAAO,CAAC,YAAY,CAAC;IAIlF,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;YAInD,OAAO;CAmBtB"}
@@ -0,0 +1,59 @@
1
+ import { ConnectError } from "../errors.js";
2
+ export class PolpoConnectClient {
3
+ baseUrl;
4
+ fetchImpl;
5
+ headers;
6
+ constructor(options) {
7
+ this.baseUrl = options.baseUrl.replace(/\/+$/, "");
8
+ this.fetchImpl = options.fetch ?? fetch;
9
+ this.headers = options.headers;
10
+ }
11
+ listProviders() {
12
+ return this.request("GET", "/v1/connect/providers");
13
+ }
14
+ listConnections() {
15
+ return this.request("GET", "/v1/connect/connections");
16
+ }
17
+ createApiKeyConnection(input) {
18
+ return this.request("POST", "/v1/connect/connections/api-key", input);
19
+ }
20
+ startOAuth(input) {
21
+ return this.request("POST", "/v1/connect/oauth/start", input);
22
+ }
23
+ completeOAuth(input) {
24
+ return this.request("POST", "/v1/connect/oauth/callback", input);
25
+ }
26
+ getToken(connectionId, input = {}) {
27
+ return this.request("POST", `/v1/connect/connections/${encodeURIComponent(connectionId)}/token`, input);
28
+ }
29
+ revokeConnection(connectionId) {
30
+ return this.request("POST", `/v1/connect/connections/${encodeURIComponent(connectionId)}/revoke`);
31
+ }
32
+ async request(method, path, body) {
33
+ const dynamicHeaders = typeof this.headers === "function" ? await this.headers() : this.headers;
34
+ const headers = new Headers(dynamicHeaders);
35
+ if (body !== undefined)
36
+ headers.set("content-type", "application/json");
37
+ const response = await this.fetchImpl(`${this.baseUrl}${path}`, {
38
+ method,
39
+ headers,
40
+ body: body === undefined ? undefined : JSON.stringify(body),
41
+ });
42
+ const text = await response.text();
43
+ const payload = text ? safeJson(text) : undefined;
44
+ if (!response.ok) {
45
+ const message = payload && typeof payload === "object" && "error" in payload ? String(payload.error) : response.statusText;
46
+ throw new ConnectError("http_error", message, { status: response.status, details: payload });
47
+ }
48
+ return payload;
49
+ }
50
+ }
51
+ function safeJson(text) {
52
+ try {
53
+ return JSON.parse(text);
54
+ }
55
+ catch {
56
+ return text;
57
+ }
58
+ }
59
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAwD5C,MAAM,OAAO,kBAAkB;IACZ,OAAO,CAAS;IAChB,SAAS,CAAe;IACxB,OAAO,CAAwC;IAEhE,YAAY,OAAkC;QAC5C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC;QACxC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACjC,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,uBAAuB,CAAC,CAAC;IACtD,CAAC;IAED,eAAe;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,yBAAyB,CAAC,CAAC;IACxD,CAAC;IAED,sBAAsB,CAAC,KAAoC;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,iCAAiC,EAA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QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAClD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,OAAO,GAAG,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC;YAC3H,MAAM,IAAI,YAAY,CAAC,YAAY,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAC/F,CAAC;QACD,OAAO,OAAY,CAAC;IACtB,CAAC;CACF;AAED,SAAS,QAAQ,CAAC,IAAY;IAC5B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ export type ConnectErrorCode = "invalid_request" | "invalid_provider" | "invalid_scope" | "provider_not_found" | "unsupported_auth" | "connection_not_found" | "connection_revoked" | "secret_not_found" | "token_not_available" | "token_exchange_failed" | "oauth_state_not_found" | "oauth_state_expired" | "oauth_error" | "policy_denied" | "http_error";
2
+ export declare class ConnectError extends Error {
3
+ readonly code: ConnectErrorCode;
4
+ readonly status: number;
5
+ readonly details?: unknown;
6
+ constructor(code: ConnectErrorCode, message: string, options?: {
7
+ status?: number;
8
+ details?: unknown;
9
+ });
10
+ }
11
+ export declare function isConnectError(error: unknown): error is ConnectError;
12
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GACxB,iBAAiB,GACjB,kBAAkB,GAClB,eAAe,GACf,oBAAoB,GACpB,kBAAkB,GAClB,sBAAsB,GACtB,oBAAoB,GACpB,kBAAkB,GAClB,qBAAqB,GACrB,uBAAuB,GACvB,uBAAuB,GACvB,qBAAqB,GACrB,aAAa,GACb,eAAe,GACf,YAAY,CAAC;AAEjB,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;gBAEf,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAO;CAO1G;AA4BD,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEpE"}
package/dist/errors.js ADDED
@@ -0,0 +1,41 @@
1
+ export class ConnectError extends Error {
2
+ code;
3
+ status;
4
+ details;
5
+ constructor(code, message, options = {}) {
6
+ super(message);
7
+ this.name = "ConnectError";
8
+ this.code = code;
9
+ this.status = options.status ?? defaultStatus(code);
10
+ this.details = options.details;
11
+ }
12
+ }
13
+ function defaultStatus(code) {
14
+ switch (code) {
15
+ case "invalid_request":
16
+ case "invalid_provider":
17
+ case "invalid_scope":
18
+ case "unsupported_auth":
19
+ case "oauth_error":
20
+ return 400;
21
+ case "connection_not_found":
22
+ case "provider_not_found":
23
+ case "oauth_state_not_found":
24
+ case "secret_not_found":
25
+ return 404;
26
+ case "connection_revoked":
27
+ case "oauth_state_expired":
28
+ case "policy_denied":
29
+ return 403;
30
+ case "token_exchange_failed":
31
+ case "token_not_available":
32
+ case "http_error":
33
+ return 502;
34
+ default:
35
+ return 500;
36
+ }
37
+ }
38
+ export function isConnectError(error) {
39
+ return error instanceof ConnectError;
40
+ }
41
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAiBA,MAAM,OAAO,YAAa,SAAQ,KAAK;IAC5B,IAAI,CAAmB;IACvB,MAAM,CAAS;IACf,OAAO,CAAW;IAE3B,YAAY,IAAsB,EAAE,OAAe,EAAE,UAAkD,EAAE;QACvG,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC;QACpD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACjC,CAAC;CACF;AAED,SAAS,aAAa,CAAC,IAAsB;IAC3C,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,iBAAiB,CAAC;QACvB,KAAK,kBAAkB,CAAC;QACxB,KAAK,eAAe,CAAC;QACrB,KAAK,kBAAkB,CAAC;QACxB,KAAK,aAAa;YAChB,OAAO,GAAG,CAAC;QACb,KAAK,sBAAsB,CAAC;QAC5B,KAAK,oBAAoB,CAAC;QAC1B,KAAK,uBAAuB,CAAC;QAC7B,KAAK,kBAAkB;YACrB,OAAO,GAAG,CAAC;QACb,KAAK,oBAAoB,CAAC;QAC1B,KAAK,qBAAqB,CAAC;QAC3B,KAAK,eAAe;YAClB,OAAO,GAAG,CAAC;QACb,KAAK,uBAAuB,CAAC;QAC7B,KAAK,qBAAqB,CAAC;QAC3B,KAAK,YAAY;YACf,OAAO,GAAG,CAAC;QACb;YACE,OAAO,GAAG,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,KAAK,YAAY,YAAY,CAAC;AACvC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from "./errors.js";
2
+ export * from "./registry.js";
3
+ export * from "./scopes.js";
4
+ export * from "./types.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export * from "./errors.js";
2
+ export * from "./registry.js";
3
+ export * from "./scopes.js";
4
+ export * from "./types.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { ConnectorProviderDefinition } from "./types.js";
2
+ export interface ConnectorRegistry {
3
+ list(): ConnectorProviderDefinition[];
4
+ get(providerId: string): ConnectorProviderDefinition | undefined;
5
+ require(providerId: string): ConnectorProviderDefinition;
6
+ validateScopes(providerId: string, scopes?: readonly string[]): string[];
7
+ }
8
+ export declare function createConnectorRegistry(providers: readonly ConnectorProviderDefinition[]): ConnectorRegistry;
9
+ export declare function validateProviderId(providerId: string): void;
10
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAE9D,MAAM,WAAW,iBAAiB;IAChC,IAAI,IAAI,2BAA2B,EAAE,CAAC;IACtC,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,2BAA2B,GAAG,SAAS,CAAC;IACjE,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,2BAA2B,CAAC;IACzD,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;CAC1E;AAED,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,SAAS,2BAA2B,EAAE,GAAG,iBAAiB,CA4B5G;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAI3D"}
@@ -0,0 +1,36 @@
1
+ import { ConnectError } from "./errors.js";
2
+ import { assertAllowedScopes } from "./scopes.js";
3
+ export function createConnectorRegistry(providers) {
4
+ const byId = new Map();
5
+ for (const provider of providers) {
6
+ validateProviderId(provider.id);
7
+ if (byId.has(provider.id)) {
8
+ throw new ConnectError("invalid_provider", `Duplicate connector provider id: ${provider.id}`);
9
+ }
10
+ byId.set(provider.id, Object.freeze({ ...provider }));
11
+ }
12
+ return {
13
+ list() {
14
+ return [...byId.values()];
15
+ },
16
+ get(providerId) {
17
+ return byId.get(providerId);
18
+ },
19
+ require(providerId) {
20
+ const provider = byId.get(providerId);
21
+ if (!provider) {
22
+ throw new ConnectError("provider_not_found", `Unknown connector provider: ${providerId}`);
23
+ }
24
+ return provider;
25
+ },
26
+ validateScopes(providerId, scopes) {
27
+ return assertAllowedScopes(this.require(providerId), scopes);
28
+ },
29
+ };
30
+ }
31
+ export function validateProviderId(providerId) {
32
+ if (!/^[a-z0-9][a-z0-9_-]{1,63}$/.test(providerId)) {
33
+ throw new ConnectError("invalid_provider", `Invalid connector provider id: ${providerId}`);
34
+ }
35
+ }
36
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAUlD,MAAM,UAAU,uB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AAkC,UAAU,EAAE,CAAC,CAAC;IAC7F,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { ConnectorProviderDefinition } from "./types.js";
2
+ export declare function normalizeScopes(scopes: readonly string[] | undefined): string[];
3
+ export declare function hasScopes(grantedScopes: readonly string[], requestedScopes: readonly string[]): boolean;
4
+ export declare function assertAllowedScopes(provider: ConnectorProviderDefinition, scopes: readonly string[] | undefined): string[];
5
+ export declare function assertGrantedScopes(grantedScopes: readonly string[], requestedScopes: readonly string[]): string[];
6
+ //# sourceMappingURL=scopes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scopes.d.ts","sourceRoot":"","sources":["../src/scopes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAE9D,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,CAI/E;AAED,wBAAgB,SAAS,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,EAAE,eAAe,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAGvG;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,2BAA2B,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,CAa1H;AAED,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,EAAE,eAAe,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAUlH"}
package/dist/scopes.js ADDED
@@ -0,0 +1,36 @@
1
+ import { ConnectError } from "./errors.js";
2
+ export function normalizeScopes(scopes) {
3
+ if (!scopes?.length)
4
+ return [];
5
+ const normalized = scopes.map((scope) => scope.trim()).filter(Boolean);
6
+ return [...new Set(normalized)].sort((a, b) => a.localeCompare(b));
7
+ }
8
+ export function hasScopes(grantedScopes, requestedScopes) {
9
+ const granted = new Set(normalizeScopes(grantedScopes));
10
+ return normalizeScopes(requestedScopes).every((scope) => granted.has(scope));
11
+ }
12
+ export function assertAllowedScopes(provider, scopes) {
13
+ const normalized = normalizeScopes(scopes);
14
+ if (provider.allowCustomScopes)
15
+ return normalized;
16
+ const allowed = new Set((provider.scopes ?? []).map((scope) => scope.id));
17
+ const invalid = normalized.filter((scope) => !allowed.has(scope));
18
+ if (invalid.length > 0) {
19
+ throw new ConnectError("invalid_scope", `Provider "${provider.id}" does not allow scopes: ${invalid.join(", ")}`, {
20
+ details: { providerId: provider.id, invalidScopes: invalid },
21
+ });
22
+ }
23
+ return normalized;
24
+ }
25
+ export function assertGrantedScopes(grantedScopes, requestedScopes) {
26
+ const normalized = normalizeScopes(requestedScopes);
27
+ if (!hasScopes(grantedScopes, normalized)) {
28
+ const granted = new Set(normalizeScopes(grantedScopes));
29
+ const missing = normalized.filter((scope) => !granted.has(scope));
30
+ throw new ConnectError("invalid_scope", `Connection is missing required scopes: ${missing.join(", ")}`, {
31
+ details: { missingScopes: missing },
32
+ });
33
+ }
34
+ return normalized;
35
+ }
36
+ //# sourceMappingURL=scopes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scopes.js","sourceRoot":"","sources":["../src/scopes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,MAAM,UAAU,eAAe,CAAC,MAAqC;IACnE,IAAI,CAAC,MAAM,EAAE,MAAM;QAAE,OAAO,EAAE,CAAC;IAC/B,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvE,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AACrE,CAA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C,EAAE,CAAC;QAC1C,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC;QACxD,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QAClE,MAAM,IAAI,YAAY,CAAC,eAAe,EAAE,0CAA0C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE;YACtG,OAAO,EAAE,EAAE,aAAa,EAAE,OAAO,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,148 @@
1
+ export type ConnectorAuthType = "api_key" | "oauth2" | "mcp";
2
+ export type ConnectSubjectType = "user" | "project" | "org" | "agent" | "service";
3
+ export interface ConnectSubject {
4
+ type: ConnectSubjectType;
5
+ id: string;
6
+ }
7
+ export interface ConnectorScopeDefinition {
8
+ id: string;
9
+ label?: string;
10
+ description?: string;
11
+ required?: boolean;
12
+ dangerous?: boolean;
13
+ }
14
+ export type ConnectorActionRisk = "read" | "write" | "admin";
15
+ export interface ConnectorActionDefinition {
16
+ id: string;
17
+ label?: string;
18
+ description?: string;
19
+ scopes?: string[];
20
+ risk?: ConnectorActionRisk;
21
+ inputSchema?: unknown;
22
+ outputSchema?: unknown;
23
+ metadata?: Record<string, unknown>;
24
+ }
25
+ export interface ConnectorTriggerDefinition {
26
+ id: string;
27
+ label?: string;
28
+ description?: string;
29
+ scopes?: string[];
30
+ metadata?: Record<string, unknown>;
31
+ }
32
+ export interface ApiKeyAuthConfig {
33
+ type: "api_key";
34
+ headerName?: string;
35
+ queryParam?: string;
36
+ instructions?: string;
37
+ defaultScopes?: string[];
38
+ }
39
+ export interface OAuth2AuthConfig {
40
+ type: "oauth2";
41
+ authorizationUrl: string;
42
+ tokenUrl: string;
43
+ revokeUrl?: string;
44
+ clientId?: string;
45
+ clientSecret?: string;
46
+ defaultScopes?: string[];
47
+ supportsPkce?: boolean;
48
+ extraAuthorizeParams?: Record<string, string>;
49
+ extraTokenParams?: Record<string, string>;
50
+ }
51
+ export interface McpAuthConfig {
52
+ type: "mcp";
53
+ auth?: "none" | "bearer" | "oauth2";
54
+ defaultScopes?: string[];
55
+ }
56
+ export type ConnectorAuthConfig = ApiKeyAuthConfig | OAuth2AuthConfig | McpAuthConfig;
57
+ export interface ConnectorProviderDefinition {
58
+ id: string;
59
+ name: string;
60
+ description?: string;
61
+ auth: ConnectorAuthConfig;
62
+ scopes?: ConnectorScopeDefinition[];
63
+ actions?: ConnectorActionDefinition[];
64
+ triggers?: ConnectorTriggerDefinition[];
65
+ allowCustomScopes?: boolean;
66
+ icon?: string;
67
+ metadata?: Record<string, unknown>;
68
+ }
69
+ export type ConnectionStatus = "active" | "pending" | "revoked" | "error";
70
+ export interface ConnectionRecord {
71
+ id: string;
72
+ providerId: string;
73
+ name?: string;
74
+ projectId?: string;
75
+ orgId?: string;
76
+ owner?: ConnectSubject;
77
+ authType: ConnectorAuthType;
78
+ status: ConnectionStatus;
79
+ grantedScopes: string[];
80
+ secretRef?: string;
81
+ tokenExpiresAt?: string;
82
+ createdAt: string;
83
+ updatedAt: string;
84
+ metadata?: Record<string, unknown>;
85
+ }
86
+ export interface OAuthStateRecord {
87
+ state: string;
88
+ providerId: string;
89
+ subject?: ConnectSubject;
90
+ requestedScopes: string[];
91
+ redirectUri: string;
92
+ codeVerifier?: string;
93
+ codeChallenge?: string;
94
+ projectId?: string;
95
+ orgId?: string;
96
+ connectionName?: string;
97
+ expiresAt: string;
98
+ createdAt: string;
99
+ metadata?: Record<string, unknown>;
100
+ }
101
+ export interface TokenSet {
102
+ accessToken: string;
103
+ refreshToken?: string;
104
+ tokenType?: string;
105
+ expiresAt?: string;
106
+ scopes?: string[];
107
+ raw?: unknown;
108
+ }
109
+ export interface RuntimeToken {
110
+ accessToken: string;
111
+ tokenType: string;
112
+ expiresAt?: string;
113
+ scopes: string[];
114
+ connectionId: string;
115
+ providerId: string;
116
+ }
117
+ export interface StoredConnectionSecret {
118
+ kind: "api_key" | "oauth2" | "mcp";
119
+ apiKey?: string;
120
+ tokens?: TokenSet;
121
+ metadata?: Record<string, unknown>;
122
+ }
123
+ export interface ConnectionListFilter {
124
+ providerId?: string;
125
+ projectId?: string;
126
+ orgId?: string;
127
+ owner?: ConnectSubject;
128
+ status?: ConnectionStatus;
129
+ }
130
+ export interface ConnectStore {
131
+ listConnections(filter?: ConnectionListFilter): Promise<ConnectionRecord[]>;
132
+ getConnection(id: string): Promise<ConnectionRecord | null>;
133
+ upsertConnection(record: ConnectionRecord): Promise<ConnectionRecord>;
134
+ updateConnection(id: string, patch: Partial<Omit<ConnectionRecord, "id" | "createdAt">>): Promise<ConnectionRecord>;
135
+ deleteConnection(id: string): Promise<void>;
136
+ saveOAuthState(record: OAuthStateRecord): Promise<void>;
137
+ consumeOAuthState(state: string): Promise<OAuthStateRecord | null>;
138
+ }
139
+ export interface ConnectPolicyDecisionInput {
140
+ connection: ConnectionRecord;
141
+ subject?: ConnectSubject;
142
+ scopes: string[];
143
+ actionId?: string;
144
+ }
145
+ export interface ConnectPolicy {
146
+ canUseConnection(input: ConnectPolicyDecisionInput): Promise<boolean> | boolean;
147
+ }
148
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE7D,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,CAAC;AAElF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,kBAAkB,CAAC;IACzB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CA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AAgB,CAAC;IAC7B,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,gBAAgB,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;CACjF"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@polpo-ai/connect",
3
+ "version": "0.15.4",
4
+ "description": "Polpo Connect contracts and client SDK for OAuth, API-key, and MCP connections",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./client": {
14
+ "types": "./dist/client/index.d.ts",
15
+ "import": "./dist/client/index.js"
16
+ }
17
+ },
18
+ "sideEffects": false,
19
+ "files": [
20
+ "dist",
21
+ "README.md"
22
+ ],
23
+ "license": "Apache-2.0",
24
+ "keywords": [
25
+ "polpo",
26
+ "agents",
27
+ "oauth",
28
+ "connections",
29
+ "connectors",
30
+ "mcp"
31
+ ],
32
+ "author": "OpenPolpo Contributors",
33
+ "engines": {
34
+ "node": ">=18.0.0"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "https://github.com/lumea-labs/polpo.git",
42
+ "directory": "packages/connect"
43
+ },
44
+ "homepage": "https://github.com/lumea-labs/polpo/tree/main/packages/connect",
45
+ "bugs": {
46
+ "url": "https://github.com/lumea-labs/polpo/issues"
47
+ },
48
+ "devDependencies": {
49
+ "typescript": "^5.7.3",
50
+ "vitest": "^3.0.4"
51
+ },
52
+ "scripts": {
53
+ "build": "tsc",
54
+ "dev": "tsc --watch",
55
+ "test": "vitest run"
56
+ }
57
+ }