@outlit/cli 3.2.4 → 3.2.6

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.
Files changed (2) hide show
  1. package/dist/cli.js +404 -8
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -104,7 +104,7 @@ var package_default;
104
104
  var init_package = __esm(() => {
105
105
  package_default = {
106
106
  name: "@outlit/cli",
107
- version: "3.2.4",
107
+ version: "3.2.6",
108
108
  description: "CLI for querying Outlit customer context and installing agent skills",
109
109
  license: "Apache-2.0",
110
110
  repository: {
@@ -147,7 +147,7 @@ var init_package = __esm(() => {
147
147
  },
148
148
  dependencies: {
149
149
  "@clack/prompts": "^1.0.1",
150
- "@outlit/tools": "^2.2.3",
150
+ "@outlit/tools": "^2.2.5",
151
151
  citty: "^0.2.1"
152
152
  },
153
153
  devDependencies: {
@@ -1715,7 +1715,7 @@ function matchesNumberBounds(value, schema, integer) {
1715
1715
  return false;
1716
1716
  return true;
1717
1717
  }
1718
- var publicToolNames, publicToolContracts, consumerToolPolicies, toolGatewayTransport, apiKeyValidationTransport, apiKeyValidationSuccessSchema, apiKeyValidationFailureSchema, toolGatewayErrorSchema, customerBillingStatuses, customerFactStatuses, customerFactTypes, unsupportedCustomerFactTypes, customerFactCategories, customerIncludeSections, customerSourceTypes, customerSourceTypeAliasMap, customerSourceTypeAliases, customerSourceTypeInputs, customerTimeframes, timelineChannels, timelineTimeframes, userJourneyStages, workspaceUserListOrderFields, publicToolNameSet, customerSourceTypeSet, iso8601UtcDateTimeRegex, DEFAULT_OUTLIT_API_URL = "https://app.outlit.ai", OutlitToolsApiError, defaultToolNames, analyticalToolNames, piToolNames, cliToolNames, defaultToolNameSet, sqlToolNames;
1718
+ var publicToolNames, publicToolContracts, consumerToolPolicies, toolGatewayTransport, apiKeyValidationTransport, apiKeyValidationSuccessSchema, apiKeyValidationFailureSchema, apiKeyContractHeader = "Outlit-Api-Key-Contract", apiKeyValidationSuccessSchemaV2, toolGatewayErrorSchema, customerBillingStatuses, customerFactStatuses, customerFactTypes, unsupportedCustomerFactTypes, customerFactCategories, customerIncludeSections, customerSourceTypes, customerSourceTypeAliasMap, customerSourceTypeAliases, customerSourceTypeInputs, customerTimeframes, timelineChannels, timelineTimeframes, userJourneyStages, workspaceUserListOrderFields, publicToolNameSet, customerSourceTypeSet, iso8601UtcDateTimeRegex, DEFAULT_OUTLIT_API_URL = "https://app.outlit.ai", OutlitToolsApiError, defaultToolNames, analyticalToolNames, piToolNames, cliToolNames, defaultToolNameSet, sqlToolNames;
1719
1719
  var init_dist4 = __esm(() => {
1720
1720
  publicToolNames = [
1721
1721
  "outlit_list_customers",
@@ -2103,7 +2103,7 @@ var init_dist4 = __esm(() => {
2103
2103
  commandVersion: 1,
2104
2104
  ownerDomain: "users",
2105
2105
  title: "List Users",
2106
- 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.",
2106
+ 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 and each user's sources: where Outlit found them (CRM, support tool, product analytics, Slack) and the calls, meetings, emails, tickets and Slack threads they took part in.",
2107
2107
  annotations: {
2108
2108
  readOnlyHint: true,
2109
2109
  destructiveHint: false
@@ -2284,6 +2284,77 @@ var init_dist4 = __esm(() => {
2284
2284
  }
2285
2285
  ]
2286
2286
  },
2287
+ sources: {
2288
+ type: "array",
2289
+ items: {
2290
+ type: "object",
2291
+ properties: {
2292
+ system: {
2293
+ type: "string",
2294
+ description: "Lowercase id of the system, such as hubspot, salesforce, attio, pylon, posthog, slack, stripe, google-mail, google-calendar, ergo, fireflies, gong, mixpanel, outlit (the Outlit SDK) or product-analytics (a product-analytics provider Outlit did not record)."
2295
+ },
2296
+ kind: {
2297
+ type: "string",
2298
+ enum: [
2299
+ "contact",
2300
+ "product_user",
2301
+ "chat_member",
2302
+ "billing_customer",
2303
+ "call",
2304
+ "meeting",
2305
+ "email",
2306
+ "support_ticket",
2307
+ "slack_thread"
2308
+ ],
2309
+ description: "Records: contact (a contact in a CRM or support tool), product_user (a user in product analytics or product sign-in), chat_member (a Slack member), billing_customer. Conversations the person took part in: call, meeting, email, support_ticket, slack_thread."
2310
+ },
2311
+ count: {
2312
+ anyOf: [
2313
+ {
2314
+ type: "integer",
2315
+ minimum: 1,
2316
+ maximum: 9007199254740991
2317
+ },
2318
+ {
2319
+ type: "null"
2320
+ }
2321
+ ],
2322
+ description: "How many conversations of this kind; null for records."
2323
+ },
2324
+ firstSeenAt: {
2325
+ anyOf: [
2326
+ {
2327
+ type: "string"
2328
+ },
2329
+ {
2330
+ type: "null"
2331
+ }
2332
+ ],
2333
+ description: "When the record was created in the system (or first linked to this person), or the first conversation."
2334
+ },
2335
+ lastSeenAt: {
2336
+ anyOf: [
2337
+ {
2338
+ type: "string"
2339
+ },
2340
+ {
2341
+ type: "null"
2342
+ }
2343
+ ],
2344
+ description: "The latest conversation; null for records."
2345
+ }
2346
+ },
2347
+ required: [
2348
+ "system",
2349
+ "kind",
2350
+ "count",
2351
+ "firstSeenAt",
2352
+ "lastSeenAt"
2353
+ ],
2354
+ additionalProperties: false
2355
+ },
2356
+ description: "Where Outlit found this person: the systems that hold a record of them and the conversations they took part in. Empty when Outlit has no source recorded; absent from servers that predate it."
2357
+ },
2287
2358
  relationshipRole: {
2288
2359
  anyOf: [
2289
2360
  {
@@ -2578,7 +2649,7 @@ var init_dist4 = __esm(() => {
2578
2649
  commandVersion: 1,
2579
2650
  ownerDomain: "customers",
2580
2651
  title: "Get Customer",
2581
- description: "Get full details for a single customer. Optionally include users, revenue, recent activity, engagement metrics, or company enrichment. Revenue amounts (currentMrr, lifetimeRevenue) are in the billing provider's units for the customer's currency, which the result doesn't name. For USD, EUR, GBP and CAD these are cents: divide by 100 (e.g. 1234500 is $12,345, USD). Other currencies follow the provider's amount rules. ARR is 12 × currentMrr in the same units.",
2652
+ description: "Get full details for a single customer. Optionally include users (each with their sources: where Outlit found them and the conversations they took part in), revenue, recent activity, engagement metrics, or company enrichment. Revenue amounts (currentMrr, lifetimeRevenue) are in the billing provider's units for the customer's currency, which the result doesn't name. For USD, EUR, GBP and CAD these are cents: divide by 100 (e.g. 1234500 is $12,345, USD). Other currencies follow the provider's amount rules. ARR is 12 × currentMrr in the same units.",
2582
2653
  annotations: {
2583
2654
  readOnlyHint: true,
2584
2655
  destructiveHint: false
@@ -2781,6 +2852,77 @@ var init_dist4 = __esm(() => {
2781
2852
  }
2782
2853
  ]
2783
2854
  },
2855
+ sources: {
2856
+ type: "array",
2857
+ items: {
2858
+ type: "object",
2859
+ properties: {
2860
+ system: {
2861
+ type: "string",
2862
+ description: "Lowercase id of the system, such as hubspot, salesforce, attio, pylon, posthog, slack, stripe, google-mail, google-calendar, ergo, fireflies, gong, mixpanel, outlit (the Outlit SDK) or product-analytics (a product-analytics provider Outlit did not record)."
2863
+ },
2864
+ kind: {
2865
+ type: "string",
2866
+ enum: [
2867
+ "contact",
2868
+ "product_user",
2869
+ "chat_member",
2870
+ "billing_customer",
2871
+ "call",
2872
+ "meeting",
2873
+ "email",
2874
+ "support_ticket",
2875
+ "slack_thread"
2876
+ ],
2877
+ description: "Records: contact (a contact in a CRM or support tool), product_user (a user in product analytics or product sign-in), chat_member (a Slack member), billing_customer. Conversations the person took part in: call, meeting, email, support_ticket, slack_thread."
2878
+ },
2879
+ count: {
2880
+ anyOf: [
2881
+ {
2882
+ type: "integer",
2883
+ minimum: 1,
2884
+ maximum: 9007199254740991
2885
+ },
2886
+ {
2887
+ type: "null"
2888
+ }
2889
+ ],
2890
+ description: "How many conversations of this kind; null for records."
2891
+ },
2892
+ firstSeenAt: {
2893
+ anyOf: [
2894
+ {
2895
+ type: "string"
2896
+ },
2897
+ {
2898
+ type: "null"
2899
+ }
2900
+ ],
2901
+ description: "When the record was created in the system (or first linked to this person), or the first conversation."
2902
+ },
2903
+ lastSeenAt: {
2904
+ anyOf: [
2905
+ {
2906
+ type: "string"
2907
+ },
2908
+ {
2909
+ type: "null"
2910
+ }
2911
+ ],
2912
+ description: "The latest conversation; null for records."
2913
+ }
2914
+ },
2915
+ required: [
2916
+ "system",
2917
+ "kind",
2918
+ "count",
2919
+ "firstSeenAt",
2920
+ "lastSeenAt"
2921
+ ],
2922
+ additionalProperties: false
2923
+ },
2924
+ description: "Where Outlit found this person: the systems that hold a record of them and the conversations they took part in. Empty when Outlit has no source recorded; absent from servers that predate it."
2925
+ },
2784
2926
  relationshipRole: {
2785
2927
  anyOf: [
2786
2928
  {
@@ -17774,6 +17916,226 @@ Returns column definitions and example queries for each view.`,
17774
17916
  ],
17775
17917
  additionalProperties: false
17776
17918
  };
17919
+ apiKeyValidationSuccessSchemaV2 = {
17920
+ $schema: "https://json-schema.org/draft/2020-12/schema",
17921
+ type: "object",
17922
+ properties: {
17923
+ valid: {
17924
+ type: "boolean",
17925
+ const: true
17926
+ },
17927
+ organizationId: {
17928
+ type: "string"
17929
+ },
17930
+ createdById: {
17931
+ anyOf: [
17932
+ {
17933
+ type: "string"
17934
+ },
17935
+ {
17936
+ type: "null"
17937
+ }
17938
+ ]
17939
+ },
17940
+ organization: {
17941
+ type: "object",
17942
+ properties: {
17943
+ id: {
17944
+ type: "string"
17945
+ },
17946
+ name: {
17947
+ anyOf: [
17948
+ {
17949
+ type: "string"
17950
+ },
17951
+ {
17952
+ type: "null"
17953
+ }
17954
+ ]
17955
+ },
17956
+ slug: {
17957
+ anyOf: [
17958
+ {
17959
+ type: "string"
17960
+ },
17961
+ {
17962
+ type: "null"
17963
+ }
17964
+ ]
17965
+ }
17966
+ },
17967
+ required: [
17968
+ "id",
17969
+ "name",
17970
+ "slug"
17971
+ ],
17972
+ additionalProperties: false
17973
+ },
17974
+ createdBy: {
17975
+ anyOf: [
17976
+ {
17977
+ type: "object",
17978
+ properties: {
17979
+ id: {
17980
+ type: "string"
17981
+ },
17982
+ email: {
17983
+ type: "string"
17984
+ },
17985
+ name: {
17986
+ anyOf: [
17987
+ {
17988
+ type: "string"
17989
+ },
17990
+ {
17991
+ type: "null"
17992
+ }
17993
+ ]
17994
+ }
17995
+ },
17996
+ required: [
17997
+ "id",
17998
+ "email",
17999
+ "name"
18000
+ ],
18001
+ additionalProperties: false
18002
+ },
18003
+ {
18004
+ type: "null"
18005
+ }
18006
+ ]
18007
+ },
18008
+ apiKey: {
18009
+ type: "object",
18010
+ properties: {
18011
+ id: {
18012
+ type: "string"
18013
+ },
18014
+ name: {
18015
+ type: "string"
18016
+ },
18017
+ prefix: {
18018
+ type: "string"
18019
+ },
18020
+ keyType: {
18021
+ type: "string",
18022
+ enum: [
18023
+ "api",
18024
+ "cli",
18025
+ "mcp",
18026
+ "ci"
18027
+ ]
18028
+ },
18029
+ grants: {
18030
+ type: "array",
18031
+ items: {
18032
+ type: "string",
18033
+ enum: [
18034
+ "customer_intelligence:read",
18035
+ "workspace_members:read",
18036
+ "analytics:read",
18037
+ "destinations:manage",
18038
+ "behavior_metrics:manage",
18039
+ "integrations:connect_own",
18040
+ "integrations:manage",
18041
+ "activation:read",
18042
+ "activation:manage",
18043
+ "workspace_settings:read",
18044
+ "workspace_settings:manage",
18045
+ "customer_access:manage",
18046
+ "customer_identity:review",
18047
+ "customer_identity:merge"
18048
+ ]
18049
+ }
18050
+ },
18051
+ createdAt: {
18052
+ type: "string",
18053
+ format: "date-time",
18054
+ 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))$"
18055
+ },
18056
+ lastUsedAt: {
18057
+ anyOf: [
18058
+ {
18059
+ type: "string",
18060
+ format: "date-time",
18061
+ 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))$"
18062
+ },
18063
+ {
18064
+ type: "null"
18065
+ }
18066
+ ]
18067
+ },
18068
+ totalRequests: {
18069
+ type: "integer",
18070
+ minimum: 0,
18071
+ maximum: 9007199254740991
18072
+ },
18073
+ expiresAt: {
18074
+ anyOf: [
18075
+ {
18076
+ type: "string",
18077
+ format: "date-time",
18078
+ 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))$"
18079
+ },
18080
+ {
18081
+ type: "null"
18082
+ }
18083
+ ]
18084
+ }
18085
+ },
18086
+ required: [
18087
+ "id",
18088
+ "name",
18089
+ "prefix",
18090
+ "keyType",
18091
+ "grants",
18092
+ "createdAt",
18093
+ "lastUsedAt",
18094
+ "totalRequests",
18095
+ "expiresAt"
18096
+ ],
18097
+ additionalProperties: false
18098
+ },
18099
+ authorization: {
18100
+ type: "object",
18101
+ properties: {
18102
+ grants: {
18103
+ type: "array",
18104
+ items: {
18105
+ type: "string",
18106
+ enum: [
18107
+ "customer_intelligence:read",
18108
+ "workspace_members:read",
18109
+ "analytics:read",
18110
+ "destinations:manage",
18111
+ "behavior_metrics:manage",
18112
+ "integrations:connect_own",
18113
+ "integrations:manage",
18114
+ "activation:read",
18115
+ "activation:manage",
18116
+ "workspace_settings:read",
18117
+ "workspace_settings:manage",
18118
+ "customer_access:manage",
18119
+ "customer_identity:review",
18120
+ "customer_identity:merge"
18121
+ ]
18122
+ }
18123
+ }
18124
+ },
18125
+ required: [
18126
+ "grants"
18127
+ ],
18128
+ additionalProperties: false
18129
+ }
18130
+ },
18131
+ required: [
18132
+ "valid",
18133
+ "organizationId",
18134
+ "createdById",
18135
+ "authorization"
18136
+ ],
18137
+ additionalProperties: false
18138
+ };
17777
18139
  toolGatewayErrorSchema = {
17778
18140
  $schema: "https://json-schema.org/draft/2020-12/schema",
17779
18141
  type: "object",
@@ -18060,6 +18422,33 @@ var init_client = __esm(() => {
18060
18422
  cliToolNameSet = new Set(cliToolNames);
18061
18423
  });
18062
18424
 
18425
+ // src/lib/key-expiry.ts
18426
+ function keyExpiryWarning(expiresAt, now = new Date) {
18427
+ if (!expiresAt)
18428
+ return null;
18429
+ const remainingMs = Date.parse(expiresAt) - now.getTime();
18430
+ if (Number.isNaN(remainingMs) || remainingMs <= 0)
18431
+ return null;
18432
+ if (remainingMs > KEY_EXPIRY_WARNING_DAYS * DAY_MS)
18433
+ return null;
18434
+ const days = Math.max(1, Math.ceil(remainingMs / DAY_MS));
18435
+ return `Warning: your Outlit API key expires in ${days} day${days === 1 ? "" : "s"}. Run \`outlit login\` to get a new one.
18436
+ `;
18437
+ }
18438
+ function warnIfKeyExpiresSoon(expiresAt) {
18439
+ if (warned)
18440
+ return;
18441
+ const warning = keyExpiryWarning(expiresAt);
18442
+ if (!warning)
18443
+ return;
18444
+ warned = true;
18445
+ process.stderr.write(warning);
18446
+ }
18447
+ var KEY_EXPIRY_WARNING_DAYS = 14, DAY_MS, warned = false;
18448
+ var init_key_expiry = __esm(() => {
18449
+ DAY_MS = 24 * 60 * 60 * 1000;
18450
+ });
18451
+
18063
18452
  // src/lib/spinner.ts
18064
18453
  function createSpinner(message) {
18065
18454
  if (!isInteractive()) {
@@ -18194,7 +18583,8 @@ async function pingApiKey(apiKey) {
18194
18583
  const response = await globalThis.fetch(url, {
18195
18584
  method: apiKeyValidationTransport.method,
18196
18585
  headers: {
18197
- Authorization: `Bearer ${apiKey}`
18586
+ Authorization: `Bearer ${apiKey}`,
18587
+ [apiKeyContractHeader]: "2"
18198
18588
  }
18199
18589
  });
18200
18590
  const text = await response.text();
@@ -18209,8 +18599,13 @@ async function pingApiKey(apiKey) {
18209
18599
  const message2 = matchesGeneratedJsonSchema(payload, apiKeyValidationFailureSchema) ? payload.error : undefined;
18210
18600
  throw new ApiKeyValidationUnavailableError(message2);
18211
18601
  }
18212
- if (response.status === apiKeyValidationTransport.responseStatuses.success && matchesGeneratedJsonSchema(payload, apiKeyValidationSuccessSchema)) {
18213
- return payload;
18602
+ if (response.status === apiKeyValidationTransport.responseStatuses.success) {
18603
+ if (matchesGeneratedJsonSchema(payload, apiKeyValidationSuccessSchemaV2)) {
18604
+ warnIfKeyExpiresSoon(payload.apiKey?.expiresAt);
18605
+ return payload;
18606
+ }
18607
+ if (matchesGeneratedJsonSchema(payload, apiKeyValidationSuccessSchema))
18608
+ return payload;
18214
18609
  }
18215
18610
  const message = matchesGeneratedJsonSchema(payload, apiKeyValidationFailureSchema) ? payload.error : text.length > 0 ? text : `API error (${response.status})`;
18216
18611
  if (!response.ok || response.status === apiKeyValidationTransport.responseStatuses.invalid) {
@@ -18302,6 +18697,7 @@ var init_api = __esm(() => {
18302
18697
  init_dist4();
18303
18698
  init_client();
18304
18699
  init_config();
18700
+ init_key_expiry();
18305
18701
  init_output();
18306
18702
  init_spinner();
18307
18703
  init_table();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outlit/cli",
3
- "version": "3.2.4",
3
+ "version": "3.2.6",
4
4
  "description": "CLI for querying Outlit customer context and installing agent skills",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@clack/prompts": "^1.0.1",
46
- "@outlit/tools": "^2.2.3",
46
+ "@outlit/tools": "^2.2.5",
47
47
  "citty": "^0.2.1"
48
48
  },
49
49
  "devDependencies": {