@bobannomi/client 0.7.0 → 0.8.1

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
@@ -606,10 +606,15 @@ interface SessionActivityPage {
606
606
  lastRunStatus?: "completed" | "failed" | "interrupted";
607
607
  attentionSeq: number;
608
608
  activeRunId?: string;
609
+ goalActivity?: SessionGoalActivity;
609
610
  pendingQuestionIds: string[];
610
611
  pendingApprovalIds: string[];
611
612
  }[];
612
613
  }
614
+ interface SessionGoalActivity {
615
+ executionState: "running" | "needs_input" | "completed" | "failed" | "interrupted";
616
+ attentionId?: string;
617
+ }
613
618
 
614
619
  type GoalStatus = "active" | "waiting_user" | "blocked" | "paused" | "completed" | "cancelled";
615
620
  type GoalAction = "pause" | "resume" | "cancel" | "budget" | "cancel_resume";
@@ -1452,7 +1457,7 @@ interface FeishuRegistrationStartInput {
1452
1457
  domain?: ChannelDomain;
1453
1458
  }
1454
1459
 
1455
- declare const CURRENT_PROTOCOL_VERSION = 7;
1460
+ declare const CURRENT_PROTOCOL_VERSION = 1;
1456
1461
  interface ProtocolVersion {
1457
1462
  version: number;
1458
1463
  }
@@ -2368,7 +2373,12 @@ interface SessionComposerContext {
2368
2373
  data: JsonValue;
2369
2374
  }
2370
2375
 
