@outlit/tools 0.0.0-canary-202604132020-e7f42ca-20260413202053
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.cjs +724 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +514 -0
- package/dist/index.d.ts +514 -0
- package/dist/index.js +674 -0
- package/dist/index.js.map +1 -0
- package/package.json +55 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,724 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
DEFAULT_OUTLIT_API_URL: () => DEFAULT_OUTLIT_API_URL,
|
|
24
|
+
allCustomerToolNames: () => allCustomerToolNames,
|
|
25
|
+
createOutlitClient: () => createOutlitClient,
|
|
26
|
+
customerActivityWindows: () => customerActivityWindows,
|
|
27
|
+
customerBillingStatuses: () => customerBillingStatuses,
|
|
28
|
+
customerFactIncludes: () => customerFactIncludes,
|
|
29
|
+
customerFactStatuses: () => customerFactStatuses,
|
|
30
|
+
customerIncludeSections: () => customerIncludeSections,
|
|
31
|
+
customerListOrderFields: () => customerListOrderFields,
|
|
32
|
+
customerSourceTypes: () => customerSourceTypes,
|
|
33
|
+
customerTimeframes: () => customerTimeframes,
|
|
34
|
+
customerToolContractHash: () => customerToolContractHash,
|
|
35
|
+
customerToolContracts: () => customerToolContracts,
|
|
36
|
+
customerToolNames: () => customerToolNames,
|
|
37
|
+
defaultAgentToolNames: () => defaultAgentToolNames,
|
|
38
|
+
getCustomerToolContract: () => getCustomerToolContract,
|
|
39
|
+
isCustomerToolName: () => isCustomerToolName,
|
|
40
|
+
resolveCustomerContextSearchInput: () => resolveCustomerContextSearchInput,
|
|
41
|
+
schemaTables: () => schemaTables,
|
|
42
|
+
sqlToolNames: () => sqlToolNames,
|
|
43
|
+
timelineChannels: () => timelineChannels,
|
|
44
|
+
timelineTimeframes: () => timelineTimeframes,
|
|
45
|
+
userJourneyStages: () => userJourneyStages,
|
|
46
|
+
userListOrderFields: () => userListOrderFields
|
|
47
|
+
});
|
|
48
|
+
module.exports = __toCommonJS(src_exports);
|
|
49
|
+
|
|
50
|
+
// src/contracts.ts
|
|
51
|
+
var customerToolNames = [
|
|
52
|
+
"outlit_list_customers",
|
|
53
|
+
"outlit_list_users",
|
|
54
|
+
"outlit_get_customer",
|
|
55
|
+
"outlit_get_timeline",
|
|
56
|
+
"outlit_list_facts",
|
|
57
|
+
"outlit_get_fact",
|
|
58
|
+
"outlit_get_source",
|
|
59
|
+
"outlit_search_customer_context",
|
|
60
|
+
"outlit_query",
|
|
61
|
+
"outlit_schema"
|
|
62
|
+
];
|
|
63
|
+
var customerToolContracts = {
|
|
64
|
+
outlit_list_customers: {
|
|
65
|
+
toolName: "outlit_list_customers",
|
|
66
|
+
description: "Browse and filter customers. Use this to find customers by billing status, activity recency, revenue, or name. Returns a paginated list with summary info (MRR, last activity, status).",
|
|
67
|
+
inputSchema: {
|
|
68
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
69
|
+
type: "object",
|
|
70
|
+
properties: {
|
|
71
|
+
billingStatus: {
|
|
72
|
+
description: "Filter by billing status",
|
|
73
|
+
type: "string",
|
|
74
|
+
enum: ["NONE", "TRIALING", "PAYING", "PAST_DUE", "CHURNED"]
|
|
75
|
+
},
|
|
76
|
+
hasActivityInLast: {
|
|
77
|
+
description: "Filter customers with activity in the last N days",
|
|
78
|
+
type: "string",
|
|
79
|
+
enum: ["7d", "14d", "30d", "90d"]
|
|
80
|
+
},
|
|
81
|
+
noActivityInLast: {
|
|
82
|
+
description: "Filter customers with NO activity in the last N days",
|
|
83
|
+
type: "string",
|
|
84
|
+
enum: ["7d", "14d", "30d", "90d"]
|
|
85
|
+
},
|
|
86
|
+
mrrAbove: {
|
|
87
|
+
description: "Minimum MRR in cents (e.g., 10000 = $100)",
|
|
88
|
+
type: "number",
|
|
89
|
+
minimum: 0
|
|
90
|
+
},
|
|
91
|
+
mrrBelow: {
|
|
92
|
+
description: "Maximum MRR in cents",
|
|
93
|
+
type: "number",
|
|
94
|
+
minimum: 0
|
|
95
|
+
},
|
|
96
|
+
traitFilters: {
|
|
97
|
+
description: "Filter by exact trait values using key/value pairs",
|
|
98
|
+
type: "object",
|
|
99
|
+
propertyNames: {
|
|
100
|
+
type: "string",
|
|
101
|
+
pattern: "^[A-Za-z0-9_-]{1,100}$"
|
|
102
|
+
},
|
|
103
|
+
additionalProperties: {
|
|
104
|
+
anyOf: [
|
|
105
|
+
{
|
|
106
|
+
type: "string",
|
|
107
|
+
maxLength: 500
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
type: "number"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
type: "boolean"
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
search: {
|
|
119
|
+
description: "Search by customer name or domain (case-insensitive)",
|
|
120
|
+
type: "string",
|
|
121
|
+
maxLength: 500
|
|
122
|
+
},
|
|
123
|
+
limit: {
|
|
124
|
+
description: "Results per page (max 1000)",
|
|
125
|
+
default: 50,
|
|
126
|
+
type: "number",
|
|
127
|
+
minimum: 1,
|
|
128
|
+
maximum: 1e3
|
|
129
|
+
},
|
|
130
|
+
cursor: {
|
|
131
|
+
description: "Pagination cursor from previous response",
|
|
132
|
+
type: "string"
|
|
133
|
+
},
|
|
134
|
+
orderBy: {
|
|
135
|
+
description: "Field to order results by",
|
|
136
|
+
default: "last_activity_at",
|
|
137
|
+
type: "string",
|
|
138
|
+
enum: ["last_activity_at", "first_seen_at", "name", "mrr_cents"]
|
|
139
|
+
},
|
|
140
|
+
orderDirection: {
|
|
141
|
+
description: "Sort direction",
|
|
142
|
+
default: "desc",
|
|
143
|
+
type: "string",
|
|
144
|
+
enum: ["asc", "desc"]
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
additionalProperties: false
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
outlit_list_users: {
|
|
151
|
+
toolName: "outlit_list_users",
|
|
152
|
+
description: "Browse and filter users. Use this to find users by journey stage, activity recency, customer, or email/name. Returns a paginated list with activity info.",
|
|
153
|
+
inputSchema: {
|
|
154
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
155
|
+
type: "object",
|
|
156
|
+
properties: {
|
|
157
|
+
journeyStage: {
|
|
158
|
+
description: "Filter by user journey stage",
|
|
159
|
+
type: "string",
|
|
160
|
+
enum: ["DISCOVERED", "SIGNED_UP", "ACTIVATED", "ENGAGED", "INACTIVE"]
|
|
161
|
+
},
|
|
162
|
+
customerId: {
|
|
163
|
+
description: "Filter users by customer ID",
|
|
164
|
+
type: "string",
|
|
165
|
+
maxLength: 500
|
|
166
|
+
},
|
|
167
|
+
traitFilters: {
|
|
168
|
+
description: "Filter by exact trait values using key/value pairs",
|
|
169
|
+
type: "object",
|
|
170
|
+
propertyNames: {
|
|
171
|
+
type: "string",
|
|
172
|
+
pattern: "^[A-Za-z0-9_-]{1,100}$"
|
|
173
|
+
},
|
|
174
|
+
additionalProperties: {
|
|
175
|
+
anyOf: [
|
|
176
|
+
{
|
|
177
|
+
type: "string",
|
|
178
|
+
maxLength: 500
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
type: "number"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
type: "boolean"
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
hasActivityInLast: {
|
|
190
|
+
description: "Filter users active within this window. Format: Nd, Nh, or Nm (e.g., '7d', '24h', '90m')",
|
|
191
|
+
type: "string",
|
|
192
|
+
pattern: "^\\d+(d|h|m)$"
|
|
193
|
+
},
|
|
194
|
+
noActivityInLast: {
|
|
195
|
+
description: "Filter users NOT active within this window. Format: Nd, Nh, or Nm (e.g., '30d', '2h')",
|
|
196
|
+
type: "string",
|
|
197
|
+
pattern: "^\\d+(d|h|m)$"
|
|
198
|
+
},
|
|
199
|
+
search: {
|
|
200
|
+
description: "Search by user email or name (case-insensitive)",
|
|
201
|
+
type: "string",
|
|
202
|
+
maxLength: 500
|
|
203
|
+
},
|
|
204
|
+
limit: {
|
|
205
|
+
description: "Results per page (max 1000)",
|
|
206
|
+
default: 50,
|
|
207
|
+
type: "number",
|
|
208
|
+
minimum: 1,
|
|
209
|
+
maximum: 1e3
|
|
210
|
+
},
|
|
211
|
+
cursor: {
|
|
212
|
+
description: "Pagination cursor from previous response",
|
|
213
|
+
type: "string"
|
|
214
|
+
},
|
|
215
|
+
orderBy: {
|
|
216
|
+
description: "Field to order by",
|
|
217
|
+
default: "last_activity_at",
|
|
218
|
+
type: "string",
|
|
219
|
+
enum: ["last_activity_at", "first_seen_at", "email"]
|
|
220
|
+
},
|
|
221
|
+
orderDirection: {
|
|
222
|
+
description: "Sort direction",
|
|
223
|
+
default: "desc",
|
|
224
|
+
type: "string",
|
|
225
|
+
enum: ["asc", "desc"]
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
additionalProperties: false
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
outlit_get_customer: {
|
|
232
|
+
toolName: "outlit_get_customer",
|
|
233
|
+
description: "Get full details for a single customer. Use this when you already know which customer you want to inspect. Optionally include related data (users, revenue, recent activity, engagement metrics).",
|
|
234
|
+
inputSchema: {
|
|
235
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
236
|
+
type: "object",
|
|
237
|
+
properties: {
|
|
238
|
+
customer: {
|
|
239
|
+
type: "string",
|
|
240
|
+
description: "Customer ID, domain, or name to look up"
|
|
241
|
+
},
|
|
242
|
+
include: {
|
|
243
|
+
description: "Additional data sections to include in the response",
|
|
244
|
+
type: "array",
|
|
245
|
+
items: {
|
|
246
|
+
type: "string",
|
|
247
|
+
enum: ["users", "revenue", "recentTimeline", "behaviorMetrics"]
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
timeframe: {
|
|
251
|
+
description: "Timeframe for timeline and behavior metrics (default: 30d)",
|
|
252
|
+
default: "30d",
|
|
253
|
+
type: "string",
|
|
254
|
+
enum: ["7d", "14d", "30d", "90d"]
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
required: ["customer"],
|
|
258
|
+
additionalProperties: false
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
outlit_get_timeline: {
|
|
262
|
+
toolName: "outlit_get_timeline",
|
|
263
|
+
description: "Get the chronological activity timeline for a customer. Use this to see what happened and when \u2014 emails, calls, Slack messages, billing events, etc. Supports channel and date filtering.",
|
|
264
|
+
inputSchema: {
|
|
265
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
266
|
+
type: "object",
|
|
267
|
+
properties: {
|
|
268
|
+
customer: {
|
|
269
|
+
type: "string",
|
|
270
|
+
description: "Customer ID or domain"
|
|
271
|
+
},
|
|
272
|
+
channels: {
|
|
273
|
+
description: "Filter by event channel (e.g., EMAIL, SLACK, CALL)",
|
|
274
|
+
type: "array",
|
|
275
|
+
items: {
|
|
276
|
+
type: "string",
|
|
277
|
+
enum: ["SDK", "EMAIL", "SLACK", "CALL", "CRM", "BILLING", "SUPPORT", "INTERNAL"]
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
eventTypes: {
|
|
281
|
+
description: "Filter by event type",
|
|
282
|
+
type: "array",
|
|
283
|
+
items: {
|
|
284
|
+
type: "string"
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
timeframe: {
|
|
288
|
+
description: "Relative time window (default: 30d). Cannot be used with startDate/endDate.",
|
|
289
|
+
type: "string",
|
|
290
|
+
enum: ["7d", "14d", "30d", "90d", "all"]
|
|
291
|
+
},
|
|
292
|
+
startDate: {
|
|
293
|
+
description: "Start of time window (ISO 8601, e.g. '2025-01-01T00:00:00Z'). Cannot be used with timeframe.",
|
|
294
|
+
type: "string",
|
|
295
|
+
format: "date-time",
|
|
296
|
+
pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
|
|
297
|
+
},
|
|
298
|
+
endDate: {
|
|
299
|
+
description: "End of time window (ISO 8601, e.g. '2025-01-31T23:59:59Z'). Cannot be used with timeframe.",
|
|
300
|
+
type: "string",
|
|
301
|
+
format: "date-time",
|
|
302
|
+
pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
|
|
303
|
+
},
|
|
304
|
+
limit: {
|
|
305
|
+
description: "Results per page (max 1000)",
|
|
306
|
+
default: 50,
|
|
307
|
+
type: "number",
|
|
308
|
+
minimum: 1,
|
|
309
|
+
maximum: 1e3
|
|
310
|
+
},
|
|
311
|
+
cursor: {
|
|
312
|
+
description: "Pagination cursor from previous response",
|
|
313
|
+
type: "string"
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
required: ["customer"],
|
|
317
|
+
additionalProperties: false
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
outlit_list_facts: {
|
|
321
|
+
toolName: "outlit_list_facts",
|
|
322
|
+
description: "List structured facts known about a customer. Use filters like status, sourceTypes, and date bounds to narrow the result set. For topic-specific retrieval, use outlit_search_customer_context instead.",
|
|
323
|
+
inputSchema: {
|
|
324
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
325
|
+
type: "object",
|
|
326
|
+
properties: {
|
|
327
|
+
customer: {
|
|
328
|
+
type: "string",
|
|
329
|
+
description: "Customer ID or domain"
|
|
330
|
+
},
|
|
331
|
+
status: {
|
|
332
|
+
description: "Optional fact status filter",
|
|
333
|
+
type: "array",
|
|
334
|
+
items: {
|
|
335
|
+
type: "string",
|
|
336
|
+
enum: ["ACTIVE", "ACKNOWLEDGED", "RESOLVED", "SNOOZED", "CANDIDATE"]
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
sourceTypes: {
|
|
340
|
+
description: "Optional generic source types to restrict fact results to.",
|
|
341
|
+
type: "array",
|
|
342
|
+
items: {
|
|
343
|
+
type: "string",
|
|
344
|
+
enum: ["EMAIL", "CALL", "CALENDAR_EVENT", "SUPPORT_TICKET"]
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
after: {
|
|
348
|
+
description: "ISO 8601 datetime lower bound",
|
|
349
|
+
type: "string",
|
|
350
|
+
format: "date-time",
|
|
351
|
+
pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
|
|
352
|
+
},
|
|
353
|
+
before: {
|
|
354
|
+
description: "ISO 8601 datetime upper bound",
|
|
355
|
+
type: "string",
|
|
356
|
+
format: "date-time",
|
|
357
|
+
pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
|
|
358
|
+
},
|
|
359
|
+
limit: {
|
|
360
|
+
description: "Results per page (max 100)",
|
|
361
|
+
default: 50,
|
|
362
|
+
type: "number",
|
|
363
|
+
minimum: 1,
|
|
364
|
+
maximum: 100
|
|
365
|
+
},
|
|
366
|
+
cursor: {
|
|
367
|
+
description: "Pagination cursor from previous response",
|
|
368
|
+
type: "string"
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
required: ["customer"],
|
|
372
|
+
additionalProperties: false
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
outlit_get_fact: {
|
|
376
|
+
toolName: "outlit_get_fact",
|
|
377
|
+
description: "Get one exact fact by ID. Returns the canonical fact shape and optionally expands requested related data such as evidence.",
|
|
378
|
+
inputSchema: {
|
|
379
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
380
|
+
type: "object",
|
|
381
|
+
properties: {
|
|
382
|
+
factId: {
|
|
383
|
+
type: "string",
|
|
384
|
+
minLength: 1,
|
|
385
|
+
maxLength: 500,
|
|
386
|
+
description: "Exact fact ID to retrieve"
|
|
387
|
+
},
|
|
388
|
+
include: {
|
|
389
|
+
description: "Optional best-effort expansions. Use include=['evidence'] to request evidence when available; unsupported include values are ignored.",
|
|
390
|
+
type: "array",
|
|
391
|
+
items: {
|
|
392
|
+
type: "string",
|
|
393
|
+
minLength: 1,
|
|
394
|
+
maxLength: 100
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
required: ["factId"],
|
|
399
|
+
additionalProperties: false
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
outlit_get_source: {
|
|
403
|
+
toolName: "outlit_get_source",
|
|
404
|
+
description: "Get one exact source record by generic sourceType and sourceId. Use this when you already know the concrete underlying source you want to inspect.",
|
|
405
|
+
inputSchema: {
|
|
406
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
407
|
+
type: "object",
|
|
408
|
+
properties: {
|
|
409
|
+
sourceType: {
|
|
410
|
+
type: "string",
|
|
411
|
+
enum: ["EMAIL", "CALL", "CALENDAR_EVENT", "SUPPORT_TICKET"]
|
|
412
|
+
},
|
|
413
|
+
sourceId: {
|
|
414
|
+
type: "string",
|
|
415
|
+
minLength: 1,
|
|
416
|
+
maxLength: 500
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
required: ["sourceType", "sourceId"],
|
|
420
|
+
additionalProperties: false
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
outlit_search_customer_context: {
|
|
424
|
+
toolName: "outlit_search_customer_context",
|
|
425
|
+
description: "Search across all known customer context using a natural-language query. Returns grouped artifact-level results for matching sources and facts. Omit customer to search across all customers in the organization.",
|
|
426
|
+
inputSchema: {
|
|
427
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
428
|
+
type: "object",
|
|
429
|
+
properties: {
|
|
430
|
+
customer: {
|
|
431
|
+
description: "Customer ID, domain, or name. Omit to search across all customers.",
|
|
432
|
+
anyOf: [
|
|
433
|
+
{
|
|
434
|
+
type: "string",
|
|
435
|
+
minLength: 1,
|
|
436
|
+
maxLength: 500
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
type: "null"
|
|
440
|
+
}
|
|
441
|
+
]
|
|
442
|
+
},
|
|
443
|
+
query: {
|
|
444
|
+
type: "string",
|
|
445
|
+
minLength: 2,
|
|
446
|
+
maxLength: 2e3,
|
|
447
|
+
description: "Natural language query or topic to search for."
|
|
448
|
+
},
|
|
449
|
+
topK: {
|
|
450
|
+
description: "Maximum number of artifact results to return (default 20).",
|
|
451
|
+
type: "integer",
|
|
452
|
+
minimum: 1,
|
|
453
|
+
maximum: 50
|
|
454
|
+
},
|
|
455
|
+
after: {
|
|
456
|
+
description: "ISO 8601 datetime lower bound",
|
|
457
|
+
type: "string",
|
|
458
|
+
format: "date-time",
|
|
459
|
+
pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
|
|
460
|
+
},
|
|
461
|
+
before: {
|
|
462
|
+
description: "ISO 8601 datetime upper bound",
|
|
463
|
+
type: "string",
|
|
464
|
+
format: "date-time",
|
|
465
|
+
pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
|
|
466
|
+
},
|
|
467
|
+
sourceTypes: {
|
|
468
|
+
description: "Optional generic source types to restrict the search to.",
|
|
469
|
+
type: "array",
|
|
470
|
+
items: {
|
|
471
|
+
type: "string",
|
|
472
|
+
enum: ["EMAIL", "CALL", "CALENDAR_EVENT", "SUPPORT_TICKET"]
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
required: ["query"],
|
|
477
|
+
additionalProperties: false
|
|
478
|
+
}
|
|
479
|
+
},
|
|
480
|
+
outlit_query: {
|
|
481
|
+
toolName: "outlit_query",
|
|
482
|
+
description: "Execute raw SQL queries against your analytics data.\n\nAvailable tables:\n- events: Customer activity events (event_type, event_channel, customer_id, occurred_at, properties, ...)\n- customer_dimensions: Customer attributes (customer_id, domain, name, billing_status, plan, mrr_cents, ...)\n- user_dimensions: User attributes (user_id, email, name, customer_id, ...)\n- mrr_snapshots: Revenue snapshots over time (customer_id, snapshot_date, mrr_cents, ...)\n\nAll queries are automatically filtered to your organization's data.\nOnly SELECT queries are allowed.\n\nExample queries:\n- SELECT event_type, count(*) FROM events GROUP BY 1 ORDER BY 2 DESC LIMIT 10\n- SELECT billing_status, sum(mrr_cents)/100 as mrr FROM customer_dimensions GROUP BY 1\n- SELECT * FROM events WHERE customer_id = 'cust_123' ORDER BY occurred_at DESC LIMIT 50",
|
|
483
|
+
inputSchema: {
|
|
484
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
485
|
+
type: "object",
|
|
486
|
+
properties: {
|
|
487
|
+
sql: {
|
|
488
|
+
type: "string",
|
|
489
|
+
description: "SQL SELECT query to execute"
|
|
490
|
+
},
|
|
491
|
+
limit: {
|
|
492
|
+
description: "Max rows to return (default 1000, max 10000)",
|
|
493
|
+
default: 1e3,
|
|
494
|
+
type: "number",
|
|
495
|
+
maximum: 1e4
|
|
496
|
+
}
|
|
497
|
+
},
|
|
498
|
+
required: ["sql"],
|
|
499
|
+
additionalProperties: false
|
|
500
|
+
}
|
|
501
|
+
},
|
|
502
|
+
outlit_schema: {
|
|
503
|
+
toolName: "outlit_schema",
|
|
504
|
+
description: "Get table schemas for available analytics tables.\n\nUse this to discover column names, types, and descriptions before writing SQL queries.\nReturns column definitions and example queries for each table.",
|
|
505
|
+
inputSchema: {
|
|
506
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
507
|
+
type: "object",
|
|
508
|
+
properties: {
|
|
509
|
+
table: {
|
|
510
|
+
description: "Specific table to describe, or omit for all tables",
|
|
511
|
+
type: "string",
|
|
512
|
+
enum: ["events", "customer_dimensions", "user_dimensions", "mrr_snapshots"]
|
|
513
|
+
}
|
|
514
|
+
},
|
|
515
|
+
additionalProperties: false
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
var customerBillingStatuses = [
|
|
520
|
+
"NONE",
|
|
521
|
+
"TRIALING",
|
|
522
|
+
"PAYING",
|
|
523
|
+
"PAST_DUE",
|
|
524
|
+
"CHURNED"
|
|
525
|
+
];
|
|
526
|
+
var customerActivityWindows = ["7d", "14d", "30d", "90d"];
|
|
527
|
+
var customerFactStatuses = [
|
|
528
|
+
"ACTIVE",
|
|
529
|
+
"ACKNOWLEDGED",
|
|
530
|
+
"RESOLVED",
|
|
531
|
+
"SNOOZED",
|
|
532
|
+
"CANDIDATE"
|
|
533
|
+
];
|
|
534
|
+
var customerFactIncludes = ["evidence"];
|
|
535
|
+
var customerListOrderFields = [
|
|
536
|
+
"last_activity_at",
|
|
537
|
+
"first_seen_at",
|
|
538
|
+
"name",
|
|
539
|
+
"mrr_cents"
|
|
540
|
+
];
|
|
541
|
+
var customerIncludeSections = [
|
|
542
|
+
"users",
|
|
543
|
+
"revenue",
|
|
544
|
+
"recentTimeline",
|
|
545
|
+
"behaviorMetrics"
|
|
546
|
+
];
|
|
547
|
+
var customerSourceTypes = ["EMAIL", "CALL", "CALENDAR_EVENT", "SUPPORT_TICKET"];
|
|
548
|
+
var customerTimeframes = ["7d", "14d", "30d", "90d"];
|
|
549
|
+
var timelineChannels = [
|
|
550
|
+
"SDK",
|
|
551
|
+
"EMAIL",
|
|
552
|
+
"SLACK",
|
|
553
|
+
"CALL",
|
|
554
|
+
"CRM",
|
|
555
|
+
"BILLING",
|
|
556
|
+
"SUPPORT",
|
|
557
|
+
"INTERNAL"
|
|
558
|
+
];
|
|
559
|
+
var timelineTimeframes = ["7d", "14d", "30d", "90d", "all"];
|
|
560
|
+
var userJourneyStages = [
|
|
561
|
+
"DISCOVERED",
|
|
562
|
+
"SIGNED_UP",
|
|
563
|
+
"ACTIVATED",
|
|
564
|
+
"ENGAGED",
|
|
565
|
+
"INACTIVE"
|
|
566
|
+
];
|
|
567
|
+
var userListOrderFields = ["last_activity_at", "first_seen_at", "email"];
|
|
568
|
+
var schemaTables = [
|
|
569
|
+
"events",
|
|
570
|
+
"customer_dimensions",
|
|
571
|
+
"user_dimensions",
|
|
572
|
+
"mrr_snapshots"
|
|
573
|
+
];
|
|
574
|
+
var customerToolContractHash = "723c552610b62397f04eb941a656e858772b876bf876065f05bc96ad019aac0b";
|
|
575
|
+
var customerToolNameSet = new Set(customerToolNames);
|
|
576
|
+
var iso8601UtcDateTimeRegex = /^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$/;
|
|
577
|
+
function isCustomerToolName(value) {
|
|
578
|
+
return customerToolNameSet.has(value);
|
|
579
|
+
}
|
|
580
|
+
function getCustomerToolContract(name) {
|
|
581
|
+
return customerToolContracts[name];
|
|
582
|
+
}
|
|
583
|
+
function resolveCustomerContextSearchInput(value) {
|
|
584
|
+
if (!value.query) {
|
|
585
|
+
return {
|
|
586
|
+
ok: false,
|
|
587
|
+
message: "A query argument is required"
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
const normalizedQuery = value.query.trim();
|
|
591
|
+
if (normalizedQuery.length < 2) {
|
|
592
|
+
return {
|
|
593
|
+
ok: false,
|
|
594
|
+
message: "Query must be at least 2 non-whitespace characters"
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
if (value.after !== void 0 && !iso8601UtcDateTimeRegex.test(value.after)) {
|
|
598
|
+
return {
|
|
599
|
+
ok: false,
|
|
600
|
+
message: "--after must be a valid ISO 8601 datetime"
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
const afterTime = value.after === void 0 ? void 0 : new Date(value.after).getTime();
|
|
604
|
+
if (afterTime !== void 0 && Number.isNaN(afterTime)) {
|
|
605
|
+
return {
|
|
606
|
+
ok: false,
|
|
607
|
+
message: "--after must be a valid ISO 8601 datetime"
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
if (value.before !== void 0 && !iso8601UtcDateTimeRegex.test(value.before)) {
|
|
611
|
+
return {
|
|
612
|
+
ok: false,
|
|
613
|
+
message: "--before must be a valid ISO 8601 datetime"
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
const beforeTime = value.before === void 0 ? void 0 : new Date(value.before).getTime();
|
|
617
|
+
if (beforeTime !== void 0 && Number.isNaN(beforeTime)) {
|
|
618
|
+
return {
|
|
619
|
+
ok: false,
|
|
620
|
+
message: "--before must be a valid ISO 8601 datetime"
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
if (afterTime !== void 0 && beforeTime !== void 0 && afterTime > beforeTime) {
|
|
624
|
+
return {
|
|
625
|
+
ok: false,
|
|
626
|
+
message: "--after must be before or equal to --before"
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
return {
|
|
630
|
+
ok: true,
|
|
631
|
+
request: {
|
|
632
|
+
query: normalizedQuery,
|
|
633
|
+
customer: value.customer,
|
|
634
|
+
topK: value.topK,
|
|
635
|
+
after: value.after,
|
|
636
|
+
before: value.before,
|
|
637
|
+
sourceTypes: value.sourceTypes
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
// src/client.ts
|
|
643
|
+
var DEFAULT_OUTLIT_API_URL = "https://app.outlit.ai";
|
|
644
|
+
function createOutlitClient(options) {
|
|
645
|
+
const key = options.apiKey.trim();
|
|
646
|
+
const baseUrl = options.baseUrl ?? DEFAULT_OUTLIT_API_URL;
|
|
647
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
648
|
+
if (!key) {
|
|
649
|
+
throw new Error("apiKey is required");
|
|
650
|
+
}
|
|
651
|
+
if (!fetchImpl) {
|
|
652
|
+
throw new Error("fetch is not available");
|
|
653
|
+
}
|
|
654
|
+
return {
|
|
655
|
+
key,
|
|
656
|
+
baseUrl,
|
|
657
|
+
async callTool(toolName, input = {}) {
|
|
658
|
+
if (!isCustomerToolName(toolName)) {
|
|
659
|
+
throw new Error(`Unknown customer tool: ${toolName}`);
|
|
660
|
+
}
|
|
661
|
+
const response = await fetchImpl(new URL("/api/tools/call", baseUrl).toString(), {
|
|
662
|
+
method: "POST",
|
|
663
|
+
headers: {
|
|
664
|
+
Authorization: `Bearer ${key}`,
|
|
665
|
+
"Content-Type": "application/json"
|
|
666
|
+
},
|
|
667
|
+
body: JSON.stringify({
|
|
668
|
+
tool: toolName,
|
|
669
|
+
input
|
|
670
|
+
})
|
|
671
|
+
});
|
|
672
|
+
if (!response.ok) {
|
|
673
|
+
const text = await response.text();
|
|
674
|
+
throw new Error(`API error (${response.status}): ${text}`);
|
|
675
|
+
}
|
|
676
|
+
return response.json();
|
|
677
|
+
}
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
// src/toolsets.ts
|
|
682
|
+
var defaultAgentToolNames = [
|
|
683
|
+
"outlit_list_customers",
|
|
684
|
+
"outlit_list_users",
|
|
685
|
+
"outlit_get_customer",
|
|
686
|
+
"outlit_get_timeline",
|
|
687
|
+
"outlit_list_facts",
|
|
688
|
+
"outlit_get_fact",
|
|
689
|
+
"outlit_get_source",
|
|
690
|
+
"outlit_search_customer_context"
|
|
691
|
+
];
|
|
692
|
+
var sqlToolNames = [
|
|
693
|
+
"outlit_schema",
|
|
694
|
+
"outlit_query"
|
|
695
|
+
];
|
|
696
|
+
var allCustomerToolNames = customerToolNames;
|
|
697
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
698
|
+
0 && (module.exports = {
|
|
699
|
+
DEFAULT_OUTLIT_API_URL,
|
|
700
|
+
allCustomerToolNames,
|
|
701
|
+
createOutlitClient,
|
|
702
|
+
customerActivityWindows,
|
|
703
|
+
customerBillingStatuses,
|
|
704
|
+
customerFactIncludes,
|
|
705
|
+
customerFactStatuses,
|
|
706
|
+
customerIncludeSections,
|
|
707
|
+
customerListOrderFields,
|
|
708
|
+
customerSourceTypes,
|
|
709
|
+
customerTimeframes,
|
|
710
|
+
customerToolContractHash,
|
|
711
|
+
customerToolContracts,
|
|
712
|
+
customerToolNames,
|
|
713
|
+
defaultAgentToolNames,
|
|
714
|
+
getCustomerToolContract,
|
|
715
|
+
isCustomerToolName,
|
|
716
|
+
resolveCustomerContextSearchInput,
|
|
717
|
+
schemaTables,
|
|
718
|
+
sqlToolNames,
|
|
719
|
+
timelineChannels,
|
|
720
|
+
timelineTimeframes,
|
|
721
|
+
userJourneyStages,
|
|
722
|
+
userListOrderFields
|
|
723
|
+
});
|
|
724
|
+
//# sourceMappingURL=index.cjs.map
|