qlogicagent 2.15.10 → 2.16.2
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/agent.js +24 -20
- package/dist/cli.js +572 -515
- package/dist/index.js +571 -514
- package/dist/orchestration.js +9 -9
- package/dist/protocol.js +1 -1
- package/dist/types/agent/tool-loop/artifact-final-contract.d.ts +21 -0
- package/dist/types/agent/tool-loop/tool-failure-policy.d.ts +1 -0
- package/dist/types/agent/tool-loop.d.ts +2 -0
- package/dist/types/agent/types.d.ts +7 -202
- package/dist/types/cli/acp-extended-handlers.d.ts +1 -0
- package/dist/types/cli/core-tools/agent-tool-service.d.ts +1 -0
- package/dist/types/cli/handlers/agents-handler.d.ts +8 -0
- package/dist/types/cli/handlers/product-handler.d.ts +21 -2
- package/dist/types/cli/handlers/workflow-handler.d.ts +5 -0
- package/dist/types/cli/tool-bootstrap-core-registration.d.ts +5 -0
- package/dist/types/cli/turn-core.d.ts +2 -0
- package/dist/types/contracts/index.d.ts +1 -0
- package/dist/types/contracts/turn-event.d.ts +235 -0
- package/dist/types/orchestration/agent-instance.d.ts +45 -2
- package/dist/types/orchestration/agent-roster.d.ts +17 -0
- package/dist/types/orchestration/dag-scheduler.d.ts +27 -0
- package/dist/types/orchestration/product-budget.d.ts +7 -1
- package/dist/types/orchestration/product-persistence.d.ts +31 -0
- package/dist/types/orchestration/product-planner.d.ts +123 -0
- package/dist/types/orchestration/product-run-coordinator.d.ts +17 -1
- package/dist/types/orchestration/product-worktree.d.ts +3 -0
- package/dist/types/orchestration/skill-improvement.d.ts +2 -19
- package/dist/types/orchestration/solo-evaluator.d.ts +10 -0
- package/dist/types/orchestration/solo-spec-builder.d.ts +4 -0
- package/dist/types/orchestration/workflow/n8n-import.d.ts +26 -32
- package/dist/types/orchestration/workflow/n8n-template-compat.d.ts +5 -0
- package/dist/types/orchestration/workflow/node-registry.d.ts +13 -0
- package/dist/types/orchestration/workflow/node-schema.d.ts +10 -0
- package/dist/types/orchestration/workflow/qla-executor-host.d.ts +7 -1
- package/dist/types/protocol/methods.d.ts +8 -1
- package/dist/types/protocol/notifications.d.ts +1 -1
- package/dist/types/protocol/wire/acp-agent-management.d.ts +38 -0
- package/dist/types/protocol/wire/acp-protocol.d.ts +1 -0
- package/dist/types/protocol/wire/agent-events.d.ts +3 -3
- package/dist/types/protocol/wire/agent-methods.d.ts +11 -1
- package/dist/types/protocol/wire/index.d.ts +1 -1
- package/dist/types/protocol/wire/notification-payloads.d.ts +39 -0
- package/dist/types/runtime/infra/acp-detector.d.ts +3 -0
- package/dist/types/runtime/infra/acp-protocol-adapter.d.ts +9 -0
- package/dist/types/runtime/ports/agent-execution-contracts.d.ts +2 -199
- package/dist/types/runtime/ports/tool-contracts.d.ts +6 -0
- package/dist/types/runtime/prompt/environment-context.d.ts +20 -1
- package/dist/types/skills/tools/ask-user-tool.d.ts +4 -2
- package/dist/types/skills/tools/shell/command-classification.d.ts +1 -0
- package/dist/types/skills/tools/tool-search-tool.d.ts +13 -0
- package/dist/types/skills/tools/tool-selection-eval.d.ts +49 -0
- package/dist/types/skills/tools/tool-selection-eval.dataset.d.ts +5 -0
- package/dist/types/skills/tools/write-tool.d.ts +2 -0
- package/dist/types/skills/tools.d.ts +21 -0
- package/dist/types/transport/acp-server.d.ts +1 -0
- package/package.json +2 -1
|
@@ -44,6 +44,8 @@ export interface AcpBackendConfig {
|
|
|
44
44
|
install?: AgentInstallSpec;
|
|
45
45
|
/** Short UI note (e.g. "需 GitHub 账号", "非 ACP,自定义适配器驱动"). */
|
|
46
46
|
note?: string;
|
|
47
|
+
/** Coarse soft capability hint for the leader's planning roster (NOT a capability contract). */
|
|
48
|
+
strengths?: string;
|
|
47
49
|
}
|
|
48
50
|
/** Official install commands for the one-click installer (no self-hosted CDN — runs upstream). */
|
|
49
51
|
export interface AgentInstallSpec {
|
|
@@ -312,6 +314,8 @@ export interface ProductBudget {
|
|
|
312
314
|
maxTotalTokens?: number;
|
|
313
315
|
maxDuration?: number;
|
|
314
316
|
usedTokens: number;
|
|
317
|
+
inputTokens?: number;
|
|
318
|
+
outputTokens?: number;
|
|
315
319
|
elapsed: number;
|
|
316
320
|
}
|
|
317
321
|
/** product.create RPC params. */
|
|
@@ -347,6 +351,19 @@ export interface ProductPlanParams {
|
|
|
347
351
|
maxTotalTokens?: number;
|
|
348
352
|
maxDuration?: number;
|
|
349
353
|
};
|
|
354
|
+
/**
|
|
355
|
+
* Optional user-supplied allow-list of agent ids the leader 小智 (qlogicagent) may assign tasks to —
|
|
356
|
+
* during planning AND during execution-phase reassignment. The user picks WHICH agents participate;
|
|
357
|
+
* the leader still auto-plans + assigns, but only within this set.
|
|
358
|
+
*
|
|
359
|
+
* Semantics are PRESENCE-based (see buildAgentRoster) — an explicit `[]` differs from omitted:
|
|
360
|
+
* - omitted / undefined → ALL ready agents (backward compatible — WS probes, other callers, old sessions).
|
|
361
|
+
* - `[]` (explicit empty array) → ONLY the leader `qlogicagent` (小智): the user deselected every worker.
|
|
362
|
+
* - non-empty → the assignable roster = ready catalog entries whose id ∈ allowedAgents, PLUS the
|
|
363
|
+
* leader `qlogicagent` (小智) ALWAYS included (universal coordinator / fallback executor, so there
|
|
364
|
+
* is always ≥1 valid assignee even if the user's picks turn out unready).
|
|
365
|
+
*/
|
|
366
|
+
allowedAgents?: string[];
|
|
350
367
|
}
|
|
351
368
|
/** The structured plan produced by the leader agent. */
|
|
352
369
|
export interface ProductPlan {
|
|
@@ -396,6 +413,14 @@ export interface ProductMessageParams {
|
|
|
396
413
|
export interface ProductIdParams {
|
|
397
414
|
productId: string;
|
|
398
415
|
}
|
|
416
|
+
/**
|
|
417
|
+
* product.replay RPC params — re-run from an arbitrary completed/failed task forward.
|
|
418
|
+
* Resets the task + its descendants to pending and reuses upstream (ancestor) outputs as context.
|
|
419
|
+
*/
|
|
420
|
+
export interface ProductReplayParams {
|
|
421
|
+
productId: string;
|
|
422
|
+
taskId: string;
|
|
423
|
+
}
|
|
399
424
|
/** Runtime instance state. */
|
|
400
425
|
export interface ProductInstanceStatus {
|
|
401
426
|
instanceId: string;
|
|
@@ -417,6 +442,11 @@ export interface ProductTaskState {
|
|
|
417
442
|
error?: string;
|
|
418
443
|
startedAt?: string;
|
|
419
444
|
completedAt?: string;
|
|
445
|
+
/** Per-task token usage, surfaced for cost attribution in the task detail view. */
|
|
446
|
+
inputTokens?: number;
|
|
447
|
+
outputTokens?: number;
|
|
448
|
+
/** Relative paths of files the task produced. */
|
|
449
|
+
changedFiles?: string[];
|
|
420
450
|
}
|
|
421
451
|
/** agents.getGateway response. */
|
|
422
452
|
export interface AgentsGetGatewayResult {
|
|
@@ -474,3 +504,11 @@ export interface ProductDeleteParams {
|
|
|
474
504
|
productId: string;
|
|
475
505
|
}
|
|
476
506
|
export type { AgentSource } from "./notification-payloads.js";
|
|
507
|
+
/** One row of the team roster shown to the leader during planning (soft capability hints only). */
|
|
508
|
+
export interface AgentRosterEntry {
|
|
509
|
+
id: string;
|
|
510
|
+
name: string;
|
|
511
|
+
model?: string;
|
|
512
|
+
strengths: string;
|
|
513
|
+
isLeader: boolean;
|
|
514
|
+
}
|
|
@@ -31,6 +31,7 @@ export declare const ACP_EXTENDED_METHODS: {
|
|
|
31
31
|
readonly PRODUCT_PAUSE: "x/product.pause";
|
|
32
32
|
readonly PRODUCT_CANCEL: "x/product.cancel";
|
|
33
33
|
readonly PRODUCT_ROLLBACK: "x/product.rollback";
|
|
34
|
+
readonly PRODUCT_REPLAY: "x/product.replay";
|
|
34
35
|
readonly PRODUCT_STATUS: "x/product.status";
|
|
35
36
|
readonly SOLO_SUBSCRIBE: "x/solo.subscribe";
|
|
36
37
|
readonly SOLO_MESSAGE: "x/solo.message";
|
|
@@ -13,17 +13,17 @@
|
|
|
13
13
|
* Turn-lifecycle events relayed to the Control UI WebSocket.
|
|
14
14
|
* These are the "chat session" events that every UI client needs.
|
|
15
15
|
*/
|
|
16
|
-
export declare const AGENT_WS_EVENT_NAMES: readonly ["turn.start", "turn.delta", "turn.end", "turn.error", "turn.recovery", "turn.tool_call", "turn.tool_result", "turn.tool_blocked", "turn.reasoning_delta", "turn.approval_request", "turn.skill_instruction", "turn.ask_user", "turn.media_result", "turn.media_progress", "turn.media_usage", "turn.media_capability_check", "turn.plan_update", "turn.suggestions", "turn.sidechain_started", "turn.subagent_started", "turn.subagent_delta", "turn.subagent_ended", "turn.sidechain_completed", "turn.task_updated", "turn.todos_updated", "turn.exec_progress", "turn.tool_use_summary", "turn.lifecycle", "turn.document_maintenance", "turn.artifact_contract", "turn.usage_update", "team.member.notification", "session.info", "memory.updated", "skills.updated", "pet.soul_ready", "pet.reaction", "pet.growth", "pet.state", "pet.confirm", "pet.asset.updated", "system.activity", "workflow.created", "workflow.updated", "workflow.deleted", "workflow.runStarted", "workflow.runCompleted", "workflow.runFailed", "workflow.nodeStatus", "workflow.triggerDropped", "workflow.alert", "workflow.approvalRequested"];
|
|
16
|
+
export declare const AGENT_WS_EVENT_NAMES: readonly ["turn.start", "turn.delta", "turn.end", "turn.error", "turn.recovery", "turn.tool_call", "turn.tool_result", "turn.tool_blocked", "turn.reasoning_delta", "turn.approval_request", "turn.skill_instruction", "turn.ask_user", "turn.media_result", "turn.media_progress", "turn.media_usage", "turn.media_capability_check", "turn.plan_update", "turn.suggestions", "turn.sidechain_started", "turn.subagent_started", "turn.subagent_delta", "turn.subagent_ended", "turn.sidechain_completed", "turn.task_updated", "turn.todos_updated", "turn.exec_progress", "turn.tool_use_summary", "turn.tool_selection_policy", "turn.lifecycle", "turn.document_maintenance", "turn.artifact_contract", "turn.usage_update", "team.member.notification", "session.info", "memory.updated", "skills.updated", "pet.soul_ready", "pet.reaction", "pet.growth", "pet.state", "pet.confirm", "pet.asset.updated", "system.activity", "workflow.created", "workflow.updated", "workflow.deleted", "workflow.runStarted", "workflow.runCompleted", "workflow.runFailed", "workflow.nodeStatus", "workflow.triggerDropped", "workflow.alert", "workflow.approvalRequested"];
|
|
17
17
|
/**
|
|
18
18
|
* Agent Team events (Solo Mode, Product Mode, Plan lifecycle).
|
|
19
19
|
* Relayed to the UI's team/orchestration panel.
|
|
20
20
|
*/
|
|
21
|
-
export declare const AGENT_TEAM_WS_EVENT_NAMES: readonly ["solo.progress", "solo.agentDelta", "solo.agentActivity", "solo.agentUsage", "solo.evaluation", "product.taskStarted", "product.taskOutput", "product.taskCompleted", "product.taskFailed", "product.budgetUpdate", "product.budgetWarning", "product.checkpointed", "product.completed", "product.dagTopology", "plan.interrupted"];
|
|
21
|
+
export declare const AGENT_TEAM_WS_EVENT_NAMES: readonly ["solo.progress", "solo.specProgress", "solo.agentDelta", "solo.agentActivity", "solo.agentUsage", "solo.evaluation", "product.taskStarted", "product.taskOutput", "product.members", "product.agentActivity", "product.taskCompleted", "product.taskFailed", "product.budgetUpdate", "product.budgetWarning", "product.checkpointed", "product.completed", "product.dagTopology", "plan.interrupted"];
|
|
22
22
|
/**
|
|
23
23
|
* All agent notifications that Gateway should relay to WS clients.
|
|
24
24
|
* Union of session events + team events.
|
|
25
25
|
*/
|
|
26
|
-
export declare const ALL_AGENT_WS_EVENT_NAMES: readonly ["turn.start", "turn.delta", "turn.end", "turn.error", "turn.recovery", "turn.tool_call", "turn.tool_result", "turn.tool_blocked", "turn.reasoning_delta", "turn.approval_request", "turn.skill_instruction", "turn.ask_user", "turn.media_result", "turn.media_progress", "turn.media_usage", "turn.media_capability_check", "turn.plan_update", "turn.suggestions", "turn.sidechain_started", "turn.subagent_started", "turn.subagent_delta", "turn.subagent_ended", "turn.sidechain_completed", "turn.task_updated", "turn.todos_updated", "turn.exec_progress", "turn.tool_use_summary", "turn.lifecycle", "turn.document_maintenance", "turn.artifact_contract", "turn.usage_update", "team.member.notification", "session.info", "memory.updated", "skills.updated", "pet.soul_ready", "pet.reaction", "pet.growth", "pet.state", "pet.confirm", "pet.asset.updated", "system.activity", "workflow.created", "workflow.updated", "workflow.deleted", "workflow.runStarted", "workflow.runCompleted", "workflow.runFailed", "workflow.nodeStatus", "workflow.triggerDropped", "workflow.alert", "workflow.approvalRequested", "solo.progress", "solo.agentDelta", "solo.agentActivity", "solo.agentUsage", "solo.evaluation", "product.taskStarted", "product.taskOutput", "product.taskCompleted", "product.taskFailed", "product.budgetUpdate", "product.budgetWarning", "product.checkpointed", "product.completed", "product.dagTopology", "plan.interrupted"];
|
|
26
|
+
export declare const ALL_AGENT_WS_EVENT_NAMES: readonly ["turn.start", "turn.delta", "turn.end", "turn.error", "turn.recovery", "turn.tool_call", "turn.tool_result", "turn.tool_blocked", "turn.reasoning_delta", "turn.approval_request", "turn.skill_instruction", "turn.ask_user", "turn.media_result", "turn.media_progress", "turn.media_usage", "turn.media_capability_check", "turn.plan_update", "turn.suggestions", "turn.sidechain_started", "turn.subagent_started", "turn.subagent_delta", "turn.subagent_ended", "turn.sidechain_completed", "turn.task_updated", "turn.todos_updated", "turn.exec_progress", "turn.tool_use_summary", "turn.tool_selection_policy", "turn.lifecycle", "turn.document_maintenance", "turn.artifact_contract", "turn.usage_update", "team.member.notification", "session.info", "memory.updated", "skills.updated", "pet.soul_ready", "pet.reaction", "pet.growth", "pet.state", "pet.confirm", "pet.asset.updated", "system.activity", "workflow.created", "workflow.updated", "workflow.deleted", "workflow.runStarted", "workflow.runCompleted", "workflow.runFailed", "workflow.nodeStatus", "workflow.triggerDropped", "workflow.alert", "workflow.approvalRequested", "solo.progress", "solo.specProgress", "solo.agentDelta", "solo.agentActivity", "solo.agentUsage", "solo.evaluation", "product.taskStarted", "product.taskOutput", "product.members", "product.agentActivity", "product.taskCompleted", "product.taskFailed", "product.budgetUpdate", "product.budgetWarning", "product.checkpointed", "product.completed", "product.dagTopology", "plan.interrupted"];
|
|
27
27
|
/** Type-level event name for session events. */
|
|
28
28
|
export type AgentWsEventName = (typeof AGENT_WS_EVENT_NAMES)[number];
|
|
29
29
|
/** Type-level event name for team events. */
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import type { ChatMessage, LocalizedToolText, ToolCapabilityCategory } from "./chat-types.js";
|
|
12
12
|
import type { GatewayRpcMethodMap } from "./gateway-rpc.js";
|
|
13
13
|
import type { WireTokenUsage } from "./notification-payloads.js";
|
|
14
|
-
import type { SoloEvaluation, SoloMessageParams, SoloEvaluateParams, SoloDeleteParams, ProductPlan, ProductPlanParams, ProductConfirmParams, ProductMessageParams, ProductIdParams, ProductDeleteParams, AgentsGetGatewayResult, AgentsListConfiguredItem, AgentsProcessInfo, AgentsKillParams, AgentsGetLogParams, AgentsGetLogResult, AgentsTestConnectionParams, AgentsTestConnectionResult } from "./acp-agent-management.js";
|
|
14
|
+
import type { SoloEvaluation, SoloMessageParams, SoloEvaluateParams, SoloDeleteParams, ProductPlan, ProductPlanParams, ProductConfirmParams, ProductMessageParams, ProductIdParams, ProductDeleteParams, ProductReplayParams, AgentsGetGatewayResult, AgentsListConfiguredItem, AgentsProcessInfo, AgentsKillParams, AgentsGetLogParams, AgentsGetLogResult, AgentsTestConnectionParams, AgentsTestConnectionResult } from "./acp-agent-management.js";
|
|
15
15
|
export type AgentCategory = "sub-agent" | "teammate";
|
|
16
16
|
export type AgentProtocol = "internal" | "acp";
|
|
17
17
|
export type AgentStatus = "available" | "unavailable" | "handshake_failed" | "not_installed";
|
|
@@ -103,6 +103,9 @@ export interface ProductTaskDef {
|
|
|
103
103
|
assignee: string;
|
|
104
104
|
prompt: string;
|
|
105
105
|
dependsOn?: string[];
|
|
106
|
+
/** Leader-authored "done" criteria: files to produce / how to self-check / terminal PASS.
|
|
107
|
+
* Appended to the task prompt so the evidence gate (assertProductTaskCompletionEvidence) sees it. */
|
|
108
|
+
acceptanceCriteria?: string;
|
|
106
109
|
}
|
|
107
110
|
export interface ProductStatus {
|
|
108
111
|
productId: string;
|
|
@@ -1263,6 +1266,13 @@ export interface AgentRpcMethodMap extends GatewayRpcMethodMap {
|
|
|
1263
1266
|
ok: true;
|
|
1264
1267
|
};
|
|
1265
1268
|
};
|
|
1269
|
+
"product.replay": {
|
|
1270
|
+
params: ProductReplayParams;
|
|
1271
|
+
result: {
|
|
1272
|
+
productId: string;
|
|
1273
|
+
ok: true;
|
|
1274
|
+
};
|
|
1275
|
+
};
|
|
1266
1276
|
"workflow.create": {
|
|
1267
1277
|
params: Record<string, unknown>;
|
|
1268
1278
|
result: Record<string, unknown>;
|
|
@@ -6,7 +6,7 @@ export { type ChatMessage, type ChatMessageRole, type LocalizedToolText, type Th
|
|
|
6
6
|
export { type AgentCapabilities, type AgentCategory, type AgentConfig, type AgentDescriptor, type AgentProtocol, type AgentRpcMethodMap, type AgentStatus, type CustomAgentDef, type ProductInstanceDef, type ProductPhase, type ProductStatus, type ProductSummary, type ProductTaskDef, type ProductTaskStatus, type SoloAgentResult, type SoloAgentState, type SoloState, type SoloStatus, } from "./agent-methods.js";
|
|
7
7
|
export type * from "./acp-agent-management.js";
|
|
8
8
|
export { AGENT_TEAM_WS_EVENT_NAMES, AGENT_WS_EVENT_NAMES, ALL_AGENT_WS_EVENT_NAMES, type AgentTeamWsEventName, type AgentWsEventName, type AllAgentWsEventName, } from "./agent-events.js";
|
|
9
|
-
export { type AgentSource, type AgentsErrorNotification, type AgentsStatusNotification, type ArtifactType, type MediaResultType, type MemoryDecayCompletedNotification, type MemoryUpdatedNotification, type NotificationMethod, type NotificationMethodMap, type NotificationThreadItem, type PermissionRuleUpdatedNotification, type PlanInterruptedNotification, type PongNotification, type ProductBudgetUpdateNotification, type ProductBudgetWarningNotification, type ProductCheckpointedNotification, type ProductCompletedNotification, type ProductDagTopologyNotification, type ProductTaskCompletedNotification, type ProductTaskFailedNotification, type ProductTaskOutputDeltaNotification, type ProductTaskStartedNotification, type ProjectArchivedNotification, type ProjectCreatedNotification, type ProjectDeletedNotification, type ProjectRenamedNotification, type ProjectSwitchedNotification, type ProjectUnarchivedNotification, type SessionInfoNotification, type SoloAgentDeltaNotification, type SoloAgentUsageNotification, type SoloEvaluationNotification, type SoloProgressNotification, type TeamMemberNotification, type ToolApprovalRequestNotification, type TurnAnnotationsNotification, type TurnArtifactContractNotification, type TurnArtifactNotification, type TurnAskUserNotification, type TurnDeltaNotification, type TurnEndNotification, type TurnErrorNotification, type TurnExecProgressNotification, type TurnHeartbeatNotification, type TurnMediaPersistedNotification, type TurnMediaProgressNotification, type TurnMediaResultNotification, type TurnPlanUpdateNotification, type TurnReasoningDeltaNotification, type TurnRecoveryNotification, type TurnSidechainCompletedNotification, type TurnSidechainStartedNotification, type TurnSkillAcquisitionNeededNotification, type TurnSkillInstructionNotification, type TurnStartNotification, type TurnSubagentDeltaNotification, type TurnSubagentEndedNotification, type TurnSubagentStartedNotification, type TurnSuggestionsNotification, type TurnTaskUpdatedNotification, type TurnTodosUpdatedNotification, type TurnToolBlockedNotification, type TurnToolCallNotification, type TurnToolResultNotification, type TurnToolUseSummaryNotification, type TurnUsageUpdateNotification, type WireTokenUsage, type ProductPlanReadyNotification, type ProductPlanFailedNotification, type ProductPlanningDeltaNotification, type PetSoulReadyNotification, type PetReactionNotification, type PetGrowthNotification, type PetStateNotification, type PetConfirmNotification, type WorkflowDeletedNotification, type WorkflowRecordNotification, type WorkflowRunCompletedNotification, type WorkflowRunFailedNotification, type WorkflowRunStartedNotification, } from "./notification-payloads.js";
|
|
9
|
+
export { type AgentSource, type AgentsErrorNotification, type AgentsStatusNotification, type ArtifactType, type MediaResultType, type MemoryDecayCompletedNotification, type MemoryUpdatedNotification, type NotificationMethod, type NotificationMethodMap, type NotificationThreadItem, type PermissionRuleUpdatedNotification, type PlanInterruptedNotification, type PongNotification, type ProductBudgetUpdateNotification, type ProductBudgetWarningNotification, type ProductCheckpointedNotification, type ProductCompletedNotification, type ProductDagTopologyNotification, type ProductTaskCompletedNotification, type ProductTaskFailedNotification, type ProductTaskOutputDeltaNotification, type ProductMembersNotification, type ProductAgentActivityNotification, type ProductTaskStartedNotification, type ProjectArchivedNotification, type ProjectCreatedNotification, type ProjectDeletedNotification, type ProjectRenamedNotification, type ProjectSwitchedNotification, type ProjectUnarchivedNotification, type SessionInfoNotification, type SoloAgentDeltaNotification, type SoloAgentUsageNotification, type SoloEvaluationNotification, type SoloProgressNotification, type TeamMemberNotification, type ToolApprovalRequestNotification, type TurnAnnotationsNotification, type TurnArtifactContractNotification, type TurnArtifactNotification, type TurnAskUserNotification, type TurnDeltaNotification, type TurnEndNotification, type TurnErrorNotification, type TurnExecProgressNotification, type TurnHeartbeatNotification, type TurnMediaPersistedNotification, type TurnMediaProgressNotification, type TurnMediaResultNotification, type TurnPlanUpdateNotification, type TurnReasoningDeltaNotification, type TurnRecoveryNotification, type TurnSidechainCompletedNotification, type TurnSidechainStartedNotification, type TurnSkillAcquisitionNeededNotification, type TurnSkillInstructionNotification, type TurnStartNotification, type TurnSubagentDeltaNotification, type TurnSubagentEndedNotification, type TurnSubagentStartedNotification, type TurnSuggestionsNotification, type TurnTaskUpdatedNotification, type TurnTodosUpdatedNotification, type TurnToolBlockedNotification, type TurnToolCallNotification, type TurnToolResultNotification, type TurnToolUseSummaryNotification, type TurnUsageUpdateNotification, type WireTokenUsage, type ProductPlanReadyNotification, type ProductPlanFailedNotification, type ProductPlanningDeltaNotification, type PetSoulReadyNotification, type PetReactionNotification, type PetGrowthNotification, type PetStateNotification, type PetConfirmNotification, type WorkflowDeletedNotification, type WorkflowRecordNotification, type WorkflowRunCompletedNotification, type WorkflowRunFailedNotification, type WorkflowRunStartedNotification, } from "./notification-payloads.js";
|
|
10
10
|
export { ACP_EXTENDED_METHODS, ACP_EXTENDED_SESSION_UPDATE_TYPES, ACP_METHODS, ACP_PROTOCOL_VERSION, ACP_SESSION_UPDATE_TYPES, isAcpJsonRpcNotification, isAcpJsonRpcRequest, isAcpJsonRpcResponse, isExtendedSessionUpdateType, isStandardSessionUpdateType, parseAcpMessage, type AcpAgentCapabilities, type AcpAgentMessageChunkPayload, type AcpAgentThoughtChunkPayload, type AcpConfigOptionDescriptor, type AcpConfigOptionUpdatePayload, type AcpContentBlock, type AcpEndTurnPayload, type AcpExtendedMethod, type AcpExtendedSessionUpdateType, type AcpFsReadTextFileParams, type AcpFsReadTextFileResult, type AcpFsWriteTextFileParams, type AcpFsWriteTextFileResult, type AcpHostCapabilities, type AcpInitializeParams, type AcpInitializeResult, type AcpJsonRpcError, type AcpJsonRpcMessage, type AcpJsonRpcNotification, type AcpJsonRpcRequest, type AcpJsonRpcResponse, type AcpMode, type AcpPermissionOption, type AcpPermissionRequestParams, type AcpPermissionRequestResult, type AcpPlanPayload, type AcpSessionCancelParams, type AcpSessionCloseParams, type AcpSessionMeta, type AcpSessionLoadParams, type AcpSessionModeState, type AcpSessionNewParams, type AcpSessionNewResult, type AcpSessionPromptParams, type AcpSessionPromptResult, type AcpSessionSetConfigParams, type AcpSessionUpdateNotification, type AcpSessionUpdateType, type AcpStandardMethod, type AcpStandardSessionUpdateType, type AcpStopReason, type AcpToolCallPayload, type AcpToolCallUpdatePayload, type AcpUsage, type AcpUsageUpdatePayload, type AcpXSessionInfoPayload, type AcpXSkillInstructionPayload, } from "./acp-protocol.js";
|
|
11
11
|
export { type ApprovalRequiredToolContract, type ModelSelectionReason, type PendingPromptContract, type RuntimeCapabilitySummaryContract, type RuntimeSessionContract, type SessionIdentityContract, } from "./session.js";
|
|
12
12
|
export { type GatewayChannelExecutionEgressContract, type GatewayChannelExecutionEgressKind, type GatewayChannelExecutionIngressBindingContract, type GatewayChannelExecutionIngressSource, } from "./channel-ingress.js";
|
|
@@ -266,6 +266,7 @@ export interface TurnHeartbeatNotification {
|
|
|
266
266
|
/** Structured telemetry for a tool use batch. */
|
|
267
267
|
export interface TurnToolUseSummaryNotification {
|
|
268
268
|
turnId: string;
|
|
269
|
+
telemetrySource?: "agent" | "agent-synthetic";
|
|
269
270
|
availableToolNames: string[];
|
|
270
271
|
enabledToolNames: string[];
|
|
271
272
|
toolCallNames: string[];
|
|
@@ -274,6 +275,18 @@ export interface TurnToolUseSummaryNotification {
|
|
|
274
275
|
reason: string;
|
|
275
276
|
}>;
|
|
276
277
|
}
|
|
278
|
+
/** Structured telemetry for why the enabled tool surface changed within a turn. */
|
|
279
|
+
export interface TurnToolSelectionPolicyNotification {
|
|
280
|
+
turnId: string;
|
|
281
|
+
policyId: string;
|
|
282
|
+
intent: "benchmark_state_maintenance" | "fresh_evidence" | "verification" | "final_answer" | "deferred_tool_discovery" | "tool_recovery" | "lifecycle_reconciliation";
|
|
283
|
+
reason: string;
|
|
284
|
+
availableToolNames: string[];
|
|
285
|
+
enabledToolNamesBefore: string[];
|
|
286
|
+
enabledToolNamesAfter: string[];
|
|
287
|
+
suppressedToolNames: string[];
|
|
288
|
+
nextAction: string;
|
|
289
|
+
}
|
|
277
290
|
/** Queryable long-horizon turn lifecycle telemetry. */
|
|
278
291
|
export interface TurnLifecycleNotification {
|
|
279
292
|
turnId: string;
|
|
@@ -302,6 +315,8 @@ export interface MaintainedDocumentIndex {
|
|
|
302
315
|
contentHash: string;
|
|
303
316
|
summary: string;
|
|
304
317
|
lastReviewedTurn: number;
|
|
318
|
+
fileSizeBytes: number;
|
|
319
|
+
recordCount: number;
|
|
305
320
|
}
|
|
306
321
|
export interface DecisionStateRecord {
|
|
307
322
|
id: string;
|
|
@@ -610,6 +625,11 @@ export interface ProductTaskCompletedNotification {
|
|
|
610
625
|
productId: string;
|
|
611
626
|
taskId: string;
|
|
612
627
|
result: string;
|
|
628
|
+
/** Per-task token usage harvested from the agent's usage tracker. */
|
|
629
|
+
inputTokens?: number;
|
|
630
|
+
outputTokens?: number;
|
|
631
|
+
/** Relative paths of files the task produced (before its worktree was torn down). */
|
|
632
|
+
changedFiles?: string[];
|
|
613
633
|
}
|
|
614
634
|
/** Product task failed. */
|
|
615
635
|
export interface ProductTaskFailedNotification {
|
|
@@ -661,6 +681,22 @@ export interface ProductTaskOutputDeltaNotification {
|
|
|
661
681
|
taskId: string;
|
|
662
682
|
text: string;
|
|
663
683
|
}
|
|
684
|
+
/** Live team roster, emitted once at run start (and on resume) so the 团队成员 panel populates live. */
|
|
685
|
+
export interface ProductMembersNotification {
|
|
686
|
+
productId: string;
|
|
687
|
+
members: {
|
|
688
|
+
agentId: string;
|
|
689
|
+
role: string;
|
|
690
|
+
name: string;
|
|
691
|
+
}[];
|
|
692
|
+
}
|
|
693
|
+
/** Per-task tool-call heartbeat (parity with Solo's solo.agentActivity) — keeps a silent-tool worker's
|
|
694
|
+
* detail pane from looking frozen by surfacing the tool it is currently using. */
|
|
695
|
+
export interface ProductAgentActivityNotification {
|
|
696
|
+
productId: string;
|
|
697
|
+
taskId: string;
|
|
698
|
+
toolName: string;
|
|
699
|
+
}
|
|
664
700
|
/** Leader agent produced a structured plan — client should present to user. */
|
|
665
701
|
export interface ProductPlanReadyNotification {
|
|
666
702
|
productId: string;
|
|
@@ -922,6 +958,7 @@ export interface NotificationMethodMap {
|
|
|
922
958
|
"turn.exec_progress": TurnExecProgressNotification;
|
|
923
959
|
"turn.heartbeat": TurnHeartbeatNotification;
|
|
924
960
|
"turn.tool_use_summary": TurnToolUseSummaryNotification;
|
|
961
|
+
"turn.tool_selection_policy": TurnToolSelectionPolicyNotification;
|
|
925
962
|
"turn.lifecycle": TurnLifecycleNotification;
|
|
926
963
|
"turn.document_maintenance": TurnDocumentMaintenanceNotification;
|
|
927
964
|
"turn.artifact": TurnArtifactNotification;
|
|
@@ -960,6 +997,8 @@ export interface NotificationMethodMap {
|
|
|
960
997
|
"product.dagTopology": ProductDagTopologyNotification;
|
|
961
998
|
"product.budgetUpdate": ProductBudgetUpdateNotification;
|
|
962
999
|
"product.taskOutput": ProductTaskOutputDeltaNotification;
|
|
1000
|
+
"product.members": ProductMembersNotification;
|
|
1001
|
+
"product.agentActivity": ProductAgentActivityNotification;
|
|
963
1002
|
"product.planReady": ProductPlanReadyNotification;
|
|
964
1003
|
"product.planFailed": ProductPlanFailedNotification;
|
|
965
1004
|
"product.planningDelta": ProductPlanningDeltaNotification;
|
|
@@ -201,3 +201,6 @@ export declare class AcpDetector {
|
|
|
201
201
|
*/
|
|
202
202
|
resolveCredentialError(agentId: string): string | null;
|
|
203
203
|
}
|
|
204
|
+
/** Best-effort resolve the backing model id for an agent (for the planning roster).
|
|
205
|
+
* Returns the configured/auto model or undefined. No spawn — reads config + auto env only. */
|
|
206
|
+
export declare function resolveAgentModel(detector: AcpDetector, id: string): string | undefined;
|
|
@@ -118,6 +118,15 @@ export declare class AcpProtocolAdapter {
|
|
|
118
118
|
* @param hostHandler Optional handler for agent→host requests (fs, terminal, permission)
|
|
119
119
|
*/
|
|
120
120
|
attach(child: ChildProcess, onNotification?: (method: string, params: unknown) => void, hostHandler?: AcpHostRequestHandler): void;
|
|
121
|
+
/**
|
|
122
|
+
* qlogicagent extends ACP `session/update` with an `x_*` variant namespace (x_relay, x_session_info,
|
|
123
|
+
* x_skill_instruction, …) that the standard SDK schema does not model and therefore rejects. Detect
|
|
124
|
+
* those notifications on the read side and dispatch them to onNotification directly — bypassing the
|
|
125
|
+
* SDK's strict validation — so the host's usage/progress accumulation runs exactly as it does for the
|
|
126
|
+
* internal-agent path. Returns true when the message was consumed here (and must be hidden from the
|
|
127
|
+
* SDK); false for everything else (standard updates, requests, responses) which the SDK handles.
|
|
128
|
+
*/
|
|
129
|
+
private consumeExtensionNotification;
|
|
121
130
|
/**
|
|
122
131
|
* Build the SDK Client implementation (agent→host reverse-RPC) from our loose host handler.
|
|
123
132
|
* Re-reads this.hostHandler / this.onNotification on each call so detach() takes effect.
|
|
@@ -1,209 +1,12 @@
|
|
|
1
1
|
import type { HookRegistry } from "../../contracts/hooks.js";
|
|
2
2
|
import type { ChatMessage as WireChatMessage, ToolDefinition as WireToolDefinition, WireTokenUsage } from "../../protocol/wire/index.js";
|
|
3
|
+
import type { TurnEvent } from "../../contracts/turn-event.js";
|
|
4
|
+
export type { TurnEvent } from "../../contracts/turn-event.js";
|
|
3
5
|
export type ChatMessage = WireChatMessage;
|
|
4
6
|
export type TokenUsage = WireTokenUsage;
|
|
5
7
|
export interface ToolDefinition extends WireToolDefinition {
|
|
6
8
|
backfillObservableInput?: (input: Record<string, unknown>) => void;
|
|
7
9
|
}
|
|
8
|
-
export type TurnEvent = {
|
|
9
|
-
type: "start";
|
|
10
|
-
turnId: string;
|
|
11
|
-
} | {
|
|
12
|
-
type: "delta";
|
|
13
|
-
turnId: string;
|
|
14
|
-
text: string;
|
|
15
|
-
} | {
|
|
16
|
-
type: "tool_call";
|
|
17
|
-
turnId: string;
|
|
18
|
-
callId: string;
|
|
19
|
-
name: string;
|
|
20
|
-
arguments: string;
|
|
21
|
-
inputSummary?: string;
|
|
22
|
-
} | {
|
|
23
|
-
type: "end";
|
|
24
|
-
turnId: string;
|
|
25
|
-
content: string;
|
|
26
|
-
usage?: TokenUsage;
|
|
27
|
-
model?: string;
|
|
28
|
-
provider?: string;
|
|
29
|
-
} | {
|
|
30
|
-
type: "error";
|
|
31
|
-
turnId: string;
|
|
32
|
-
error: string;
|
|
33
|
-
code?: string;
|
|
34
|
-
usage?: TokenUsage;
|
|
35
|
-
} | {
|
|
36
|
-
type: "skill_instruction";
|
|
37
|
-
turnId: string;
|
|
38
|
-
instruction: unknown;
|
|
39
|
-
} | {
|
|
40
|
-
type: "tool_result";
|
|
41
|
-
turnId: string;
|
|
42
|
-
callId: string;
|
|
43
|
-
name: string;
|
|
44
|
-
ok: boolean;
|
|
45
|
-
error?: string;
|
|
46
|
-
outputPreview?: string;
|
|
47
|
-
durationMs?: number;
|
|
48
|
-
exitCode?: number;
|
|
49
|
-
stdout?: string;
|
|
50
|
-
stderr?: string;
|
|
51
|
-
details?: Record<string, unknown>;
|
|
52
|
-
} | {
|
|
53
|
-
type: "tool_blocked";
|
|
54
|
-
turnId: string;
|
|
55
|
-
callId: string;
|
|
56
|
-
name: string;
|
|
57
|
-
reason: string;
|
|
58
|
-
} | {
|
|
59
|
-
type: "recovery";
|
|
60
|
-
turnId: string;
|
|
61
|
-
action: string;
|
|
62
|
-
detail?: string;
|
|
63
|
-
} | {
|
|
64
|
-
type: "plan_update";
|
|
65
|
-
turnId: string;
|
|
66
|
-
slug: string;
|
|
67
|
-
content: string;
|
|
68
|
-
} | {
|
|
69
|
-
type: "heartbeat";
|
|
70
|
-
turnId: string;
|
|
71
|
-
message: string;
|
|
72
|
-
} | {
|
|
73
|
-
type: "tool_use_summary";
|
|
74
|
-
turnId: string;
|
|
75
|
-
availableToolNames: string[];
|
|
76
|
-
enabledToolNames: string[];
|
|
77
|
-
toolCallNames: string[];
|
|
78
|
-
blockedToolCalls: Array<{
|
|
79
|
-
name: string;
|
|
80
|
-
reason: string;
|
|
81
|
-
}>;
|
|
82
|
-
} | {
|
|
83
|
-
type: "lifecycle";
|
|
84
|
-
turnId: string;
|
|
85
|
-
kind: "stage" | "reopen" | "resume" | "context_compression" | "goal_reconstruction" | "memory_drift" | "artifact_path_drift";
|
|
86
|
-
stage?: string;
|
|
87
|
-
status?: string;
|
|
88
|
-
detail?: string;
|
|
89
|
-
reconstruction?: GoalReconstructionState;
|
|
90
|
-
observedAt?: string;
|
|
91
|
-
} | {
|
|
92
|
-
type: "document_maintenance";
|
|
93
|
-
turnId: string;
|
|
94
|
-
checkpointId: string;
|
|
95
|
-
documents: MaintainedDocumentIndex[];
|
|
96
|
-
decisionStateTable: DecisionStateRecord[];
|
|
97
|
-
readCycleFindings: Array<Record<string, unknown>>;
|
|
98
|
-
readCycleGuard: ReadCycleGuard;
|
|
99
|
-
observedAt?: string;
|
|
100
|
-
} | {
|
|
101
|
-
type: "reasoning_delta";
|
|
102
|
-
turnId: string;
|
|
103
|
-
text: string;
|
|
104
|
-
} | {
|
|
105
|
-
type: "suggestions";
|
|
106
|
-
turnId: string;
|
|
107
|
-
items: Array<{
|
|
108
|
-
text: string;
|
|
109
|
-
icon?: string;
|
|
110
|
-
action?: string;
|
|
111
|
-
}>;
|
|
112
|
-
} | {
|
|
113
|
-
type: "media_result";
|
|
114
|
-
turnId: string;
|
|
115
|
-
mediaType: "image" | "tts" | "video" | "music" | "3d";
|
|
116
|
-
url: string;
|
|
117
|
-
model?: string;
|
|
118
|
-
provider?: string;
|
|
119
|
-
durationSeconds?: number;
|
|
120
|
-
width?: number;
|
|
121
|
-
height?: number;
|
|
122
|
-
mimeType?: string;
|
|
123
|
-
billingUnit?: string;
|
|
124
|
-
billingQuantity?: number;
|
|
125
|
-
taskId?: string;
|
|
126
|
-
} | {
|
|
127
|
-
type: "artifact";
|
|
128
|
-
turnId: string;
|
|
129
|
-
artifactId: string;
|
|
130
|
-
artifactType: "code" | "file" | "image" | "document" | "diagram" | "table";
|
|
131
|
-
title: string;
|
|
132
|
-
filePath?: string;
|
|
133
|
-
language?: string;
|
|
134
|
-
content?: string;
|
|
135
|
-
mimeType?: string;
|
|
136
|
-
} | {
|
|
137
|
-
type: "artifact_contract";
|
|
138
|
-
turnId: string;
|
|
139
|
-
artifactRoot?: string;
|
|
140
|
-
writePaths: string[];
|
|
141
|
-
outOfRootWrites: Array<{
|
|
142
|
-
path: string;
|
|
143
|
-
artifactRoot: string;
|
|
144
|
-
toolName: string;
|
|
145
|
-
}>;
|
|
146
|
-
devServerUrls: string[];
|
|
147
|
-
browserVerified: boolean;
|
|
148
|
-
browserEvidence: string[];
|
|
149
|
-
requiresBrowserAcceptance: boolean;
|
|
150
|
-
} | {
|
|
151
|
-
type: "annotations";
|
|
152
|
-
turnId: string;
|
|
153
|
-
annotations: Array<{
|
|
154
|
-
type: string;
|
|
155
|
-
url?: string;
|
|
156
|
-
title?: string;
|
|
157
|
-
[key: string]: unknown;
|
|
158
|
-
}>;
|
|
159
|
-
} | {
|
|
160
|
-
type: "subagent_started";
|
|
161
|
-
turnId: string;
|
|
162
|
-
subagentId: string;
|
|
163
|
-
agentType: string;
|
|
164
|
-
prompt?: string;
|
|
165
|
-
} | {
|
|
166
|
-
type: "subagent_ended";
|
|
167
|
-
turnId: string;
|
|
168
|
-
subagentId: string;
|
|
169
|
-
agentType: string;
|
|
170
|
-
ok: boolean;
|
|
171
|
-
outputPreview?: string;
|
|
172
|
-
error?: string;
|
|
173
|
-
};
|
|
174
|
-
export interface GoalReconstructionState {
|
|
175
|
-
goal: string;
|
|
176
|
-
artifactRoot: string;
|
|
177
|
-
decisions: string[];
|
|
178
|
-
defects: string[];
|
|
179
|
-
acceptanceCriteria: string[];
|
|
180
|
-
blockers: string[];
|
|
181
|
-
nextAction: string;
|
|
182
|
-
}
|
|
183
|
-
export interface MaintainedDocumentIndex {
|
|
184
|
-
name?: string;
|
|
185
|
-
path?: string;
|
|
186
|
-
indexed: true;
|
|
187
|
-
maintained: true;
|
|
188
|
-
indexVersion: string;
|
|
189
|
-
contentHash: string;
|
|
190
|
-
summary: string;
|
|
191
|
-
lastReviewedTurn: number;
|
|
192
|
-
}
|
|
193
|
-
export interface DecisionStateRecord {
|
|
194
|
-
id: string;
|
|
195
|
-
decision: string;
|
|
196
|
-
status: string;
|
|
197
|
-
evidence: string;
|
|
198
|
-
lastConfirmedTurn: number;
|
|
199
|
-
}
|
|
200
|
-
export interface ReadCycleGuard {
|
|
201
|
-
strategy: string;
|
|
202
|
-
nextReadPolicy: string;
|
|
203
|
-
budgetStatus: "within-budget";
|
|
204
|
-
maxReadsPerDocument: number;
|
|
205
|
-
observedReadsByPath: Record<string, number>;
|
|
206
|
-
}
|
|
207
10
|
export interface ToolInvoker {
|
|
208
11
|
invoke(turnId: string, name: string, args: string, signal?: AbortSignal): Promise<{
|
|
209
12
|
result: string;
|
|
@@ -48,6 +48,12 @@ export interface ToolCatalog {
|
|
|
48
48
|
removeTool(name: string): boolean;
|
|
49
49
|
activateTool(name: string): boolean;
|
|
50
50
|
clearActivatedTools(): void;
|
|
51
|
+
/** SSOT for the deferred-tool set consumed by the prompt index and the tool_search corpus. */
|
|
52
|
+
listDeferredTools(): Array<{
|
|
53
|
+
name: string;
|
|
54
|
+
description: string;
|
|
55
|
+
searchHint?: string;
|
|
56
|
+
}>;
|
|
51
57
|
}
|
|
52
58
|
export interface ToolBootstrapProgress {
|
|
53
59
|
output: string;
|
|
@@ -35,6 +35,23 @@ export declare function createTaskGuidanceSection(domain?: TaskDomain): SystemPr
|
|
|
35
35
|
* Tells the LLM when to use specialized tools vs. primitives.
|
|
36
36
|
*/
|
|
37
37
|
export declare function createToolGuidanceSection(): SystemPromptSection;
|
|
38
|
+
/**
|
|
39
|
+
* Render the deferred-tool listing with accuracy-aware token discipline.
|
|
40
|
+
*
|
|
41
|
+
* Dropping ALL descriptions to save tokens trades away tool-SELECTION accuracy:
|
|
42
|
+
* the model cannot tell `mcp__exa__search` from `mcp__github__search` by name.
|
|
43
|
+
* So spend the description budget exactly where confusion lives:
|
|
44
|
+
* - small set (<= richHintLimit): every tool rich.
|
|
45
|
+
* - built-in deferred tools (no server): always rich — small, bounded set.
|
|
46
|
+
* - MCP tools whose leaf name collides with another tool: keep the hint.
|
|
47
|
+
* - MCP tools with a unique leaf: name only (unambiguous; tool_search recovers
|
|
48
|
+
* details on demand).
|
|
49
|
+
* Names are ALWAYS listed so any capability can be `select:`ed directly.
|
|
50
|
+
*/
|
|
51
|
+
export declare function buildDeferredToolIndexBody(deferred: Array<{
|
|
52
|
+
name: string;
|
|
53
|
+
description: string;
|
|
54
|
+
}>, richHintLimit: number): string[];
|
|
38
55
|
/**
|
|
39
56
|
* Index of deferred tools so the model KNOWS these capabilities exist even
|
|
40
57
|
* though their schemas are not loaded. Without this the model sees only the
|
|
@@ -47,7 +64,9 @@ export declare function createToolGuidanceSection(): SystemPromptSection;
|
|
|
47
64
|
export declare function createDeferredToolIndexSection(listDeferredTools: () => Array<{
|
|
48
65
|
name: string;
|
|
49
66
|
description: string;
|
|
50
|
-
}
|
|
67
|
+
}>, options?: {
|
|
68
|
+
richHintLimit?: number;
|
|
69
|
+
}): SystemPromptSection;
|
|
51
70
|
/**
|
|
52
71
|
* Create a system prompt section that instructs the model on response language.
|
|
53
72
|
* CC parity: only injected when language is explicitly set; when absent,
|
|
@@ -34,7 +34,9 @@ export declare const ASK_USER_TOOL_SCHEMA: {
|
|
|
34
34
|
};
|
|
35
35
|
readonly options: {
|
|
36
36
|
readonly type: "array";
|
|
37
|
-
readonly
|
|
37
|
+
readonly minItems: 2;
|
|
38
|
+
readonly maxItems: 8;
|
|
39
|
+
readonly description: "2-8 options for the user to choose from. Omit for free text.";
|
|
38
40
|
readonly items: {
|
|
39
41
|
readonly type: "object";
|
|
40
42
|
readonly properties: {
|
|
@@ -52,7 +54,7 @@ export declare const ASK_USER_TOOL_SCHEMA: {
|
|
|
52
54
|
};
|
|
53
55
|
readonly multiSelect: {
|
|
54
56
|
readonly type: "boolean";
|
|
55
|
-
readonly description:
|
|
57
|
+
readonly description: string;
|
|
56
58
|
};
|
|
57
59
|
};
|
|
58
60
|
readonly required: readonly ["question", "header"];
|
|
@@ -42,3 +42,4 @@ export declare function commandHasAnyCd(command: string): boolean;
|
|
|
42
42
|
* Mirrors cc's `isSearchOrReadBashCommand()` + `isSilentBashCommand()`.
|
|
43
43
|
*/
|
|
44
44
|
export declare function classifyCommand(command: string): CommandClassification;
|
|
45
|
+
export declare function requiresDedicatedReadSearchTool(classification: CommandClassification): boolean;
|
|
@@ -23,6 +23,11 @@ export interface DeferredToolInfo {
|
|
|
23
23
|
description: string;
|
|
24
24
|
/** Optional search hint for better discovery */
|
|
25
25
|
searchHint?: string;
|
|
26
|
+
/** Compact parameter signature (e.g. "query, maxResults?") to disambiguate similar tools. */
|
|
27
|
+
paramSummary?: string;
|
|
28
|
+
score?: number;
|
|
29
|
+
matchedTerms?: string[];
|
|
30
|
+
matchedFields?: string[];
|
|
26
31
|
}
|
|
27
32
|
export interface ToolSearchOutput {
|
|
28
33
|
matches: DeferredToolInfo[];
|
|
@@ -52,7 +57,15 @@ export interface ToolSearchCorpusEntry {
|
|
|
52
57
|
name: string;
|
|
53
58
|
description: string;
|
|
54
59
|
searchHint?: string;
|
|
60
|
+
paramSummary?: string;
|
|
55
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Compact parameter signature for a JSON-Schema tool, e.g. "query, maxResults?".
|
|
64
|
+
* Required params are plain, optional ones suffixed "?". Surfacing this in search
|
|
65
|
+
* results raises tool-SELECTION accuracy: two lexically similar tools (e.g. two
|
|
66
|
+
* `search` tools) are told apart by their inputs, not guessed by name.
|
|
67
|
+
*/
|
|
68
|
+
export declare function summarizeToolParams(parameters: unknown): string;
|
|
56
69
|
/**
|
|
57
70
|
* Score a keyword query against a tool corpus (CC-aligned weights).
|
|
58
71
|
* Query syntax: plain terms rank, "+term" is required (must appear in
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type ToolSearchCorpusEntry } from "./tool-search-tool.js";
|
|
2
|
+
export type EvalLang = "en" | "zh";
|
|
3
|
+
export interface ToolSelectionCase {
|
|
4
|
+
id: string;
|
|
5
|
+
/** Natural-language / keyword intent issued to tool_search. */
|
|
6
|
+
query: string;
|
|
7
|
+
lang: EvalLang;
|
|
8
|
+
/** Tool names that count as a correct selection (one or more acceptable). */
|
|
9
|
+
expected: string[];
|
|
10
|
+
/** Optional note on what weakness this case probes. */
|
|
11
|
+
note?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface CaseResult {
|
|
14
|
+
id: string;
|
|
15
|
+
lang: EvalLang;
|
|
16
|
+
query: string;
|
|
17
|
+
expected: string[];
|
|
18
|
+
topMatch: string | null;
|
|
19
|
+
hitAt1: boolean;
|
|
20
|
+
hitAtK: boolean;
|
|
21
|
+
/** 1-based rank of the first expected tool among results, or null if absent. */
|
|
22
|
+
firstExpectedRank: number | null;
|
|
23
|
+
}
|
|
24
|
+
export interface EvalReport {
|
|
25
|
+
k: number;
|
|
26
|
+
total: number;
|
|
27
|
+
/** Share of cases whose #1 result is an expected tool. */
|
|
28
|
+
precisionAt1: number;
|
|
29
|
+
/** Share of cases with an expected tool anywhere in the top-k. */
|
|
30
|
+
recallAtK: number;
|
|
31
|
+
/** Mean reciprocal rank of the first expected tool. */
|
|
32
|
+
mrr: number;
|
|
33
|
+
byLang: Record<EvalLang, {
|
|
34
|
+
total: number;
|
|
35
|
+
precisionAt1: number;
|
|
36
|
+
recallAtK: number;
|
|
37
|
+
}>;
|
|
38
|
+
failures: CaseResult[];
|
|
39
|
+
results: CaseResult[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Run the deterministic search-ranking eval: feed each case's query through
|
|
43
|
+
* searchToolCorpus and score whether the expected tool is surfaced (and where).
|
|
44
|
+
*/
|
|
45
|
+
export declare function evalSearchSelection(corpus: ToolSearchCorpusEntry[], cases: ToolSelectionCase[], options?: {
|
|
46
|
+
k?: number;
|
|
47
|
+
}): EvalReport;
|
|
48
|
+
/** Human-readable report — printed on gate failure so CI logs name the regressed cases. */
|
|
49
|
+
export declare function formatEvalReport(report: EvalReport): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ToolSearchCorpusEntry } from "./tool-search-tool.js";
|
|
2
|
+
import type { ToolSelectionCase } from "./tool-selection-eval.js";
|
|
3
|
+
/** Representative deferred corpus: built-in media/dev tools + colliding MCP tools. */
|
|
4
|
+
export declare const SEED_CORPUS: ToolSearchCorpusEntry[];
|
|
5
|
+
export declare const SEED_CASES: ToolSelectionCase[];
|