2371
- interface UploadAttachmentInput {
2376
+ interface AttachmentRequestOptions {
2377
+ /** Selects the known session for access checks and temporary draft storage. */
2378
+ sessionId?: string;
2379
+ signal?: AbortSignal;
2380
+ }
2381
+ interface UploadAttachmentInput extends AttachmentRequestOptions {
2372
2382
  requestId: string;
2373
2383
  draftId: string;
2374
2384
  expectedSha256: string;
@@ -2376,15 +2386,17 @@ interface UploadAttachmentInput {
2376
2386
  displayName: string;
2377
2387
  mediaType?: string;
2378
2388
  body: Blob | ArrayBuffer | Uint8Array | ReadableStream<Uint8Array>;
2379
- signal?: AbortSignal;
2380
2389
  }
2381
- interface DownloadAttachmentOptions {
2390
+ interface DownloadAttachmentOptions extends AttachmentRequestOptions {
2382
2391
  range?: {
2383
2392
  start?: number;
2384
2393
  end?: number;
2385
2394
  suffixBytes?: number;
2386
2395
  };
2387
- signal?: AbortSignal;
2396
+ }
2397
+ interface DeleteAttachmentOptions extends AttachmentRequestOptions {
2398
+ /** The original upload draft that owns this asset. */
2399
+ draftId: string;
2388
2400
  }
2389
2401
 
2390
2402
  /**
@@ -2600,7 +2612,7 @@ interface PluginLocalInstallInput extends PluginLocalPreviewInput {
2600
2612
  link?: boolean;
2601
2613
  }
2602
2614
  interface PluginArchivePreviewInput {
2603
- cwd: string;
2615
+ cwd?: string;
2604
2616
  archivePath: string;
2605
2617
  }
2606
2618
  interface PluginArchiveInstallInput extends PluginArchivePreviewInput {
@@ -2609,7 +2621,7 @@ interface PluginArchiveInstallInput extends PluginArchivePreviewInput {
2609
2621
  allowSourceChange?: boolean;
2610
2622
  }
2611
2623
  interface PluginGitPreviewInput {
2612
- cwd: string;
2624
+ cwd?: string;
2613
2625
  url: string;
2614
2626
  ref?: string;
2615
2627
  }
@@ -2708,6 +2720,13 @@ interface AdmitClientPromptInput {
2708
2720
  attachments?: AdmitPromptAttachmentInput[];
2709
2721
  metadata?: Record<string, unknown>;
2710
2722
  }
2723
+ /** Plain text is converted to one text item before the prompt is sent. */
2724
+ type SessionPromptInput = (AdmitClientPromptInput & {
2725
+ text?: never;
2726
+ }) | (Omit<AdmitClientPromptInput, "items"> & {
2727
+ text: string;
2728
+ items?: never;
2729
+ });
2711
2730
  /** Session identity is carried by the URL; only lifecycle prompt fields are public. */
2712
2731
  /** `POST /sessions/:id/runs/:runId/resume` 请求体。`id` 用于安全重试。 */
2713
2732
  interface ResumeInterruptedRunInput {
@@ -2934,66 +2953,68 @@ interface SessionObservation {
2934
2953
  interface RunResult {
2935
2954
  run: SessionRunRecord;
2936
2955
  messages: SessionMessageWithParts[];
2956
+ /** Visible assistant text for this run, joined in message and part order. */
2957
+ text: string;
2937
2958
  }
2938
2959
 
2939
- type RequestOptions$8 = {
2960
+ type RequestOptions$9 = {
2940
2961
  signal?: AbortSignal;
2941
2962
  };
2942
- /** Operations for one session, using the connection that created this handle. */
2943
- interface SessionHandle {
2963
+ /** Operations for one session on the bound daemon connection. */
2964
+ interface Session {
2944
2965
  readonly id: string;
2945
- get(options?: RequestOptions$8): Promise<SessionRecord>;
2946
- getState(options?: RequestOptions$8 & {
2966
+ get(options?: RequestOptions$9): Promise<SessionRecord>;
2967
+ getState(options?: RequestOptions$9 & {
2947
2968
  partView?: "summary";
2948
2969
  }): Promise<AgentSessionStateSnapshot>;
2949
2970
  /** Observe the current messages, inputs, runs and permission requests for this session. */
2950
- observe(options?: RequestOptions$8 & {
2971
+ observe(options?: RequestOptions$9 & {
2951
2972
  partView?: "summary";
2952
2973
  }): AsyncIterable<SessionObservation>;
2953
2974
  /** Merge JSON fields into this session's application metadata on the daemon. */
2954
- updateAppMetadata(metadata: Record<string, unknown>, options?: RequestOptions$8): Promise<SessionRecord>;
2955
- /** Submit an input and return its admission result. */
2956
- prompt(input: AdmitClientPromptInput, options?: RequestOptions$8): Promise<PromptResponse>;
2975
+ updateAppMetadata(metadata: Record<string, unknown>, options?: RequestOptions$9): Promise<SessionRecord>;
2976
+ /** Submit plain text or structured input and return its admission result. */
2977
+ prompt(input: SessionPromptInput, options?: RequestOptions$9): Promise<PromptResponse>;
2957
2978
  /** Observe an existing run until it reaches a durable terminal state. */
2958
- waitForRun(runId: string, options?: RequestOptions$8): Promise<RunResult>;
2959
- interrupt(options?: RequestOptions$8 & {
2979
+ waitForRun(runId: string, options?: RequestOptions$9): Promise<RunResult>;
2980
+ interrupt(options?: RequestOptions$9 & {
2960
2981
  expectedRunId?: string;
2961
2982
  }): Promise<InterruptSessionResponse>;
2962
- getControls(options?: RequestOptions$8): Promise<SessionControls>;
2983
+ getControls(options?: RequestOptions$9): Promise<SessionControls>;
2963
2984
  getControlResult(input: {
2964
2985
  requestId: string;
2965
2986
  original: SessionControlOriginal;
2966
- }, options?: RequestOptions$8): Promise<SessionControlReceipt | null>;
2967
- getContextUsage(options?: RequestOptions$8): Promise<ContextUsageSnapshot>;
2968
- getUsage(options?: RequestOptions$8): Promise<SessionUsageResponse>;
2969
- editLatestPrompt(input: EditLatestClientPromptInput, options?: RequestOptions$8): Promise<PromptResponse>;
2970
- resumeInterruptedRun(runId: string, input?: ResumeInterruptedRunInput, options?: RequestOptions$8): Promise<ResumeInterruptedRunResponse>;
2971
- fork(input?: ForkClientSessionInput, options?: RequestOptions$8): Promise<SessionRecord>;
2987
+ }, options?: RequestOptions$9): Promise<SessionControlReceipt | null>;
2988
+ getContextUsage(options?: RequestOptions$9): Promise<ContextUsageSnapshot>;
2989
+ getUsage(options?: RequestOptions$9): Promise<SessionUsageResponse>;
2990
+ editLatestPrompt(input: EditLatestClientPromptInput, options?: RequestOptions$9): Promise<PromptResponse>;
2991
+ resumeInterruptedRun(runId: string, input?: ResumeInterruptedRunInput, options?: RequestOptions$9): Promise<ResumeInterruptedRunResponse>;
2992
+ fork(input?: ForkClientSessionInput, options?: RequestOptions$9): Promise<SessionRecord>;
2972
2993
  /** Compact the transcript using the recorded configuration revision and request ID. */
2973
2994
  compact(input: {
2974
2995
  requestId: string;
2975
2996
  expectedRevision: number;
2976
- }, options?: RequestOptions$8): Promise<SessionControlReceipt>;
2997
+ }, options?: RequestOptions$9): Promise<SessionControlReceipt>;
2977
2998
  rewind(input?: {
2978
2999
  count?: number;
2979
- }, options?: RequestOptions$8): Promise<RewindSessionResponse>;
2980
- remember(options?: RequestOptions$8): Promise<RememberSessionResponse>;
3000
+ }, options?: RequestOptions$9): Promise<RewindSessionResponse>;
3001
+ remember(options?: RequestOptions$9): Promise<RememberSessionResponse>;
2981
3002
  export(input?: {
2982
3003
  filename?: string;
2983
3004
  json?: boolean;
2984
- }, options?: RequestOptions$8): Promise<SessionExportResponse>;
3005
+ }, options?: RequestOptions$9): Promise<SessionExportResponse>;
2985
3006
  /** Read or update settings, and recover the result of the original update. */
2986
3007
  readonly configuration: {
2987
- get(options?: RequestOptions$8): Promise<SessionConfigurationSnapshot>;
2988
- update(input: ConfigureClientSessionInput, options?: RequestOptions$8): Promise<SessionControlReceipt>;
2989
- getResult(input: SessionConfigurationResultInput, options?: RequestOptions$8): Promise<SessionControlReceipt | null>;
3008
+ get(options?: RequestOptions$9): Promise<SessionConfigurationSnapshot>;
3009
+ update(input: ConfigureClientSessionInput, options?: RequestOptions$9): Promise<SessionControlReceipt>;
3010
+ getResult(input: SessionConfigurationResultInput, options?: RequestOptions$9): Promise<SessionControlReceipt | null>;
2990
3011
  };
2991
3012
  readonly queue: {
2992
- promote(inputId: string, input: PromoteQueuedClientPromptInput, options?: RequestOptions$8): Promise<PromoteQueuedPromptResponse>;
2993
- cancel(inputId: string, input: CancelQueuedClientPromptInput, options: RequestOptions$8 & {
3013
+ promote(inputId: string, input: PromoteQueuedClientPromptInput, options?: RequestOptions$9): Promise<PromoteQueuedPromptResponse>;
3014
+ cancel(inputId: string, input: CancelQueuedClientPromptInput, options: RequestOptions$9 & {
2994
3015
  responseMode: "receipt";
2995
3016
  }): Promise<QueuedPromptCancelReceipt>;
2996
- cancel(inputId: string, input: CancelQueuedClientPromptInput, options?: RequestOptions$8 & {
3017
+ cancel(inputId: string, input: CancelQueuedClientPromptInput, options?: RequestOptions$9 & {
2997
3018
  responseMode?: "snapshot";
2998
3019
  }): Promise<CancelQueuedPromptResponse>;
2999
3020
  };
@@ -3007,34 +3028,34 @@ interface SessionHandle {
3007
3028
  /** Perform versioned management operations and query their durable receipts. */
3008
3029
  readonly management: {
3009
3030
  /** Interrupt active work before archiving the session tree. */
3010
- archiveAndInterrupt(options?: RequestOptions$8): Promise<SessionRecord>;
3031
+ archiveAndInterrupt(options?: RequestOptions$9): Promise<SessionRecord>;
3011
3032
  getRevision(input: {
3012
3033
  action: SessionManagementAction;
3013
- }, options?: RequestOptions$8): Promise<SessionResourceRevision>;
3034
+ }, options?: RequestOptions$9): Promise<SessionResourceRevision>;
3014
3035
  rename(input: {
3015
3036
  requestId: string;
3016
3037
  title: string;
3017
3038
  expectedRevision: number;
3018
- }, options?: RequestOptions$8): Promise<SessionMutationPublicReceipt>;
3039
+ }, options?: RequestOptions$9): Promise<SessionMutationPublicReceipt>;
3019
3040
  setPinned(input: {
3020
3041
  requestId: string;
3021
3042
  pinned: boolean;
3022
3043
  expectedRevision: number;
3023
- }, options?: RequestOptions$8): Promise<SessionMutationPublicReceipt>;
3044
+ }, options?: RequestOptions$9): Promise<SessionMutationPublicReceipt>;
3024
3045
  archive(input: {
3025
3046
  requestId: string;
3026
3047
  expectedTreeRevision: string;
3027
- }, options?: RequestOptions$8): Promise<SessionMutationPublicReceipt>;
3048
+ }, options?: RequestOptions$9): Promise<SessionMutationPublicReceipt>;
3028
3049
  delete(input: {
3029
3050
  requestId: string;
3030
3051
  expectedTreeRevision: string;
3031
- }, options?: RequestOptions$8): Promise<SessionMutationPublicReceipt>;
3032
- getMutation(requestId: string, options?: RequestOptions$8): Promise<SessionMutationPublicReceipt | null>;
3052
+ }, options?: RequestOptions$9): Promise<SessionMutationPublicReceipt>;
3053
+ getMutation(requestId: string, options?: RequestOptions$9): Promise<SessionMutationPublicReceipt | null>;
3033
3054
  };
3034
3055
  readonly messages: {
3035
- list(options?: ListMessagesOptions & RequestOptions$8): Promise<SessionMessageRecord[]>;
3036
- listParts(options?: ListClientMessagePartsOptions & RequestOptions$8): Promise<SessionMessagePartRecord[]>;
3037
- getPart(messageId: string, partId: string, options?: RequestOptions$8): Promise<SessionMessagePartRecord>;
3056
+ list(options?: ListMessagesOptions & RequestOptions$9): Promise<SessionMessageRecord[]>;
3057
+ listParts(options?: ListClientMessagePartsOptions & RequestOptions$9): Promise<SessionMessagePartRecord[]>;
3058
+ getPart(messageId: string, partId: string, options?: RequestOptions$9): Promise<SessionMessagePartRecord>;
3038
3059
  };
3039
3060
  /** Read-only access. Paths are relative to the session's execution directory on the daemon. */
3040
3061
  readonly files: {
@@ -3046,18 +3067,18 @@ interface SessionHandle {
3046
3067
  };
3047
3068
  /** Observe terminals already associated with this session. */
3048
3069
  readonly terminals: {
3049
- list(options?: RequestOptions$8): Promise<TerminalSessionInfo[]>;
3050
- read(terminalId: string, options?: RequestOptions$8 & {
3070
+ list(options?: RequestOptions$9): Promise<TerminalSessionInfo[]>;
3071
+ read(terminalId: string, options?: RequestOptions$9 & {
3051
3072
  after?: number;
3052
3073
  maxChars?: number;
3053
3074
  }): Promise<TerminalReadResult>;
3054
- stream(terminalId: string, options?: RequestOptions$8): Promise<AsyncIterable<TerminalEvent>>;
3075
+ stream(terminalId: string, options?: RequestOptions$9): Promise<AsyncIterable<TerminalEvent>>;
3055
3076
  };
3056
3077
  /** Manage background jobs and subagent runs belonging to this session. */
3057
3078
  readonly jobs: {
3058
3079
  list(options?: ListSessionJobsOptions): Promise<JobListResult>;
3059
- createBackgroundShell(input: CreateBackgroundShellInput, options?: RequestOptions$8): Promise<CreateBackgroundShellResult>;
3060
- read(target: JobTarget, options?: RequestOptions$8 & {
3080
+ createBackgroundShell(input: CreateBackgroundShellInput, options?: RequestOptions$9): Promise<CreateBackgroundShellResult>;
3081
+ read(target: JobTarget, options?: RequestOptions$9 & {
3061
3082
  after?: number;
3062
3083
  maxChars?: number;
3063
3084
  }): Promise<JobReadResult>;
@@ -3065,34 +3086,38 @@ interface SessionHandle {
3065
3086
  timeoutMs?: number;
3066
3087
  after?: number;
3067
3088
  maxChars?: number;
3068
- }, options?: RequestOptions$8): Promise<JobWaitResult>;
3089
+ }, options?: RequestOptions$9): Promise<JobWaitResult>;
3069
3090
  send(target: JobTarget, input: {
3070
3091
  data: string;
3071
- }, options?: RequestOptions$8): Promise<JobInputReceipt | void>;
3092
+ }, options?: RequestOptions$9): Promise<JobInputReceipt | void>;
3072
3093
  cancel(target: JobTarget, input: {
3073
3094
  reason?: string;
3074
- } | undefined, options: RequestOptions$8 & {
3095
+ } | undefined, options: RequestOptions$9 & {
3075
3096
  responseMode: "receipt";
3076
3097
  }): Promise<JobCancelReceipt>;
3077
3098
  cancel(target: JobTarget, input?: {
3078
3099
  reason?: string;
3079
- }, options?: RequestOptions$8 & {
3100
+ }, options?: RequestOptions$9 & {
3080
3101
  responseMode?: "snapshot";
3081
3102
  }): Promise<JobSnapshot>;
3082
3103
  };
3083
3104
  /** Read MCP connection status for this session. The daemon may initialize its runtime. */
3084
3105
  readonly mcp: {
3085
- list(options?: RequestOptions$8): Promise<McpServerStatus[]>;
3106
+ list(options?: RequestOptions$9): Promise<McpServerStatus[]>;
3086
3107
  };
3087
3108
  }
3088
3109
 
3110
+ interface CreatedSession extends Session {
3111
+ /** The record returned by the creation request. Use get() to read current data. */
3112
+ readonly record: SessionRecord;
3113
+ }
3089
3114
  /** Find, prepare, and create sessions on one daemon connection. */
