qlogicagent 2.6.1 → 2.9.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 (137) hide show
  1. package/dist/agent.js +19 -17
  2. package/dist/cli.js +634 -367
  3. package/dist/index.js +631 -364
  4. package/dist/orchestration.js +15 -15
  5. package/dist/protocol.js +1 -1
  6. package/dist/types/agent/agent.d.ts +4 -1
  7. package/dist/types/agent/tool-loop.d.ts +3 -1
  8. package/dist/types/agent/tunable-defaults.d.ts +22 -1
  9. package/dist/types/agent/types.d.ts +7 -9
  10. package/dist/types/cli/handlers/agents-handler.d.ts +19 -0
  11. package/dist/types/cli/handlers/config-handler.d.ts +17 -0
  12. package/dist/types/cli/handlers/dream-handler.d.ts +5 -0
  13. package/dist/types/cli/handlers/files-handler.d.ts +15 -0
  14. package/dist/types/cli/handlers/media-handler.d.ts +13 -0
  15. package/dist/types/cli/handlers/memory-handler.d.ts +11 -0
  16. package/dist/types/cli/handlers/pet-handler.d.ts +21 -0
  17. package/dist/types/cli/handlers/product-handler.d.ts +32 -0
  18. package/dist/types/cli/handlers/project-handler.d.ts +19 -0
  19. package/dist/types/cli/handlers/session-handler.d.ts +38 -0
  20. package/dist/types/cli/handlers/settings-handler.d.ts +24 -0
  21. package/dist/types/cli/handlers/skills-handler.d.ts +20 -0
  22. package/dist/types/cli/handlers/solo-handler.d.ts +15 -0
  23. package/dist/types/cli/handlers/turn-handler.d.ts +17 -0
  24. package/dist/types/cli/main.d.ts +2 -2
  25. package/dist/types/cli/stdio-server.d.ts +94 -100
  26. package/dist/types/cli/tool-bootstrap.d.ts +7 -8
  27. package/dist/types/config/config.d.ts +1 -1
  28. package/dist/types/index.d.ts +2 -2
  29. package/dist/types/llm/index.d.ts +1 -31
  30. package/dist/types/orchestration/dag-scheduler.d.ts +46 -0
  31. package/dist/types/orchestration/index.d.ts +1 -1
  32. package/dist/types/orchestration/product-planner.d.ts +146 -0
  33. package/dist/types/orchestration/skill-improvement.d.ts +39 -0
  34. package/dist/types/orchestration/solo-evaluator.d.ts +26 -6
  35. package/dist/types/orchestration/solo-persistence.d.ts +5 -0
  36. package/dist/types/orchestration/tool-cascade.d.ts +2 -2
  37. package/dist/types/protocol/methods.d.ts +189 -6
  38. package/dist/types/protocol/notifications.d.ts +1 -1
  39. package/dist/types/protocol/wire/acp-protocol.d.ts +7 -0
  40. package/dist/types/protocol/wire/agent-events.d.ts +2 -2
  41. package/dist/types/protocol/wire/agent-methods.d.ts +6 -4
  42. package/dist/types/protocol/wire/gateway-rpc.d.ts +77 -4
  43. package/dist/types/protocol/wire/index.d.ts +1 -1
  44. package/dist/types/protocol/wire/memory-provider-lifecycle.d.ts +3 -1
  45. package/dist/types/protocol/wire/notification-payloads.d.ts +124 -4
  46. package/dist/types/runtime/execution/dream-agent.d.ts +33 -6
  47. package/dist/types/runtime/execution/forked-agent.d.ts +1 -1
  48. package/dist/types/runtime/execution/memory-decay.d.ts +17 -5
  49. package/dist/types/runtime/hooks/context-compression.d.ts +1 -1
  50. package/dist/types/runtime/hooks/memory-hooks.d.ts +10 -1
  51. package/dist/types/runtime/infra/acp-types.d.ts +92 -0
  52. package/dist/types/runtime/infra/agent-paths.d.ts +22 -25
  53. package/dist/types/runtime/infra/agent-process.d.ts +1 -1
  54. package/dist/types/runtime/infra/builtin-providers.d.ts +36 -0
  55. package/dist/types/runtime/infra/checkpoint-backend.d.ts +1 -1
  56. package/dist/types/runtime/infra/index.d.ts +1 -2
  57. package/dist/types/runtime/infra/key-pool.d.ts +120 -0
  58. package/dist/types/runtime/infra/media-persistence.d.ts +26 -15
  59. package/dist/types/runtime/infra/model-registry.d.ts +187 -0
  60. package/dist/types/runtime/infra/project-instructions-store.d.ts +3 -3
  61. package/dist/types/runtime/infra/project-store.d.ts +3 -0
  62. package/dist/types/runtime/infra/token-budget.d.ts +2 -2
  63. package/dist/types/runtime/infra/worktree-backend.d.ts +1 -1
  64. package/dist/types/runtime/pet/index.d.ts +8 -0
  65. package/dist/types/runtime/pet/pet-context-injection.d.ts +8 -0
  66. package/dist/types/runtime/pet/pet-file-loader.d.ts +62 -0
  67. package/dist/types/runtime/pet/pet-growth-engine.d.ts +60 -0
  68. package/dist/types/runtime/pet/pet-reaction-service.d.ts +33 -0
  69. package/dist/types/runtime/pet/pet-soul-service.d.ts +71 -0
  70. package/dist/types/runtime/prompt/environment-context.d.ts +10 -0
  71. package/dist/types/runtime/prompt/index.d.ts +1 -1
  72. package/dist/types/runtime/session/group-session-split.d.ts +38 -0
  73. package/dist/types/runtime/session/index.d.ts +4 -2
  74. package/dist/types/runtime/session/session-locator.d.ts +24 -0
  75. package/dist/types/runtime/session/session-memory.d.ts +4 -4
  76. package/dist/types/runtime/session/session-persistence.d.ts +47 -46
  77. package/dist/types/runtime/session/session-state.d.ts +3 -5
  78. package/dist/types/skills/index.d.ts +8 -2
  79. package/dist/types/skills/memory/implicit-extraction.d.ts +58 -0
  80. package/dist/types/skills/memory/local-embedding.d.ts +176 -0
  81. package/dist/types/skills/memory/local-memory-provider.d.ts +197 -0
  82. package/dist/types/skills/memory/local-store.d.ts +255 -0
  83. package/dist/types/skills/memory/memdir.d.ts +13 -5
  84. package/dist/types/skills/memory/memory-provider-factory.d.ts +48 -0
  85. package/dist/types/skills/memory/memory-tool.d.ts +30 -2
  86. package/dist/types/skills/permissions/denial-audit-log.d.ts +52 -0
  87. package/dist/types/skills/permissions/hook-runner.d.ts +14 -4
  88. package/dist/types/skills/permissions/permission-classifier.d.ts +1 -1
  89. package/dist/types/skills/skill-system/skill-lifecycle.d.ts +81 -0
  90. package/dist/types/skills/skill-system/skill-validation.d.ts +29 -0
  91. package/dist/types/skills/tools/exec-tool.d.ts +1 -1
  92. package/dist/types/skills/tools/search-tool.d.ts +1 -1
  93. package/dist/types/skills/tools.d.ts +3 -3
  94. package/dist/types/transport/acp-event-emitter.d.ts +1 -1
  95. package/dist/types/transport/acp-server.d.ts +7 -2
  96. package/package.json +19 -5
  97. package/dist/types/llm/adapters/aliyun-oss-file-upload-adapter.d.ts +0 -44
  98. package/dist/types/llm/adapters/gemini-file-upload-adapter.d.ts +0 -26
  99. package/dist/types/llm/adapters/hub-oss-file-upload-adapter.d.ts +0 -29
  100. package/dist/types/llm/adapters/index.d.ts +0 -10
  101. package/dist/types/llm/adapters/openai-file-upload-adapter.d.ts +0 -38
  102. package/dist/types/llm/adapters/volcengine-file-upload-adapter.d.ts +0 -24
  103. package/dist/types/llm/builtin-providers.d.ts +0 -10
  104. package/dist/types/llm/debug-transport.d.ts +0 -12
  105. package/dist/types/llm/file-upload-service.d.ts +0 -68
  106. package/dist/types/llm/gemini-schema-utils.d.ts +0 -17
  107. package/dist/types/llm/llm-client.d.ts +0 -43
  108. package/dist/types/llm/media-client.d.ts +0 -42
  109. package/dist/types/llm/media-transport.d.ts +0 -176
  110. package/dist/types/llm/model-catalog.d.ts +0 -53
  111. package/dist/types/llm/model-detection.d.ts +0 -22
  112. package/dist/types/llm/provider-def.d.ts +0 -203
  113. package/dist/types/llm/provider-registry.d.ts +0 -59
  114. package/dist/types/llm/provider-tool-api.d.ts +0 -44
  115. package/dist/types/llm/retry.d.ts +0 -37
  116. package/dist/types/llm/transport.d.ts +0 -281
  117. package/dist/types/llm/transports/anthropic-messages.d.ts +0 -65
  118. package/dist/types/llm/transports/gemini-cache-api.d.ts +0 -86
  119. package/dist/types/llm/transports/gemini-file-api.d.ts +0 -90
  120. package/dist/types/llm/transports/gemini-generatecontent.d.ts +0 -56
  121. package/dist/types/llm/transports/gemini-lyria-realtime.d.ts +0 -117
  122. package/dist/types/llm/transports/gemini-media.d.ts +0 -53
  123. package/dist/types/llm/transports/media-resolve.d.ts +0 -50
  124. package/dist/types/llm/transports/minimax-media.d.ts +0 -55
  125. package/dist/types/llm/transports/openai-chat.d.ts +0 -81
  126. package/dist/types/llm/transports/openai-media.d.ts +0 -24
  127. package/dist/types/llm/transports/openai-responses.d.ts +0 -63
  128. package/dist/types/llm/transports/qwen-media.d.ts +0 -50
  129. package/dist/types/llm/transports/realtime-transport.d.ts +0 -183
  130. package/dist/types/llm/transports/volcengine-grounding.d.ts +0 -58
  131. package/dist/types/llm/transports/volcengine-media.d.ts +0 -93
  132. package/dist/types/llm/transports/volcengine-responses.d.ts +0 -64
  133. package/dist/types/llm/transports/zhipu-media.d.ts +0 -82
  134. package/dist/types/llm/transports/zhipu-tool-api.d.ts +0 -35
  135. package/dist/types/runtime/infra/project-plan-store.d.ts +0 -27
  136. package/dist/types/skills/memory/qmemory-adapter.d.ts +0 -55
  137. package/dist/types/skills/memory/qmemory-http-client.d.ts +0 -16
