@otto-code/client 0.5.1 → 0.5.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/dist/daemon-client.d.ts +40 -2
- package/dist/daemon-client.js +79 -1
- package/package.json +3 -3
package/dist/daemon-client.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { z } from "zod";
|
|
2
2
|
import { type ClientCapability } from "@otto-code/protocol/client-capabilities";
|
|
3
3
|
import { AgentRefreshedStatusPayloadSchema, CheckoutRenameBranchResponseSchema, RenameTerminalResponseSchema, RestartRequestedStatusPayloadSchema, ShutdownRequestedStatusPayloadSchema, DaemonUpdateResponseSchema, type ServerInfoStatusPayload } from "@otto-code/protocol/messages";
|
|
4
|
-
import type { AgentStreamEventPayload, AgentSnapshotPayload, ProjectPlacementPayload, AgentPermissionResolvedMessage, CreateAgentRequestMessage, CreateOttoWorktreeRequest, CodeListFilesResponse, CodeSymbolLocation, FileDownloadTokenResponse, FileEol, FileReplaceFileResult, FileReplaceRequest, FileReplaceResponse, FileSearchResultPayload, FileSearchSummary, FileUploadResponse, FileExplorerResponse, FileWatchEventPayload, FileWriteResult, FetchAgentTimelineResponseMessage, AgentForkContextResponseMessage, GitSetupOptions, CheckoutStatusResponse, CheckoutCommitResponse, CheckoutGitCommitResponse, CheckoutGitCommitAgentResponse, CheckoutGitRollbackResponse, CheckoutGitGetOperationLogResponse, CheckoutMergeResponse, CheckoutMergeFromBaseResponse, CheckoutPullResponse, CheckoutPushResponse, CheckoutRefreshResponse, CheckoutPrCreateResponse, CheckoutPrMergeResponse, CheckoutPrMergeMethod, CheckoutGithubSetAutoMergeResponse, CheckoutGithubGetCheckDetailsResponse, PreviewListConfigResponse, PreviewStartResponse, PreviewBindTabResponse, PreviewStopResponse, CheckoutPrStatusResponse, PullRequestTimelineResponse, CheckoutSwitchBranchResponse, StashSaveResponse, StashPopResponse, StashListResponse, ValidateBranchResponse, BranchSuggestionsResponse, GitHubSearchResponse, GitHubSearchRequest, GitHostingProviderId, HostingSearchRequest, HostingSearchResponse, HostingAuthStatusResponse, DirectorySuggestionsResponse, OttoWorktreeListResponse, OttoWorktreeArchiveResponse, ProjectIconResponse, ProjectAddResponse, OpenProjectResponseMessage, ArchiveWorkspaceResponseMessage, WorkspaceSetupStatusResponseMessage, ListCommandsResponse, ListProviderFeaturesResponseMessage, ListProviderModelsResponseMessage, ListProviderModesResponseMessage, ListAvailableProvidersResponse, GetProvidersSnapshotResponseMessage, RefreshProvidersSnapshotResponseMessage, ProviderDiagnosticResponseMessage, ProviderUsageListResponseMessage, AgentContextGetUsageResponseMessage, DaemonGetStatusResponse, DaemonGetPairingOfferResponse, DiagnosticsResponse, AgentRewindResponseMessage, ListTerminalsResponse, CreateTerminalResponse, SubscribeTerminalResponse, SubscribeTerminalRequest, CloseItemsResponse, KillTerminalResponse, CaptureTerminalResponse, TerminalInput, SessionInboundMessage, SessionOutboundMessage, SendAgentMessageRequest, OttoConfigRaw, OttoConfigRevision, WorkspaceCreateRequest } from "@otto-code/protocol/messages";
|
|
4
|
+
import type { AgentStreamEventPayload, AgentSnapshotPayload, ProjectPlacementPayload, AgentPermissionResolvedMessage, CreateAgentRequestMessage, CreateOttoWorktreeRequest, CodeListFilesResponse, CodeSymbolLocation, FileDownloadTokenResponse, FileEol, FileReplaceFileResult, FileReplaceRequest, FileReplaceResponse, FileSearchResultPayload, FileSearchSummary, FileUploadResponse, FileExplorerResponse, FileWatchEventPayload, FileWriteResult, FetchAgentTimelineResponseMessage, AgentForkContextResponseMessage, GitSetupOptions, CheckoutStatusResponse, CheckoutCommitResponse, CheckoutGitCommitResponse, CheckoutGitCommitAgentResponse, CheckoutGitRollbackResponse, CheckoutGitGetOperationLogResponse, CheckoutMergeResponse, CheckoutMergeFromBaseResponse, CheckoutPullResponse, CheckoutPushResponse, CheckoutRefreshResponse, CheckoutPrCreateResponse, CheckoutPrMergeResponse, CheckoutPrMergeMethod, CheckoutGithubSetAutoMergeResponse, CheckoutGithubGetCheckDetailsResponse, PreviewListConfigResponse, PreviewStartResponse, PreviewBindTabResponse, PreviewStopResponse, CheckoutPrStatusResponse, PullRequestTimelineResponse, CheckoutSwitchBranchResponse, StashSaveResponse, StashPopResponse, StashListResponse, ValidateBranchResponse, BranchSuggestionsResponse, GitHubSearchResponse, GitHubSearchRequest, GitHostingProviderId, HostingSearchRequest, HostingSearchResponse, HostingAuthStatusResponse, DirectorySuggestionsResponse, OttoWorktreeListResponse, OttoWorktreeArchiveResponse, ProjectIconResponse, ProjectAddResponse, OpenProjectResponseMessage, ArchiveWorkspaceResponseMessage, WorkspaceSetupStatusResponseMessage, ListCommandsResponse, ListProviderFeaturesResponseMessage, ListProviderModelsResponseMessage, ListProviderModesResponseMessage, ListAvailableProvidersResponse, GetProvidersSnapshotResponseMessage, RefreshProvidersSnapshotResponseMessage, ProviderDiagnosticResponseMessage, ProviderUsageListResponseMessage, StatsActivityGetResponseMessage, AgentContextGetUsageResponseMessage, DaemonGetStatusResponse, DaemonGetPairingOfferResponse, DiagnosticsResponse, AgentRewindResponseMessage, ListTerminalsResponse, CreateTerminalResponse, SubscribeTerminalResponse, SubscribeTerminalRequest, CloseItemsResponse, KillTerminalResponse, CaptureTerminalResponse, TerminalInput, SessionInboundMessage, SessionOutboundMessage, SendAgentMessageRequest, OttoConfigRaw, OttoConfigRevision, WorkspaceCreateRequest } from "@otto-code/protocol/messages";
|
|
5
5
|
import type { AgentPermissionRequest, AgentPermissionResponse, AgentPersistenceHandle, AgentProviderNotice, AgentProvider, AgentSessionConfig } from "@otto-code/protocol/agent-types";
|
|
6
|
+
import type { Run } from "@otto-code/protocol/orchestration";
|
|
6
7
|
import type { MutableDaemonConfig, MutableDaemonConfigPatch, SpeechSettingsOptions, SpeechTtsPreviewResult } from "@otto-code/protocol/messages";
|
|
7
8
|
import { type DaemonTransportFactory, type WebSocketFactory } from "./daemon-client-transport.js";
|
|
8
9
|
import { type TerminalStreamEvent } from "./terminal-stream-router.js";
|
|
@@ -550,6 +551,8 @@ export interface CreateScheduleOptions {
|
|
|
550
551
|
config: {
|
|
551
552
|
provider: AgentProvider;
|
|
552
553
|
cwd: string;
|
|
554
|
+
/** Personality binding by name, or the "@team-scheduler" sentinel. */
|
|
555
|
+
personality?: string;
|
|
553
556
|
modeId?: string;
|
|
554
557
|
model?: string;
|
|
555
558
|
thinkingOptionId?: string;
|
|
@@ -576,6 +579,11 @@ export interface InspectScheduleOptions {
|
|
|
576
579
|
}
|
|
577
580
|
export interface UpdateScheduleNewAgentConfig {
|
|
578
581
|
provider?: string;
|
|
582
|
+
/**
|
|
583
|
+
* Personality binding by name, or the "@team-scheduler" sentinel. Explicit
|
|
584
|
+
* null clears a stored binding; omission leaves it untouched.
|
|
585
|
+
*/
|
|
586
|
+
personality?: string | null;
|
|
579
587
|
model?: string | null;
|
|
580
588
|
modeId?: string | null;
|
|
581
589
|
thinkingOptionId?: string | null;
|
|
@@ -768,6 +776,30 @@ export declare class DaemonClient {
|
|
|
768
776
|
* the provider's stopTask. See projects/observed-subagents/observed-subagents.md.
|
|
769
777
|
*/
|
|
770
778
|
stopObservedSubagent(agentId: string): Promise<void>;
|
|
779
|
+
/**
|
|
780
|
+
* Stop a running background shell task (Claude Bash tool run_in_background).
|
|
781
|
+
* Not an AI subagent — the daemon resolves it to its owning provider task and
|
|
782
|
+
* calls the provider's stopTask, same mechanism as stopObservedSubagent.
|
|
783
|
+
*/
|
|
784
|
+
stopBackgroundShellTask(parentAgentId: string, taskId: string): Promise<void>;
|
|
785
|
+
/**
|
|
786
|
+
* Clear one or more terminal background shell tasks from the Background
|
|
787
|
+
* Tasks track. Still-live tasks are stopped best-effort first.
|
|
788
|
+
*/
|
|
789
|
+
clearBackgroundShellTasks(parentAgentId: string, taskIds: readonly string[]): Promise<void>;
|
|
790
|
+
/** Orchestration: fetch the current snapshot of all runs on this host. */
|
|
791
|
+
getRunsSnapshot(): Promise<Run[]>;
|
|
792
|
+
/** Orchestration: approve or reject a run's attended gate. */
|
|
793
|
+
respondToRunGate(input: {
|
|
794
|
+
runId: string;
|
|
795
|
+
phaseId: string;
|
|
796
|
+
approved: boolean;
|
|
797
|
+
note?: string;
|
|
798
|
+
}): Promise<boolean>;
|
|
799
|
+
/** Orchestration: cancel a run. */
|
|
800
|
+
cancelRun(runId: string): Promise<boolean>;
|
|
801
|
+
/** Orchestration: delete every finished (done/failed/canceled) run. */
|
|
802
|
+
clearFinishedRuns(): Promise<string[]>;
|
|
771
803
|
updateAgent(agentId: string, updates: {
|
|
772
804
|
name?: string;
|
|
773
805
|
labels?: Record<string, string>;
|
|
@@ -789,7 +821,9 @@ export declare class DaemonClient {
|
|
|
789
821
|
sendAgentMessage(agentId: string, text: string, options?: SendMessageOptions): Promise<void>;
|
|
790
822
|
sendMessage(agentId: string, text: string, options?: SendMessageOptions): Promise<void>;
|
|
791
823
|
rewindAgent(agentId: string, messageId: string, mode: "conversation" | "files" | "both"): Promise<AgentRewindResponseMessage["payload"]>;
|
|
792
|
-
cancelAgent(agentId: string): Promise<
|
|
824
|
+
cancelAgent(agentId: string): Promise<{
|
|
825
|
+
cancelled?: boolean;
|
|
826
|
+
}>;
|
|
793
827
|
setAgentMode(agentId: string, modeId: string): Promise<AgentProviderNotice | null>;
|
|
794
828
|
setAgentModel(agentId: string, modelId: string | null): Promise<void>;
|
|
795
829
|
setAgentFeature(agentId: string, featureId: string, value: unknown): Promise<void>;
|
|
@@ -1047,6 +1081,10 @@ export declare class DaemonClient {
|
|
|
1047
1081
|
listProviderUsage(options?: {
|
|
1048
1082
|
requestId?: string;
|
|
1049
1083
|
}): Promise<ProviderUsageListPayload>;
|
|
1084
|
+
/** Daemon-wide "fun stats" — see docs/data-model.md ActivityStatsStore. */
|
|
1085
|
+
getActivityStats(options?: {
|
|
1086
|
+
requestId?: string;
|
|
1087
|
+
}): Promise<StatsActivityGetResponseMessage["payload"]>;
|
|
1050
1088
|
getAgentContextUsage(agentId: string, options?: {
|
|
1051
1089
|
requestId?: string;
|
|
1052
1090
|
}): Promise<AgentContextGetUsagePayload>;
|
package/dist/daemon-client.js
CHANGED
|
@@ -1256,6 +1256,73 @@ export class DaemonClient {
|
|
|
1256
1256
|
throw new Error(payload.error ?? "stopObservedSubagent rejected");
|
|
1257
1257
|
}
|
|
1258
1258
|
}
|
|
1259
|
+
/**
|
|
1260
|
+
* Stop a running background shell task (Claude Bash tool run_in_background).
|
|
1261
|
+
* Not an AI subagent — the daemon resolves it to its owning provider task and
|
|
1262
|
+
* calls the provider's stopTask, same mechanism as stopObservedSubagent.
|
|
1263
|
+
*/
|
|
1264
|
+
async stopBackgroundShellTask(parentAgentId, taskId) {
|
|
1265
|
+
const payload = await this.sendNamespacedCorrelatedSessionRequest({
|
|
1266
|
+
message: {
|
|
1267
|
+
type: "agent.background_task.stop.request",
|
|
1268
|
+
parentAgentId,
|
|
1269
|
+
taskId,
|
|
1270
|
+
},
|
|
1271
|
+
});
|
|
1272
|
+
if (!payload.accepted) {
|
|
1273
|
+
throw new Error(payload.error ?? "stopBackgroundShellTask rejected");
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
/**
|
|
1277
|
+
* Clear one or more terminal background shell tasks from the Background
|
|
1278
|
+
* Tasks track. Still-live tasks are stopped best-effort first.
|
|
1279
|
+
*/
|
|
1280
|
+
async clearBackgroundShellTasks(parentAgentId, taskIds) {
|
|
1281
|
+
const payload = await this.sendNamespacedCorrelatedSessionRequest({
|
|
1282
|
+
message: {
|
|
1283
|
+
type: "agent.background_task.clear.request",
|
|
1284
|
+
parentAgentId,
|
|
1285
|
+
taskIds: [...taskIds],
|
|
1286
|
+
},
|
|
1287
|
+
});
|
|
1288
|
+
if (!payload.accepted) {
|
|
1289
|
+
throw new Error(payload.error ?? "clearBackgroundShellTasks rejected");
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
/** Orchestration: fetch the current snapshot of all runs on this host. */
|
|
1293
|
+
async getRunsSnapshot() {
|
|
1294
|
+
const payload = await this.sendNamespacedCorrelatedSessionRequest({
|
|
1295
|
+
message: { type: "runs.get_snapshot.request" },
|
|
1296
|
+
});
|
|
1297
|
+
return payload.runs;
|
|
1298
|
+
}
|
|
1299
|
+
/** Orchestration: approve or reject a run's attended gate. */
|
|
1300
|
+
async respondToRunGate(input) {
|
|
1301
|
+
const payload = await this.sendNamespacedCorrelatedSessionRequest({
|
|
1302
|
+
message: {
|
|
1303
|
+
type: "runs.gate_respond.request",
|
|
1304
|
+
runId: input.runId,
|
|
1305
|
+
phaseId: input.phaseId,
|
|
1306
|
+
approved: input.approved,
|
|
1307
|
+
...(input.note !== undefined ? { note: input.note } : {}),
|
|
1308
|
+
},
|
|
1309
|
+
});
|
|
1310
|
+
return payload.accepted;
|
|
1311
|
+
}
|
|
1312
|
+
/** Orchestration: cancel a run. */
|
|
1313
|
+
async cancelRun(runId) {
|
|
1314
|
+
const payload = await this.sendNamespacedCorrelatedSessionRequest({
|
|
1315
|
+
message: { type: "runs.cancel.request", runId },
|
|
1316
|
+
});
|
|
1317
|
+
return payload.canceled;
|
|
1318
|
+
}
|
|
1319
|
+
/** Orchestration: delete every finished (done/failed/canceled) run. */
|
|
1320
|
+
async clearFinishedRuns() {
|
|
1321
|
+
const payload = await this.sendNamespacedCorrelatedSessionRequest({
|
|
1322
|
+
message: { type: "runs.clear.request" },
|
|
1323
|
+
});
|
|
1324
|
+
return payload.runIds;
|
|
1325
|
+
}
|
|
1259
1326
|
async updateAgent(agentId, updates) {
|
|
1260
1327
|
const requestId = this.createRequestId();
|
|
1261
1328
|
const message = SessionInboundMessageSchema.parse({
|
|
@@ -1541,7 +1608,7 @@ export class DaemonClient {
|
|
|
1541
1608
|
agentId,
|
|
1542
1609
|
requestId,
|
|
1543
1610
|
});
|
|
1544
|
-
await this.sendRequest({
|
|
1611
|
+
const payload = await this.sendRequest({
|
|
1545
1612
|
requestId,
|
|
1546
1613
|
message,
|
|
1547
1614
|
options: { skipQueue: true },
|
|
@@ -1555,6 +1622,8 @@ export class DaemonClient {
|
|
|
1555
1622
|
return msg.payload;
|
|
1556
1623
|
},
|
|
1557
1624
|
});
|
|
1625
|
+
// Absent ⇒ old daemon that doesn't report whether a run was interrupted.
|
|
1626
|
+
return payload.cancelled !== undefined ? { cancelled: payload.cancelled } : {};
|
|
1558
1627
|
}
|
|
1559
1628
|
async setAgentMode(agentId, modeId) {
|
|
1560
1629
|
const requestId = this.createRequestId();
|
|
@@ -2988,6 +3057,15 @@ export class DaemonClient {
|
|
|
2988
3057
|
},
|
|
2989
3058
|
});
|
|
2990
3059
|
}
|
|
3060
|
+
/** Daemon-wide "fun stats" — see docs/data-model.md ActivityStatsStore. */
|
|
3061
|
+
async getActivityStats(options) {
|
|
3062
|
+
return this.sendNamespacedCorrelatedSessionRequest({
|
|
3063
|
+
requestId: options?.requestId,
|
|
3064
|
+
message: {
|
|
3065
|
+
type: "stats.activity.get.request",
|
|
3066
|
+
},
|
|
3067
|
+
});
|
|
3068
|
+
}
|
|
2991
3069
|
async getAgentContextUsage(agentId, options) {
|
|
2992
3070
|
return this.sendNamespacedCorrelatedSessionRequest({
|
|
2993
3071
|
requestId: options?.requestId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@otto-code/client",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "Otto client SDK package",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"test": "vitest run"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@otto-code/protocol": "0.5.
|
|
39
|
-
"@otto-code/relay": "0.5.
|
|
38
|
+
"@otto-code/protocol": "0.5.4",
|
|
39
|
+
"@otto-code/relay": "0.5.4",
|
|
40
40
|
"zod": "^4.4.3"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|