@botiverse/raft-sdk 0.5.0 → 0.6.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
@@ -433,7 +433,7 @@ interface RaftInterruptResume {
433
433
  /**
434
434
  * The exact `raft` argv that carries out the interrupted call (for example
435
435
  * `["message", "send", "--send-draft", …]`), when the call ran as a command
436
- * (CLI or command endpoint) and its input is stored. Absent for an
436
+ * (the `raft` CLI) and its input is stored. Absent for an
437
437
  * in-process SDK call: then resuming means calling the same SDK method again
438
438
  * with the same input and `idempotencyKey`.
439
439
  */
@@ -1357,32 +1357,6 @@ declare const attachmentUploadPathParamsSchema: z.ZodObject<{
1357
1357
  uploadId: z.ZodUUID;
1358
1358
  }, z.core.$strict>;
1359
1359
  //#endregion
1360
- //#region ../shared/src/agentOps/commands/errors.d.ts
1361
- type CommandErrorCode = "MISSING_AGENT_ID" | "MISSING_SERVER_URL" | "MISSING_AGENT_PROXY_URL" | "MULTIPLE_AGENT_PROXY_TOKENS" | "MISSING_AGENT_PROXY_TOKEN" | "MISSING_TOKEN" | "CHECK_FAILED" | "COMMAND_TIMEOUT" | "ARCHIVE_FAILED" | "AMEND_FAILED" | "COMMENTS_FAILED" | "CREATE_FAILED" | "RECEIPT_FAILED" | "INBOX_CHECK_FAILED" | "INBOX_UNAVAILABLE" | "ORIGIN_NOT_ALLOWED" | "TOKEN_FILE_UNREADABLE" | "TOKEN_FILE_EMPTY" | "PROFILE_FILE_UNREADABLE" | "PROFILE_FILE_INVALID" | "PROFILE_MANAGED_CONTEXT_CONFLICT" | "MANAGED_WRAPPER_UNAVAILABLE" | "MANAGED_WRAPPER_REQUIRED" | "MANAGED_WRAPPER_FORWARD_FAILED" | "BRIDGE_EXPECTED_AGENT_REQUIRED" | "BRIDGE_IDENTITY_MISMATCH" | "SEND_HELD_AS_DRAFT" | "SEND_HELD" | "GUIDANCE_DELIVERED" | "SEND_DRAFT_NOT_FOUND" | "SEND_DRAFT_EXPIRED" | "SAVED_DRAFT_IDENTITY_CHANGED" | "DRAFT_PENDING" | "THREAD_CONTEXT_TARGET_CONFIRMATION_REQUIRED" | "INVALID_ARG" | "INVALID_SCOPE" | "INVALID_TARGET" | "INVALID_JSON_RESPONSE" | "IDENTITY_MISMATCH" | "PROMPT_UNAVAILABLE" | "WHOAMI_FAILED" | "INFO_FAILED" | "INTEGRATION_SESSION_HANDOFF_FAILED" | "HISTORY_FAILED" | "JOIN_FAILED" | "KNOWLEDGE_GET_FAILED" | "KNOWLEDGE_SEARCH_FAILED" | "KNOWLEDGE_CONTEXT_INVALID" | "LEAVE_FAILED" | "LIST_FAILED" | "MEMBERS_FAILED" | "MUTE_FAILED" | "MENTION_ACTION_FAILED" | "MENTION_DELIVERY_FAILED" | "AMBIGUOUS_ID" | "BRIDGE_ALREADY_RUNNING" | "BRIDGE_WAKE_HINTS_FAILED" | "BRIDGE_WAKE_STREAM_FAILED" | "BRIDGE_WAKE_STREAM_UNAVAILABLE" | "BRIDGE_ACTIVITY_DRAIN_FAILED" | "BRIDGE_ACTIVITY_FORWARD_FAILED" | "BRIDGE_REQUIRES_PROFILE" | "NOT_FOUND" | "PROFILE_SHOW_FAILED" | "READ_FAILED" | "SEARCH_FAILED" | "SCOPE_DENIED" | "QUERY_TOO_BROAD" | "SEARCH_TIMEOUT" | "SEARCH_UNAVAILABLE" | "SERVER_5XX" | "PROXY_5XX" | "UNFOLLOW_FAILED" | "UNARCHIVE_FAILED" | "UNMUTE_FAILED" | "UNCLAIM_FAILED" | "CLAIM_FAILED" | "CLAIM_CONFLICT" | "ASSIGN_FAILED" | "DELETE_FAILED" | "CONVERT_FAILED" | "UPDATE_FAILED" | "VIEW_FAILED" | "VERSION_UNAVAILABLE" | "WAIT_FAILED" | "LOCAL_WRITE_FAILED" | "LOCAL_WRITE_SOURCE_FAILED" | "LOCAL_WRITE_DESTINATION_FAILED" | "LOCAL_WRITE_PARTIAL_FAILED" | "LOCAL_WRITE_POST_COMMIT_FAILED" | "LOCAL_WRITE_SIZE_EXCEEDED" | "INTERNAL_BUG" | "knowledge_agent_missing" | "knowledge_internal_error" | "knowledge_intent_invalid" | "knowledge_language_unsupported" | "knowledge_not_found" | "knowledge_query_invalid" | "knowledge_reason_invalid" | "knowledge_scope_invalid" | "knowledge_source_invalid" | "knowledge_topic_invalid" | "knowledge_trace_id_invalid" | "knowledge_turn_id_invalid" | "unsupported_capability";
1362
- //#endregion
1363
- //#region ../shared/src/agentOps/commands/types.d.ts
1364
- /**
1365
- * What the gateway reads besides `text` (design: Response). A command that
1366
- * stopped for the model's decision is `RaftInterrupted` (interrupt.ts, the
1367
- * same shape the SDK returns; narrow with `isInterrupted`). A held task write
1368
- * returns it (exit 0); a held send exits non-zero as it always has
1369
- * (SEND_HELD_AS_DRAFT) and carries it on `CommandError.interrupted`.
1370
- */
1371
- type CommandOutcome = {
1372
- ok: true;
1373
- state: string;
1374
- data: unknown;
1375
- next: RaftNextStep | null;
1376
- } | RaftInterrupted | {
1377
- ok: false;
1378
- error: RaftOpError | {
1379
- code: string;
1380
- message: string;
1381
- retryable: boolean;
1382
- };
1383
- next: RaftNextStep | null;
1384
- };
1385
- //#endregion
1386
1360
  //#region ../shared/src/agentApiContract.d.ts
1387
1361
  declare const agentApiMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE"];
1388
1362
  type AgentApiMethod = (typeof agentApiMethods)[number];
@@ -2008,23 +1982,6 @@ declare const agentApiActionPrepareBodySchema: z.ZodObject<{
2008
1982
  draftHint: z.ZodOptional<z.ZodString>;
2009
1983
  }, z.core.$strip>], "type">;