@@ -12,6 +12,6 @@ export interface AgentConfig {
12
12
  * Parse CLI arguments into AgentConfig.
13
13
  *
14
14
  * Supports:
15
- * --verbose / -v Enable verbose logging
15
+ * verbose / -v Enable verbose logging
16
16
  */
17
17
  export declare function parseCliArgs(argv: string[]): AgentConfig;
@@ -10,7 +10,7 @@ export type { AgentConfig } from "./config/config.js";
10
10
  export type { Transport } from "./cli/transport.js";
11
11
  export { StdioTransport } from "./cli/transport.js";
12
12
  export { StdioServer, type StdioServerConfig } from "./cli/stdio-server.js";
13
- export { ProviderRegistry, createLLMClient, } from "./llm/index.js";
14
- export type { LLMTransport, LLMRequest, LLMChunk } from "./llm/index.js";
13
+ export { ProviderRegistry, createLLMClient, } from "@qlogic/provider-core";
14
+ export type { LLMTransport, LLMRequest, LLMChunk } from "@qlogic/provider-core";
15
15
  export { createHookRegistry } from "./runtime/hooks/hook-registry.js";
16
16
  export { buildSkillInstruction, } from "./orchestration/index.js";
@@ -1,31 +1 @@
1
- /**
2
- * LLM Provider layer — public API surface.
3
- *
4
- * Provides: ProviderDef + LLMTransport + ProviderRegistry + LLMClient factory
5
- */
6
- export type { ProviderDef, ModelInfo, TransportType, AuthType, MediaCapability, MediaCapabilities, VideoCapabilities, ImageCapabilities, MusicCapabilities, TtsCapabilities, ThreeDCapabilities, SttCapabilities, EmbeddingCapabilities, VideoUnderstandingCapabilities, ImageUnderstandingCapabilities, VoiceCloneCapabilities, RerankCapabilities, DocumentParsingCapabilities, RealtimeAudioCapabilities, VideoOperation, ImageOperation, MusicOperation, TtsOperation, ThreeDOperation } from "./provider-def.js";
7
- export type { LLMTransport, LLMRequest, LLMChunk, AccumulatedToolCall, } from "./transport.js";
8
- export { accumulateToolCalls } from "./transport.js";
9
- export type { MediaTransport, MediaRequest, MediaResult, MediaType } from "./media-transport.js";
10
- export { MediaClient, type MediaClientConfig, type ResolvedMediaModel } from "./media-client.js";
11
- export { ProviderRegistry } from "./provider-registry.js";
12
- export { BUILTIN_PROVIDERS } from "./builtin-providers.js";
13
- export { ModelCatalog } from "./model-catalog.js";
14
- export type { LLMClientConfig, LLMClient } from "./llm-client.js";
15
- export { createLLMClient } from "./llm-client.js";
16
- export { OpenAIChatTransport } from "./transports/openai-chat.js";
17
- export { AnthropicMessagesTransport } from "./transports/anthropic-messages.js";
18
- export { GeminiGenerateContentTransport } from "./transports/gemini-generatecontent.js";
19
- export { VolcengineMediaTransport } from "./transports/volcengine-media.js";
20
- export { OpenAIMediaTransport } from "./transports/openai-media.js";
21
- export { MiniMaxMediaTransport } from "./transports/minimax-media.js";
22
- export { GeminiMediaTransport, type GeminiMediaConfig } from "./transports/gemini-media.js";
23
- export { GeminiLyriaRealtimeSession, generateRealtimeMusic } from "./transports/gemini-lyria-realtime.js";
24
- export type { WeightedPrompt, MusicGenerationConfig, MusicScale, MusicGenerationMode, LyriaRealtimeConfig, LyriaRealtimeSessionOptions, AudioChunk } from "./transports/gemini-lyria-realtime.js";
25
- export { RealtimeTransport } from "./transports/realtime-transport.js";
26
- export type { RealtimeConfig, RealtimeTool, RealtimeEvent, RealtimeUsage } from "./transports/realtime-transport.js";
27
- export { GeminiCacheAPI } from "./transports/gemini-cache-api.js";
28
- export type { GeminiCachedContent, GeminiCacheCreateOptions } from "./transports/gemini-cache-api.js";
29
- export { GeminiFileAPI } from "./transports/gemini-file-api.js";
30
- export type { GeminiFileInfo } from "./transports/gemini-file-api.js";
31
- export { isDebugTransportEnabled, createDebugTransport } from "./debug-transport.js";
1
+ export * from "@qlogic/provider-core";
@@ -3,6 +3,8 @@
3
3
  *
4
4
  * Manages a directed acyclic graph of tasks with dependencies.
5
5
  * Ensures tasks only execute when all prerequisites are satisfied.
6
+ *
7
+ * Supports dynamic mutations: leader can add/remove/retry tasks at runtime.
6
8
  */
7
9
  import type { ProductTaskDef, ProductTaskStatus } from "../runtime/infra/acp-types.js";
8
10
  export interface TaskNode {
@@ -68,5 +70,49 @@ export declare class DagScheduler {
68
70
  startedAt?: number;
69
71
  completedAt?: number;
70
72
  }>): void;
73
+ /**
74
+ * Add a new task to the DAG at runtime.
75
+ * Used by leader agent when it discovers new work is needed.
76
+ * Validates that the addition doesn't create cycles.
77
+ */
78
+ addTask(task: ProductTaskDef): void;
79
+ /**
80
+ * Add multiple tasks atomically. All-or-nothing.
81
+ */
82
+ addTasks(tasks: ProductTaskDef[]): void;
83
+ /**
84
+ * Remove a pending task from the DAG.
85
+ * Cannot remove running/completed tasks.
86
+ * Removes the task from other tasks' dependsOn lists.
87
+ */
88
+ removeTask(taskId: string): void;
89
+ /**
90
+ * Retry a failed task: reset it to pending for re-execution.
91
+ * Optionally update the prompt (leader may refine instructions).
92
+ */
93
+ retryTask(taskId: string, newPrompt?: string): void;
94
+ /**
95
+ * Update a pending task's prompt (leader refines instructions before execution).
96
+ */
97
+ updateTaskPrompt(taskId: string, prompt: string): void;
98
+ /**
99
+ * Re-assign a pending task to a different instance.
100
+ */
101
+ reassignTask(taskId: string, newAssignee: string): void;
102
+ /**
103
+ * Add a dependency edge. Validates no cycle is introduced.
104
+ */
105
+ addDependency(taskId: string, dependsOnTaskId: string): void;
106
+ /**
107
+ * Get statistics for progress tracking.
108
+ */
109
+ getProgress(): {
110
+ total: number;
111
+ completed: number;
112
+ running: number;
113
+ failed: number;
114
+ pending: number;
115
+ paused: number;
116
+ };
71
117
  private validateDag;
72
118
  }
