@badger_badger/badger_hq 1.6.0 → 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # badger_hq
2
2
 
3
+ ## 1.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e85a4c8: Monitor tasks as a batch of sources.
8
+
9
+ - `AgentTaskSchema.sources` (`AgentTaskSourceSchema[]`, default `[]`): the sources attached to a Monitor task other than its `target` — `{ platform, url, label? }`, http(s) only, no internal source id.
10
+ Each also carries `lastCapturedAt?`, `dueAt?` (under current urgency; absent when parked) and `accessProblem?`.
11
+ - `AgentAssignmentVersionSchema.sourcesUpdatedAt?`: the latest change to a Monitor task's attached sources, so a visit refreshes agents without bumping the task version.
12
+ - `MONITOR_TASK_MAX_SOURCES` (20): the most sources one Monitor task may have attached (enforced by hero-service).
13
+ - `Source.visitIntervalMs?`: the activity-based wait set by the last visit, before urgency.
14
+ - Source schedule helpers (pure, browser-safe): `effectiveDueAt` applies current urgency (`URGENCY_FACTOR`: emergency ×0.5; mission priority critical ×0.5, high ×0.75, medium ×1, low ×1.5) to the base interval, clamped to 1–72 h; `effectiveInterval` (that interval, for `overdueLevel`); `overdueLevel` (`none` / `late` / `missed` after one more interval; `OverdueLevelSchema`); `baseVisitInterval`, `urgencyFactor`, `clampInterval`.
15
+ A source without `visitIntervalMs` (scheduled before it existed) falls back to its last `nextVisitAt − lastCollectedAt` gap, which already includes the urgency of that visit and is not scaled again.
16
+ - Sources index `{ orgId, taskIds }` (multikey): the sources attached to a task.
17
+
18
+ Wire-compatible: existing documents and payloads still parse. The inferred `AgentTask` type now always has `sources`, so code that builds `AgentTask` objects must set it (`[]` when none).
19
+
3
20
  ## 1.6.0
4
21
 
5
22
  ### Minor Changes
@@ -2415,6 +2415,8 @@ declare const SourceSchema: z.ZodObject<{
2415
2415
  }>;
2416
2416
  lastCollectedAt: z.ZodOptional<z.ZodDate>;
2417
2417
  nextVisitAt: z.ZodOptional<z.ZodDate>;
2418
+ /** Activity-based wait set by the last visit, before current urgency (see `effectiveDueAt`). */
2419
+ visitIntervalMs: z.ZodOptional<z.ZodNumber>;
2418
2420
  } & {
2419
2421
  createdAt: z.ZodDate;
2420
2422
  updatedAt: z.ZodDate;
@@ -2450,6 +2452,7 @@ declare const SourceSchema: z.ZodObject<{
2450
2452
  } | undefined;
2451
2453
  lastCollectedAt?: Date | undefined;
2452
2454
  nextVisitAt?: Date | undefined;
2455
+ visitIntervalMs?: number | undefined;
2453
2456
  }, {
2454
2457
  type: "channel" | "group" | "profile" | "forum" | "site";
2455
2458
  createdAt: Date;
@@ -2480,6 +2483,7 @@ declare const SourceSchema: z.ZodObject<{
2480
2483
  } | undefined;
2481
2484
  lastCollectedAt?: Date | undefined;
2482
2485
  nextVisitAt?: Date | undefined;
2486
+ visitIntervalMs?: number | undefined;
2483
2487
  }>;
