Vana SDK - v4.1.0
    Preparing search index...

    Function waitForDerivativeStatus

    • Poll getDerivativeStatus until the derived scope has an answer or has stopped trying to get one.

      Returns Promise<
          {
              derivedScope: string;
              status: "pending"
              | "failed"
              | "ready"
              | "stale";
              lastComputedAt: string | null;
              derivedVersion: number | null;
              derivedCollectedAt: string | null;
              errorCode:
                  | NonNullable<
                      | "internal"
                      | "inference_unavailable"
                      | "source_missing"
                      | "grant_invalid",
                  >
                  | null;
              retryAfterSeconds: number
              | null;
          },
      >

      The settled status.

      Returns as soon as isDerivativeStatusSettled holds: ready, or failed with no retry pending. A failure the server will retry is not a result, so the wait continues through it — on the server's own cadence, because retryAfterSeconds is when the next compute actually happens and polling faster only spends requests. A failed status is returned, not thrown: the reader branches on errorCode.

      When the budget ran out first. The question keeps computing on the server; call again.

      const status = await waitForDerivativeStatus({
      personalServerUrl,
      derivedScope: "coach.weekly",
      grantId,
      signer,
      timeoutMs: 60_000,
      });
      if (status.status !== "ready") console.log(status.errorCode);