@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.
@@ -40,286 +40,6 @@ interface ExecutionInstructions {
40
40
  content: string;
41
41
  }
42
42
 
43
- /** How an agent explains findings and delivers results, independently of update timing. */
44
- type ReplyStyle = "collaborative" | "direct" | "explanatory";
45
-
46
- /** Application choices; none of these fields grants access to a resource. */
47
- interface SessionConfigurationInput {
48
- model?: {
49
- provider: string;
50
- model: string;
51
- };
52
- roleId?: string | null;
53
- systemPrompt?: string | null;
54
- executionInstructions?: {
55
- revision: number;
56
- content: string;
57
- } | null;
58
- effort?: string | null;
59
- workMode?: "execute" | "plan";
60
- maxTurns?: number;
61
- sessionMode?: "direct" | "coordinator";
62
- replyStyle?: ReplyStyle;
63
- approvalMode?: "ask" | "auto_review" | "full_access";
64
- tools?: {
65
- allowed?: string[];
66
- denied?: string[];
67
- };
68
- pluginsEnabled?: boolean;
69
- pluginAutoSelectionEnabled?: boolean;
70
- activePluginId?: string | null;
71
- pluginIds?: string[];
72
- serviceBindings?: string[];
73
- memory?: {
74
- enabled: boolean;
75
- };
76
- }
77
- interface ResolvedSessionConfiguration extends Required<Omit<SessionConfigurationInput, "tools">> {
78
- tools: {
79
- allowed: string[];
80
- denied: string[];
81
- };
82
- }
83
- interface SessionConfigurationSnapshot {
84
- revision: number;
85
- configuration: ResolvedSessionConfiguration;
86
- configurationRoot: {
87
- cwd: string;
88
- settingsRoot: string;
89
- };
90
- }
91
- interface SessionCreationReceipt {
92
- dataScopeId: string;
93
- sessionId: string;
94
- requestId: string;
95
- action: "create-session";
96
- state: "prepared" | "completed" | "unknown";
97
- revision?: number;
98
- configuration?: SessionConfigurationSnapshot;
99
- }
100
- interface SessionConfigurationBinding {
101
- revision: number;
102
- /** Explicit creation choices plus subsequent editor deltas; never accepted as public metadata. */
103
- configurationInput?: SessionConfigurationInput;
104
- /** Original non-role defaults for fields that role selection can replace. */
105
- roleBaseConfiguration?: SessionConfigurationInput;
106
- effectiveConfiguration: ResolvedSessionConfiguration;
107
- resolvedResources: (ConfigurationResourceRef & {
108
- revision: string;
109
- })[];
110
- defaultsRevision: string;
111
- configurationRoot: {
112
- cwd: string;
113
- settingsRoot: string;
114
- };
115
- }
116
- interface ConfigurationResourceRef {
117
- kind: "model" | "role" | "tool" | "plugin" | "service" | "skill" | "mcp";
118
- id: string;
119
- }
120
-
121
- /** A directory's actual filesystem identity, captured by trusted execution code. */
122
- interface SessionExecutionRoot {
123
- readonly canonicalRoot: string;
124
- readonly rootIdentity: {
125
- readonly dev: string;
126
- readonly ino: string;
127
- };
128
- }
129
- /** Execution provenance describes a business relationship; it grants no access. */
130
- type SessionExecutionSource = {
131
- readonly kind: "interactive";
132
- } | {
133
- readonly kind: "channel";
134
- readonly conversationId: string;
135
- } | {
136
- readonly kind: "automation";
137
- readonly service: string;
138
- readonly sourceId: string;
139
- } | {
140
- readonly kind: "child";
141
- readonly sessionId: string;
142
- readonly runId: string;
143
- readonly childId: string;
144
- readonly postRunPurpose?: "review" | "maintenance";
145
- } | {
146
- readonly kind: "fork";
147
- readonly sessionId: string;
148
- readonly requestId: string;
149
- };
150
- /** Frozen alongside configuration when work is accepted, then copied to Input/Run. */
151
- interface SessionExecutionBinding {
152
- readonly version: 1;
153
- readonly cwd: SessionExecutionRoot;
154
- readonly settingsRoot: SessionExecutionRoot;
155
- readonly source: SessionExecutionSource;
156
- }
157
-
158
- /**
159
- * `closing` 表示 Session 正在停止当前工作并等待资源释放,此时不再接收新工作。
160
- * 等待结束后,Session 会进入不可逆的 archived 状态。
161
- */
162
- type SessionStatus = "idle" | "running" | "closing" | "archived" | "error";
163
- type SessionStorage = "sqlite" | "memory";
164
- interface SessionRecord {
165
- id: string;
166
- storage?: SessionStorage;
167
- parentId?: string;
168
- projectId?: string;
169
- cwd: string;
170
- cwdRelative?: string;
171
- title: string;
172
- model: string;
173
- agent?: string;
174
- status: SessionStatus;
175
- metadata: Record<string, unknown> & {
176
- configurationBinding?: SessionConfigurationBinding;
177
- executionBinding?: SessionExecutionBinding;
178
- };
179
- createdAt: number;
180
- updatedAt: number;
181
- archivedAt?: number;
182
- }
183
-
184
- interface WorkspaceConversationCreation {
185
- dataScopeId: string;
186
- requestId: string;
187
- sessionId: string;
188
- workspaceId?: string;
189
- outsideProject?: boolean;
190
- taskLocation: "current" | "worktree";
191
- configuration: SessionConfigurationInput;
192
- preparationRevision?: string;
193
- }
194
- interface WorkspaceConversationResult extends SessionCreationReceipt {
195
- session?: SessionRecord;
196
- operationState?: "prepared" | "running" | "completed" | "failed" | "unknown";
197
- indexBindingPending?: true;
198
- workspaceId?: string;
199
- executionRoot?: string;
200
- privateSessionId?: string;
201
- worktree?: {
202
- id: string;
203
- path: string;
204
- branch: string;
205
- sourceHead: string;
206
- projectId: string;
207
- projectPath: string;
208
- configDir: string;
209
- environment: "native" | "wsl";
210
- distribution?: string;
211
- };
212
- }
213
-
214
- interface ControlOption {
215
- id: string;
216
- name: string;
217
- }
218
- interface DraftComposerTarget {
219
- source: "instance";
220
- workspaceId?: string;
221
- outsideProject?: boolean;
222
- roleId?: string | null;
223
- }
224
- interface DraftComposerOptions {
225
- source: "instance";
226
- optionsRevision: string;
227
- skills: (ControlOption & {
228
- path: string;
229
- source?: string;
230
- })[];
231
- plugins: (ControlOption & {
232
- agents: ControlOption[];
233
- })[];
234
- }
235
- type SessionControlAction = "readContext" | "configure" | "compact" | "edit" | "fork" | "resume" | "goalRead" | "goalWrite" | "goalStop";
236
- interface SessionControls {
237
- dataScopeId: string;
238
- sessionId: string;
239
- source: "instance" | "auxiliary" | "im";
240
- revision: number;
241
- optionsRevision: string;
242
- actions: Record<SessionControlAction, boolean>;
243
- models: ControlOption[];
244
- roles: ControlOption[];
245
- efforts: ControlOption[];
246
- workModes: ControlOption[];
247
- permissionModes?: ControlOption[];
248
- appServiceBindings?: ControlOption[];
249
- skills: (ControlOption & {
250
- path: string;
251
- source?: string;
252
- })[];
253
- commands: ControlOption[];
254
- contexts: ControlOption[];
255
- plugins?: (ControlOption & {
256
- agents: ControlOption[];
257
- })[];
258
- }
259
- type SessionControlOriginal = {
260
- action: "compact";
261
- body: {
262
- requestId: string;
263
- expectedRevision: number;
264
- };
265
- } | {
266
- action: "fork";
267
- body: {
268
- requestId: string;
269
- id: string;
270
- copyHistory?: boolean;
271
- beforeMessageId?: string;
272
- afterMessageId?: string;
273
- storage?: "sqlite";
274
- };
275
- };
276
- interface SessionControlReceipt {
277
- dataScopeId: string;
278
- sessionId: string;
279
- requestId: string;
280
- action: SessionControlOriginal["action"] | "configure";
281
- state: "prepared" | "created" | "completed" | "unknown";
282
- revision?: number;
283
- targetSessionId?: string;
284
- }
285
- interface SessionControlMethodMap {
286
- "sessions.getDraftComposerOptions": {
287
- params: DraftComposerTarget;
288
- result: DraftComposerOptions;
289
- };
290
- "sessions.createConversation": {
291
- params: WorkspaceConversationCreation;
292
- result: WorkspaceConversationResult;
293
- };
294
- "sessions.bindConversationIndex": {
295
- params: {
296
- original: WorkspaceConversationCreation;
297
- dataScopeId: string;
298
- };
299
- result: WorkspaceConversationResult;
300
- };
301
- "sessions.getConversationCreationResult": {
302
- params: WorkspaceConversationCreation;
303
- result: WorkspaceConversationResult | null;
304
- };
305
- "sessions.getControls": {
306
- params: {
307
- connectionId: string;
308
- sessionId: string;
309
- };
310
- result: SessionControls;
311
- };
312
- "sessions.getControlResult": {
313
- params: {
314
- connectionId?: string;
315
- requestId: string;
316
- sessionId: string;
317
- original: SessionControlOriginal;
318
- };
319
- result: SessionControlReceipt | null;
320
- };
321
- }
322
-
323
43
  interface ServiceWork {
324
44
  requestId: string;
325
45
  state: ServiceWorkState;
@@ -441,7 +161,7 @@ type Entry<P, R> = {
441
161
  params: P;
442
162
  result: R;
443
163
  };
444
- interface ServiceHostMethodMap extends Pick<SessionControlMethodMap, "sessions.getControls" | "sessions.getControlResult"> {
164
+ interface ServiceHostMethodMap {
445
165
  "secrets.get": Entry<{
446
166
  key: string;
447
167
  }, string | null>;
@@ -464,11 +184,6 @@ interface ServiceHostMethodMap extends Pick<SessionControlMethodMap, "sessions.g
464
184
  id: string;
465
185
  name: string;
466
186
  }[]>;
467
- "agent.listRoles": Entry<Record<string, never>, {
468
- id: string;
469
- name: string;
470
- description: string;
471
- }[]>;
472
187
  "agent.getConnection": Entry<{
473
188
  workspaceId?: string;
474
189
  executionRoot?: string;
@@ -507,7 +222,7 @@ interface ServiceHostMethodMap extends Pick<SessionControlMethodMap, "sessions.g
507
222
  }, ServiceWork | null>;
508
223
  }
509
224
  type ServiceHostMethod = keyof ServiceHostMethodMap;
510
- 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"];
225
+ 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"];
511
226
  declare const SERVICE_HOST_MAX_FRAME_BYTES: number;
512
227
  declare const SERVICE_HOST_MAX_PENDING = 64;
513
228
  declare const validServiceContext: (v: unknown) => v is ServiceContext;
@@ -548,6 +263,64 @@ type ServiceHostFrame = PageFetchFrame | {
548
263
  };
549
264
  declare function isServiceHostFrame(v: unknown): v is ServiceHostFrame;
550
265
 
266
+ /** How an agent explains findings and delivers results, independently of update timing. */
267
+ type ReplyStyle = "collaborative" | "direct" | "explanatory";
268
+
269
+ interface ControlOption {
270
+ id: string;
271
+ name: string;
272
+ }
273
+ type SessionControlAction = "readContext" | "configure" | "compact" | "edit" | "fork" | "resume" | "goalRead" | "goalWrite" | "goalStop";
274
+ interface SessionControls {
275
+ dataScopeId: string;
276
+ sessionId: string;
277
+ source: "instance" | "auxiliary" | "im";
278
+ revision: number;
279
+ optionsRevision: string;
280
+ actions: Record<SessionControlAction, boolean>;
281
+ models: ControlOption[];
282
+ roles: ControlOption[];
283
+ efforts: ControlOption[];
284
+ workModes: ControlOption[];
285
+ permissionModes?: ControlOption[];
286
+ appServiceBindings?: ControlOption[];
287
+ skills: (ControlOption & {
288
+ path: string;
289
+ source?: string;
290
+ })[];
291
+ commands: ControlOption[];
292
+ contexts: ControlOption[];
293
+ plugins?: (ControlOption & {
294
+ agents: ControlOption[];
295
+ })[];
296
+ }
297
+ type SessionControlOriginal = {
298
+ action: "compact";
299
+ body: {
300
+ requestId: string;
301
+ expectedRevision: number;
302
+ };
303
+ } | {
304
+ action: "fork";
305
+ body: {
306
+ requestId: string;
307
+ id: string;
308
+ copyHistory?: boolean;
309
+ beforeMessageId?: string;
310
+ afterMessageId?: string;
311
+ storage?: "sqlite";
312
+ };
313
+ };
314
+ interface SessionControlReceipt {
315
+ dataScopeId: string;
316
+ sessionId: string;
317
+ requestId: string;
318
+ action: SessionControlOriginal["action"] | "configure";
319
+ state: "prepared" | "created" | "completed" | "unknown";
320
+ revision?: number;
321
+ targetSessionId?: string;
322
+ }
323
+
551
324
  interface AppAgentModel {
552
325
  id: string;
553
326
  name: string;
@@ -580,11 +353,6 @@ interface AppHostAgent {
580
353
  privateSessionId?: string;
581
354
  }): Promise<AgentConnection>;
582
355
  listModels(): Promise<AppAgentModel[]>;
583
- listRoles(): Promise<{
584
- id: string;
585
- name: string;
586
- description: string;
587
- }[]>;
588
356
  resolveSkills(skillIds: string[]): Promise<{
589
357
  type: "skill";
590
358
  name: string;
@@ -592,19 +360,6 @@ interface AppHostAgent {
592
360
  }[]>;
593
361
  }
594
362
 
595
- interface AppHostSessionControls {
596
- getControls(input: {
597
- connection: AgentConnection;
598
- sessionId: string;
599
- }): Promise<SessionControls>;
600
- getControlResult(input: {
601
- connection?: AgentConnection;
602
- requestId: string;
603
- sessionId: string;
604
- original: SessionControlOriginal;
605
- }): Promise<SessionControlReceipt | null>;
606
- }
607
-
608
363
  interface TextBlock {
609
364
  type: "text";
610
365
  text: string;
@@ -1633,13 +1388,7 @@ interface AppServiceHost {
1633
1388
  resolveInvocation(ticket: string): Promise<ServiceInvocation>;
1634
1389
  };
1635
1390
  agent: AppHostAgent;
1636
- sessions: Pick<AppHostSessionControls, "getControls"> & {
1637
- getControlResult(input: {
1638
- connection: AgentConnection;
1639
- sessionId: string;
1640
- requestId: string;
1641
- original: SessionControlOriginal;
1642
- }): Promise<SessionControlReceipt | null>;
1391
+ sessions: {
1643
1392
  getConnection(input: {
1644
1393
  dataScopeId: string;
1645
1394
  sessionId: string;