qlogicagent 1.1.0 → 1.2.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.
Files changed (66) hide show
  1. package/dist/agent.js +8 -6
  2. package/dist/cli.js +258 -214
  3. package/dist/index.js +258 -214
  4. package/dist/orchestration.js +12 -9
  5. package/dist/types/agent/tool-loop.d.ts +22 -0
  6. package/dist/types/agent/types.d.ts +32 -0
  7. package/dist/types/cli/stdio-server.d.ts +96 -1
  8. package/dist/types/cli/tool-bootstrap.d.ts +8 -1
  9. package/dist/types/llm/gemini-schema-utils.d.ts +17 -0
  10. package/dist/types/llm/index.d.ts +11 -2
  11. package/dist/types/llm/media-transport.d.ts +28 -3
  12. package/dist/types/llm/model-detection.d.ts +22 -0
  13. package/dist/types/llm/provider-def.d.ts +17 -4
  14. package/dist/types/llm/transport.d.ts +60 -2
  15. package/dist/types/llm/transports/gemini-cache-api.d.ts +86 -0
  16. package/dist/types/llm/transports/gemini-file-api.d.ts +90 -0
  17. package/dist/types/llm/transports/gemini-generatecontent.d.ts +52 -0
  18. package/dist/types/llm/transports/gemini-lyria-realtime.d.ts +117 -0
  19. package/dist/types/llm/transports/gemini-media.d.ts +40 -8
  20. package/dist/types/llm/transports/minimax-media.d.ts +34 -5
  21. package/dist/types/llm/transports/openai-responses.d.ts +60 -0
  22. package/dist/types/llm/transports/qwen-media.d.ts +32 -7
  23. package/dist/types/llm/transports/realtime-transport.d.ts +1 -1
  24. package/dist/types/llm/transports/volcengine-media.d.ts +10 -2
  25. package/dist/types/llm/transports/zhipu-media.d.ts +24 -2
  26. package/dist/types/orchestration/agent-instance.d.ts +58 -0
  27. package/dist/types/orchestration/dag-scheduler.d.ts +72 -0
  28. package/dist/types/orchestration/product-budget.d.ts +56 -0
  29. package/dist/types/orchestration/product-checkpoint.d.ts +46 -0
  30. package/dist/types/orchestration/product-persistence.d.ts +40 -0
  31. package/dist/types/orchestration/product-worktree.d.ts +13 -0
  32. package/dist/types/orchestration/solo-evaluator.d.ts +59 -0
  33. package/dist/types/orchestration/subagent/fork-subagent.d.ts +2 -0
  34. package/dist/types/orchestration/subagent/task-types.d.ts +4 -0
  35. package/dist/types/orchestration/tool-cascade.d.ts +2 -2
  36. package/dist/types/protocol/methods.d.ts +92 -0
  37. package/dist/types/protocol/notifications.d.ts +162 -0
  38. package/dist/types/runtime/infra/acp-detector.d.ts +36 -0
  39. package/dist/types/runtime/infra/acp-detector.test.d.ts +1 -0
  40. package/dist/types/runtime/infra/acp-protocol-adapter.d.ts +73 -0
  41. package/dist/types/runtime/infra/acp-protocol-adapter.test.d.ts +1 -0
  42. package/dist/types/runtime/infra/acp-types.d.ts +397 -0
  43. package/dist/types/runtime/infra/acp-usage-tracker.d.ts +46 -0
  44. package/dist/types/runtime/infra/acp-usage-tracker.test.d.ts +1 -0
  45. package/dist/types/runtime/infra/agent-config-store.d.ts +30 -0
  46. package/dist/types/runtime/infra/agent-config-store.test.d.ts +1 -0
  47. package/dist/types/runtime/infra/agent-paths.d.ts +8 -0
  48. package/dist/types/runtime/infra/agent-process.d.ts +280 -0
  49. package/dist/types/runtime/infra/agent-process.test.d.ts +1 -0
  50. package/dist/types/runtime/infra/index.d.ts +10 -0
  51. package/dist/types/runtime/infra/mcp-bridge.d.ts +166 -0
  52. package/dist/types/runtime/infra/mcp-bridge.test.d.ts +1 -0
  53. package/dist/types/runtime/infra/model-id-translator.d.ts +22 -0
  54. package/dist/types/runtime/infra/model-id-translator.test.d.ts +1 -0
  55. package/dist/types/runtime/infra/skill-injector.d.ts +51 -0
  56. package/dist/types/runtime/infra/skill-injector.test.d.ts +1 -0
  57. package/dist/types/runtime/infra/worktree-backend.d.ts +1 -0
  58. package/dist/types/runtime/prompt/environment-context.d.ts +6 -0
  59. package/dist/types/runtime/session/session-persistence.d.ts +9 -8
  60. package/dist/types/runtime/session/session-state.d.ts +3 -31
  61. package/dist/types/skills/index.d.ts +2 -10
  62. package/dist/types/skills/tools/skill-tool.d.ts +101 -0
  63. package/dist/types/skills/tools/team-tool.d.ts +23 -1
  64. package/package.json +1 -1
  65. package/dist/types/runtime/session/session-memory.d.ts +0 -90
  66. package/dist/types/skills/memory/memory-extractor.d.ts +0 -64
