@botiverse/raft-sdk 0.3.1 → 0.4.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/dist/index.d.ts CHANGED
@@ -341,8 +341,8 @@ interface RaftNextStep {
341
341
  /**
342
342
  * Structured arguments for the step: plain, serialisable data (never a
343
343
  * closure), so a runtime whose next step runs in another process can store
344
- * it and act on it later — for example spread a held send's `args` into the
345
- * next `messages.send`.
344
+ * it and act on it later — for example the `target` of a `read_target` step.
345
+ * (An interrupted call's resume is `interrupt.resume`, not `args`.)
346
346
  */
347
347
  args?: Record<string, unknown>;
348
348
  /** One sentence explaining why this is the next step. */
@@ -426,6 +426,64 @@ export declare function projectRaftMessage(envelope: AgentApiMessageEnvelope): R
426
426
  /** Project a list, skipping envelopes without a conversation identity. */
427
427
  export declare function projectRaftMessages(envelopes: readonly AgentApiMessageEnvelope[]): RaftMessage[];
428
428
  //#endregion
429
+ //#region ../shared/src/agentOps/interrupt.d.ts
430
+ /** Why the call stopped. */
431
+ type RaftInterruptReason = "unread_messages";
432
+ interface RaftInterruptResume {
433
+ /** The exact `raft` argv that carries out the interrupted call (for example `["message", "send", "--send-draft", …]`). */
434
+ argv: string[];
435
+ /** The interrupted call's original idempotency key, when it has one (a send); resuming reuses it. */
436
+ idempotencyKey?: string;
437
+ }
438
+ interface RaftInterruptCancel {
439
+ /** The exact `raft` argv that releases what the interrupted call left behind (a held send's saved draft). */
440
+ argv: string[];
441
+ }
442
+ interface RaftInterrupt {
443
+ reason: RaftInterruptReason;
444
+ /** What happened and what is new, as the CLI prints it; enough for the model to decide in one turn. */
445
+ context: string;
446
+ /** How to go ahead. Always present. */
447
+ resume: RaftInterruptResume;
448
+ /**
449
+ * How to drop the call when it left something to clean up (today: the draft
450
+ * a held send saved). Absent `cancel` means cancelling needs no request:
451
+ * just don't execute `resume`.
452
+ */
453
+ cancel?: RaftInterruptCancel;
454
+ /** The conversation the unread messages are in. */
455
+ target: string;
456
+ /** How many newer messages the agent has not seen in this conversation. */
457
+ newMessageCount: number;
458
+ /** The newest of them, previewed; the Server may omit older ones. Empty when withheld. */
459
+ heldMessages: RaftMessage[];
460
+ omittedMessageCount: number;
461
+ /** How many of the unread messages formally @mention this agent. */
462
+ formalMentionCount: number;
463
+ /** The seq the Server considers current for this conversation; attesting it says the model saw the context. */
464
+ seenUpToSeq: number | null;
465
+ /** Reviewer isolation: bodies withheld, only a count. */
466
+ withheld: boolean;
467
+ /**
468
+ * Whether `heldMessages` plus `omittedMessageCount` account for every one of
469
+ * `newMessageCount`. When false the model cannot have seen all of them:
470
+ * `frontier.recordHeld(interrupt)` records nothing, and the model should
471
+ * read the conversation before resuming.
472
+ */
473
+ contextComplete: boolean;
474
+ }
475
+ /** The outcome of an interrupted call. */
476
+ interface RaftInterrupted {
477
+ ok: true;
478
+ state: "interrupted";
479
+ interrupt: RaftInterrupt;
480
+ next: RaftNextStep | null;
481
+ /** The canonical text; the same as `interrupt.context`. */
482
+ text: string;
483
+ }
484
+ /** Narrow any outcome (SDK or command registry) to an interrupt, without knowing the command. */
485
+ export declare function isInterrupted(outcome: unknown): outcome is RaftInterrupted;
486
+ //#endregion
429
487
  //#region ../shared/src/agentOps/frontier.d.ts
430
488
  interface SeenAttestation {
431
489
  seenUpToSeq?: number;
@@ -454,15 +512,18 @@ export declare class SeenFrontier {
454
512
  /** Record bodies that were rendered without proving contiguity. */
455
513
  recordExact(target: string, seqs: readonly number[]): void;
456
514
  /**
457
- * Attest that the model saw the context a held send/claim returned. Call it
458
- * only after the held messages actually reached the model (the SDK cannot
459
- * know that, so it never records this implicitly). Returns false and records
460
- * nothing when the context was withheld or the Server sent no boundary.
515
+ * Attest that the model saw the context of an interrupt (`outcome.interrupt`
516
+ * of an `interrupted` send, claim or task write). Call it only after
517
+ * `interrupt.context` actually reached the model (the SDK cannot know that,
518
+ * so it never records this implicitly). Returns false and records nothing
519
+ * when the context was withheld, not fully shown (`contextComplete: false`),
520
+ * or the Server sent no boundary.
461
521
  */
462
522
  recordHeld(held: {
463
523
  target: string;
464
524
  seenUpToSeq: number | null;
465
525
  withheld: boolean;
526
+ contextComplete?: boolean;
466
527
  }): boolean;
467
528
  /** What to attest on a send or claim to `target`; omits `seenUpToSeq` when nothing contiguous is known. */
468
529
  attestation(target: string): SeenAttestation;
@@ -553,6 +614,12 @@ interface ReadHistoryRequest {
553
614
  /** Anchor a window around a seq or message id; records exact seqs only. */
554
615
  around?: number | string;
555
616
  limit?: number;
617
+ /**
618
+ * `false` reads without consuming: the Server does not mark the page read,
619
+ * and nothing is recorded in the seen frontier. Use it when the result may
620
+ * not reach the model (for example, code the agent wrote).
621
+ */
622
+ consume?: boolean;
556
623
  }
557
624
  interface RaftHistoryPage {
558
625
  /** Canonical target the Server resolved (falls back to the requested spelling on older Servers). */
@@ -571,7 +638,8 @@ interface SendMessageRequest {
571
638
  /**
572
639
  * One key per logical message. Generated with `crypto.randomUUID()` when
573
640
  * omitted, so a response lost after the Server committed can be retried
574
- * without posting twice; a `resend` after a hold reuses the same key.
641
+ * without posting twice; sending again after an interrupt reuses the same
642
+ * key (`interrupt.resume.idempotencyKey`).
575
643
  */
576
644
  idempotencyKey?: string;
577
645
  mentions?: AgentApiStructuredMention[];
@@ -593,52 +661,7 @@ interface RaftSent {
593
661
  /** Newer messages the Server returned alongside the acceptance, if any. */
594
662
  recentUnread: RaftMessage[];
595
663
  }
596
- /**
597
- * Plain data that continues a held send in a later process: spread it into
598
- * the next `messages.send({ ...original, ...continuation })`. `seen` is set
599
- * only when the Server reported a boundary and nothing was withheld.
600
- * Spreading `seen` asserts that the model saw the held messages (the same
601
- * attestation as `frontier.recordHeld`); drop it if the held text was stored
602
- * without being handed to the model, and the next send will be held again
603
- * with the same context instead of passing on a false attestation.
604
- */
605
- interface RaftSendContinuation {
606
- idempotencyKey: string;
607
- seen?: {
608
- upToSeq: number;
609
- };
610
- }
611
- interface RaftHeldBase {
612
- target: string;
613
- /** The idempotency key of the held message; a later send with this key is the same logical message. */
614
- idempotencyKey: string;
615
- /** Serialisable continuation for the next step (also carried in `next.args`). */
616
- continuation: RaftSendContinuation;
617
- /** How many newer messages the agent has not seen in this conversation. */
618
- newMessageCount: number;
619
- /** The newest of them, previewed; the Server may omit older ones. */
620
- heldMessages: RaftMessage[];
621
- omittedMessageCount: number;
622
- /** How many of the held messages formally @mention this agent. */
623
- formalMentionCount: number;
624
- /** The seq the Server considers current for this conversation; attesting it says the model saw the held context. */
625
- seenUpToSeq: number | null;
626
- /** Reviewer isolation: bodies withheld, only a count. */
627
- withheld: boolean;
628
- }
629
- interface RaftHeld extends RaftHeldBase {
630
- /**
631
- * In-process sugar over `continuation`: send the same message again after the
632
- * runtime has handled the held context. `seen: "held"` attests the Server's
633
- * `seenUpToSeq` (say this only if the model saw the held messages);
634
- * `seen: "anyway"` bypasses the freshness check. Runtimes whose next step
635
- * runs elsewhere store `continuation` (or `next.args`) instead.
636
- */
637
- resend(options: {
638
- seen: "held" | "anyway";
639
- }): Promise<SendMessageOutcome>;
640
- }
641
- type SendMessageOutcome = RaftOutcome<RaftSent, "sent"> | RaftOutcome<RaftHeld, "held">;
664
+ type SendMessageOutcome = RaftOutcome<RaftSent, "sent"> | RaftInterrupted;
642
665
  //#endregion
643
666
  //#region ../shared/src/agentText/tasks.d.ts
644
667
  interface AgentClaimConflict {
@@ -693,13 +716,7 @@ interface RaftClaimResult {
693
716
  /** At least one row authorises work. */
694
717
  anyAuthorised: boolean;
695
718
  }
696
- interface RaftClaimHeld extends Omit<RaftHeldBase, "idempotencyKey" | "continuation"> {
697
- /** The claim to repeat once the held context has been handled (plain data; also in `next.args`). */
698
- request: ClaimTasksRequest;
699
- /** In-process sugar: retry the identical claim. */
700
- retry(): Promise<ClaimTasksOutcome>;
701
- }
702
- type ClaimTasksOutcome = RaftOutcome<RaftClaimResult, "claimed" | "partial" | "refused"> | RaftOutcome<RaftClaimHeld, "held">;
719
+ type ClaimTasksOutcome = RaftOutcome<RaftClaimResult, "claimed" | "partial" | "refused"> | RaftInterrupted;
703
720
  type RaftTaskStatus = "todo" | "in_progress" | "in_review" | "done" | "closed";
704
721
  interface ListTasksRequest {
705
722
  /** Channel board, for example `#proj-sdk`; omit with `mine: true` for your own tasks across channels. */
@@ -738,11 +755,7 @@ interface AssignTaskRequest extends TaskRef {
738
755
  interface UpdateTaskStatusRequest extends TaskRef {
739
756
  status: RaftTaskStatus;
740
757
  }
741
- type UpdateTaskStatusOutcome = RaftOutcome<UpdateTaskStatusRequest, "updated"> | RaftOutcome<RaftClaimHeldLike<UpdateTaskStatusRequest>, "held">;
742
- /** A hold on a task write: the held context plus the request to repeat, as data. */
743
- type RaftClaimHeldLike<TRequest> = Omit<RaftHeldBase, "idempotencyKey" | "continuation"> & {
744
- request: TRequest;
745
- };
758
+ type UpdateTaskStatusOutcome = RaftOutcome<UpdateTaskStatusRequest, "updated"> | RaftInterrupted;
746
759
  interface AmendTaskRequest extends TaskRef {
747
760
  title?: string;
748
761
  /** New description; `null` clears it. */
@@ -750,7 +763,7 @@ interface AmendTaskRequest extends TaskRef {
750
763
  }
751
764
  type AmendTaskOutcome = RaftOutcome<AgentApiTaskAmendSuccessResponse & {
752
765
  target: string;
753
- }, "amended"> | RaftOutcome<RaftClaimHeldLike<AmendTaskRequest>, "held">;
766
+ }, "amended"> | RaftInterrupted;
754
767
  //#endregion
755
768
  //#region ../shared/src/agentOps/wake.d.ts
756
769
  export declare const RAFT_INBOX_NOTICE_SCHEMA: "raft-agent-inbox-notice.v1";
@@ -1277,8 +1290,8 @@ declare const attachmentUploadSessionSchema: z.ZodObject<{
1277
1290
  pending: "pending";
1278
1291
  canceled: "canceled";
1279
1292
  completed: "completed";
1280
- failed: "failed";
1281
1293
  verifying: "verifying";
1294
+ failed: "failed";
1282
1295
  }>;
1283
1296
  expiresAt: z.ZodISODateTime;
1284
1297
  attachment: z.ZodNullable<z.ZodObject<{
@@ -1422,6 +1435,10 @@ declare const agentApiHistoryQuerySchema: z.ZodObject<{
1422
1435
  after: z.ZodOptional<z.ZodString>;
1423
1436
  around: z.ZodOptional<z.ZodString>;
1424
1437
  limit: z.ZodOptional<z.ZodString>;
1438
+ consume: z.ZodOptional<z.ZodEnum<{
1439
+ true: "true";
1440
+ false: "false";
1441
+ }>>;
1425
1442
  }, z.core.$loose>;
1426
1443
  declare const agentApiKnowledgeGetQuerySchema: z.ZodObject<{
1427
1444
  topic: z.ZodString;
@@ -2841,100 +2858,6 @@ declare const agentApiAppConfigResponseSchema: z.ZodObject<{
2841
2858
  overrides: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>;
2842
2859
  effective: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>;
2843
2860
  }, z.core.$loose>;
2844
- declare const agentApiMigrationBeginBodySchema: z.ZodObject<{
2845
- targetMachineId: z.ZodString;
2846
- prepDeadlineMs: z.ZodOptional<z.ZodNumber>;
2847
- transferDeadlineMs: z.ZodOptional<z.ZodNumber>;
2848
- arrivalDeadlineMs: z.ZodOptional<z.ZodNumber>;
2849
- }, z.core.$loose>;
2850
- declare const agentApiMigrationReadyBodySchema: z.ZodObject<{
2851
- manifestPath: z.ZodString;
2852
- manifestSha256: z.ZodOptional<z.ZodString>;
2853
- }, z.core.$loose>;
2854
- declare const agentApiMigrationArrivedBodySchema: z.ZodObject<{
2855
- reportPath: z.ZodOptional<z.ZodString>;
2856
- reportSha256: z.ZodOptional<z.ZodString>;
2857
- }, z.core.$loose>;
2858
- declare const agentApiMigrationResponseSchema: z.ZodObject<{
2859
- migration: z.ZodObject<{
2860
- id: z.ZodString;
2861
- agentId: z.ZodString;
2862
- sourceMachineId: z.ZodString;
2863
- targetMachineId: z.ZodString;
2864
- state: z.ZodEnum<{
2865
- provisioning: "provisioning";
2866
- prep: "prep";
2867
- ready: "ready";
2868
- in_transit: "in_transit";
2869
- arriving: "arriving";
2870
- starting: "starting";
2871
- cancel_requested_pre_flip: "cancel_requested_pre_flip";
2872
- cancel_requested_post_flip: "cancel_requested_post_flip";
2873
- canceled_pre_flip: "canceled_pre_flip";
2874
- canceled_post_flip: "canceled_post_flip";
2875
- completed: "completed";
2876
- aborted: "aborted";
2877
- failed: "failed";
2878
- }>;
2879
- manifestPath: z.ZodNullable<z.ZodString>;
2880
- manifestSha256: z.ZodNullable<z.ZodString>;
2881
- arrivalReportPath: z.ZodNullable<z.ZodString>;
2882
- arrivalReportSha256: z.ZodNullable<z.ZodString>;
2883
- abortReason: z.ZodNullable<z.ZodString>;
2884
- failureReason: z.ZodNullable<z.ZodString>;
2885
- prepDeadlineAt: z.ZodString;
2886
- transferDeadlineAt: z.ZodString;
2887
- arrivalDeadlineAt: z.ZodString;
2888
- readyAt: z.ZodNullable<z.ZodString>;
2889
- flippedAt: z.ZodNullable<z.ZodString>;
2890
- arrivedAt: z.ZodNullable<z.ZodString>;
2891
- completedAt: z.ZodNullable<z.ZodString>;
2892
- abortedAt: z.ZodNullable<z.ZodString>;
2893
- revision: z.ZodNumber;
2894
- createdAt: z.ZodString;
2895
- updatedAt: z.ZodString;
2896
- }, z.core.$loose>;
2897
- }, z.core.$loose>;
2898
- declare const agentApiMigrationStatusResponseSchema: z.ZodObject<{
2899
- migration: z.ZodNullable<z.ZodObject<{
2900
- id: z.ZodString;
2901
- agentId: z.ZodString;
2902
- sourceMachineId: z.ZodString;
2903
- targetMachineId: z.ZodString;
2904
- state: z.ZodEnum<{
2905
- provisioning: "provisioning";
2906
- prep: "prep";
2907
- ready: "ready";
2908
- in_transit: "in_transit";
2909
- arriving: "arriving";
2910
- starting: "starting";
2911
- cancel_requested_pre_flip: "cancel_requested_pre_flip";
2912
- cancel_requested_post_flip: "cancel_requested_post_flip";
2913
- canceled_pre_flip: "canceled_pre_flip";
2914
- canceled_post_flip: "canceled_post_flip";
2915
- completed: "completed";
2916
- aborted: "aborted";
2917
- failed: "failed";
2918
- }>;
2919
- manifestPath: z.ZodNullable<z.ZodString>;
2920
- manifestSha256: z.ZodNullable<z.ZodString>;
2921
- arrivalReportPath: z.ZodNullable<z.ZodString>;
2922
- arrivalReportSha256: z.ZodNullable<z.ZodString>;
2923
- abortReason: z.ZodNullable<z.ZodString>;
2924
- failureReason: z.ZodNullable<z.ZodString>;
2925
- prepDeadlineAt: z.ZodString;
2926
- transferDeadlineAt: z.ZodString;
2927
- arrivalDeadlineAt: z.ZodString;
2928
- readyAt: z.ZodNullable<z.ZodString>;
2929
- flippedAt: z.ZodNullable<z.ZodString>;
2930
- arrivedAt: z.ZodNullable<z.ZodString>;
2931
- completedAt: z.ZodNullable<z.ZodString>;
2932
- abortedAt: z.ZodNullable<z.ZodString>;
2933
- revision: z.ZodNumber;
2934
- createdAt: z.ZodString;
2935
- updatedAt: z.ZodString;
2936
- }, z.core.$loose>>;
2937
- }, z.core.$loose>;
2938
2861
  declare const agentApiPushWebhookRegisterBodySchema: z.ZodObject<{
2939
2862
  url: z.ZodString;
2940
2863
  secret: z.ZodString;
@@ -3222,6 +3145,10 @@ declare const agentApiContract: {
3222
3145
  after: z.ZodOptional<z.ZodString>;
3223
3146
  around: z.ZodOptional<z.ZodString>;
3224
3147
  limit: z.ZodOptional<z.ZodString>;
3148
+ consume: z.ZodOptional<z.ZodEnum<{
3149
+ true: "true";
3150
+ false: "false";
3151
+ }>>;
3225
3152
  }, z.core.$loose>;
3226
3153
  };
3227
3154
  readonly response: {
@@ -6560,247 +6487,6 @@ declare const agentApiContract: {
6560
6487
  } & {
6561
6488
  fullPath: string;
6562
6489
  };
6563
- readonly migrationBegin: {
6564
- readonly key: "migrationBegin";
6565
- readonly method: "POST";
6566
- readonly path: "/migrations";
6567
- readonly client: {
6568
- readonly resource: "migrations";
6569
- readonly method: "begin";
6570
- };
6571
- readonly capability: "server";
6572
- readonly description: "Begin a migration for the bound agent credential.";
6573
- readonly request: {
6574
- readonly body: z.ZodObject<{
6575
- targetMachineId: z.ZodString;
6576
- prepDeadlineMs: z.ZodOptional<z.ZodNumber>;
6577
- transferDeadlineMs: z.ZodOptional<z.ZodNumber>;
6578
- arrivalDeadlineMs: z.ZodOptional<z.ZodNumber>;
6579
- }, z.core.$loose>;
6580
- };
6581
- readonly response: {
6582
- readonly body: z.ZodObject<{
6583
- migration: z.ZodObject<{
6584
- id: z.ZodString;
6585
- agentId: z.ZodString;
6586
- sourceMachineId: z.ZodString;
6587
- targetMachineId: z.ZodString;
6588
- state: z.ZodEnum<{
6589
- provisioning: "provisioning";
6590
- prep: "prep";
6591
- ready: "ready";
6592
- in_transit: "in_transit";
6593
- arriving: "arriving";
6594
- starting: "starting";
6595
- cancel_requested_pre_flip: "cancel_requested_pre_flip";
6596
- cancel_requested_post_flip: "cancel_requested_post_flip";
6597
- canceled_pre_flip: "canceled_pre_flip";
6598
- canceled_post_flip: "canceled_post_flip";
6599
- completed: "completed";
6600
- aborted: "aborted";
6601
- failed: "failed";
6602
- }>;
6603
- manifestPath: z.ZodNullable<z.ZodString>;
6604
- manifestSha256: z.ZodNullable<z.ZodString>;
6605
- arrivalReportPath: z.ZodNullable<z.ZodString>;
6606
- arrivalReportSha256: z.ZodNullable<z.ZodString>;
6607
- abortReason: z.ZodNullable<z.ZodString>;
6608
- failureReason: z.ZodNullable<z.ZodString>;
6609
- prepDeadlineAt: z.ZodString;
6610
- transferDeadlineAt: z.ZodString;
6611
- arrivalDeadlineAt: z.ZodString;
6612
- readyAt: z.ZodNullable<z.ZodString>;
6613
- flippedAt: z.ZodNullable<z.ZodString>;
6614
- arrivedAt: z.ZodNullable<z.ZodString>;
6615
- completedAt: z.ZodNullable<z.ZodString>;
6616
- abortedAt: z.ZodNullable<z.ZodString>;
6617
- revision: z.ZodNumber;
6618
- createdAt: z.ZodString;
6619
- updatedAt: z.ZodString;
6620
- }, z.core.$loose>;
6621
- }, z.core.$loose>;
6622
- };
6623
- } & {
6624
- fullPath: string;
6625
- };
6626
- readonly migrationStatus: {
6627
- readonly key: "migrationStatus";
6628
- readonly method: "GET";
6629
- readonly path: "/migrations/current";
6630
- readonly client: {
6631
- readonly resource: "migrations";
6632
- readonly method: "status";
6633
- };
6634
- readonly capability: "read";
6635
- readonly description: "Read the active migration for the bound agent credential, if any.";
6636
- readonly request: {};
6637
- readonly response: {
6638
- readonly body: z.ZodObject<{
6639
- migration: z.ZodNullable<z.ZodObject<{
6640
- id: z.ZodString;
6641
- agentId: z.ZodString;
6642
- sourceMachineId: z.ZodString;
6643
- targetMachineId: z.ZodString;
6644
- state: z.ZodEnum<{
6645
- provisioning: "provisioning";
6646
- prep: "prep";
6647
- ready: "ready";
6648
- in_transit: "in_transit";
6649
- arriving: "arriving";
6650
- starting: "starting";
6651
- cancel_requested_pre_flip: "cancel_requested_pre_flip";
6652
- cancel_requested_post_flip: "cancel_requested_post_flip";
6653
- canceled_pre_flip: "canceled_pre_flip";
6654
- canceled_post_flip: "canceled_post_flip";
6655
- completed: "completed";
6656
- aborted: "aborted";
6657
- failed: "failed";
6658
- }>;
6659
- manifestPath: z.ZodNullable<z.ZodString>;
6660
- manifestSha256: z.ZodNullable<z.ZodString>;
6661
- arrivalReportPath: z.ZodNullable<z.ZodString>;
6662
- arrivalReportSha256: z.ZodNullable<z.ZodString>;
6663
- abortReason: z.ZodNullable<z.ZodString>;
6664
- failureReason: z.ZodNullable<z.ZodString>;
6665
- prepDeadlineAt: z.ZodString;
6666
- transferDeadlineAt: z.ZodString;
6667
- arrivalDeadlineAt: z.ZodString;
6668
- readyAt: z.ZodNullable<z.ZodString>;
6669
- flippedAt: z.ZodNullable<z.ZodString>;
6670
- arrivedAt: z.ZodNullable<z.ZodString>;
6671
- completedAt: z.ZodNullable<z.ZodString>;
6672
- abortedAt: z.ZodNullable<z.ZodString>;
6673
- revision: z.ZodNumber;
6674
- createdAt: z.ZodString;
6675
- updatedAt: z.ZodString;
6676
- }, z.core.$loose>>;
6677
- }, z.core.$loose>;
6678
- };
6679
- } & {
6680
- fullPath: string;
6681
- };
6682
- readonly migrationReady: {
6683
- readonly key: "migrationReady";
6684
- readonly method: "POST";
6685
- readonly path: "/migrations/ready";
6686
- readonly client: {
6687
- readonly resource: "migrations";
6688
- readonly method: "ready";
6689
- };
6690
- readonly capability: "read";
6691
- readonly description: "Mark the bound agent's active migration prep phase ready.";
6692
- readonly request: {
6693
- readonly body: z.ZodObject<{
6694
- manifestPath: z.ZodString;
6695
- manifestSha256: z.ZodOptional<z.ZodString>;
6696
- }, z.core.$loose>;
6697
- };
6698
- readonly response: {
6699
- readonly body: z.ZodObject<{
6700
- migration: z.ZodObject<{
6701
- id: z.ZodString;
6702
- agentId: z.ZodString;
6703
- sourceMachineId: z.ZodString;
6704
- targetMachineId: z.ZodString;
6705
- state: z.ZodEnum<{
6706
- provisioning: "provisioning";
6707
- prep: "prep";
6708
- ready: "ready";
6709
- in_transit: "in_transit";
6710
- arriving: "arriving";
6711
- starting: "starting";
6712
- cancel_requested_pre_flip: "cancel_requested_pre_flip";
6713
- cancel_requested_post_flip: "cancel_requested_post_flip";
6714
- canceled_pre_flip: "canceled_pre_flip";
6715
- canceled_post_flip: "canceled_post_flip";
6716
- completed: "completed";
6717
- aborted: "aborted";
6718
- failed: "failed";
6719
- }>;
6720
- manifestPath: z.ZodNullable<z.ZodString>;
6721
- manifestSha256: z.ZodNullable<z.ZodString>;
6722
- arrivalReportPath: z.ZodNullable<z.ZodString>;
6723
- arrivalReportSha256: z.ZodNullable<z.ZodString>;
6724
- abortReason: z.ZodNullable<z.ZodString>;
6725
- failureReason: z.ZodNullable<z.ZodString>;
6726
- prepDeadlineAt: z.ZodString;
6727
- transferDeadlineAt: z.ZodString;
6728
- arrivalDeadlineAt: z.ZodString;
6729
- readyAt: z.ZodNullable<z.ZodString>;
6730
- flippedAt: z.ZodNullable<z.ZodString>;
6731
- arrivedAt: z.ZodNullable<z.ZodString>;
6732
- completedAt: z.ZodNullable<z.ZodString>;
6733
- abortedAt: z.ZodNullable<z.ZodString>;
6734
- revision: z.ZodNumber;
6735
- createdAt: z.ZodString;
6736
- updatedAt: z.ZodString;
6737
- }, z.core.$loose>;
6738
- }, z.core.$loose>;
6739
- };
6740
- } & {
6741
- fullPath: string;
6742
- };
6743
- readonly migrationArrived: {
6744
- readonly key: "migrationArrived";
6745
- readonly method: "POST";
6746
- readonly path: "/migrations/arrived";
6747
- readonly client: {
6748
- readonly resource: "migrations";
6749
- readonly method: "arrived";
6750
- };
6751
- readonly capability: "read";
6752
- readonly description: "Mark the bound agent's active migration arrival phase complete.";
6753
- readonly request: {
6754
- readonly body: z.ZodObject<{
6755
- reportPath: z.ZodOptional<z.ZodString>;
6756
- reportSha256: z.ZodOptional<z.ZodString>;
6757
- }, z.core.$loose>;
6758
- };
6759
- readonly response: {
6760
- readonly body: z.ZodObject<{
6761
- migration: z.ZodObject<{
6762
- id: z.ZodString;
6763
- agentId: z.ZodString;
6764
- sourceMachineId: z.ZodString;
6765
- targetMachineId: z.ZodString;
6766
- state: z.ZodEnum<{
6767
- provisioning: "provisioning";
6768
- prep: "prep";
6769
- ready: "ready";
6770
- in_transit: "in_transit";
6771
- arriving: "arriving";
6772
- starting: "starting";
6773
- cancel_requested_pre_flip: "cancel_requested_pre_flip";
6774
- cancel_requested_post_flip: "cancel_requested_post_flip";
6775
- canceled_pre_flip: "canceled_pre_flip";
6776
- canceled_post_flip: "canceled_post_flip";
6777
- completed: "completed";
6778
- aborted: "aborted";
6779
- failed: "failed";
6780
- }>;
6781
- manifestPath: z.ZodNullable<z.ZodString>;
6782
- manifestSha256: z.ZodNullable<z.ZodString>;
6783
- arrivalReportPath: z.ZodNullable<z.ZodString>;
6784
- arrivalReportSha256: z.ZodNullable<z.ZodString>;
6785
- abortReason: z.ZodNullable<z.ZodString>;
6786
- failureReason: z.ZodNullable<z.ZodString>;
6787
- prepDeadlineAt: z.ZodString;
6788
- transferDeadlineAt: z.ZodString;
6789
- arrivalDeadlineAt: z.ZodString;
6790
- readyAt: z.ZodNullable<z.ZodString>;
6791
- flippedAt: z.ZodNullable<z.ZodString>;
6792
- arrivedAt: z.ZodNullable<z.ZodString>;
6793
- completedAt: z.ZodNullable<z.ZodString>;
6794
- abortedAt: z.ZodNullable<z.ZodString>;
6795
- revision: z.ZodNumber;
6796
- createdAt: z.ZodString;
6797
- updatedAt: z.ZodString;
6798
- }, z.core.$loose>;
6799
- }, z.core.$loose>;
6800
- };
6801
- } & {
6802
- fullPath: string;
6803
- };
6804
6490
  readonly reminderList: {
6805
6491
  readonly key: "reminderList";
6806
6492
  readonly method: "GET";
@@ -8039,8 +7725,8 @@ declare const agentApiContract: {
8039
7725
  pending: "pending";
8040
7726
  canceled: "canceled";
8041
7727
  completed: "completed";
8042
- failed: "failed";
8043
7728
  verifying: "verifying";
7729
+ failed: "failed";
8044
7730
  }>;
8045
7731
  expiresAt: z.ZodISODateTime;
8046
7732
  attachment: z.ZodNullable<z.ZodObject<{
@@ -8085,8 +7771,8 @@ declare const agentApiContract: {
8085
7771
  pending: "pending";
8086
7772
  canceled: "canceled";
8087
7773
  completed: "completed";
8088
- failed: "failed";
8089
7774
  verifying: "verifying";
7775
+ failed: "failed";
8090
7776
  }>;
8091
7777
  expiresAt: z.ZodISODateTime;
8092
7778
  attachment: z.ZodNullable<z.ZodObject<{
@@ -8553,11 +8239,6 @@ type AgentApiIntegrationAppStatusResponse = z.infer<typeof agentApiIntegrationAp
8553
8239
  type AgentApiAttachmentCommentsParams = z.infer<typeof agentApiAttachmentCommentsParamsSchema>;
8554
8240
  type AgentApiAttachmentCommentsQuery = z.infer<typeof agentApiAttachmentCommentsQuerySchema>;
8555
8241
  type AgentApiAttachmentCommentsResponse = z.infer<typeof agentApiAttachmentCommentsResponseSchema>;
8556
- type AgentApiMigrationBeginBody = z.infer<typeof agentApiMigrationBeginBodySchema>;
8557
- type AgentApiMigrationReadyBody = z.infer<typeof agentApiMigrationReadyBodySchema>;
8558
- type AgentApiMigrationArrivedBody = z.infer<typeof agentApiMigrationArrivedBodySchema>;
8559
- type AgentApiMigrationResponse = z.infer<typeof agentApiMigrationResponseSchema>;
8560
- type AgentApiMigrationStatusResponse = z.infer<typeof agentApiMigrationStatusResponseSchema>;
8561
8242
  type AgentApiFeedbackLocatorIngestBody = z.infer<typeof agentApiFeedbackLocatorIngestBodySchema>;
8562
8243
  type AgentApiFeedbackLocatorAcceptance = z.infer<typeof agentApiFeedbackLocatorAcceptanceSchema>;
8563
8244
  type AgentApiFeedbackLocatorListQuery = z.infer<typeof agentApiFeedbackLocatorListQuerySchema>;
@@ -8607,10 +8288,6 @@ type AgentApiRequestParamsByRoute = {
8607
8288
  taskConvert: never;
8608
8289
  taskAmend: never;
8609
8290
  taskHistory: never;
8610
- migrationBegin: never;
8611
- migrationStatus: never;
8612
- migrationReady: never;
8613
- migrationArrived: never;
8614
8291
  reminderList: never;
8615
8292
  reminderCreate: never;
8616
8293
  reminderCancel: AgentApiReminderParams;
@@ -8691,10 +8368,6 @@ type AgentApiRequestQueryByRoute = {
8691
8368
  taskConvert: never;
8692
8369
  taskAmend: never;
8693
8370
  taskHistory: AgentApiTaskHistoryQuery;
8694
- migrationBegin: never;
8695
- migrationStatus: never;
8696
- migrationReady: never;
8697
- migrationArrived: never;
8698
8371
  reminderList: AgentApiReminderListQuery;
8699
8372
  reminderCreate: never;
8700
8373
  reminderCancel: never;
@@ -8775,10 +8448,6 @@ type AgentApiRequestBodyByRoute = {
8775
8448
  taskConvert: AgentApiTaskConvertBody;
8776
8449
  taskAmend: AgentApiTaskAmendBody;
8777
8450
  taskHistory: never;
8778
- migrationBegin: AgentApiMigrationBeginBody;
8779
- migrationStatus: never;
8780
- migrationReady: AgentApiMigrationReadyBody;
8781
- migrationArrived: AgentApiMigrationArrivedBody;
8782
8451
  reminderList: never;
8783
8452
  reminderCreate: AgentApiReminderScheduleBody;
8784
8453
  reminderCancel: never;
@@ -8859,10 +8528,6 @@ type AgentApiResponseByRoute = {
8859
8528
  taskConvert: AgentApiTaskConvertResponse;
8860
8529
  taskAmend: AgentApiTaskAmendResponse;
8861
8530
  taskHistory: AgentApiTaskHistoryResponse;
8862
- migrationBegin: AgentApiMigrationResponse;
8863
- migrationStatus: AgentApiMigrationStatusResponse;
8864
- migrationReady: AgentApiMigrationResponse;
8865
- migrationArrived: AgentApiMigrationResponse;
8866
8531
  reminderList: AgentApiReminderListResponse;
8867
8532
  reminderCreate: AgentApiReminderResponse;
8868
8533
  reminderCancel: AgentApiReminderResponse;
@@ -9439,7 +9104,12 @@ interface Raft {
9439
9104
  messages: {
9440
9105
  /** Read a conversation like `raft message read`; advances the seen frontier by the CLI's rules. */
9441
9106
  read(request: ReadHistoryRequest): Promise<RaftOutcome<RaftHistoryPage, "page" | "empty">>;
9442
- /** Send, attesting the seen frontier. A freshness hold comes back as `state: "held"` with `resend`. */
9107
+ /**
9108
+ * Send, attesting the seen frontier. A freshness hold comes back as
9109
+ * `state: "interrupted"`: show `interrupt.context` to the model; to go
9110
+ * ahead, send the same request again (the held key is reused, also in
9111
+ * `interrupt.resume.idempotencyKey`); to drop it, don't.
9112
+ */
9443
9113
  send(request: SendMessageRequest): Promise<SendMessageOutcome>;
9444
9114
  /** Reply where a received message came from. */
9445
9115
  reply(message: Pick<RaftMessage, "target">, request: Omit<SendMessageRequest, "target">): Promise<SendMessageOutcome>;
@@ -9499,7 +9169,7 @@ interface Raft {
9499
9169
  } & ManualContext): Promise<RaftOutcome<AgentApiKnowledgeSearchResponse, "results" | "empty">>;
9500
9170
  };
9501
9171
  tasks: {
9502
- /** Claim before working. Refusals are rows, not exceptions; a hold comes back as `state: "held"` with `retry`. */
9172
+ /** Claim before working. Refusals are rows, not exceptions; a hold comes back as `state: "interrupted"` (resume = the same claim). */
9503
9173
  claim(request: ClaimTasksRequest): Promise<ClaimTasksOutcome>;
9504
9174
  /** A channel's task board, or your own tasks across channels with `mine: true`. */
9505
9175
  list(request: ListTasksRequest): Promise<RaftOutcome<RaftTaskBoard, "board" | "empty">>;
@@ -9511,7 +9181,7 @@ interface Raft {
9511
9181
  assignee: string | null;
9512
9182
  revision: number;
9513
9183
  }, "assigned" | "unassigned">>;
9514
- /** todo → in_progress → in_review → done; `closed` from anywhere. A hold comes back as `state: "held"` with `data.request`. */
9184
+ /** todo → in_progress → in_review → done; `closed` from anywhere. A hold comes back as `state: "interrupted"` (resume = the same update). */
9515
9185
  updateStatus(request: UpdateTaskStatusRequest): Promise<UpdateTaskStatusOutcome>;
9516
9186
  amend(request: AmendTaskRequest): Promise<AmendTaskOutcome>;
9517
9187
  history(request: TaskRef): Promise<RaftOutcome<AgentApiTaskHistoryResponse & {
@@ -9568,7 +9238,7 @@ interface Raft {
9568
9238
  /** What this process has shown its model, per target; export it to survive restarts. */
9569
9239
  frontier: SeenFrontier;
9570
9240
  state: {
9571
- /** Save now (for example after `frontier.recordHeld`). Best effort; returns whether it succeeded. */
9241
+ /** Save now (for example after `frontier.recordHeld(interrupt)`). Best effort; returns whether it succeeded. */
9572
9242
  save(): Promise<boolean>;
9573
9243
  /** Load the persisted state now (operations do this automatically). */
9574
9244
  load(): Promise<void>;
@@ -9580,4 +9250,4 @@ interface Raft {
9580
9250
  }
9581
9251
  export declare function createRaft(options: CreateRaftOptions): Raft;
9582
9252
  //#endregion
9583
- export type { AmendTaskOutcome, AmendTaskRequest, AssignTaskRequest, BootstrapRaftCredentialOptions, CheckInboxOutcome, CheckInboxRequest, ClaimTasksOutcome, ClaimTasksRequest, CreateRaftClientFromStoreOptions, CreateRaftClientOptions, CreateRaftOptions, CreateRaftRoutesOptions, CreateTasksRequest, DrainInboxRequest, ExecuteMentionActionRequest, ListInboxRequest, ListTasksRequest, ManualContext, PrepareActionCardRequest, Raft, RaftAckMode, RaftActionPrepareRequest, RaftActionPrepared, RaftApiError, RaftApiResult, RaftAppConfig, RaftAppConfigPatch, RaftAttachmentBytes, RaftAttachmentUploaded, RaftAvatarUpload, RaftChannelJoinClient, RaftChannelJoinClientResult, RaftChannelJoinError, RaftChannelJoinFailure, RaftChannelJoinOperation, RaftChannelJoinRequest, RaftChannelJoinResult, RaftChannelJoinSuccess, RaftChannelJoinTransportError, RaftChannelMuteState, RaftChannelRef, RaftClaimHeld, RaftClaimHeldLike, RaftClaimResult, RaftClaimRow, RaftClaimRowState, RaftClient, RaftClientError, RaftClientFailure, RaftClientResult, RaftClientSuccess, RaftClientThrottleOptions, RaftClientTransportRequest, RaftContextAgent, RaftContextData, RaftContextError, RaftContextResult, RaftContextServer, RaftCredentialErrorCode, RaftCredentialIdentity, RaftCredentialStore, RaftEvent, RaftEventAttachment, RaftEventExternalMessage, RaftEventsReceiveData, RaftEventsReceiveError, RaftEventsReceiveRequest, RaftEventsReceiveResult, RaftFailure, RaftHeld, RaftHeldBase, RaftHistoryPage, RaftInboxBatch, RaftInboxCommitResult, RaftInboxConversation, RaftInboxDrainSummary, RaftInboxListing, RaftInboxNotice, RaftLatestReadThread, RaftManageClient, RaftMessage, RaftMessageAttachment, RaftMessageTask, RaftNextStep, RaftNoticeFlag, RaftNoticeTarget, RaftOpError, RaftOpErrorCode, RaftOutcome, RaftPendingMentions, RaftPreparedCard, RaftProfile, RaftProfileUpdate, RaftRouteAnnotations, RaftRouteInfo, RaftRouteKey, RaftRouteMeta, RaftRouteResult, RaftRouteRetryPolicy, RaftRoutes, RaftSdkConfigurationErrorCode, RaftSearchPage, RaftSendContinuation, RaftSenderType, RaftSent, RaftServerInfo, RaftServerProfile, RaftServerUpdate, RaftState, RaftStateContinuation, RaftStateSaveErrorHandler, RaftStateStore, RaftTaskBoard, RaftTaskStatus, RaftTasksCreated, RaftWebhookStatus, ReactRequest, ReadHistoryRequest, ReadLatestReadThreadOptions, SearchMessagesRequest, SeenAttestation, SeenFrontierSnapshot, SendMessageOutcome, SendMessageRequest, ServerInfoRequest, ServerInfoSection, StoredRaftCredential, TaskRef, UpdateTaskStatusOutcome, UpdateTaskStatusRequest, UploadAttachmentRequest, VerifyNoticeInput, VerifyNoticeRejection, VerifyNoticeResult };
9253
+ export type { AmendTaskOutcome, AmendTaskRequest, AssignTaskRequest, BootstrapRaftCredentialOptions, CheckInboxOutcome, CheckInboxRequest, ClaimTasksOutcome, ClaimTasksRequest, CreateRaftClientFromStoreOptions, CreateRaftClientOptions, CreateRaftOptions, CreateRaftRoutesOptions, CreateTasksRequest, DrainInboxRequest, ExecuteMentionActionRequest, ListInboxRequest, ListTasksRequest, ManualContext, PrepareActionCardRequest, Raft, RaftAckMode, RaftActionPrepareRequest, RaftActionPrepared, RaftApiError, RaftApiResult, RaftAppConfig, RaftAppConfigPatch, RaftAttachmentBytes, RaftAttachmentUploaded, RaftAvatarUpload, RaftChannelJoinClient, RaftChannelJoinClientResult, RaftChannelJoinError, RaftChannelJoinFailure, RaftChannelJoinOperation, RaftChannelJoinRequest, RaftChannelJoinResult, RaftChannelJoinSuccess, RaftChannelJoinTransportError, RaftChannelMuteState, RaftChannelRef, RaftClaimResult, RaftClaimRow, RaftClaimRowState, RaftClient, RaftClientError, RaftClientFailure, RaftClientResult, RaftClientSuccess, RaftClientThrottleOptions, RaftClientTransportRequest, RaftContextAgent, RaftContextData, RaftContextError, RaftContextResult, RaftContextServer, RaftCredentialErrorCode, RaftCredentialIdentity, RaftCredentialStore, RaftEvent, RaftEventAttachment, RaftEventExternalMessage, RaftEventsReceiveData, RaftEventsReceiveError, RaftEventsReceiveRequest, RaftEventsReceiveResult, RaftFailure, RaftHistoryPage, RaftInboxBatch, RaftInboxCommitResult, RaftInboxConversation, RaftInboxDrainSummary, RaftInboxListing, RaftInboxNotice, RaftInterrupt, RaftInterruptCancel, RaftInterruptReason, RaftInterruptResume, RaftInterrupted, RaftLatestReadThread, RaftManageClient, RaftMessage, RaftMessageAttachment, RaftMessageTask, RaftNextStep, RaftNoticeFlag, RaftNoticeTarget, RaftOpError, RaftOpErrorCode, RaftOutcome, RaftPendingMentions, RaftPreparedCard, RaftProfile, RaftProfileUpdate, RaftRouteAnnotations, RaftRouteInfo, RaftRouteKey, RaftRouteMeta, RaftRouteResult, RaftRouteRetryPolicy, RaftRoutes, RaftSdkConfigurationErrorCode, RaftSearchPage, RaftSenderType, RaftSent, RaftServerInfo, RaftServerProfile, RaftServerUpdate, RaftState, RaftStateContinuation, RaftStateSaveErrorHandler, RaftStateStore, RaftTaskBoard, RaftTaskStatus, RaftTasksCreated, RaftWebhookStatus, ReactRequest, ReadHistoryRequest, ReadLatestReadThreadOptions, SearchMessagesRequest, SeenAttestation, SeenFrontierSnapshot, SendMessageOutcome, SendMessageRequest, ServerInfoRequest, ServerInfoSection, StoredRaftCredential, TaskRef, UpdateTaskStatusOutcome, UpdateTaskStatusRequest, UploadAttachmentRequest, VerifyNoticeInput, VerifyNoticeRejection, VerifyNoticeResult };