@otto-code/client 0.8.12 → 0.8.13

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 CHANGED
@@ -1,12 +1,39 @@
1
1
  # @otto-code/client
2
2
 
3
- Otto's JavaScript/TypeScript client package.
3
+ TypeScript SDK for building integrations on top of a Otto daemon.
4
4
 
5
- ## Stability
5
+ ```bash
6
+ npm install @otto-code/client
7
+ ```
8
+
9
+ ```ts
10
+ import { createOttoClient } from "@otto-code/client";
11
+
12
+ const client = createOttoClient({ url: "ws://127.0.0.1:6868/ws" });
13
+ await client.connect();
14
+
15
+ const agent = await client.agents.create({
16
+ config: { provider: "codex/gpt-5.5" },
17
+ cwd: "/Users/me/dev/storefront",
18
+ prompt: "Review the current diff and name the riskiest change.",
19
+ });
20
+
21
+ const result = await agent.waitForFinish();
22
+ console.log(result.lastMessage);
23
+
24
+ await client.close();
25
+ ```
6
26
 
7
- This package is public so Otto's published packages can depend on it cleanly.
8
- It is not a stable public SDK yet.
27
+ The public API is the package root. Imports under `@otto-code/client/internal/*` are unsupported implementation details used by Otto's own packages.
28
+
29
+ Read the [SDK documentation](https://otto-code.me/docs/sdk) for agents, workspaces, provider discovery, events, recipes, and the API reference. Runnable TypeScript patterns also live in [`examples/`](./examples/README.md).
30
+
31
+ ## Runtime
32
+
33
+ The client needs a WebSocket implementation. Modern browsers and Node.js 22 provide one globally.
34
+
35
+ Use a WebSocket URL ending in `/ws`, such as `ws://127.0.0.1:6868/ws`. Pass `password` when the daemon requires authentication.
36
+
37
+ ## Stability
9
38
 
10
- APIs, exports, runtime behavior, and types may change or disappear in any
11
- release without advance notice. Use it outside Otto at your own risk until the
12
- package is explicitly documented as stable.
39
+ The high-level API exported from `@otto-code/client` is the supported SDK surface. The SDK and daemon remain protocol-compatible across versions, but newly added capabilities can require a newer daemon.
@@ -1,4 +1,5 @@
1
1
  import { normalizeAgentModelDefinition } from "@otto-code/protocol/agent-types";
2
+ import { expandProviderSnapshot } from "@otto-code/protocol/provider-snapshot-codec";
2
3
  // COMPAT(model-normalize): daemon normalizes at source (provider-registry) - shim covers older daemons; drop when floor >= v0.1.104
3
4
  function normalizeAgentModels(models) {
4
5
  if (!models) {
@@ -30,7 +31,9 @@ export function normalizeListProviderModelsPayload(payload) {
30
31
  return models === payload.models ? payload : { ...payload, models };
31
32
  }
32
33
  export function normalizeProvidersSnapshotPayload(payload) {
33
- const entries = normalizeProviderSnapshotEntries(payload.entries);
34
+ const entries = payload.compactSnapshot
35
+ ? expandProviderSnapshot(payload.compactSnapshot)
36
+ : normalizeProviderSnapshotEntries(payload.entries);
34
37
  return entries === payload.entries ? payload : { ...payload, entries };
35
38
  }
36
39
  export function normalizeProviderSnapshotUpdateMessage(msg) {
@@ -3,6 +3,10 @@ export declare function defaultWebSocketFactory(url: string, options?: {
3
3
  headers?: Record<string, string>;
4
4
  protocols?: string[];
5
5
  }): WebSocketLike;
6
+ export declare function nativeWebSocketFactory(url: string, options?: {
7
+ headers?: Record<string, string>;
8
+ protocols?: string[];
9
+ }): WebSocketLike;
6
10
  export declare function createWebSocketTransportFactory(factory: WebSocketFactory): DaemonTransportFactory;
7
11
  export declare function bindWsHandler(ws: WebSocketLike, event: "open" | "close" | "error" | "message", handler: (...args: unknown[]) => void): () => void;
8
12
  //# sourceMappingURL=daemon-client-websocket-transport.d.ts.map
@@ -1,10 +1,22 @@
1
1
  import { extractRelayMessage } from "./daemon-client-transport-utils.js";
2
- export function defaultWebSocketFactory(url, options) {
2
+ function getGlobalWebSocket() {
3
3
  const globalWs = globalThis.WebSocket;
4
4
  if (!globalWs) {
5
5
  throw new Error("WebSocket is not available in this runtime");
6
6
  }
7
- return new globalWs(url, options?.protocols);
7
+ return globalWs;
8
+ }
9
+ export function defaultWebSocketFactory(url, options) {
10
+ const globalWs = getGlobalWebSocket();
11
+ if (options?.protocols === undefined) {
12
+ return new globalWs(url);
13
+ }
14
+ return new globalWs(url, options.protocols);
15
+ }
16
+ // React Native and Node-compatible WebSocket implementations accept this extra options object.
17
+ // Keep it out of the standard browser factory above.
18
+ export function nativeWebSocketFactory(url, options) {
19
+ return new (getGlobalWebSocket())(url, options?.protocols, { headers: options?.headers });
8
20
  }
9
21
  export function createWebSocketTransportFactory(factory) {
10
22
  return ({ url, headers, protocols }) => {
@@ -3,10 +3,11 @@ import type { z } from "zod";
3
3
  import type { ProjectGithubCloneProtocol } from "@otto-code/protocol/messages";
4
4
  import { type ClientCapability } from "@otto-code/protocol/client-capabilities";
5
5
  import { AgentRefreshedStatusPayloadSchema, CheckoutRenameBranchResponseSchema, RenameTerminalResponseSchema, RestartRequestedStatusPayloadSchema, ShutdownRequestedStatusPayloadSchema, DaemonUpdateResponseSchema, type ServerInfoStatusPayload } from "@otto-code/protocol/messages";
6
- import type { AgentStreamEventPayload, AgentSnapshotPayload, ProjectPlacementPayload, AgentPermissionResolvedMessage, CreateAgentRequestMessage, CreateOttoWorktreeRequest, CodeListFilesResponse, CodeSymbolLocation, CodeDefinitionLocation, CodeDefinitionStatus, CodeRenameApplyStatus, CodeRenameFileOutcome, CodeRenameUndoFile, CodeRenameUndoStatus, CodeHoverRange, CodeRenameEdit, CodeRenameFilePlan, LspLanguageState, LspRunningServer, CodeSolutionGetTreeResponse, CodeSolutionLoadProjectResponse, SolutionFormat, SolutionRef, SolutionTreeFolder, SolutionTreeProject, SolutionProjectNode, SolutionProjectStatus, SolutionPackageReference, FileCreateResult, FileDeleteResult, FileDownloadTokenResponse, FileEntryKind, FileEol, FileRenameResult, FileReplaceFileResult, FileReplaceRequest, FileReplaceResponse, FileSearchResultPayload, FileSearchSummary, FileUploadResponse, FileExplorerResponse, FileWatchEventPayload, FileWriteResult, FileRefineResult, FileRefineDocument, FileRefineReference, FetchAgentTimelineResponseMessage, AgentForkContextResponseMessage, GitSetupOptions, CheckoutStatusResponse, CheckoutCommitResponse, CheckoutGitCommitResponse, CheckoutGitCommitAgentResponse, CheckoutGitRollbackResponse, CheckoutGitFileHistoryResponse, CheckoutGitFileCommitDiffResponse, CheckoutGitFileBlameResponse, CheckoutGitFileOriginResponse, CheckoutGitGetOperationLogResponse, CheckoutMergeResponse, CheckoutMergeFromBaseResponse, CheckoutPullResponse, CheckoutPushResponse, CheckoutRefreshResponse, CheckoutGitFetchResponse, CheckoutPrCreateResponse, CheckoutPrMergeResponse, CheckoutPrMergeMethod, CheckoutGithubSetAutoMergeResponse, CheckoutGithubGetCheckDetailsResponse, PreviewListConfigResponse, PreviewStartResponse, PreviewBindTabResponse, PreviewStopResponse, CheckoutPrStatusResponse, PullRequestTimelineResponse, CheckoutSwitchBranchResponse, StashSaveResponse, StashPopResponse, StashListResponse, KanbanBoardsListResponse, ProjectKanbanTarget, KanbanBoardGetResponse, KanbanCardMoveResponse, KanbanCardCreateResponse, KanbanTaskLinkResponse, ValidateBranchResponse, BranchSuggestionsResponse, FileVersion, CheckoutCommit, ParsedDiffFile, WorkspaceRecoveryState, CheckoutForgeGetCheckDetailsResponse, CheckoutForgeSetAutoMergeResponse, ProjectCreateDirectoryResponse, FsFileWriteResult, FsFileWriteBinaryResult, GitHubSearchResponse, GitHubSearchRequest, ForgeSearchResponse, ForgeSearchRequest, GitHostingProviderId, HostingSearchRequest, HostingSearchResponse, HostingAuthStatusResponse, DirectorySuggestionsResponse, OttoWorktreeListResponse, OttoWorktreeArchiveResponse, ProjectIconResponse, ContextCategory, ContextPromptPreviewGetResponseMessage, ContextReportGetResponseMessage, ContextEdgeConvertResponseMessage, ContextFindingsFixResponseMessage, PersonalityMemoryListResponseMessage, PersonalityMemoryUpdateResponseMessage, PersonalityMemoryTransferResponseMessage, PersonalityMemoryStatsResponseMessage, ProjectKnowledgeListResponseMessage, ProjectKnowledgeGetResponseMessage, ProjectKnowledgeCreateResponseMessage, ProjectKnowledgeApplyResponseMessage, ProjectKnowledgeStatusResponseMessage, ProjectKnowledgeProjectApplyResponseMessage, ProjectKnowledgeReferenceApplyResponseMessage, ProjectKnowledgeRootApplyResponseMessage, ProjectKnowledgeDeleteResponseMessage, ProjectAddResponse, ProjectResolveWorkspaceForPathResponse, ProjectScaffoldGit, ProjectScaffoldProgress, ProjectScaffoldResponse, HostingListRepositoriesResponse, HostingListOwnersResponse, OpenProjectResponseMessage, ArchiveWorkspaceResponseMessage, WorkspaceArchivePreflightResponse, WorktreeBaseRefSetResponse, WorktreeReattachListResponse, WorktreeReattachResponse, WorktreeReattachTarget, WorkspaceSetupStatusResponseMessage, ListCommandsResponse, ListProviderFeaturesResponseMessage, ListProviderModelsResponseMessage, ListProviderModesResponseMessage, ListAvailableProvidersResponse, GetProvidersSnapshotResponseMessage, RefreshProvidersSnapshotResponseMessage, ProviderDiagnosticResponseMessage, ProviderUsageListResponseMessage, StatsActivityGetResponseMessage, StatsActivityResetResponseMessage, UsageLogGetResponseMessage, AgentContextGetUsageResponseMessage, DaemonGetStatusResponse, DaemonGetPairingOfferResponse, DiagnosticsResponse, AgentRewindResponseMessage, ListTerminalsResponse, CreateTerminalResponse, SubscribeTerminalResponse, SubscribeTerminalRequest, CloseItemsResponse, AttachmentsImagesClearResponse, AttachmentsImagesStatsResponse, HistoryAgentsClearArchivedResponse, HistoryAgentsStorageStatsResponse, KillTerminalResponse, CaptureTerminalResponse, TerminalCompatibilityDiagnosticResponse, TerminalInput, SessionInboundMessage, SessionOutboundMessage, SendAgentMessageRequest, AgentPromptDelivery, TasksSuggestedStartMode, OttoConfigRaw, OttoConfigRevision, WorkspaceCreateRequest } from "@otto-code/protocol/messages";
6
+ import type { AgentStreamEventPayload, AgentSnapshotPayload, ProjectPlacementPayload, AgentPermissionResolvedMessage, CreateAgentRequestMessage, CreateOttoWorktreeRequest, CodeListFilesResponse, CodeSymbolLocation, CodeDefinitionLocation, CodeDefinitionStatus, CodeRenameApplyStatus, CodeRenameFileOutcome, CodeRenameUndoFile, CodeRenameUndoStatus, CodeHoverRange, CodeRenameEdit, CodeRenameFilePlan, LspLanguageState, LspRunningServer, CodeSolutionGetTreeResponse, CodeSolutionLoadProjectResponse, SolutionFormat, SolutionRef, SolutionTreeFolder, SolutionTreeProject, SolutionProjectNode, SolutionProjectStatus, SolutionPackageReference, FileDownloadTokenResponse, FileEntryKind, FileEol, FileReplaceFileResult, FileReplaceRequest, FileReplaceResponse, FileSearchResultPayload, FileSearchSummary, FileUploadResponse, FileExplorerResponse, FileWatchEventPayload, FileWriteResult, FileRefineResult, FileRefineDocument, FileRefineReference, FetchAgentTimelineResponseMessage, AgentForkContextResponseMessage, GitSetupOptions, CheckoutStatusResponse, CheckoutCommitResponse, CheckoutGitCommitResponse, CheckoutGitCommitAgentResponse, CheckoutGitRollbackResponse, CheckoutGitFileHistoryResponse, CheckoutGitFileCommitDiffResponse, CheckoutGitFileBlameResponse, CheckoutGitFileOriginResponse, CheckoutGitGetOperationLogResponse, CheckoutMergeResponse, CheckoutMergeFromBaseResponse, CheckoutPullResponse, CheckoutPushResponse, CheckoutRefreshResponse, CheckoutGitFetchResponse, CheckoutPrCreateResponse, CheckoutPrMergeResponse, CheckoutPrMergeMethod, CheckoutGithubSetAutoMergeResponse, CheckoutGithubGetCheckDetailsResponse, PreviewListConfigResponse, PreviewStartResponse, PreviewBindTabResponse, PreviewStopResponse, CheckoutPrStatusResponse, PullRequestTimelineResponse, CheckoutSwitchBranchResponse, StashSaveResponse, StashPopResponse, StashListResponse, KanbanBoardsListResponse, ProjectKanbanTarget, KanbanBoardGetResponse, KanbanCardMoveResponse, KanbanCardCreateResponse, KanbanTaskLinkResponse, ValidateBranchResponse, BranchSuggestionsResponse, FileVersion, CheckoutCommit, ParsedDiffFile, WorkspaceRecoveryState, CheckoutForgeGetCheckDetailsResponse, CheckoutForgeSetAutoMergeResponse, ProjectCreateDirectoryResponse, FsFileWriteResult, FsFileWriteBinaryResult, GitHubSearchResponse, GitHubSearchRequest, ForgeSearchResponse, ForgeSearchRequest, GitHostingProviderId, HostingSearchRequest, HostingSearchResponse, HostingAuthStatusResponse, DirectorySuggestionsResponse, OttoWorktreeListResponse, OttoWorktreeArchiveResponse, ProjectIconSource, ProjectIconResponse, ContextCategory, ContextPromptPreviewGetResponseMessage, ContextReportGetResponseMessage, ContextEdgeConvertResponseMessage, ContextFindingsFixResponseMessage, PersonalityMemoryListResponseMessage, PersonalityMemoryUpdateResponseMessage, PersonalityMemoryTransferResponseMessage, PersonalityMemoryStatsResponseMessage, ProjectKnowledgeListResponseMessage, ProjectKnowledgeGetResponseMessage, ProjectKnowledgeCreateResponseMessage, ProjectKnowledgeApplyResponseMessage, ProjectKnowledgeStatusResponseMessage, ProjectKnowledgeProjectApplyResponseMessage, ProjectKnowledgeReferenceApplyResponseMessage, ProjectKnowledgeRootApplyResponseMessage, ProjectKnowledgeDeleteResponseMessage, ProjectIconGetResponse, ProjectAddResponse, ProjectResolveWorkspaceForPathResponse, ProjectScaffoldGit, ProjectScaffoldProgress, ProjectScaffoldResponse, HostingListRepositoriesResponse, HostingListOwnersResponse, OpenProjectResponseMessage, ArchiveWorkspaceResponseMessage, WorkspaceArchivePreflightResponse, WorktreeBaseRefSetResponse, WorktreeReattachListResponse, WorktreeReattachResponse, WorktreeReattachTarget, WorkspaceSetupStatusResponseMessage, ListCommandsResponse, ListProviderFeaturesResponseMessage, ListProviderModelsResponseMessage, ListProviderModesResponseMessage, ListAvailableProvidersResponse, GetProvidersSnapshotResponseMessage, RefreshProvidersSnapshotResponseMessage, ProviderDiagnosticResponseMessage, ProviderUsageListResponseMessage, StatsActivityGetResponseMessage, StatsActivityResetResponseMessage, UsageLogGetResponseMessage, AgentContextGetUsageResponseMessage, DaemonGetStatusResponse, DaemonGetPairingOfferResponse, DiagnosticsResponse, AgentRewindResponseMessage, ListTerminalsResponse, CreateTerminalResponse, SubscribeTerminalResponse, SubscribeTerminalRequest, CloseItemsResponse, AttachmentsImagesClearResponse, AttachmentsImagesStatsResponse, HistoryAgentsClearArchivedResponse, HistoryAgentsStorageStatsResponse, KillTerminalResponse, CaptureTerminalResponse, TerminalCompatibilityDiagnosticResponse, TerminalInput, SessionInboundMessage, SessionOutboundMessage, SendAgentMessageRequest, AgentPromptDelivery, TasksSuggestedStartMode, OttoConfigRaw, OttoConfigRevision, WorkspaceCreateRequest } from "@otto-code/protocol/messages";
7
7
  import type { AgentPermissionRequest, AgentPermissionResponse, AgentPersistenceHandle, AgentProviderNotice, AgentProvider, AgentSessionConfig } from "@otto-code/protocol/agent-types";
8
8
  import type { OrchestrationGraph, PromptTemplate, Run } from "@otto-code/protocol/orchestration";
9
9
  import type { BrainCatalogModel, BrainDiskUsage, BrainEvals, BrainHfSearchResult, BrainHostStatus, BrainInstalledModel, BrainInventoryModel, BrainJob, BrainLogsTailResponse, BrainLogsWatchResponse, BrainModelBudgetGetResponse, BrainModelDeleteResponse, BrainModelLoadResponse, BrainModelProfileGetResponse, BrainModelProfileSetResponse, BrainModelRenameResetResponse, BrainModelRenameResponse, BrainNetworkInfo, BrainRemoteConfig, BrainRepoQuant, BrainRuntime, ConnectorsListToolsResponse, ConnectorsOauthAuthorizeResponse, ConnectorsOauthDisconnectResponse, CommunicationsGetOverviewResponse, CommunicationsInboxGetHomeResponse, CommunicationsInboxNotificationsAcknowledgeResponse, CommunicationsInboxSearchResponse, CommunicationsInboxSetFavoriteResponse, CommunicationsInboxGetPresenceResponse, CommunicationsInboxGetMessagesResponse, CommunicationsInboxSetPresenceResponse, CommunicationsInboxSetEnabledResponse, CommunicationsInboxSendMessageResponse, CommunicationsRoomGetResponse, CommunicationsRoomThreadGetResponse, CommunicationsRoomMessageSendResponse, CommunicationsRoomReactionSetResponse, IntegrationsAuthorizationGetOverviewResponse, IntegrationsAuthorizationGetMethodsResponse, IntegrationsAuthorizationStartBrowserResponse, IntegrationsZoomStartAuthorizationResponse, CueMoment, MutableDaemonConfig, MutableDaemonConfigPatch, ProjectLink, SpeechSettingsOptions, SpeechTtsPreviewResult, SpeechTtsSpeakResult, SpeechTtsSpeakCancelResult, VisualizerVoiceCuesResult, AgentPersonalitiesGenerateProfileResult } from "@otto-code/protocol/messages";
10
+ import type { AgentConfigApply } from "@otto-code/protocol/messages";
10
11
  import { type DaemonTransportFactory, type WebSocketFactory } from "./daemon-client-transport.js";
11
12
  import { type DaemonClientTrafficHotspot, type DaemonClientTrafficTotals } from "./daemon-client-runtime-metrics.js";
12
13
  import { type TerminalStreamEvent } from "./terminal-stream-router.js";
@@ -127,8 +128,14 @@ export interface DaemonClientConfig {
127
128
  };
128
129
  runtimeMetricsIntervalMs?: number;
129
130
  runtimeMetricsWindowMs?: number;
131
+ trace?: DaemonClientTrace;
130
132
  capabilities?: Partial<Record<ClientCapability, unknown>>;
131
133
  }
134
+ export interface DaemonClientTrace {
135
+ isEnabled(): boolean;
136
+ beginSection(name: string, args?: Record<string, string>): void;
137
+ endSection(): void;
138
+ }
132
139
  export interface SendMessageOptions {
133
140
  messageId?: string;
134
141
  images?: Array<{
@@ -481,42 +488,6 @@ type CloseItemsPayload = CloseItemsResponse["payload"];
481
488
  type KillTerminalPayload = KillTerminalResponse["payload"];
482
489
  type CaptureTerminalPayload = CaptureTerminalResponse["payload"];
483
490
  type TerminalCompatibilityDiagnosticPayload = TerminalCompatibilityDiagnosticResponse["payload"];
484
- type ChatCreatePayload = Extract<SessionOutboundMessage, {
485
- type: "chat/create/response";
486
- }>["payload"];
487
- type ChatListPayload = Extract<SessionOutboundMessage, {
488
- type: "chat/list/response";
489
- }>["payload"];
490
- type ChatInspectPayload = Extract<SessionOutboundMessage, {
491
- type: "chat/inspect/response";
492
- }>["payload"];
493
- type ChatDeletePayload = Extract<SessionOutboundMessage, {
494
- type: "chat/delete/response";
495
- }>["payload"];
496
- type ChatPostPayload = Extract<SessionOutboundMessage, {
497
- type: "chat/post/response";
498
- }>["payload"];
499
- type ChatReadPayload = Extract<SessionOutboundMessage, {
500
- type: "chat/read/response";
501
- }>["payload"];
502
- type ChatWaitPayload = Extract<SessionOutboundMessage, {
503
- type: "chat/wait/response";
504
- }>["payload"];
505
- type LoopRunPayload = Extract<SessionOutboundMessage, {
506
- type: "loop/run/response";
507
- }>["payload"];
508
- type LoopListPayload = Extract<SessionOutboundMessage, {
509
- type: "loop/list/response";
510
- }>["payload"];
511
- type LoopInspectPayload = Extract<SessionOutboundMessage, {
512
- type: "loop/inspect/response";
513
- }>["payload"];
514
- type LoopLogsPayload = Extract<SessionOutboundMessage, {
515
- type: "loop/logs/response";
516
- }>["payload"];
517
- type LoopStopPayload = Extract<SessionOutboundMessage, {
518
- type: "loop/stop/response";
519
- }>["payload"];
520
491
  type ScheduleCreatePayload = Extract<SessionOutboundMessage, {
521
492
  type: "schedule/create/response";
522
493
  }>["payload"];
@@ -584,9 +555,13 @@ export interface FetchAgentTimelineOptions {
584
555
  cursor?: FetchAgentTimelineCursor;
585
556
  limit?: number;
586
557
  projection?: FetchAgentTimelineProjection;
558
+ mergeWindow?: boolean;
587
559
  requestId?: string;
588
560
  timeout?: number;
589
561
  }
562
+ export type AgentTimelinePromptIndexPayload = Extract<SessionOutboundMessage, {
563
+ type: "agent.timeline.list_prompts.response";
564
+ }>["payload"];
590
565
  export type ProviderSubagentListPayload = Extract<SessionOutboundMessage, {
591
566
  type: "agent.provider_subagents.list.response";
592
567
  }>["payload"];
@@ -665,70 +640,6 @@ export type FetchWorkspacesOptions = Omit<FetchWorkspacesRequest, "type" | "requ
665
640
  };
666
641
  export type FetchWorkspacesEntry = FetchWorkspacesPayload["entries"][number];
667
642
  export type FetchWorkspacesPageInfo = FetchWorkspacesPayload["pageInfo"];
668
- export interface CreateChatRoomOptions {
669
- name: string;
670
- purpose?: string | null;
671
- requestId?: string;
672
- }
673
- export interface InspectChatRoomOptions {
674
- room: string;
675
- requestId?: string;
676
- }
677
- export interface DeleteChatRoomOptions {
678
- room: string;
679
- requestId?: string;
680
- }
681
- export interface PostChatMessageOptions {
682
- room: string;
683
- body: string;
684
- authorAgentId?: string;
685
- replyToMessageId?: string | null;
686
- requestId?: string;
687
- }
688
- export interface ReadChatMessagesOptions {
689
- room: string;
690
- limit?: number;
691
- since?: string;
692
- authorAgentId?: string;
693
- requestId?: string;
694
- timeout?: number;
695
- }
696
- export interface WaitForChatMessagesOptions {
697
- room: string;
698
- afterMessageId?: string | null;
699
- timeoutMs?: number;
700
- requestId?: string;
701
- }
702
- export interface RunLoopOptions {
703
- prompt: string;
704
- cwd: string;
705
- provider?: string;
706
- model?: string;
707
- modeId?: string;
708
- verifierProvider?: string;
709
- verifierModel?: string;
710
- verifierModeId?: string;
711
- verifyPrompt?: string | null;
712
- verifyChecks?: string[];
713
- name?: string | null;
714
- sleepMs?: number;
715
- maxIterations?: number;
716
- maxTimeMs?: number;
717
- requestId?: string;
718
- }
719
- export interface InspectLoopOptions {
720
- id: string;
721
- requestId?: string;
722
- }
723
- export interface LoopLogsOptions {
724
- id: string;
725
- afterSeq?: number;
726
- requestId?: string;
727
- }
728
- export interface StopLoopOptions {
729
- id: string;
730
- requestId?: string;
731
- }
732
643
  export interface CreateScheduleOptions {
733
644
  prompt: string;
734
645
  name?: string | null;
@@ -759,11 +670,7 @@ export interface CreateScheduleOptions {
759
670
  archiveOnFinish?: boolean;
760
671
  isolation?: "local" | "worktree";
761
672
  title?: string | null;
762
- approvalPolicy?: string;
763
- sandboxMode?: string;
764
- networkAccess?: boolean;
765
- webSearch?: boolean;
766
- extra?: AgentSessionConfig["extra"];
673
+ providerOptions?: AgentSessionConfig["providerOptions"];
767
674
  systemPrompt?: string;
768
675
  mcpServers?: AgentSessionConfig["mcpServers"];
769
676
  };
@@ -840,6 +747,21 @@ export interface WaitForFinishResult {
840
747
  error: string | null;
841
748
  lastMessage: string | null;
842
749
  }
750
+ type GetDaemonConfigResponse = Extract<SessionOutboundMessage, {
751
+ type: "get_daemon_config_response";
752
+ }>;
753
+ type SetDaemonConfigResponse = Extract<SessionOutboundMessage, {
754
+ type: "set_daemon_config_response";
755
+ }>;
756
+ type CorrelatedResponseMessage = Extract<SessionOutboundMessage, {
757
+ payload: {
758
+ requestId: string;
759
+ };
760
+ }> | GetDaemonConfigResponse | SetDaemonConfigResponse;
761
+ type CorrelatedResponseType = CorrelatedResponseMessage["type"];
762
+ type CorrelatedResponsePayload<TType extends CorrelatedResponseType> = Extract<CorrelatedResponseMessage, {
763
+ type: TType;
764
+ }>["payload"];
843
765
  type ProjectGithubClonePayload = Extract<SessionOutboundMessage, {
844
766
  type: "project.github.clone.response";
845
767
  }>["payload"];
@@ -904,6 +826,11 @@ export declare class DaemonClient {
904
826
  type: TType;
905
827
  }>) => void): () => void;
906
828
  on(handler: DaemonEventHandler): () => void;
829
+ private beginTraceSection;
830
+ private endTraceSection;
831
+ private traceInstant;
832
+ private sendJsonMessage;
833
+ private sendTransportFrame;
907
834
  /**
908
835
  * Send a session message. For fire-and-forget messages (heartbeats, etc.),
909
836
  * failures are suppressed if `suppressSendErrors` is configured.
@@ -942,6 +869,7 @@ export declare class DaemonClient {
942
869
  appVisibilityChangedAt?: string;
943
870
  }): void;
944
871
  registerPushToken(token: string): void;
872
+ unregisterPushToken(token: string): Promise<void>;
945
873
  ping(params?: {
946
874
  requestId?: string;
947
875
  timeoutMs?: number;
@@ -1150,6 +1078,7 @@ export declare class DaemonClient {
1150
1078
  }, requestId?: string): Promise<{
1151
1079
  target: ProjectKanbanTarget | null;
1152
1080
  }>;
1081
+ setProjectIcon(projectId: string, source: ProjectIconSource, requestId?: string): Promise<void>;
1153
1082
  removeProject(projectId: string, requestId?: string): Promise<{
1154
1083
  removedWorkspaceIds: string[];
1155
1084
  }>;
@@ -1256,6 +1185,10 @@ export declare class DaemonClient {
1256
1185
  unsubscribe: () => void;
1257
1186
  }>;
1258
1187
  fetchAgentTimeline(agentId: string, options?: FetchAgentTimelineOptions): Promise<FetchAgentTimelinePayload>;
1188
+ listAgentTimelinePrompts(agentId: string, options?: {
1189
+ requestId?: string;
1190
+ timeout?: number;
1191
+ }): Promise<AgentTimelinePromptIndexPayload>;
1259
1192
  buildAgentForkContext(agentId: string, options?: AgentForkContextOptions): Promise<AgentForkContextPayload>;
1260
1193
  sendAgentMessage(agentId: string, text: string, options?: SendMessageOptions): Promise<SendAgentMessageResult>;
1261
1194
  sendMessage(agentId: string, text: string, options?: SendMessageOptions): Promise<void>;
@@ -1293,6 +1226,14 @@ export declare class DaemonClient {
1293
1226
  * server_info.features.setAgentPersonality.
1294
1227
  */
1295
1228
  setAgentPersonality(agentId: string, personalityId: string | null): Promise<AgentProviderNotice | null>;
1229
+ /**
1230
+ * Applies a whole agent-config bundle in one request. Use this instead of
1231
+ * chaining the single-field setters when the values belong together so client
1232
+ * interruption and other mutations cannot interleave between steps. A
1233
+ * provider rejection can still leave earlier steps applied.
1234
+ * Gated on `server_info.features.agentConfigApply`.
1235
+ */
1236
+ applyAgentConfig(agentId: string, config: AgentConfigApply): Promise<AgentProviderNotice | null>;
1296
1237
  restartServer(reason?: string, requestId?: string): Promise<RestartRequestedStatusPayload>;
1297
1238
  shutdownServer(options?: ShutdownServerOptions): Promise<ShutdownRequestedStatusPayload>;
1298
1239
  updateDaemon(requestId?: string): Promise<DaemonUpdateResponse["payload"]>;
@@ -1508,12 +1449,6 @@ export declare class DaemonClient {
1508
1449
  * frames leave in order and behind the JSON request that announced them.
1509
1450
  */
1510
1451
  private sendFileTransfer;
1511
- /** Create an empty file or a directory. Never overwrites - see FileCreateResultSchema. */
1512
- createFileEntry(options: FileCreateOptions): Promise<FileCreateResult>;
1513
- /** Permanent delete - an unlink, not a move to any trash. */
1514
- deleteFileEntry(options: FileDeleteOptions): Promise<FileDeleteResult>;
1515
- /** Rename, which is also move. Never clobbers an occupied destination. */
1516
- renameFileEntry(options: FileRenameOptions): Promise<FileRenameResult>;
1517
1452
  refineFile(options: FileRefineOptions): Promise<FileRefineResult>;
1518
1453
  /**
1519
1454
  * Project-wide search. Per-file results stream through onFileResult (the
@@ -1795,6 +1730,7 @@ export declare class DaemonClient {
1795
1730
  }): Promise<ListAvailableProvidersPayload>;
1796
1731
  getProvidersSnapshot(options?: {
1797
1732
  cwd?: string;
1733
+ ifNoneMatch?: string;
1798
1734
  requestId?: string;
1799
1735
  }): Promise<GetProvidersSnapshotPayload>;
1800
1736
  getDaemonConfig(requestId?: string): Promise<{
@@ -1954,6 +1890,28 @@ export declare class DaemonClient {
1954
1890
  brainCalibrate(model: string, requestId?: string): Promise<BrainJob>;
1955
1891
  brainSweep(model: string, requestId?: string): Promise<BrainJob>;
1956
1892
  brainBench(model?: string | null, requestId?: string): Promise<BrainJob>;
1893
+ createFileEntry(input: {
1894
+ cwd: string;
1895
+ parentPath: string;
1896
+ name: string;
1897
+ kind: "file" | "directory";
1898
+ }): Promise<CorrelatedResponsePayload<"fs.entry.create.response">>;
1899
+ renameFileEntry(input: {
1900
+ cwd: string;
1901
+ path: string;
1902
+ name: string;
1903
+ }): Promise<CorrelatedResponsePayload<"fs.entry.rename.response">>;
1904
+ duplicateFileEntry(input: {
1905
+ cwd: string;
1906
+ path: string;
1907
+ }): Promise<CorrelatedResponsePayload<"fs.entry.duplicate.response">>;
1908
+ deleteFileEntry(input: {
1909
+ cwd: string;
1910
+ path: string;
1911
+ }): Promise<CorrelatedResponsePayload<"fs.entry.delete.response">>;
1912
+ checkoutDiscardChanges(cwd: string, input: {
1913
+ paths: string[];
1914
+ }): Promise<CorrelatedResponsePayload<"checkout.discard_changes.response">>;
1957
1915
  brainJobsList(requestId?: string): Promise<BrainJob[]>;
1958
1916
  brainJobsCancel(jobId: string, requestId?: string): Promise<BrainJob[]>;
1959
1917
  /**
@@ -1986,6 +1944,7 @@ export declare class DaemonClient {
1986
1944
  brainModelLoad(modelId: string, requestId?: string): Promise<BrainModelLoadResponse["payload"]>;
1987
1945
  /** Unload the resident model, leaving the brain up and serving nothing. */
1988
1946
  brainModelUnload(requestId?: string): Promise<BrainHostStatus | null>;
1947
+ getProjectIcon(projectId: string, requestId?: string): Promise<ProjectIconGetResponse["payload"]>;
1989
1948
  /** Delete a model's files. The brain refuses while that model is loaded. */
1990
1949
  brainModelDelete(modelId: string, requestId?: string): Promise<BrainModelDeleteResponse["payload"]>;
1991
1950
  brainModelComponentDelete(modelId: string, componentId: string, requestId?: string): Promise<{
@@ -2126,13 +2085,6 @@ export declare class DaemonClient {
2126
2085
  stripAnsi?: boolean;
2127
2086
  }, requestId?: string): Promise<CaptureTerminalPayload>;
2128
2087
  runTerminalCompatibilityDiagnostic(requestId?: string): Promise<TerminalCompatibilityDiagnosticPayload>;
2129
- createChatRoom(options: CreateChatRoomOptions): Promise<ChatCreatePayload>;
2130
- listChatRooms(requestId?: string): Promise<ChatListPayload>;
2131
- inspectChatRoom(options: InspectChatRoomOptions): Promise<ChatInspectPayload>;
2132
- deleteChatRoom(options: DeleteChatRoomOptions): Promise<ChatDeletePayload>;
2133
- postChatMessage(options: PostChatMessageOptions): Promise<ChatPostPayload>;
2134
- readChatMessages(options: ReadChatMessagesOptions): Promise<ChatReadPayload>;
2135
- waitForChatMessages(options: WaitForChatMessagesOptions): Promise<ChatWaitPayload>;
2136
2088
  scheduleCreate(options: CreateScheduleOptions): Promise<ScheduleCreatePayload>;
2137
2089
  scheduleList(requestId?: string): Promise<ScheduleListPayload>;
2138
2090
  scheduleInspect(options: InspectScheduleOptions): Promise<ScheduleInspectPayload>;
@@ -2193,11 +2145,6 @@ export declare class DaemonClient {
2193
2145
  artifactId: string;
2194
2146
  requestId?: string;
2195
2147
  }): Promise<ArtifactGetContentPayload>;
2196
- loopRun(options: RunLoopOptions): Promise<LoopRunPayload>;
2197
- loopList(requestId?: string): Promise<LoopListPayload>;
2198
- loopInspect(options: string | InspectLoopOptions): Promise<LoopInspectPayload>;
2199
- loopLogs(options: string | LoopLogsOptions, afterSeq?: number): Promise<LoopLogsPayload>;
2200
- loopStop(options: string | StopLoopOptions): Promise<LoopStopPayload>;
2201
2148
  onTerminalStreamEvent(handler: (event: TerminalStreamEvent) => void): () => void;
2202
2149
  waitForTerminalStreamEvent(predicate: (event: TerminalStreamEvent) => boolean, timeout?: number): Promise<TerminalStreamEvent>;
2203
2150
  private createRequestId;