2484
2488
  declare const SourceCreateSchema: z.ZodObject<Omit<{
2485
2489
  _id: z.ZodString;
@@ -2524,12 +2528,14 @@ declare const SourceCreateSchema: z.ZodObject<Omit<{
2524
2528
  }>;
2525
2529
  lastCollectedAt: z.ZodOptional<z.ZodDate>;
2526
2530
  nextVisitAt: z.ZodOptional<z.ZodDate>;
2531
+ /** Activity-based wait set by the last visit, before current urgency (see `effectiveDueAt`). */
2532
+ visitIntervalMs: z.ZodOptional<z.ZodNumber>;
2527
2533
  } & {
2528
2534
  createdAt: z.ZodDate;
2529
2535
  updatedAt: z.ZodDate;
2530
2536
  } & {
2531
2537
  deletedAt: z.ZodOptional<z.ZodDate>;
2532
- }, "createdAt" | "updatedAt" | "deletedAt" | "_id" | "orgId" | "databaseId" | "discoveredBy" | "lastCollectedAt">, "strip", z.ZodTypeAny, {
2538
+ }, "createdAt" | "updatedAt" | "deletedAt" | "_id" | "orgId" | "databaseId" | "discoveredBy" | "lastCollectedAt" | "visitIntervalMs">, "strip", z.ZodTypeAny, {
2533
2539
  type: "channel" | "group" | "profile" | "forum" | "site";
2534
2540
  status: "active" | "paused" | "closed" | "access_problem";
2535
2541
  platform: "telegram" | "facebook" | "x" | "tiktok" | "instagram" | "youtube" | "whatsapp" | "reddit" | "discord" | "linkedin" | "threads" | "vk" | "snapchat" | "web";
@@ -5811,4 +5817,4 @@ type LlmCall = z.infer<typeof LlmCallSchema>;
5811
5817
  type LlmCallCreate = z.infer<typeof LlmCallCreateSchema>;
5812
5818
  type LlmCallCreateInput = z.input<typeof LlmCallCreateSchema>;
5813
5819
 
5814
- export { type AuditLogCreate as $, ACCESS_ISSUE_VALUES as A, AgentSessionMode as B, AgentSessionSchema as C, type AgentSessionStats as D, AgentSessionStatsSchema as E, AgentSessionStatus as F, type AgentSessionUpdate as G, AgentSessionUpdateSchema as H, AgentSourceOutcome as I, type AnalystProfile as J, AnalystProfileSchema as K, type AnalystProfileUpdate as L, type AnalystProfileUpdateInput as M, AnalystProfileUpdateSchema as N, type AssigneeLoad as O, AssigneeLoadSchema as P, AssigneeType as Q, type Assignment as R, type AssignmentCreate as S, type AssignmentCreateInput as T, AssignmentCreateSchema as U, AssignmentSchema as V, AssignmentSource as W, AssignmentStatus as X, type AssignmentUpdate as Y, AssignmentUpdateSchema as Z, type AuditLog as _, AGENT_CARD_KIND_VALUES as a, type DeploymentCreate as a$, AuditLogCreateSchema as a0, AuditLogSchema as a1, type AuditLogUpdate as a2, AuditLogUpdateSchema as a3, type AuditTarget as a4, AuditTargetSchema as a5, type BlobRef as a6, BlobRefSchema as a7, CAPTURE_DOM_STATUS_VALUES as a8, CAPTURE_STATUS_VALUES as a9, DEFAULT_ANALYST_TASK_LIMIT as aA, DEFAULT_SCOUT_TASK_LIMIT as aB, DEPLOYMENT_KIND_VALUES as aC, DEPLOYMENT_STATUS_VALUES as aD, DISCOVERED_BY_TYPE_VALUES as aE, type DataItem as aF, type DataItemContent as aG, DataItemContentSchema as aH, type DataItemCreate as aI, type DataItemCreateInput as aJ, DataItemCreateSchema as aK, type DataItemEntity as aL, DataItemEntitySchema as aM, DataItemSchema as aN, type DataItemUpdate as aO, DataItemUpdateSchema as aP, type Database as aQ, DatabaseCollection as aR, type DatabaseCreate as aS, type DatabaseCreateInput as aT, DatabaseCreateSchema as aU, DatabaseName as aV, DatabaseSchema as aW, DatabaseStatus as aX, type DatabaseUpdate as aY, DatabaseUpdateSchema as aZ, type Deployment as a_, CAPTURE_WINDOW_MODE_VALUES as aa, COLLECTIONS as ab, COLLECTOR_TYPE_VALUES as ac, type Capture as ad, type CaptureCreate as ae, type CaptureCreateInput as af, CaptureCreateSchema as ag, type CaptureDomSnapshot as ah, CaptureDomSnapshotSchema as ai, CaptureDomStatus as aj, type CaptureDomSummary as ak, CaptureDomSummarySchema as al, CapturePromptCardSchema as am, type CaptureRegion as an, CaptureRegionSchema as ao, CaptureSchema as ap, CaptureStatus as aq, CaptureThumbCardSchema as ar, CaptureWindowMode as as, type CollectionName as at, type Collector as au, CollectorSchema as av, CollectorType as aw, ConnectionString as ax, DATABASE_COLLECTION_VALUES as ay, DATABASE_STATUS_VALUES as az, AGENT_MESSAGE_KIND_VALUES as b, OrgSettingsUpdateSchema as b$, DeploymentCreateSchema as b0, DeploymentKind as b1, DeploymentSchema as b2, DeploymentStatus as b3, type DeploymentStep as b4, DeploymentStepSchema as b5, type DeploymentUpdate as b6, DeploymentUpdateSchema as b7, type DiscoveredBy as b8, DiscoveredBySchema as b9, type LlmCallCreateInput as bA, LlmCallCreateSchema as bB, LlmCallSchema as bC, LlmCapability as bD, LlmOutcome as bE, LlmProvider as bF, type LlmUsage as bG, LlmUsageSchema as bH, LoadScope as bI, MAX_AGENT_MESSAGE_TEXT_LENGTH as bJ, MAX_RATING_COMMENT_LENGTH as bK, MAX_SOURCE_IMPORT_ROW_ERRORS as bL, MISSION_PRIORITY_VALUES as bM, MISSION_STATUS_VALUES as bN, type Mission as bO, type MissionCreate as bP, type MissionCreateInput as bQ, MissionCreateSchema as bR, MissionPriority as bS, MissionSchema as bT, MissionStatus as bU, type MissionUpdate as bV, MissionUpdateSchema as bW, OpenLinkCardSchema as bX, type OrgSettings as bY, OrgSettingsSchema as bZ, type OrgSettingsUpdate as b_, DiscoveredByType as ba, type DomBlock as bb, DomBlockSchema as bc, type DomLink as bd, DomLinkSchema as be, type DomRect as bf, DomRectSchema as bg, Email as bh, GLOBAL_LOAD_SCOPE as bi, type Geo as bj, GeoSchema as bk, HOURS_LOG_SOURCE_VALUES as bl, type HoursLog as bm, type HoursLogCreate as bn, HoursLogCreateSchema as bo, HoursLogSchema as bp, HoursLogSource as bq, type HoursLogUpdate as br, HoursLogUpdateSchema as bs, HoursProposalCardSchema as bt, ItemResultCardSchema as bu, LLM_CAPABILITY_VALUES as bv, LLM_OUTCOME_VALUES as bw, LLM_PROVIDER_VALUES as bx, type LlmCall as by, type LlmCallCreate as bz, AGENT_MESSAGE_ROLE_VALUES as c, SourceImportSummarySchema as c$, PLATFORM_VALUES as c0, Platform as c1, QuickRepliesCardSchema as c2, type QuickReplyOption as c3, QuickReplyOptionSchema as c4, RATER_TYPE_VALUES as c5, REGION_MODE_VALUES as c6, RaterType as c7, RatingScore as c8, type RatingSummary as c9, type Scraper as cA, type ScraperCreate as cB, ScraperCreateSchema as cC, type ScraperMetric as cD, type ScraperMetricCreate as cE, ScraperMetricCreateSchema as cF, ScraperMetricSchema as cG, type ScraperMetricUpdate as cH, ScraperMetricUpdateSchema as cI, ScraperSchema as cJ, ScraperStatus as cK, type ScraperUpdate as cL, ScraperUpdateSchema as cM, type Source as cN, SourceAccess as cO, type SourceCreate as cP, type SourceCreateInput as cQ, SourceCreateSchema as cR, type SourceImport as cS, type SourceImportCreate as cT, SourceImportCreateSchema as cU, SourceImportKind as cV, type SourceImportRowError as cW, SourceImportRowErrorSchema as cX, SourceImportSchema as cY, SourceImportStatus as cZ, type SourceImportSummary as c_, RatingSummarySchema as ca, RegionMode as cb, SCOUT_STATUS_VALUES as cc, SCRAPER_STATUS_VALUES as cd, SOURCE_ACCESS_VALUES as ce, SOURCE_IMPORT_KIND_VALUES as cf, SOURCE_IMPORT_STATUS_VALUES as cg, SOURCE_INTAKE_OUTCOME_VALUES as ch, SOURCE_ROUTE_VALUES as ci, SOURCE_STATUS_VALUES as cj, SOURCE_TYPE_VALUES as ck, type ScoutProfile as cl, type ScoutProfileCreate as cm, type ScoutProfileCreateInput as cn, ScoutProfileCreateSchema as co, ScoutProfileSchema as cp, type ScoutProfileUpdate as cq, type ScoutProfileUpdateInput as cr, ScoutProfileUpdateSchema as cs, type ScoutRating as ct, type ScoutRatingInput as cu, ScoutRatingInputSchema as cv, ScoutRatingSchema as cw, type ScoutSelfUpdate as cx, ScoutSelfUpdateSchema as cy, ScoutStatus as cz, AGENT_SESSION_MODE_VALUES as d, type SourceImportUpdate as d0, SourceImportUpdateSchema as d1, SourceIntakeOutcome as d2, type SourceRating as d3, SourceRatingSchema as d4, SourceResultCardSchema as d5, SourceRoute as d6, SourceSchema as d7, SourceStatus as d8, SourceType as d9, type SourceUpdate as da, SourceUpdateSchema as db, type SystemRecommendation as dc, type SystemRecommendationInput as dd, SystemRecommendationInputSchema as de, SystemRecommendationSchema as df, TASK_KIND_VALUES as dg, TASK_ORIGIN_VALUES as dh, TASK_STATUS_VALUES as di, type Task as dj, type TaskCreate as dk, type TaskCreateInput as dl, TaskCreateSchema as dm, TaskKind as dn, TaskOrigin as dp, TaskSchema as dq, TaskStatus as dr, type TaskUpdate as ds, TaskUpdateSchema as dt, VETTING_STATUS_VALUES as du, VettingStatus as dv, AGENT_SESSION_STATUS_VALUES as e, AGENT_SOURCE_OUTCOME_VALUES as f, ASSIGNEE_TYPE_VALUES as g, ASSIGNMENT_SOURCE_VALUES as h, ASSIGNMENT_STATUS_VALUES as i, AccessIssue as j, type AgentCard as k, AgentCardKind as l, AgentCardSchema as m, type AgentMessage as n, type AgentMessageCreate as o, type AgentMessageCreateInput as p, AgentMessageCreateSchema as q, AgentMessageKind as r, AgentMessageRole as s, AgentMessageSchema as t, type AgentSession as u, type AgentSessionBudget as v, AgentSessionBudgetSchema as w, type AgentSessionCreate as x, type AgentSessionCreateInput as y, AgentSessionCreateSchema as z };
5820
+ export { AssignmentUpdateSchema as $, ACCESS_ISSUE_VALUES as A, AgentSessionMode as B, AgentSessionSchema as C, type AgentSessionStats as D, AgentSessionStatsSchema as E, AgentSessionStatus as F, type AgentSessionUpdate as G, AgentSessionUpdateSchema as H, AgentSourceOutcome as I, type AnalystProfile as J, AnalystProfileSchema as K, type AnalystProfileUpdate as L, MissionPriority as M, type AnalystProfileUpdateInput as N, AnalystProfileUpdateSchema as O, type AssigneeLoad as P, AssigneeLoadSchema as Q, AssigneeType as R, SourceStatus as S, type Assignment as T, type AssignmentCreate as U, type AssignmentCreateInput as V, AssignmentCreateSchema as W, AssignmentSchema as X, AssignmentSource as Y, AssignmentStatus as Z, type AssignmentUpdate as _, AGENT_CARD_KIND_VALUES as a, DatabaseUpdateSchema as a$, type AuditLog as a0, type AuditLogCreate as a1, AuditLogCreateSchema as a2, AuditLogSchema as a3, type AuditLogUpdate as a4, AuditLogUpdateSchema as a5, type AuditTarget as a6, AuditTargetSchema as a7, type BlobRef as a8, BlobRefSchema as a9, DATABASE_COLLECTION_VALUES as aA, DATABASE_STATUS_VALUES as aB, DEFAULT_ANALYST_TASK_LIMIT as aC, DEFAULT_SCOUT_TASK_LIMIT as aD, DEPLOYMENT_KIND_VALUES as aE, DEPLOYMENT_STATUS_VALUES as aF, DISCOVERED_BY_TYPE_VALUES as aG, type DataItem as aH, type DataItemContent as aI, DataItemContentSchema as aJ, type DataItemCreate as aK, type DataItemCreateInput as aL, DataItemCreateSchema as aM, type DataItemEntity as aN, DataItemEntitySchema as aO, DataItemSchema as aP, type DataItemUpdate as aQ, DataItemUpdateSchema as aR, type Database as aS, DatabaseCollection as aT, type DatabaseCreate as aU, type DatabaseCreateInput as aV, DatabaseCreateSchema as aW, DatabaseName as aX, DatabaseSchema as aY, DatabaseStatus as aZ, type DatabaseUpdate as a_, CAPTURE_DOM_STATUS_VALUES as aa, CAPTURE_STATUS_VALUES as ab, CAPTURE_WINDOW_MODE_VALUES as ac, COLLECTIONS as ad, COLLECTOR_TYPE_VALUES as ae, type Capture as af, type CaptureCreate as ag, type CaptureCreateInput as ah, CaptureCreateSchema as ai, type CaptureDomSnapshot as aj, CaptureDomSnapshotSchema as ak, CaptureDomStatus as al, type CaptureDomSummary as am, CaptureDomSummarySchema as an, CapturePromptCardSchema as ao, type CaptureRegion as ap, CaptureRegionSchema as aq, CaptureSchema as ar, CaptureStatus as as, CaptureThumbCardSchema as at, CaptureWindowMode as au, type CollectionName as av, type Collector as aw, CollectorSchema as ax, CollectorType as ay, ConnectionString as az, AGENT_MESSAGE_KIND_VALUES as b, type OrgSettingsUpdate as b$, type Deployment as b0, type DeploymentCreate as b1, DeploymentCreateSchema as b2, DeploymentKind as b3, DeploymentSchema as b4, DeploymentStatus as b5, type DeploymentStep as b6, DeploymentStepSchema as b7, type DeploymentUpdate as b8, DeploymentUpdateSchema as b9, type LlmCall as bA, type LlmCallCreate as bB, type LlmCallCreateInput as bC, LlmCallCreateSchema as bD, LlmCallSchema as bE, LlmCapability as bF, LlmOutcome as bG, LlmProvider as bH, type LlmUsage as bI, LlmUsageSchema as bJ, LoadScope as bK, MAX_AGENT_MESSAGE_TEXT_LENGTH as bL, MAX_RATING_COMMENT_LENGTH as bM, MAX_SOURCE_IMPORT_ROW_ERRORS as bN, MISSION_PRIORITY_VALUES as bO, MISSION_STATUS_VALUES as bP, type Mission as bQ, type MissionCreate as bR, type MissionCreateInput as bS, MissionCreateSchema as bT, MissionSchema as bU, MissionStatus as bV, type MissionUpdate as bW, MissionUpdateSchema as bX, OpenLinkCardSchema as bY, type OrgSettings as bZ, OrgSettingsSchema as b_, type DiscoveredBy as ba, DiscoveredBySchema as bb, DiscoveredByType as bc, type DomBlock as bd, DomBlockSchema as be, type DomLink as bf, DomLinkSchema as bg, type DomRect as bh, DomRectSchema as bi, Email as bj, GLOBAL_LOAD_SCOPE as bk, type Geo as bl, GeoSchema as bm, HOURS_LOG_SOURCE_VALUES as bn, type HoursLog as bo, type HoursLogCreate as bp, HoursLogCreateSchema as bq, HoursLogSchema as br, HoursLogSource as bs, type HoursLogUpdate as bt, HoursLogUpdateSchema as bu, HoursProposalCardSchema as bv, ItemResultCardSchema as bw, LLM_CAPABILITY_VALUES as bx, LLM_OUTCOME_VALUES as by, LLM_PROVIDER_VALUES as bz, AGENT_MESSAGE_ROLE_VALUES as c, type SourceImportSummary as c$, OrgSettingsUpdateSchema as c0, PLATFORM_VALUES as c1, Platform as c2, QuickRepliesCardSchema as c3, type QuickReplyOption as c4, QuickReplyOptionSchema as c5, RATER_TYPE_VALUES as c6, REGION_MODE_VALUES as c7, RaterType as c8, RatingScore as c9, ScoutStatus as cA, type Scraper as cB, type ScraperCreate as cC, ScraperCreateSchema as cD, type ScraperMetric as cE, type ScraperMetricCreate as cF, ScraperMetricCreateSchema as cG, ScraperMetricSchema as cH, type ScraperMetricUpdate as cI, ScraperMetricUpdateSchema as cJ, ScraperSchema as cK, ScraperStatus as cL, type ScraperUpdate as cM, ScraperUpdateSchema as cN, type Source as cO, SourceAccess as cP, type SourceCreate as cQ, type SourceCreateInput as cR, SourceCreateSchema as cS, type SourceImport as cT, type SourceImportCreate as cU, SourceImportCreateSchema as cV, SourceImportKind as cW, type SourceImportRowError as cX, SourceImportRowErrorSchema as cY, SourceImportSchema as cZ, SourceImportStatus as c_, type RatingSummary as ca, RatingSummarySchema as cb, RegionMode as cc, SCOUT_STATUS_VALUES as cd, SCRAPER_STATUS_VALUES as ce, SOURCE_ACCESS_VALUES as cf, SOURCE_IMPORT_KIND_VALUES as cg, SOURCE_IMPORT_STATUS_VALUES as ch, SOURCE_INTAKE_OUTCOME_VALUES as ci, SOURCE_ROUTE_VALUES as cj, SOURCE_STATUS_VALUES as ck, SOURCE_TYPE_VALUES as cl, type ScoutProfile as cm, type ScoutProfileCreate as cn, type ScoutProfileCreateInput as co, ScoutProfileCreateSchema as cp, ScoutProfileSchema as cq, type ScoutProfileUpdate as cr, type ScoutProfileUpdateInput as cs, ScoutProfileUpdateSchema as ct, type ScoutRating as cu, type ScoutRatingInput as cv, ScoutRatingInputSchema as cw, ScoutRatingSchema as cx, type ScoutSelfUpdate as cy, ScoutSelfUpdateSchema as cz, AGENT_SESSION_MODE_VALUES as d, SourceImportSummarySchema as d0, type SourceImportUpdate as d1, SourceImportUpdateSchema as d2, SourceIntakeOutcome as d3, type SourceRating as d4, SourceRatingSchema as d5, SourceResultCardSchema as d6, SourceRoute as d7, SourceSchema as d8, SourceType as d9, type SourceUpdate as da, SourceUpdateSchema as db, type SystemRecommendation as dc, type SystemRecommendationInput as dd, SystemRecommendationInputSchema as de, SystemRecommendationSchema as df, TASK_KIND_VALUES as dg, TASK_ORIGIN_VALUES as dh, TASK_STATUS_VALUES as di, type Task as dj, type TaskCreate as dk, type TaskCreateInput as dl, TaskCreateSchema as dm, TaskKind as dn, TaskOrigin as dp, TaskSchema as dq, TaskStatus as dr, type TaskUpdate as ds, TaskUpdateSchema as dt, VETTING_STATUS_VALUES as du, VettingStatus as dv, AGENT_SESSION_STATUS_VALUES as e, AGENT_SOURCE_OUTCOME_VALUES as f, ASSIGNEE_TYPE_VALUES as g, ASSIGNMENT_SOURCE_VALUES as h, ASSIGNMENT_STATUS_VALUES as i, AccessIssue as j, type AgentCard as k, AgentCardKind as l, AgentCardSchema as m, type AgentMessage as n, type AgentMessageCreate as o, type AgentMessageCreateInput as p, AgentMessageCreateSchema as q, AgentMessageKind as r, AgentMessageRole as s, AgentMessageSchema as t, type AgentSession as u, type AgentSessionBudget as v, AgentSessionBudgetSchema as w, type AgentSessionCreate as x, type AgentSessionCreateInput as y, AgentSessionCreateSchema as z };
@@ -2415,6 +2415,8 @@ declare const SourceSchema: z.ZodObject<{
2415
2415
  }>;
2416
2416
  lastCollectedAt: z.ZodOptional<z.ZodDate>;
2417
2417
  nextVisitAt: z.ZodOptional<z.ZodDate>;
2418
+ /** Activity-based wait set by the last visit, before current urgency (see `effectiveDueAt`). */
2419
+ visitIntervalMs: z.ZodOptional<z.ZodNumber>;
2418
2420
  } & {
2419
2421
  createdAt: z.ZodDate;
2420
2422
  updatedAt: z.ZodDate;
@@ -2450,6 +2452,7 @@ declare const SourceSchema: z.ZodObject<{
2450
2452
  } | undefined;
2451
2453
  lastCollectedAt?: Date | undefined;
2452
2454
  nextVisitAt?: Date | undefined;
2455
+ visitIntervalMs?: number | undefined;
2453
2456
  }, {
2454
2457
  type: "channel" | "group" | "profile" | "forum" | "site";
2455
2458
  createdAt: Date;
@@ -2480,6 +2483,7 @@ declare const SourceSchema: z.ZodObject<{
2480
2483
  } | undefined;
2481
2484
  lastCollectedAt?: Date | undefined;
2482
2485
  nextVisitAt?: Date | undefined;
2486
+ visitIntervalMs?: number | undefined;
2483
2487
  }>;
