atomix-cli 1.3.0 → 1.4.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.
package/dist/session.d.ts CHANGED
@@ -31,6 +31,8 @@ export interface SessionCoreApi {
31
31
  updatePermissionMode(mode: PermissionMode): void;
32
32
  getPermissionMode(): PermissionMode;
33
33
  interruptSession(): unknown;
34
+ /** 处理中插入用户消息(不打断当前轮):processing 时入队返回 true,否则 false 且不入队 */
35
+ injectUserInput(input: string, originalInput?: string): boolean;
34
36
  getCurrentSessionId(): string | null;
35
37
  respondToToolPermission(response: {
36
38
  toolName: string;
@@ -207,6 +209,13 @@ export interface AtomixSession<C extends SessionCoreApi = SessionCoreApi> {
207
209
  readonly notes: string[];
208
210
  /** 发送一条用户输入,等到本轮 idle 后返回。多次调用按序排队 */
209
211
  send(input: string, opts?: SendOptions): Promise<SendResult>;
212
+ /**
213
+ * 处理中插入用户消息(§11):不打断进行中的 send,在当前工具批次结束后追加到工具结果之后
214
+ * (模型无工具收尾时作为新用户消息在同一轮内续跑,send 的 texts 会多出续跑的回复)。
215
+ * 返回 true = 已排队;false = 此刻没有进行中的一轮(什么都没发生,应改用 send)。
216
+ * 中断 / 本轮未经排空点结束时排队消息被丢弃,以 input_dropped 事件告知。注入内容原样进对话,不走命令 / @文件引用。
217
+ */
218
+ inject(input: string): boolean;
210
219
  on<T>(event: string, listener: (data: T) => void): void;
211
220
  off<T>(event: string, listener: (data: T) => void): void;
212
221
  /** 立即结束:中断进行中的一轮(其 send 以 error.type='disposed' 返回),排队中的 send 拒绝,再释放 core */
@@ -291,6 +300,23 @@ export type StreamEvent = {
291
300
  type: "interrupted";
292
301
  agentId: string;
293
302
  content: string;
303
+ }
304
+ /** 处理中插入的消息已排队(pending = 队列长度)/ 已拼进对话(mode:tool_result = 追加在工具结果后;turn = 无工具收尾时作为新用户消息续跑)/ 被丢弃 */
305
+ | {
306
+ type: "input_queued";
307
+ agentId: string;
308
+ text: string;
309
+ pending: number;
310
+ } | {
311
+ type: "input_injected";
312
+ agentId: string;
313
+ text: string;
314
+ mode: "tool_result" | "turn";
315
+ } | {
316
+ type: "input_dropped";
317
+ agentId: string;
318
+ texts: string[];
319
+ reason: "interrupted" | "turn_ended";
294
320
  } | {
295
321
  type: "error";
296
322
  errorType: string;
@@ -349,6 +375,15 @@ export type ServeRequest = {
349
375
  session: string;
350
376
  };
351
377
  }
378
+ /** 处理中插入消息(§11):不排队、不打断进行中的 send;queued:false = 此刻没有进行中的一轮。控制面请求,不受在途上限约束 */
379
+ | {
380
+ id: string | number;
381
+ op: "session.inject";
382
+ params: {
383
+ session: string;
384
+ input: string;
385
+ };
386
+ }
352
387
  /** close 排在该会话前面的 send 之后;force = 先中止进行中与排队中的 send(它们以 aborted 返回)再关 */
353
388
  | {
354
389
  id: string | number;
@@ -451,6 +486,9 @@ export interface ServeAttachResult extends ServeSessionInfo {
451
486
  export type ServeResult = ServeOpenResult | ServeSendResult | {
452
487
  sessionId: string;
453
488
  interrupted: number;
489
+ } | {
490
+ sessionId: string;
491
+ queued: boolean;
454
492
  } | {
455
493
  sessionId: string;
456
494
  closed: true;