@redplanethq/sdk 0.1.16 → 1.2.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/CHANGELOG.md +1657 -0
- package/LICENSE.md +30 -0
- package/README.md +159 -183
- package/dist/__tests__/__fixtures__/network.stream.d.ts +2329 -0
- package/dist/__tests__/__fixtures__/network.stream.d.ts.map +1 -0
- package/dist/_types/@ai-sdk_provider/dist/index.d.ts +1725 -0
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +10332 -0
- package/dist/_types/@internal_ai-v6/dist/index.d.ts +13493 -0
- package/dist/chat-route.d.ts +117 -0
- package/dist/chat-route.d.ts.map +1 -0
- package/dist/chunk-3YJ25IUJ.js +79 -0
- package/dist/chunk-3YJ25IUJ.js.map +1 -0
- package/dist/chunk-DGUM43GV.js +10 -0
- package/dist/chunk-DGUM43GV.js.map +1 -0
- package/dist/chunk-HDI4ZP7N.js +79 -0
- package/dist/chunk-HDI4ZP7N.js.map +1 -0
- package/dist/chunk-HMOX24BQ.js +439 -0
- package/dist/chunk-HMOX24BQ.js.map +1 -0
- package/dist/chunk-IV3RKEE4.js +439 -0
- package/dist/chunk-IV3RKEE4.js.map +1 -0
- package/dist/chunk-JEQ2X3Z6.cjs +12 -0
- package/dist/chunk-JEQ2X3Z6.cjs.map +1 -0
- package/dist/chunk-PEZAMDZJ.cjs +84 -0
- package/dist/chunk-PEZAMDZJ.cjs.map +1 -0
- package/dist/chunk-VJW66KXQ.cjs +441 -0
- package/dist/chunk-VJW66KXQ.cjs.map +1 -0
- package/dist/chunk-WFARZCDO.cjs +84 -0
- package/dist/chunk-WFARZCDO.cjs.map +1 -0
- package/dist/chunk-X72VW7EY.cjs +441 -0
- package/dist/chunk-X72VW7EY.cjs.map +1 -0
- package/dist/convert-messages.d.ts +90 -0
- package/dist/convert-messages.d.ts.map +1 -0
- package/dist/convert-streams.d.ts +59 -0
- package/dist/convert-streams.d.ts.map +1 -0
- package/dist/helpers.d.ts +59 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/index.cjs +14385 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +14 -1243
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14289 -804
- package/dist/index.js.map +1 -1
- package/dist/middleware.d.ts +159 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/network-route.d.ts +84 -0
- package/dist/network-route.d.ts.map +1 -0
- package/dist/public-types.d.ts +9 -0
- package/dist/public-types.d.ts.map +1 -0
- package/dist/to-ai-sdk-format.d.ts +16 -0
- package/dist/to-ai-sdk-format.d.ts.map +1 -0
- package/dist/token-APYSY3BW-CBIBV5F2.js +61 -0
- package/dist/token-APYSY3BW-CBIBV5F2.js.map +1 -0
- package/dist/token-APYSY3BW-INR55PKP.js +61 -0
- package/dist/token-APYSY3BW-INR55PKP.js.map +1 -0
- package/dist/token-APYSY3BW-M2K6HVOG.cjs +63 -0
- package/dist/token-APYSY3BW-M2K6HVOG.cjs.map +1 -0
- package/dist/token-APYSY3BW-Y5VD4L7Z.cjs +63 -0
- package/dist/token-APYSY3BW-Y5VD4L7Z.cjs.map +1 -0
- package/dist/token-util-RMHT2CPJ-3LCBPXJ6.cjs +10 -0
- package/dist/token-util-RMHT2CPJ-3LCBPXJ6.cjs.map +1 -0
- package/dist/token-util-RMHT2CPJ-4YTBAZ23.cjs +10 -0
- package/dist/token-util-RMHT2CPJ-4YTBAZ23.cjs.map +1 -0
- package/dist/token-util-RMHT2CPJ-HCMQIDTV.js +8 -0
- package/dist/token-util-RMHT2CPJ-HCMQIDTV.js.map +1 -0
- package/dist/token-util-RMHT2CPJ-IOKQM5O3.js +8 -0
- package/dist/token-util-RMHT2CPJ-IOKQM5O3.js.map +1 -0
- package/dist/transformers.d.ts +315 -0
- package/dist/transformers.d.ts.map +1 -0
- package/dist/ui.cjs +15 -0
- package/dist/ui.cjs.map +1 -0
- package/dist/ui.d.ts +2 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +12 -0
- package/dist/ui.js.map +1 -0
- package/dist/utils.d.ts +11 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/workflow-route.d.ts +93 -0
- package/dist/workflow-route.d.ts.map +1 -0
- package/package.json +65 -31
- package/ui.d.ts +1 -0
- package/LICENSE +0 -44
- package/dist/index.d.mts +0 -1243
- package/dist/index.mjs +0 -822
- package/dist/index.mjs.map +0 -1
package/dist/index.mjs
DELETED
|
@@ -1,822 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { randomUUID } from 'crypto';
|
|
4
|
-
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
|
|
8
|
-
// ../types/dist/llm/llm.entity.js
|
|
9
|
-
var LLMModelEnum;
|
|
10
|
-
(function(LLMModelEnum2) {
|
|
11
|
-
LLMModelEnum2["GPT35TURBO"] = "GPT35TURBO";
|
|
12
|
-
LLMModelEnum2["GPT4TURBO"] = "GPT4TURBO";
|
|
13
|
-
LLMModelEnum2["GPT4O"] = "GPT4O";
|
|
14
|
-
LLMModelEnum2["GPT41"] = "GPT41";
|
|
15
|
-
LLMModelEnum2["GPT41MINI"] = "GPT41MINI";
|
|
16
|
-
LLMModelEnum2["GPT41NANO"] = "GPT41NANO";
|
|
17
|
-
LLMModelEnum2["LLAMA3"] = "LLAMA3";
|
|
18
|
-
LLMModelEnum2["CLAUDEOPUS"] = "CLAUDEOPUS";
|
|
19
|
-
LLMModelEnum2["CLAUDESONNET"] = "CLAUDESONNET";
|
|
20
|
-
LLMModelEnum2["CLAUDEHAIKU"] = "CLAUDEHAIKU";
|
|
21
|
-
LLMModelEnum2["GEMINI25FLASH"] = "GEMINI25FLASH";
|
|
22
|
-
LLMModelEnum2["GEMINI25PRO"] = "GEMINI25PRO";
|
|
23
|
-
LLMModelEnum2["GEMINI20FLASH"] = "GEMINI20FLASH";
|
|
24
|
-
LLMModelEnum2["GEMINI20FLASHLITE"] = "GEMINI20FLASHLITE";
|
|
25
|
-
})(LLMModelEnum || (LLMModelEnum = {}));
|
|
26
|
-
var LLMModelType = {
|
|
27
|
-
GPT35TURBO: "GPT35TURBO",
|
|
28
|
-
GPT4TURBO: "GPT4TURBO",
|
|
29
|
-
GPT4O: "GPT4O",
|
|
30
|
-
GPT41: "GPT41",
|
|
31
|
-
GPT41MINI: "GPT41MINI",
|
|
32
|
-
GPT41NANO: "GPT41NANO",
|
|
33
|
-
LLAMA3: "LLAMA3",
|
|
34
|
-
CLAUDEOPUS: "CLAUDEOPUS",
|
|
35
|
-
CLAUDESONNET: "CLAUDESONNET",
|
|
36
|
-
CLAUDEHAIKU: "CLAUDEHAIKU",
|
|
37
|
-
GEMINI25FLASH: "GEMINI25FLASH",
|
|
38
|
-
GEMINI25PRO: "GEMINI25PRO",
|
|
39
|
-
GEMINI20FLASH: "GEMINI20FLASH",
|
|
40
|
-
GEMINI20FLASHLITE: "GEMINI20FLASHLITE"
|
|
41
|
-
};
|
|
42
|
-
var LLMMappings;
|
|
43
|
-
(function(LLMMappings2) {
|
|
44
|
-
LLMMappings2["GPT35TURBO"] = "gpt-3.5-turbo";
|
|
45
|
-
LLMMappings2["GPT4TURBO"] = "gpt-4-turbo";
|
|
46
|
-
LLMMappings2["GPT4O"] = "gpt-4o";
|
|
47
|
-
LLMMappings2["GPT41"] = "gpt-4.1-2025-04-14";
|
|
48
|
-
LLMMappings2["GPT41MINI"] = "gpt-4.1-mini-2025-04-14";
|
|
49
|
-
LLMMappings2["GPT41NANO"] = "gpt-4.1-nano-2025-04-14";
|
|
50
|
-
LLMMappings2["LLAMA3"] = "llama3";
|
|
51
|
-
LLMMappings2["CLAUDEOPUS"] = "claude-3-opus-20240229";
|
|
52
|
-
LLMMappings2["CLAUDESONNET"] = "claude-3-7-sonnet-20250219";
|
|
53
|
-
LLMMappings2["CLAUDEHAIKU"] = "claude-3-5-haiku-20241022";
|
|
54
|
-
LLMMappings2["GEMINI25FLASH"] = "gemini-2.5-flash-preview-04-17";
|
|
55
|
-
LLMMappings2["GEMINI25PRO"] = "gemini-2.5-pro-preview-03-25";
|
|
56
|
-
LLMMappings2["GEMINI20FLASH"] = "gemini-2.0-flash";
|
|
57
|
-
LLMMappings2["GEMINI20FLASHLITE"] = "gemini-2.0-flash-lite";
|
|
58
|
-
})(LLMMappings || (LLMMappings = {}));
|
|
59
|
-
var OpenAIModels = [
|
|
60
|
-
LLMModelEnum.GPT35TURBO,
|
|
61
|
-
LLMModelEnum.GPT4TURBO,
|
|
62
|
-
LLMModelEnum.GPT4O,
|
|
63
|
-
LLMModelEnum.GPT41,
|
|
64
|
-
LLMModelEnum.GPT41MINI,
|
|
65
|
-
LLMModelEnum.GPT41NANO
|
|
66
|
-
];
|
|
67
|
-
var ClaudeModels = [
|
|
68
|
-
LLMModelEnum.CLAUDEOPUS,
|
|
69
|
-
LLMModelEnum.CLAUDESONNET,
|
|
70
|
-
LLMModelEnum.CLAUDEHAIKU
|
|
71
|
-
];
|
|
72
|
-
var GeminiModels = [
|
|
73
|
-
LLMModelEnum.GEMINI25FLASH,
|
|
74
|
-
LLMModelEnum.GEMINI25PRO,
|
|
75
|
-
LLMModelEnum.GEMINI20FLASH,
|
|
76
|
-
LLMModelEnum.GEMINI20FLASHLITE
|
|
77
|
-
];
|
|
78
|
-
|
|
79
|
-
// ../types/dist/graph/graph.entity.js
|
|
80
|
-
var EPISODIC_NODE_PROPERTIES = `{
|
|
81
|
-
uuid: e.uuid,
|
|
82
|
-
content: e.content,
|
|
83
|
-
originalContent: e.originalContent,
|
|
84
|
-
source: e.source,
|
|
85
|
-
metadata: e.metadata,
|
|
86
|
-
createdAt: e.createdAt,
|
|
87
|
-
userId: e.userId,
|
|
88
|
-
workspaceId: e.workspaceId,
|
|
89
|
-
sessionId: e.sessionId,
|
|
90
|
-
queueId: e.queueId,
|
|
91
|
-
labelIds: e.labelIds,
|
|
92
|
-
validAt: e.validAt,
|
|
93
|
-
recallCount: e.recallCount,
|
|
94
|
-
type: e.type,
|
|
95
|
-
chunkIndex: e.chunkIndex,
|
|
96
|
-
totalChunks: e.totalChunks,
|
|
97
|
-
version: e.version,
|
|
98
|
-
contentHash: e.contentHash,
|
|
99
|
-
previousVersionSessionId: e.previousVersionSessionId,
|
|
100
|
-
chunkHashes: e.chunkHashes
|
|
101
|
-
}`;
|
|
102
|
-
var STATEMENT_NODE_PROPERTIES = `{
|
|
103
|
-
uuid: s.uuid,
|
|
104
|
-
fact: s.fact,
|
|
105
|
-
createdAt: s.createdAt,
|
|
106
|
-
userId: s.userId,
|
|
107
|
-
workspaceId: s.workspaceId,
|
|
108
|
-
validAt: s.validAt,
|
|
109
|
-
invalidAt: s.invalidAt,
|
|
110
|
-
invalidatedBy: s.invalidatedBy,
|
|
111
|
-
attributes: s.attributes,
|
|
112
|
-
aspect: s.aspect,
|
|
113
|
-
recallCount: s.recallCount,
|
|
114
|
-
provenanceCount: s.provenanceCount
|
|
115
|
-
}`;
|
|
116
|
-
var ENTITY_NODE_PROPERTIES = `{
|
|
117
|
-
uuid: ent.uuid,
|
|
118
|
-
name: ent.name,
|
|
119
|
-
type: ent.type,
|
|
120
|
-
createdAt: ent.createdAt,
|
|
121
|
-
userId: ent.userId,
|
|
122
|
-
workspaceId: ent.workspaceId,
|
|
123
|
-
attributes: ent.attributes
|
|
124
|
-
}`;
|
|
125
|
-
var COMPACTED_SESSION_NODE_PROPERTIES = `{
|
|
126
|
-
uuid: cs.uuid,
|
|
127
|
-
sessionId: cs.sessionId,
|
|
128
|
-
summary: cs.summary,
|
|
129
|
-
episodeCount: cs.episodeCount,
|
|
130
|
-
startTime: cs.startTime,
|
|
131
|
-
endTime: cs.endTime,
|
|
132
|
-
createdAt: cs.createdAt,
|
|
133
|
-
updatedAt: cs.updatedAt,
|
|
134
|
-
confidence: cs.confidence,
|
|
135
|
-
userId: cs.userId,
|
|
136
|
-
workspaceId: cs.workspaceId,
|
|
137
|
-
source: cs.source,
|
|
138
|
-
compressionRatio: cs.compressionRatio,
|
|
139
|
-
metadata: cs.metadata
|
|
140
|
-
}`;
|
|
141
|
-
var EntityTypes = [
|
|
142
|
-
"Person",
|
|
143
|
-
"Organization",
|
|
144
|
-
"Place",
|
|
145
|
-
"Event",
|
|
146
|
-
"Project",
|
|
147
|
-
"Task",
|
|
148
|
-
"Technology",
|
|
149
|
-
"Product",
|
|
150
|
-
"Standard",
|
|
151
|
-
"Concept",
|
|
152
|
-
"Predicate"
|
|
153
|
-
];
|
|
154
|
-
var StatementAspects = [
|
|
155
|
-
"Identity",
|
|
156
|
-
"Knowledge",
|
|
157
|
-
"Belief",
|
|
158
|
-
"Preference",
|
|
159
|
-
"Habit",
|
|
160
|
-
"Goal",
|
|
161
|
-
"Task",
|
|
162
|
-
"Directive",
|
|
163
|
-
"Decision",
|
|
164
|
-
"Event",
|
|
165
|
-
"Problem",
|
|
166
|
-
"Relationship"
|
|
167
|
-
];
|
|
168
|
-
var VOICE_ASPECTS = [
|
|
169
|
-
"Directive",
|
|
170
|
-
"Preference",
|
|
171
|
-
"Habit",
|
|
172
|
-
"Belief",
|
|
173
|
-
"Goal",
|
|
174
|
-
"Task"
|
|
175
|
-
];
|
|
176
|
-
var GRAPH_ASPECTS = [
|
|
177
|
-
"Identity",
|
|
178
|
-
"Event",
|
|
179
|
-
"Relationship",
|
|
180
|
-
"Decision",
|
|
181
|
-
"Knowledge",
|
|
182
|
-
"Problem",
|
|
183
|
-
"Task"
|
|
184
|
-
];
|
|
185
|
-
var EpisodeTypeEnum;
|
|
186
|
-
(function(EpisodeTypeEnum2) {
|
|
187
|
-
EpisodeTypeEnum2["CONVERSATION"] = "CONVERSATION";
|
|
188
|
-
EpisodeTypeEnum2["DOCUMENT"] = "DOCUMENT";
|
|
189
|
-
})(EpisodeTypeEnum || (EpisodeTypeEnum = {}));
|
|
190
|
-
var EpisodeType = {
|
|
191
|
-
CONVERSATION: "CONVERSATION",
|
|
192
|
-
DOCUMENT: "DOCUMENT",
|
|
193
|
-
IMAGE: "IMAGE"
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
// ../types/dist/conversation-execution-step/conversation-execution.entity.js
|
|
197
|
-
var ActionStatusEnum;
|
|
198
|
-
(function(ActionStatusEnum2) {
|
|
199
|
-
ActionStatusEnum2["ACCEPT"] = "ACCEPT";
|
|
200
|
-
ActionStatusEnum2["DECLINE"] = "DECLINE";
|
|
201
|
-
ActionStatusEnum2["QUESTION"] = "QUESTION";
|
|
202
|
-
ActionStatusEnum2["TOOL_REQUEST"] = "TOOL_REQUEST";
|
|
203
|
-
ActionStatusEnum2["SUCCESS"] = "SUCCESS";
|
|
204
|
-
ActionStatusEnum2["FAILED"] = "FAILED";
|
|
205
|
-
})(ActionStatusEnum || (ActionStatusEnum = {}));
|
|
206
|
-
var ActionStatus = {
|
|
207
|
-
ACCEPT: "ACCEPT",
|
|
208
|
-
DECLINE: "DECLINE",
|
|
209
|
-
QUESTION: "QUESTION",
|
|
210
|
-
TOOL_REQUEST: "TOOL_REQUEST",
|
|
211
|
-
SUCCESS: "SUCCESS",
|
|
212
|
-
FAILED: "FAILED"
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
// ../types/dist/oauth/params.js
|
|
216
|
-
var OAuth2Params = class {
|
|
217
|
-
static {
|
|
218
|
-
__name(this, "OAuth2Params");
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
// ../types/dist/integration.js
|
|
223
|
-
var IntegrationEventType;
|
|
224
|
-
(function(IntegrationEventType2) {
|
|
225
|
-
IntegrationEventType2["SETUP"] = "setup";
|
|
226
|
-
IntegrationEventType2["PROCESS"] = "process";
|
|
227
|
-
IntegrationEventType2["IDENTIFY"] = "identify";
|
|
228
|
-
IntegrationEventType2["SYNC"] = "sync";
|
|
229
|
-
IntegrationEventType2["SPEC"] = "spec";
|
|
230
|
-
IntegrationEventType2["GET_TOOLS"] = "get-tools";
|
|
231
|
-
IntegrationEventType2["CALL_TOOL"] = "call-tool";
|
|
232
|
-
})(IntegrationEventType || (IntegrationEventType = {}));
|
|
233
|
-
var Spec = class {
|
|
234
|
-
static {
|
|
235
|
-
__name(this, "Spec");
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
// ../types/dist/user/index.js
|
|
240
|
-
var UserTypeEnum;
|
|
241
|
-
(function(UserTypeEnum2) {
|
|
242
|
-
UserTypeEnum2["Agent"] = "Agent";
|
|
243
|
-
UserTypeEnum2["User"] = "User";
|
|
244
|
-
UserTypeEnum2["System"] = "System";
|
|
245
|
-
})(UserTypeEnum || (UserTypeEnum = {}));
|
|
246
|
-
|
|
247
|
-
// ../types/dist/pattern.js
|
|
248
|
-
var EXPLICIT_PATTERN_TYPES = {
|
|
249
|
-
// Derived from space themes and explicit content
|
|
250
|
-
THEME: "theme",
|
|
251
|
-
TOPIC: "topic",
|
|
252
|
-
DOMAIN: "domain",
|
|
253
|
-
INTEREST_AREA: "interest_area"
|
|
254
|
-
};
|
|
255
|
-
var IMPLICIT_PATTERN_TYPES = {
|
|
256
|
-
// Discovered from behavioral analysis and content patterns
|
|
257
|
-
PREFERENCE: "preference",
|
|
258
|
-
HABIT: "habit",
|
|
259
|
-
WORKFLOW: "workflow",
|
|
260
|
-
COMMUNICATION_STYLE: "communication_style",
|
|
261
|
-
DECISION_PATTERN: "decision_pattern",
|
|
262
|
-
TEMPORAL_PATTERN: "temporal_pattern",
|
|
263
|
-
BEHAVIORAL_PATTERN: "behavioral_pattern",
|
|
264
|
-
LEARNING_STYLE: "learning_style",
|
|
265
|
-
COLLABORATION_STYLE: "collaboration_style"
|
|
266
|
-
};
|
|
267
|
-
var PATTERN_TYPES = Object.assign(Object.assign({}, EXPLICIT_PATTERN_TYPES), IMPLICIT_PATTERN_TYPES);
|
|
268
|
-
|
|
269
|
-
// ../types/dist/search.js
|
|
270
|
-
var QUALITY_THRESHOLDS = {
|
|
271
|
-
// Adaptive episode-level scoring (based on available sources)
|
|
272
|
-
HIGH_QUALITY_EPISODE: 5,
|
|
273
|
-
MEDIUM_QUALITY_EPISODE: 1,
|
|
274
|
-
LOW_QUALITY_EPISODE: 0.3,
|
|
275
|
-
// Overall result confidence
|
|
276
|
-
CONFIDENT_RESULT: 0.7,
|
|
277
|
-
UNCERTAIN_RESULT: 0.3,
|
|
278
|
-
NO_RESULT: 0.3,
|
|
279
|
-
// Score gap detection
|
|
280
|
-
MINIMUM_GAP_RATIO: 0.5
|
|
281
|
-
};
|
|
282
|
-
var IntegrationCLI = class {
|
|
283
|
-
static {
|
|
284
|
-
__name(this, "IntegrationCLI");
|
|
285
|
-
}
|
|
286
|
-
program;
|
|
287
|
-
integrationName;
|
|
288
|
-
version;
|
|
289
|
-
constructor(integrationName, version = "1.0.0") {
|
|
290
|
-
this.integrationName = integrationName;
|
|
291
|
-
this.version = version;
|
|
292
|
-
this.program = new Command();
|
|
293
|
-
this.setupProgram();
|
|
294
|
-
}
|
|
295
|
-
setupProgram() {
|
|
296
|
-
this.program.name(`${this.integrationName}-integration`).description(`${this.integrationName} integration CLI`).version(this.version);
|
|
297
|
-
this.setupSpecCommand();
|
|
298
|
-
this.setupAccountCommands();
|
|
299
|
-
this.setupDataCommands();
|
|
300
|
-
this.setupSyncCommand();
|
|
301
|
-
this.setupGetToolsCommand();
|
|
302
|
-
this.setupCallToolCommand();
|
|
303
|
-
}
|
|
304
|
-
setupAccountCommands() {
|
|
305
|
-
this.program.command("setup").description(`Set up a new ${this.integrationName} integration account`).requiredOption("--event-body <body>", "Event body JSON (e.g. OAuth response or setup data)").requiredOption("--integration-definition <definition>", "Integration definition JSON").action(async (options) => {
|
|
306
|
-
try {
|
|
307
|
-
const eventBody = JSON.parse(options.eventBody);
|
|
308
|
-
const integrationDefinition = JSON.parse(options.integrationDefinition);
|
|
309
|
-
const messages = await this.handleEvent({
|
|
310
|
-
event: IntegrationEventType.SETUP,
|
|
311
|
-
eventBody,
|
|
312
|
-
integrationDefinition
|
|
313
|
-
});
|
|
314
|
-
for (const message of messages) {
|
|
315
|
-
console.log(JSON.stringify(message));
|
|
316
|
-
}
|
|
317
|
-
} catch (error) {
|
|
318
|
-
console.error("Error during setup:", error);
|
|
319
|
-
process.exit(1);
|
|
320
|
-
}
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
setupDataCommands() {
|
|
324
|
-
this.program.command("process").description(`Process ${this.integrationName} integration data`).requiredOption("--event-data <data>", "Event data JSON").requiredOption("--config <config>", "Integration configuration JSON").action(async (options) => {
|
|
325
|
-
try {
|
|
326
|
-
const eventData = JSON.parse(options.eventData);
|
|
327
|
-
const config = JSON.parse(options.config);
|
|
328
|
-
const messages = await this.handleEvent({
|
|
329
|
-
event: IntegrationEventType.PROCESS,
|
|
330
|
-
eventBody: eventData,
|
|
331
|
-
config
|
|
332
|
-
});
|
|
333
|
-
for (const message of messages) {
|
|
334
|
-
console.log(JSON.stringify(message));
|
|
335
|
-
}
|
|
336
|
-
} catch (error) {
|
|
337
|
-
console.error("Error processing data:", error);
|
|
338
|
-
process.exit(1);
|
|
339
|
-
}
|
|
340
|
-
});
|
|
341
|
-
this.program.command("identify").description("Identify webhook account").requiredOption("--webhook-data <data>", "Webhook data JSON").requiredOption("--integration-definition <definition>", "Integration definition JSON").action(async (options) => {
|
|
342
|
-
try {
|
|
343
|
-
const webhookData = JSON.parse(options.webhookData);
|
|
344
|
-
const integrationDefinition = JSON.parse(options.integrationDefinition);
|
|
345
|
-
const messages = await this.handleEvent({
|
|
346
|
-
event: IntegrationEventType.IDENTIFY,
|
|
347
|
-
eventBody: webhookData,
|
|
348
|
-
integrationDefinition
|
|
349
|
-
});
|
|
350
|
-
for (const message of messages) {
|
|
351
|
-
console.log(JSON.stringify(message));
|
|
352
|
-
}
|
|
353
|
-
} catch (error) {
|
|
354
|
-
console.error("Error identifying account:", error);
|
|
355
|
-
process.exit(1);
|
|
356
|
-
}
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
setupSpecCommand() {
|
|
360
|
-
this.program.command("spec").description("Get integration specification").action(async () => {
|
|
361
|
-
try {
|
|
362
|
-
const spec = await this.getSpec();
|
|
363
|
-
const message = {
|
|
364
|
-
type: "spec",
|
|
365
|
-
data: spec
|
|
366
|
-
};
|
|
367
|
-
console.log(JSON.stringify(message));
|
|
368
|
-
} catch (error) {
|
|
369
|
-
console.error("Error getting spec:", error);
|
|
370
|
-
process.exit(1);
|
|
371
|
-
}
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
setupSyncCommand() {
|
|
375
|
-
this.program.command("sync").description("Perform scheduled sync").requiredOption("--config <config>", "Integration configuration JSON").requiredOption("--integration-definition <definition>", "Integration definition JSON").option("--state <state>", "Integration state JSON", "{}").action(async (options) => {
|
|
376
|
-
try {
|
|
377
|
-
const config = JSON.parse(options.config);
|
|
378
|
-
const integrationDefinition = JSON.parse(options.integrationDefinition);
|
|
379
|
-
const state = options.state ? JSON.parse(options.state) : {};
|
|
380
|
-
const messages = await this.handleEvent({
|
|
381
|
-
event: IntegrationEventType.SYNC,
|
|
382
|
-
eventBody: {},
|
|
383
|
-
config,
|
|
384
|
-
state,
|
|
385
|
-
integrationDefinition
|
|
386
|
-
});
|
|
387
|
-
for (const message of messages) {
|
|
388
|
-
console.log(JSON.stringify(message));
|
|
389
|
-
}
|
|
390
|
-
} catch (error) {
|
|
391
|
-
console.error("Error during sync:", error);
|
|
392
|
-
process.exit(1);
|
|
393
|
-
}
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
setupGetToolsCommand() {
|
|
397
|
-
this.program.command("get-tools").description("Get available MCP tools for this integration").requiredOption("--config <config>", "Integration configuration JSON").requiredOption("--integration-definition <definition>", "Integration definition JSON").action(async (options) => {
|
|
398
|
-
try {
|
|
399
|
-
const config = JSON.parse(options.config);
|
|
400
|
-
const integrationDefinition = JSON.parse(options.integrationDefinition);
|
|
401
|
-
const messages = await this.handleEvent({
|
|
402
|
-
event: IntegrationEventType.GET_TOOLS,
|
|
403
|
-
eventBody: {},
|
|
404
|
-
config,
|
|
405
|
-
integrationDefinition
|
|
406
|
-
});
|
|
407
|
-
console.log(JSON.stringify(messages));
|
|
408
|
-
} catch (error) {
|
|
409
|
-
console.error("Error getting tools:", error);
|
|
410
|
-
process.exit(1);
|
|
411
|
-
}
|
|
412
|
-
});
|
|
413
|
-
}
|
|
414
|
-
setupCallToolCommand() {
|
|
415
|
-
this.program.command("call-tool").description("Call a specific MCP tool").requiredOption("--config <config>", "Integration configuration JSON").requiredOption("--integration-definition <definition>", "Integration definition JSON").requiredOption("--tool-name <name>", "Name of the tool to call").requiredOption("--tool-arguments <arguments>", "Tool arguments as JSON").action(async (options) => {
|
|
416
|
-
try {
|
|
417
|
-
const config = JSON.parse(options.config);
|
|
418
|
-
const integrationDefinition = JSON.parse(options.integrationDefinition);
|
|
419
|
-
const toolArguments = JSON.parse(options.toolArguments);
|
|
420
|
-
const messages = await this.handleEvent({
|
|
421
|
-
event: IntegrationEventType.CALL_TOOL,
|
|
422
|
-
eventBody: {
|
|
423
|
-
name: options.toolName,
|
|
424
|
-
arguments: toolArguments
|
|
425
|
-
},
|
|
426
|
-
config,
|
|
427
|
-
integrationDefinition
|
|
428
|
-
});
|
|
429
|
-
console.log(JSON.stringify(messages));
|
|
430
|
-
} catch (error) {
|
|
431
|
-
console.error("Error calling tool:", error);
|
|
432
|
-
process.exit(1);
|
|
433
|
-
}
|
|
434
|
-
});
|
|
435
|
-
}
|
|
436
|
-
/**
|
|
437
|
-
* Parse and execute the CLI commands
|
|
438
|
-
*/
|
|
439
|
-
parse() {
|
|
440
|
-
this.program.parse();
|
|
441
|
-
}
|
|
442
|
-
/**
|
|
443
|
-
* Get the commander program instance for additional customization
|
|
444
|
-
*/
|
|
445
|
-
getProgram() {
|
|
446
|
-
return this.program;
|
|
447
|
-
}
|
|
448
|
-
};
|
|
449
|
-
var IngestInputSchema = z.object({
|
|
450
|
-
episodeBody: z.string(),
|
|
451
|
-
referenceTime: z.string(),
|
|
452
|
-
metadata: z.record(z.union([
|
|
453
|
-
z.string(),
|
|
454
|
-
z.number(),
|
|
455
|
-
z.boolean()
|
|
456
|
-
])).optional(),
|
|
457
|
-
source: z.string(),
|
|
458
|
-
labelIds: z.array(z.string()).optional(),
|
|
459
|
-
sessionId: z.string().optional(),
|
|
460
|
-
type: z.enum([
|
|
461
|
-
"CONVERSATION",
|
|
462
|
-
"DOCUMENT"
|
|
463
|
-
]).default("CONVERSATION"),
|
|
464
|
-
title: z.string().optional()
|
|
465
|
-
});
|
|
466
|
-
var IngestResponseSchema = z.object({
|
|
467
|
-
success: z.boolean(),
|
|
468
|
-
id: z.string()
|
|
469
|
-
});
|
|
470
|
-
var SearchInputSchema = z.object({
|
|
471
|
-
query: z.string(),
|
|
472
|
-
startTime: z.string().optional(),
|
|
473
|
-
endTime: z.string().optional(),
|
|
474
|
-
labelIds: z.array(z.string()).optional(),
|
|
475
|
-
limit: z.number().optional(),
|
|
476
|
-
structured: z.boolean().optional(),
|
|
477
|
-
sortBy: z.enum([
|
|
478
|
-
"relevance",
|
|
479
|
-
"recency"
|
|
480
|
-
]).optional()
|
|
481
|
-
});
|
|
482
|
-
var SearchResponseSchema = z.record(z.unknown());
|
|
483
|
-
var MeResponseSchema = z.object({
|
|
484
|
-
id: z.string(),
|
|
485
|
-
name: z.string().nullable().optional(),
|
|
486
|
-
persona: z.string().nullable().optional(),
|
|
487
|
-
workspaceId: z.string().nullable().optional(),
|
|
488
|
-
phoneNumber: z.string().nullable().optional(),
|
|
489
|
-
email: z.string().nullable().optional(),
|
|
490
|
-
timezone: z.string().nullable().optional(),
|
|
491
|
-
metadata: z.record(z.unknown()).nullable().optional()
|
|
492
|
-
});
|
|
493
|
-
var IntegrationAccountSchema = z.object({
|
|
494
|
-
id: z.string(),
|
|
495
|
-
name: z.string().optional(),
|
|
496
|
-
slug: z.string().optional()
|
|
497
|
-
}).passthrough();
|
|
498
|
-
var GetIntegrationsConnectedResponseSchema = z.object({
|
|
499
|
-
accounts: z.array(IntegrationAccountSchema)
|
|
500
|
-
});
|
|
501
|
-
var GetIntegrationActionsInputSchema = z.object({
|
|
502
|
-
accountId: z.string(),
|
|
503
|
-
query: z.string().optional()
|
|
504
|
-
});
|
|
505
|
-
var GetIntegrationActionsResponseSchema = z.object({
|
|
506
|
-
actions: z.array(z.unknown())
|
|
507
|
-
});
|
|
508
|
-
var ExecuteIntegrationActionInputSchema = z.object({
|
|
509
|
-
accountId: z.string(),
|
|
510
|
-
action: z.string(),
|
|
511
|
-
parameters: z.record(z.unknown()).optional()
|
|
512
|
-
});
|
|
513
|
-
var ExecuteIntegrationActionResponseSchema = z.object({
|
|
514
|
-
result: z.unknown()
|
|
515
|
-
});
|
|
516
|
-
var GetDocumentsInputSchema = z.object({
|
|
517
|
-
page: z.number().optional(),
|
|
518
|
-
limit: z.number().optional(),
|
|
519
|
-
source: z.string().optional(),
|
|
520
|
-
status: z.string().optional(),
|
|
521
|
-
type: z.string().optional(),
|
|
522
|
-
sessionId: z.string().optional(),
|
|
523
|
-
label: z.string().optional(),
|
|
524
|
-
cursor: z.string().optional()
|
|
525
|
-
});
|
|
526
|
-
var DocumentSchema = z.object({
|
|
527
|
-
id: z.string(),
|
|
528
|
-
title: z.string().nullable().optional(),
|
|
529
|
-
createdAt: z.string().optional(),
|
|
530
|
-
sessionId: z.string().nullable().optional(),
|
|
531
|
-
source: z.string().nullable().optional()
|
|
532
|
-
}).passthrough();
|
|
533
|
-
var GetDocumentsResponseSchema = z.object({
|
|
534
|
-
documents: z.array(DocumentSchema),
|
|
535
|
-
page: z.number(),
|
|
536
|
-
limit: z.number(),
|
|
537
|
-
hasMore: z.boolean(),
|
|
538
|
-
nextCursor: z.string().nullable(),
|
|
539
|
-
availableSources: z.array(z.object({
|
|
540
|
-
name: z.string(),
|
|
541
|
-
slug: z.string()
|
|
542
|
-
})),
|
|
543
|
-
totalCount: z.number()
|
|
544
|
-
});
|
|
545
|
-
var GetDocumentInputSchema = z.object({
|
|
546
|
-
documentId: z.string()
|
|
547
|
-
});
|
|
548
|
-
var GetDocumentResponseSchema = z.object({
|
|
549
|
-
document: DocumentSchema.nullable()
|
|
550
|
-
});
|
|
551
|
-
var GatewayAgentInfoSchema = z.object({
|
|
552
|
-
id: z.string(),
|
|
553
|
-
name: z.string(),
|
|
554
|
-
description: z.string(),
|
|
555
|
-
tools: z.array(z.string()),
|
|
556
|
-
platform: z.string().nullable(),
|
|
557
|
-
hostname: z.string().nullable(),
|
|
558
|
-
status: z.enum([
|
|
559
|
-
"CONNECTED",
|
|
560
|
-
"DISCONNECTED"
|
|
561
|
-
])
|
|
562
|
-
});
|
|
563
|
-
var GetGatewaysResponseSchema = z.object({
|
|
564
|
-
gateways: z.array(GatewayAgentInfoSchema)
|
|
565
|
-
});
|
|
566
|
-
var ExecuteGatewayInputSchema = z.object({
|
|
567
|
-
gatewayId: z.string(),
|
|
568
|
-
intent: z.string()
|
|
569
|
-
});
|
|
570
|
-
var ExecuteGatewayToolInputSchema = z.object({
|
|
571
|
-
gatewayId: z.string(),
|
|
572
|
-
toolName: z.string(),
|
|
573
|
-
params: z.record(z.unknown())
|
|
574
|
-
});
|
|
575
|
-
var ExecuteGatewayResponseSchema = z.object({
|
|
576
|
-
result: z.unknown()
|
|
577
|
-
});
|
|
578
|
-
var AuthorizationCodeResponseSchema = z.object({
|
|
579
|
-
authorizationCode: z.string(),
|
|
580
|
-
url: z.string()
|
|
581
|
-
});
|
|
582
|
-
var TokenExchangeInputSchema = z.object({
|
|
583
|
-
authorizationCode: z.string()
|
|
584
|
-
});
|
|
585
|
-
var TokenExchangeResponseSchema = z.object({
|
|
586
|
-
token: z.object({
|
|
587
|
-
token: z.string(),
|
|
588
|
-
obfuscatedToken: z.string()
|
|
589
|
-
}).nullable()
|
|
590
|
-
});
|
|
591
|
-
var CoreClientError = class extends Error {
|
|
592
|
-
static {
|
|
593
|
-
__name(this, "CoreClientError");
|
|
594
|
-
}
|
|
595
|
-
statusCode;
|
|
596
|
-
constructor(message, statusCode) {
|
|
597
|
-
super(message);
|
|
598
|
-
this.name = "CoreClientError";
|
|
599
|
-
this.statusCode = statusCode;
|
|
600
|
-
}
|
|
601
|
-
};
|
|
602
|
-
var CoreClient = class {
|
|
603
|
-
static {
|
|
604
|
-
__name(this, "CoreClient");
|
|
605
|
-
}
|
|
606
|
-
baseUrl;
|
|
607
|
-
token;
|
|
608
|
-
constructor(options) {
|
|
609
|
-
this.baseUrl = options.baseUrl.replace(/\/+$/, "");
|
|
610
|
-
this.token = options.token;
|
|
611
|
-
}
|
|
612
|
-
async request(method, path, options) {
|
|
613
|
-
let url = `${this.baseUrl}${path}`;
|
|
614
|
-
if (options?.searchParams) {
|
|
615
|
-
const params = new URLSearchParams(options.searchParams);
|
|
616
|
-
const query = params.toString();
|
|
617
|
-
if (query) url += `?${query}`;
|
|
618
|
-
}
|
|
619
|
-
const response = await fetch(url, {
|
|
620
|
-
method,
|
|
621
|
-
headers: {
|
|
622
|
-
"Content-Type": "application/json",
|
|
623
|
-
Authorization: `Bearer ${this.token}`
|
|
624
|
-
},
|
|
625
|
-
...options?.body ? {
|
|
626
|
-
body: JSON.stringify(options.body)
|
|
627
|
-
} : {}
|
|
628
|
-
});
|
|
629
|
-
if (!response.ok) {
|
|
630
|
-
let errorMessage;
|
|
631
|
-
try {
|
|
632
|
-
const errorBody = await response.json();
|
|
633
|
-
errorMessage = errorBody.error || JSON.stringify(errorBody);
|
|
634
|
-
} catch {
|
|
635
|
-
errorMessage = await response.text();
|
|
636
|
-
}
|
|
637
|
-
throw new CoreClientError(errorMessage, response.status);
|
|
638
|
-
}
|
|
639
|
-
return response.json();
|
|
640
|
-
}
|
|
641
|
-
/**
|
|
642
|
-
* Send a request without an Authorization header.
|
|
643
|
-
* Used for public endpoints like authorization-code and token exchange.
|
|
644
|
-
*/
|
|
645
|
-
async requestPublic(method, path, options) {
|
|
646
|
-
const url = `${this.baseUrl}${path}`;
|
|
647
|
-
const response = await fetch(url, {
|
|
648
|
-
method,
|
|
649
|
-
headers: {
|
|
650
|
-
"Content-Type": "application/json"
|
|
651
|
-
},
|
|
652
|
-
...options?.body ? {
|
|
653
|
-
body: JSON.stringify(options.body)
|
|
654
|
-
} : {}
|
|
655
|
-
});
|
|
656
|
-
if (!response.ok) {
|
|
657
|
-
let errorMessage;
|
|
658
|
-
try {
|
|
659
|
-
const errorBody = await response.json();
|
|
660
|
-
errorMessage = errorBody.error || JSON.stringify(errorBody);
|
|
661
|
-
} catch {
|
|
662
|
-
errorMessage = await response.text();
|
|
663
|
-
}
|
|
664
|
-
throw new CoreClientError(errorMessage, response.status);
|
|
665
|
-
}
|
|
666
|
-
return response.json();
|
|
667
|
-
}
|
|
668
|
-
/**
|
|
669
|
-
* Get the authenticated user's profile info.
|
|
670
|
-
* GET /api/v1/me
|
|
671
|
-
*/
|
|
672
|
-
async me() {
|
|
673
|
-
return this.request("GET", "/api/v1/me");
|
|
674
|
-
}
|
|
675
|
-
/**
|
|
676
|
-
* Store a conversation or document in memory.
|
|
677
|
-
* POST /api/v1/add
|
|
678
|
-
*/
|
|
679
|
-
async ingest(body) {
|
|
680
|
-
return this.request("POST", "/api/v1/add", {
|
|
681
|
-
body
|
|
682
|
-
});
|
|
683
|
-
}
|
|
684
|
-
/**
|
|
685
|
-
* Search memory with a query and optional filters.
|
|
686
|
-
* POST /api/v1/search
|
|
687
|
-
*/
|
|
688
|
-
async search(body) {
|
|
689
|
-
return this.request("POST", "/api/v1/search", {
|
|
690
|
-
body
|
|
691
|
-
});
|
|
692
|
-
}
|
|
693
|
-
/**
|
|
694
|
-
* List all connected integration accounts for the workspace.
|
|
695
|
-
* GET /api/v1/integration_account
|
|
696
|
-
*/
|
|
697
|
-
async getIntegrationsConnected() {
|
|
698
|
-
return this.request("GET", "/api/v1/integration_account");
|
|
699
|
-
}
|
|
700
|
-
/**
|
|
701
|
-
* Get relevant actions for a specific integration account.
|
|
702
|
-
* GET /api/v1/integration_account/:accountId/action?query=...
|
|
703
|
-
*/
|
|
704
|
-
async getIntegrationActions(params) {
|
|
705
|
-
const searchParams = {};
|
|
706
|
-
if (params.query) searchParams.query = params.query;
|
|
707
|
-
return this.request("GET", `/api/v1/integration_account/${params.accountId}/action`, {
|
|
708
|
-
searchParams: Object.keys(searchParams).length > 0 ? searchParams : void 0
|
|
709
|
-
});
|
|
710
|
-
}
|
|
711
|
-
/**
|
|
712
|
-
* Execute an action on an integration account.
|
|
713
|
-
* POST /api/v1/integration_account/:accountId/action
|
|
714
|
-
*/
|
|
715
|
-
async executeIntegrationAction(params) {
|
|
716
|
-
const { accountId, ...body } = params;
|
|
717
|
-
return this.request("POST", `/api/v1/integration_account/${accountId}/action`, {
|
|
718
|
-
body
|
|
719
|
-
});
|
|
720
|
-
}
|
|
721
|
-
/**
|
|
722
|
-
* Generate a new session UUID for conversation tracking.
|
|
723
|
-
* Local operation — no API call.
|
|
724
|
-
*/
|
|
725
|
-
async getSessionId() {
|
|
726
|
-
return randomUUID();
|
|
727
|
-
}
|
|
728
|
-
/**
|
|
729
|
-
* List documents with optional filtering and pagination.
|
|
730
|
-
* GET /api/v1/documents
|
|
731
|
-
*/
|
|
732
|
-
async getDocuments(params) {
|
|
733
|
-
const searchParams = {};
|
|
734
|
-
if (params) {
|
|
735
|
-
if (params.page != null) searchParams.page = String(params.page);
|
|
736
|
-
if (params.limit != null) searchParams.limit = String(params.limit);
|
|
737
|
-
if (params.source) searchParams.source = params.source;
|
|
738
|
-
if (params.status) searchParams.status = params.status;
|
|
739
|
-
if (params.type) searchParams.type = params.type;
|
|
740
|
-
if (params.sessionId) searchParams.sessionId = params.sessionId;
|
|
741
|
-
if (params.label) searchParams.label = params.label;
|
|
742
|
-
if (params.cursor) searchParams.cursor = params.cursor;
|
|
743
|
-
}
|
|
744
|
-
return this.request("GET", "/api/v1/documents", {
|
|
745
|
-
searchParams: Object.keys(searchParams).length > 0 ? searchParams : void 0
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
/**
|
|
749
|
-
* Get a single document by ID.
|
|
750
|
-
* GET /api/v1/documents/:documentId
|
|
751
|
-
*/
|
|
752
|
-
async getDocument(params) {
|
|
753
|
-
return this.request("GET", `/api/v1/documents/${params.documentId}`);
|
|
754
|
-
}
|
|
755
|
-
/**
|
|
756
|
-
* List all connected gateways for the workspace.
|
|
757
|
-
* GET /api/v1/gateways
|
|
758
|
-
*/
|
|
759
|
-
async getGateways() {
|
|
760
|
-
return this.request("GET", "/api/v1/gateways");
|
|
761
|
-
}
|
|
762
|
-
/**
|
|
763
|
-
* Run a gateway sub-agent with an intent and return the final text result.
|
|
764
|
-
* POST /api/v1/gateways/:gatewayId/execute
|
|
765
|
-
*/
|
|
766
|
-
async executeGateway(params) {
|
|
767
|
-
return this.request("POST", `/api/v1/gateways/${params.gatewayId}/execute`, {
|
|
768
|
-
body: {
|
|
769
|
-
intent: params.intent
|
|
770
|
-
}
|
|
771
|
-
});
|
|
772
|
-
}
|
|
773
|
-
/**
|
|
774
|
-
* Proxy a single tool call to a gateway via server websocket.
|
|
775
|
-
* POST /api/v1/gateways/:gatewayId/execute (mode: "tool")
|
|
776
|
-
*/
|
|
777
|
-
async executeGatewayTool(params) {
|
|
778
|
-
return this.request("POST", `/api/v1/gateways/${params.gatewayId}/execute`, {
|
|
779
|
-
body: {
|
|
780
|
-
mode: "tool",
|
|
781
|
-
toolName: params.toolName,
|
|
782
|
-
params: params.params
|
|
783
|
-
}
|
|
784
|
-
});
|
|
785
|
-
}
|
|
786
|
-
// -------------------------------------------------------------------------
|
|
787
|
-
// Auth – Device-style login flow (public endpoints, no token required)
|
|
788
|
-
// -------------------------------------------------------------------------
|
|
789
|
-
/**
|
|
790
|
-
* Request a fresh authorization code.
|
|
791
|
-
* POST /api/v1/authorization-code (unauthenticated)
|
|
792
|
-
*
|
|
793
|
-
* The returned `url` is the page the user must visit to authorize the CLI.
|
|
794
|
-
*/
|
|
795
|
-
async getAuthorizationCode() {
|
|
796
|
-
return this.requestPublic("POST", "/api/v1/authorization-code");
|
|
797
|
-
}
|
|
798
|
-
/**
|
|
799
|
-
* Exchange an authorization code for a personal access token.
|
|
800
|
-
* POST /api/v1/token (unauthenticated)
|
|
801
|
-
*
|
|
802
|
-
* Returns `{ token: null }` while the user has not yet completed
|
|
803
|
-
* the browser authorization step. Poll until `token` is non-null.
|
|
804
|
-
*/
|
|
805
|
-
async exchangeToken(params) {
|
|
806
|
-
return this.requestPublic("POST", "/api/v1/token", {
|
|
807
|
-
body: params
|
|
808
|
-
});
|
|
809
|
-
}
|
|
810
|
-
/**
|
|
811
|
-
* Verify that the current token is valid by calling /api/v1/me.
|
|
812
|
-
* Returns the user profile on success, or throws CoreClientError on failure.
|
|
813
|
-
* Useful as a health-check before launching other operations.
|
|
814
|
-
*/
|
|
815
|
-
async checkAuth() {
|
|
816
|
-
return this.me();
|
|
817
|
-
}
|
|
818
|
-
};
|
|
819
|
-
|
|
820
|
-
export { ActionStatus, ActionStatusEnum, AuthorizationCodeResponseSchema, COMPACTED_SESSION_NODE_PROPERTIES, ClaudeModels, CoreClient, CoreClientError, DocumentSchema, ENTITY_NODE_PROPERTIES, EPISODIC_NODE_PROPERTIES, EXPLICIT_PATTERN_TYPES, EntityTypes, EpisodeType, EpisodeTypeEnum, ExecuteGatewayInputSchema, ExecuteGatewayResponseSchema, ExecuteGatewayToolInputSchema, ExecuteIntegrationActionInputSchema, ExecuteIntegrationActionResponseSchema, GRAPH_ASPECTS, GatewayAgentInfoSchema, GeminiModels, GetDocumentInputSchema, GetDocumentResponseSchema, GetDocumentsInputSchema, GetDocumentsResponseSchema, GetGatewaysResponseSchema, GetIntegrationActionsInputSchema, GetIntegrationActionsResponseSchema, GetIntegrationsConnectedResponseSchema, IMPLICIT_PATTERN_TYPES, IngestInputSchema, IngestResponseSchema, IntegrationAccountSchema, IntegrationCLI, IntegrationEventType, LLMMappings, LLMModelEnum, LLMModelType, MeResponseSchema, OAuth2Params, OpenAIModels, PATTERN_TYPES, QUALITY_THRESHOLDS, STATEMENT_NODE_PROPERTIES, SearchInputSchema, SearchResponseSchema, Spec, StatementAspects, TokenExchangeInputSchema, TokenExchangeResponseSchema, UserTypeEnum, VOICE_ASPECTS };
|
|
821
|
-
//# sourceMappingURL=index.mjs.map
|
|
822
|
-
//# sourceMappingURL=index.mjs.map
|