qlogicagent 2.23.4 → 2.23.6
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/README.md +1 -1
- package/dist/agent.js +43 -43
- package/dist/cli.js +7 -7
- package/dist/index.js +307 -309
- package/dist/types/agent/tool-loop.d.ts +2 -0
- package/dist/types/agent/types.d.ts +5 -2
- package/dist/types/cli/acp-session-handlers.d.ts +2 -2
- package/dist/types/cli/acp-session-host.d.ts +1 -0
- package/dist/types/cli/handlers/turn-handler.d.ts +2 -14
- package/dist/types/cli/stdio-server.d.ts +1 -1
- package/dist/types/cli/turn-core.d.ts +2 -0
- package/dist/types/contracts/tool-schema-load.d.ts +6 -0
- package/dist/types/protocol/wire/acp-protocol.d.ts +12 -0
- package/dist/types/protocol/wire/index.d.ts +1 -1
- package/dist/types/runtime/infra/context-ledger.d.ts +27 -0
- package/dist/types/runtime/prompt/capability-schema-directory.d.ts +17 -0
- package/dist/types/runtime/prompt/environment-context.d.ts +3 -87
- package/dist/types/runtime/prompt/prompt-policy.d.ts +1 -1
- package/dist/types/runtime/prompt/system-prompt-sections.d.ts +1 -1
- package/dist/types/skills/permissions/hook-runner.d.ts +3 -0
- package/dist/types/skills/permissions/operation-classifier.d.ts +2 -0
- package/dist/types/skills/tools/tool-schema-load-tool.d.ts +6 -0
- package/dist/types/skills/tools.d.ts +3 -2
- package/dist/types/transport/acp-server.d.ts +2 -2
- package/package.json +1 -1
- package/dist/types/runtime/prompt/task-domain.d.ts +0 -20
|
@@ -72,6 +72,8 @@ export interface ToolLoopParams {
|
|
|
72
72
|
* or the same array reference if unchanged.
|
|
73
73
|
*/
|
|
74
74
|
refreshTools?: () => ToolDefinition[];
|
|
75
|
+
/** Exact tool names whose full schemas must be activated by tool_schema_load. */
|
|
76
|
+
deferredToolNames?: readonly string[];
|
|
75
77
|
/**
|
|
76
78
|
* Drain user guidance queued MID-TURN (队列"运行中引导"). Called at the top of
|
|
77
79
|
* every loop round; each returned string is appended as a user message before
|
|
@@ -97,11 +97,14 @@ export interface TurnRequest {
|
|
|
97
97
|
memoryRecallPrefetch?: MemoryRecallPrefetch;
|
|
98
98
|
/** Full registered tool surface before per-turn policy filtering. */
|
|
99
99
|
availableTools?: ToolDefinition[];
|
|
100
|
+
/** Exact tool names whose full parameter schemas are loaded only after Agent selection. */
|
|
101
|
+
deferredToolNames?: string[];
|
|
100
102
|
tools: ToolDefinition[];
|
|
101
103
|
/**
|
|
102
104
|
* Live tool-manifest rebuild, consulted each loop iteration (turnCount > 1).
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
+
* It may retract or restore tools from the turn's initial authoritative snapshot.
|
|
106
|
+
* Newly registered tools become visible on the next user turn so they cannot bypass
|
|
107
|
+
* the complete directory, schema deferral, or permission snapshot for this turn.
|
|
105
108
|
*/
|
|
106
109
|
refreshTools?: () => ToolDefinition[];
|
|
107
110
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AcpSessionHost } from "./acp-session-host.js";
|
|
2
|
-
import { type AcpInitializeParams, type AcpInitializeResult, type AcpSessionCloseParams, type AcpSessionLoadParams, type AcpSessionMeta, type AcpSessionNewParams, type AcpSessionNewResult, type AcpSessionPromptParams, type AcpSessionPromptResult, type AcpSessionSetConfigParams } from "../protocol/wire/index.js";
|
|
2
|
+
import { type AcpInitializeParams, type AcpInitializeResult, type AcpSessionCloseParams, type AcpSessionLoadParams, type AcpSessionMeta, type AcpSessionNewParams, type AcpSessionNewResult, type AcpSessionPromptParams, type AcpSessionPromptResult, type AcpSessionSetConfigParams, type AcpSessionSetConfigResult } from "../protocol/wire/index.js";
|
|
3
3
|
export type { AcpSessionHost };
|
|
4
4
|
/**
|
|
5
5
|
* Resolve the _meta a prompt must inherit: prefer the meta registered for THIS session (session/new)
|
|
@@ -36,7 +36,7 @@ export declare function tryDispatchCommand(host: AcpSessionHost, params: AcpSess
|
|
|
36
36
|
}>;
|
|
37
37
|
export declare function handleAcpSessionPrompt(host: AcpSessionHost, params: AcpSessionPromptParams): Promise<AcpSessionPromptResult>;
|
|
38
38
|
export declare function handleAcpSessionClose(host: AcpSessionHost, params: AcpSessionCloseParams): Promise<void>;
|
|
39
|
-
export declare function handleAcpSessionSetConfig(host: AcpSessionHost, params: AcpSessionSetConfigParams): Promise<
|
|
39
|
+
export declare function handleAcpSessionSetConfig(host: AcpSessionHost, params: AcpSessionSetConfigParams): Promise<AcpSessionSetConfigResult>;
|
|
40
40
|
export declare function handleAcpSessionSetModel(host: AcpSessionHost, _sessionId: string, model: string): Promise<void>;
|
|
41
41
|
/**
|
|
42
42
|
* Standard ACP session/set_mode: validate the requested permission mode and record it on the
|
|
@@ -25,6 +25,7 @@ export interface MaterializedSessionBinding extends SessionLlmConfig {
|
|
|
25
25
|
}
|
|
26
26
|
/** Gateway-materialized session-private profile. apiKey exists in memory only. */
|
|
27
27
|
export interface MaterializedSessionProfile {
|
|
28
|
+
bindingRevision: string;
|
|
28
29
|
bindings: Record<string, MaterializedSessionBinding>;
|
|
29
30
|
permissions: Record<string, unknown>;
|
|
30
31
|
}
|
|
@@ -107,22 +107,10 @@ export declare function hydrateAttachmentReferenceUrlsForTurn(messages: ChatMess
|
|
|
107
107
|
*/
|
|
108
108
|
export declare function augmentLastUserMessageContent(messages: ChatMessage[], modelContext: string): ChatMessage[];
|
|
109
109
|
export declare function getLatestUserTextForTurn(messages: readonly ChatMessage[]): string;
|
|
110
|
-
/**
|
|
111
|
-
* Insert the per-turn DOMAIN guidance block as a SYSTEM-role message immediately BEFORE the
|
|
112
|
-
* last user message (LLM view only) — the prompt-cache alignment path.
|
|
113
|
-
*
|
|
114
|
-
* The domain block carries markdown headers ("# Doing Tasks"), the word "artifact", and example
|
|
115
|
-
* file paths — baking it into the user message
|
|
116
|
-
* would poison the user-intent scans (final-marker extraction, artifact counting, round/tool
|
|
117
|
-
* budgets) that read `role === "user"` content. A system message keeps the model bound to the
|
|
118
|
-
* guidance while staying invisible to those scans. Kept out of the system PROMPT so a domain
|
|
119
|
-
* switch never re-encodes the byte-stable prefix or the conversation history. The original
|
|
120
|
-
* array/objects are never mutated.
|
|
121
|
-
*/
|
|
122
110
|
/**
|
|
123
111
|
* Two-layer memory INDEX block for the per-turn conversation channel (global
|
|
124
112
|
* owner cheat-sheet first, then project notes; injected before the last user
|
|
125
|
-
* message
|
|
113
|
+
* message). Living here instead of the system prompt
|
|
126
114
|
* is deliberate: INDEX content changes whenever Host project memory is updated,
|
|
127
115
|
* and as a volatile system-prompt section every update re-encoded the byte-stable
|
|
128
116
|
* prefix plus the whole conversation history on the next turn. In the per-turn
|
|
@@ -130,7 +118,7 @@ export declare function getLatestUserTextForTurn(messages: readonly ChatMessage[
|
|
|
130
118
|
*/
|
|
131
119
|
export declare function buildMemoryIndexBlock(globalBlock: string | null, projectBlock: string | null): string | null;
|
|
132
120
|
export declare function buildMemoryIndexAdmissionReceipt(globalBlock: string | null, projectBlock: string | null, sessionId: string, turnId: string): Record<string, unknown> | null;
|
|
133
|
-
export declare function
|
|
121
|
+
export declare function injectContextBeforeLastUser(messages: ChatMessage[], context: string): ChatMessage[];
|
|
134
122
|
export declare function refreshPermissionCheckerToolMeta(permissionChecker: PermissionMetadataResolver | null | undefined, tools: ToolDefinition[]): void;
|
|
135
123
|
export declare function handleUserResponse(this: TurnControlHandlerHost, msg: AgentRpcRequest): void;
|
|
136
124
|
interface ModalityRegistryView {
|
|
@@ -59,7 +59,7 @@ export declare class StdioServer {
|
|
|
59
59
|
* and never touched by it.
|
|
60
60
|
*/
|
|
61
61
|
private readonly resolvedAgent;
|
|
62
|
-
/** Active session/turn identity + lifecycle (id/turn/state/
|
|
62
|
+
/** Active session/turn identity + lifecycle (id/turn/state/llmConfig/acpMeta). */
|
|
63
63
|
private readonly session;
|
|
64
64
|
taskStore: TaskStore;
|
|
65
65
|
/** Unified background execution registry (agent forks + backgrounded shell commands). */
|
|
@@ -13,6 +13,8 @@ export interface TurnCoreRequest {
|
|
|
13
13
|
messages: ChatMessage[];
|
|
14
14
|
/** Full registered tool surface before per-turn policy filtering. */
|
|
15
15
|
availableTools?: ToolDefinition[];
|
|
16
|
+
/** Exact capability names whose full schemas are loaded only after Agent selection. */
|
|
17
|
+
deferredToolNames?: string[];
|
|
16
18
|
tools: ToolDefinition[];
|
|
17
19
|
/** Live tool-manifest rebuild for same-turn activation (forwarded to the loop). */
|
|
18
20
|
refreshTools?: () => ToolDefinition[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const TOOL_SCHEMA_LOAD_TOOL_NAME = "tool_schema_load";
|
|
2
|
+
export interface ToolSchemaLoadDetails extends Record<string, unknown> {
|
|
3
|
+
type: "tool_schema_load";
|
|
4
|
+
requestedToolNames: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare function toolSchemaLoadNames(details: Record<string, unknown> | undefined): string[];
|
|
@@ -241,6 +241,18 @@ export interface AcpSessionSetConfigParams {
|
|
|
241
241
|
option: string;
|
|
242
242
|
value: unknown;
|
|
243
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* Semantic acknowledgement for a session-private configuration write.
|
|
246
|
+
* `bindingRevision` is present for the Host-owned profile projection and lets
|
|
247
|
+
* the Host prove that the exact materialization sent after session/load was
|
|
248
|
+
* committed before it admits a prompt.
|
|
249
|
+
*/
|
|
250
|
+
export interface AcpSessionSetConfigResult {
|
|
251
|
+
applied: true;
|
|
252
|
+
sessionId: string;
|
|
253
|
+
option: string;
|
|
254
|
+
bindingRevision?: string;
|
|
255
|
+
}
|
|
244
256
|
/**
|
|
245
257
|
* The `session/update` notification params.
|
|
246
258
|
* Standard format: { sessionId, update: { sessionUpdate: "<type>", ...payload } }
|
|
@@ -6,7 +6,7 @@ export { type AgentRpcMethodMap, type ProductInstanceDef, type ProductPhase, typ
|
|
|
6
6
|
export type * from "./acp-agent-management.js";
|
|
7
7
|
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";
|
|
8
8
|
export { type AgentSource, type ArtifactType, type MediaResultType, type MemoryDecayCompletedNotification, type MemoryUpdatedNotification, type NotificationMethod, type NotificationMethodMap, type NotificationThreadItem, type ThreadItemNotification, 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 ProjectDetachedNotification, type ProjectAttachedNotification, type ProjectRenamedNotification, type ProjectSwitchedNotification, type ProjectUnarchivedNotification, type SessionInfoNotification, type SessionRecoveryPendingNotification, 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 TurnMediaResultNotification, type TurnPlanUpdateNotification, type TurnProgressNotification, type TurnReasoningDeltaNotification, type TurnRecoveryNotification, type TurnSidechainCompletedNotification, type TurnSidechainStartedNotification, type TurnSkillAcquisitionNeededNotification, type TurnStartNotification, type TurnSubagentActivityNotification, type TurnSubagentActivityStatus, type TurnSubagentCompletedNotification, type TurnSubagentDecisionNotification, type TurnSubagentDeltaNotification, type TurnSubagentEndedNotification, type TurnSubagentEvidenceItem, type TurnSubagentStartedNotification, type TurnSubagentTokenUsage, type TurnSuggestionsNotification, type TurnTaskUpdatedNotification, type TurnTodosUpdatedNotification, type TurnToolBlockedNotification, type TurnToolCallNotification, type TurnToolResultNotification, type TurnToolSelectionPolicyNotification, type ToolCallExecutionEvidence, type FinalAnswerEvidence, type TurnToolUseSummaryNotification, type TurnUsageUpdateNotification, type WireTokenUsage, type ProductPlanReadyNotification, type ProductPlanFailedNotification, type ProductPlanningDeltaNotification, type ProductLeaderMessageNotification, type ProductPlanningAskNotification, type MentionDelegateStartedNotification, type MentionDelegateActivityNotification, type MentionDelegateSettledNotification, type WorkflowDeletedNotification, type WorkflowRecordNotification, type WorkflowRunCompletedNotification, type WorkflowRunFailedNotification, type WorkflowRunStartedNotification, } from "./notification-payloads.js";
|
|
9
|
-
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, ACP_PERMISSION_PRESENTATION_META_KEY, type AcpPermissionPresentationMetaV1, 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";
|
|
9
|
+
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, ACP_PERMISSION_PRESENTATION_META_KEY, type AcpPermissionPresentationMetaV1, 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 AcpSessionSetConfigResult, 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";
|
|
10
10
|
export { type ApprovalRequiredToolContract, type ModelSelectionReason, type PendingPromptContract, type RuntimeCapabilitySummaryContract, type RuntimeSessionContract, type SessionIdentityContract, } from "./session.js";
|
|
11
11
|
export { CAPABILITY_MANIFEST_DIFF_SECTIONS, cloneCapabilityManifestSnapshot, createCapabilityManifestDiffPayload, deriveCapabilityToolNamespaces, deriveCapabilityWorkspaceIds, mergeCapabilityManifestSnapshot, type CapabilityManifestApprovalMode, type CapabilityManifestApprovalPolicyContract, type CapabilityManifestDiffSection, type CapabilityMcpManifestContract, type CapabilityManifestSnapshotContract, type HostCapabilitySnapshotContract, type CapabilityPluginManifestContract, type RuntimeCapabilityViewContract, type RuntimeToolEligibilityContract, type CapabilitySkillManifestContract, type CapabilityToolManifestContract, type CapabilityWorkspaceSummaryContract, type ToolEligibilityResolvedSource, type ToolEligibilityReasonCode, type ToolEligibilityStatus, } from "./capability-manifest.js";
|
|
12
12
|
export { WEB_ACTION_SCOPE_VALUES, WEB_APPROVAL_DEFAULT_VALUES, WEB_CAPABILITY_FAMILY_VALUES, WEB_CAPABILITY_ID_VALUES, WEB_DEGRADATION_TARGET_VALUES, WEB_ESCALATION_REASON_VALUES, WEB_EXECUTION_MODE_VALUES, WEB_POLICY_RISK_CLASS_VALUES, WEB_RETRY_POLICY_VALUES, WEB_STATEFULNESS_VALUES, WEB_TASK_MODE_VALUES, type WebActionScope, type WebApprovalDefault, type WebCapabilityDescriptorContract, type WebCapabilityFamily, type WebCapabilityId, type WebDegradationTarget, type WebEscalationReason, type WebExecutionMode, type WebPolicyRiskClass, type WebRetryPolicy, type WebStatefulness, type WebTaskMode, type ToolRiskLevel, } from "./web-capability.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ChatMessage, ToolDefinition } from "../../agent/types.js";
|
|
2
|
+
export declare function toolDefinitionChars(tools: readonly ToolDefinition[]): number;
|
|
3
|
+
export declare function messageHistoryChars(messages: readonly ChatMessage[]): number;
|
|
4
|
+
export declare function nativePromptCacheKey(input: {
|
|
5
|
+
systemPrompt: string;
|
|
6
|
+
capabilityRevision: string;
|
|
7
|
+
provider?: string;
|
|
8
|
+
model?: string;
|
|
9
|
+
}): string;
|
|
10
|
+
export interface ContextLedgerSnapshot {
|
|
11
|
+
systemChars: number;
|
|
12
|
+
capabilityDirectoryChars: number;
|
|
13
|
+
residentToolDefinitionChars: number;
|
|
14
|
+
deferredToolDefinitionChars: number;
|
|
15
|
+
historyChars: number;
|
|
16
|
+
memoryChars: number;
|
|
17
|
+
cacheKeyId: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function buildContextLedgerSnapshot(input: {
|
|
20
|
+
systemPrompt: string;
|
|
21
|
+
capabilityDirectory: string;
|
|
22
|
+
residentTools: readonly ToolDefinition[];
|
|
23
|
+
deferredToolDefinitionChars: number;
|
|
24
|
+
messages: readonly ChatMessage[];
|
|
25
|
+
memoryChars: number;
|
|
26
|
+
promptCacheKey: string;
|
|
27
|
+
}): ContextLedgerSnapshot;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ToolDefinition } from "../../agent/types.js";
|
|
2
|
+
export declare const MAX_RESIDENT_PARAMETER_SCHEMA_CHARS = 1024;
|
|
3
|
+
export interface CapabilitySchemaDirectoryProjection {
|
|
4
|
+
allTools: ToolDefinition[];
|
|
5
|
+
residentTools: ToolDefinition[];
|
|
6
|
+
deferredToolNames: string[];
|
|
7
|
+
prompt: string;
|
|
8
|
+
revision: `sha256:${string}`;
|
|
9
|
+
stats: {
|
|
10
|
+
allDefinitionChars: number;
|
|
11
|
+
residentDefinitionChars: number;
|
|
12
|
+
deferredDefinitionChars: number;
|
|
13
|
+
directoryChars: number;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare function shouldDeferToolSchema(tool: ToolDefinition): boolean;
|
|
17
|
+
export declare function projectCapabilitySchemaDirectory(tools: readonly ToolDefinition[]): CapabilitySchemaDirectoryProjection;
|
|
@@ -1,102 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Compact, cache-stable facts and authority boundaries for each Agent turn.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* CC reference: ShellSnapshot.ts (shell type detection),
|
|
8
|
-
* shellCompletion.ts (platform-aware command generation)
|
|
9
|
-
*
|
|
10
|
-
* This is a system prompt section that provides:
|
|
11
|
-
* - OS name + version
|
|
12
|
-
* - Shell type (bash/powershell/zsh)
|
|
13
|
-
* - Current working directory
|
|
14
|
-
* - Node.js version
|
|
15
|
-
* - Available package managers
|
|
4
|
+
* Capability meaning belongs to tool-owned metadata. Workflow knowledge belongs
|
|
5
|
+
* to selected Skills. This module must not become a second routing or playbook layer.
|
|
16
6
|
*/
|
|
17
7
|
import { type SystemPromptSection } from "./system-prompt-sections.js";
|
|
18
|
-
import type { TaskDomain } from "./task-domain.js";
|
|
19
8
|
export type ShellType = "bash" | "powershell" | "zsh" | "cmd" | "fish" | "unknown";
|
|
20
|
-
/**
|
|
21
|
-
* Structural snapshot of the shell provider that `exec()` actually drives.
|
|
22
|
-
*
|
|
23
|
-
* Defined LOCALLY (not imported from src/skills/tools/shell) on purpose: the
|
|
24
|
-
* runtime/prompt layer must not depend on the skills layer (architecture
|
|
25
|
-
* boundary). The CLI layer, which may import both, reads the real snapshot via
|
|
26
|
-
* `getActiveShellInfo()` and passes it in here; TS structural typing makes the
|
|
27
|
-
* shapes compatible without a cross-layer import.
|
|
28
|
-
*/
|
|
29
9
|
export interface ShellInfo {
|
|
30
10
|
type: "bash" | "powershell";
|
|
31
11
|
shellPath?: string;
|
|
32
12
|
psEdition?: "5.1" | "7+";
|
|
33
13
|
isGitBashOnWindows?: boolean;
|
|
34
14
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Dynamic, platform-specific shell guidance lines appended to `# Environment`.
|
|
37
|
-
*
|
|
38
|
-
* When `shellInfo` is present it reflects the REAL active shell (edition +
|
|
39
|
-
* Git-Bash-on-Windows), so the advice matches what commands will actually run
|
|
40
|
-
* against. When absent, we fall back to the env-guessed `shellType` and keep the
|
|
41
|
-
* old one-line PowerShell/CMD note (never crashes, never over-claims an edition
|
|
42
|
-
* we don't know).
|
|
43
|
-
*/
|
|
44
|
-
export declare function shellGuidanceLines(shellInfo: ShellInfo | undefined, shellType: ShellType): string[];
|
|
45
|
-
/**
|
|
46
|
-
* Create a system prompt section that provides environment context.
|
|
47
|
-
* Memoized — computed once per session (environment doesn't change mid-session).
|
|
48
|
-
*
|
|
49
|
-
* @param cwdOverride Working directory to report (defaults to process.cwd()).
|
|
50
|
-
* @param shellInfo Real active-shell facts from the provider (via the CLI).
|
|
51
|
-
* When omitted, the `- Shell:` line and guidance fall back to
|
|
52
|
-
* `detectShellType()` (env-based guess). The shell identity is
|
|
53
|
-
* folded into the memoize key so a different shell doesn't
|
|
54
|
-
* serve a stale cached section for the same cwd.
|
|
55
|
-
*/
|
|
56
15
|
export declare function createEnvironmentContextSection(cwdOverride?: string, shellInfo?: ShellInfo): SystemPromptSection;
|
|
57
|
-
/**
|
|
58
|
-
* Domain-specific guidance ONLY — the small, genuinely per-turn-variable block.
|
|
59
|
-
* Excludes universalGuidance() (which is domain-INVARIANT and lives in its own
|
|
60
|
-
* stable section, see createUniversalGuidanceSection). This is the single source
|
|
61
|
-
* of truth for domain content, so the combined section and the split sections
|
|
62
|
-
* never drift.
|
|
63
|
-
*
|
|
64
|
-
* @param domain - Task domain from auto-detection or host override.
|
|
65
|
-
*/
|
|
66
|
-
export declare function renderDomainGuidanceBlock(domain?: TaskDomain): string[];
|
|
67
|
-
/**
|
|
68
|
-
* Universal (domain-INVARIANT) working-approach guidance as a STABLE (memoized)
|
|
69
|
-
* system section. Byte-identical every turn regardless of the detected domain, so
|
|
70
|
-
* it belongs in the cacheable system-prompt prefix. The per-turn domain block
|
|
71
|
-
* (renderDomainGuidanceBlock) is deliberately NOT part of this section — it is
|
|
72
|
-
* injected as a system message right before the last user message so the system
|
|
73
|
-
* prompt stays byte-stable when the detected domain switches.
|
|
74
|
-
*/
|
|
75
16
|
export declare function createUniversalGuidanceSection(): SystemPromptSection;
|
|
76
|
-
/**
|
|
77
|
-
* Create a system prompt section that provides tool usage guidance.
|
|
78
|
-
* CC parity: matches claude-code's getUsingYourToolsSection().
|
|
79
|
-
* Tells the LLM when to use specialized tools vs. primitives.
|
|
80
|
-
*/
|
|
81
|
-
export declare function createToolGuidanceSection(): SystemPromptSection;
|
|
82
|
-
/**
|
|
83
|
-
* Create a system prompt section that instructs the model on response language.
|
|
84
|
-
* CC parity: only injected when language is explicitly set; when absent,
|
|
85
|
-
* the model follows the user's message language naturally.
|
|
86
|
-
*
|
|
87
|
-
* Key rule: always respond in the SAME language as the user's current message.
|
|
88
|
-
* This prevents confusion when system prompt contains mixed-language content
|
|
89
|
-
* (e.g., Chinese INDEX.md + English tool guidance).
|
|
90
|
-
*/
|
|
91
17
|
export declare function createLanguageSection(language?: string): SystemPromptSection;
|
|
92
|
-
/**
|
|
93
|
-
* Detect the response language from the user's current-turn text so the strong
|
|
94
|
-
* explicit-language branch of createLanguageSection actually fires.
|
|
95
|
-
*
|
|
96
|
-
* The soft "mirror the user" fallback is not enough for weaker models: buried
|
|
97
|
-
* under a wall of English guidance, they drift to English even for a Chinese
|
|
98
|
-
* prompt. Naming the language ("Always respond in 简体中文") is the load-bearing
|
|
99
|
-
* signal. Han characters present -> Chinese; otherwise undefined (let the soft
|
|
100
|
-
* fallback handle English/other, which weak models already mirror fine).
|
|
101
|
-
*/
|
|
102
18
|
export declare function detectResponseLanguage(userText: string): string | undefined;
|
|
@@ -39,7 +39,7 @@ export declare function resolveSystemPromptSections(sections: SystemPromptSectio
|
|
|
39
39
|
*/
|
|
40
40
|
export declare function clearSystemPromptSections(): void;
|
|
41
41
|
export interface SystemPromptAssemblyOptions {
|
|
42
|
-
/** Include
|
|
42
|
+
/** Include internal prompt-policy metadata for diagnostics. Defaults to false. */
|
|
43
43
|
includePromptPolicy?: boolean;
|
|
44
44
|
/** Base system prompt (from Gateway config) */
|
|
45
45
|
basePrompt?: string;
|
|
@@ -11,6 +11,8 @@ export interface PermissionCheckerDeps {
|
|
|
11
11
|
hookRegistry: HookRegistry;
|
|
12
12
|
/** Returns the current workspace root for operation classification. */
|
|
13
13
|
getWorkspaceRoot(): string;
|
|
14
|
+
/** Host-owned, session-scoped roots that read-only tools may consume directly. */
|
|
15
|
+
getTrustedReadRoots?: () => readonly string[];
|
|
14
16
|
/**
|
|
15
17
|
* Callback to send an approval request to the host (Gateway/Electron).
|
|
16
18
|
* Must return a promise that resolves when the user responds.
|
|
@@ -63,6 +65,7 @@ export declare class PermissionChecker {
|
|
|
63
65
|
private readonly ruleEngine;
|
|
64
66
|
private readonly hookRegistry;
|
|
65
67
|
private readonly getWorkspaceRoot;
|
|
68
|
+
private readonly getTrustedReadRoots;
|
|
66
69
|
private readonly onRequestApproval;
|
|
67
70
|
private readonly onDenied;
|
|
68
71
|
private readonly classifierLLMCall;
|
|
@@ -24,6 +24,8 @@ export interface OperationClassification {
|
|
|
24
24
|
}
|
|
25
25
|
export interface ClassifyContext {
|
|
26
26
|
workspaceRoot: string;
|
|
27
|
+
/** Host-owned, session-scoped roots that read-only tools may consume without a user prompt. */
|
|
28
|
+
trustedReadRoots?: readonly string[];
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* Canonical set of shell-command tool names. This is the single source of truth,
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
* module-level functions below remain as a compatibility facade for older
|
|
7
7
|
* bootstrap paths while those call sites are migrated.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* The registry owns complete executable definitions. Prompt projection may keep
|
|
10
|
+
* large parameter schemas non-resident until the Agent explicitly expands an
|
|
11
|
+
* exact capability name; execution still resolves here through the original tool.
|
|
11
12
|
*/
|
|
12
13
|
import type { PortableTool } from "./portable-tool.js";
|
|
13
14
|
import type { ToolDefinition } from "../protocol/wire/index.js";
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* existing internal handlers.
|
|
18
18
|
*/
|
|
19
19
|
import type { Transport } from "./io-transport.js";
|
|
20
|
-
import { type AcpInitializeParams, type AcpInitializeResult, type AcpSessionNewParams, type AcpSessionLoadParams, type AcpSessionNewResult, type AcpSessionPromptParams, type AcpSessionPromptResult, type AcpSessionCloseParams, type AcpSessionSetConfigParams, type AcpSessionUpdateType, type AcpPermissionRequestParams, type AcpPermissionRequestResult } from "../protocol/wire/index.js";
|
|
20
|
+
import { type AcpInitializeParams, type AcpInitializeResult, type AcpSessionNewParams, type AcpSessionLoadParams, type AcpSessionNewResult, type AcpSessionPromptParams, type AcpSessionPromptResult, type AcpSessionCloseParams, type AcpSessionSetConfigParams, type AcpSessionSetConfigResult, type AcpSessionUpdateType, type AcpPermissionRequestParams, type AcpPermissionRequestResult } from "../protocol/wire/index.js";
|
|
21
21
|
import { DelegateClient } from "./delegate-client.js";
|
|
22
22
|
import type { HostRequestClient } from "./host-request-client.js";
|
|
23
23
|
import { type HostRequestService } from "../host-contract/index.js";
|
|
@@ -43,7 +43,7 @@ export interface AcpRequestHandler {
|
|
|
43
43
|
handleAcpSessionNew(params: AcpSessionNewParams): Promise<AcpSessionNewResult>;
|
|
44
44
|
handleAcpSessionPrompt(params: AcpSessionPromptParams): Promise<AcpSessionPromptResult>;
|
|
45
45
|
handleAcpSessionClose(params: AcpSessionCloseParams): Promise<void>;
|
|
46
|
-
handleAcpSessionSetConfig(params: AcpSessionSetConfigParams): Promise<
|
|
46
|
+
handleAcpSessionSetConfig(params: AcpSessionSetConfigParams): Promise<AcpSessionSetConfigResult>;
|
|
47
47
|
handleAcpSessionSetModel(sessionId: string, model: string): Promise<void>;
|
|
48
48
|
handleAcpSessionSetMode(sessionId: string, modeId: string): Promise<string>;
|
|
49
49
|
handleAcpSessionLoad(params: AcpSessionLoadParams): Promise<{
|
package/package.json
CHANGED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task-domain guidance is a Host-owned typed choice, not a language classifier.
|
|
3
|
-
* User text is intentionally not inspected for keywords or regular expressions.
|
|
4
|
-
*/
|
|
5
|
-
export type TaskDomain = "coding" | "office" | "creative" | "general";
|
|
6
|
-
/**
|
|
7
|
-
* Kept as a compatibility-neutral pure function for callers that only have text.
|
|
8
|
-
* Without a typed Host decision the safe domain is always general.
|
|
9
|
-
*/
|
|
10
|
-
export declare function detectTaskDomain(_userText: string): TaskDomain;
|
|
11
|
-
export interface DomainResolutionContext {
|
|
12
|
-
/** Host-provided typed override from thread.turn params. */
|
|
13
|
-
hostOverride?: TaskDomain;
|
|
14
|
-
/** Current user text is accepted for API stability but never classified. */
|
|
15
|
-
userText: string;
|
|
16
|
-
}
|
|
17
|
-
export declare function resolveTaskDomain(ctx: DomainResolutionContext): {
|
|
18
|
-
domain: TaskDomain;
|
|
19
|
-
source: "host-override" | "default";
|
|
20
|
-
};
|