@@ -3,7 +3,7 @@ export { classifyError, isRetryableCategory, type ErrorCategory, } from "./error
3
3
  export { composeStrategies, composeAsyncStrategies, SlidingWindowStrategy, SummarizeOldStrategy, ToolResultTrimStrategy, HeadTailProtectedStrategy, IncrementalCompactStrategy, CacheAwareCompressionStrategy, CompressionMetricsCollector, ContextEngineRegistry, MicroCompactStrategy, postCompactFileRecovery, type PostCompactRecoveryConfig, buildStructuredSummaryPrompt, computeAdaptiveBudget, isAsyncCompressionStrategy, selectCompressionTier, DEFAULT_ADAPTIVE_BUDGET_CONFIG, type AdaptiveBudgetConfig, type AsyncCompressionStrategy, type CacheAwareCompressionConfig, type CompressibleMessage, type CompressionEvent, type CompressionMetrics, type CompressionMetricsSnapshot, type CompressionResult, type CompressionStrategy, type CompressionTier, type ContextEngine, type HeadTailProtectionConfig, type IncrementalCompactConfig, type SummarizeFn, } from "./context/context-compression.js";
4
4
  export { snipCompactIfNeeded, type SnipResult, } from "./context/context-compression.js";
5
5
  export { applyCollapsesIfNeeded as applyContextCollapsesIfNeeded, recoverFromOverflow as recoverContextCollapseFromOverflow, createCollapseStore, type CollapseStore, type CollapseStage, } from "./context/context-collapse.js";
