deepline 0.2.39 → 0.2.41

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.d.mts CHANGED
@@ -1170,6 +1170,57 @@ interface PlayListItem {
1170
1170
  currentRevision?: PlayRevisionSummary | null;
1171
1171
  liveRevision?: PlayRevisionSummary | null;
1172
1172
  aliases?: string[];
1173
+ triggerStatus?: {
1174
+ cron: string | null;
1175
+ webhook: string | null;
1176
+ blockedReason: string | null;
1177
+ };
1178
+ }
1179
+ interface ProductNotificationEventDefinition {
1180
+ id: string;
1181
+ label: string;
1182
+ description: string;
1183
+ source: 'cron' | 'webhook';
1184
+ outcome: 'succeeded' | 'failed';
1185
+ defaultEnabled: boolean;
1186
+ }
1187
+ interface ProductNotificationSettings {
1188
+ contractVersion: number;
1189
+ catalog: ProductNotificationEventDefinition[];
1190
+ notifications?: ProductNotification[];
1191
+ providers?: Array<{
1192
+ kind: string;
1193
+ targetLabel: string;
1194
+ }>;
1195
+ destinations: Array<Record<string, unknown>>;
1196
+ subscriptions: Array<{
1197
+ eventType: string;
1198
+ enabled: boolean;
1199
+ destinationId: string;
1200
+ }>;
1201
+ dlq: {
1202
+ count: number;
1203
+ capped: boolean;
1204
+ };
1205
+ slackConnection?: {
1206
+ connected: boolean;
1207
+ status: string;
1208
+ };
1209
+ }
1210
+ interface ProductNotification {
1211
+ id: string;
1212
+ name: string;
1213
+ provider: string;
1214
+ target: {
1215
+ id: string;
1216
+ name: string;
1217
+ };
1218
+ enabled: boolean;
1219
+ status: string;
1220
+ eventTypes: string[];
1221
+ lastTestedAt?: number;
1222
+ lastTestStatus?: string;
1223
+ lastErrorMessage?: string;
1173
1224
  }
1174
1225
  interface PlayDescription {
1175
1226
  name: string;
@@ -3119,6 +3170,88 @@ declare class DeeplineClient {
3119
3170
  grep?: string;
3120
3171
  grepMode?: 'all' | 'any' | 'phrase';
3121
3172
  }): Promise<PlayListItem[]>;
