@bobannomi/app-host 0.1.0-next.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -209,6 +209,260 @@ declare class AppHostError extends Error {
209
209
  });
210
210
  }
211
211
 
212
+ interface ServiceStatus {
213
+ state: "absent" | "unauthorized" | "stopped" | "starting" | "recovering" | "ready" | "failed";
214
+ reason?: "dependency_missing" | "service_start_failed" | "service_unavailable" | "result_unknown" | "incompatible" | "revoked";
215
+ instanceId?: string;
216
+ apiVersion?: string;
217
+ }
218
+ interface ServiceWork {
219
+ requestId: string;
220
+ state: ServiceWorkState;
221
+ updatedAt: string;
222
+ result?: JsonValue;
223
+ error?: JsonValue;
224
+ }
225
+ interface ServiceConnectionDescriptor {
226
+ connectionId: string;
227
+ baseUrl: string;
228
+ apiVersion: string;
229
+ }
230
+
231
+ declare const APP_HOST_FEATURES: readonly ["fetch-v2", "fetch-inline-body-v1", "fetch-target-close-v1", "service-v1", "extended-errors-v1", "workspace-v1", "session-resources-v1", "session-controls-v1", "conversation-creation-session-v1", "trusted-desktop-v1", "attachments-v1", "auxiliary-sessions-v1", "system-ui-v1", "lifecycle-v1", "commands-v1", "resource-catalog-v1", "file-content-v1", "window-chrome-v1", "embedded-browser-v1", "browser-binding-invalidation-v1", "browser-capture-preview-v1"];
232
+ type AppHostFeature = typeof APP_HOST_FEATURES[number];
233
+ declare const FETCH_CHUNK_BYTES: number;
234
+ declare const FETCH_INLINE_BODY_BYTES: number;
235
+ declare const FETCH_WINDOW_CHUNKS = 4;
236
+ declare const FETCH_MAX_STREAMS = 16;
237
+ declare const FETCH_METADATA_BYTES: number;
238
+ declare const FETCH_HEADERS_TIMEOUT_MS = 30000;
239
+ declare const FETCH_IDLE_TIMEOUT_MS = 120000;
240
+ type FetchDirection = "upload" | "download";
241
+ type PageFetchFrame = {
242
+ protocol: 2;
243
+ } & ({
244
+ type: "fetch-open";
245
+ id: string;
246
+ connectionId: string;
247
+ url: string;
248
+ method: string;
249
+ headers: [string, string][];
250
+ hasBody: boolean;
251
+ inlineBody?: string;
252
+ } | {
253
+ type: "fetch-headers";
254
+ id: string;
255
+ status: number;
256
+ statusText: string;
257
+ headers: [string, string][];
258
+ hasBody: boolean;
259
+ } | {
260
+ type: "fetch-credit";
261
+ id: string;
262
+ direction: FetchDirection;
263
+ sequence: number;
264
+ chunks: number;
265
+ bytes: number;
266
+ } | {
267
+ type: "fetch-chunk";
268
+ id: string;
269
+ direction: FetchDirection;
270
+ sequence: number;
271
+ bytes: Uint8Array;
272
+ } | {
273
+ type: "fetch-end";
274
+ id: string;
275
+ direction: FetchDirection;
276
+ sequence: number;
277
+ } | {
278
+ type: "fetch-consumed";
279
+ id: string;
280
+ direction: "download";
281
+ sequence: number;
282
+ } | {
283
+ type: "fetch-cancel";
284
+ id: string;
285
+ } | {
286
+ type: "fetch-error";
287
+ id: string;
288
+ error: AppHostErrorInfo;
289
+ } | {
290
+ type: "fetch-close";
291
+ connectionId: string;
292
+ });
293
+ /** Plain-data validation runs before reading fields; accessors and hidden properties are invalid. */
294
+ declare function isPageFetchFrame(value: unknown): value is PageFetchFrame;
295
+ /** This URL is only an opaque document-local descriptor; it is never fetched over a network. */
296
+ declare function pageFetchPath(baseUrl: string, input: string): string;
297
+
298
+ interface ServiceContext {
299
+ protocolVersion: 1;
300
+ registrationId: string;
301
+ instanceId: string;
302
+ dataScopeId: string;
303
+ scope: {
304
+ appId: string;
305
+ installationId: string;
306
+ contentDigest: string;
307
+ };
308
+ installationRevision: number;
309
+ phase: "starting" | "ready";
310
+ }
311
+ interface ServiceInvocation {
312
+ invocationId: string;
313
+ dataScopeId: string;
314
+ sessionId: string;
315
+ runId: string;
316
+ inputId?: string;
317
+ workspaceId?: string;
318
+ executionRoot?: string;
319
+ privateSessionId?: string;
320
+ }
321
+ interface CreateWorktree {
322
+ requestId: string;
323
+ workspaceId: string;
324
+ expectedHead: string;
325
+ branch: string;
326
+ }
327
+ interface WorktreeQuery {
328
+ requestId: string;
329
+ original: Omit<CreateWorktree, "requestId">;
330
+ }
331
+ interface WorktreeReceipt {
332
+ requestId: string;
333
+ state: "accepted" | "completed" | "failed" | "unknown";
334
+ result?: {
335
+ executionRoot: string;
336
+ workspaceId: string;
337
+ branch: string;
338
+ sourceHead: string;
339
+ };
340
+ }
341
+ interface RootReleaseReceipt {
342
+ requestId: string;
343
+ executionRoot: string;
344
+ state: "released" | "retained-dirty" | "in-use" | "unknown";
345
+ }
346
+ interface GitStatus {
347
+ root: string;
348
+ commonDir: string;
349
+ head: string;
350
+ branch: string;
351
+ changes: string[];
352
+ }
353
+ type Entry$1<P, R> = {
354
+ params: P;
355
+ result: R;
356
+ };
357
+ interface ServiceHostMethodMap {
358
+ "secrets.get": Entry$1<{
359
+ key: string;
360
+ }, string | null>;
361
+ "secrets.set": Entry$1<{
362
+ key: string;
363
+ value: string;
364
+ }, {
365
+ stored: true;
366
+ }>;
367
+ "secrets.delete": Entry$1<{
368
+ key: string;
369
+ }, {
370
+ deleted: true;
371
+ }>;
372
+ "context.get": Entry$1<Record<string, never>, ServiceContext>;
373
+ "context.resolveInvocation": Entry$1<{
374
+ ticket: string;
375
+ }, ServiceInvocation>;
376
+ "agent.listModels": Entry$1<Record<string, never>, {
377
+ id: string;
378
+ name: string;
379
+ }[]>;
380
+ "agent.getConnection": Entry$1<{
381
+ workspaceId?: string;
382
+ executionRoot?: string;
383
+ privateSessionId?: string;
384
+ }, {
385
+ connectionId: string;
386
+ baseUrl: string;
387
+ }>;
388
+ "agent.resolveSkills": Entry$1<{
389
+ skillIds: string[];
390
+ }, {
391
+ type: "skill";
392
+ name: string;
393
+ path: string;
394
+ }[]>;
395
+ "sessions.getConnection": Entry$1<{
396
+ dataScopeId: string;
397
+ sessionId: string;
398
+ }, {
399
+ connectionId: string;
400
+ baseUrl: string;
401
+ }>;
402
+ "workspace.gitStatus": Entry$1<{
403
+ workspaceId: string;
404
+ }, GitStatus>;
405
+ "workspace.createTaskWorktree": Entry$1<CreateWorktree, WorktreeReceipt>;
406
+ "workspace.getWorktree": Entry$1<WorktreeQuery, WorktreeReceipt | null>;
407
+ "workspace.releaseExecutionRoot": Entry$1<{
408
+ requestId: string;
409
+ workspaceId: string;
410
+ executionRoot: string;
411
+ }, RootReleaseReceipt>;
412
+ "work.list": Entry$1<Record<string, never>, ServiceWork[]>;
413
+ "work.get": Entry$1<{
414
+ requestId: string;
415
+ }, ServiceWork | null>;
416
+ }
417
+ type ServiceHostMethod = keyof ServiceHostMethodMap;
418
+ declare const SERVICE_HOST_METHODS: readonly ["secrets.get", "secrets.set", "secrets.delete", "context.get", "context.resolveInvocation", "agent.listModels", "agent.getConnection", "agent.resolveSkills", "sessions.getConnection", "workspace.gitStatus", "workspace.createTaskWorktree", "workspace.getWorktree", "workspace.releaseExecutionRoot", "work.list", "work.get"];
419
+ declare const SERVICE_HOST_MAX_FRAME_BYTES: number;
420
+ declare const SERVICE_HOST_MAX_PENDING = 64;
421
+ declare const validServiceContext: (v: unknown) => v is ServiceContext;
422
+ declare function validServiceHostInput(method: ServiceHostMethod, v: unknown): boolean;
423
+ declare function validServiceHostResult(method: ServiceHostMethod, v: unknown): boolean;
424
+ type ServiceHostFrame = PageFetchFrame | {
425
+ protocol: 1;
426
+ type: "service-host-connect";
427
+ id: string;
428
+ } | {
429
+ protocol: 1;
430
+ type: "service-host-ready";
431
+ id: string;
432
+ context: ServiceContext;
433
+ } | {
434
+ protocol: 1;
435
+ type: "service-host-context";
436
+ context: ServiceContext;
437
+ } | {
438
+ protocol: 1;
439
+ type: "service-host-request";
440
+ id: string;
441
+ method: ServiceHostMethod;
442
+ params: ServiceHostMethodMap[ServiceHostMethod]["params"];
443
+ } | ({
444
+ protocol: 1;
445
+ type: "service-host-response";
446
+ id: string;
447
+ } & ({
448
+ ok: true;
449
+ value: unknown;
450
+ } | {
451
+ ok: false;
452
+ error: AppHostErrorInfo;
453
+ })) | {
454
+ protocol: 1;
455
+ type: "service-host-close";
456
+ };
457
+ declare function isServiceHostFrame(v: unknown): v is ServiceHostFrame;
458
+
459
+ interface AgentApiRoute {
460
+ readonly id: string;
461
+ }
462
+ declare function matchAgentApiRoute(method: string, path: string): AgentApiRoute | undefined;
463
+ /** Read the original Node request target, before WHATWG URL removes dot segments. */
464
+ declare function normalizeAgentApiPath(raw: string): string;
465
+
212
466
  /** How an agent explains findings and delivers results, independently of update timing. */
