@opengeni/capabilities 0.1.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/LICENSE +190 -0
- package/README.md +23 -0
- package/THIRD_PARTY_NOTICES +28 -0
- package/dist/auth.d.ts +3 -0
- package/dist/graphql.d.ts +52 -0
- package/dist/http.d.ts +15 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +1944 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-manifest.d.ts +25 -0
- package/dist/openapi.d.ts +69 -0
- package/dist/providers.d.ts +44 -0
- package/dist/revision.d.ts +4 -0
- package/dist/types.d.ts +94 -0
- package/package.json +46 -0
- package/src/auth.ts +171 -0
- package/src/graphql.ts +625 -0
- package/src/http.ts +131 -0
- package/src/index.ts +8 -0
- package/src/mcp-manifest.ts +90 -0
- package/src/openapi.ts +846 -0
- package/src/providers.ts +559 -0
- package/src/revision.ts +40 -0
- package/src/types.ts +126 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { FetchLike, OutboundNetworkSettings } from "@opengeni/network";
|
|
2
|
+
|
|
3
|
+
export type IntegrationProtocol = "mcp" | "openapi" | "graphql";
|
|
4
|
+
export type IntegrationToolSafety = "read" | "write" | "destructive";
|
|
5
|
+
export type IntegrationApprovalMode = "never" | "ask";
|
|
6
|
+
|
|
7
|
+
export type JsonSchema = Readonly<Record<string, unknown>>;
|
|
8
|
+
|
|
9
|
+
export interface IntegrationToolDefinition {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly operationKey: string;
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly description: string;
|
|
14
|
+
readonly inputSchema: JsonSchema;
|
|
15
|
+
readonly outputSchema?: JsonSchema;
|
|
16
|
+
readonly safety: IntegrationToolSafety;
|
|
17
|
+
readonly approvalMode: IntegrationApprovalMode;
|
|
18
|
+
readonly deprecated: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type CredentialCarrier = "header" | "query" | "cookie";
|
|
22
|
+
|
|
23
|
+
export interface IntegrationCredentialPlacement {
|
|
24
|
+
readonly carrier: CredentialCarrier;
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly value: string;
|
|
27
|
+
readonly prefix?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface IntegrationCredentialAudience {
|
|
31
|
+
/** Exact normalized origin the credential may reach. */
|
|
32
|
+
readonly origin: string;
|
|
33
|
+
/** Optional normalized path prefix. Defaults to `/`. */
|
|
34
|
+
readonly pathPrefix?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface ResolvedIntegrationCredential {
|
|
38
|
+
readonly audience: IntegrationCredentialAudience;
|
|
39
|
+
readonly placements: readonly IntegrationCredentialPlacement[];
|
|
40
|
+
readonly expiresAt?: string;
|
|
41
|
+
readonly scope?: readonly string[];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface IntegrationInvocationAuthority {
|
|
45
|
+
readonly accountId: string;
|
|
46
|
+
readonly workspaceId: string;
|
|
47
|
+
readonly sessionId?: string;
|
|
48
|
+
readonly rootSessionId?: string;
|
|
49
|
+
readonly turnId?: string;
|
|
50
|
+
readonly attemptId?: string;
|
|
51
|
+
readonly initiatingSubjectId?: string;
|
|
52
|
+
readonly connectionRef?: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface ResolveIntegrationCredentialRequest extends IntegrationInvocationAuthority {
|
|
56
|
+
readonly protocol: Exclude<IntegrationProtocol, "mcp">;
|
|
57
|
+
readonly integrationId: string;
|
|
58
|
+
readonly revisionId: string;
|
|
59
|
+
readonly operationKey: string;
|
|
60
|
+
readonly destinationUrl: string;
|
|
61
|
+
readonly requiredScopeAlternatives?: readonly (readonly string[])[];
|
|
62
|
+
/** Refresh the exact bound Connection for a safe retry or a later call. */
|
|
63
|
+
readonly forceRefresh?: boolean;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface IntegrationCredentialResolver {
|
|
67
|
+
resolve(
|
|
68
|
+
request: ResolveIntegrationCredentialRequest,
|
|
69
|
+
): Promise<ResolvedIntegrationCredential | null>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface IntegrationTransport {
|
|
73
|
+
readonly fetch: FetchLike;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface PinnedIntegrationTransportOptions {
|
|
77
|
+
readonly network: OutboundNetworkSettings;
|
|
78
|
+
readonly fetchImpl?: FetchLike;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export type IntegrationRevisionSource = {
|
|
82
|
+
readonly url?: string;
|
|
83
|
+
readonly provider?: string;
|
|
84
|
+
readonly fetchedAt?: string;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export interface IntegrationRevision<
|
|
88
|
+
TBinding = unknown,
|
|
89
|
+
TProtocol extends Exclude<IntegrationProtocol, "mcp"> = Exclude<IntegrationProtocol, "mcp">,
|
|
90
|
+
> {
|
|
91
|
+
readonly id: string;
|
|
92
|
+
readonly protocol: TProtocol;
|
|
93
|
+
readonly integrationId: string;
|
|
94
|
+
readonly contentSha256: string;
|
|
95
|
+
readonly source: IntegrationRevisionSource;
|
|
96
|
+
readonly title: string;
|
|
97
|
+
readonly description?: string;
|
|
98
|
+
readonly version?: string;
|
|
99
|
+
readonly tools: readonly IntegrationToolDefinition[];
|
|
100
|
+
readonly bindings: Readonly<Record<string, TBinding>>;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export type InvocationOutcome = "not_started" | "unknown" | "failed";
|
|
104
|
+
|
|
105
|
+
export class IntegrationProtocolError extends Error {
|
|
106
|
+
constructor(
|
|
107
|
+
readonly code: string,
|
|
108
|
+
message: string,
|
|
109
|
+
) {
|
|
110
|
+
super(message);
|
|
111
|
+
this.name = "IntegrationProtocolError";
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export class IntegrationInvocationError extends Error {
|
|
116
|
+
constructor(
|
|
117
|
+
readonly code: string,
|
|
118
|
+
message: string,
|
|
119
|
+
readonly outcome: InvocationOutcome,
|
|
120
|
+
readonly retryable: boolean,
|
|
121
|
+
readonly status?: number,
|
|
122
|
+
) {
|
|
123
|
+
super(message);
|
|
124
|
+
this.name = "IntegrationInvocationError";
|
|
125
|
+
}
|
|
126
|
+
}
|