Documentation
    Preparing search index...

    Coalescing queue for source-document notifications (Decision 12).

    • A notification for a pending reference is merged into it (the latest rule wins; the reference keeps its place in line).
    • One for an in-flight reference marks it dirty: when the current run ends the reference is queued once more (at the back), however many notifications arrived meanwhile.
    • Every run calls process, which retrieves current state, so a burst on one reference costs at most two retrievals and the final state wins. Runs never overlap for the same reference.

    References are compared exactly (case-sensitive), like source point IDs. The queue holds work until start; pause (prune) stops new runs without rejecting enqueues. Failures never escape: process records issues itself, and an unexpected rejection becomes a failed result and an extraction_error issue (with the designated rule).

    Reindex runs go through processNow as well, so a notification and a reindex of one reference never run in parallel and the latest state wins.

    Implements

    Index
    • Notify that a source document changed (fire and forget).

      Parameters

      • ref: string

        The exact <name>://<id> reference.

      • rule: string

        The designated rule name.

      Returns boolean

      false when the queue is stopped and the notification was dropped.

    • Process a reference and resolve with the result of a run that started after this call, so the result reflects the source's state at or after the call (the ?wait=true path). Coalesces with other notifications: if the reference is pending, this joins that run; if it is in flight, this waits for the current run and then the one dirty re-run.

      Parameters

      • ref: string

        The exact <name>://<id> reference.

      • rule: string

        The designated rule name.

      • options: ProcessNowOptions = {}

        force re-embeds unchanged content.

      Returns Promise<
          {
              chunks?: number;
              error?: {
                  code: | "type_collision"
                  | "interpolation_error"
                  | "extraction_error"
                  | "embedding_error"
                  | "upsert_error"
                  | "match_failed"
                  | "rule_missing"
                  | "no_content"
                  | "source_unavailable"
                  | "unsupported_content_type"
                  | "invalid_reference"
                  | "unknown_source"
                  | "invalid_id"
                  | "queue_stopped";
                  details?: unknown;
                  message: string;
              };
              matched_rules?: string[];
              source: string;
              status: "indexed"
              | "unchanged"
              | "deleted"
              | "failed";
          },
      >

      The per-document result.

      SourceNotifyQueueStoppedError (as a rejection) when the queue is stopped before the run starts.