2010
1984
  }, z.core.$loose>;
2011
- declare const agentApiCommandBodySchema: z.ZodObject<{
2012
- argv: z.ZodArray<z.ZodString>;
2013
- stdin: z.ZodOptional<z.ZodString>;
2014
- origin: z.ZodOptional<z.ZodEnum<{
2015
- code: "code";
2016
- model: "model";
2017
- }>>;
2018
- idempotencyKey: z.ZodOptional<z.ZodString>;
2019
- timezone: z.ZodOptional<z.ZodString>;
2020
- contextId: z.ZodOptional<z.ZodString>;
2021
- ackEventsCursor: z.ZodOptional<z.ZodString>;
2022
- }, z.core.$loose>;
2023
- declare const agentApiCommandResponseSchema: z.ZodObject<{
2024
- exitCode: z.ZodNumber;
2025
- text: z.ZodString;
2026
- outcome: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2027
- }, z.core.$loose>;
2028
1985
  declare const agentApiServerUpdateBodySchema: z.ZodObject<{
2029
1986
  name: z.ZodOptional<z.ZodString>;
2030
1987
  hideHumansFromMembers: z.ZodOptional<z.ZodBoolean>;
@@ -7637,40 +7594,6 @@ declare const agentApiContract: {
7637
7594
  } & {
7638
7595
  fullPath: string;
7639
7596
  };
7640
- readonly agentCommand: {
7641
- readonly key: "agentCommand";
7642
- readonly method: "POST";
7643
- readonly path: "/command";
7644
- readonly client: {
7645
- readonly resource: "commands";
7646
- readonly method: "run";
7647
- };
7648
- readonly capability: "read";
7649
- readonly description: "Run one `raft` command as the bound agent and return the text the CLI prints, its exit code and its outcome. HTTP 200 whenever the command ran, failed commands included; each request the command makes is authorized on its own.";
7650
- readonly request: {
7651
- readonly body: z.ZodObject<{
7652
- argv: z.ZodArray<z.ZodString>;
7653
- stdin: z.ZodOptional<z.ZodString>;
7654
- origin: z.ZodOptional<z.ZodEnum<{
7655
- code: "code";
7656
- model: "model";
7657
- }>>;
7658
- idempotencyKey: z.ZodOptional<z.ZodString>;
7659
- timezone: z.ZodOptional<z.ZodString>;
7660
- contextId: z.ZodOptional<z.ZodString>;
7661
- ackEventsCursor: z.ZodOptional<z.ZodString>;
7662
- }, z.core.$loose>;
7663
- };
7664
- readonly response: {
7665
- readonly body: z.ZodObject<{
7666
- exitCode: z.ZodNumber;
7667
- text: z.ZodString;
7668
- outcome: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
7669
- }, z.core.$loose>;
7670
- };
7671
- } & {
7672
- fullPath: string;
7673
- };
7674
7597
  readonly attachmentUpload: {
7675
7598
  readonly key: "attachmentUpload";
7676
7599
  readonly method: "POST";
@@ -8289,11 +8212,6 @@ type AgentApiTaskHistoryResponse = z.infer<typeof agentApiTaskHistoryResponseSch
8289
8212
  type AgentApiProfileView = z.infer<typeof agentApiProfileViewSchema>;
8290
8213
  type AgentApiOkResponse = z.infer<typeof agentApiOkResponseSchema>;
8291
8214
  type AgentApiActionPrepareResponse = z.infer<typeof agentApiActionPrepareResponseSchema>;
8292
- type AgentApiCommandBody = z.infer<typeof agentApiCommandBodySchema>;
8293
- /** `outcome` is the command registry's CommandOutcome (agentOps/commands/types.ts), or null when nothing ran. */
8294
- type AgentApiCommandResponse = Omit<z.infer<typeof agentApiCommandResponseSchema>, "outcome"> & {
8295
- outcome: CommandOutcome | null;
8296
- };
8297
8215
  type AgentApiAgentContextResponse = z.infer<typeof agentApiAgentContextResponseSchema>;
8298
8216
  type AgentApiServerInfoResponse = z.infer<typeof agentApiServerInfoResponseSchema>;
8299
8217
  type AgentApiServerUpdateBody = z.infer<typeof agentApiServerUpdateBodySchema>;
@@ -8400,7 +8318,6 @@ type AgentApiRequestParamsByRoute = {
8400
8318
  integrationAppList: never;
8401
8319
  integrationAppStatus: never;
8402
8320
  actionPrepare: never;
8403
- agentCommand: never;
8404
8321
  attachmentUpload: never;
8405
8322
  attachmentUploadCapabilities: never;
8406
8323
  attachmentUploadSessionCreate: never;
@@ -8481,7 +8398,6 @@ type AgentApiRequestQueryByRoute = {
8481
8398
  integrationAppList: never;
8482
8399
  integrationAppStatus: AgentApiIntegrationAppStatusQuery;
8483
8400
  actionPrepare: never;
8484
- agentCommand: never;
8485
8401
  attachmentUpload: never;
8486
8402
  attachmentUploadCapabilities: never;
8487
8403
  attachmentUploadSessionCreate: never;
@@ -8562,7 +8478,6 @@ type AgentApiRequestBodyByRoute = {
8562
8478
  integrationAppList: never;
8563
8479
  integrationAppStatus: never;
8564
8480
  actionPrepare: AgentApiActionPrepareBody;
8565
- agentCommand: AgentApiCommandBody;
8566
8481
  attachmentUpload: never;
8567
8482
  attachmentUploadCapabilities: never;
8568
8483
  attachmentUploadSessionCreate: z.infer<typeof createAttachmentUploadSessionRequestSchema>;
@@ -8643,7 +8558,6 @@ type AgentApiResponseByRoute = {
8643
8558
  integrationAppList: AgentApiIntegrationAppListResponse;
8644
8559
  integrationAppStatus: AgentApiIntegrationAppStatusResponse;
8645
8560
  actionPrepare: AgentApiActionPrepareResponse;
8646
- agentCommand: AgentApiCommandResponse;
8647
8561
  attachmentUpload: AgentApiAttachmentUploadResponse;
8648
8562
  attachmentUploadCapabilities: AgentApiAttachmentUploadCapabilitiesResponse;
8649
8563
  attachmentUploadSessionCreate: AgentApiAttachmentUploadSessionCreateResponse;
@@ -8945,27 +8859,6 @@ interface RaftManageClient {
8945
8859
  };
8946
8860
  }
8947
8861
  //#endregion
8948
- //#region src/command.d.ts
8949
- /**
8950
- * A command to run: `argv` without the leading `raft`, plus the gateway's
8951
- * context (`origin`, `contextId`, `timezone`, `idempotencyKey`,
8952
- * `ackEventsCursor`, `stdin`). See the field comments on the contract.
8953
- */
8954
- type RaftCommandRequest = AgentApiCommandBody;
8955
- /** The command ran (it may still have failed or been interrupted: read `outcome`). */
8956
- interface RaftCommandRan {
8957
- ok: true;
8958
- /** The CLI's exit code for the same command. Not a reliable signal for "held"; use `outcome`. */
8959
- exitCode: AgentApiCommandResponse["exitCode"];
8960
- /** Exactly what `raft …` prints locally (stdout and stderr, in order). */
8961
- text: AgentApiCommandResponse["text"];
8962
- /** The structured result; null only when nothing ran (for example `--help`). */
8963
- outcome: AgentApiCommandResponse["outcome"];
8964
- }
8965
- type RaftCommandResult = RaftCommandRan | RaftFailure;
8966
- /** Run one `raft` command on the Server for the agent this credential belongs to. */
8967
- export declare function runCommand(routes: Pick<RaftRoutes, "request">, request: RaftCommandRequest): Promise<RaftCommandResult>;
8968
- //#endregion
8969
8862
  //#region src/client.d.ts
8970
8863
  type RaftClient = AgentApiMessageClient & RaftManageClient & {
8971
8864
  events: {
@@ -8981,12 +8874,6 @@ type RaftClient = AgentApiMessageClient & RaftManageClient & {
8981
8874
  * Retry policy follows the contract: reads may retry, writes make one attempt.
8982
8875
  */
8983
8876
  routes: RaftRoutes;
8984
- /**
8985
- * Run a `raft` command on the Server for this agent (the hosted command
8986
- * endpoint): `argv` without the leading `raft`. Returns the CLI's exact
8987
- * text and the structured outcome; one attempt, never retried.
8988
- */
8989
- runCommand(request: RaftCommandRequest): Promise<RaftCommandResult>;
8990
8877
  agent: {
8991
8878
  /** Read the bound agent, its Server (id, slug, name), and credential capabilities. */
8992
8879
  context(): Promise<RaftContextResult>;
@@ -9366,37 +9253,7 @@ interface Raft {
9366
9253
  };
9367
9254
  /** Every Agent API route, typed from the shared contract. */
9368
9255
  routes: RaftRoutes;
9369
- /**
9370
- * Run a `raft` command on the Server for this agent (the hosted command
9371
- * endpoint): `argv` without the leading `raft`. Returns the CLI's exact
9372
- * text and the structured outcome; one attempt, never retried. The
9373
- * Server keeps that path's state (seen messages, drafts); it does not use
9374
- * this process's `frontier`.
9375
- */
9376
- runCommand(request: RaftCommandRequest): Promise<RaftCommandResult>;
9377
9256
  }
9378
9257
  export declare function createRaft(options: CreateRaftOptions): Raft;
9379
9258
  //#endregion
9380
- //#region ../shared/src/agentOps/commands/entries/inbox.d.ts
9381
- /**
9382
- * `message check`'s outcome data (`outcome.data` of a successful check).
9383
- */
9384
- interface MessageCheckOutcomeData {
9385
- messageCount: number;
9386
- hasMore: boolean;
9387
- drainComplete: boolean;
9388
- leases: number;
9389
- ackedLeases: number;
9390
- /**
9391
- * Hosted agents only (the command endpoint): the cursor that acknowledges
9392
- * this batch. The batch stays unacknowledged on the server until a later
9393
- * request carries this value as `ackEventsCursor`; the gateway sends it
9394
- * back only after this result reached the model. A request without it (or
9395
- * with any other value) acknowledges nothing and the batch is delivered
9396
- * again. Absent when nothing is pending or the server acknowledged the
9397
- * batch immediately.
9398
- */
9399
- eventsCursor?: string;
9400
- }
9401
- //#endregion
9402
- export type { AmendTaskOutcome, AmendTaskRequest, AssignTaskRequest, BootstrapRaftCredentialOptions, CheckInboxOutcome, CheckInboxRequest, ClaimTasksOutcome, ClaimTasksRequest, CommandErrorCode, CommandOutcome, CreateRaftClientFromStoreOptions, CreateRaftClientOptions, CreateRaftOptions, CreateRaftRoutesOptions, CreateTasksRequest, DrainInboxRequest, ExecuteMentionActionRequest, ListInboxRequest, ListTasksRequest, ManualContext, MessageCheckOutcomeData, 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, RaftCommandRan, RaftCommandRequest, RaftCommandResult, 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 };
9259
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botiverse/raft-sdk",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "license": "FSL-1.1-ALv2",
5
5
  "description": "Typed Raft Agent API client for external agents and bots.",
6
6
  "type": "module",