6
- export { buildSkillInstruction, type SkillCreateInstruction, type SkillImproveInstruction, type SkillInstruction, type SkillTurnResult, } from "./skill-improvement.js";
6
+ export { buildSkillInstruction, recordPatternAndCheckThreshold, getPatternStats, buildToolSignature, type SkillCreateInstruction, type SkillImproveInstruction, type SkillInstruction, type SkillTurnResult, } from "./skill-improvement.js";
7
7
  export { applyToolChoicePolicy, type ApplyToolChoicePolicyInput, type ApplyToolChoicePolicyResult, } from "./tool-loop/tool-choice-policy.js";
8
8
  export { repairOpenAiChatConversation, type ConversationRepairOptions, type OpenAiChatMessageLike, type OpenAiToolCall, } from "./tool-loop/conversation-repair.js";
9
9
  export { advanceToolLoopState, recoverToolLoopStateFromChatConversation, recoverToolLoopStateFromResponsesItems, settleToolLoopState, type RepairToolLoopStateResult, type ToolLoopRepairAction, type ToolLoopState, } from "./tool-loop/tool-loop-state.js";
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Product Planner — Interactive multi-turn planning + persistent leader management.
3
+ *
4
+ * Architecture (aligned with CrewAI hierarchical + LangGraph durable execution):
5
+ *
6
+ * Phase 1 — PLANNING (multi-turn dialogue):
7
+ * 1. product.plan → spawn leader agent → leader engages user in multi-turn dialogue
8
+ * 2. Leader asks clarifying questions, proposes module decomposition
9
+ * 3. User responds via product.message → leader refines plan
10
+ * 4. Leader outputs structured plan → client presents to user
11
+ *
12
+ * Phase 2 — CONFIRMATION:
13
+ * 5. product.confirm → user confirms/modifies plan → transition to execution
14
+ *
15
+ * Phase 3 — EXECUTION (leader as persistent manager):
16
+ * 6. Leader manages DAG: dispatches tasks, monitors, handles failures
17
+ * 7. Leader can dynamically mutate DAG: add/retry/reassign tasks
18
+ * 8. User can intervene via product.message at any time
19
+ * 9. Each state transition is checkpointed for crash recovery
20
+ *
21
+ * Key mechanisms from reference projects:
22
+ * - CrewAI: hierarchical process (manager auto-delegates/verifies)
23
+ * - CrewAI: checkpoint serialization (mid-task state)
24
+ * - LangGraph: durable execution (persist after each node)
25
+ */
26
+ import type { AgentProcessManager } from "../runtime/infra/agent-process.js";
27
+ import type { AcpDetector } from "../runtime/infra/acp-detector.js";
28
+ import type { AgentConfigStore } from "../runtime/infra/agent-config-store.js";
29
+ import type { ProductPlanParams, ProductPlan, ProductConfirmParams } from "../runtime/infra/acp-types.js";
30
+ export type PlanningPhase = "planning" | "awaiting_confirmation" | "confirmed" | "executing" | "paused" | "completed" | "cancelled";
31
+ export interface PlanningMessage {
32
+ role: "leader" | "user";
33
+ content: string;
34
+ timestamp: string;
35
+ }
36
+ export interface PlanningSession {
37
+ productId: string;
38
+ goal: string;
39
+ cwd: string;
40
+ leaderAgentId: string;
41
+ leaderMemberId?: string;
42
+ phase: PlanningPhase;
43
+ plan?: ProductPlan;
44
+ /** Multi-turn conversation history during planning. */
45
+ dialogue: PlanningMessage[];
46
+ budget?: {
47
+ maxTotalTokens?: number;
48
+ maxDuration?: number;
49
+ };
50
+ createdAt: string;
51
+ /** Last checkpoint timestamp for durable execution. */
52
+ lastCheckpoint?: string;
53
+ }
54
+ export interface PlannerCallbacks {
55
+ log?: {
56
+ info(msg: string): void;
57
+ warn(msg: string): void;
58
+ };
59
+ /** Leader produced a structured plan — client presents to user. */
60
+ onPlanReady?: (productId: string, plan: ProductPlan) => void;
61
+ /** Planning failed. */
62
+ onPlanFailed?: (productId: string, error: string) => void;
63
+ /** Streaming text from leader during planning dialogue. */
64
+ onPlanningDelta?: (productId: string, text: string) => void;
65
+ /** Leader sent a message to user (multi-turn). */
66
+ onLeaderMessage?: (productId: string, message: string) => void;
67
+ /** Leader dynamically mutated the DAG during execution. */
68
+ onDagMutated?: (productId: string, mutation: DagMutation) => void;
69
+ }
70
+ /** Describes a DAG mutation performed by the leader. */
71
+ export interface DagMutation {
72
+ type: "add_task" | "remove_task" | "retry_task" | "reassign_task" | "update_prompt";
73
+ taskId: string;
74
+ details?: Record<string, unknown>;
75
+ }
76
+ export declare class ProductPlanner {
77
+ private processManager;
78
+ private acpDetector;
79
+ private configStore;
80
+ private callbacks;
81
+ private sessions;
82
+ constructor(processManager: AgentProcessManager, acpDetector: AcpDetector, configStore: AgentConfigStore | null, callbacks?: PlannerCallbacks);
83
+ /**
84
+ * Start an interactive planning session (Phase 1).
85
+ * Spawns the leader agent and begins multi-turn dialogue.
86
+ */
87
+ plan(params: ProductPlanParams): Promise<{
88
+ productId: string;
89
+ plan: ProductPlan;
90
+ }>;
91
+ /**
92
+ * Send a user message to the leader (works in planning and execution phases).
93
+ * Returns the leader's response and optionally a finalized plan.
94
+ */
95
+ message(productId: string, content: string): Promise<{
96
+ response: string;
97
+ plan?: ProductPlan;
98
+ mutations?: DagMutation[];
99
+ }>;
100
+ /**
101
+ * Confirm the plan → transition to execution (Phase 2 → Phase 3).
102
+ */
103
+ confirm(params: ProductConfirmParams): Promise<{
104
+ productId: string;
105
+ ok: true;
106
+ }>;
107
+ /** Transition session to executing phase. Called after ProductOrchestrator.create(). */
108
+ markExecuting(productId: string): void;
109
+ /** Mark as completed. */
110
+ markCompleted(productId: string): void;
111
+ /** Get planning session by ID. */
112
+ getSession(productId: string): PlanningSession | undefined;
113
+ /** Cancel and kill leader process. */
114
+ cancel(productId: string): Promise<void>;
115
+ /** List active sessions. */
116
+ listSessions(): PlanningSession[];
117
+ /**
118
+ * Ask leader to evaluate execution state and propose DAG mutations.
119
+ * Called by ProductOrchestrator when tasks fail or progress stalls.
120
+ */
121
+ consultLeader(productId: string, context: {
122
+ progress: {
123
+ total: number;
124
+ completed: number;
125
+ running: number;
126
+ failed: number;
127
+ };
128
+ failedTasks?: Array<{
129
+ taskId: string;
130
+ error: string;
131
+ }>;
132
+ }): Promise<DagMutation[]>;
133
+ /**
134
+ * Serialize session for checkpoint persistence (durable execution).
135
+ */
136
+ serializeSession(productId: string): PlanningSession | null;
137
+ /**
138
+ * Restore session from checkpoint (crash recovery).
139
+ */
140
+ restoreSession(data: PlanningSession): void;
141
+ private handlePlanningMessage;
142
+ private handleExecutionMessage;
143
+ private sendToLeader;
144
+ private tryParsePlan;
145
+ private parseDagMutations;
146
+ }
@@ -3,6 +3,8 @@
3
3
  * trigger skill creation or improvement instructions.