213
467
  type ReplyStyle = "collaborative" | "direct" | "explanatory";
214
468
 
@@ -367,386 +621,127 @@ interface WorkspaceConversationResult extends SessionCreationReceipt {
367
621
  workspaceId?: string;
368
622
  executionRoot?: string;
369
623
  privateSessionId?: string;
370
- worktree?: {
371
- id: string;
372
- path: string;
373
- branch: string;
374
- sourceHead: string;
375
- projectId: string;
376
- projectPath: string;
377
- configDir: string;
378
- environment: "native" | "wsl";
379
- distribution?: string;
380
- };
381
- }
382
-
383
- interface ControlOption {
384
- id: string;
385
- name: string;
386
- }
387
- interface DraftComposerTarget {
388
- source: "instance";
389
- workspaceId?: string;
390
- outsideProject?: boolean;
391
- roleId?: string | null;
392
- }
393
- interface DraftComposerOptions {
394
- source: "instance";
395
- optionsRevision: string;
396
- skills: (ControlOption & {
397
- path: string;
398
- source?: string;
399
- })[];
400
- plugins: (ControlOption & {
401
- agents: ControlOption[];
402
- })[];
403
- }
404
- type SessionControlAction = "readContext" | "configure" | "compact" | "edit" | "fork" | "resume" | "goalRead" | "goalWrite" | "goalStop";
405
- interface SessionControls {
406
- dataScopeId: string;
407
- sessionId: string;
408
- source: "instance" | "auxiliary" | "im";
409
- revision: number;
410
- optionsRevision: string;
411
- actions: Record<SessionControlAction, boolean>;
412
- models: ControlOption[];
413
- roles: ControlOption[];
414
- efforts: ControlOption[];
415
- workModes: ControlOption[];
416
- permissionModes?: ControlOption[];
417
- appServiceBindings?: ControlOption[];
418
- skills: (ControlOption & {
419
- path: string;
420
- source?: string;
421
- })[];
422
- commands: ControlOption[];
423
- contexts: ControlOption[];
424
- plugins?: (ControlOption & {
425
- agents: ControlOption[];
426
- })[];
427
- }
428
- type SessionControlOriginal = {
429
- action: "compact";
430
- body: {
431
- requestId: string;
432
- expectedRevision: number;
433
- };
434
- } | {
435
- action: "fork";
436
- body: {
437
- requestId: string;
438
- id: string;
439
- copyHistory?: boolean;
440
- beforeMessageId?: string;
441
- afterMessageId?: string;
442
- storage?: "sqlite";
443
- };
444
- };
445
- interface SessionControlReceipt {
446
- dataScopeId: string;
447
- sessionId: string;
448
- requestId: string;
449
- action: SessionControlOriginal["action"] | "configure";
450
- state: "prepared" | "created" | "completed" | "unknown";
451
- revision?: number;
452
- targetSessionId?: string;
453
- }
454
- interface SessionControlMethodMap {
455
- "sessions.getDraftComposerOptions": {
456
- params: DraftComposerTarget;
457
- result: DraftComposerOptions;
458
- };
459
- "sessions.createConversation": {
460
- params: WorkspaceConversationCreation;
461
- result: WorkspaceConversationResult;
462
- };
463
- "sessions.bindConversationIndex": {
464
- params: {
465
- original: WorkspaceConversationCreation;
466
- dataScopeId: string;
467
- };
468
- result: WorkspaceConversationResult;
469
- };
470
- "sessions.getConversationCreationResult": {
471
- params: WorkspaceConversationCreation;
472
- result: WorkspaceConversationResult | null;
473
- };
474
- "sessions.getControls": {
475
- params: {
476
- connectionId: string;
477
- sessionId: string;
478
- };
479
- result: SessionControls;
480
- };
481
- "sessions.getControlResult": {
482
- params: {
483
- connectionId?: string;
484
- requestId: string;
485
- sessionId: string;
486
- original: SessionControlOriginal;
487
- };
488
- result: SessionControlReceipt | null;
489
- };
490
- }
491
-
492
- interface ServiceStatus {
493
- state: "absent" | "unauthorized" | "stopped" | "starting" | "recovering" | "ready" | "failed";
494
- reason?: "dependency_missing" | "service_start_failed" | "service_unavailable" | "result_unknown" | "incompatible" | "revoked";
495
- instanceId?: string;
496
- apiVersion?: string;
497
- }
498
- interface ServiceWork {
499
- requestId: string;
500
- state: ServiceWorkState;
501
- updatedAt: string;
502
- result?: JsonValue;
503
- error?: JsonValue;
504
- }
505
- interface ServiceConnectionDescriptor {
506
- connectionId: string;
507
- baseUrl: string;
508
- apiVersion: string;
509
- }
510
-
511
- declare const APP_HOST_FEATURES: readonly ["fetch-v2", "fetch-inline-body-v1", "fetch-target-close-v1", "service-v1", "extended-errors-v1", "workspace-v1", "session-resources-v1", "session-controls-v1", "conversation-creation-session-v1", "trusted-desktop-v1", "attachments-v1", "auxiliary-sessions-v1", "system-ui-v1", "lifecycle-v1", "commands-v1", "resource-catalog-v1", "file-content-v1", "window-chrome-v1", "embedded-browser-v1", "browser-binding-invalidation-v1", "browser-capture-preview-v1"];
512
- type AppHostFeature = typeof APP_HOST_FEATURES[number];
513
- declare const FETCH_CHUNK_BYTES: number;
514
- declare const FETCH_INLINE_BODY_BYTES: number;
515
- declare const FETCH_WINDOW_CHUNKS = 4;
516
- declare const FETCH_MAX_STREAMS = 16;
517
- declare const FETCH_METADATA_BYTES: number;
518
- declare const FETCH_HEADERS_TIMEOUT_MS = 30000;
519
- declare const FETCH_IDLE_TIMEOUT_MS = 120000;
520
- type FetchDirection = "upload" | "download";
521
- type PageFetchFrame = {
522
- protocol: 2;
523
- } & ({
524
- type: "fetch-open";
525
- id: string;
526
- connectionId: string;
527
- url: string;
528
- method: string;
529
- headers: [string, string][];
530
- hasBody: boolean;
531
- inlineBody?: string;
532
- } | {
533
- type: "fetch-headers";
534
- id: string;
535
- status: number;
536
- statusText: string;
537
- headers: [string, string][];
538
- hasBody: boolean;
539
- } | {
540
- type: "fetch-credit";
541
- id: string;
542
- direction: FetchDirection;
543
- sequence: number;
544
- chunks: number;
545
- bytes: number;
546
- } | {
547
- type: "fetch-chunk";
548
- id: string;
549
- direction: FetchDirection;
550
- sequence: number;
551
- bytes: Uint8Array;
552
- } | {
553
- type: "fetch-end";
554
- id: string;
555
- direction: FetchDirection;
556
- sequence: number;
557
- } | {
558
- type: "fetch-consumed";
559
- id: string;
560
- direction: "download";
561
- sequence: number;
562
- } | {
563
- type: "fetch-cancel";
564
- id: string;
565
- } | {
566
- type: "fetch-error";
567
- id: string;
568
- error: AppHostErrorInfo;
569
- } | {
570
- type: "fetch-close";
571
- connectionId: string;
572
- });
573
- /** Plain-data validation runs before reading fields; accessors and hidden properties are invalid. */
574
- declare function isPageFetchFrame(value: unknown): value is PageFetchFrame;
575
- /** This URL is only an opaque document-local descriptor; it is never fetched over a network. */
576
- declare function pageFetchPath(baseUrl: string, input: string): string;
577
-
578
- interface ServiceContext {
579
- protocolVersion: 1;
580
- registrationId: string;
581
- instanceId: string;
582
- dataScopeId: string;
583
- scope: {
584
- appId: string;
585
- installationId: string;
586
- contentDigest: string;
587
- };
588
- installationRevision: number;
589
- phase: "starting" | "ready";
590
- }
591
- interface ServiceInvocation {
592
- invocationId: string;
593
- dataScopeId: string;
594
- sessionId: string;
595
- runId: string;
596
- inputId?: string;
597
- workspaceId?: string;
598
- executionRoot?: string;
599
- privateSessionId?: string;
600
- }
601
- interface CreateWorktree {
602
- requestId: string;
603
- workspaceId: string;
604
- expectedHead: string;
605
- branch: string;
606
- }
607
- interface WorktreeQuery {
608
- requestId: string;
609
- original: Omit<CreateWorktree, "requestId">;
610
- }
611
- interface WorktreeReceipt {
612
- requestId: string;
613
- state: "accepted" | "completed" | "failed" | "unknown";
614
- result?: {
615
- executionRoot: string;
616
- workspaceId: string;
624
+ worktree?: {
625
+ id: string;
626
+ path: string;
617
627
  branch: string;
618
628
  sourceHead: string;
629
+ projectId: string;
630
+ projectPath: string;
631
+ configDir: string;
632
+ environment: "native" | "wsl";
633
+ distribution?: string;
619
634
  };
620
635
  }
621
- interface RootReleaseReceipt {
622
- requestId: string;
623
- executionRoot: string;
624
- state: "released" | "retained-dirty" | "in-use" | "unknown";
636
+
637
+ interface ControlOption {
638
+ id: string;
639
+ name: string;
625
640
  }
626
- interface GitStatus {
627
- root: string;
628
- commonDir: string;
629
- head: string;
630
- branch: string;
631
- changes: string[];
641
+ interface DraftComposerTarget {
642
+ source: "instance";
643
+ workspaceId?: string;
644
+ outsideProject?: boolean;
645
+ roleId?: string | null;
632
646
  }
633
- type Entry$1<P, R> = {
634
- params: P;
635
- result: R;
636
- };
637
- interface ServiceHostMethodMap extends Pick<SessionControlMethodMap, "sessions.getControls" | "sessions.getControlResult"> {
638
- "secrets.get": Entry$1<{
639
- key: string;
640
- }, string | null>;
641
- "secrets.set": Entry$1<{
642
- key: string;
643
- value: string;
644
- }, {
645
- stored: true;
646
- }>;
647
- "secrets.delete": Entry$1<{
648
- key: string;
649
- }, {
650
- deleted: true;
651
- }>;
652
- "context.get": Entry$1<Record<string, never>, ServiceContext>;
653
- "context.resolveInvocation": Entry$1<{
654
- ticket: string;
655
- }, ServiceInvocation>;
656
- "agent.listModels": Entry$1<Record<string, never>, {
657
- id: string;
658
- name: string;
659
- }[]>;
660
- "agent.listRoles": Entry$1<Record<string, never>, {
661
- id: string;
662
- name: string;
663
- description: string;
664
- }[]>;
665
- "agent.getConnection": Entry$1<{
666
- workspaceId?: string;
667
- executionRoot?: string;
668
- privateSessionId?: string;
669
- }, {
670
- connectionId: string;
671
- baseUrl: string;
672
- }>;
673
- "agent.resolveSkills": Entry$1<{
674
- skillIds: string[];
675
- }, {
676
- type: "skill";
677
- name: string;
647
+ interface DraftComposerOptions {
648
+ source: "instance";
649
+ optionsRevision: string;
650
+ skills: (ControlOption & {
678
651
  path: string;
679
- }[]>;
680
- "sessions.getConnection": Entry$1<{
681
- dataScopeId: string;
682
- sessionId: string;
683
- }, {
684
- connectionId: string;
685
- baseUrl: string;
686
- }>;
687
- "workspace.gitStatus": Entry$1<{
688
- workspaceId: string;
689
- }, GitStatus>;
690
- "workspace.createTaskWorktree": Entry$1<CreateWorktree, WorktreeReceipt>;
691
- "workspace.getWorktree": Entry$1<WorktreeQuery, WorktreeReceipt | null>;
692
- "workspace.releaseExecutionRoot": Entry$1<{
693
- requestId: string;
694
- workspaceId: string;
695
- executionRoot: string;
696
- }, RootReleaseReceipt>;
697
- "work.list": Entry$1<Record<string, never>, ServiceWork[]>;
698
- "work.get": Entry$1<{
699
- requestId: string;
700
- }, ServiceWork | null>;
652
+ source?: string;
653
+ })[];
654
+ plugins: (ControlOption & {
655
+ agents: ControlOption[];
656
+ })[];
701
657
  }
702
- type ServiceHostMethod = keyof ServiceHostMethodMap;
703
- declare const SERVICE_HOST_METHODS: readonly ["secrets.get", "secrets.set", "secrets.delete", "context.get", "context.resolveInvocation", "agent.listModels", "agent.listRoles", "agent.getConnection", "agent.resolveSkills", "sessions.getConnection", "sessions.getControls", "sessions.getControlResult", "workspace.gitStatus", "workspace.createTaskWorktree", "workspace.getWorktree", "workspace.releaseExecutionRoot", "work.list", "work.get"];
704
- declare const SERVICE_HOST_MAX_FRAME_BYTES: number;
705
- declare const SERVICE_HOST_MAX_PENDING = 64;
706
- declare const validServiceContext: (v: unknown) => v is ServiceContext;
707
- declare function validServiceHostInput(method: ServiceHostMethod, v: unknown): boolean;
708
- declare function validServiceHostResult(method: ServiceHostMethod, v: unknown): boolean;
709
- type ServiceHostFrame = PageFetchFrame | {
710
- protocol: 1;
711
- type: "service-host-connect";
712
- id: string;
713
- } | {
714
- protocol: 1;
715
- type: "service-host-ready";
716
- id: string;
717
- context: ServiceContext;
718
- } | {
719
- protocol: 1;
720
- type: "service-host-context";
721
- context: ServiceContext;
722
- } | {
723
- protocol: 1;
724
- type: "service-host-request";
725
- id: string;
726
- method: ServiceHostMethod;
727
- params: ServiceHostMethodMap[ServiceHostMethod]["params"];
728
- } | ({
729
- protocol: 1;
730
- type: "service-host-response";
731
- id: string;
732
- } & ({
733
- ok: true;
734
- value: unknown;
658
+ type SessionControlAction = "readContext" | "configure" | "compact" | "edit" | "fork" | "resume" | "goalRead" | "goalWrite" | "goalStop";
659
+ interface SessionControls {
660
+ dataScopeId: string;
661
+ sessionId: string;
662
+ source: "instance" | "auxiliary" | "im";
663
+ revision: number;
664
+ optionsRevision: string;
665
+ actions: Record<SessionControlAction, boolean>;
666
+ models: ControlOption[];
667
+ roles: ControlOption[];
668
+ efforts: ControlOption[];
669
+ workModes: ControlOption[];
670
+ permissionModes?: ControlOption[];
671
+ appServiceBindings?: ControlOption[];
672
+ skills: (ControlOption & {
673
+ path: string;
674
+ source?: string;
675
+ })[];
676
+ commands: ControlOption[];
677
+ contexts: ControlOption[];
678
+ plugins?: (ControlOption & {
679
+ agents: ControlOption[];
680
+ })[];
681
+ }
682
+ type SessionControlOriginal = {
683
+ action: "compact";
684
+ body: {
685
+ requestId: string;
686
+ expectedRevision: number;
687
+ };
735
688
  } | {
736
- ok: false;
737
- error: AppHostErrorInfo;
738
- })) | {
739
- protocol: 1;
740
- type: "service-host-close";
689
+ action: "fork";
690
+ body: {
691
+ requestId: string;
692
+ id: string;
693
+ copyHistory?: boolean;
694
+ beforeMessageId?: string;
695
+ afterMessageId?: string;
696
+ storage?: "sqlite";
697
+ };
741
698
  };
742
- declare function isServiceHostFrame(v: unknown): v is ServiceHostFrame;
743
-
744
- interface AgentApiRoute {
745
- readonly id: string;
699
+ interface SessionControlReceipt {
700
+ dataScopeId: string;
701
+ sessionId: string;
702
+ requestId: string;
703
+ action: SessionControlOriginal["action"] | "configure";
704
+ state: "prepared" | "created" | "completed" | "unknown";
705
+ revision?: number;
706
+ targetSessionId?: string;
707
+ }
708
+ interface SessionControlMethodMap {
709
+ "sessions.getDraftComposerOptions": {
710
+ params: DraftComposerTarget;
711
+ result: DraftComposerOptions;
712
+ };
713
+ "sessions.createConversation": {
714
+ params: WorkspaceConversationCreation;
715
+ result: WorkspaceConversationResult;
716
+ };
717
+ "sessions.bindConversationIndex": {
718
+ params: {
719
+ original: WorkspaceConversationCreation;
720
+ dataScopeId: string;
721
+ };
722
+ result: WorkspaceConversationResult;
723
+ };
724
+ "sessions.getConversationCreationResult": {
725
+ params: WorkspaceConversationCreation;
726
+ result: WorkspaceConversationResult | null;
727
+ };
728
+ "sessions.getControls": {
729
+ params: {
730
+ connectionId: string;
731
+ sessionId: string;
732
+ };
733
+ result: SessionControls;
734
+ };
735
+ "sessions.getControlResult": {
736
+ params: {
737
+ connectionId?: string;
738
+ requestId: string;
739
+ sessionId: string;
740
+ original: SessionControlOriginal;
741
+ };
742
+ result: SessionControlReceipt | null;
743
+ };
746
744
  }
747
- declare function matchAgentApiRoute(method: string, path: string): AgentApiRoute | undefined;
748
- /** Read the original Node request target, before WHATWG URL removes dot segments. */
749
- declare function normalizeAgentApiPath(raw: string): string;
750
745
 
751
746
  interface WorkspaceRef {
752
747
  id: string;
@@ -1373,14 +1368,6 @@ interface DesktopMethodMap {
1373
1368
  "desktop.browser.removeAnnotation": Entry<BrowserPage & {
1374
1369
  annotationId: string;
1375
1370
  }, BrowserAnnotationSnapshot>;
1376
- "desktop.browser.capture": Entry<BrowserPage, {
1377
- assetId: string;
1378
- sha256: string;
1379
- mediaType: string;
1380
- byteLength: number;
1381
- width: number;
1382
- height: number;
1383
- }>;
1384
1371
  "desktop.browser.capturePreview": Entry<BrowserPage, {
1385
1372
  bytes: Uint8Array<ArrayBuffer>;
1386
1373
  width: number;
@@ -2129,14 +2116,13 @@ interface SystemRequester {
2129
2116
  }
2130
2117
  declare function createAppSystemApi(requester: SystemRequester, connectionOwner: object): AppHostSystem;
2131
2118
 
2132
- interface SessionTarget {
2133
- dataScopeId: string;
2134
- sessionId: string;
2135
- }
2136
- type SessionConnectionTarget = SessionTarget | Record<string, never>;
2137
2119
  type SessionResourceMethod = "sessions.getConnection";
2138
2120
  declare function validSessionResourceInput(method: SessionResourceMethod, v: unknown): boolean;
2139
- declare function validSessionResourceResult(method: SessionResourceMethod, v: unknown): boolean;
2121
+ declare function validSessionResourceResult(_method: SessionResourceMethod, v: unknown): v is {
2122
+ connectionId: string;
2123
+ baseUrl: string;
2124
+ defaultTaskLocation?: "current" | "worktree";
2125
+ };
2140
2126
 
2141
2127
  type AppUnloadReason = "switch" | "reload" | "disable" | "quit";
2142
2128
  type AppLifecycleFrame = {
@@ -2222,7 +2208,7 @@ interface ConnectParams {
2222
2208
  }
2223
2209
  interface AppHostMethodMap extends CommandsMethodMap, ResourceCatalogMethodMap, ConversationPreparationMethodMap, DesktopMethodMap, AttachmentsMethodMap, AuxiliaryMethodMap, SystemMethodMap, WindowMethodMap {
2224
2210
  "sessions.getConnection": {
2225
- params: SessionConnectionTarget;
2211
+ params: Record<string, never>;
2226
2212
  result: {
2227
2213
  connectionId: string;
2228
2214
  baseUrl: string;
@@ -2389,4 +2375,4 @@ interface AppHostPortMessage {
2389
2375
  }
2390
2376
 
2391
2377
  export { APP_HOST_ERROR_RETRY, APP_HOST_FEATURES, APP_HOST_LOGIN_TIMEOUT_MS, APP_HOST_LOGIN_TRANSPORT_TIMEOUT_MS, APP_HOST_MAX_PAYLOAD_BYTES, APP_HOST_MAX_PENDING, APP_HOST_METHODS, APP_HOST_PORT, APP_HOST_PORT_TIMEOUT_MS, APP_HOST_PROTOCOL, APP_HOST_READY, APP_HOST_REQUEST_TIMEOUT_MS, ATTACHMENTS_METHODS, AUXILIARY_METHODS, AppHostError, BROWSER_CAPTURE_PREVIEW_MAX_BYTES, COMMANDS_METHODS, DESKTOP_METHODS, EXTENSION_INPUTS, FETCH_CHUNK_BYTES, FETCH_HEADERS_TIMEOUT_MS, FETCH_IDLE_TIMEOUT_MS, FETCH_INLINE_BODY_BYTES, FETCH_MAX_STREAMS, FETCH_METADATA_BYTES, FETCH_WINDOW_CHUNKS, HOST_REQUEST_ID, RESOURCE_CATALOG_METHODS, SERVICE_HOST_MAX_FRAME_BYTES, SERVICE_HOST_MAX_PENDING, SERVICE_HOST_METHODS, SYSTEM_METHODS, SYSTEM_SETTINGS_SECTIONS, SYSTEM_SHORTCUT_IDS, WINDOW_METHODS, appHostErrorMessage, canonicalDesktopRequest, createAppAttachmentsApi, createAppAuxiliarySessionsApi, createAppCommandsApi, createAppDesktopApi, createAppSystemApi, createAppWindowApi, createResourceCatalogApi, isAppHostErrorInfo, isAppLifecycleFrame, isAuxiliaryMethod, isCommandsMethod, isConversationPreparationMethod, isDesktopMethod, isPageFetchFrame, isResourceCatalogMethod, isSafeErrorDetails, isServiceHostFrame, isSystemMethod, isWindowMethod, matchAgentApiRoute, normalizeAgentApiPath, pageFetchPath, validAppCommandSnapshot, validAppWindowState, validAttachmentsInput, validAttachmentsResult, validAuxiliaryInput, validAuxiliaryResult, validBrowserSnapshot, validCommandInvocation, validCommandReceipt, validCommandsInput, validConversationPreparationInput, validConversationPreparationResult, validDesktopEvent, validDesktopInput, validDesktopNavigationTarget, validDesktopResult, validDesktopResultForInput, validDesktopTarget, validExtensionRequest, validExtensionResult, validPresentationSnapshot, validProjectRequest, validProjectSnapshot, validResourceCatalogInput, validResourceCatalogResult, validResourceChanged, validServiceContext, validServiceHostInput, validServiceHostResult, validSessionResourceInput, validSessionResourceResult, validSessionSettingsTarget, validSystemEvent, validSystemInput, validSystemResult, validWindowEvent, validWindowInput, validWindowResult, validWorkspaceInput, validWorkspaceOperation, validWorkspaceResult };
2392
- export type { AgentApiRoute, AnnotationMode, AnnotationRect, AnnotationTarget, AppCommandRegistration, AppCommandSnapshot, AppContext, AppHostAttachments, AppHostAuxiliarySessions, AppHostCommands, AppHostDesktop, AppHostErrorCode, AppHostErrorInfo, AppHostEvent, AppHostEventMessage, AppHostFeature, AppHostMethod, AppHostMethodMap, AppHostPortMessage, AppHostReadyMessage, AppHostRequest, AppHostResponse, AppHostRetry, AppHostSystem, AppHostWindow, AppLifecycleFrame, AppUnloadReason, AppWindowMaterialState, AppWindowOpenHostInput, AppWindowStartupResult, AppWindowState, AppearancePreferences, AttachmentsMethod, AttachmentsMethodMap, AuxiliaryMethod, AuxiliaryMethodMap, AuxiliaryOptions, AuxiliaryReceipt, AuxiliaryRequest, AuxiliarySelection, AuxiliaryWireRequest, BindDesktopTarget, BrowserAnnotationRecord, BrowserAnnotationSnapshot, BrowserPage, CommandInvocation, CommandReceipt, CommandsMethod, CommandsMethodMap, ConnectParams, ConversationPreparationMethod, ConversationPreparationMethodMap, CreateWorktree, DesktopGitChange, DesktopMethod, DesktopMethodMap, DesktopNavigationTarget, DesktopOpener, DesktopRoot, DesktopSearch, DesktopTarget, DesktopTerminal, DesktopTerminalInfo, DesktopTerminalRequestOriginal, DesktopTerminalRequestReceipt, DesktopTerminalSnapshot, DesktopText, DesktopToolEvent, DesktopWindow, ExtensionOperation, ExtensionRequest, FetchDirection, GitStatus, JsonValue, LoginResult, ModelProviderConnection, ModelProviderRequest, NavigationCompletionStatus, PageFetchFrame, PluginAppActionReceipt, PluginAppActionResponse, PluginAppCatalog, PluginAppComposerContext, PluginAppHostState, PluginAppModelContext, PluginAppMount, PluginAppPreparedMessage, PluginAppPreparedTool, PluginAppRecord, PluginAppSource, PluginAppSubmissionReceipt, PluginAppToolPolicy, PresentationSnapshot, ProjectRequest, ProjectSnapshot, ProviderConnectionTestResult, ProviderDefaultsRequest, ProviderDefaultsSnapshot, ResourceCatalogMethod, ResourceCatalogMethodMap, ResourceChanged, RootReleaseReceipt, ServiceConnectionDescriptor, ServiceContext, ServiceHostFrame, ServiceHostMethod, ServiceHostMethodMap, ServiceInvocation, ServiceStatus, ServiceWork, ServiceWorkState, SessionResourceMethod, SessionSettingsTarget, SessionSettingsWireTarget, SessionTarget, StorageGetResult, StoredFile, SystemEvent, SystemMethod, SystemMethodMap, SystemOpenInput, SystemOpenWireInput, SystemProject, SystemRequester, SystemShortcutId, WindowMethod, WindowMethodMap, WindowRequester, WindowStateChanged, WorkspaceDirectoryPage, WorkspaceFilePage, WorkspaceMethod, WorkspaceOperation, WorkspaceOperationKind, WorkspaceOperationOriginal, WorkspaceRef, WorkspaceSelection, WorkspaceText, WorktreeQuery, WorktreeReceipt };
2378
+ export type { AgentApiRoute, AnnotationMode, AnnotationRect, AnnotationTarget, AppCommandRegistration, AppCommandSnapshot, AppContext, AppHostAttachments, AppHostAuxiliarySessions, AppHostCommands, AppHostDesktop, AppHostErrorCode, AppHostErrorInfo, AppHostEvent, AppHostEventMessage, AppHostFeature, AppHostMethod, AppHostMethodMap, AppHostPortMessage, AppHostReadyMessage, AppHostRequest, AppHostResponse, AppHostRetry, AppHostSystem, AppHostWindow, AppLifecycleFrame, AppUnloadReason, AppWindowMaterialState, AppWindowOpenHostInput, AppWindowStartupResult, AppWindowState, AppearancePreferences, AttachmentsMethod, AttachmentsMethodMap, AuxiliaryMethod, AuxiliaryMethodMap, AuxiliaryOptions, AuxiliaryReceipt, AuxiliaryRequest, AuxiliarySelection, AuxiliaryWireRequest, BindDesktopTarget, BrowserAnnotationRecord, BrowserAnnotationSnapshot, BrowserPage, CommandInvocation, CommandReceipt, CommandsMethod, CommandsMethodMap, ConnectParams, ConversationPreparationMethod, ConversationPreparationMethodMap, CreateWorktree, DesktopGitChange, DesktopMethod, DesktopMethodMap, DesktopNavigationTarget, DesktopOpener, DesktopRoot, DesktopSearch, DesktopTarget, DesktopTerminal, DesktopTerminalInfo, DesktopTerminalRequestOriginal, DesktopTerminalRequestReceipt, DesktopTerminalSnapshot, DesktopText, DesktopToolEvent, DesktopWindow, ExtensionOperation, ExtensionRequest, FetchDirection, GitStatus, JsonValue, LoginResult, ModelProviderConnection, ModelProviderRequest, NavigationCompletionStatus, PageFetchFrame, PluginAppActionReceipt, PluginAppActionResponse, PluginAppCatalog, PluginAppComposerContext, PluginAppHostState, PluginAppModelContext, PluginAppMount, PluginAppPreparedMessage, PluginAppPreparedTool, PluginAppRecord, PluginAppSource, PluginAppSubmissionReceipt, PluginAppToolPolicy, PresentationSnapshot, ProjectRequest, ProjectSnapshot, ProviderConnectionTestResult, ProviderDefaultsRequest, ProviderDefaultsSnapshot, ResourceCatalogMethod, ResourceCatalogMethodMap, ResourceChanged, RootReleaseReceipt, ServiceConnectionDescriptor, ServiceContext, ServiceHostFrame, ServiceHostMethod, ServiceHostMethodMap, ServiceInvocation, ServiceStatus, ServiceWork, ServiceWorkState, SessionResourceMethod, SessionSettingsTarget, SessionSettingsWireTarget, StorageGetResult, StoredFile, SystemEvent, SystemMethod, SystemMethodMap, SystemOpenInput, SystemOpenWireInput, SystemProject, SystemRequester, SystemShortcutId, WindowMethod, WindowMethodMap, WindowRequester, WindowStateChanged, WorkspaceDirectoryPage, WorkspaceFilePage, WorkspaceMethod, WorkspaceOperation, WorkspaceOperationKind, WorkspaceOperationOriginal, WorkspaceRef, WorkspaceSelection, WorkspaceText, WorktreeQuery, WorktreeReceipt };