@outlit/cli 1.6.4 → 1.7.0

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 +136 -51
  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: "1.6.4",
107
+ version: "1.7.0",
108
108
  description: "CLI for Outlit customer intelligence platform",
109
109
  license: "Apache-2.0",
110
110
  repository: {
@@ -135,7 +135,7 @@ var init_package = __esm(() => {
135
135
  },
136
136
  dependencies: {
137
137
  "@clack/prompts": "^1.0.1",
138
- "@outlit/tools": "^0.1.3",
138
+ "@outlit/tools": "^0.2.0",
139
139
  citty: "^0.2.1"
140
140
  },
141
141
  devDependencies: {
@@ -1494,11 +1494,11 @@ function isCustomerToolName(value) {
1494
1494
  return customerToolNameSet.has(value);
1495
1495
  }
1496
1496
  function normalizeCustomerSourceType(value) {
1497
- const normalizedValue = value.trim().toUpperCase();
1498
- if (customerSourceTypeSet.has(normalizedValue)) {
1499
- return normalizedValue;
1497
+ const normalized = value.trim().toUpperCase();
1498
+ if (customerSourceTypeSet.has(normalized)) {
1499
+ return normalized;
1500
1500
  }
1501
- return customerSourceTypeAliasMap.get(normalizedValue) ?? null;
1501
+ return customerSourceTypeAliasMap.get(normalized) ?? null;
1502
1502
  }
1503
1503
  function resolveCustomerContextSearchInput(value) {
1504
1504
  if (!value.query) {
@@ -1602,7 +1602,7 @@ function createOutlitClient(options) {
1602
1602
  }
1603
1603
  };
1604
1604
  }
1605
- var customerToolNames, customerSourceTypes, customerSourceTypeAliases, customerSourceTypeInputs, customerToolContracts, customerBillingStatuses, customerFactStatuses, customerFactTypes, unsupportedCustomerFactTypes, customerFactCategories, customerIncludeSections, customerTimeframes, notificationSeverityValues, timelineChannels, timelineTimeframes, userJourneyStages, customerToolNameSet, customerSourceTypeSet, customerSourceTypeAliasMap, iso8601UtcDateTimeRegex, DEFAULT_OUTLIT_API_URL = "https://app.outlit.ai", actionToolNames, defaultAgentToolNames, sqlToolNames, analyticalAgentToolNames;
1605
+ var customerToolNames, customerSourceTypes, customerSourceTypeAliases, customerSourceTypeInputs, notificationProviderValues, customerToolContracts, customerBillingStatuses, customerFactStatuses, customerFactTypes, unsupportedCustomerFactTypes, customerFactCategories, customerIncludeSections, customerTimeframes, notificationSeverityValues, timelineChannels, timelineTimeframes, userJourneyStages, customerToolNameSet, customerSourceTypeSet, customerSourceTypeAliasMap, iso8601UtcDateTimeRegex, DEFAULT_OUTLIT_API_URL = "https://app.outlit.ai", actionToolNames, defaultAgentToolNames, sqlToolNames, analyticalAgentToolNames;
1606
1606
  var init_dist4 = __esm(() => {
1607
1607
  customerToolNames = [
1608
1608
  "outlit_list_customers",
@@ -1634,6 +1634,7 @@ var init_dist4 = __esm(() => {
1634
1634
  "CRM",
1635
1635
  "CRM_OPPORTUNITY"
1636
1636
  ];
1637
+ notificationProviderValues = ["slack"];
1637
1638
  customerToolContracts = {
1638
1639
  outlit_list_customers: {
1639
1640
  toolName: "outlit_list_customers",
@@ -2154,7 +2155,7 @@ Returns column definitions and example queries for each view.`,
2154
2155
  },
2155
2156
  outlit_send_notification: {
2156
2157
  toolName: "outlit_send_notification",
2157
- description: "Send or post a Slack notification. Use only when the user explicitly asks you to send, post, or notify. The payload is rendered as a Slack code block.",
2158
+ description: "Send or post a notification. Use only when the user explicitly asks you to send, post, or notify. Slack is the default notifier when destinations are omitted.",
2158
2159
  inputSchema: {
2159
2160
  $schema: "https://json-schema.org/draft/2020-12/schema",
2160
2161
  type: "object",
@@ -2165,41 +2166,18 @@ Returns column definitions and example queries for each view.`,
2165
2166
  maxLength: 160,
2166
2167
  description: "Notification title"
2167
2168
  },
2169
+ markdown: {
2170
+ description: "Markdown notification body rendered for the target provider",
2171
+ type: "string",
2172
+ minLength: 1,
2173
+ maxLength: 1e5
2174
+ },
2168
2175
  payload: {
2169
- description: "JSON-compatible payload rendered in Slack as a code block. Serialized size must be 100,000 characters or fewer.",
2170
- anyOf: [
2171
- {
2172
- type: "string"
2173
- },
2174
- {
2175
- type: "number"
2176
- },
2177
- {
2178
- type: "boolean"
2179
- },
2180
- {
2181
- type: "null"
2182
- },
2183
- {
2184
- type: "array",
2185
- items: {
2186
- $ref: "#/$defs/__schema0"
2187
- }
2188
- },
2189
- {
2190
- type: "object",
2191
- propertyNames: {
2192
- type: "string"
2193
- },
2194
- additionalProperties: {
2195
- $ref: "#/$defs/__schema0"
2196
- }
2197
- }
2198
- ],
2176
+ description: "Optional JSON-compatible payload. Serialized size must be 100,000 characters or fewer.",
2199
2177
  $ref: "#/$defs/__schema0"
2200
2178
  },
2201
2179
  message: {
2202
- description: "Optional Slack message",
2180
+ description: "Optional summary message",
2203
2181
  type: "string",
2204
2182
  minLength: 1,
2205
2183
  maxLength: 1200
@@ -2220,9 +2198,39 @@ Returns column definitions and example queries for each view.`,
2220
2198
  type: "string",
2221
2199
  minLength: 1,
2222
2200
  maxLength: 240
2201
+ },
2202
+ destinations: {
2203
+ description: "Optional explicit notification destinations. Omit to use the default notifier.",
2204
+ minItems: 1,
2205
+ maxItems: 10,
2206
+ type: "array",
2207
+ items: {
2208
+ type: "object",
2209
+ properties: {
2210
+ provider: {
2211
+ description: "Notification provider",
2212
+ type: "string",
2213
+ enum: notificationProviderValues
2214
+ },
2215
+ channelId: {
2216
+ description: "Provider-specific destination channel ID",
2217
+ type: "string",
2218
+ minLength: 1,
2219
+ maxLength: 240
2220
+ },
2221
+ label: {
2222
+ description: "Optional destination label",
2223
+ type: "string",
2224
+ minLength: 1,
2225
+ maxLength: 120
2226
+ }
2227
+ },
2228
+ required: ["provider"],
2229
+ additionalProperties: false
2230
+ }
2223
2231
  }
2224
2232
  },
2225
- required: ["title", "payload"],
2233
+ required: ["title"],
2226
2234
  additionalProperties: false,
2227
2235
  $defs: {
2228
2236
  __schema0: {
@@ -5162,7 +5170,33 @@ function payloadSizeIsValid(payload) {
5162
5170
  const serialized = JSON.stringify(payload);
5163
5171
  return typeof serialized === "string" && serialized.length <= 1e5;
5164
5172
  }
5165
- var notify_default;
5173
+ function parseDestinations(raw) {
5174
+ if (raw === undefined) {
5175
+ return;
5176
+ }
5177
+ const destinations = raw.split(",").map((entry) => entry.trim());
5178
+ if (destinations.length > MAX_DESTINATION_COUNT || destinations.some((entry) => entry.length === 0)) {
5179
+ return null;
5180
+ }
5181
+ const parsed = [];
5182
+ for (const destination of destinations) {
5183
+ const [providerInput, ...channelParts] = destination.split(":");
5184
+ const provider = providerInput?.trim().toLowerCase();
5185
+ const channelId = channelParts.join(":").trim();
5186
+ if (!notificationProviderValues.includes(provider)) {
5187
+ return null;
5188
+ }
5189
+ if (channelId.length > MAX_DESTINATION_CHANNEL_ID_LENGTH) {
5190
+ return null;
5191
+ }
5192
+ parsed.push({
5193
+ provider,
5194
+ ...channelId.length > 0 ? { channelId } : {}
5195
+ });
5196
+ }
5197
+ return parsed;
5198
+ }
5199
+ var MAX_DESTINATION_COUNT = 10, MAX_DESTINATION_CHANNEL_ID_LENGTH = 240, notify_default;
5166
5200
  var init_notify = __esm(() => {
5167
5201
  init_dist4();
5168
5202
  init_dist();
@@ -5174,14 +5208,16 @@ var init_notify = __esm(() => {
5174
5208
  meta: {
5175
5209
  name: "notify",
5176
5210
  description: [
5177
- "Send a Slack notification through Outlit.",
5211
+ "Send a notification through Outlit to the organization's configured notifier.",
5178
5212
  "",
5179
- "Provide the payload as a positional argument or via --payload-file.",
5180
- "When both are provided, --payload-file takes precedence.",
5213
+ "Use --markdown or --markdown-file for the human-readable body; Outlit renders it for the destination platform.",
5214
+ "Add a JSON or raw payload when useful for structured context. When --destination is omitted, Outlit uses the default notifier.",
5181
5215
  "",
5182
5216
  "Examples:",
5217
+ " outlit notify --title 'Risk found' --markdown '**Risk found**\\n\\n- Customer: acme.com'",
5183
5218
  ` outlit notify --title 'Risk found' '{"customer":"acme.com"}'`,
5184
5219
  " outlit notify --title 'Risk found' --payload-file ./payload.json",
5220
+ " outlit notify --title 'Escalation' --markdown '**Check this account**' --destination slack:C123",
5185
5221
  ` outlit notify --title 'Escalation' --severity HIGH --message 'Check this account' '{"customer":"acme.com"}'`,
5186
5222
  "",
5187
5223
  AGENT_JSON_HINT
@@ -5205,9 +5241,17 @@ var init_notify = __esm(() => {
5205
5241
  type: "string",
5206
5242
  description: "Path to a payload file to read (takes precedence over positional payload)"
5207
5243
  },
5244
+ markdown: {
5245
+ type: "string",
5246
+ description: "Markdown body rendered for the destination platform."
5247
+ },
5248
+ "markdown-file": {
5249
+ type: "string",
5250
+ description: "Path to a markdown file to render for the destination platform."
5251
+ },
5208
5252
  message: {
5209
5253
  type: "string",
5210
- description: "Optional Slack message"
5254
+ description: "Optional summary message"
5211
5255
  },
5212
5256
  severity: {
5213
5257
  type: "string",
@@ -5220,6 +5264,10 @@ var init_notify = __esm(() => {
5220
5264
  subject: {
5221
5265
  type: "string",
5222
5266
  description: "Optional subject line"
5267
+ },
5268
+ destination: {
5269
+ type: "string",
5270
+ description: "Optional comma-separated destinations in provider[:channelId] form. Supported provider: slack"
5223
5271
  }
5224
5272
  },
5225
5273
  async run({ args }) {
@@ -5234,6 +5282,24 @@ var init_notify = __esm(() => {
5234
5282
  code: "invalid_input"
5235
5283
  }, json);
5236
5284
  }
5285
+ let markdownInput = args.markdown;
5286
+ if (args["markdown-file"]) {
5287
+ try {
5288
+ markdownInput = readFileSync5(args["markdown-file"], "utf-8");
5289
+ } catch (err) {
5290
+ return outputError({
5291
+ message: `Cannot read markdown file: ${errorMessage(err, "unknown error")}`,
5292
+ code: "file_error"
5293
+ }, json);
5294
+ }
5295
+ }
5296
+ const markdown = validateTrimmedText(markdownInput, 1e5);
5297
+ if (markdown === null) {
5298
+ return outputError({
5299
+ message: "--markdown must be between 1 and 100000 characters after trimming",
5300
+ code: "invalid_input"
5301
+ }, json);
5302
+ }
5237
5303
  const message = validateTrimmedText(args.message, 1200);
5238
5304
  if (message === null) {
5239
5305
  return outputError({
@@ -5266,6 +5332,13 @@ var init_notify = __esm(() => {
5266
5332
  }
5267
5333
  severity = normalized;
5268
5334
  }
5335
+ const destinations = parseDestinations(args.destination);
5336
+ if (destinations === null) {
5337
+ return outputError({
5338
+ message: `--destination must use provider[:channelId] with provider one of: ${notificationProviderValues.join(", ")}`,
5339
+ code: "invalid_input"
5340
+ }, json);
5341
+ }
5269
5342
  let payloadInput;
5270
5343
  if (args["payload-file"]) {
5271
5344
  try {
@@ -5278,11 +5351,15 @@ var init_notify = __esm(() => {
5278
5351
  }
5279
5352
  } else if (typeof args.payload === "string" && args.payload.trim().length > 0) {
5280
5353
  payloadInput = args.payload;
5281
- } else {
5282
- return outputError({ message: "Provide a payload or --payload-file", code: "missing_input" }, json);
5283
5354
  }
5284
- const payload = parsePayload(payloadInput);
5285
- if (!payloadSizeIsValid(payload)) {
5355
+ if (!payloadInput && markdown === undefined) {
5356
+ return outputError({
5357
+ message: "Provide --markdown, --markdown-file, a payload, or --payload-file",
5358
+ code: "missing_input"
5359
+ }, json);
5360
+ }
5361
+ const payload = payloadInput === undefined ? undefined : parsePayload(payloadInput);
5362
+ if (payload !== undefined && !payloadSizeIsValid(payload)) {
5286
5363
  return outputError({
5287
5364
  message: "Payload must serialize to 100000 characters or fewer",
5288
5365
  code: "invalid_input"
@@ -5290,9 +5367,14 @@ var init_notify = __esm(() => {
5290
5367
  }
5291
5368
  const client = await getClientOrExit(args["api-key"], json);
5292
5369
  const params = {
5293
- title,
5294
- payload
5370
+ title
5295
5371
  };
5372
+ if (markdown !== undefined) {
5373
+ params.markdown = markdown;
5374
+ }
5375
+ if (payload !== undefined) {
5376
+ params.payload = payload;
5377
+ }
5296
5378
  if (message !== undefined) {
5297
5379
  params.message = message;
5298
5380
  }
@@ -5305,6 +5387,9 @@ var init_notify = __esm(() => {
5305
5387
  if (subject !== undefined) {
5306
5388
  params.subject = subject;
5307
5389
  }
5390
+ if (destinations !== undefined) {
5391
+ params.destinations = destinations;
5392
+ }
5308
5393
  return runTool(client, customerToolContracts.outlit_send_notification.toolName, params, json);
5309
5394
  }
5310
5395
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outlit/cli",
3
- "version": "1.6.4",
3
+ "version": "1.7.0",
4
4
  "description": "CLI for Outlit customer intelligence platform",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@clack/prompts": "^1.0.1",
34
- "@outlit/tools": "^0.1.3",
34
+ "@outlit/tools": "^0.2.0",
35
35
  "citty": "^0.2.1"
36
36
  },
37
37
  "devDependencies": {