4
4
  *
5
5
  * Guards against proliferation:
6
+ * - Project-level pattern repetition: same workflow signature must appear
7
+ * ≥ SKILL_PATTERN_REPETITION_THRESHOLD times before triggering creation
6
8
  * - MAX_SKILLS_PER_PROJECT: hard cap on project-level skills
7
9
  * - Dedup check: compares tool-set signature against existing skills
8
10
  * - Cooldown: prevents rapid-fire creation within a session
@@ -47,6 +49,40 @@ export type SkillInstruction = SkillCreateInstruction | SkillImproveInstruction;
47
49
  * Reset cooldown state (for testing).
48
50
  */
49
51
  export declare function resetSkillCreationCooldown(): void;
52
+ interface PatternEntry {
53
+ /** Sorted tool signature (e.g. "bash+file_read+file_write") */
54
+ signature: string;
55
+ /** Number of times this pattern has been observed */
56
+ count: number;
57
+ /** First seen timestamp (ISO) */
58
+ firstSeen: string;
59
+ /** Last seen timestamp (ISO) */
60
+ lastSeen: string;
61
+ /** Whether a skill has already been created for this pattern */
62
+ promoted: boolean;
63
+ }
64
+ /**
65
+ * Record a workflow pattern observation and return whether it has reached
66
+ * the repetition threshold (i.e., is now eligible for skill creation).
67
+ *
68
+ * @returns true if the pattern just reached the threshold on this observation
69
+ */
70
+ export declare function recordPatternAndCheckThreshold(projectRoot: string, tools: string[]): boolean;
71
+ /**
72
+ * Mark a pattern as promoted (skill already created for it).
73
+ * Called when a skill is created through other paths (e.g., manual).
74
+ */
75
+ export declare function markPatternPromoted(projectRoot: string, tools: string[]): void;
76
+ /**
77
+ * Get all tracked patterns for a project. Useful for diagnostics.
78
+ */
79
+ export declare function getPatternStats(projectRoot: string): PatternEntry[];
80
+ /**
81
+ * Build a normalized "tool signature" from sorted tool names.
82
+ * Used for dedup — if an existing skill has the same tool signature,
83
+ * we skip creation.
84
+ */
85
+ export declare function buildToolSignature(tools: string[]): string;
50
86
  /**
51
87
  * Check if an existing skill in skillsDir already covers the same tool set.
52
88
  * Returns the name of the conflicting skill, or null if none found.
@@ -68,6 +104,8 @@ export interface SkillCreationContext {
68
104
  tools: string[];
69
105
  /** Optional suggested name */