@@ -10,6 +10,7 @@
10
10
  */
11
11
  import type { TokenUsage } from "../agent/types.js";
12
12
  import type { TodoItem } from "../contracts/todo.js";
13
+ import type { AgentSource } from "../runtime/infra/acp-types.js";
13
14
  /** Embedded thread item for clients using the Thread protocol. */
14
15
  export interface NotificationThreadItem {
15
16
  id: string;
@@ -37,6 +38,7 @@ export interface TurnDeltaNotification {
37
38
  turnId: string;
38
39
  text: string;
39
40
  item?: NotificationThreadItem;
41
+ agentSource?: AgentSource;
40
42
  }
41
43
  /** Turn completed successfully. */
42
44
  export interface TurnEndNotification {
@@ -46,6 +48,7 @@ export interface TurnEndNotification {
46
48
  model?: string;
47
49
  provider?: string;
48
50
  item?: NotificationThreadItem;
51
+ agentSource?: AgentSource;
49
52
  }
50
53
  /** Turn failed. */
51
54
  export interface TurnErrorNotification {
@@ -68,6 +71,7 @@ export interface TurnToolCallNotification {
68
71
  /** Serialized arguments JSON. Enables UI to display "searching for X", "reading file Y". */
69
72
  arguments?: string;
70
73
  item?: NotificationThreadItem;
74
+ agentSource?: AgentSource;
71
75
  }
72
76
  /**
73
77
  * Tool execution completed.
@@ -141,6 +145,16 @@ export interface TurnSubagentEndedNotification {
141
145
  outputPreview?: string;
142
146
  error?: string;
143
147
  }
148
+ /** URL citations / file citations returned by OpenAI built-in tools. */
149
+ export interface TurnAnnotationsNotification {
150
+ turnId: string;
151
+ annotations: Array<{
152
+ type: string;
153
+ url?: string;
154
+ title?: string;
155
+ [key: string]: unknown;
156
+ }>;
157
+ }
144
158
  export type MediaResultType = "image" | "tts" | "video";
145
159
  /** Structured media generation result — enables media preview cards. */
146
160
  export interface TurnMediaResultNotification {
@@ -162,6 +176,21 @@ export interface TurnMediaResultNotification {
162
176
  /** Billing info. */
163
177
  billingUnit?: string;
164
178
  billingQuantity?: number;
179
+ /** Backend task ID — for progress querying / cancellation. */
180
+ taskId?: string;
181
+ }
182
+ /** Async media generation progress — emitted during polling for video/music/3D tasks. */
183
+ export interface TurnMediaProgressNotification {
184
+ turnId: string;
185
+ /** Backend task ID (provider-specific). */
186
+ taskId: string;
187
+ mediaType: MediaResultType;
188
+ /** Estimated progress (0-100). */
189
+ percent: number;
190
+ /** Provider status label (e.g. "queuing", "running", "processing"). */
191
+ status: string;
192
+ /** Provider id. */
193
+ provider?: string;
165
194
  }
166
195
  /** Full todo list updated — enables DeerFlow-style todo panel sync. */
167
196
  export interface TurnTodosUpdatedNotification {
@@ -188,6 +217,16 @@ export interface TurnExecProgressNotification {
188
217
  totalLines: number;
189
218
  totalBytes: number;
190
219
  }
220
+ /** Generic progress heartbeat (e.g. builtin tool status). */
221
+ export interface TurnHeartbeatNotification {
222
+ turnId: string;
223
+ message: string;
224
+ }
225
+ /** Human-readable summary of a tool use batch. */
226
+ export interface TurnToolUseSummaryNotification {
227
+ turnId: string;
228
+ summary: string;
229
+ }
191
230
  export type ArtifactType = "code" | "file" | "image" | "document" | "diagram" | "table";
192
231
  /** Structured artifact produced by the agent — enables Canvas-style rendering. */
193
232
  export interface TurnArtifactNotification {
@@ -218,6 +257,18 @@ export interface TurnSkillInstructionNotification {
218
257
  turnId: string;
219
258
  instruction: unknown;
220
259
  }
260
+ /** Agent asks the user a clarifying question mid-turn. Host presents UI, then responds via thread.user_response. */
261
+ export interface TurnAskUserNotification {
262
+ requestId: string;
263
+ questions: Array<{
264
+ header: string;
265
+ question: string;
266
+ options?: Array<{
267
+ label: string;
268
+ description?: string;
269
+ }>;
270
+ }>;
271
+ }
221
272
  /** Memory content changed (local md or QMemory). */
222
273
  export interface MemoryUpdatedNotification {
223
274
  source: string;
@@ -251,8 +302,21 @@ export interface TeamUpdatedNotification {
251
302
  members?: Array<{
252
303
  agentName: string;
253
304
  role: string;
305
+ worktreePath?: string;
306
+ pid?: number;
254
307
  }>;
255
308
  }
309
+ /** Forwarded notification from a team member child process. */
310
+ export interface TeamMemberNotification {
311
+ memberId: string;
312
+ method: string;
313
+ params: unknown;
314
+ }
315
+ /** Team member child process state change. */
316
+ export interface TeamMemberStateNotification {
317
+ memberId: string;
318
+ state: "starting" | "ready" | "running" | "completed" | "failed" | "killed";
319
+ }
256
320
  export interface PongNotification {
257
321
  }
258
322
  /** Real-time token usage update (emitted after each LLM call within a turn). */
@@ -263,6 +327,86 @@ export interface TurnUsageUpdateNotification {
263
327
  /** Cumulative cost estimate for this session (USD). */
264
328
  sessionCostUSD?: number;
265
329
  }
330
+ /** Agent status change notification. */
331
+ export interface AgentsStatusNotification {
332
+ agentId: string;
333
+ status: "available" | "spawning" | "running" | "hang" | "failed" | "unavailable";
334
+ health?: {
335
+ missedBeats: number;
336
+ lastActiveAt: string;
337
+ };
338
+ usage?: {
339
+ inputTokens: number;
340
+ outputTokens: number;
341
+ totalTokens: number;
342
+ };
343
+ error?: {
344
+ phase: string;
345
+ message: string;
346
+ retriesLeft: number;
347
+ };
348
+ }
349
+ /** Agent error notification. */
350
+ export interface AgentsErrorNotification {
351
+ agentId: string;
352
+ phase: "detect" | "spawn" | "handshake" | "runtime" | "shutdown" | "heartbeat";
353
+ error: string;
354
+ retriesLeft: number;
355
+ }
356
+ /** Solo agent progress notification. */
357
+ export interface SoloProgressNotification {
358
+ soloId: string;
359
+ agentId: string;
360
+ state: "pending" | "running" | "completed" | "failed";
361
+ progress?: string;
362
+ }
363
+ /** Solo evaluation completed notification. */
364
+ export interface SoloEvaluationNotification {
365
+ soloId: string;
366
+ winnerId: string;
367
+ reasoning: string;
368
+ }
369
+ /** Solo agent streaming delta — text output from a competing agent. */
370
+ export interface SoloAgentDeltaNotification {
371
+ soloId: string;
372
+ agentId: string;
373
+ text: string;
374
+ }
375
+ /** Product task started. */
376
+ export interface ProductTaskStartedNotification {
377
+ productId: string;
378
+ taskId: string;
379
+ assignee: string;
380
+ }
381
+ /** Product task completed. */
382
+ export interface ProductTaskCompletedNotification {
383
+ productId: string;
384
+ taskId: string;
385
+ result: string;
386
+ }
387
+ /** Product task failed. */
388
+ export interface ProductTaskFailedNotification {
389
+ productId: string;
390
+ taskId: string;
391
+ error: string;
392
+ }
393
+ /** Product checkpoint saved. */
394
+ export interface ProductCheckpointedNotification {
395
+ productId: string;
396
+ timestamp: string;
397
+ }
398
+ /** Product budget warning (>80%). */
399
+ export interface ProductBudgetWarningNotification {
400
+ productId: string;
401
+ usedTokens: number;
402
+ maxTotalTokens: number;
403
+ percentage: number;
404
+ }
405
+ /** Product completed (all tasks done or terminal). */
406
+ export interface ProductCompletedNotification {
407
+ productId: string;
408
+ summary: string;
409
+ }
266
410
  export interface NotificationMethodMap {
267
411
  "turn.start": TurnStartNotification;
268
412
  "turn.delta": TurnDeltaNotification;
@@ -278,19 +422,37 @@ export interface NotificationMethodMap {
278
422
  "turn.subagent_started": TurnSubagentStartedNotification;
279
423
  "turn.subagent_delta": TurnSubagentDeltaNotification;
280
424
  "turn.subagent_ended": TurnSubagentEndedNotification;
425
+ "turn.annotations": TurnAnnotationsNotification;
281
426
  "turn.media_result": TurnMediaResultNotification;
427
+ "turn.media_progress": TurnMediaProgressNotification;
282
428
  "turn.todos_updated": TurnTodosUpdatedNotification;
283
429
  "task.updated": TaskUpdatedNotification;
284
430
  "turn.exec_progress": TurnExecProgressNotification;
431
+ "turn.heartbeat": TurnHeartbeatNotification;
432
+ "turn.tool_use_summary": TurnToolUseSummaryNotification;
285
433
  "turn.artifact": TurnArtifactNotification;
286
434
  "tool.approval.request": ToolApprovalRequestNotification;
287
435
  "turn.skill_instruction": TurnSkillInstructionNotification;
436
+ "turn.ask_user": TurnAskUserNotification;
288
437
  "memory.updated": MemoryUpdatedNotification;
289
438
  "session.info": SessionInfoNotification;
290
439
  "permission.rule_updated": PermissionRuleUpdatedNotification;
291
440
  "team.updated": TeamUpdatedNotification;
441
+ "team.member.notification": TeamMemberNotification;
442
+ "team.member.state": TeamMemberStateNotification;
292
443
  "turn.usage_update": TurnUsageUpdateNotification;
293
444
  "pong": PongNotification;
445
+ "agents.status": AgentsStatusNotification;
446
+ "agents.error": AgentsErrorNotification;
447
+ "solo.progress": SoloProgressNotification;
448
+ "solo.evaluation": SoloEvaluationNotification;
449
+ "solo.agentDelta": SoloAgentDeltaNotification;
450
+ "product.taskStarted": ProductTaskStartedNotification;
451
+ "product.taskCompleted": ProductTaskCompletedNotification;
452
+ "product.taskFailed": ProductTaskFailedNotification;
453
+ "product.checkpointed": ProductCheckpointedNotification;
454
+ "product.budgetWarning": ProductBudgetWarningNotification;
455
+ "product.completed": ProductCompletedNotification;
294
456
  }
295
457
  /** All known notification method names. */
296
458
  export type NotificationMethod = keyof NotificationMethodMap;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * ACP Agent Detector — scans PATH for installed ACP-compatible CLI agents.
3
+ *
4
+ * Uses `which` (Unix) / `where` (Windows) to locate CLI binaries,
5
+ * then optionally probes version. Results are cached with TTL.
6
+ *
7
+ * Reference: AionUI AcpDetector + ACP_BACKENDS_ALL registry.
8
+ */
9
+ import type { AcpBackendConfig, AgentDescriptor, AgentConfigStoreData } from "./acp-types.js";
10
+ export declare const ACP_BACKENDS: Record<string, AcpBackendConfig>;
11
+ export declare class AcpDetector {
12
+ private cache;
13
+ private configStore;
14
+ /**
15
+ * Provide the config store data so detector can populate `hasConfig` field
16
+ * and include user-registered custom agents.
17
+ */
18
+ setConfigStore(data: AgentConfigStoreData): void;
19
+ /**
20
+ * Scan for installed ACP agent CLIs.
21
+ * @param force - Clear cache and re-scan.
22
+ */
23
+ scan(force?: boolean): AgentDescriptor[];
24
+ /** Return cached results without IO. */
25
+ list(): AgentDescriptor[];
26
+ /** Clear the detection cache. */
27
+ clearCache(): void;
28
+ private detectBackend;
29
+ private detectCustomAgent;
30
+ private hasAgentConfig;
31
+ /**
32
+ * Build an ExternalAgentDescriptor suitable for AgentProcessManager.spawn().
33
+ * Returns null if the agent is not available.
34
+ */
35
+ buildExternalDescriptor(agentId: string): import("./acp-types.js").ExternalAgentDescriptor | null;
36
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,73 @@
1
+ /**
2
+ * ACP Protocol Adapter — translates between qlogicagent's internal JSON-RPC
3
+ * protocol and the ACP (Agent-Client Protocol) wire format.
4
+ *
5
+ * ACP = JSON-RPC 2.0 over stdio with different method names:
6
+ * initialize → initialize (compatible)
7
+ * session/new → create session with workspaceRoot + mcpServers
8
+ * prompt → send task
9
+ * session/close → abort
10
+ * message notifications → turn.delta / turn.end
11
+ *
12
+ * Reference: AionUI AcpAgentManager, ACP protocol spec.
13
+ */
14
+ import type { ChildProcess } from "node:child_process";
15
+ import type { AcpInitializeResult, AcpSessionResult, AcpPromptResponse, McpServerConfig } from "./acp-types.js";
16
+ /** Internal representation of an ACP notification translated to qlogicagent format. */
17
+ export interface TranslatedNotification {
18
+ method: string;
19
+ params: Record<string, unknown>;
20
+ }
21
+ export declare class AcpProtocolAdapter {
22
+ private pendingRpcs;
23
+ private rl;
24
+ private onNotification;
25
+ /**
26
+ * Attach to a child process's stdio for ACP communication.
27
+ * Must be called before any RPC methods.
28
+ */
29
+ attach(child: ChildProcess, onNotification?: (method: string, params: unknown) => void): void;
30
+ /** Detach from the child process. */
31
+ detach(): void;
32
+ /** Send a raw JSON-RPC request and await response. */
33
+ sendRpc(child: ChildProcess, method: string, params?: unknown, timeoutMs?: number): Promise<unknown>;
34
+ /**
35
+ * Perform ACP initialize handshake.
36
+ * Permissive: fallback protocolVersion to 0 if missing.
37
+ * Extracts `supportsResume` from capabilities for D-1 session resume.
38
+ */
39
+ initialize(child: ChildProcess): Promise<AcpInitializeResult>;
40
+ /**
41
+ * Create an ACP session.
42
+ * Optionally injects MCP servers and system prompt.
43
+ */
44
+ createSession(child: ChildProcess, options: {
45
+ workspaceRoot: string;
46
+ mcpServers?: McpServerConfig[];
47
+ systemPrompt?: string;
48
+ }): Promise<AcpSessionResult>;
49
+ /**
50
+ * Send a prompt to a running ACP session.
51
+ * Returns the complete response.
52
+ */
53
+ sendPrompt(child: ChildProcess, sessionId: string, content: string, timeoutMs?: number): Promise<AcpPromptResponse>;
54
+ /**
55
+ * Resume an existing ACP session (D-1).
56
+ * Only call if the agent's capabilities.supportsResume is true.
57
+ * Falls back to createSession + summary injection if session/resume fails.
58
+ */
59
+ resumeSession(child: ChildProcess, sessionId: string, options?: {
60
+ workspaceRoot?: string;
61
+ mcpServers?: McpServerConfig[];
62
+ summary?: string;
63
+ }): Promise<AcpSessionResult>;
64
+ /**
65
+ * Close an ACP session.
66
+ */
67
+ closeSession(child: ChildProcess, sessionId: string): Promise<void>;
68
+ /**
69
+ * Translate an ACP notification into qlogicagent's internal format.
70
+ * Returns null if the notification is not translatable (handled separately).
71
+ */
72
+ static translateNotification(method: string, params: unknown): TranslatedNotification | null;
73
+ }