@botiverse/raft-sdk 0.3.2 → 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,11 +512,12 @@ 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, not fully shown
461
- * (`contextComplete: false`), 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.
462
521
  */
463
522
  recordHeld(held: {
464
523
  target: string;
@@ -555,6 +614,12 @@ interface ReadHistoryRequest {
555
614
  /** Anchor a window around a seq or message id; records exact seqs only. */
556
615
  around?: number | string;
557
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;
558
623
  }
559
624
  interface RaftHistoryPage {
560
625
  /** Canonical target the Server resolved (falls back to the requested spelling on older Servers). */
@@ -573,7 +638,8 @@ interface SendMessageRequest {
573
638
  /**
574
639
  * One key per logical message. Generated with `crypto.randomUUID()` when
575
640
  * omitted, so a response lost after the Server committed can be retried
576
- * 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`).
577
643
  */
578
644
  idempotencyKey?: string;
579
645
  mentions?: AgentApiStructuredMention[];
@@ -595,59 +661,7 @@ interface RaftSent {
595
661
  /** Newer messages the Server returned alongside the acceptance, if any. */
596
662
  recentUnread: RaftMessage[];
597
663
  }
598
- /**
599
- * Plain data that continues a held send in a later process: spread it into
600
- * the next `messages.send({ ...original, ...continuation })`. `seen` is set
601
- * only when the Server reported a boundary and nothing was withheld.
602
- * Spreading `seen` asserts that the model saw the held messages (the same
603
- * attestation as `frontier.recordHeld`); drop it if the held text was stored
604
- * without being handed to the model, and the next send will be held again
605
- * with the same context instead of passing on a false attestation.
606
- */
607
- interface RaftSendContinuation {
608
- idempotencyKey: string;
609
- seen?: {
610
- upToSeq: number;
611
- };
612
- }
613
- interface RaftHeldBase {
614
- target: string;
615
- /** The idempotency key of the held message; a later send with this key is the same logical message. */
616
- idempotencyKey: string;
617
- /** Serialisable continuation for the next step (also carried in `next.args`). */
618
- continuation: RaftSendContinuation;
619
- /** How many newer messages the agent has not seen in this conversation. */
620
- newMessageCount: number;
621
- /** The newest of them, previewed; the Server may omit older ones. */
622
- heldMessages: RaftMessage[];
623
- omittedMessageCount: number;
624
- /** How many of the held messages formally @mention this agent. */
625
- formalMentionCount: number;
626
- /** The seq the Server considers current for this conversation; attesting it says the model saw the held context. */
627
- seenUpToSeq: number | null;
628
- /** Reviewer isolation: bodies withheld, only a count. */
629
- withheld: boolean;
630
- /**
631
- * Whether `heldMessages` plus `omittedMessageCount` account for every one of
632
- * `newMessageCount`. When false the model cannot have seen all of them, so
633
- * no `seen` is offered and `frontier.recordHeld` records nothing; read the
634
- * conversation instead.
635
- */
636
- contextComplete: boolean;
637
- }
638
- interface RaftHeld extends RaftHeldBase {
639
- /**
640
- * In-process sugar over `continuation`: send the same message again after the
641
- * runtime has handled the held context. `seen: "held"` attests the Server's
642
- * `seenUpToSeq` (say this only if the model saw the held messages);
643
- * `seen: "anyway"` bypasses the freshness check. Runtimes whose next step
644
- * runs elsewhere store `continuation` (or `next.args`) instead.
645
- */
646
- resend(options: {
647
- seen: "held" | "anyway";
648
- }): Promise<SendMessageOutcome>;
649
- }
650
- type SendMessageOutcome = RaftOutcome<RaftSent, "sent"> | RaftOutcome<RaftHeld, "held">;
664
+ type SendMessageOutcome = RaftOutcome<RaftSent, "sent"> | RaftInterrupted;
651
665
  //#endregion
652
666
  //#region ../shared/src/agentText/tasks.d.ts
653
667
  interface AgentClaimConflict {
@@ -702,13 +716,7 @@ interface RaftClaimResult {
702
716
  /** At least one row authorises work. */
703
717
  anyAuthorised: boolean;
704
718
  }
705
- interface RaftClaimHeld extends Omit<RaftHeldBase, "idempotencyKey" | "continuation"> {
706
- /** The claim to repeat once the held context has been handled (plain data; also in `next.args`). */
707
- request: ClaimTasksRequest;
708
- /** In-process sugar: retry the identical claim. */
709
- retry(): Promise<ClaimTasksOutcome>;
710
- }
711
- type ClaimTasksOutcome = RaftOutcome<RaftClaimResult, "claimed" | "partial" | "refused"> | RaftOutcome<RaftClaimHeld, "held">;
719
+ type ClaimTasksOutcome = RaftOutcome<RaftClaimResult, "claimed" | "partial" | "refused"> | RaftInterrupted;
712
720
  type RaftTaskStatus = "todo" | "in_progress" | "in_review" | "done" | "closed";
713
721
  interface ListTasksRequest {
714
722
  /** Channel board, for example `#proj-sdk`; omit with `mine: true` for your own tasks across channels. */
@@ -747,11 +755,7 @@ interface AssignTaskRequest extends TaskRef {
747
755
  interface UpdateTaskStatusRequest extends TaskRef {
748
756
  status: RaftTaskStatus;
749
757
  }
750
- type UpdateTaskStatusOutcome = RaftOutcome<UpdateTaskStatusRequest, "updated"> | RaftOutcome<RaftClaimHeldLike<UpdateTaskStatusRequest>, "held">;
751
- /** A hold on a task write: the held context plus the request to repeat, as data. */
752
- type RaftClaimHeldLike<TRequest> = Omit<RaftHeldBase, "idempotencyKey" | "continuation"> & {
753
- request: TRequest;
754
- };
758
+ type UpdateTaskStatusOutcome = RaftOutcome<UpdateTaskStatusRequest, "updated"> | RaftInterrupted;
755
759
  interface AmendTaskRequest extends TaskRef {
756
760
  title?: string;
757
761
  /** New description; `null` clears it. */
@@ -759,7 +763,7 @@ interface AmendTaskRequest extends TaskRef {
759
763
  }
760
764
  type AmendTaskOutcome = RaftOutcome<AgentApiTaskAmendSuccessResponse & {
761
765
  target: string;
762
- }, "amended"> | RaftOutcome<RaftClaimHeldLike<AmendTaskRequest>, "held">;
766
+ }, "amended"> | RaftInterrupted;
763
767
  //#endregion
764
768
  //#region ../shared/src/agentOps/wake.d.ts
765
769
  export declare const RAFT_INBOX_NOTICE_SCHEMA: "raft-agent-inbox-notice.v1";
@@ -1286,8 +1290,8 @@ declare const attachmentUploadSessionSchema: z.ZodObject<{
1286
1290
  pending: "pending";
1287
1291
  canceled: "canceled";
1288
1292
  completed: "completed";
1289
- failed: "failed";
1290
1293
  verifying: "verifying";
1294
+ failed: "failed";
1291
1295
  }>;
1292
1296
  expiresAt: z.ZodISODateTime;
1293
1297
  attachment: z.ZodNullable<z.ZodObject<{
@@ -1431,6 +1435,10 @@ declare const agentApiHistoryQuerySchema: z.ZodObject<{
1431
1435
  after: z.ZodOptional<z.ZodString>;
1432
1436
  around: z.ZodOptional<z.ZodString>;
1433
1437
  limit: z.ZodOptional<z.ZodString>;
1438
+ consume: z.ZodOptional<z.ZodEnum<{
1439
+ true: "true";
1440
+ false: "false";
1441
+ }>>;
1434
1442
  }, z.core.$loose>;
1435
1443
  declare const agentApiKnowledgeGetQuerySchema: z.ZodObject<{
1436
1444
  topic: z.ZodString;
@@ -2850,100 +2858,6 @@ declare const agentApiAppConfigResponseSchema: z.ZodObject<{
2850
2858
  overrides: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>;
2851
2859
  effective: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>;
2852
2860
  }, z.core.$loose>;
2853
- declare const agentApiMigrationBeginBodySchema: z.ZodObject<{
2854
- targetMachineId: z.ZodString;
2855
- prepDeadlineMs: z.ZodOptional<z.ZodNumber>;
2856
- transferDeadlineMs: z.ZodOptional<z.ZodNumber>;
2857
- arrivalDeadlineMs: z.ZodOptional<z.ZodNumber>;
2858
- }, z.core.$loose>;
2859
- declare const agentApiMigrationReadyBodySchema: z.ZodObject<{
2860
- manifestPath: z.ZodString;
2861
- manifestSha256: z.ZodOptional<z.ZodString>;
2862
- }, z.core.$loose>;
2863
- declare const agentApiMigrationArrivedBodySchema: z.ZodObject<{
2864
- reportPath: z.ZodOptional<z.ZodString>;
2865
- reportSha256: z.ZodOptional<z.ZodString>;
2866
- }, z.core.$loose>;
2867
- declare const agentApiMigrationResponseSchema: z.ZodObject<{
2868
- migration: z.ZodObject<{
2869
- id: z.ZodString;
2870
- agentId: z.ZodString;
2871
- sourceMachineId: z.ZodString;
2872
- targetMachineId: z.ZodString;
2873
- state: z.ZodEnum<{
2874
- provisioning: "provisioning";
2875
- prep: "prep";
2876
- ready: "ready";
2877
- in_transit: "in_transit";
2878
- arriving: "arriving";
2879
- starting: "starting";
2880
- cancel_requested_pre_flip: "cancel_requested_pre_flip";
2881
- cancel_requested_post_flip: "cancel_requested_post_flip";
2882
- canceled_pre_flip: "canceled_pre_flip";
2883
- canceled_post_flip: "canceled_post_flip";
2884
- completed: "completed";
2885
- aborted: "aborted";
2886
- failed: "failed";
2887
- }>;
2888
- manifestPath: z.ZodNullable<z.ZodString>;
2889
- manifestSha256: z.ZodNullable<z.ZodString>;
2890
- arrivalReportPath: z.ZodNullable<z.ZodString>;
2891
- arrivalReportSha256: z.ZodNullable<z.ZodString>;
2892
- abortReason: z.ZodNullable<z.ZodString>;
2893
- failureReason: z.ZodNullable<z.ZodString>;
2894
- prepDeadlineAt: z.ZodString;
2895
- transferDeadlineAt: z.ZodString;
2896
- arrivalDeadlineAt: z.ZodString;
2897
- readyAt: z.ZodNullable<z.ZodString>;
2898
- flippedAt: z.ZodNullable<z.ZodString>;
2899
- arrivedAt: z.ZodNullable<z.ZodString>;
2900
- completedAt: z.ZodNullable<z.ZodString>;
2901
- abortedAt: z.ZodNullable<z.ZodString>;
2902
- revision: z.ZodNumber;
2903
- createdAt: z.ZodString;
2904
- updatedAt: z.ZodString;
2905
- }, z.core.$loose>;
2906
- }, z.core.$loose>;
2907
- declare const agentApiMigrationStatusResponseSchema: z.ZodObject<{
2908
- migration: z.ZodNullable<z.ZodObject<{
2909
- id: z.ZodString;
2910
- agentId: z.ZodString;
2911
- sourceMachineId: z.ZodString;
2912
- targetMachineId: z.ZodString;
2913
- state: z.ZodEnum<{
2914
- provisioning: "provisioning";
2915
- prep: "prep";
2916
- ready: "ready";
2917
- in_transit: "in_transit";
2918
- arriving: "arriving";
2919
- starting: "starting";
2920
- cancel_requested_pre_flip: "cancel_requested_pre_flip";
2921
- cancel_requested_post_flip: "cancel_requested_post_flip";
2922
- canceled_pre_flip: "canceled_pre_flip";
2923
- canceled_post_flip: "canceled_post_flip";
2924
- completed: "completed";
2925
- aborted: "aborted";
2926
- failed: "failed";
2927
- }>;
2928
- manifestPath: z.ZodNullable<z.ZodString>;
2929
- manifestSha256: z.ZodNullable<z.ZodString>;
2930
- arrivalReportPath: z.ZodNullable<z.ZodString>;
2931
- arrivalReportSha256: z.ZodNullable<z.ZodString>;
2932
- abortReason: z.ZodNullable<z.ZodString>;
2933
- failureReason: z.ZodNullable<z.ZodString>;
2934
- prepDeadlineAt: z.ZodString;
2935
- transferDeadlineAt: z.ZodString;
2936
- arrivalDeadlineAt: z.ZodString;
2937
- readyAt: z.ZodNullable<z.ZodString>;
2938
- flippedAt: z.ZodNullable<z.ZodString>;
2939
- arrivedAt: z.ZodNullable<z.ZodString>;
2940
- completedAt: z.ZodNullable<z.ZodString>;
2941
- abortedAt: z.ZodNullable<z.ZodString>;
2942
- revision: z.ZodNumber;
2943
- createdAt: z.ZodString;
2944
- updatedAt: z.ZodString;
2945
- }, z.core.$loose>>;
2946
- }, z.core.$loose>;
2947
2861
  declare const agentApiPushWebhookRegisterBodySchema: z.ZodObject<{
2948
2862
  url: z.ZodString;
2949
2863
  secret: z.ZodString;
@@ -3231,6 +3145,10 @@ declare const agentApiContract: {
3231
3145
  after: z.ZodOptional<z.ZodString>;
3232
3146
  around: z.ZodOptional<z.ZodString>;
3233
3147
  limit: z.ZodOptional<z.ZodString>;
3148
+ consume: z.ZodOptional<z.ZodEnum<{
3149
+ true: "true";
3150
+ false: "false";
3151
+ }>>;
3234
3152
  }, z.core.$loose>;
3235
3153
  };
3236
3154
  readonly response: {
@@ -6569,247 +6487,6 @@ declare const agentApiContract: {
6569
6487
  } & {
6570
6488
  fullPath: string;
6571
6489
  };
6572
- readonly migrationBegin: {
6573
- readonly key: "migrationBegin";
6574
- readonly method: "POST";
6575
- readonly path: "/migrations";
6576
- readonly client: {
6577
- readonly resource: "migrations";
6578
- readonly method: "begin";
6579
- };
6580
- readonly capability: "server";
6581
- readonly description: "Begin a migration for the bound agent credential.";
6582
- readonly request: {
6583
- readonly body: z.ZodObject<{
6584
- targetMachineId: z.ZodString;
6585
- prepDeadlineMs: z.ZodOptional<z.ZodNumber>;
6586
- transferDeadlineMs: z.ZodOptional<z.ZodNumber>;
6587
- arrivalDeadlineMs: z.ZodOptional<z.ZodNumber>;
6588
- }, z.core.$loose>;
6589
- };
6590
- readonly response: {
6591
- readonly body: z.ZodObject<{
6592
- migration: z.ZodObject<{
6593
- id: z.ZodString;
6594
- agentId: z.ZodString;
6595
- sourceMachineId: z.ZodString;
6596
- targetMachineId: z.ZodString;
6597
- state: z.ZodEnum<{
6598
- provisioning: "provisioning";
6599
- prep: "prep";
6600
- ready: "ready";
6601
- in_transit: "in_transit";
6602
- arriving: "arriving";
6603
- starting: "starting";
6604
- cancel_requested_pre_flip: "cancel_requested_pre_flip";
6605
- cancel_requested_post_flip: "cancel_requested_post_flip";
6606
- canceled_pre_flip: "canceled_pre_flip";
6607
- canceled_post_flip: "canceled_post_flip";
6608
- completed: "completed";
6609
- aborted: "aborted";
6610
- failed: "failed";
6611
- }>;
6612
- manifestPath: z.ZodNullable<z.ZodString>;
6613
- manifestSha256: z.ZodNullable<z.ZodString>;
6614
- arrivalReportPath: z.ZodNullable<z.ZodString>;
6615
- arrivalReportSha256: z.ZodNullable<z.ZodString>;
6616
- abortReason: z.ZodNullable<z.ZodString>;
6617
- failureReason: z.ZodNullable<z.ZodString>;
6618
- prepDeadlineAt: z.ZodString;
6619
- transferDeadlineAt: z.ZodString;
6620
- arrivalDeadlineAt: z.ZodString;
6621
- readyAt: z.ZodNullable<z.ZodString>;
6622
- flippedAt: z.ZodNullable<z.ZodString>;
6623
- arrivedAt: z.ZodNullable<z.ZodString>;
6624
- completedAt: z.ZodNullable<z.ZodString>;
6625
- abortedAt: z.ZodNullable<z.ZodString>;
6626
- revision: z.ZodNumber;
6627
- createdAt: z.ZodString;
6628
- updatedAt: z.ZodString;
6629
- }, z.core.$loose>;
6630
- }, z.core.$loose>;
6631
- };
6632
- } & {
6633
- fullPath: string;
6634
- };
6635
- readonly migrationStatus: {
6636
- readonly key: "migrationStatus";
6637
- readonly method: "GET";
6638
- readonly path: "/migrations/current";
6639
- readonly client: {
6640
- readonly resource: "migrations";
6641
- readonly method: "status";
6642
- };
6643
- readonly capability: "read";
6644
- readonly description: "Read the active migration for the bound agent credential, if any.";
6645
- readonly request: {};
6646
- readonly response: {
6647
- readonly body: z.ZodObject<{
6648
- migration: z.ZodNullable<z.ZodObject<{
6649
- id: z.ZodString;
6650
- agentId: z.ZodString;
6651
- sourceMachineId: z.ZodString;
6652
- targetMachineId: z.ZodString;
6653
- state: z.ZodEnum<{
6654
- provisioning: "provisioning";
6655
- prep: "prep";
6656
- ready: "ready";
6657
- in_transit: "in_transit";
6658
- arriving: "arriving";
6659
- starting: "starting";
6660
- cancel_requested_pre_flip: "cancel_requested_pre_flip";
6661
- cancel_requested_post_flip: "cancel_requested_post_flip";
6662
- canceled_pre_flip: "canceled_pre_flip";
6663
- canceled_post_flip: "canceled_post_flip";
6664
- completed: "completed";
6665
- aborted: "aborted";
6666
- failed: "failed";
6667
- }>;
6668
- manifestPath: z.ZodNullable<z.ZodString>;
6669
- manifestSha256: z.ZodNullable<z.ZodString>;
6670
- arrivalReportPath: z.ZodNullable<z.ZodString>;
6671
- arrivalReportSha256: z.ZodNullable<z.ZodString>;
6672
- abortReason: z.ZodNullable<z.ZodString>;
6673
- failureReason: z.ZodNullable<z.ZodString>;
6674
- prepDeadlineAt: z.ZodString;
6675
- transferDeadlineAt: z.ZodString;
6676
- arrivalDeadlineAt: z.ZodString;
6677
- readyAt: z.ZodNullable<z.ZodString>;
6678
- flippedAt: z.ZodNullable<z.ZodString>;
6679
- arrivedAt: z.ZodNullable<z.ZodString>;
6680
- completedAt: z.ZodNullable<z.ZodString>;
6681
- abortedAt: z.ZodNullable<z.ZodString>;
6682
- revision: z.ZodNumber;
6683
- createdAt: z.ZodString;
6684
- updatedAt: z.ZodString;
6685
- }, z.core.$loose>>;
6686
- }, z.core.$loose>;
6687
- };
6688
- } & {
6689
- fullPath: string;
6690
- };
6691
- readonly migrationReady: {
6692
- readonly key: "migrationReady";
6693
- readonly method: "POST";
6694
- readonly path: "/migrations/ready";
6695
- readonly client: {
6696
- readonly resource: "migrations";
6697
- readonly method: "ready";
6698
- };
6699
- readonly capability: "read";
6700
- readonly description: "Mark the bound agent's active migration prep phase ready.";
6701
- readonly request: {
6702
- readonly body: z.ZodObject<{
6703
- manifestPath: z.ZodString;
6704
- manifestSha256: z.ZodOptional<z.ZodString>;
6705
- }, z.core.$loose>;
6706
- };
6707
- readonly response: {
6708
- readonly body: z.ZodObject<{
6709
- migration: z.ZodObject<{
6710
- id: z.ZodString;
6711
- agentId: z.ZodString;
6712
- sourceMachineId: z.ZodString;
6713
- targetMachineId: z.ZodString;
6714
- state: z.ZodEnum<{
6715
- provisioning: "provisioning";
6716
- prep: "prep";
6717
- ready: "ready";
6718
- in_transit: "in_transit";
6719
- arriving: "arriving";
6720
- starting: "starting";
6721
- cancel_requested_pre_flip: "cancel_requested_pre_flip";
6722
- cancel_requested_post_flip: "cancel_requested_post_flip";
6723
- canceled_pre_flip: "canceled_pre_flip";
6724
- canceled_post_flip: "canceled_post_flip";
6725
- completed: "completed";
6726
- aborted: "aborted";
6727
- failed: "failed";
6728
- }>;
6729
- manifestPath: z.ZodNullable<z.ZodString>;
6730
- manifestSha256: z.ZodNullable<z.ZodString>;
6731
- arrivalReportPath: z.ZodNullable<z.ZodString>;
6732
- arrivalReportSha256: z.ZodNullable<z.ZodString>;
6733
- abortReason: z.ZodNullable<z.ZodString>;
6734
- failureReason: z.ZodNullable<z.ZodString>;
6735
- prepDeadlineAt: z.ZodString;
6736
- transferDeadlineAt: z.ZodString;
6737
- arrivalDeadlineAt: z.ZodString;
6738
- readyAt: z.ZodNullable<z.ZodString>;
6739
- flippedAt: z.ZodNullable<z.ZodString>;
6740
- arrivedAt: z.ZodNullable<z.ZodString>;
6741
- completedAt: z.ZodNullable<z.ZodString>;
6742
- abortedAt: z.ZodNullable<z.ZodString>;
6743
- revision: z.ZodNumber;
6744
- createdAt: z.ZodString;
6745
- updatedAt: z.ZodString;
6746
- }, z.core.$loose>;
6747
- }, z.core.$loose>;
6748
- };
6749
- } & {
6750
- fullPath: string;
6751
- };
6752
- readonly migrationArrived: {
6753
- readonly key: "migrationArrived";
6754
- readonly method: "POST";
6755
- readonly path: "/migrations/arrived";
6756
- readonly client: {
6757
- readonly resource: "migrations";
6758
- readonly method: "arrived";
6759
- };
6760
- readonly capability: "read";
6761
- readonly description: "Mark the bound agent's active migration arrival phase complete.";
6762
- readonly request: {
6763
- readonly body: z.ZodObject<{
6764
- reportPath: z.ZodOptional<z.ZodString>;
6765
- reportSha256: z.ZodOptional<z.ZodString>;
6766
- }, z.core.$loose>;
6767
- };
6768
- readonly response: {
6769
- readonly body: z.ZodObject<{
6770
- migration: z.ZodObject<{
6771
- id: z.ZodString;
6772
- agentId: z.ZodString;
6773
- sourceMachineId: z.ZodString;
6774
- targetMachineId: z.ZodString;
6775
- state: z.ZodEnum<{
6776
- provisioning: "provisioning";
6777
- prep: "prep";
6778
- ready: "ready";
6779
- in_transit: "in_transit";
6780
- arriving: "arriving";
6781
- starting: "starting";
6782
- cancel_requested_pre_flip: "cancel_requested_pre_flip";
6783
- cancel_requested_post_flip: "cancel_requested_post_flip";
6784
- canceled_pre_flip: "canceled_pre_flip";
6785
- canceled_post_flip: "canceled_post_flip";
6786
- completed: "completed";
6787
- aborted: "aborted";
6788
- failed: "failed";
6789
- }>;
6790
- manifestPath: z.ZodNullable<z.ZodString>;
6791
- manifestSha256: z.ZodNullable<z.ZodString>;
6792
- arrivalReportPath: z.ZodNullable<z.ZodString>;
6793
- arrivalReportSha256: z.ZodNullable<z.ZodString>;
6794
- abortReason: z.ZodNullable<z.ZodString>;
6795
- failureReason: z.ZodNullable<z.ZodString>;
6796
- prepDeadlineAt: z.ZodString;
6797
- transferDeadlineAt: z.ZodString;
6798
- arrivalDeadlineAt: z.ZodString;
6799
- readyAt: z.ZodNullable<z.ZodString>;
6800
- flippedAt: z.ZodNullable<z.ZodString>;
6801
- arrivedAt: z.ZodNullable<z.ZodString>;
6802
- completedAt: z.ZodNullable<z.ZodString>;
6803
- abortedAt: z.ZodNullable<z.ZodString>;
6804
- revision: z.ZodNumber;
6805
- createdAt: z.ZodString;
6806
- updatedAt: z.ZodString;
6807
- }, z.core.$loose>;
6808
- }, z.core.$loose>;
6809
- };
6810
- } & {
6811
- fullPath: string;
6812
- };
6813
6490
  readonly reminderList: {
6814
6491
  readonly key: "reminderList";
6815
6492
  readonly method: "GET";
@@ -8048,8 +7725,8 @@ declare const agentApiContract: {
8048
7725
  pending: "pending";
8049
7726
  canceled: "canceled";
8050
7727
  completed: "completed";
8051
- failed: "failed";
8052
7728
  verifying: "verifying";
7729
+ failed: "failed";
8053
7730
  }>;
8054
7731
  expiresAt: z.ZodISODateTime;
8055
7732
  attachment: z.ZodNullable<z.ZodObject<{
@@ -8094,8 +7771,8 @@ declare const agentApiContract: {
8094
7771
  pending: "pending";
8095
7772
  canceled: "canceled";
8096
7773
  completed: "completed";
8097
- failed: "failed";
8098
7774
  verifying: "verifying";
7775
+ failed: "failed";
8099
7776
  }>;
8100
7777
  expiresAt: z.ZodISODateTime;
8101
7778
  attachment: z.ZodNullable<z.ZodObject<{
@@ -8562,11 +8239,6 @@ type AgentApiIntegrationAppStatusResponse = z.infer<typeof agentApiIntegrationAp
8562
8239
  type AgentApiAttachmentCommentsParams = z.infer<typeof agentApiAttachmentCommentsParamsSchema>;
8563
8240
  type AgentApiAttachmentCommentsQuery = z.infer<typeof agentApiAttachmentCommentsQuerySchema>;
8564
8241
  type AgentApiAttachmentCommentsResponse = z.infer<typeof agentApiAttachmentCommentsResponseSchema>;
8565
- type AgentApiMigrationBeginBody = z.infer<typeof agentApiMigrationBeginBodySchema>;
8566
- type AgentApiMigrationReadyBody = z.infer<typeof agentApiMigrationReadyBodySchema>;
8567
- type AgentApiMigrationArrivedBody = z.infer<typeof agentApiMigrationArrivedBodySchema>;
8568
- type AgentApiMigrationResponse = z.infer<typeof agentApiMigrationResponseSchema>;
8569
- type AgentApiMigrationStatusResponse = z.infer<typeof agentApiMigrationStatusResponseSchema>;
8570
8242
  type AgentApiFeedbackLocatorIngestBody = z.infer<typeof agentApiFeedbackLocatorIngestBodySchema>;
8571
8243
  type AgentApiFeedbackLocatorAcceptance = z.infer<typeof agentApiFeedbackLocatorAcceptanceSchema>;
8572
8244
  type AgentApiFeedbackLocatorListQuery = z.infer<typeof agentApiFeedbackLocatorListQuerySchema>;
@@ -8616,10 +8288,6 @@ type AgentApiRequestParamsByRoute = {
8616
8288
  taskConvert: never;
8617
8289
  taskAmend: never;
8618
8290
  taskHistory: never;
8619
- migrationBegin: never;
8620
- migrationStatus: never;
8621
- migrationReady: never;
8622
- migrationArrived: never;
8623
8291
  reminderList: never;
8624
8292
  reminderCreate: never;
8625
8293
  reminderCancel: AgentApiReminderParams;
@@ -8700,10 +8368,6 @@ type AgentApiRequestQueryByRoute = {
8700
8368
  taskConvert: never;
8701
8369
  taskAmend: never;
8702
8370
  taskHistory: AgentApiTaskHistoryQuery;
8703
- migrationBegin: never;
8704
- migrationStatus: never;
8705
- migrationReady: never;
8706
- migrationArrived: never;
8707
8371
  reminderList: AgentApiReminderListQuery;
8708
8372
  reminderCreate: never;
8709
8373
  reminderCancel: never;
@@ -8784,10 +8448,6 @@ type AgentApiRequestBodyByRoute = {
8784
8448
  taskConvert: AgentApiTaskConvertBody;
8785
8449
  taskAmend: AgentApiTaskAmendBody;
8786
8450
  taskHistory: never;
8787
- migrationBegin: AgentApiMigrationBeginBody;
8788
- migrationStatus: never;
8789
- migrationReady: AgentApiMigrationReadyBody;
8790
- migrationArrived: AgentApiMigrationArrivedBody;
8791
8451
  reminderList: never;
8792
8452
  reminderCreate: AgentApiReminderScheduleBody;
8793
8453
  reminderCancel: never;
@@ -8868,10 +8528,6 @@ type AgentApiResponseByRoute = {
8868
8528
  taskConvert: AgentApiTaskConvertResponse;
8869
8529
  taskAmend: AgentApiTaskAmendResponse;
8870
8530
  taskHistory: AgentApiTaskHistoryResponse;
8871
- migrationBegin: AgentApiMigrationResponse;
8872
- migrationStatus: AgentApiMigrationStatusResponse;
8873
- migrationReady: AgentApiMigrationResponse;
8874
- migrationArrived: AgentApiMigrationResponse;
8875
8531
  reminderList: AgentApiReminderListResponse;
8876
8532
  reminderCreate: AgentApiReminderResponse;
8877
8533
  reminderCancel: AgentApiReminderResponse;
@@ -9448,7 +9104,12 @@ interface Raft {
9448
9104
  messages: {
9449
9105
  /** Read a conversation like `raft message read`; advances the seen frontier by the CLI's rules. */
9450
9106
  read(request: ReadHistoryRequest): Promise<RaftOutcome<RaftHistoryPage, "page" | "empty">>;
9451
- /** 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
+ */
9452
9113
  send(request: SendMessageRequest): Promise<SendMessageOutcome>;
9453
9114
  /** Reply where a received message came from. */
9454
9115
  reply(message: Pick<RaftMessage, "target">, request: Omit<SendMessageRequest, "target">): Promise<SendMessageOutcome>;
@@ -9508,7 +9169,7 @@ interface Raft {
9508
9169
  } & ManualContext): Promise<RaftOutcome<AgentApiKnowledgeSearchResponse, "results" | "empty">>;
9509
9170
  };
9510
9171
  tasks: {
9511
- /** 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). */
9512
9173
  claim(request: ClaimTasksRequest): Promise<ClaimTasksOutcome>;
9513
9174
  /** A channel's task board, or your own tasks across channels with `mine: true`. */
9514
9175
  list(request: ListTasksRequest): Promise<RaftOutcome<RaftTaskBoard, "board" | "empty">>;
@@ -9520,7 +9181,7 @@ interface Raft {
9520
9181
  assignee: string | null;
9521
9182
  revision: number;
9522
9183
  }, "assigned" | "unassigned">>;
9523
- /** 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). */
9524
9185
  updateStatus(request: UpdateTaskStatusRequest): Promise<UpdateTaskStatusOutcome>;
9525
9186
  amend(request: AmendTaskRequest): Promise<AmendTaskOutcome>;
9526
9187
  history(request: TaskRef): Promise<RaftOutcome<AgentApiTaskHistoryResponse & {
@@ -9577,7 +9238,7 @@ interface Raft {
9577
9238
  /** What this process has shown its model, per target; export it to survive restarts. */
9578
9239
  frontier: SeenFrontier;
9579
9240
  state: {
9580
- /** 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. */
9581
9242
  save(): Promise<boolean>;
9582
9243
  /** Load the persisted state now (operations do this automatically). */
9583
9244
  load(): Promise<void>;
@@ -9589,4 +9250,4 @@ interface Raft {
9589
9250
  }
9590
9251
  export declare function createRaft(options: CreateRaftOptions): Raft;
9591
9252
  //#endregion
9592
- 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 };