70
106
  suggestedName?: string;
107
+ /** Project root directory (required for pattern tracking) */
108
+ projectRoot?: string;
71
109
  }
72
110
  /**
73
111
  * Determine whether a completed turn should produce a skill instruction.
@@ -80,6 +118,7 @@ export interface SkillCreationContext {
80
118
  * - Cooldown has elapsed since last skill creation
81
119
  * - No duplicate skill exists (same tool signature)
82
120
  * - Project skill count < MAX_SKILLS_PER_PROJECT
121
+ * - **Pattern repetition threshold reached** (≥3 occurrences at project level)
83
122
  */
84
123
  export declare function shouldCreateSkill(result: SkillTurnResult, context?: SkillCreationContext): boolean;
85
124
  export declare function shouldImproveSkill(result: SkillTurnResult): boolean;
@@ -1,14 +1,22 @@
1
1
  /**
2
- * Solo Mode Evaluator — parallel N-agent PK with leader evaluation.
2
+ * Solo Mode Evaluator — parallel N-agent PK with user-triggered evaluation.
3
3
  *
4
4
  * Flow:
5
5
  * 1. solo.start → create N isolated git worktrees, spawn N agents in parallel
6
6
  * 2. Each agent receives the same task prompt in its own worktree
7
- * 3. On completion, collect each agent's resultText + git diff
8
- * 4. Leader agent evaluates all results picks winner
9
- * 5. solo.select merge winning worktree, clean up others
7
+ * (all agents share initial config: memory/rules from project .qlogicagent/)
8
+ * 3. On completion of initial task, agents enter "idle" state (process kept alive)
9
+ * 4. User can send follow-up messages to individual agents via solo.message
10
+ * 5. User triggers evaluation via solo.evaluate (or skips directly to solo.select)
11
+ * 6. solo.select → merge winning worktree, clean up others
10
12
  *
11
- * Degradation: if K agents fail but ≥1 succeeds, evaluation still proceeds.
13
+ * Key design:
14
+ * - Solo = special project type (persisted in .qlogicagent/solos/)
15
+ * - Agents share the same initial config but operate in isolated worktrees
16
+ * - User controls the evaluation timing (not automatic)
17
+ * - Follow-up instructions to individual agents supported
18
+ *
19
+ * Degradation: if K agents fail but ≥1 succeeds, session remains interactive.
12
20
  */