2484
2488
  declare const SourceCreateSchema: z.ZodObject<Omit<{
2485
2489
  _id: z.ZodString;
@@ -2524,12 +2528,14 @@ declare const SourceCreateSchema: z.ZodObject<Omit<{
2524
2528
  }>;
2525
2529
  lastCollectedAt: z.ZodOptional<z.ZodDate>;
2526
2530
  nextVisitAt: z.ZodOptional<z.ZodDate>;
2531
+ /** Activity-based wait set by the last visit, before current urgency (see `effectiveDueAt`). */
2532
+ visitIntervalMs: z.ZodOptional<z.ZodNumber>;
2527
2533
  } & {
2528
2534
  createdAt: z.ZodDate;
2529
2535
  updatedAt: z.ZodDate;
2530
2536
  } & {
2531
2537
  deletedAt: z.ZodOptional<z.ZodDate>;
2532
- }, "createdAt" | "updatedAt" | "deletedAt" | "_id" | "orgId" | "databaseId" | "discoveredBy" | "lastCollectedAt">, "strip", z.ZodTypeAny, {
2538
+ }, "createdAt" | "updatedAt" | "deletedAt" | "_id" | "orgId" | "databaseId" | "discoveredBy" | "lastCollectedAt" | "visitIntervalMs">, "strip", z.ZodTypeAny, {
2533
2539
  type: "channel" | "group" | "profile" | "forum" | "site";
2534
2540
  status: "active" | "paused" | "closed" | "access_problem";
2535
2541
  platform: "telegram" | "facebook" | "x" | "tiktok" | "instagram" | "youtube" | "whatsapp" | "reddit" | "discord" | "linkedin" | "threads" | "vk" | "snapchat" | "web";
@@ -5811,4 +5817,4 @@ type LlmCall = z.infer<typeof LlmCallSchema>;
5811
5817
  type LlmCallCreate = z.infer<typeof LlmCallCreateSchema>;
5812
5818
  type LlmCallCreateInput = z.input<typeof LlmCallCreateSchema>;
5813
5819
 
5814
- export { type AuditLogCreate as $, ACCESS_ISSUE_VALUES as A, AgentSessionMode as B, AgentSessionSchema as C, type AgentSessionStats as D, AgentSessionStatsSchema as E, AgentSessionStatus as F, type AgentSessionUpdate as G, AgentSessionUpdateSchema as H, AgentSourceOutcome as I, type AnalystProfile as J, AnalystProfileSchema as K, type AnalystProfileUpdate as L, type AnalystProfileUpdateInput as M, AnalystProfileUpdateSchema as N, type AssigneeLoad as O, AssigneeLoadSchema as P, AssigneeType as Q, type Assignment as R, type AssignmentCreate as S, type AssignmentCreateInput as T, AssignmentCreateSchema as U, AssignmentSchema as V, AssignmentSource as W, AssignmentStatus as X, type AssignmentUpdate as Y, AssignmentUpdateSchema as Z, type AuditLog as _, AGENT_CARD_KIND_VALUES as a, type DeploymentCreate as a$, AuditLogCreateSchema as a0, AuditLogSchema as a1, type AuditLogUpdate as a2, AuditLogUpdateSchema as a3, type AuditTarget as a4, AuditTargetSchema as a5, type BlobRef as a6, BlobRefSchema as a7, CAPTURE_DOM_STATUS_VALUES as a8, CAPTURE_STATUS_VALUES as a9, DEFAULT_ANALYST_TASK_LIMIT as aA, DEFAULT_SCOUT_TASK_LIMIT as aB, DEPLOYMENT_KIND_VALUES as aC, DEPLOYMENT_STATUS_VALUES as aD, DISCOVERED_BY_TYPE_VALUES as aE, type DataItem as aF, type DataItemContent as aG, DataItemContentSchema as aH, type DataItemCreate as aI, type DataItemCreateInput as aJ, DataItemCreateSchema as aK, type DataItemEntity as aL, DataItemEntitySchema as aM, DataItemSchema as aN, type DataItemUpdate as aO, DataItemUpdateSchema as aP, type Database as aQ, DatabaseCollection as aR, type DatabaseCreate as aS, type DatabaseCreateInput as aT, DatabaseCreateSchema as aU, DatabaseName as aV, DatabaseSchema as aW, DatabaseStatus as aX, type DatabaseUpdate as aY, DatabaseUpdateSchema as aZ, type Deployment as a_, CAPTURE_WINDOW_MODE_VALUES as aa, COLLECTIONS as ab, COLLECTOR_TYPE_VALUES as ac, type Capture as ad, type CaptureCreate as ae, type CaptureCreateInput as af, CaptureCreateSchema as ag, type CaptureDomSnapshot as ah, CaptureDomSnapshotSchema as ai, CaptureDomStatus as aj, type CaptureDomSummary as ak, CaptureDomSummarySchema as al, CapturePromptCardSchema as am, type CaptureRegion as an, CaptureRegionSchema as ao, CaptureSchema as ap, CaptureStatus as aq, CaptureThumbCardSchema as ar, CaptureWindowMode as as, type CollectionName as at, type Collector as au, CollectorSchema as av, CollectorType as aw, ConnectionString as ax, DATABASE_COLLECTION_VALUES as ay, DATABASE_STATUS_VALUES as az, AGENT_MESSAGE_KIND_VALUES as b, OrgSettingsUpdateSchema as b$, DeploymentCreateSchema as b0, DeploymentKind as b1, DeploymentSchema as b2, DeploymentStatus as b3, type DeploymentStep as b4, DeploymentStepSchema as b5, type DeploymentUpdate as b6, DeploymentUpdateSchema as b7, type DiscoveredBy as b8, DiscoveredBySchema as b9, type LlmCallCreateInput as bA, LlmCallCreateSchema as bB, LlmCallSchema as bC, LlmCapability as bD, LlmOutcome as bE, LlmProvider as bF, type LlmUsage as bG, LlmUsageSchema as bH, LoadScope as bI, MAX_AGENT_MESSAGE_TEXT_LENGTH as bJ, MAX_RATING_COMMENT_LENGTH as bK, MAX_SOURCE_IMPORT_ROW_ERRORS as bL, MISSION_PRIORITY_VALUES as bM, MISSION_STATUS_VALUES as bN, type Mission as bO, type MissionCreate as bP, type MissionCreateInput as bQ, MissionCreateSchema as bR, MissionPriority as bS, MissionSchema as bT, MissionStatus as bU, type MissionUpdate as bV, MissionUpdateSchema as bW, OpenLinkCardSchema as bX, type OrgSettings as bY, OrgSettingsSchema as bZ, type OrgSettingsUpdate as b_, DiscoveredByType as ba, type DomBlock as bb, DomBlockSchema as bc, type DomLink as bd, DomLinkSchema as be, type DomRect as bf, DomRectSchema as bg, Email as bh, GLOBAL_LOAD_SCOPE as bi, type Geo as bj, GeoSchema as bk, HOURS_LOG_SOURCE_VALUES as bl, type HoursLog as bm, type HoursLogCreate as bn, HoursLogCreateSchema as bo, HoursLogSchema as bp, HoursLogSource as bq, type HoursLogUpdate as br, HoursLogUpdateSchema as bs, HoursProposalCardSchema as bt, ItemResultCardSchema as bu, LLM_CAPABILITY_VALUES as bv, LLM_OUTCOME_VALUES as bw, LLM_PROVIDER_VALUES as bx, type LlmCall as by, type LlmCallCreate as bz, AGENT_MESSAGE_ROLE_VALUES as c, SourceImportSummarySchema as c$, PLATFORM_VALUES as c0, Platform as c1, QuickRepliesCardSchema as c2, type QuickReplyOption as c3, QuickReplyOptionSchema as c4, RATER_TYPE_VALUES as c5, REGION_MODE_VALUES as c6, RaterType as c7, RatingScore as c8, type RatingSummary as c9, type Scraper as cA, type ScraperCreate as cB, ScraperCreateSchema as cC, type ScraperMetric as cD, type ScraperMetricCreate as cE, ScraperMetricCreateSchema as cF, ScraperMetricSchema as cG, type ScraperMetricUpdate as cH, ScraperMetricUpdateSchema as cI, ScraperSchema as cJ, ScraperStatus as cK, type ScraperUpdate as cL, ScraperUpdateSchema as cM, type Source as cN, SourceAccess as cO, type SourceCreate as cP, type SourceCreateInput as cQ, SourceCreateSchema as cR, type SourceImport as cS, type SourceImportCreate as cT, SourceImportCreateSchema as cU, SourceImportKind as cV, type SourceImportRowError as cW, SourceImportRowErrorSchema as cX, SourceImportSchema as cY, SourceImportStatus as cZ, type SourceImportSummary as c_, RatingSummarySchema as ca, RegionMode as cb, SCOUT_STATUS_VALUES as cc, SCRAPER_STATUS_VALUES as cd, SOURCE_ACCESS_VALUES as ce, SOURCE_IMPORT_KIND_VALUES as cf, SOURCE_IMPORT_STATUS_VALUES as cg, SOURCE_INTAKE_OUTCOME_VALUES as ch, SOURCE_ROUTE_VALUES as ci, SOURCE_STATUS_VALUES as cj, SOURCE_TYPE_VALUES as ck, type ScoutProfile as cl, type ScoutProfileCreate as cm, type ScoutProfileCreateInput as cn, ScoutProfileCreateSchema as co, ScoutProfileSchema as cp, type ScoutProfileUpdate as cq, type ScoutProfileUpdateInput as cr, ScoutProfileUpdateSchema as cs, type ScoutRating as ct, type ScoutRatingInput as cu, ScoutRatingInputSchema as cv, ScoutRatingSchema as cw, type ScoutSelfUpdate as cx, ScoutSelfUpdateSchema as cy, ScoutStatus as cz, AGENT_SESSION_MODE_VALUES as d, type SourceImportUpdate as d0, SourceImportUpdateSchema as d1, SourceIntakeOutcome as d2, type SourceRating as d3, SourceRatingSchema as d4, SourceResultCardSchema as d5, SourceRoute as d6, SourceSchema as d7, SourceStatus as d8, SourceType as d9, type SourceUpdate as da, SourceUpdateSchema as db, type SystemRecommendation as dc, type SystemRecommendationInput as dd, SystemRecommendationInputSchema as de, SystemRecommendationSchema as df, TASK_KIND_VALUES as dg, TASK_ORIGIN_VALUES as dh, TASK_STATUS_VALUES as di, type Task as dj, type TaskCreate as dk, type TaskCreateInput as dl, TaskCreateSchema as dm, TaskKind as dn, TaskOrigin as dp, TaskSchema as dq, TaskStatus as dr, type TaskUpdate as ds, TaskUpdateSchema as dt, VETTING_STATUS_VALUES as du, VettingStatus as dv, AGENT_SESSION_STATUS_VALUES as e, AGENT_SOURCE_OUTCOME_VALUES as f, ASSIGNEE_TYPE_VALUES as g, ASSIGNMENT_SOURCE_VALUES as h, ASSIGNMENT_STATUS_VALUES as i, AccessIssue as j, type AgentCard as k, AgentCardKind as l, AgentCardSchema as m, type AgentMessage as n, type AgentMessageCreate as o, type AgentMessageCreateInput as p, AgentMessageCreateSchema as q, AgentMessageKind as r, AgentMessageRole as s, AgentMessageSchema as t, type AgentSession as u, type AgentSessionBudget as v, AgentSessionBudgetSchema as w, type AgentSessionCreate as x, type AgentSessionCreateInput as y, AgentSessionCreateSchema as z };
5820
+ export { AssignmentUpdateSchema as $, ACCESS_ISSUE_VALUES as A, AgentSessionMode as B, AgentSessionSchema as C, type AgentSessionStats as D, AgentSessionStatsSchema as E, AgentSessionStatus as F, type AgentSessionUpdate as G, AgentSessionUpdateSchema as H, AgentSourceOutcome as I, type AnalystProfile as J, AnalystProfileSchema as K, type AnalystProfileUpdate as L, MissionPriority as M, type AnalystProfileUpdateInput as N, AnalystProfileUpdateSchema as O, type AssigneeLoad as P, AssigneeLoadSchema as Q, AssigneeType as R, SourceStatus as S, type Assignment as T, type AssignmentCreate as U, type AssignmentCreateInput as V, AssignmentCreateSchema as W, AssignmentSchema as X, AssignmentSource as Y, AssignmentStatus as Z, type AssignmentUpdate as _, AGENT_CARD_KIND_VALUES as a, DatabaseUpdateSchema as a$, type AuditLog as a0, type AuditLogCreate as a1, AuditLogCreateSchema as a2, AuditLogSchema as a3, type AuditLogUpdate as a4, AuditLogUpdateSchema as a5, type AuditTarget as a6, AuditTargetSchema as a7, type BlobRef as a8, BlobRefSchema as a9, DATABASE_COLLECTION_VALUES as aA, DATABASE_STATUS_VALUES as aB, DEFAULT_ANALYST_TASK_LIMIT as aC, DEFAULT_SCOUT_TASK_LIMIT as aD, DEPLOYMENT_KIND_VALUES as aE, DEPLOYMENT_STATUS_VALUES as aF, DISCOVERED_BY_TYPE_VALUES as aG, type DataItem as aH, type DataItemContent as aI, DataItemContentSchema as aJ, type DataItemCreate as aK, type DataItemCreateInput as aL, DataItemCreateSchema as aM, type DataItemEntity as aN, DataItemEntitySchema as aO, DataItemSchema as aP, type DataItemUpdate as aQ, DataItemUpdateSchema as aR, type Database as aS, DatabaseCollection as aT, type DatabaseCreate as aU, type DatabaseCreateInput as aV, DatabaseCreateSchema as aW, DatabaseName as aX, DatabaseSchema as aY, DatabaseStatus as aZ, type DatabaseUpdate as a_, CAPTURE_DOM_STATUS_VALUES as aa, CAPTURE_STATUS_VALUES as ab, CAPTURE_WINDOW_MODE_VALUES as ac, COLLECTIONS as ad, COLLECTOR_TYPE_VALUES as ae, type Capture as af, type CaptureCreate as ag, type CaptureCreateInput as ah, CaptureCreateSchema as ai, type CaptureDomSnapshot as aj, CaptureDomSnapshotSchema as ak, CaptureDomStatus as al, type CaptureDomSummary as am, CaptureDomSummarySchema as an, CapturePromptCardSchema as ao, type CaptureRegion as ap, CaptureRegionSchema as aq, CaptureSchema as ar, CaptureStatus as as, CaptureThumbCardSchema as at, CaptureWindowMode as au, type CollectionName as av, type Collector as aw, CollectorSchema as ax, CollectorType as ay, ConnectionString as az, AGENT_MESSAGE_KIND_VALUES as b, type OrgSettingsUpdate as b$, type Deployment as b0, type DeploymentCreate as b1, DeploymentCreateSchema as b2, DeploymentKind as b3, DeploymentSchema as b4, DeploymentStatus as b5, type DeploymentStep as b6, DeploymentStepSchema as b7, type DeploymentUpdate as b8, DeploymentUpdateSchema as b9, type LlmCall as bA, type LlmCallCreate as bB, type LlmCallCreateInput as bC, LlmCallCreateSchema as bD, LlmCallSchema as bE, LlmCapability as bF, LlmOutcome as bG, LlmProvider as bH, type LlmUsage as bI, LlmUsageSchema as bJ, LoadScope as bK, MAX_AGENT_MESSAGE_TEXT_LENGTH as bL, MAX_RATING_COMMENT_LENGTH as bM, MAX_SOURCE_IMPORT_ROW_ERRORS as bN, MISSION_PRIORITY_VALUES as bO, MISSION_STATUS_VALUES as bP, type Mission as bQ, type MissionCreate as bR, type MissionCreateInput as bS, MissionCreateSchema as bT, MissionSchema as bU, MissionStatus as bV, type MissionUpdate as bW, MissionUpdateSchema as bX, OpenLinkCardSchema as bY, type OrgSettings as bZ, OrgSettingsSchema as b_, type DiscoveredBy as ba, DiscoveredBySchema as bb, DiscoveredByType as bc, type DomBlock as bd, DomBlockSchema as be, type DomLink as bf, DomLinkSchema as bg, type DomRect as bh, DomRectSchema as bi, Email as bj, GLOBAL_LOAD_SCOPE as bk, type Geo as bl, GeoSchema as bm, HOURS_LOG_SOURCE_VALUES as bn, type HoursLog as bo, type HoursLogCreate as bp, HoursLogCreateSchema as bq, HoursLogSchema as br, HoursLogSource as bs, type HoursLogUpdate as bt, HoursLogUpdateSchema as bu, HoursProposalCardSchema as bv, ItemResultCardSchema as bw, LLM_CAPABILITY_VALUES as bx, LLM_OUTCOME_VALUES as by, LLM_PROVIDER_VALUES as bz, AGENT_MESSAGE_ROLE_VALUES as c, type SourceImportSummary as c$, OrgSettingsUpdateSchema as c0, PLATFORM_VALUES as c1, Platform as c2, QuickRepliesCardSchema as c3, type QuickReplyOption as c4, QuickReplyOptionSchema as c5, RATER_TYPE_VALUES as c6, REGION_MODE_VALUES as c7, RaterType as c8, RatingScore as c9, ScoutStatus as cA, type Scraper as cB, type ScraperCreate as cC, ScraperCreateSchema as cD, type ScraperMetric as cE, type ScraperMetricCreate as cF, ScraperMetricCreateSchema as cG, ScraperMetricSchema as cH, type ScraperMetricUpdate as cI, ScraperMetricUpdateSchema as cJ, ScraperSchema as cK, ScraperStatus as cL, type ScraperUpdate as cM, ScraperUpdateSchema as cN, type Source as cO, SourceAccess as cP, type SourceCreate as cQ, type SourceCreateInput as cR, SourceCreateSchema as cS, type SourceImport as cT, type SourceImportCreate as cU, SourceImportCreateSchema as cV, SourceImportKind as cW, type SourceImportRowError as cX, SourceImportRowErrorSchema as cY, SourceImportSchema as cZ, SourceImportStatus as c_, type RatingSummary as ca, RatingSummarySchema as cb, RegionMode as cc, SCOUT_STATUS_VALUES as cd, SCRAPER_STATUS_VALUES as ce, SOURCE_ACCESS_VALUES as cf, SOURCE_IMPORT_KIND_VALUES as cg, SOURCE_IMPORT_STATUS_VALUES as ch, SOURCE_INTAKE_OUTCOME_VALUES as ci, SOURCE_ROUTE_VALUES as cj, SOURCE_STATUS_VALUES as ck, SOURCE_TYPE_VALUES as cl, type ScoutProfile as cm, type ScoutProfileCreate as cn, type ScoutProfileCreateInput as co, ScoutProfileCreateSchema as cp, ScoutProfileSchema as cq, type ScoutProfileUpdate as cr, type ScoutProfileUpdateInput as cs, ScoutProfileUpdateSchema as ct, type ScoutRating as cu, type ScoutRatingInput as cv, ScoutRatingInputSchema as cw, ScoutRatingSchema as cx, type ScoutSelfUpdate as cy, ScoutSelfUpdateSchema as cz, AGENT_SESSION_MODE_VALUES as d, SourceImportSummarySchema as d0, type SourceImportUpdate as d1, SourceImportUpdateSchema as d2, SourceIntakeOutcome as d3, type SourceRating as d4, SourceRatingSchema as d5, SourceResultCardSchema as d6, SourceRoute as d7, SourceSchema as d8, SourceType as d9, type SourceUpdate as da, SourceUpdateSchema as db, type SystemRecommendation as dc, type SystemRecommendationInput as dd, SystemRecommendationInputSchema as de, SystemRecommendationSchema as df, TASK_KIND_VALUES as dg, TASK_ORIGIN_VALUES as dh, TASK_STATUS_VALUES as di, type Task as dj, type TaskCreate as dk, type TaskCreateInput as dl, TaskCreateSchema as dm, TaskKind as dn, TaskOrigin as dp, TaskSchema as dq, TaskStatus as dr, type TaskUpdate as ds, TaskUpdateSchema as dt, VETTING_STATUS_VALUES as du, VettingStatus as dv, AGENT_SESSION_STATUS_VALUES as e, AGENT_SOURCE_OUTCOME_VALUES as f, ASSIGNEE_TYPE_VALUES as g, ASSIGNMENT_SOURCE_VALUES as h, ASSIGNMENT_STATUS_VALUES as i, AccessIssue as j, type AgentCard as k, AgentCardKind as l, AgentCardSchema as m, type AgentMessage as n, type AgentMessageCreate as o, type AgentMessageCreateInput as p, AgentMessageCreateSchema as q, AgentMessageKind as r, AgentMessageRole as s, AgentMessageSchema as t, type AgentSession as u, type AgentSessionBudget as v, AgentSessionBudgetSchema as w, type AgentSessionCreate as x, type AgentSessionCreateInput as y, AgentSessionCreateSchema as z };
package/dist/index.cjs CHANGED
@@ -195,6 +195,50 @@ var COLLECTIONS = {
195
195
  captures: "captures",
196
196
  llmCalls: "llmCalls"
197
197
  };
198
+ var HOUR_MS = 36e5;
199
+ var VISIT_INTERVAL_MIN_MS = 1 * HOUR_MS;
200
+ var VISIT_INTERVAL_MAX_MS = 72 * HOUR_MS;
201
+ var URGENCY_FACTOR = {
202
+ emergency: 0.5,
203
+ missionPriority: { critical: 0.5, high: 0.75, medium: 1, low: 1.5 }
204
+ };
205
+ var OverdueLevelSchema = zod.z.enum(["none", "late", "missed"]);
206
+ function knownInterval(source) {
207
+ if (source.visitIntervalMs) return { ms: source.visitIntervalMs, urgencyApplied: false };
208
+ if (source.lastCollectedAt && source.nextVisitAt) {
209
+ const derived = source.nextVisitAt.getTime() - source.lastCollectedAt.getTime();
210
+ if (derived > 0) return { ms: derived, urgencyApplied: true };
211
+ }
212
+ return void 0;
213
+ }
214
+ function baseVisitInterval(source) {
215
+ return knownInterval(source)?.ms;
216
+ }
217
+ function urgencyFactor(urgency) {
218
+ const priority = urgency.missionPriority ? URGENCY_FACTOR.missionPriority[urgency.missionPriority] : 1;
219
+ return (urgency.emergency ? URGENCY_FACTOR.emergency : 1) * priority;
220
+ }
221
+ function clampInterval(ms) {
222
+ return Math.min(Math.max(ms, VISIT_INTERVAL_MIN_MS), VISIT_INTERVAL_MAX_MS);
223
+ }
224
+ function effectiveInterval(source, urgency) {
225
+ const known = knownInterval(source);
226
+ if (!known) return void 0;
227
+ return clampInterval(known.urgencyApplied ? known.ms : known.ms * urgencyFactor(urgency));
228
+ }
229
+ function effectiveDueAt(source, urgency, now = /* @__PURE__ */ new Date()) {
230
+ if (source.status === "access_problem") return void 0;
231
+ if (!source.lastCollectedAt) return now;
232
+ const interval = effectiveInterval(source, urgency);
233
+ if (interval === void 0) return source.nextVisitAt ?? now;
234
+ return new Date(source.lastCollectedAt.getTime() + interval);
235
+ }
236
+ function overdueLevel(dueAt, intervalMs, now = /* @__PURE__ */ new Date()) {
237
+ if (!dueAt) return "none";
238
+ const lateMs = now.getTime() - dueAt.getTime();
239
+ if (lateMs <= 0) return "none";
240
+ return intervalMs !== void 0 && lateMs > intervalMs ? "missed" : "late";
241
+ }
198
242
  var DatabaseName = zod.z.string().min(1).max(63).regex(/^[^/\\. "$*<>:|?]+$/, "Invalid MongoDB database name");
199
243
  var ConnectionString = zod.z.string().min(1).regex(/^mongodb(\+srv)?:\/\/\S+$/, "Expected a mongodb:// or mongodb+srv:// URI");
200
244
  var DatabaseSchema = zod.z.object({
@@ -234,6 +278,7 @@ var TaskCriteriaSchema = zod.z.object({
234
278
  emergency: zod.z.boolean().default(false)
235
279
  });
236
280
  var MAX_CAPTURE_WINDOW_DAYS = 90;
281
+ var MONITOR_TASK_MAX_SOURCES = 20;
237
282
  var DAY_MS = 24 * 60 * 60 * 1e3;
238
283
  function isHttpUrl(value) {
239
284
  try {
@@ -556,7 +601,9 @@ var SourceSchema = zod.z.object({
556
601
  status: SourceStatus.default("active"),
557
602
  discoveredBy: DiscoveredBySchema,
558
603
  lastCollectedAt: zod.z.coerce.date().optional(),
559
- nextVisitAt: zod.z.coerce.date().optional()
604
+ nextVisitAt: zod.z.coerce.date().optional(),
605
+ /** Activity-based wait set by the last visit, before current urgency (see `effectiveDueAt`). */
606
+ visitIntervalMs: zod.z.number().int().positive().optional()
560
607
  }).merge(TimestampsSchema).merge(SoftDeleteSchema);
561
608
  var SourceCreateSchema = SourceSchema.omit({
562
609
  _id: true,
@@ -566,7 +613,8 @@ var SourceCreateSchema = SourceSchema.omit({
566
613
  updatedAt: true,
567
614
  deletedAt: true,
568
615
  discoveredBy: true,
569
- lastCollectedAt: true
616
+ lastCollectedAt: true,
617
+ visitIntervalMs: true
570
618
  });
571
619
  var SourceUpdateSchema = SourceCreateSchema.partial();
572
620
  var MAX_SOURCE_IMPORT_ROW_ERRORS = 500;
@@ -998,6 +1046,16 @@ var AgentTaskCriteriaSchema = zod.z.object({
998
1046
  emergency: zod.z.boolean()
999
1047
  });
1000
1048
  var AgentTaskTargetSchema = TaskTargetSchema.omit({ sourceId: true });
1049
+ var AgentTaskSourceSchema = zod.z.object({
1050
+ platform: Platform,
1051
+ url: zod.z.string().url().refine(isHttpUrl, "Expected an http(s) URL"),
1052
+ label: zod.z.string().min(1).optional(),
1053
+ lastCapturedAt: zod.z.coerce.date().optional(),
1054
+ /** When to capture it again, under current urgency (absent: parked on an access problem). */
1055
+ dueAt: zod.z.coerce.date().optional(),
1056
+ /** Parked: a person couldn't get in; an analyst reviews it. */
1057
+ accessProblem: zod.z.boolean().optional()
1058
+ });
1001
1059
  var AgentTaskSchema = zod.z.object({
1002
1060
  id: ObjectIdString,
1003
1061
  title: zod.z.string(),
@@ -1007,6 +1065,8 @@ var AgentTaskSchema = zod.z.object({
1007
1065
  searchQueries: zod.z.array(zod.z.string()),
1008
1066
  criteria: AgentTaskCriteriaSchema,
1009
1067
  target: AgentTaskTargetSchema.optional(),
1068
+ /** Monitor: the attached sources other than `target`, sorted by platform then URL. */
1069
+ sources: zod.z.array(AgentTaskSourceSchema).default([]),
1010
1070
  captureWindow: CaptureWindowSchema.optional(),
1011
1071
  status: TaskStatus,
1012
1072
  version: zod.z.number().int().min(1),
@@ -1028,7 +1088,9 @@ var AgentAssignmentsResponseSchema = zod.z.object({
1028
1088
  });
1029
1089
  var AgentAssignmentVersionSchema = zod.z.object({
1030
1090
  assignmentId: ObjectIdString,
1031
- taskVersion: zod.z.number().int().min(1)
1091
+ taskVersion: zod.z.number().int().min(1),
1092
+ /** Monitor: the latest change to any attached source (a visit moves it; the task version doesn't). */
1093
+ sourcesUpdatedAt: zod.z.coerce.date().optional()
1032
1094
  });
1033
1095
  var AgentAssignmentVersionsResponseSchema = zod.z.object({
1034
1096
  items: zod.z.array(AgentAssignmentVersionSchema)
@@ -1239,6 +1301,7 @@ exports.AgentSourceOutcome = AgentSourceOutcome;
1239
1301
  exports.AgentStreamEventSchema = AgentStreamEventSchema;
1240
1302
  exports.AgentTaskCriteriaSchema = AgentTaskCriteriaSchema;
1241
1303
  exports.AgentTaskSchema = AgentTaskSchema;
1304
+ exports.AgentTaskSourceSchema = AgentTaskSourceSchema;
1242
1305
  exports.AgentTaskTargetSchema = AgentTaskTargetSchema;
1243
1306
  exports.AnalystProfileSchema = AnalystProfileSchema;
1244
1307
  exports.AnalystProfileUpdateSchema = AnalystProfileUpdateSchema;
@@ -1339,6 +1402,7 @@ exports.MAX_SOURCE_IMPORT_ROW_ERRORS = MAX_SOURCE_IMPORT_ROW_ERRORS;
1339
1402
  exports.MAX_SOURCE_INTAKE_CANDIDATES = MAX_SOURCE_INTAKE_CANDIDATES;
1340
1403
  exports.MISSION_PRIORITY_VALUES = MISSION_PRIORITY_VALUES;
1341
1404
  exports.MISSION_STATUS_VALUES = MISSION_STATUS_VALUES;
1405
+ exports.MONITOR_TASK_MAX_SOURCES = MONITOR_TASK_MAX_SOURCES;
1342
1406
  exports.MatchingFieldsSchema = MatchingFieldsSchema;
1343
1407
  exports.MissionCreateSchema = MissionCreateSchema;
1344
1408
  exports.MissionPriority = MissionPriority;
@@ -1349,6 +1413,7 @@ exports.ObjectIdString = ObjectIdString;
1349
1413
  exports.OpenLinkCardSchema = OpenLinkCardSchema;
1350
1414
  exports.OrgSettingsSchema = OrgSettingsSchema;
1351
1415
  exports.OrgSettingsUpdateSchema = OrgSettingsUpdateSchema;
1416
+ exports.OverdueLevelSchema = OverdueLevelSchema;
1352
1417
  exports.PLATFORM_VALUES = PLATFORM_VALUES;
1353
1418
  exports.PaginatedSchema = PaginatedSchema;
1354
1419
  exports.PaginationQuerySchema = PaginationQuerySchema;
@@ -1428,8 +1493,17 @@ exports.TaskTargetSchema = TaskTargetSchema;
1428
1493
  exports.TaskUpdateSchema = TaskUpdateSchema;
1429
1494
  exports.TimeZone = TimeZone;
1430
1495
  exports.TimestampsSchema = TimestampsSchema;
1496
+ exports.URGENCY_FACTOR = URGENCY_FACTOR;
1431
1497
  exports.VETTING_STATUS_VALUES = VETTING_STATUS_VALUES;
1498
+ exports.VISIT_INTERVAL_MAX_MS = VISIT_INTERVAL_MAX_MS;
1499
+ exports.VISIT_INTERVAL_MIN_MS = VISIT_INTERVAL_MIN_MS;
1432
1500
  exports.VettingStatus = VettingStatus;
1501
+ exports.baseVisitInterval = baseVisitInterval;
1502
+ exports.clampInterval = clampInterval;
1503
+ exports.effectiveDueAt = effectiveDueAt;
1504
+ exports.effectiveInterval = effectiveInterval;
1433
1505
  exports.isHttpUrl = isHttpUrl;
1506
+ exports.overdueLevel = overdueLevel;
1507
+ exports.urgencyFactor = urgencyFactor;
1434
1508
  //# sourceMappingURL=index.cjs.map
1435
1509
  //# sourceMappingURL=index.cjs.map