@anuma/sdk 6.24.0 → 6.24.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.
@@ -19459,6 +19459,7 @@ function createDurableAutoExtractor(options) {
19459
19459
  }
19460
19460
  async function extractBatch(messages, conversationId, ids, jobScope, jobFolderId) {
19461
19461
  let watchdog;
19462
+ const model = options.modelForScope?.(jobScope) ?? options.extract.model;
19462
19463
  try {
19463
19464
  return await Promise.race([
19464
19465
  new Promise((resolve, reject) => {
@@ -19471,6 +19472,8 @@ function createDurableAutoExtractor(options) {
19471
19472
  canWrite: async () => !disposed && await storage.conversationsCollection.query(import_watermelondb12.Q.where("conversation_id", conversationId), import_watermelondb12.Q.where("is_deleted", false)).fetchCount() > 0 && await storage.messagesCollection.query(import_watermelondb12.Q.where("conversation_id", conversationId), import_watermelondb12.Q.where("id", import_watermelondb12.Q.oneOf(ids))).fetchCount() === ids.length && (!vault.canWrite || await vault.canWrite()) && !disposed
19472
19473
  }
19473
19474
  },
19475
+ // The model follows the job's scope, not the mode alive at drain time.
19476
+ extract: { ...options.extract, ...model !== void 0 && { model } },
19474
19477
  // Never publish a private queued observation after a mode flip.
19475
19478
  scope: jobScope,
19476
19479
  folderId: jobFolderId,
@@ -9459,6 +9459,16 @@ interface DurableAutoExtractorOptions extends Omit<CreateAutoExtractorOptions, "
9459
9459
  * as `"private"` — the direction that cannot publish.
9460
9460
  */
9461
9461
  scope?: string | (() => string);
9462
+ /**
9463
+ * Extraction model for a batch, chosen from the scope that batch will be
9464
+ * retained under. A queued job keeps its scope across a privacy-mode flip but
9465
+ * `extract.model` is whatever this instance was built with, so without this a
9466
+ * turn queued in private mode is drained by a public-mode extractor on that
9467
+ * extractor's model. Returning `undefined` keeps `extract.model`. A resolver
9468
+ * that throws fails the batch, which stays queued for retry: guessing a model
9469
+ * is exactly the mistake this exists to prevent.
9470
+ */
9471
+ modelForScope?: (scope: string) => string | undefined;
9462
9472
  /** Coalesce arrivals after durably recording them. Defaults to 20 seconds. */
9463
9473
  debounceMs?: number;
9464
9474
  /** Retry delay for a failed batch. Defaults to 30 seconds; max three attempts
@@ -9459,6 +9459,16 @@ interface DurableAutoExtractorOptions extends Omit<CreateAutoExtractorOptions, "
9459
9459
  * as `"private"` — the direction that cannot publish.
9460
9460
  */
9461
9461
  scope?: string | (() => string);
9462
+ /**
9463
+ * Extraction model for a batch, chosen from the scope that batch will be
9464
+ * retained under. A queued job keeps its scope across a privacy-mode flip but
9465
+ * `extract.model` is whatever this instance was built with, so without this a
9466
+ * turn queued in private mode is drained by a public-mode extractor on that
9467
+ * extractor's model. Returning `undefined` keeps `extract.model`. A resolver
9468
+ * that throws fails the batch, which stays queued for retry: guessing a model
9469
+ * is exactly the mistake this exists to prevent.
9470
+ */
9471
+ modelForScope?: (scope: string) => string | undefined;
9462
9472
  /** Coalesce arrivals after durably recording them. Defaults to 20 seconds. */
9463
9473
  debounceMs?: number;
9464
9474
  /** Retry delay for a failed batch. Defaults to 30 seconds; max three attempts
@@ -9529,6 +9529,7 @@ function createDurableAutoExtractor(options) {
9529
9529
  }
9530
9530
  async function extractBatch(messages, conversationId, ids, jobScope, jobFolderId) {
9531
9531
  let watchdog;
9532
+ const model = options.modelForScope?.(jobScope) ?? options.extract.model;
9532
9533
  try {
9533
9534
  return await Promise.race([
9534
9535
  new Promise((resolve, reject) => {
@@ -9541,6 +9542,8 @@ function createDurableAutoExtractor(options) {
9541
9542
  canWrite: async () => !disposed && await storage.conversationsCollection.query(Q4.where("conversation_id", conversationId), Q4.where("is_deleted", false)).fetchCount() > 0 && await storage.messagesCollection.query(Q4.where("conversation_id", conversationId), Q4.where("id", Q4.oneOf(ids))).fetchCount() === ids.length && (!vault.canWrite || await vault.canWrite()) && !disposed
9542
9543
  }
9543
9544
  },
9545
+ // The model follows the job's scope, not the mode alive at drain time.
9546
+ extract: { ...options.extract, ...model !== void 0 && { model } },
9544
9547
  // Never publish a private queued observation after a mode flip.
9545
9548
  scope: jobScope,
9546
9549
  folderId: jobFolderId,
@@ -20763,6 +20763,7 @@ function createDurableAutoExtractor(options) {
20763
20763
  }
20764
20764
  async function extractBatch(messages, conversationId, ids, jobScope, jobFolderId) {
20765
20765
  let watchdog;
20766
+ const model = options.modelForScope?.(jobScope) ?? options.extract.model;
20766
20767
  try {
20767
20768
  return await Promise.race([
20768
20769
  new Promise((resolve, reject) => {
@@ -20775,6 +20776,8 @@ function createDurableAutoExtractor(options) {
20775
20776
  canWrite: async () => !disposed && await storage.conversationsCollection.query(import_watermelondb13.Q.where("conversation_id", conversationId), import_watermelondb13.Q.where("is_deleted", false)).fetchCount() > 0 && await storage.messagesCollection.query(import_watermelondb13.Q.where("conversation_id", conversationId), import_watermelondb13.Q.where("id", import_watermelondb13.Q.oneOf(ids))).fetchCount() === ids.length && (!vault.canWrite || await vault.canWrite()) && !disposed
20776
20777
  }
20777
20778
  },
20779
+ // The model follows the job's scope, not the mode alive at drain time.
20780
+ extract: { ...options.extract, ...model !== void 0 && { model } },
20778
20781
  // Never publish a private queued observation after a mode flip.
20779
20782
  scope: jobScope,
20780
20783
  folderId: jobFolderId,
@@ -10694,6 +10694,16 @@ interface DurableAutoExtractorOptions extends Omit<CreateAutoExtractorOptions, "
10694
10694
  * as `"private"` — the direction that cannot publish.
10695
10695
  */
10696
10696
  scope?: string | (() => string);
10697
+ /**
10698
+ * Extraction model for a batch, chosen from the scope that batch will be
10699
+ * retained under. A queued job keeps its scope across a privacy-mode flip but
10700
+ * `extract.model` is whatever this instance was built with, so without this a
10701
+ * turn queued in private mode is drained by a public-mode extractor on that
10702
+ * extractor's model. Returning `undefined` keeps `extract.model`. A resolver
10703
+ * that throws fails the batch, which stays queued for retry: guessing a model
10704
+ * is exactly the mistake this exists to prevent.
10705
+ */
10706
+ modelForScope?: (scope: string) => string | undefined;
10697
10707
  /** Coalesce arrivals after durably recording them. Defaults to 20 seconds. */
10698
10708
  debounceMs?: number;
10699
10709
  /** Retry delay for a failed batch. Defaults to 30 seconds; max three attempts
@@ -10694,6 +10694,16 @@ interface DurableAutoExtractorOptions extends Omit<CreateAutoExtractorOptions, "
10694
10694
  * as `"private"` — the direction that cannot publish.
10695
10695
  */
10696
10696
  scope?: string | (() => string);
10697
+ /**
10698
+ * Extraction model for a batch, chosen from the scope that batch will be
10699
+ * retained under. A queued job keeps its scope across a privacy-mode flip but
10700
+ * `extract.model` is whatever this instance was built with, so without this a
10701
+ * turn queued in private mode is drained by a public-mode extractor on that
10702
+ * extractor's model. Returning `undefined` keeps `extract.model`. A resolver
10703
+ * that throws fails the batch, which stays queued for retry: guessing a model
10704
+ * is exactly the mistake this exists to prevent.
10705
+ */
10706
+ modelForScope?: (scope: string) => string | undefined;
10697
10707
  /** Coalesce arrivals after durably recording them. Defaults to 20 seconds. */
10698
10708
  debounceMs?: number;
10699
10709
  /** Retry delay for a failed batch. Defaults to 30 seconds; max three attempts
@@ -10347,6 +10347,7 @@ function createDurableAutoExtractor(options) {
10347
10347
  }
10348
10348
  async function extractBatch(messages, conversationId, ids, jobScope, jobFolderId) {
10349
10349
  let watchdog;
10350
+ const model = options.modelForScope?.(jobScope) ?? options.extract.model;
10350
10351
  try {
10351
10352
  return await Promise.race([
10352
10353
  new Promise((resolve, reject) => {
@@ -10359,6 +10360,8 @@ function createDurableAutoExtractor(options) {
10359
10360
  canWrite: async () => !disposed && await storage.conversationsCollection.query(Q5.where("conversation_id", conversationId), Q5.where("is_deleted", false)).fetchCount() > 0 && await storage.messagesCollection.query(Q5.where("conversation_id", conversationId), Q5.where("id", Q5.oneOf(ids))).fetchCount() === ids.length && (!vault.canWrite || await vault.canWrite()) && !disposed
10360
10361
  }
10361
10362
  },
10363
+ // The model follows the job's scope, not the mode alive at drain time.
10364
+ extract: { ...options.extract, ...model !== void 0 && { model } },
10362
10365
  // Never publish a private queued observation after a mode flip.
10363
10366
  scope: jobScope,
10364
10367
  folderId: jobFolderId,
@@ -32401,6 +32401,7 @@ function createDurableAutoExtractor(options) {
32401
32401
  }
32402
32402
  async function extractBatch(messages, conversationId, ids, jobScope, jobFolderId) {
32403
32403
  let watchdog;
32404
+ const model = options.modelForScope?.(jobScope) ?? options.extract.model;
32404
32405
  try {
32405
32406
  return await Promise.race([
32406
32407
  new Promise((resolve, reject) => {
@@ -32413,6 +32414,8 @@ function createDurableAutoExtractor(options) {
32413
32414
  canWrite: async () => !disposed && await storage.conversationsCollection.query(import_watermelondb24.Q.where("conversation_id", conversationId), import_watermelondb24.Q.where("is_deleted", false)).fetchCount() > 0 && await storage.messagesCollection.query(import_watermelondb24.Q.where("conversation_id", conversationId), import_watermelondb24.Q.where("id", import_watermelondb24.Q.oneOf(ids))).fetchCount() === ids.length && (!vault.canWrite || await vault.canWrite()) && !disposed
32414
32415
  }
32415
32416
  },
32417
+ // The model follows the job's scope, not the mode alive at drain time.
32418
+ extract: { ...options.extract, ...model !== void 0 && { model } },
32416
32419
  // Never publish a private queued observation after a mode flip.
32417
32420
  scope: jobScope,
32418
32421
  folderId: jobFolderId,
@@ -10031,6 +10031,16 @@ interface DurableAutoExtractorOptions extends Omit<CreateAutoExtractorOptions, "
10031
10031
  * as `"private"` — the direction that cannot publish.
10032
10032
  */
10033
10033
  scope?: string | (() => string);
10034
+ /**
10035
+ * Extraction model for a batch, chosen from the scope that batch will be
10036
+ * retained under. A queued job keeps its scope across a privacy-mode flip but
10037
+ * `extract.model` is whatever this instance was built with, so without this a
10038
+ * turn queued in private mode is drained by a public-mode extractor on that
10039
+ * extractor's model. Returning `undefined` keeps `extract.model`. A resolver
10040
+ * that throws fails the batch, which stays queued for retry: guessing a model
10041
+ * is exactly the mistake this exists to prevent.
10042
+ */
10043
+ modelForScope?: (scope: string) => string | undefined;
10034
10044
  /** Coalesce arrivals after durably recording them. Defaults to 20 seconds. */
10035
10045
  debounceMs?: number;
10036
10046
  /** Retry delay for a failed batch. Defaults to 30 seconds; max three attempts
@@ -10031,6 +10031,16 @@ interface DurableAutoExtractorOptions extends Omit<CreateAutoExtractorOptions, "
10031
10031
  * as `"private"` — the direction that cannot publish.
10032
10032
  */
10033
10033
  scope?: string | (() => string);
10034
+ /**
10035
+ * Extraction model for a batch, chosen from the scope that batch will be
10036
+ * retained under. A queued job keeps its scope across a privacy-mode flip but
10037
+ * `extract.model` is whatever this instance was built with, so without this a
10038
+ * turn queued in private mode is drained by a public-mode extractor on that
10039
+ * extractor's model. Returning `undefined` keeps `extract.model`. A resolver
10040
+ * that throws fails the batch, which stays queued for retry: guessing a model
10041
+ * is exactly the mistake this exists to prevent.
10042
+ */
10043
+ modelForScope?: (scope: string) => string | undefined;
10034
10044
  /** Coalesce arrivals after durably recording them. Defaults to 20 seconds. */
10035
10045
  debounceMs?: number;
10036
10046
  /** Retry delay for a failed batch. Defaults to 30 seconds; max three attempts
@@ -8412,6 +8412,7 @@ function createDurableAutoExtractor(options) {
8412
8412
  }
8413
8413
  async function extractBatch(messages, conversationId, ids, jobScope, jobFolderId) {
8414
8414
  let watchdog;
8415
+ const model = options.modelForScope?.(jobScope) ?? options.extract.model;
8415
8416
  try {
8416
8417
  return await Promise.race([
8417
8418
  new Promise((resolve, reject) => {
@@ -8424,6 +8425,8 @@ function createDurableAutoExtractor(options) {
8424
8425
  canWrite: async () => !disposed && await storage.conversationsCollection.query(import_watermelondb20.Q.where("conversation_id", conversationId), import_watermelondb20.Q.where("is_deleted", false)).fetchCount() > 0 && await storage.messagesCollection.query(import_watermelondb20.Q.where("conversation_id", conversationId), import_watermelondb20.Q.where("id", import_watermelondb20.Q.oneOf(ids))).fetchCount() === ids.length && (!vault.canWrite || await vault.canWrite()) && !disposed
8425
8426
  }
8426
8427
  },
8428
+ // The model follows the job's scope, not the mode alive at drain time.
8429
+ extract: { ...options.extract, ...model !== void 0 && { model } },
8427
8430
  // Never publish a private queued observation after a mode flip.
8428
8431
  scope: jobScope,
8429
8432
  folderId: jobFolderId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anuma/sdk",
3
- "version": "6.24.0",
3
+ "version": "6.24.1",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",