13
21
  import type { AgentProcessManager } from "../runtime/infra/agent-process.js";
14
22
  import type { AcpDetector } from "../runtime/infra/acp-detector.js";
@@ -50,6 +58,18 @@ export declare class SoloEvaluator {
50
58
  * Creates worktrees, spawns agents in parallel, waits for completion, then evaluates.
51
59
  */
52
60
  start(params: SoloStartParams): Promise<string>;
61
+ /**
62
+ * Send a follow-up message to a specific agent within a solo session.
63
+ * Agent must be in "idle" or "completed" state.
64
+ */
65
+ message(soloId: string, agentId: string, content: string, agentIndex?: number): Promise<{
66
+ resultText: string;
67
+ }>;
68
+ /**
69
+ * User-triggered evaluation — compare all completed/idle agents' results.
70
+ * The user chooses which agent in the session performs the evaluation comparison.
71
+ */
72
+ triggerEvaluation(soloId: string, evaluatorAgentId: string, evaluatorIndex?: number): Promise<SoloEvaluation>;
53
73
  /** Get the current status of a solo session. */
54
74
  getStatus(soloId: string): SoloStatus | null;
55
75
  /** Cancel a running solo session. Kill all agents and clean up worktrees. */
@@ -63,7 +83,7 @@ export declare class SoloEvaluator {
63
83
  /** Delete a solo session, killing agents and cleaning up worktrees if still active. */
64
84
  delete(soloId: string): Promise<void>;
65
85
  /**
66
- * Build an evaluation prompt and send to the leader agent (first successful).
86
+ * Build an evaluation prompt and send to the user-chosen evaluator agent.
67
87
  * Returns evaluation result.
68
88
  */
69
89
  private evaluate;
@@ -24,6 +24,11 @@ export interface PersistedSoloState {
24
24
  outputTokens: number;
25
25
  };
26
26
  error?: string;
27
+ turns?: Array<{
28
+ role: "user" | "agent";
29
+ content: string;
30
+ timestamp: number;
31
+ }>;
27
32
  }>;
28
33
  evaluation?: SoloEvaluation;
29
34
  createdAt: number;
@@ -23,14 +23,14 @@
23
23
  *
24
24
  * ```ts
25
25
  * import { cascadeWebSearch } from "./tool-cascade.js";
26
- * import { ZhipuToolAPI } from "../llm/transports/zhipu-tool-api.js";
26
+ * import { ZhipuToolAPI } from "@qlogic/provider-core/transports/zhipu-tool-api";
27
27
  *
28
28
  * const providerApi = new ZhipuToolAPI({ baseUrl, apiKey });
29
29
  * const cascadedSearch = cascadeWebSearch(providerApi, fallbackSearchFn);
30
30
  * const tool = createWebSearchTool({ search: cascadedSearch });
31
31
  * ```
32
32
  */
33
- import type { ProviderToolAPI } from "../llm/provider-tool-api.js";
33
+ import type { ProviderToolAPI } from "@qlogic/provider-core";
34
34
  import type { WebSearchToolDeps } from "../skills/tools/web-search-tool.js";
35
35
  /**
36
36
  * Cascade web search: provider-native search → host fallback.