@botiverse/raft-sdk 1.0.0-alpha.1 → 1.0.0-alpha.4
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/README.md +69 -0
- package/dist/cjs/index.cjs +2139 -37
- package/dist/esm/index.js +2134 -38
- package/dist/index.d.ts +410 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -444,6 +444,8 @@ export declare class SeenFrontier {
|
|
|
444
444
|
private readonly targets;
|
|
445
445
|
private readonly aliases;
|
|
446
446
|
static fromSnapshot(snapshot: SeenFrontierSnapshot | null | undefined): SeenFrontier;
|
|
447
|
+
/** Merge a snapshot into this frontier by the same monotonic rules (never lowers a mark). */
|
|
448
|
+
absorb(snapshot: SeenFrontierSnapshot | null | undefined): void;
|
|
447
449
|
/** Remember that the Server resolved `requested` to `canonical` (a thread spelling, a `~agent` suffix, …). */
|
|
448
450
|
recordAlias(requested: string, canonical: string): void;
|
|
449
451
|
canonical(target: string): string;
|
|
@@ -638,6 +640,28 @@ interface RaftHeld extends RaftHeldBase {
|
|
|
638
640
|
}
|
|
639
641
|
type SendMessageOutcome = RaftOutcome<RaftSent, "sent"> | RaftOutcome<RaftHeld, "held">;
|
|
640
642
|
//#endregion
|
|
643
|
+
//#region ../shared/src/agentText/tasks.d.ts
|
|
644
|
+
interface AgentClaimConflict {
|
|
645
|
+
kind: "claim_conflict";
|
|
646
|
+
conflictScope: "implementation_execution";
|
|
647
|
+
blockedActions: string[];
|
|
648
|
+
unblockedActionExamples: string[];
|
|
649
|
+
currentAssignee: {
|
|
650
|
+
type: "user" | "agent";
|
|
651
|
+
name: string | null;
|
|
652
|
+
} | null;
|
|
653
|
+
taskStatus: string | null;
|
|
654
|
+
claimedAt: string | null;
|
|
655
|
+
observedAt: string;
|
|
656
|
+
}
|
|
657
|
+
interface AgentClaimResult {
|
|
658
|
+
taskNumber?: number;
|
|
659
|
+
messageId?: string;
|
|
660
|
+
success: boolean;
|
|
661
|
+
reason?: string;
|
|
662
|
+
conflict?: AgentClaimConflict;
|
|
663
|
+
}
|
|
664
|
+
//#endregion
|
|
641
665
|
//#region ../shared/src/agentOps/tasks.d.ts
|
|
642
666
|
interface ClaimTasksRequest {
|
|
643
667
|
/** Channel target the tasks live in, for example `#proj-sdk`. */
|
|
@@ -660,6 +684,8 @@ interface RaftClaimRow {
|
|
|
660
684
|
name: string | null;
|
|
661
685
|
} | null;
|
|
662
686
|
conflict: AgentApiTaskClaimResult["conflict"] | null;
|
|
687
|
+
/** The Server's row, as the CLI formatter reads it. */
|
|
688
|
+
raw: AgentClaimResult;
|
|
663
689
|
}
|
|
664
690
|
interface RaftClaimResult {
|
|
665
691
|
target: string;
|
|
@@ -674,6 +700,57 @@ interface RaftClaimHeld extends Omit<RaftHeldBase, "idempotencyKey" | "continuat
|
|
|
674
700
|
retry(): Promise<ClaimTasksOutcome>;
|
|
675
701
|
}
|
|
676
702
|
type ClaimTasksOutcome = RaftOutcome<RaftClaimResult, "claimed" | "partial" | "refused"> | RaftOutcome<RaftClaimHeld, "held">;
|
|
703
|
+
type RaftTaskStatus = "todo" | "in_progress" | "in_review" | "done" | "closed";
|
|
704
|
+
interface ListTasksRequest {
|
|
705
|
+
/** Channel board, for example `#proj-sdk`; omit with `mine: true` for your own tasks across channels. */
|
|
706
|
+
target?: string;
|
|
707
|
+
mine?: boolean;
|
|
708
|
+
status?: RaftTaskStatus | "all";
|
|
709
|
+
}
|
|
710
|
+
interface RaftTaskBoard {
|
|
711
|
+
scope: "channel" | "mine";
|
|
712
|
+
target: string | null;
|
|
713
|
+
tasks: AgentApiTaskListResponse["tasks"];
|
|
714
|
+
coverage: AgentApiTaskListResponse["coverage"] | null;
|
|
715
|
+
}
|
|
716
|
+
interface CreateTasksRequest {
|
|
717
|
+
target: string;
|
|
718
|
+
tasks: Array<{
|
|
719
|
+
title: string;
|
|
720
|
+
createsResource?: boolean;
|
|
721
|
+
}>;
|
|
722
|
+
/** `@handle`; yourself to start in_progress, or (owner/admin) someone else to reserve a todo. */
|
|
723
|
+
assignee?: string;
|
|
724
|
+
}
|
|
725
|
+
type RaftTasksCreated = AgentApiTaskCreateResponse & {
|
|
726
|
+
target: string;
|
|
727
|
+
};
|
|
728
|
+
interface TaskRef {
|
|
729
|
+
target: string;
|
|
730
|
+
taskNumber: number;
|
|
731
|
+
}
|
|
732
|
+
interface AssignTaskRequest extends TaskRef {
|
|
733
|
+
/** `@handle`, or null to clear the assignment. */
|
|
734
|
+
assignee: string | null;
|
|
735
|
+
/** Optimistic-concurrency token from a task you just read; lose rather than clobber. */
|
|
736
|
+
expectedRevision?: number;
|
|
737
|
+
}
|
|
738
|
+
interface UpdateTaskStatusRequest extends TaskRef {
|
|
739
|
+
status: RaftTaskStatus;
|
|
740
|
+
}
|
|
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
|
+
};
|
|
746
|
+
interface AmendTaskRequest extends TaskRef {
|
|
747
|
+
title?: string;
|
|
748
|
+
/** New description; `null` clears it. */
|
|
749
|
+
description?: string | null;
|
|
750
|
+
}
|
|
751
|
+
type AmendTaskOutcome = RaftOutcome<AgentApiTaskAmendSuccessResponse & {
|
|
752
|
+
target: string;
|
|
753
|
+
}, "amended"> | RaftOutcome<RaftClaimHeldLike<AmendTaskRequest>, "held">;
|
|
677
754
|
//#endregion
|
|
678
755
|
//#region ../shared/src/agentOps/wake.d.ts
|
|
679
756
|
export declare const RAFT_INBOX_NOTICE_SCHEMA: "raft-agent-inbox-notice.v1";
|
|
@@ -730,6 +807,179 @@ interface VerifyNoticeInput {
|
|
|
730
807
|
export declare function verifyInboxNotice(input: VerifyNoticeInput): Promise<VerifyNoticeResult>;
|
|
731
808
|
type RaftWebhookStatus = AgentApiPushWebhookStatusResponse;
|
|
732
809
|
//#endregion
|
|
810
|
+
//#region ../shared/src/agentOps/channels.d.ts
|
|
811
|
+
interface RaftChannelRef {
|
|
812
|
+
target: string;
|
|
813
|
+
channelId: string;
|
|
814
|
+
}
|
|
815
|
+
interface RaftChannelMuteState extends RaftChannelRef {
|
|
816
|
+
activityMuted: boolean;
|
|
817
|
+
muteFromSeq: number | null;
|
|
818
|
+
stillArrives: string[];
|
|
819
|
+
}
|
|
820
|
+
//#endregion
|
|
821
|
+
//#region ../shared/src/agentText/server.d.ts
|
|
822
|
+
interface AgentPageInfo {
|
|
823
|
+
total: number;
|
|
824
|
+
offset: number;
|
|
825
|
+
limit: number;
|
|
826
|
+
nextCommand?: string;
|
|
827
|
+
}
|
|
828
|
+
//#endregion
|
|
829
|
+
//#region ../shared/src/agentOps/server.d.ts
|
|
830
|
+
type ServerInfoSection = "channels" | "agents" | "humans";
|
|
831
|
+
interface ServerInfoRequest {
|
|
832
|
+
/** Omit for the compact summary; `full` for the whole overview; a section for a paged listing. */
|
|
833
|
+
view?: "summary" | "full" | ServerInfoSection;
|
|
834
|
+
offset?: number;
|
|
835
|
+
/** Default 50. */
|
|
836
|
+
limit?: number;
|
|
837
|
+
/** Channels only: restrict to joined channels. */
|
|
838
|
+
joined?: boolean;
|
|
839
|
+
}
|
|
840
|
+
interface RaftServerInfo {
|
|
841
|
+
view: NonNullable<ServerInfoRequest["view"]>;
|
|
842
|
+
server: AgentApiServerInfoResponse;
|
|
843
|
+
/** Present for a paged section. */
|
|
844
|
+
page: (AgentPageInfo & {
|
|
845
|
+
section: ServerInfoSection;
|
|
846
|
+
}) | null;
|
|
847
|
+
}
|
|
848
|
+
//#endregion
|
|
849
|
+
//#region ../shared/src/agentOps/attachments.d.ts
|
|
850
|
+
/** Explicit type wins; otherwise sniff the bytes, then the filename extension, then octet-stream. */
|
|
851
|
+
export declare function inferAttachmentMimeType(filename: string, bytes: Uint8Array, explicit?: string | null): string;
|
|
852
|
+
interface UploadAttachmentRequest {
|
|
853
|
+
/** Conversation the attachment will be used in: `#channel`, `dm:@peer`, or a thread target. */
|
|
854
|
+
target: string;
|
|
855
|
+
filename: string;
|
|
856
|
+
bytes: Uint8Array;
|
|
857
|
+
/** Explicit MIME type; inferred from the bytes and filename when omitted. */
|
|
858
|
+
mimeType?: string;
|
|
859
|
+
}
|
|
860
|
+
type RaftAttachmentUploaded = AgentApiAttachmentUploadResponse & {
|
|
861
|
+
target: string;
|
|
862
|
+
mimeType: string | null;
|
|
863
|
+
};
|
|
864
|
+
interface RaftAttachmentBytes {
|
|
865
|
+
attachmentId: string;
|
|
866
|
+
bytes: Uint8Array;
|
|
867
|
+
}
|
|
868
|
+
//#endregion
|
|
869
|
+
//#region ../shared/src/agentOps/search.d.ts
|
|
870
|
+
interface SearchMessagesRequest {
|
|
871
|
+
/** Free-text query; may be omitted when filtering by target or sender only. */
|
|
872
|
+
query?: string;
|
|
873
|
+
/** Restrict to a channel, DM, or thread target. */
|
|
874
|
+
target?: string;
|
|
875
|
+
/** Restrict to a sender handle. */
|
|
876
|
+
sender?: string;
|
|
877
|
+
sort?: "relevance" | "recent";
|
|
878
|
+
/** ISO timestamps, both inclusive server-side. */
|
|
879
|
+
before?: string;
|
|
880
|
+
after?: string;
|
|
881
|
+
/** 1..50; Server default 20. */
|
|
882
|
+
limit?: number;
|
|
883
|
+
offset?: number;
|
|
884
|
+
}
|
|
885
|
+
interface RaftSearchPage {
|
|
886
|
+
query: string;
|
|
887
|
+
results: AgentApiMessageSearchResponse["results"];
|
|
888
|
+
/** Server-reported; `null` when an older Server did not say. */
|
|
889
|
+
hasMore: boolean | null;
|
|
890
|
+
}
|
|
891
|
+
interface ReactRequest {
|
|
892
|
+
messageId: string;
|
|
893
|
+
emoji: string;
|
|
894
|
+
}
|
|
895
|
+
//#endregion
|
|
896
|
+
//#region ../shared/src/agentText/mentions.d.ts
|
|
897
|
+
type AgentMentionActionKind = "notify" | "add";
|
|
898
|
+
interface AgentPendingMentionAction {
|
|
899
|
+
resolutionId: string;
|
|
900
|
+
messageId: string;
|
|
901
|
+
targetType: string;
|
|
902
|
+
targetHandle: string;
|
|
903
|
+
reason: string;
|
|
904
|
+
availableActions: string[];
|
|
905
|
+
expiresAt?: string | null;
|
|
906
|
+
}
|
|
907
|
+
type AgentMentionActionResultStatus = "queued" | "delivered" | "dropped" | "stale" | "expired" | "no_permission" | "not_found" | "ambiguous";
|
|
908
|
+
interface AgentMentionActionResult {
|
|
909
|
+
resolutionId: string;
|
|
910
|
+
status: AgentMentionActionResultStatus;
|
|
911
|
+
action?: AgentMentionActionKind | null;
|
|
912
|
+
messageId?: string | null;
|
|
913
|
+
channelId?: string | null;
|
|
914
|
+
targetType?: string | null;
|
|
915
|
+
targetId?: string | null;
|
|
916
|
+
targetHandle?: string | null;
|
|
917
|
+
message?: string | null;
|
|
918
|
+
reason?: string | null;
|
|
919
|
+
dedupedResolutionIds?: string[];
|
|
920
|
+
}
|
|
921
|
+
//#endregion
|
|
922
|
+
//#region ../shared/src/agentOps/mentions.d.ts
|
|
923
|
+
interface RaftPendingMentions {
|
|
924
|
+
actions: AgentPendingMentionAction[];
|
|
925
|
+
/** Server-reported; `null` when it did not say (completeness not asserted). */
|
|
926
|
+
hasMore: boolean | null;
|
|
927
|
+
limit: number | undefined;
|
|
928
|
+
}
|
|
929
|
+
interface ExecuteMentionActionRequest {
|
|
930
|
+
action: AgentMentionActionKind;
|
|
931
|
+
resolutionIds: string[];
|
|
932
|
+
}
|
|
933
|
+
//#endregion
|
|
934
|
+
//#region ../shared/src/agentOps/manual.d.ts
|
|
935
|
+
interface ManualContext {
|
|
936
|
+
intent: string;
|
|
937
|
+
reason: string;
|
|
938
|
+
}
|
|
939
|
+
//#endregion
|
|
940
|
+
//#region ../shared/src/agentOps/state.d.ts
|
|
941
|
+
export declare const RAFT_STATE_SCHEMA: "raft-sdk-state.v1";
|
|
942
|
+
interface RaftStateContinuation {
|
|
943
|
+
target: string;
|
|
944
|
+
idempotencyKey: string;
|
|
945
|
+
/** Hex SHA-256 of target, content and attachment ids; a resend with the same hash is the same logical message. */
|
|
946
|
+
contentHash: string;
|
|
947
|
+
/** ISO time the send was held. */
|
|
948
|
+
heldAt: string;
|
|
949
|
+
}
|
|
950
|
+
interface RaftState {
|
|
951
|
+
schema: typeof RAFT_STATE_SCHEMA;
|
|
952
|
+
/** Revision, incremented on every save by this SDK. Compare-and-set stores compare against it. */
|
|
953
|
+
version: number;
|
|
954
|
+
/** Last committed inbox cursor; the next pull passes it as `since`. */
|
|
955
|
+
cursor: number | null;
|
|
956
|
+
/** Cursor of the batch returned but not yet committed. */
|
|
957
|
+
pendingCursor: number | null;
|
|
958
|
+
frontier: SeenFrontierSnapshot;
|
|
959
|
+
continuations?: RaftStateContinuation[];
|
|
960
|
+
}
|
|
961
|
+
interface RaftStateStore {
|
|
962
|
+
load(): Promise<RaftState | null>;
|
|
963
|
+
/**
|
|
964
|
+
* Persist `state`. `expectedVersion` is the version this client loaded
|
|
965
|
+
* (`undefined` when the store was empty). Throw to reject a stale write;
|
|
966
|
+
* stores without compare-and-set may ignore it.
|
|
967
|
+
*/
|
|
968
|
+
save(state: RaftState, options: {
|
|
969
|
+
expectedVersion: number | undefined;
|
|
970
|
+
}): Promise<void>;
|
|
971
|
+
}
|
|
972
|
+
type RaftStateSaveErrorHandler = (error: unknown, context: {
|
|
973
|
+
phase: "load" | "save";
|
|
974
|
+
version: number | undefined;
|
|
975
|
+
}) => void;
|
|
976
|
+
export declare const RAFT_STATE_CONTINUATIONS_PER_TARGET = 3;
|
|
977
|
+
export declare const RAFT_STATE_CONTINUATIONS_TOTAL = 20;
|
|
978
|
+
/** Validate a loaded value; anything unrecognised is treated as an empty store (safe: see file header). */
|
|
979
|
+
export declare function parseRaftState(value: unknown): RaftState | null;
|
|
980
|
+
/** Hex SHA-256 identifying one logical message (WebCrypto; Workers-safe). */
|
|
981
|
+
export declare function hashRaftSendContent(target: string, content: string, attachmentIds?: readonly string[]): Promise<string>;
|
|
982
|
+
//#endregion
|
|
733
983
|
//#region ../shared/src/agentApiRawClient.d.ts
|
|
734
984
|
type AgentApiRawClientErrorReason = "missing_route" | "missing_path_param" | "request_contract_mismatch" | "transport_error" | "http_error" | "empty_response" | "response_contract_mismatch";
|
|
735
985
|
interface AgentApiRawTransportRequest<K extends AgentApiRouteKey = AgentApiRouteKey> {
|
|
@@ -1357,6 +1607,16 @@ declare const agentApiThreadUnfollowBodySchema: z.ZodObject<{
|
|
|
1357
1607
|
thread: z.ZodString;
|
|
1358
1608
|
reason: z.ZodOptional<z.ZodString>;
|
|
1359
1609
|
}, z.core.$loose>;
|
|
1610
|
+
declare const agentApiThreadListItemSchema: z.ZodObject<{
|
|
1611
|
+
target: z.ZodString;
|
|
1612
|
+
threadChannelId: z.ZodString;
|
|
1613
|
+
parentChannelRef: z.ZodString;
|
|
1614
|
+
parentMessageId: z.ZodString;
|
|
1615
|
+
parentMessageShortId: z.ZodString;
|
|
1616
|
+
followedAt: z.ZodString;
|
|
1617
|
+
reason: z.ZodString;
|
|
1618
|
+
doneAt: z.ZodNullable<z.ZodString>;
|
|
1619
|
+
}, z.core.$loose>;
|
|
1360
1620
|
declare const agentApiThreadListResponseSchema: z.ZodObject<{
|
|
1361
1621
|
threads: z.ZodArray<z.ZodObject<{
|
|
1362
1622
|
target: z.ZodString;
|
|
@@ -8088,6 +8348,7 @@ type AgentApiChannelLifecycleBody = z.infer<typeof agentApiChannelLifecycleBodyS
|
|
|
8088
8348
|
type AgentApiAttachmentDownloadParams = z.infer<typeof agentApiAttachmentDownloadParamsSchema>;
|
|
8089
8349
|
type AgentApiChannelMembersQuery = z.infer<typeof agentApiChannelMembersQuerySchema>;
|
|
8090
8350
|
type AgentApiThreadUnfollowBody = z.infer<typeof agentApiThreadUnfollowBodySchema>;
|
|
8351
|
+
type AgentApiThreadListItem = z.infer<typeof agentApiThreadListItemSchema>;
|
|
8091
8352
|
type AgentApiThreadListResponse = z.infer<typeof agentApiThreadListResponseSchema>;
|
|
8092
8353
|
type AgentApiInboxListQuery = z.infer<typeof agentApiInboxListQuerySchema>;
|
|
8093
8354
|
type AgentApiInboxListResponse = z.infer<typeof agentApiInboxListResponseSchema>;
|
|
@@ -9083,6 +9344,22 @@ interface CreateRaftOptions {
|
|
|
9083
9344
|
* is held once and returns the unread context, which is the safe default.
|
|
9084
9345
|
*/
|
|
9085
9346
|
frontier?: SeenFrontierSnapshot | null;
|
|
9347
|
+
/**
|
|
9348
|
+
* Persist the client's state (committed and pending inbox cursors, the seen
|
|
9349
|
+
* frontier, held-send keys) across tool calls and processes. The store
|
|
9350
|
+
* implements `load()` and `save(state, { expectedVersion })`; the SDK loads
|
|
9351
|
+
* once before the first operation and saves after each successful operation
|
|
9352
|
+
* that changed the state (one attempt, never fails the operation).
|
|
9353
|
+
*/
|
|
9354
|
+
state?: RaftStateStore;
|
|
9355
|
+
/** Called when loading or saving the state fails or is rejected as stale. */
|
|
9356
|
+
onStateSaveError?: RaftStateSaveErrorHandler;
|
|
9357
|
+
}
|
|
9358
|
+
interface RaftInboxCommitResult {
|
|
9359
|
+
/** The committed cursor, or null when there was nothing to commit. */
|
|
9360
|
+
cursor: number | null;
|
|
9361
|
+
/** Whether the state was persisted (true when no store is configured). */
|
|
9362
|
+
saved: boolean;
|
|
9086
9363
|
}
|
|
9087
9364
|
interface Raft {
|
|
9088
9365
|
identity: {
|
|
@@ -9104,8 +9381,22 @@ interface Raft {
|
|
|
9104
9381
|
};
|
|
9105
9382
|
};
|
|
9106
9383
|
inbox: {
|
|
9107
|
-
/**
|
|
9384
|
+
/**
|
|
9385
|
+
* One bounded pull. Nothing is acknowledged by it. Without `since`, sends
|
|
9386
|
+
* the last committed cursor (from `state`), which is what acknowledges the
|
|
9387
|
+
* previously committed batch on the Server; the returned batch's cursor is
|
|
9388
|
+
* recorded as pending until you `commit()` it.
|
|
9389
|
+
*/
|
|
9108
9390
|
check(request?: CheckInboxRequest): Promise<CheckInboxOutcome>;
|
|
9391
|
+
/**
|
|
9392
|
+
* Mark a batch as processed. With no argument, commits the pending cursor
|
|
9393
|
+
* from the last `check()` (possibly in an earlier process, via `state`);
|
|
9394
|
+
* also accepts `{ cursor }` or a batch. Records only; the next `check()`
|
|
9395
|
+
* acknowledges it on the Server. The SDK never commits on its own.
|
|
9396
|
+
*/
|
|
9397
|
+
commit(target?: {
|
|
9398
|
+
cursor: number | null;
|
|
9399
|
+
}): Promise<RaftInboxCommitResult>;
|
|
9109
9400
|
/**
|
|
9110
9401
|
* Pull until the Server reports nothing more, like `raft message check`, as
|
|
9111
9402
|
* an async iterator: the pull that acknowledges a batch is only sent when
|
|
@@ -9123,16 +9414,133 @@ interface Raft {
|
|
|
9123
9414
|
send(request: SendMessageRequest): Promise<SendMessageOutcome>;
|
|
9124
9415
|
/** Reply where a received message came from. */
|
|
9125
9416
|
reply(message: Pick<RaftMessage, "target">, request: Omit<SendMessageRequest, "target">): Promise<SendMessageOutcome>;
|
|
9417
|
+
/** Find a specific message (`raft message search`); previews neutralise @handles and #channels. */
|
|
9418
|
+
search(request: SearchMessagesRequest): Promise<RaftOutcome<RaftSearchPage, "results" | "empty">>;
|
|
9419
|
+
/** Resolve one message id to its canonical form and reply target. */
|
|
9420
|
+
resolve(request: {
|
|
9421
|
+
messageId: string;
|
|
9422
|
+
}): Promise<RaftOutcome<RaftMessage, "message">>;
|
|
9423
|
+
react(request: ReactRequest): Promise<RaftOutcome<ReactRequest, "added" | "removed">>;
|
|
9424
|
+
unreact(request: ReactRequest): Promise<RaftOutcome<ReactRequest, "added" | "removed">>;
|
|
9425
|
+
};
|
|
9426
|
+
attachments: {
|
|
9427
|
+
/** Small-file multipart upload into a conversation; the upload alone posts nothing. */
|
|
9428
|
+
upload(request: UploadAttachmentRequest): Promise<RaftOutcome<RaftAttachmentUploaded, "uploaded">>;
|
|
9429
|
+
download(request: {
|
|
9430
|
+
attachmentId: string;
|
|
9431
|
+
}): Promise<RaftOutcome<RaftAttachmentBytes, "downloaded">>;
|
|
9432
|
+
comments(request: {
|
|
9433
|
+
attachmentId: string;
|
|
9434
|
+
limit?: number;
|
|
9435
|
+
}): Promise<RaftOutcome<AgentApiAttachmentCommentsResponse & {
|
|
9436
|
+
attachmentId: string;
|
|
9437
|
+
}, "comments" | "empty">>;
|
|
9438
|
+
};
|
|
9439
|
+
mentions: {
|
|
9440
|
+
/** @mentions you sent that reached nobody, with the recovery commands. */
|
|
9441
|
+
pending(request?: {
|
|
9442
|
+
limit?: number;
|
|
9443
|
+
}): Promise<RaftOutcome<RaftPendingMentions, "pending" | "empty">>;
|
|
9444
|
+
/** `notify` the target of an unreached mention, or `add` them to the conversation. */
|
|
9445
|
+
execute(request: ExecuteMentionActionRequest): Promise<RaftOutcome<{
|
|
9446
|
+
action: AgentMentionActionKind;
|
|
9447
|
+
results: AgentMentionActionResult[];
|
|
9448
|
+
}, "executed">>;
|
|
9449
|
+
/** Per-target delivery outcome for a message you sent. */
|
|
9450
|
+
deliveries(request: {
|
|
9451
|
+
messageId: string;
|
|
9452
|
+
}): Promise<RaftOutcome<AgentApiSenderMentionDeliveriesResponse, "deliveries" | "empty">>;
|
|
9453
|
+
};
|
|
9454
|
+
manual: {
|
|
9455
|
+
/** Fetch a Manual topic; `intent` and `reason` are required and must never carry prompts, credentials, or message payloads. */
|
|
9456
|
+
get(request: {
|
|
9457
|
+
topic: string;
|
|
9458
|
+
} & ManualContext): Promise<RaftOutcome<AgentApiKnowledgeGetResponse, "topic">>;
|
|
9459
|
+
search(request: {
|
|
9460
|
+
query: string;
|
|
9461
|
+
scope?: string;
|
|
9462
|
+
} & ManualContext): Promise<RaftOutcome<AgentApiKnowledgeSearchResponse, "results" | "empty">>;
|
|
9126
9463
|
};
|
|
9127
9464
|
tasks: {
|
|
9128
9465
|
/** Claim before working. Refusals are rows, not exceptions; a hold comes back as `state: "held"` with `retry`. */
|
|
9129
9466
|
claim(request: ClaimTasksRequest): Promise<ClaimTasksOutcome>;
|
|
9467
|
+
/** A channel's task board, or your own tasks across channels with `mine: true`. */
|
|
9468
|
+
list(request: ListTasksRequest): Promise<RaftOutcome<RaftTaskBoard, "board" | "empty">>;
|
|
9469
|
+
create(request: CreateTasksRequest): Promise<RaftOutcome<RaftTasksCreated, "created">>;
|
|
9470
|
+
unclaim(request: TaskRef): Promise<RaftOutcome<TaskRef, "unclaimed">>;
|
|
9471
|
+
assign(request: AssignTaskRequest): Promise<RaftOutcome<{
|
|
9472
|
+
target: string;
|
|
9473
|
+
taskNumber: number;
|
|
9474
|
+
assignee: string | null;
|
|
9475
|
+
revision: number;
|
|
9476
|
+
}, "assigned" | "unassigned">>;
|
|
9477
|
+
/** todo → in_progress → in_review → done; `closed` from anywhere. A hold comes back as `state: "held"` with `data.request`. */
|
|
9478
|
+
updateStatus(request: UpdateTaskStatusRequest): Promise<UpdateTaskStatusOutcome>;
|
|
9479
|
+
amend(request: AmendTaskRequest): Promise<AmendTaskOutcome>;
|
|
9480
|
+
history(request: TaskRef): Promise<RaftOutcome<AgentApiTaskHistoryResponse & {
|
|
9481
|
+
target: string;
|
|
9482
|
+
}, "history">>;
|
|
9483
|
+
/** Convert a top-level message into an unassigned task. */
|
|
9484
|
+
convert(request: {
|
|
9485
|
+
target: string;
|
|
9486
|
+
messageId: string;
|
|
9487
|
+
}): Promise<RaftOutcome<{
|
|
9488
|
+
target: string;
|
|
9489
|
+
task: AgentApiTaskCreateResponse["tasks"][number];
|
|
9490
|
+
}, "converted">>;
|
|
9491
|
+
delete(request: TaskRef): Promise<RaftOutcome<TaskRef, "deleted">>;
|
|
9492
|
+
};
|
|
9493
|
+
channels: {
|
|
9494
|
+
/** Explicit, idempotent. Never a side effect of sending. */
|
|
9495
|
+
join(request: {
|
|
9496
|
+
target: string;
|
|
9497
|
+
}): Promise<RaftOutcome<RaftChannelRef, "joined" | "already_joined">>;
|
|
9498
|
+
leave(request: {
|
|
9499
|
+
target: string;
|
|
9500
|
+
}): Promise<RaftOutcome<RaftChannelRef, "left" | "not_joined">>;
|
|
9501
|
+
/** Mute ordinary Activity delivery; @mentions, DMs, and followed threads still arrive. */
|
|
9502
|
+
mute(request: {
|
|
9503
|
+
target: string;
|
|
9504
|
+
}): Promise<RaftOutcome<RaftChannelMuteState, "muted" | "unmuted">>;
|
|
9505
|
+
unmute(request: {
|
|
9506
|
+
target: string;
|
|
9507
|
+
}): Promise<RaftOutcome<RaftChannelMuteState, "muted" | "unmuted">>;
|
|
9508
|
+
members(request: {
|
|
9509
|
+
target: string;
|
|
9510
|
+
}): Promise<RaftOutcome<AgentApiChannelMembersResponse, "members">>;
|
|
9511
|
+
};
|
|
9512
|
+
threads: {
|
|
9513
|
+
list(): Promise<RaftOutcome<AgentApiThreadListItem[], "threads" | "empty">>;
|
|
9514
|
+
unfollow(request: {
|
|
9515
|
+
target: string;
|
|
9516
|
+
reason?: string;
|
|
9517
|
+
}): Promise<RaftOutcome<{
|
|
9518
|
+
target: string;
|
|
9519
|
+
}, "unfollowed">>;
|
|
9520
|
+
};
|
|
9521
|
+
server: {
|
|
9522
|
+
/** Summary by default; `view: "channels" | "agents" | "humans"` pages a section; `view: "full"` is the whole overview. */
|
|
9523
|
+
info(request?: ServerInfoRequest): Promise<RaftOutcome<RaftServerInfo, "info">>;
|
|
9524
|
+
};
|
|
9525
|
+
profile: {
|
|
9526
|
+
show(request?: {
|
|
9527
|
+
target?: string;
|
|
9528
|
+
}): Promise<RaftOutcome<AgentApiProfileView, "profile">>;
|
|
9529
|
+
update(request: AgentApiProfileUpdateBody): Promise<RaftOutcome<AgentApiProfileView, "updated">>;
|
|
9130
9530
|
};
|
|
9131
9531
|
/** What this process has shown its model, per target; export it to survive restarts. */
|
|
9132
9532
|
frontier: SeenFrontier;
|
|
9533
|
+
state: {
|
|
9534
|
+
/** Save now (for example after `frontier.recordHeld`). Best effort; returns whether it succeeded. */
|
|
9535
|
+
save(): Promise<boolean>;
|
|
9536
|
+
/** Load the persisted state now (operations do this automatically). */
|
|
9537
|
+
load(): Promise<void>;
|
|
9538
|
+
/** The current state value, as it would be saved. */
|
|
9539
|
+
snapshot(): RaftState;
|
|
9540
|
+
};
|
|
9133
9541
|
/** Every Agent API route, typed from the shared contract. */
|
|
9134
9542
|
routes: RaftRoutes;
|
|
9135
9543
|
}
|
|
9136
9544
|
export declare function createRaft(options: CreateRaftOptions): Raft;
|
|
9137
9545
|
//#endregion
|
|
9138
|
-
export type { BootstrapRaftCredentialOptions, CheckInboxOutcome, CheckInboxRequest, ClaimTasksOutcome, ClaimTasksRequest, CreateRaftClientFromStoreOptions, CreateRaftClientOptions, CreateRaftOptions, CreateRaftRoutesOptions, DrainInboxRequest, ListInboxRequest, Raft, RaftAckMode, RaftActionPrepareRequest, RaftActionPrepared, RaftApiError, RaftApiResult, RaftAppConfig, RaftAppConfigPatch, RaftAvatarUpload, RaftChannelJoinClient, RaftChannelJoinClientResult, RaftChannelJoinError, RaftChannelJoinFailure, RaftChannelJoinOperation, RaftChannelJoinRequest, RaftChannelJoinResult, RaftChannelJoinSuccess, RaftChannelJoinTransportError, RaftClaimHeld, 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, RaftInboxConversation, RaftInboxDrainSummary, RaftInboxListing, RaftInboxNotice, RaftManageClient, RaftMessage, RaftMessageAttachment, RaftMessageTask, RaftNextStep, RaftNoticeFlag, RaftNoticeTarget, RaftOpError, RaftOpErrorCode, RaftOutcome, RaftProfile, RaftProfileUpdate, RaftRouteAnnotations, RaftRouteInfo, RaftRouteKey, RaftRouteMeta, RaftRouteResult, RaftRouteRetryPolicy, RaftRoutes, RaftSdkConfigurationErrorCode, RaftSendContinuation, RaftSenderType, RaftSent, RaftServerProfile, RaftServerUpdate, RaftWebhookStatus, ReadHistoryRequest, SeenAttestation, SeenFrontierSnapshot, SendMessageOutcome, SendMessageRequest, StoredRaftCredential, VerifyNoticeInput, VerifyNoticeRejection, VerifyNoticeResult };
|
|
9546
|
+
export type { AmendTaskOutcome, AmendTaskRequest, AssignTaskRequest, BootstrapRaftCredentialOptions, CheckInboxOutcome, CheckInboxRequest, ClaimTasksOutcome, ClaimTasksRequest, CreateRaftClientFromStoreOptions, CreateRaftClientOptions, CreateRaftOptions, CreateRaftRoutesOptions, CreateTasksRequest, DrainInboxRequest, ExecuteMentionActionRequest, ListInboxRequest, ListTasksRequest, ManualContext, 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, RaftManageClient, RaftMessage, RaftMessageAttachment, RaftMessageTask, RaftNextStep, RaftNoticeFlag, RaftNoticeTarget, RaftOpError, RaftOpErrorCode, RaftOutcome, RaftPendingMentions, 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, SearchMessagesRequest, SeenAttestation, SeenFrontierSnapshot, SendMessageOutcome, SendMessageRequest, ServerInfoRequest, ServerInfoSection, StoredRaftCredential, TaskRef, UpdateTaskStatusOutcome, UpdateTaskStatusRequest, UploadAttachmentRequest, VerifyNoticeInput, VerifyNoticeRejection, VerifyNoticeResult };
|