3173
+ /** Read product-notification destinations, subscriptions, event catalog, and DLQ health. */
3174
+ getNotificationSettings(): Promise<ProductNotificationSettings>;
3175
+ /** Start the Slack OAuth flow required by product notifications. */
3176
+ connectNotificationSlack(options?: {
3177
+ successUrl?: string;
3178
+ failureUrl?: string;
3179
+ }): Promise<{
3180
+ ok: boolean;
3181
+ redirect_url: string;
3182
+ }>;
3183
+ /** List Slack channels visible to the connected Deepline Slack app. */
3184
+ listNotificationSlackChannels(query?: string): Promise<{
3185
+ identity: {
3186
+ teamId: string;
3187
+ teamName?: string;
3188
+ };
3189
+ channels: Array<{
3190
+ id: string;
3191
+ name: string;
3192
+ isPrivate: boolean;
3193
+ }>;
3194
+ }>;
3195
+ /** Select the Slack channel used for product notifications. */
3196
+ setNotificationSlack(channel: string): Promise<unknown>;
3197
+ /** Send one synchronous test ping and return Slack's delivery result. */
3198
+ testNotificationSlack(): Promise<{
3199
+ ok: boolean;
3200
+ deliveryId: string;
3201
+ state: string;
3202
+ message: string;
3203
+ }>;
3204
+ /** Disable Slack product notifications without deleting the OAuth connection. */
3205
+ disableNotificationSlack(): Promise<unknown>;
3206
+ /** Enable or disable event IDs from the server-provided notification catalog. */
3207
+ setNotificationSubscriptions(eventTypes: string[], enabled: boolean): Promise<unknown>;
3208
+ /** List exhausted deliveries. Dead-lettered messages never replay automatically. */
3209
+ listNotificationDlq(limit?: number): Promise<unknown>;
3210
+ /** Inspect one exhausted notification delivery. */
3211
+ getNotificationDlqDelivery(deliveryId: string): Promise<unknown>;
3212
+ /** Explicitly retry or archive one dead-lettered notification delivery. */
3213
+ updateNotificationDlqDelivery(deliveryId: string, action: 'retry' | 'archive'): Promise<unknown>;
3214
+ /** List the workspace's named notification rules. */
3215
+ getNotifications(): Promise<ProductNotificationSettings>;
3216
+ /** List Slack channels available to an already-connected Slack integration. */
3217
+ listNotificationChannels(query?: string): Promise<{
3218
+ identity: {
3219
+ teamId: string;
3220
+ teamName?: string;
3221
+ };
3222
+ channels: Array<{
3223
+ id: string;
3224
+ name: string;
3225
+ isPrivate: boolean;
3226
+ }>;
3227
+ }>;
3228
+ /** Create a named notification routed through an existing provider integration. */
3229
+ createNotification(input: {
3230
+ name: string;
3231
+ provider: 'slack';
3232
+ channel: string;
3233
+ eventTypes: string[];
3234
+ }): Promise<unknown>;
3235
+ /** Update a notification's target, event selection, or enabled state. */
3236
+ updateNotification(notificationId: string, input: {
3237
+ enabled: boolean;
3238
+ } | {
3239
+ name: string;
3240
+ channel: string;
3241
+ eventTypes: string[];
3242
+ }): Promise<unknown>;
3243
+ /** Send a validation ping to one notification. */
3244
+ testNotification(notificationId: string): Promise<{
3245
+ ok: boolean;
3246
+ deliveryId: string;
3247
+ state: string;
3248
+ message: string;
3249
+ }>;
3250
+ /** Archive one notification without touching its provider integration. */
3251
+ deleteNotification(notificationId: string): Promise<{
3252
+ deleted: boolean;
3253
+ id: string;
3254
+ }>;
3122
3255
  /**
3123
3256
  * Search callable plays and return compact play descriptions.
3124
3257
  *
package/dist/index.d.ts CHANGED
@@ -1170,6 +1170,57 @@ interface PlayListItem {
1170
1170
  currentRevision?: PlayRevisionSummary | null;
1171
1171
  liveRevision?: PlayRevisionSummary | null;
1172
1172
  aliases?: string[];
1173
+ triggerStatus?: {
1174
+ cron: string | null;
1175
+ webhook: string | null;
1176
+ blockedReason: string | null;
1177
+ };
1178
+ }
1179
+ interface ProductNotificationEventDefinition {
1180
+ id: string;
1181
+ label: string;
1182
+ description: string;
1183
+ source: 'cron' | 'webhook';
1184
+ outcome: 'succeeded' | 'failed';
1185
+ defaultEnabled: boolean;
1186
+ }
1187
+ interface ProductNotificationSettings {
1188
+ contractVersion: number;
1189
+ catalog: ProductNotificationEventDefinition[];
1190
+ notifications?: ProductNotification[];
1191
+ providers?: Array<{
1192
+ kind: string;
1193
+ targetLabel: string;
1194
+ }>;
1195
+ destinations: Array<Record<string, unknown>>;
1196
+ subscriptions: Array<{
1197
+ eventType: string;
1198
+ enabled: boolean;
1199
+ destinationId: string;
1200
+ }>;
1201
+ dlq: {
1202
+ count: number;
1203
+ capped: boolean;
1204
+ };
1205
+ slackConnection?: {
1206
+ connected: boolean;
1207
+ status: string;
1208
+ };
1209
+ }
1210
+ interface ProductNotification {
1211
+ id: string;
1212
+ name: string;
1213
+ provider: string;
1214
+ target: {
1215
+ id: string;
1216
+ name: string;
1217
+ };
1218
+ enabled: boolean;
1219
+ status: string;
1220
+ eventTypes: string[];
1221
+ lastTestedAt?: number;
1222
+ lastTestStatus?: string;
1223
+ lastErrorMessage?: string;
1173
1224
  }
1174
1225
  interface PlayDescription {
1175
1226
  name: string;
@@ -3119,6 +3170,88 @@ declare class DeeplineClient {
3119
3170
  grep?: string;
3120
3171
  grepMode?: 'all' | 'any' | 'phrase';
3121
3172
  }): Promise<PlayListItem[]>;
3173
+ /** Read product-notification destinations, subscriptions, event catalog, and DLQ health. */
3174
+ getNotificationSettings(): Promise<ProductNotificationSettings>;
3175
+ /** Start the Slack OAuth flow required by product notifications. */
3176
+ connectNotificationSlack(options?: {
3177
+ successUrl?: string;
3178
+ failureUrl?: string;
3179
+ }): Promise<{
3180
+ ok: boolean;
3181
+ redirect_url: string;
3182
+ }>;
3183
+ /** List Slack channels visible to the connected Deepline Slack app. */
3184
+ listNotificationSlackChannels(query?: string): Promise<{
3185
+ identity: {
3186
+ teamId: string;
3187
+ teamName?: string;
3188
+ };
3189
+ channels: Array<{
3190
+ id: string;
3191
+ name: string;
3192
+ isPrivate: boolean;
3193
+ }>;
3194
+ }>;
3195
+ /** Select the Slack channel used for product notifications. */
3196
+ setNotificationSlack(channel: string): Promise<unknown>;
3197
+ /** Send one synchronous test ping and return Slack's delivery result. */
3198
+ testNotificationSlack(): Promise<{
3199
+ ok: boolean;
3200
+ deliveryId: string;
3201
+ state: string;
3202
+ message: string;
3203
+ }>;
3204
+ /** Disable Slack product notifications without deleting the OAuth connection. */
3205
+ disableNotificationSlack(): Promise<unknown>;
3206
+ /** Enable or disable event IDs from the server-provided notification catalog. */
3207
+ setNotificationSubscriptions(eventTypes: string[], enabled: boolean): Promise<unknown>;
3208
+ /** List exhausted deliveries. Dead-lettered messages never replay automatically. */
3209
+ listNotificationDlq(limit?: number): Promise<unknown>;
3210
+ /** Inspect one exhausted notification delivery. */
3211
+ getNotificationDlqDelivery(deliveryId: string): Promise<unknown>;
3212
+ /** Explicitly retry or archive one dead-lettered notification delivery. */
3213
+ updateNotificationDlqDelivery(deliveryId: string, action: 'retry' | 'archive'): Promise<unknown>;
3214
+ /** List the workspace's named notification rules. */
3215
+ getNotifications(): Promise<ProductNotificationSettings>;
3216
+ /** List Slack channels available to an already-connected Slack integration. */
3217
+ listNotificationChannels(query?: string): Promise<{
3218
+ identity: {
3219
+ teamId: string;
3220
+ teamName?: string;
3221
+ };
3222
+ channels: Array<{
3223
+ id: string;
3224
+ name: string;
3225
+ isPrivate: boolean;
3226
+ }>;
3227
+ }>;
3228
+ /** Create a named notification routed through an existing provider integration. */
3229
+ createNotification(input: {
3230
+ name: string;
3231
+ provider: 'slack';
3232
+ channel: string;
3233
+ eventTypes: string[];
3234
+ }): Promise<unknown>;
3235
+ /** Update a notification's target, event selection, or enabled state. */
3236
+ updateNotification(notificationId: string, input: {
3237
+ enabled: boolean;
3238
+ } | {
3239
+ name: string;
3240
+ channel: string;
3241
+ eventTypes: string[];
3242
+ }): Promise<unknown>;
3243
+ /** Send a validation ping to one notification. */
3244
+ testNotification(notificationId: string): Promise<{
3245
+ ok: boolean;
3246
+ deliveryId: string;
3247
+ state: string;
3248
+ message: string;
3249
+ }>;
3250
+ /** Archive one notification without touching its provider integration. */
3251
+ deleteNotification(notificationId: string): Promise<{
3252
+ deleted: boolean;
3253
+ id: string;
3254
+ }>;
3122
3255
  /**
3123
3256
  * Search callable plays and return compact play descriptions.
3124
3257
  *
package/dist/index.js CHANGED
@@ -763,7 +763,7 @@ var SDK_RELEASE = {
763
763
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
764
764
  // exposed storage-dependent synchronous access. This deliberate minor
765
765
  // release keeps lazy paging semantics independent of row residency.
766
- version: "0.2.39",
766
+ version: "0.2.41",
767
767
  contracts: {
768
768
  api: {
769
769
  name: "sdk-http-api",
@@ -1391,6 +1391,9 @@ var HttpClient = class {
1391
1391
  headers
1392
1392
  });
1393
1393
  }
1394
+ async put(path, body, headers) {
1395
+ return this.request(path, { method: "PUT", body, headers });
1396
+ }
1394
1397
  /**
1395
1398
  * Send a DELETE request.
1396
1399
  *
@@ -1541,6 +1544,61 @@ function withCoworkNetworkHint(message) {
1541
1544
  ${COWORK_NETWORK_HINT}`;
1542
1545
  }
1543
1546
 
1547
+ // ../shared_libs/product-notifications/contract.ts
1548
+ var PRODUCT_NOTIFICATION_EVENT_CATALOG = [
1549
+ {
1550
+ id: "play.cron.succeeded",
1551
+ label: "Cron success",
1552
+ description: "A scheduled Play run completed successfully.",
1553
+ source: "cron",
1554
+ outcome: "succeeded",
1555
+ defaultEnabled: true
1556
+ },
1557
+ {
1558
+ id: "play.cron.failed",
1559
+ label: "Cron failure",
1560
+ description: "A scheduled Play could not start or its run reached a failed terminal state.",
1561
+ source: "cron",
1562
+ outcome: "failed",
1563
+ defaultEnabled: true
1564
+ },
1565
+ {
1566
+ id: "play.webhook.succeeded",
1567
+ label: "Webhook success",
1568
+ description: "An accepted webhook-triggered Play completed successfully.",
1569
+ source: "webhook",
1570
+ outcome: "succeeded",
1571
+ defaultEnabled: true
1572
+ },
1573
+ {
1574
+ id: "play.webhook.failed",
1575
+ label: "Webhook failure",
1576
+ description: "An accepted webhook-triggered Play reached a failed terminal state.",
1577
+ source: "webhook",
1578
+ outcome: "failed",
1579
+ defaultEnabled: true
1580
+ }
1581
+ ];
1582
+ var PRODUCT_NOTIFICATION_EVENT_TYPE_SET = new Set(
1583
+ PRODUCT_NOTIFICATION_EVENT_CATALOG.map((event) => event.id)
1584
+ );
1585
+ var PRODUCT_NOTIFICATION_SLACK_OAUTH_SCOPES = [
1586
+ "channels:read",
1587
+ "chat:write",
1588
+ "groups:read"
1589
+ ];
1590
+ var PRODUCT_NOTIFICATION_RETRY_DELAYS_MS = [
1591
+ 0,
1592
+ 6e4,
1593
+ 5 * 6e4,
1594
+ 15 * 6e4,
1595
+ 60 * 6e4
1596
+ ];
1597
+ var PRODUCT_NOTIFICATION_MAX_ATTEMPTS = PRODUCT_NOTIFICATION_RETRY_DELAYS_MS.length;
1598
+ var PRODUCT_NOTIFICATION_DELIVERY_LEASE_MS = 2 * 6e4;
1599
+ var PRODUCT_NOTIFICATION_SUCCESS_TTL_MS = 15 * 6e4;
1600
+ var PRODUCT_NOTIFICATION_FAILURE_TTL_MS = 24 * 60 * 6e4;
1601
+
1544
1602
  // src/stream-reconnect.ts
1545
1603
  var STREAM_RECONNECT_BASE_DELAY_MS = 500;
1546
1604
  var STREAM_RECONNECT_MAX_DELAY_MS = 15e3;
@@ -2933,6 +2991,7 @@ async function* observeRunEvents(options) {
2933
2991
  // ../shared_libs/integrations/theirstack-execution-policy.ts
2934
2992
  var THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS = 135e3;
2935
2993
  var THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS = 6e4 + THEIRSTACK_SLOW_JOB_SEARCH_PROVIDER_TIMEOUT_MS + 15e3;
2994
+ var THEIRSTACK_COMPANY_SEARCH_CLIENT_TIMEOUT_MS = 21e4;
2936
2995
  var LONG_JOB_SEARCH_WINDOW_MS = 365 * 24 * 60 * 60 * 1e3;
2937
2996
  var DATE_ONLY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
2938
2997
  function parseDateOnly(value) {
@@ -2976,6 +3035,12 @@ function usesExtendedTheirstackJobSearchBudget(endpointId, payload) {
2976
3035
  const maxAgeDays = parseMaxAgeDays(payload.posted_at_max_age_days);
2977
3036
  return maxAgeDays !== null && maxAgeDays >= 365 ? true : usesLongExplicitDateWindow(payload);
2978
3037
  }
3038
+ function resolveTheirstackClientTimeoutMs(endpointId, payload) {
3039
+ if (endpointId === "theirstack_company_search") {
3040
+ return THEIRSTACK_COMPANY_SEARCH_CLIENT_TIMEOUT_MS;
3041
+ }
3042
+ return usesExtendedTheirstackJobSearchBudget(endpointId, payload) ? THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS : null;
3043
+ }
2979
3044
 
2980
3045
  // ../shared_libs/play-runtime/backend.ts
2981
3046
  var PLAY_RUNTIME_BACKENDS = {
@@ -3222,9 +3287,11 @@ function resolveToolExecuteTimeoutMs(toolId, input) {
3222
3287
  return Math.floor(requestedTimeoutMs) + APIFY_SYNC_RESPONSE_GRACE_MS;
3223
3288
  }
3224
3289
  }
3225
- if (usesExtendedTheirstackJobSearchBudget(normalized, input)) {
3226
- return THEIRSTACK_SLOW_JOB_SEARCH_CLIENT_TIMEOUT_MS;
3227
- }
3290
+ const theirstackTimeoutMs = resolveTheirstackClientTimeoutMs(
3291
+ normalized,
3292
+ input
3293
+ );
3294
+ if (theirstackTimeoutMs !== null) return theirstackTimeoutMs;
3228
3295
  return normalized === "deeplineagent" || normalized === "deeplineagent_deeplineagent" || normalized === "ai_inference" || normalized === "deeplineagent_ai_inference" || normalized === "aiinference" ? DEEPLINEAGENT_EXECUTE_TIMEOUT_MS : void 0;
3229
3296
  }
3230
3297
  var RUNS_FAILED_LOG_LIMIT = 20;
@@ -5097,6 +5164,95 @@ var DeeplineClient = class {
5097
5164
  );
5098
5165
  return response.plays ?? [];
5099
5166
  }
5167
+ /** Read product-notification destinations, subscriptions, event catalog, and DLQ health. */
5168
+ async getNotificationSettings() {
5169
+ return this.http.get("/api/v2/settings/notifications");
5170
+ }
5171
+ /** Start the Slack OAuth flow required by product notifications. */
5172
+ async connectNotificationSlack(options) {
5173
+ return this.http.post("/api/v2/integrations/connect", {
5174
+ provider: "slack",
5175
+ scopes: [...PRODUCT_NOTIFICATION_SLACK_OAUTH_SCOPES],
5176
+ ...options?.successUrl ? { success_url: options.successUrl } : {},
5177
+ ...options?.failureUrl ? { failure_url: options.failureUrl } : {}
5178
+ });
5179
+ }
5180
+ /** List Slack channels visible to the connected Deepline Slack app. */
5181
+ async listNotificationSlackChannels(query) {
5182
+ const suffix = query ? `?query=${encodeURIComponent(query)}` : "";
5183
+ return this.http.get(`/api/v2/settings/notifications/channels${suffix}`);
5184
+ }
5185
+ /** Select the Slack channel used for product notifications. */
5186
+ async setNotificationSlack(channel) {
5187
+ return this.http.put("/api/v2/settings/notifications", { channel });
5188
+ }
5189
+ /** Send one synchronous test ping and return Slack's delivery result. */
5190
+ async testNotificationSlack() {
5191
+ return this.http.post("/api/v2/settings/notifications/test", {});
5192
+ }
5193
+ /** Disable Slack product notifications without deleting the OAuth connection. */
5194
+ async disableNotificationSlack() {
5195
+ return this.http.delete("/api/v2/settings/notifications");
5196
+ }
5197
+ /** Enable or disable event IDs from the server-provided notification catalog. */
5198
+ async setNotificationSubscriptions(eventTypes, enabled) {
5199
+ return this.http.patch("/api/v2/settings/notifications/subscriptions", {
5200
+ eventTypes,
5201
+ enabled
5202
+ });
5203
+ }
5204
+ /** List exhausted deliveries. Dead-lettered messages never replay automatically. */
5205
+ async listNotificationDlq(limit = 25) {
5206
+ return this.http.get(
5207
+ `/api/v2/settings/notifications/dlq?limit=${encodeURIComponent(String(limit))}`
5208
+ );
5209
+ }
5210
+ /** Inspect one exhausted notification delivery. */
5211
+ async getNotificationDlqDelivery(deliveryId) {
5212
+ return this.http.get(
5213
+ `/api/v2/settings/notifications/dlq/${encodeURIComponent(deliveryId)}`
5214
+ );
5215
+ }
5216
+ /** Explicitly retry or archive one dead-lettered notification delivery. */
5217
+ async updateNotificationDlqDelivery(deliveryId, action) {
5218
+ return this.http.post(
5219
+ `/api/v2/settings/notifications/dlq/${encodeURIComponent(deliveryId)}`,
5220
+ { action }
5221
+ );
5222
+ }
5223
+ /** List the workspace's named notification rules. */
5224
+ async getNotifications() {
5225
+ return this.http.get("/api/v2/notifications");
5226
+ }
5227
+ /** List Slack channels available to an already-connected Slack integration. */
5228
+ async listNotificationChannels(query) {
5229
+ const suffix = query ? `?search=${encodeURIComponent(query)}` : "";
5230
+ return this.http.get(`/api/v2/notifications/slack/channels${suffix}`);
5231
+ }
5232
+ /** Create a named notification routed through an existing provider integration. */
5233
+ async createNotification(input) {
5234
+ return this.http.post("/api/v2/notifications", input);
5235
+ }
5236
+ /** Update a notification's target, event selection, or enabled state. */
5237
+ async updateNotification(notificationId, input) {
5238
+ return this.http.patch(
5239
+ `/api/v2/notifications/${encodeURIComponent(notificationId)}`,
5240
+ input
5241
+ );
5242
+ }
5243
+ /** Send a validation ping to one notification. */
5244
+ async testNotification(notificationId) {
5245
+ return this.http.post(
5246
+ `/api/v2/notifications/${encodeURIComponent(notificationId)}/test`,
5247
+ {}
5248
+ );
5249
+ }
5250
+ /** Archive one notification without touching its provider integration. */
5251
+ async deleteNotification(notificationId) {
5252
+ return this.http.delete(
5253
+ `/api/v2/notifications/${encodeURIComponent(notificationId)}`
5254
+ );
5255
+ }
5100
5256
  /**
5101
5257
  * Search callable plays and return compact play descriptions.
5102
5258
  *