3090
3115
  declare class SessionResource {
3091
3116
  #private;
3092
3117
  private readonly prepareModel?;
3093
3118
  constructor(transport: HttpTransport, events?: EventResource, prepareModel?: PrepareModelConnection | undefined);
3094
3119
  /** Bind a session ID locally. Operations use this resource's daemon connection when called. */
3095
- byId(sessionId: string): SessionHandle;
3120
+ byId(sessionId: string): Session;
3096
3121
  /** `GET /sessions/search` - search saved conversation text without opening it. */
3097
3122
  search(options: SearchSessionsOptions & {
3098
3123
  signal?: AbortSignal;
@@ -3112,10 +3137,10 @@ declare class SessionResource {
3112
3137
  getDraftComposerOptions(input: DraftComposerTarget, options?: {
3113
3138
  signal?: AbortSignal;
3114
3139
  }): Promise<DraftComposerOptions>;
3115
- /** `POST /sessions` */
3140
+ /** Create a session and bind its operations to this connection. */
3116
3141
  create(input: SessionCreationInput, options?: {
3117
3142
  signal?: AbortSignal;
3118
- }): Promise<SessionRecord>;
3143
+ }): Promise<CreatedSession>;
3119
3144
  getConfigurationOptions(input: {
3120
3145
  cwd: string;
3121
3146
  projectId?: string;
@@ -3140,7 +3165,7 @@ declare function createSessionRequestId(): string;
3140
3165
  declare class AttachmentResource {
3141
3166
  private readonly transport;
3142
3167
  constructor(transport: HttpTransport);
3143
- /** Manage daemon attachment storage. Ordinary session connections cannot use these methods. */
3168
+ /** Inspect and maintain attachment storage for the current daemon. */
3144
3169
  readonly storage: {
3145
3170
  scan: (options?: {
3146
3171
  signal?: AbortSignal;
@@ -3155,16 +3180,15 @@ declare class AttachmentResource {
3155
3180
  /** `POST /attachments` — upload bytes without JSON or multipart buffering. */
3156
3181
  upload(input: UploadAttachmentInput): Promise<AttachmentAssetRecord>;
3157
3182
  getUpload(input: Omit<UploadAttachmentInput, "body">): Promise<AttachmentAssetRecord | null>;
3158
- get(id: string, options?: {
3159
- signal?: AbortSignal;
3160
- }): Promise<AttachmentAssetRecord>;
3183
+ get(id: string, options?: AttachmentRequestOptions): Promise<AttachmentAssetRecord>;
3161
3184
  /** Returns the raw response so callers can consume the body as a stream. */
3162
3185
  download(id: string, options?: DownloadAttachmentOptions): Promise<Response>;
3163
- delete(id: string, options?: {
3164
- signal?: AbortSignal;
3165
- }): Promise<AttachmentAssetRecord>;
3186
+ delete(id: string, options: DeleteAttachmentOptions): Promise<AttachmentAssetRecord>;
3166
3187
  }
3167
3188
 
3189
+ type SavedToolApproval = PermissionRequestRecord & {
3190
+ sessionTitle?: string;
3191
+ };
3168
3192
  declare class PermissionResource {
3169
3193
  #private;
3170
3194
  constructor(transport: HttpTransport);
@@ -3185,66 +3209,103 @@ declare class PermissionResource {
3185
3209
  }) => Promise<PermissionRequestRecord>;
3186
3210
  };
3187
3211
  readonly approvals: {
3188
- list: () => Promise<PermissionRequestRecord[]>;
3212
+ list: () => Promise<SavedToolApproval[]>;
3189
3213
  revoke: (requestId: string) => Promise<PermissionRequestRecord>;
3190
3214
  };
3191
3215
  }
3192
3216
 
3193
- type RequestOptions$7 = {
3217
+ type RequestOptions$8 = {
3194
3218
  signal?: AbortSignal;
3195
3219
  };
3220
+ type DirectoryOptional<T> = Omit<T, "cwd"> & {
3221
+ cwd?: string;
3222
+ };
3196
3223
  /** Manage marketplace sources and look up the result of an original install. */
3197
3224
  declare class PluginMarketplaceResource {
3198
3225
  private readonly transport;
3199
3226
  constructor(transport: HttpTransport);
3200
- catalog({ signal, ...query }: MarketplaceCatalogRequest & RequestOptions$7): Promise<MarketplaceCatalog>;
3201
- listSources(options?: RequestOptions$7): Promise<MarketplaceSourcesResponse>;
3202
- addSource(input: MarketplaceAddSourceRequest, options?: RequestOptions$7): Promise<MarketplaceSourcesResponse>;
3203
- setSourceEnabled(sourceId: string, input: MarketplaceSourceEnabledRequest, options?: RequestOptions$7): Promise<MarketplaceSourcesResponse>;
3204
- removeSource(sourceId: string, options?: RequestOptions$7): Promise<MarketplaceSourcesResponse>;
3205
- preview(input: MarketplacePreviewRequest, options?: RequestOptions$7): Promise<MarketplacePreview>;
3206
- cancel(input: MarketplaceCancelRequest, options?: RequestOptions$7): Promise<MarketplaceCancelResponse>;
3227
+ catalog({ signal, ...query }?: DirectoryOptional<MarketplaceCatalogRequest> & RequestOptions$8): Promise<MarketplaceCatalog>;
3228
+ listSources(options?: RequestOptions$8): Promise<MarketplaceSourcesResponse>;
3229
+ addSource(input: MarketplaceAddSourceRequest, options?: RequestOptions$8): Promise<MarketplaceSourcesResponse>;
3230
+ setSourceEnabled(sourceId: string, input: MarketplaceSourceEnabledRequest, options?: RequestOptions$8): Promise<MarketplaceSourcesResponse>;
3231
+ removeSource(sourceId: string, options?: RequestOptions$8): Promise<MarketplaceSourcesResponse>;
3232
+ preview(input: DirectoryOptional<MarketplacePreviewRequest>, options?: RequestOptions$8): Promise<MarketplacePreview>;
3233
+ cancel(input: MarketplaceCancelRequest, options?: RequestOptions$8): Promise<MarketplaceCancelResponse>;
3207
3234
  /** Save the operation ID before submitting. Recover an uncertain result with getOperation. */
3208
- install(input: MarketplaceInstallRequest, options?: RequestOptions$7): Promise<MarketplaceOperation>;
3235
+ install(input: DirectoryOptional<MarketplaceInstallRequest>, options?: RequestOptions$8): Promise<MarketplaceOperation>;
3209
3236
  /** Look up the original operation without repeating its install. */
3210
- getOperation(operationId: string, options?: RequestOptions$7): Promise<MarketplaceOperation>;
3237
+ getOperation(operationId: string, options?: RequestOptions$8): Promise<MarketplaceOperation>;
3211
3238
  }
3212
3239
 
3213
- type RequestOptions$6 = {
3240
+ type RequestOptions$7 = {
3214
3241
  signal?: AbortSignal;
3215
3242
  };
3216
3243
  type DirectoryInput = {
3217
- cwd: string;
3244
+ cwd?: string;
3218
3245
  };
3219
3246
  type PluginMessage = {
3220
3247
  message: string;
3221
3248
  };
3249
+ type PluginChangeMessage = PluginMessage & {
3250
+ warning?: string;
3251
+ };
3252
+ type IconInput = DirectoryInput & {
3253
+ pluginId: string;
3254
+ } & ({
3255
+ sourceId?: never;
3256
+ version?: never;
3257
+ } | {
3258
+ sourceId: string;
3259
+ version: string;
3260
+ });
3222
3261
  /** Manage native plugins in the daemon. Uses a management connection. */
3223
3262
  declare class PluginResource {
3224
3263
  private readonly transport;
3225
3264
  readonly marketplace: PluginMarketplaceResource;
3226
3265
  constructor(transport: HttpTransport);
3227
3266
  /** List native plugins for a directory in the daemon environment. */
3228
- list({ signal, cwd }: DirectoryInput & RequestOptions$6): Promise<PluginListResult>;
3229
- enable(id: string, input: DirectoryInput, options?: RequestOptions$6): Promise<PluginMessage>;
3230
- disable(id: string, input: DirectoryInput, options?: RequestOptions$6): Promise<PluginMessage>;
3267
+ list({ signal, cwd }?: DirectoryInput & RequestOptions$7): Promise<PluginListResult>;
3268
+ /** Load an image from an installed plugin or a marketplace entry in the daemon. */
3269
+ getIcon(input: IconInput, options?: RequestOptions$7): Promise<{
3270
+ icon: string | null;
3271
+ }>;
3272
+ enable(id: string, input: DirectoryInput, options?: RequestOptions$7): Promise<PluginChangeMessage>;
3273
+ disable(id: string, input: DirectoryInput, options?: RequestOptions$7): Promise<PluginChangeMessage>;
3231
3274
  /** Read the identity, digest and requested permissions for a directory on the daemon machine. */
3232
- previewLocal(input: PluginLocalPreviewInput, options?: RequestOptions$6): Promise<PluginLocalPreview>;
3275
+ previewLocal(input: PluginLocalPreviewInput, options?: RequestOptions$7): Promise<PluginLocalPreview>;
3233
3276
  /** Install or link a plugin directory the daemon can read after approval. */
3234
- installLocal(input: PluginLocalInstallInput, options?: RequestOptions$6): Promise<PluginMessage>;
3277
+ installLocal(input: PluginLocalInstallInput, options?: RequestOptions$7): Promise<PluginMessage>;
3235
3278
  /** Read the digest and required permissions for an archive on the daemon machine. */
3236
- previewArchive(input: PluginArchivePreviewInput, options?: RequestOptions$6): Promise<PluginArchivePreview>;
3279
+ previewArchive(input: PluginArchivePreviewInput, options?: RequestOptions$7): Promise<PluginArchivePreview>;
3237
3280
  /** Install the previewed archive with its original digest and approved permissions. */
3238
- installArchive(input: PluginArchiveInstallInput, options?: RequestOptions$6): Promise<PluginMessage>;
3281
+ installArchive(input: PluginArchiveInstallInput, options?: RequestOptions$7): Promise<PluginMessage>;
3282
+ /** Preview a client-selected archive by uploading its bytes to the daemon. */
3283
+ uploadArchive(input: DirectoryInput & {
3284
+ archive: Blob | ArrayBuffer;
3285
+ fileName: string;
3286
+ }, options?: RequestOptions$7): Promise<PluginArchivePreview & {
3287
+ candidateId: string;
3288
+ }>;
3289
+ /** Release an uploaded archive preview. Unclaimed previews also expire. */
3290
+ cancelUploadedArchive(candidateId: string, options?: RequestOptions$7): Promise<{
3291
+ cancelled: true;
3292
+ }>;
3293
+ /** Save the operation ID before submitting. Recover an uncertain result with getArchiveInstallOperation. */
3294
+ installUploadedArchive(input: Omit<PluginArchiveInstallInput, "archivePath"> & {
3295
+ candidateId: string;
3296
+ operationId: string;
3297
+ }, options?: RequestOptions$7): Promise<MarketplaceOperation>;
3298
+ /** Read the result of the original upload install without submitting it again. */
3299
+ getArchiveInstallOperation(operationId: string, options?: RequestOptions$7): Promise<MarketplaceOperation>;
3239
3300
  /** Read the digest and required permissions for a Git source. */
3240
- previewGit(input: PluginGitPreviewInput, options?: RequestOptions$6): Promise<PluginGitPreview>;
3301
+ previewGit(input: PluginGitPreviewInput, options?: RequestOptions$7): Promise<PluginGitPreview>;
3241
3302
  /** Install the previewed Git source with its original digest and approved permissions. */
3242
- installGit(input: PluginGitInstallInput, options?: RequestOptions$6): Promise<PluginMessage>;
3243
- uninstall(id: string, input: DirectoryInput, options?: RequestOptions$6): Promise<PluginMessage>;
3244
- reload(input: DirectoryInput, options?: RequestOptions$6): Promise<ReloadPluginsResponse>;
3303
+ installGit(input: PluginGitInstallInput, options?: RequestOptions$7): Promise<PluginMessage>;
3304
+ uninstall(id: string, input: DirectoryInput, options?: RequestOptions$7): Promise<PluginChangeMessage>;
3305
+ reload(input?: DirectoryInput, options?: RequestOptions$7): Promise<ReloadPluginsResponse>;
3245
3306
  }
3246
3307
 
3247
- type RequestOptions$5 = {
3308
+ type RequestOptions$6 = {
3248
3309
  signal?: AbortSignal;
3249
3310
  };
3250
3311
  interface ChannelQuery {
@@ -3261,35 +3322,35 @@ declare class ChannelResource {
3261
3322
  constructor(transport: HttpTransport);
3262
3323
  /** Read the running connectors or temporarily start and stop them. */
3263
3324
  readonly runtime: {
3264
- status: (options?: RequestOptions$5) => Promise<ChannelRuntimeStatus>;
3265
- start: (input?: ChannelRuntimeControlInput, options?: RequestOptions$5) => Promise<ChannelRuntimeStatus>;
3266
- stop: (input?: ChannelRuntimeControlInput, options?: RequestOptions$5) => Promise<ChannelRuntimeStatus>;
3325
+ status: (options?: RequestOptions$6) => Promise<ChannelRuntimeStatus>;
3326
+ start: (input?: ChannelRuntimeControlInput, options?: RequestOptions$6) => Promise<ChannelRuntimeStatus>;
3327
+ stop: (input?: ChannelRuntimeControlInput, options?: RequestOptions$6) => Promise<ChannelRuntimeStatus>;
3267
3328
  };
3268
3329
  /** Configure Feishu or Lark. Status snapshots omit credentials. */
3269
3330
  readonly feishu: {
3270
- status: (options?: RequestOptions$5) => Promise<FeishuChannelSnapshot>;
3271
- connect: (input: FeishuConnectInput, options?: RequestOptions$5) => Promise<FeishuComposedSnapshot>;
3272
- update: (input: FeishuPatchInput, options?: RequestOptions$5) => Promise<FeishuComposedSnapshot>;
3273
- disconnect: (options?: RequestOptions$5) => Promise<FeishuComposedSnapshot>;
3331
+ status: (options?: RequestOptions$6) => Promise<FeishuChannelSnapshot>;
3332
+ connect: (input: FeishuConnectInput, options?: RequestOptions$6) => Promise<FeishuComposedSnapshot>;
3333
+ update: (input: FeishuPatchInput, options?: RequestOptions$6) => Promise<FeishuComposedSnapshot>;
3334
+ disconnect: (options?: RequestOptions$6) => Promise<FeishuComposedSnapshot>;
3274
3335
  allowlist: {
3275
- add: (input: FeishuAllowInput, options?: RequestOptions$5) => Promise<FeishuChannelSnapshot>;
3276
- remove: (key: string, options?: RequestOptions$5) => Promise<FeishuChannelSnapshot>;
3336
+ add: (input: FeishuAllowInput, options?: RequestOptions$6) => Promise<FeishuChannelSnapshot>;
3337
+ remove: (key: string, options?: RequestOptions$6) => Promise<FeishuChannelSnapshot>;
3277
3338
  };
3278
3339
  registration: {
3279
- start: (input?: FeishuRegistrationStartInput, options?: RequestOptions$5) => Promise<FeishuRegistrationSnapshot>;
3280
- status: (options?: RequestOptions$5) => Promise<FeishuRegistrationSnapshot>;
3281
- cancel: (options?: RequestOptions$5) => Promise<FeishuRegistrationSnapshot>;
3340
+ start: (input?: FeishuRegistrationStartInput, options?: RequestOptions$6) => Promise<FeishuRegistrationSnapshot>;
3341
+ status: (options?: RequestOptions$6) => Promise<FeishuRegistrationSnapshot>;
3342
+ cancel: (options?: RequestOptions$6) => Promise<FeishuRegistrationSnapshot>;
3282
3343
  };
3283
3344
  };
3284
3345
  /** Submit external messages and work with durable delivery records. */
3285
3346
  readonly connector: {
3286
3347
  /** Retain the external message ID when retrying the same input. */
3287
- submitMessage: (input: DurableChannelMessageInput, options?: RequestOptions$5) => Promise<DurableChannelMessageResult>;
3288
- status: (query?: ChannelQuery, options?: RequestOptions$5) => Promise<ChannelStatusSnapshot>;
3289
- listPendingDeliveries: (query?: ChannelQuery, options?: RequestOptions$5) => Promise<ChannelDeliveryRecord[]>;
3348
+ submitMessage: (input: DurableChannelMessageInput, options?: RequestOptions$6) => Promise<DurableChannelMessageResult>;
3349
+ status: (query?: ChannelQuery, options?: RequestOptions$6) => Promise<ChannelStatusSnapshot>;
3350
+ listPendingDeliveries: (query?: ChannelQuery, options?: RequestOptions$6) => Promise<ChannelDeliveryRecord[]>;
3290
3351
  /** Look up the stored result after an interrupted request. Returns null for an unknown ID. */
3291
- getDelivery: (deliveryId: string, options?: RequestOptions$5) => Promise<ChannelDeliveryRecord | null>;
3292
- recordDelivery: (deliveryId: string, input: RecordChannelDeliveryInput, options?: RequestOptions$5) => Promise<ChannelDeliveryRecord>;
3352
+ getDelivery: (deliveryId: string, options?: RequestOptions$6) => Promise<ChannelDeliveryRecord | null>;
3353
+ recordDelivery: (deliveryId: string, input: RecordChannelDeliveryInput, options?: RequestOptions$6) => Promise<ChannelDeliveryRecord>;
3293
3354
  };
3294
3355
  }
3295
3356
 
@@ -3297,32 +3358,58 @@ declare class ChannelResource {
3297
3358
  * ProjectResource: 项目目录探测、绑定、别名与元数据管理资源。
3298
3359
  */
3299
3360
 
3300
- type RequestOptions$4 = {
3361
+ type RequestOptions$5 = {
3301
3362
  signal?: AbortSignal;
3302
3363
  };
3364
+ interface ProjectDirectory {
3365
+ workspaceId: string;
3366
+ projectId: string;
3367
+ name: string;
3368
+ path: string;
3369
+ rootIdentity?: {
3370
+ dev: string;
3371
+ ino: string;
3372
+ };
3373
+ available: boolean;
3374
+ lastOpenedAt: number;
3375
+ defaultShell?: string;
3376
+ }
3377
+ interface ProjectDirectorySnapshot {
3378
+ dataScopeId: string;
3379
+ projects: ProjectDirectory[];
3380
+ }
3303
3381
  declare class ProjectResource {
3304
3382
  private readonly transport;
3305
3383
  constructor(transport: HttpTransport);
3384
+ /** Read the daemon's registered project directories and their current directory identities. */
3385
+ listDirectories(options?: RequestOptions$5): Promise<ProjectDirectorySnapshot>;
3386
+ /** Apply the default shell only while the observed project and registered directory still match. */
3387
+ setDirectoryDefaultShell(input: {
3388
+ dataScopeId: string;
3389
+ projectId: string;
3390
+ workspaceId: string;
3391
+ shell: string | null;
3392
+ }, options?: RequestOptions$5): Promise<ProjectDirectorySnapshot>;
3306
3393
  /** `GET /projects` */
3307
3394
  list(options?: ListProjectsOptions & {
3308
3395
  signal?: AbortSignal;
3309
3396
  }): Promise<ProjectRecord[]>;
3310
- /** Register or reopen a directory on the daemon host and update its last-opened time. */
3311
- register(path: string, options?: RequestOptions$4): Promise<ProjectRecord>;
3397
+ /** Register or reopen a project on the daemon host, recording the directory identity and last-opened time. */
3398
+ register(path: string, options?: RequestOptions$5): Promise<ProjectRecord>;
3312
3399
  /** Alias for register. This can create or restore a project record. */
3313
- inspect(path: string, options?: RequestOptions$4): Promise<ProjectRecord>;
3400
+ inspect(path: string, options?: RequestOptions$5): Promise<ProjectRecord>;
3314
3401
  /** `PATCH /projects/:id` (name) */
3315
- rename(projectId: string, name: string, options?: RequestOptions$4): Promise<ProjectRecord>;
3402
+ rename(projectId: string, name: string, options?: RequestOptions$5): Promise<ProjectRecord>;
3316
3403
  /** `PATCH /projects/:id` (pinned) */
3317
- setPinned(projectId: string, pinned: boolean, options?: RequestOptions$4): Promise<ProjectRecord>;
3404
+ setPinned(projectId: string, pinned: boolean, options?: RequestOptions$5): Promise<ProjectRecord>;
3318
3405
  /** `PATCH /projects/:id` (defaultShell) */
3319
- setDefaultShell(projectId: string, defaultShell: string | null, options?: RequestOptions$4): Promise<ProjectRecord>;
3320
- /** `POST /projects/:id/rebind` */
3321
- rebind(projectId: string, path: string, options?: string | (RequestOptions$4 & {
3406
+ setDefaultShell(projectId: string, defaultShell: string | null, options?: RequestOptions$5): Promise<ProjectRecord>;
3407
+ /** Rebind a project to the current directory at path. Pass the prior project path as expectedPath to reject a stale update. */
3408
+ rebind(projectId: string, path: string, options?: string | (RequestOptions$5 & {
3322
3409
  expectedPath?: string;
3323
3410
  })): Promise<ProjectRecord>;
3324
3411
  /** `DELETE /projects/:id` */
3325
- archive(projectId: string, options?: RequestOptions$4): Promise<ProjectRecord>;
3412
+ archive(projectId: string, options?: RequestOptions$5): Promise<ProjectRecord>;
3326
3413
  /** `POST /project/init` */
3327
3414
  init(input: {
3328
3415
  cwd: string;
@@ -3348,21 +3435,120 @@ interface TaskWorktreeRecord {
3348
3435
  directoryRemoved?: boolean;
3349
3436
  reason?: string;
3350
3437
  }
3351
- type RequestOptions$3 = {
3438
+ type RequestOptions$4 = {
3352
3439
  signal?: AbortSignal;
3353
3440
  };
3354
3441
  /** Inspect and maintain task worktrees managed by the daemon. */
3355
3442
  declare class WorktreeResource {
3356
3443
  private readonly transport;
3357
3444
  constructor(transport: HttpTransport);
3358
- list(options?: RequestOptions$3): Promise<TaskWorktreeRecord[]>;
3359
- cleanup(id: string, options?: RequestOptions$3): Promise<void>;
3360
- setDisposable(id: string, disposable: boolean, options?: RequestOptions$3): Promise<void>;
3445
+ list(options?: RequestOptions$4): Promise<TaskWorktreeRecord[]>;
3446
+ cleanup(id: string, options?: RequestOptions$4): Promise<void>;
3447
+ setDisposable(id: string, disposable: boolean, options?: RequestOptions$4): Promise<void>;
3361
3448
  }
3362
3449
 
3450
+ interface GitWorkspaceRoot {
3451
+ path: string;
3452
+ identity: {
3453
+ dev: string;
3454
+ ino: string;
3455
+ };
3456
+ }
3457
+ type GitWorkspaceTarget = {
3458
+ dataScopeId: string;
3459
+ } & ({
3460
+ source: {
3461
+ projectId: string;
3462
+ workspaceId: string;
3463
+ };
3464
+ root: GitWorkspaceRoot;
3465
+ } | {
3466
+ source: {
3467
+ sessionId: string;
3468
+ };
3469
+ root: {
3470
+ path: string;
3471
+ identity?: GitWorkspaceRoot["identity"];
3472
+ };
3473
+ });
3474
+ type GitBranchOperation = {
3475
+ kind: "git.switchBranch" | "git.createBranch";
3476
+ body: {
3477
+ branch: string;
3478
+ expectedHead: string;
3479
+ };
3480
+ };
3481
+ interface GitBranchReceipt {
3482
+ requestId: string;
3483
+ kind: GitBranchOperation["kind"];
3484
+ state: "prepared" | "running" | "completed" | "failed" | "unknown";
3485
+ result?: {
3486
+ root: string;
3487
+ commonDir: string;
3488
+ head: string;
3489
+ branch: string;
3490
+ changes: string[];
3491
+ };
3492
+ error?: {
3493
+ code: string;
3494
+ };
3495
+ createdAt: number;
3496
+ updatedAt: number;
3497
+ }
3498
+ type GitChangesOptions = {
3499
+ range?: "uncommitted" | "working" | "staged";
3500
+ ignoreWhitespace?: boolean;
3501
+ };
3502
+ type GitDiffOptions = GitChangesOptions & {
3503
+ path?: string;
3504
+ base?: string;
3505
+ head?: string;
3506
+ };
3507
+ type RequestOptions$3 = {
3508
+ signal?: AbortSignal;
3509
+ };
3510
+ /** Git operations for a project directory or a session's actual execution directory. */
3511
+ declare class GitWorkspaceResource {
3512
+ private readonly transport;
3513
+ private readonly target;
3514
+ constructor(transport: HttpTransport, target: GitWorkspaceTarget);
3515
+ status(options?: RequestOptions$3): Promise<{
3516
+ root: string;
3517
+ commonDir: string;
3518
+ head: string;
3519
+ branch: string;
3520
+ changes: string[];
3521
+ }>;
3522
+ listBranches(options?: RequestOptions$3): Promise<{
3523
+ branches: string[];
3524
+ }>;
3525
+ changes(params?: GitChangesOptions, options?: RequestOptions$3): Promise<{
3526
+ files: {
3527
+ path: string;
3528
+ oldPath?: string;
3529
+ status: "added" | "modified" | "deleted" | "renamed" | "copied" | "untracked";
3530
+ additions: number | null;
3531
+ deletions: number | null;
3532
+ binary: boolean;
3533
+ }[];
3534
+ totalAdditions: number;
3535
+ totalDeletions: number;
3536
+ }>;
3537
+ diff(params?: GitDiffOptions, options?: RequestOptions$3): Promise<{
3538
+ text: string;
3539
+ truncated: boolean;
3540
+ }>;
3541
+ /** Submit an original branch operation for a registered project. */
3542
+ changeBranch(requestId: string, original: GitBranchOperation, options?: RequestOptions$3): Promise<GitBranchReceipt>;
3543
+ /** Query the same original body and request ID after an interrupted branch operation. */
3544
+ getBranchOperation(requestId: string, original: GitBranchOperation, options?: RequestOptions$3): Promise<GitBranchReceipt | null>;
3545
+ private read;
3546
+ }
3363
3547
  declare class GitResource {
3364
3548
  private readonly transport;
3365
3549
  constructor(transport: HttpTransport);
3550
+ /** Open Git operations for a registered project or an existing session in the current daemon. */
3551
+ workspace(target: GitWorkspaceTarget): GitWorkspaceResource;
3366
3552
  /** `GET /git/diff?cwd=&full=` */
3367
3553
  getDiff(options: {
3368
3554
  cwd: string;
@@ -3432,6 +3618,10 @@ type McpManagedServerSummary = Omit<McpOAuthStatusSnapshot["servers"][number], "
3432
3618
  summary: string;
3433
3619
  runtimeRef?: McpServerRuntimeRef;
3434
3620
  };
3621
+ /** Application registrations appear as read-only rows in the global inventory. */
3622
+ type McpServerInventoryEntry = McpManagedServerSummary & {
3623
+ readOnly?: true;
3624
+ };
3435
3625
  interface McpConfigOperationResult {
3436
3626
  persisted: boolean;
3437
3627
  credentialRemoved: boolean;
@@ -3445,6 +3635,10 @@ declare class McpServersResource {
3445
3635
  list(options?: RequestOptions$2): Promise<{
3446
3636
  servers: McpManagedServerSummary[];
3447
3637
  }>;
3638
+ /** List manually configured and application-registered connections without credentials. */
3639
+ inventory(options?: RequestOptions$2): Promise<{
3640
+ servers: McpServerInventoryEntry[];
3641
+ }>;
3448
3642
  getConfig(name: string, options?: RequestOptions$2): Promise<McpManagedServerConfig>;
3449
3643
  exportConfig(options?: RequestOptions$2): Promise<{
3450
3644
  mcpServers: Record<string, McpManagedServerConfig>;
@@ -3712,6 +3906,12 @@ declare class MaintenanceResource {
3712
3906
  readonly usage: {
3713
3907
  get: (input?: UsageFilter, options?: RequestOptions$1) => Promise<UsageReport>;
3714
3908
  getSettings: (options?: RequestOptions$1) => Promise<UsageSettings>;
3909
+ /** Read whether known usage has reached the current monthly budget. */
3910
+ getBudgetStatus: (options?: RequestOptions$1) => Promise<{
3911
+ monthStart: number;
3912
+ budget: UsageBudget;
3913
+ reached: boolean;
3914
+ }>;
3715
3915
  updateBudget: (input: UsageBudget & {
3716
3916
  expected?: UsageBudget;
3717
3917
  }, options?: RequestOptions$1) => Promise<UsageSettings>;
@@ -3847,10 +4047,171 @@ interface GlobalSettingsPatch {
3847
4047
  showReasoning?: boolean;
3848
4048
  systemPrompt?: string | null;
3849
4049
  }
4050
+ interface RuntimeEnvironmentConfig {
4051
+ kind: "native" | "wsl";
4052
+ distribution?: string;
4053
+ shell?: {
4054
+ executable: string;
4055
+ args: string[];
4056
+ };
4057
+ env?: Record<string, string>;
4058
+ secretEnv?: string[];
4059
+ }
4060
+ interface RuntimeSettingsSnapshot {
4061
+ userConfig: RuntimeEnvironmentConfig;
4062
+ projectConfig: RuntimeEnvironmentConfig | null;
4063
+ activeDefault: RuntimeEnvironmentConfig;
4064
+ effective: RuntimeEnvironmentConfig;
4065
+ source: string;
4066
+ restartRequired: boolean;
4067
+ wslSupported: boolean;
4068
+ inheritedVariableNames: string[];
4069
+ distributions: string[];
4070
+ secretRevision: string;
4071
+ }
4072
+ interface SaveRuntimeEnvironmentInput {
4073
+ cwd?: string;
4074
+ config: RuntimeEnvironmentConfig | null;
4075
+ expected: RuntimeEnvironmentConfig | null;
4076
+ secrets?: Record<string, string | null>;
4077
+ expectedSecretRevision?: string;
4078
+ }
4079
+ interface RuntimeEnvironmentCheck {
4080
+ name: string;
4081
+ status: "ok" | "warning" | "failed";
4082
+ detail: string;
4083
+ }
4084
+ interface PersonalizationMemoryPreferences {
4085
+ enabled: boolean;
4086
+ autoExtractEnabled: boolean;
4087
+ sessionMemoryEnabled: boolean;
4088
+ autoDreamEnabled: boolean;
4089
+ autoDreamMinHours: number;
4090
+ autoDreamMinSessions: number;
4091
+ }
4092
+ interface PersonalizationSettingsSnapshot {
4093
+ effective: PersonalizationMemoryPreferences;
4094
+ configured: (Partial<PersonalizationMemoryPreferences> & {
4095
+ maxFiles?: number;
4096
+ maxEntrypointLines?: number;
4097
+ }) | null;
4098
+ sources: Record<string, string>;
4099
+ rules: string[];
4100
+ consolidation: {
4101
+ lastConsolidatedAt: number | null;
4102
+ status: string;
4103
+ taskId?: string;
4104
+ finishedAt?: number;
4105
+ error?: string;
4106
+ };
4107
+ projectId?: string;
4108
+ projectPath?: string;
4109
+ }
4110
+ interface SavePersonalizationSettingsInput {
4111
+ projectId?: string;
4112
+ value: PersonalizationMemoryPreferences | null;
4113
+ expected: PersonalizationSettingsSnapshot["configured"];
4114
+ }
4115
+ interface PortableSettingsFile {
4116
+ version: 1;
4117
+ groups: Record<string, Record<string, unknown>>;
4118
+ }
4119
+ interface PortableSettingsPreview {
4120
+ id: string;
4121
+ groups: Array<{
4122
+ id: string;
4123
+ changes: Array<{
4124
+ key: string;
4125
+ before: string;
4126
+ after: string;
4127
+ }>;
4128
+ }>;
4129
+ }
4130
+ interface GlobalPermissionRules {
4131
+ mode: ApprovalMode;
4132
+ allowedTools?: string[];
4133
+ deniedTools?: string[];
4134
+ autoApproveTools?: string[];
4135
+ deniedCommands?: string[];
4136
+ pathRules?: Array<{
4137
+ pattern: string;
4138
+ allow: boolean;
4139
+ }>;
4140
+ }
4141
+ interface IsolationSettings {
4142
+ enabled: boolean;
4143
+ failIfUnavailable: boolean;
4144
+ enabledPlatforms: Array<"linux" | "wsl" | "macos">;
4145
+ filesystem: {
4146
+ allowRead: string[];
4147
+ denyRead: string[];
4148
+ allowWrite: string[];
4149
+ denyWrite: string[];
4150
+ extraAllowedRoots: string[];
4151
+ };
4152
+ network: {
4153
+ mode: "none" | "bridge" | "host" | "proxy";
4154
+ allowedDomains: string[];
4155
+ deniedDomains: string[];
4156
+ strictDomainPolicy: boolean;
4157
+ };
4158
+ srt: {
4159
+ runtimeCommand: string;
4160
+ };
4161
+ }
4162
+ interface PermissionConfigurationSnapshot {
4163
+ permission: GlobalPermissionRules;
4164
+ sandbox: IsolationSettings;
4165
+ isolationAvailable: boolean;
4166
+ isolationReason: string | null;
4167
+ environment: "native" | "wsl";
4168
+ }
4169
+ interface CheckPermissionConfigurationInput {
4170
+ permission: GlobalPermissionRules;
4171
+ toolName: string;
4172
+ path?: string;
4173
+ command?: string;
4174
+ cwd: string;
4175
+ }
3850
4176
  /** Daemon settings, profile and output styles. */
3851
4177
  declare class SettingsResource {
3852
4178
  private readonly transport;
3853
4179
  constructor(transport: HttpTransport);
4180
+ /** Runtime environment management from an existing full daemon connection. */
4181
+ readonly runtimeEnvironment: {
4182
+ get: ({ cwd }?: {
4183
+ cwd?: string;
4184
+ }, options?: RequestOptions) => Promise<RuntimeSettingsSnapshot>;
4185
+ save: (input: SaveRuntimeEnvironmentInput, options?: RequestOptions) => Promise<RuntimeSettingsSnapshot>;
4186
+ check: (input: {
4187
+ cwd: string;
4188
+ config: RuntimeEnvironmentConfig;
4189
+ }, options?: RequestOptions) => Promise<RuntimeEnvironmentCheck[]>;
4190
+ };
4191
+ /** Global or registered-project memory configuration from a full daemon connection. */
4192
+ readonly personalization: {
4193
+ get: ({ projectId }?: {
4194
+ projectId?: string;
4195
+ }, options?: RequestOptions) => Promise<PersonalizationSettingsSnapshot>;
4196
+ save: (input: SavePersonalizationSettingsInput, options?: RequestOptions) => Promise<PersonalizationSettingsSnapshot>;
4197
+ };
4198
+ /** Export selected non-secret settings and confirm an import preview from the same daemon. */
4199
+ readonly portable: {
4200
+ export: (categories: string[], options?: RequestOptions) => Promise<PortableSettingsFile>;
4201
+ preview: (value: unknown, options?: RequestOptions) => Promise<PortableSettingsPreview>;
4202
+ apply: ({ id, categories }: {
4203
+ id: string;
4204
+ categories: string[];
4205
+ }, options?: RequestOptions) => Promise<void>;
4206
+ };
4207
+ /** Read the daemon's effective isolation availability or check a draft rule without running it. */
4208
+ readonly permissionConfiguration: {
4209
+ get: (options?: RequestOptions) => Promise<PermissionConfigurationSnapshot>;
4210
+ check: (input: CheckPermissionConfigurationInput, options?: RequestOptions) => Promise<{
4211
+ action: "allow" | "deny" | "ask";
4212
+ reason?: string;
4213
+ }>;
4214
+ };
3854
4215
  /** Read the daemon's current global settings. */
3855
4216
  getGlobal({ signal }?: RequestOptions): Promise<Record<string, unknown>>;
3856
4217
  /** Read effective settings including overrides for a daemon-side project directory. */
@@ -4150,5 +4511,5 @@ declare function isWorkMode(value: unknown): value is WorkMode;
4150
4511
  declare function readSessionRuntimeConfig(session: SessionRecord, defaults?: Partial<SessionRuntimeConfig>): SessionRuntimeConfig;
4151
4512
  declare function patchSessionRuntimeMetadata(metadata: Record<string, unknown>, patch: SessionRuntimeConfigPatch): Record<string, unknown>;
4152
4513
 
4153
- export { AttachmentResource, BobanNomiApiError, BobanNomiClient, CURRENT_PROTOCOL_VERSION, ChannelResource, CommandResource, ContextResource, DiagnosticResource, EventResource, GitResource, HookResource, HttpTransport, IncompatibleProtocolError, MaintenanceResource, McpResource, McpServersResource, MemoryResource, PermissionResource, PluginMarketplaceResource, PluginResource, ProjectResource, ProtocolClient, ProtocolValidationError, ScheduleResource, SessionResource, SessionSyncController, SettingsResource, SseTransport, TerminalResource, UnsupportedSessionEventSchemaVersionError, WorktreeResource, applyEvent, applyEvents, attachmentRangeHeader, checkProtocolCompatibility, createClientState, createSessionRequestId, getVisibleSessionMessages, hydrateState, isSupersededModelPart, isWorkMode, normalizeApprovalMode, normalizeDaemonBaseUrl, parseCreateSessionGoalInput, parseGoalActionInput, parseMcpCallResultData, parseUpdateSessionGoalInput, patchSessionRuntimeMetadata, readRuntimeMetadata, readSessionModelRetryState, readSessionModelUsage, readSessionRuntimeConfig, readWorkspaceChangesMetadata, replaceSessionState, responseArray, responseField, selectFirstPendingPermission, selectSessionInputs, selectSessionMessagesWithParts, selectSessionModelRetry, selectSessionModelUsage, selectSessionOrderedMessages, selectSessionParts, selectSessionPermissions, selectSessionRuns, selectSessionTasks, streamServerSentEvents, supportsFeature, syncEvents };
4154
- export type { AdmitClientPromptInput, AdmitPromptAttachmentInput, AgentEnvironmentCapabilities, AgentPersonaInfo, ApprovalMode, ApprovalReviewRecord, AttachmentAssetRecord, AttachmentStorageGcResult, AttachmentStorageIssue, AttachmentStorageRepairResult, AttachmentStorageReport, AuthStatus, BobanNomiClientOptions, BobanNomiClientState, BobanNomiServerHealth, CancelQueuedClientPromptInput, CancelQueuedPromptResponse, CancelResponseMode, ChannelConnectorRuntimeStatus, ChannelDeliveryRecord, ChannelDeliveryStatus, ChannelDenialNotice, ChannelDomain, ChannelQuery, ChannelRuntimeControlInput, ChannelRuntimeState, ChannelRuntimeStatus, ChannelStatusSnapshot, CleanupCandidate, CleanupPreview, CleanupResult, ClearMemoryInput, ClientModelConnection, ClientModelProvider, ClientProtocolSupport, CommandCatalogEntry, CommandKind, CommandSelection, CommandSource, ConfigureClientSessionInput, ContextBucketId, ContextUsageBucket, ContextUsageSnapshot, ContextUsageTip, ContextUsageTipCode, CreateBackgroundShellInput, CreateBackgroundShellResult, CreateClientSessionInput, CreateScheduledTaskInput, CreateSessionByProjectInput, CreateSessionGoalInput, CreateSessionWithDirectoryInput, CustomModelProviderInput, DaemonRestartPreview, DiagnosticExecutionQuery, DispatchedSessionCreation, DispatchedSessionCreationRequest, DownloadAttachmentOptions, DraftComposerOptions, DraftComposerTarget, DurableChannelMessageInput, DurableChannelMessageResult, EditLatestClientPromptInput, EventSyncOptions, ExecutionInstructions, ExpectedModelConnection, ExternalConversationRecord, FactReplacementResult, FeishuAllowInput, FeishuChannelSnapshot, FeishuComposedSnapshot, FeishuConnectInput, FeishuPatchInput, FeishuRegistrationSnapshot, FeishuRegistrationStartInput, FeishuRegistrationState, ForkClientSessionInput, GlobalSettingsPatch, GoalActionInput, GoalExternalWait, GoalStopReason, HookInfo, HostDiagnosticSnapshots, HttpRequestOptions, HttpTransportOptions, InputDelivery, InterruptSessionResponse, JobCancelReceipt, JobCapabilities, JobInputReceipt, JobKind, JobListResult, JobReadResult, JobSnapshot, JobStatus, JobTarget, JobWaitResult, JsonValue, ListClientMessagePartsOptions, ListCommandsOptions, ListEventsOptions, ListMessagePartsOptions, ListMessagesOptions, ListPermissionsOptions, ListProjectsOptions, ListSessionJobsOptions, ListSessionsOptions, MaintenanceBackupManifest, MaintenanceBackupResult, MarketplaceAddSourceRequest, MarketplaceCancelRequest, MarketplaceCancelResponse, MarketplaceCatalog, MarketplaceCatalogRequest, MarketplaceEntry, MarketplaceInstallInput, MarketplaceInstallRequest, MarketplaceOperation, MarketplacePreview, MarketplacePreviewRequest, MarketplaceProvenance, MarketplaceSelection, MarketplaceSource, MarketplaceSourceEnabledRequest, MarketplaceSourceView, MarketplaceSourcesResponse, McpConfigOperationResult, McpManagedServerConfig, McpManagedServerSummary, McpOAuthLoginInput, McpOAuthLoginResponse, McpOAuthStatusSnapshot, McpRuntimeStatus, McpRuntimeSyncResult, McpServerRuntimeRef, McpServerStatus, MemoryEntryRecord, MemoryListResponse, MemoryRevision, ModelInfo, ModelProviderConnection, ModelProviderInfo, ModelProviderRequest, OAuthOperationEvent, OAuthOperationView, OutputStyleInfo, PermissionRequestRecord, PermissionStatus, PluginArchiveError, PluginArchiveInstallInput, PluginArchivePreview, PluginArchivePreviewInput, PluginGitInstallInput, PluginGitPreview, PluginGitPreviewInput, PluginInfo, PluginListResult, PluginLocalInstallInput, PluginLocalPreview, PluginLocalPreviewInput, PluginRuntimeStatus, ProjectFactRecord, ProjectRecord, PromoteQueuedClientPromptInput, PromoteQueuedPromptResponse, PromptResponse, ProtocolCompatibility, ProviderConnectionTestResult, ProviderDefaultsRequest, ProviderDefaultsSnapshot, ProviderInfo, QueuedPromptCancelReceipt, RawRequestOptions, RecordChannelDeliveryInput, ReloadPluginsResponse, RememberSessionResponse, ReplyPermissionInput, ResolvedSessionConfiguration, ResumeInterruptedRunInput, ResumeInterruptedRunResponse, RewindSessionResponse, RunResult, ScheduledRunRecord, ScheduledTaskRecord, ScheduledTaskStatusSummary, SearchSessionsOptions, ServerCapabilities, SessionActivityPage, SessionAttachmentMessagePartRecord, SessionBucket, SessionComposerContext, SessionConfigurationInput, SessionConfigurationOptions, SessionConfigurationResultInput, SessionConfigurationSnapshot, SessionControlOriginal, SessionControlReceipt, SessionControls, SessionCreationInput, SessionCreationReceipt, SessionDirectoryEntry, SessionDirectoryPage, SessionDirectoryResult, SessionEventRecord, SessionExecutionRecord, SessionExportResponse, SessionFileErrorCode, SessionFileFindInput, SessionFileFindOptions, SessionFileInfo, SessionFileListInput, SessionFileListOptions, SessionFileReadInput, SessionFileReadOptions, SessionFileRequestOptions, SessionFileSearchInput, SessionFileSearchMatch, SessionFileSearchOptions, SessionFileStatInput, SessionFindFilesResult, SessionGoal, SessionGoalRequestReceipt, SessionHandle, SessionInputAttachmentRecord, SessionInputRecord, SessionManagementAction, SessionMessagePartRecord, SessionMessageRecord, SessionMessageWithParts, SessionModelRetryState, SessionModelUsageSummary, SessionMutationPublicReceipt, SessionObservation, SessionRecord, SessionResourceRevision, SessionRunAttemptRecord, SessionRunRecord, SessionRuntimeConfig, SessionRuntimeConfigPatch, SessionSearchFilesResult, SessionSearchResult, AgentSessionStateSnapshot as SessionStateSnapshot, SessionSyncControllerOptions, SessionTextFileResult, SessionTransformationMessagePartRecord, SessionUsageResponse, SessionUserInputItem, SkillInfo, SkillInstallInput, SkillMarketplaceEntry, SkillMarketplaceInstallInput, SkillProject, SkillSnapshot, SkillSource, StartDreamResponse, StorageCategory, StorageReport, StorageRetentionPolicy, SyncConnectionStatus, SyncEventUpdate, SyncEventsClient, TaskWorktreeRecord, TerminalCreateRequest, TerminalEvent, TerminalReadRequest, TerminalReadResult, TerminalResizeRequest, TerminalRuntime, TerminalSessionInfo, TerminalSessionStatus, TerminalSignal, TerminalSource, TerminalWriteRequest, UpdateMemoryEntryInput, UpdateScheduledTaskInput, UpdateSessionGoalInput, UploadAttachmentInput, UsageFilter, UsagePrice, UsageReport, UsageRequest, UsageSettings, WorkMode, WorkspaceChangeFile, WorkspaceChangesMetadata };
4514
+ export { AttachmentResource, BobanNomiApiError, BobanNomiClient, CURRENT_PROTOCOL_VERSION, ChannelResource, CommandResource, ContextResource, DiagnosticResource, EventResource, GitResource, GitWorkspaceResource, HookResource, HttpTransport, IncompatibleProtocolError, MaintenanceResource, McpResource, McpServersResource, MemoryResource, PermissionResource, PluginMarketplaceResource, PluginResource, ProjectResource, ProtocolClient, ProtocolValidationError, ScheduleResource, SessionResource, SessionSyncController, SettingsResource, SseTransport, TerminalResource, UnsupportedSessionEventSchemaVersionError, WorktreeResource, applyEvent, applyEvents, attachmentRangeHeader, checkProtocolCompatibility, createClientState, createSessionRequestId, getVisibleSessionMessages, hydrateState, isSupersededModelPart, isWorkMode, normalizeApprovalMode, normalizeDaemonBaseUrl, parseCreateSessionGoalInput, parseGoalActionInput, parseMcpCallResultData, parseUpdateSessionGoalInput, patchSessionRuntimeMetadata, readRuntimeMetadata, readSessionModelRetryState, readSessionModelUsage, readSessionRuntimeConfig, readWorkspaceChangesMetadata, replaceSessionState, responseArray, responseField, selectFirstPendingPermission, selectSessionInputs, selectSessionMessagesWithParts, selectSessionModelRetry, selectSessionModelUsage, selectSessionOrderedMessages, selectSessionParts, selectSessionPermissions, selectSessionRuns, selectSessionTasks, streamServerSentEvents, supportsFeature, syncEvents };
4515
+ export type { AdmitClientPromptInput, AdmitPromptAttachmentInput, AgentEnvironmentCapabilities, AgentPersonaInfo, ApprovalMode, ApprovalReviewRecord, AttachmentAssetRecord, AttachmentRequestOptions, AttachmentStorageGcResult, AttachmentStorageIssue, AttachmentStorageRepairResult, AttachmentStorageReport, AuthStatus, BobanNomiClientOptions, BobanNomiClientState, BobanNomiServerHealth, CancelQueuedClientPromptInput, CancelQueuedPromptResponse, CancelResponseMode, ChannelConnectorRuntimeStatus, ChannelDeliveryRecord, ChannelDeliveryStatus, ChannelDenialNotice, ChannelDomain, ChannelQuery, ChannelRuntimeControlInput, ChannelRuntimeState, ChannelRuntimeStatus, ChannelStatusSnapshot, CheckPermissionConfigurationInput, CleanupCandidate, CleanupPreview, CleanupResult, ClearMemoryInput, ClientModelConnection, ClientModelProvider, ClientProtocolSupport, CommandCatalogEntry, CommandKind, CommandSelection, CommandSource, ConfigureClientSessionInput, ContextBucketId, ContextUsageBucket, ContextUsageSnapshot, ContextUsageTip, ContextUsageTipCode, CreateBackgroundShellInput, CreateBackgroundShellResult, CreateClientSessionInput, CreateScheduledTaskInput, CreateSessionByProjectInput, CreateSessionGoalInput, CreateSessionWithDirectoryInput, CreatedSession, CustomModelProviderInput, DaemonRestartPreview, DeleteAttachmentOptions, DiagnosticExecutionQuery, DispatchedSessionCreation, DispatchedSessionCreationRequest, DownloadAttachmentOptions, DraftComposerOptions, DraftComposerTarget, DurableChannelMessageInput, DurableChannelMessageResult, EditLatestClientPromptInput, EventSyncOptions, ExecutionInstructions, ExpectedModelConnection, ExternalConversationRecord, FactReplacementResult, FeishuAllowInput, FeishuChannelSnapshot, FeishuComposedSnapshot, FeishuConnectInput, FeishuPatchInput, FeishuRegistrationSnapshot, FeishuRegistrationStartInput, FeishuRegistrationState, ForkClientSessionInput, GitBranchOperation, GitBranchReceipt, GitWorkspaceRoot, GitWorkspaceTarget, GlobalPermissionRules, GlobalSettingsPatch, GoalActionInput, GoalExternalWait, GoalStopReason, HookInfo, HostDiagnosticSnapshots, HttpRequestOptions, HttpTransportOptions, InputDelivery, InterruptSessionResponse, IsolationSettings, JobCancelReceipt, JobCapabilities, JobInputReceipt, JobKind, JobListResult, JobReadResult, JobSnapshot, JobStatus, JobTarget, JobWaitResult, JsonValue, ListClientMessagePartsOptions, ListCommandsOptions, ListEventsOptions, ListMessagePartsOptions, ListMessagesOptions, ListPermissionsOptions, ListProjectsOptions, ListSessionJobsOptions, ListSessionsOptions, MaintenanceBackupManifest, MaintenanceBackupResult, MarketplaceAddSourceRequest, MarketplaceCancelRequest, MarketplaceCancelResponse, MarketplaceCatalog, MarketplaceCatalogRequest, MarketplaceEntry, MarketplaceInstallInput, MarketplaceInstallRequest, MarketplaceOperation, MarketplacePreview, MarketplacePreviewRequest, MarketplaceProvenance, MarketplaceSelection, MarketplaceSource, MarketplaceSourceEnabledRequest, MarketplaceSourceView, MarketplaceSourcesResponse, McpConfigOperationResult, McpManagedServerConfig, McpManagedServerSummary, McpOAuthLoginInput, McpOAuthLoginResponse, McpOAuthStatusSnapshot, McpRuntimeStatus, McpRuntimeSyncResult, McpServerInventoryEntry, McpServerRuntimeRef, McpServerStatus, MemoryEntryRecord, MemoryListResponse, MemoryRevision, ModelInfo, ModelProviderConnection, ModelProviderInfo, ModelProviderRequest, OAuthOperationEvent, OAuthOperationView, OutputStyleInfo, PermissionConfigurationSnapshot, PermissionRequestRecord, PermissionStatus, PersonalizationMemoryPreferences, PersonalizationSettingsSnapshot, PluginArchiveError, PluginArchiveInstallInput, PluginArchivePreview, PluginArchivePreviewInput, PluginGitInstallInput, PluginGitPreview, PluginGitPreviewInput, PluginInfo, PluginListResult, PluginLocalInstallInput, PluginLocalPreview, PluginLocalPreviewInput, PluginRuntimeStatus, PortableSettingsFile, PortableSettingsPreview, ProjectDirectory, ProjectDirectorySnapshot, ProjectFactRecord, ProjectRecord, PromoteQueuedClientPromptInput, PromoteQueuedPromptResponse, PromptResponse, ProtocolCompatibility, ProviderConnectionTestResult, ProviderDefaultsRequest, ProviderDefaultsSnapshot, ProviderInfo, QueuedPromptCancelReceipt, RawRequestOptions, RecordChannelDeliveryInput, ReloadPluginsResponse, RememberSessionResponse, ReplyPermissionInput, ResolvedSessionConfiguration, ResumeInterruptedRunInput, ResumeInterruptedRunResponse, RewindSessionResponse, RunResult, RuntimeEnvironmentCheck, RuntimeEnvironmentConfig, RuntimeSettingsSnapshot, SavePersonalizationSettingsInput, SaveRuntimeEnvironmentInput, ScheduledRunRecord, ScheduledTaskRecord, ScheduledTaskStatusSummary, SearchSessionsOptions, ServerCapabilities, Session, SessionActivityPage, SessionAttachmentMessagePartRecord, SessionBucket, SessionComposerContext, SessionConfigurationInput, SessionConfigurationOptions, SessionConfigurationResultInput, SessionConfigurationSnapshot, SessionControlOriginal, SessionControlReceipt, SessionControls, SessionCreationInput, SessionCreationReceipt, SessionDirectoryEntry, SessionDirectoryPage, SessionDirectoryResult, SessionEventRecord, SessionExecutionRecord, SessionExportResponse, SessionFileErrorCode, SessionFileFindInput, SessionFileFindOptions, SessionFileInfo, SessionFileListInput, SessionFileListOptions, SessionFileReadInput, SessionFileReadOptions, SessionFileRequestOptions, SessionFileSearchInput, SessionFileSearchMatch, SessionFileSearchOptions, SessionFileStatInput, SessionFindFilesResult, SessionGoal, SessionGoalRequestReceipt, SessionInputAttachmentRecord, SessionInputRecord, SessionManagementAction, SessionMessagePartRecord, SessionMessageRecord, SessionMessageWithParts, SessionModelRetryState, SessionModelUsageSummary, SessionMutationPublicReceipt, SessionObservation, SessionPromptInput, SessionRecord, SessionResourceRevision, SessionRunAttemptRecord, SessionRunRecord, SessionRuntimeConfig, SessionRuntimeConfigPatch, SessionSearchFilesResult, SessionSearchResult, AgentSessionStateSnapshot as SessionStateSnapshot, SessionSyncControllerOptions, SessionTextFileResult, SessionTransformationMessagePartRecord, SessionUsageResponse, SessionUserInputItem, SkillInfo, SkillInstallInput, SkillMarketplaceEntry, SkillMarketplaceInstallInput, SkillProject, SkillSnapshot, SkillSource, StartDreamResponse, StorageCategory, StorageReport, StorageRetentionPolicy, SyncConnectionStatus, SyncEventUpdate, SyncEventsClient, TaskWorktreeRecord, TerminalCreateRequest, TerminalEvent, TerminalReadRequest, TerminalReadResult, TerminalResizeRequest, TerminalRuntime, TerminalSessionInfo, TerminalSessionStatus, TerminalSignal, TerminalSource, TerminalWriteRequest, UpdateMemoryEntryInput, UpdateScheduledTaskInput, UpdateSessionGoalInput, UploadAttachmentInput, UsageFilter, UsagePrice, UsageReport, UsageRequest, UsageSettings, WorkMode, WorkspaceChangeFile, WorkspaceChangesMetadata };