qlogicagent 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -45
- package/package.json +1 -1
- package/dist/agent.js +0 -1
- package/dist/cli.js +0 -9
- package/dist/contracts.js +0 -1
- package/dist/index.js +0 -5
- package/dist/orchestration.js +0 -118
- package/dist/types/agent/agent.d.ts +0 -43
- package/dist/types/agent/tool-loop.d.ts +0 -64
- package/dist/types/agent/types.d.ts +0 -175
- package/dist/types/cli/main.d.ts +0 -11
- package/dist/types/cli/stdio-server.d.ts +0 -45
- package/dist/types/config/config.d.ts +0 -17
- package/dist/types/contracts/hooks.d.ts +0 -120
- package/dist/types/contracts/index.d.ts +0 -10
- package/dist/types/contracts/planner.d.ts +0 -35
- package/dist/types/contracts/skill-candidate.d.ts +0 -63
- package/dist/types/contracts/todo.d.ts +0 -14
- package/dist/types/index.d.ts +0 -13
- package/dist/types/llm/builtin-providers.d.ts +0 -10
- package/dist/types/llm/index.d.ts +0 -15
- package/dist/types/llm/llm-client.d.ts +0 -43
- package/dist/types/llm/model-catalog.d.ts +0 -53
- package/dist/types/llm/provider-def.d.ts +0 -59
- package/dist/types/llm/provider-registry.d.ts +0 -54
- package/dist/types/llm/transport.d.ts +0 -62
- package/dist/types/llm/transports/anthropic-messages.d.ts +0 -31
- package/dist/types/llm/transports/openai-chat.d.ts +0 -36
- package/dist/types/orchestration/agent-registry.d.ts +0 -41
- package/dist/types/orchestration/approval-aware-tool-plan.d.ts +0 -32
- package/dist/types/orchestration/context-compression.d.ts +0 -220
- package/dist/types/orchestration/conversation-repair.d.ts +0 -61
- package/dist/types/orchestration/curator-scheduler.d.ts +0 -119
- package/dist/types/orchestration/embedded-failover-policy.d.ts +0 -110
- package/dist/types/orchestration/error-classification.d.ts +0 -12
- package/dist/types/orchestration/failover-classification.d.ts +0 -8
- package/dist/types/orchestration/failover-error.d.ts +0 -33
- package/dist/types/orchestration/fork-subagent.d.ts +0 -100
- package/dist/types/orchestration/index.d.ts +0 -120
- package/dist/types/orchestration/memory-flush-policy.d.ts +0 -57
- package/dist/types/orchestration/memory-provider.d.ts +0 -14
- package/dist/types/orchestration/parallel-tool-calls.d.ts +0 -41
- package/dist/types/orchestration/prompt-cache-strategy.d.ts +0 -126
- package/dist/types/orchestration/reactive-compact.d.ts +0 -73
- package/dist/types/orchestration/retry-loop.d.ts +0 -22
- package/dist/types/orchestration/skill-candidate.d.ts +0 -52
- package/dist/types/orchestration/skill-consolidation.d.ts +0 -123
- package/dist/types/orchestration/skill-improvement.d.ts +0 -59
- package/dist/types/orchestration/skill-similarity.d.ts +0 -98
- package/dist/types/orchestration/streaming-tool-executor.d.ts +0 -73
- package/dist/types/orchestration/team-orchestration.d.ts +0 -195
- package/dist/types/orchestration/team-tool-loop-wiring.d.ts +0 -92
- package/dist/types/orchestration/tool-choice-policy.d.ts +0 -54
- package/dist/types/orchestration/tool-loop-state.d.ts +0 -50
- package/dist/types/orchestration/tool-schema.d.ts +0 -39
- package/dist/types/orchestration/transcript-repair.d.ts +0 -42
- package/dist/types/orchestration/turn-loop-guard.d.ts +0 -86
- package/dist/types/orchestration/web-browser-policy.d.ts +0 -17
- package/dist/types/runtime/context-compression.d.ts +0 -61
- package/dist/types/runtime/hook-registry.d.ts +0 -12
- package/dist/types/runtime/memory-hooks.d.ts +0 -23
- package/dist/types/runtime/tool-eligibility.d.ts +0 -59
- package/dist/types/skills/index.d.ts +0 -108
- package/dist/types/skills/memory-extractor.d.ts +0 -64
- package/dist/types/skills/memory-query-tool.d.ts +0 -43
- package/dist/types/skills/memory-store.d.ts +0 -66
- package/dist/types/skills/memory-tool.d.ts +0 -67
- package/dist/types/skills/portable-tool.d.ts +0 -71
- package/dist/types/skills/qmemory-adapter.d.ts +0 -52
- package/dist/types/skills/skill-frontmatter.d.ts +0 -19
- package/dist/types/skills/skill-guard.d.ts +0 -23
- package/dist/types/skills/skill-loader.d.ts +0 -16
- package/dist/types/skills/skill-source.d.ts +0 -119
- package/dist/types/skills/skill-types.d.ts +0 -199
- package/dist/types/skills/think-tool.d.ts +0 -16
- package/dist/types/skills/todo-tool.d.ts +0 -63
- package/dist/types/skills/tools/agent-tool.d.ts +0 -91
- package/dist/types/skills/tools/apply-patch-tool.d.ts +0 -29
- package/dist/types/skills/tools/ask-user-tool.d.ts +0 -80
- package/dist/types/skills/tools/brief-tool.d.ts +0 -74
- package/dist/types/skills/tools/browser-tool.d.ts +0 -114
- package/dist/types/skills/tools/checkpoint-tool.d.ts +0 -66
- package/dist/types/skills/tools/config-tool.d.ts +0 -63
- package/dist/types/skills/tools/cron-tool.d.ts +0 -116
- package/dist/types/skills/tools/edit-tool.d.ts +0 -43
- package/dist/types/skills/tools/exec-tool.d.ts +0 -102
- package/dist/types/skills/tools/image-generate-tool.d.ts +0 -62
- package/dist/types/skills/tools/instructions-tool.d.ts +0 -103
- package/dist/types/skills/tools/lsp-tool.d.ts +0 -153
- package/dist/types/skills/tools/mcp-client-types.d.ts +0 -269
- package/dist/types/skills/tools/mcp-tool.d.ts +0 -249
- package/dist/types/skills/tools/memory-tool.d.ts +0 -74
- package/dist/types/skills/tools/monitor-tool.d.ts +0 -113
- package/dist/types/skills/tools/music-generate-tool.d.ts +0 -55
- package/dist/types/skills/tools/notify-tool.d.ts +0 -53
- package/dist/types/skills/tools/patch-tool.d.ts +0 -45
- package/dist/types/skills/tools/pdf-tool.d.ts +0 -66
- package/dist/types/skills/tools/plan-mode-tool.d.ts +0 -59
- package/dist/types/skills/tools/read-tool.d.ts +0 -51
- package/dist/types/skills/tools/repl-tool.d.ts +0 -70
- package/dist/types/skills/tools/search-tool.d.ts +0 -112
- package/dist/types/skills/tools/send-message-tool.d.ts +0 -51
- package/dist/types/skills/tools/skill-list-tool.d.ts +0 -33
- package/dist/types/skills/tools/skill-manage-tool.d.ts +0 -73
- package/dist/types/skills/tools/skill-view-tool.d.ts +0 -37
- package/dist/types/skills/tools/sleep-tool.d.ts +0 -49
- package/dist/types/skills/tools/structured-output-tool.d.ts +0 -116
- package/dist/types/skills/tools/task-tool.d.ts +0 -104
- package/dist/types/skills/tools/team-tool.d.ts +0 -89
- package/dist/types/skills/tools/tool-search-tool.d.ts +0 -51
- package/dist/types/skills/tools/tts-tool.d.ts +0 -38
- package/dist/types/skills/tools/video-edit-tool.d.ts +0 -69
- package/dist/types/skills/tools/video-generate-tool.d.ts +0 -62
- package/dist/types/skills/tools/video-merge-tool.d.ts +0 -105
- package/dist/types/skills/tools/video-upscale-tool.d.ts +0 -45
- package/dist/types/skills/tools/web-fetch-tool.d.ts +0 -78
- package/dist/types/skills/tools/web-search-tool.d.ts +0 -57
- package/dist/types/skills/tools/worktree-tool.d.ts +0 -69
- package/dist/types/skills/tools/write-tool.d.ts +0 -45
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fork Sub-Agent — CC-aligned fork mechanism for spawning child agents.
|
|
3
|
-
*
|
|
4
|
-
* Core design principles (aligned with Claude Code):
|
|
5
|
-
* 1. Child agent shares parent's message prefix (prompt cache hit)
|
|
6
|
-
* 2. Fork uses placeholder results to ensure byte-identical prefix across children
|
|
7
|
-
* 3. Child has independent tool context (doesn't pollute parent state)
|
|
8
|
-
* 4. Results flow back via AsyncGenerator (streaming backflow)
|
|
9
|
-
* 5. Depth control via in-memory counter (not DB-based)
|
|
10
|
-
*/
|
|
11
|
-
import type { AgentDefinition } from "./agent-registry.js";
|
|
12
|
-
/** Sentinel tag injected into fork children to prevent recursive forking. */
|
|
13
|
-
export declare const FORK_SENTINEL_TAG = "<fork-child-context>";
|
|
14
|
-
/** Placeholder text used for all tool_results in shared prefix (ensures byte-identical prefix). */
|
|
15
|
-
export declare const FORK_PLACEHOLDER_RESULT = "Fork started \u2014 processing in background";
|
|
16
|
-
/** Maximum fork depth for in-memory agents (more permissive than DB sidechain). */
|
|
17
|
-
export declare const MAX_FORK_DEPTH = 4;
|
|
18
|
-
/** Maximum fork depth for DB-backed sidechains (more conservative). */
|
|
19
|
-
export declare const MAX_SIDECHAIN_DB_DEPTH = 2;
|
|
20
|
-
export interface ForkContext {
|
|
21
|
-
/** Parent's full message history (becomes shared prefix for cache). */
|
|
22
|
-
parentMessages: unknown[];
|
|
23
|
-
/** Parent's rendered system prompt (byte-exact for cache hit). */
|
|
24
|
-
systemPrompt: string;
|
|
25
|
-
/** Parent's full tool pool (useExactTools=true pattern). */
|
|
26
|
-
parentTools: string[];
|
|
27
|
-
/** Current fork depth (0 = root). */
|
|
28
|
-
depth: number;
|
|
29
|
-
/** Abort signal from parent. */
|
|
30
|
-
abortSignal?: AbortSignal;
|
|
31
|
-
/** Parent's agent ID for lineage tracking. */
|
|
32
|
-
parentAgentId: string;
|
|
33
|
-
}
|
|
34
|
-
export interface ForkChildConfig {
|
|
35
|
-
/** The agent definition to run. */
|
|
36
|
-
agent: AgentDefinition;
|
|
37
|
-
/** Task-specific prompt for this child (the unique part after shared prefix). */
|
|
38
|
-
taskPrompt: string;
|
|
39
|
-
/** Optional override for max turns. */
|
|
40
|
-
maxTurns?: number;
|
|
41
|
-
/** Whether to run in background (async). */
|
|
42
|
-
isAsync?: boolean;
|
|
43
|
-
}
|
|
44
|
-
export interface ForkChildMessage {
|
|
45
|
-
role: "assistant" | "user" | "system";
|
|
46
|
-
content: unknown;
|
|
47
|
-
toolCalls?: unknown[];
|
|
48
|
-
}
|
|
49
|
-
export interface ForkResult {
|
|
50
|
-
/** Whether the fork completed successfully. */
|
|
51
|
-
ok: boolean;
|
|
52
|
-
/** Child's final output text (summary). */
|
|
53
|
-
output: string;
|
|
54
|
-
/** Messages produced by the child (for result backflow). */
|
|
55
|
-
messages: ForkChildMessage[];
|
|
56
|
-
/** Total tokens consumed by the child. */
|
|
57
|
-
tokensUsed: number;
|
|
58
|
-
/** Whether the child hit its turn limit. */
|
|
59
|
-
maxTurnsReached: boolean;
|
|
60
|
-
/** Child's agent ID. */
|
|
61
|
-
childAgentId: string;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Check if current context is inside a fork child (prevents recursive forking).
|
|
65
|
-
*/
|
|
66
|
-
export declare function isInForkChild(messages: unknown[]): boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Check if fork depth allows spawning another child.
|
|
69
|
-
*/
|
|
70
|
-
export declare function canForkAtDepth(currentDepth: number, mode?: "in-memory" | "db-sidechain"): boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Build forked messages that ensure byte-identical prefix across all fork children.
|
|
73
|
-
*
|
|
74
|
-
* Strategy (aligned with CC's buildForkedMessages):
|
|
75
|
-
* 1. Keep full parent message history (all tool_use blocks, thinking, text)
|
|
76
|
-
* 2. Replace all pending tool_results with FORK_PLACEHOLDER_RESULT
|
|
77
|
-
* 3. Append a single user message with the child-specific directive
|
|
78
|
-
* → All children share the same prefix up to the directive → maximum cache hits.
|
|
79
|
-
*/
|
|
80
|
-
export declare function buildForkedMessages(context: ForkContext, childConfig: ForkChildConfig): unknown[];
|
|
81
|
-
/**
|
|
82
|
-
* Build placeholder tool results for the shared prefix.
|
|
83
|
-
* When parent has pending tool_calls, replace them all with identical placeholder text
|
|
84
|
-
* so all fork children produce byte-identical API request prefix.
|
|
85
|
-
*/
|
|
86
|
-
export declare function buildForkPlaceholderResults(pendingToolCallIds: string[]): Array<{
|
|
87
|
-
role: "tool";
|
|
88
|
-
tool_call_id: string;
|
|
89
|
-
content: string;
|
|
90
|
-
}>;
|
|
91
|
-
/**
|
|
92
|
-
* Resolve the effective tool set for a fork child.
|
|
93
|
-
* CC pattern: useExactTools=true → child gets parent's full tool pool,
|
|
94
|
-
* then filtered by agent definition.
|
|
95
|
-
*/
|
|
96
|
-
export declare function resolveForkChildTools(parentTools: string[], agent: AgentDefinition): string[];
|
|
97
|
-
/**
|
|
98
|
-
* Generate a unique agent ID for a fork child.
|
|
99
|
-
*/
|
|
100
|
-
export declare function generateForkChildAgentId(parentAgentId: string, agentName: string, depth: number): string;
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
export { buildAssistantToolCallMessage, buildToolResultMessage, cleanToolSchemaForGemini, convertCapabilityToolManifestsToFunctionTools, convertFunctionTools, isXaiProvider, normalizeMessageTextContent, normalizeFunctionToolParameters, parseOpenAiToolCallsFromChatResponse, type CapabilityToolManifestLike, type FunctionToolDefinition, type FunctionToolSource, type ToolSchemaProvider, } from "./tool-schema.js";
|
|
2
|
-
export { classifyError, classifyErrorFromReason, getRetryStrategy, type ErrorCategory, type RetryStrategy, } from "./error-classification.js";
|
|
3
|
-
export { composeStrategies, composeAsyncStrategies, SlidingWindowStrategy, SummarizeOldStrategy, ToolResultTrimStrategy, HeadTailProtectedStrategy, IncrementalCompactStrategy, CacheAwareCompressionStrategy, CompressionMetricsCollector, ContextEngineRegistry, 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-compression.js";
|
|
4
|
-
export { buildSkillInstruction, shouldCreateSkill, shouldImproveSkill, type SkillCreateInstruction, type SkillImproveInstruction, type SkillInstruction, type SkillTurnResult, } from "./skill-improvement.js";
|
|
5
|
-
export { buildSkillCandidateEffectivenessSummary, buildSkillCandidateEvidencePayload, buildSkillCandidateImprovementEvidenceBundle, buildSkillCandidateLatestReview, createDefaultSkillImprovementPolicy, normalizeSkillImprovementPolicy, type SkillCandidateImprovementEvidenceBundleContract, type SkillImprovementPolicyContract, } from "./skill-candidate.js";
|
|
6
|
-
export declare const SIDECHAIN_TYPE_VALUES: readonly ["research", "planner", "plan-repair", "code-repair", "media-prep"];
|
|
7
|
-
export type SidechainType = typeof SIDECHAIN_TYPE_VALUES[number];
|
|
8
|
-
export type SidechainBudgetTier = "low" | "medium" | "high";
|
|
9
|
-
export type SidechainMergePolicy = "summary-only" | "append-messages" | "replace-context" | "manual";
|
|
10
|
-
export type SidechainToolAccessMode = "full" | "read-only" | "none";
|
|
11
|
-
export interface SidechainTypePolicy {
|
|
12
|
-
type: SidechainType;
|
|
13
|
-
label: string;
|
|
14
|
-
description: string;
|
|
15
|
-
mergePolicy: SidechainMergePolicy;
|
|
16
|
-
budgetTier: SidechainBudgetTier;
|
|
17
|
-
budgetWeight: number;
|
|
18
|
-
preferFullContext: boolean;
|
|
19
|
-
preserveConversationHistory: boolean;
|
|
20
|
-
toolAccessMode: SidechainToolAccessMode;
|
|
21
|
-
}
|
|
22
|
-
export type SidechainToolAccessDecision = "allowed" | "denied";
|
|
23
|
-
export type SidechainToolAccessInheritance = "inherit" | "shrink";
|
|
24
|
-
export type SidechainToolAccessReason = "default-allow" | "always-deny" | "leaf-deny";
|
|
25
|
-
export interface SidechainToolAccessRule {
|
|
26
|
-
toolName: string;
|
|
27
|
-
decision: SidechainToolAccessDecision;
|
|
28
|
-
inheritance: SidechainToolAccessInheritance;
|
|
29
|
-
reason: SidechainToolAccessReason;
|
|
30
|
-
}
|
|
31
|
-
export interface SidechainToolAccessPolicy {
|
|
32
|
-
deniedTools: string[];
|
|
33
|
-
canSpawnChildren: boolean;
|
|
34
|
-
defaultDecision: "allowed";
|
|
35
|
-
defaultInheritance: "inherit";
|
|
36
|
-
tools: SidechainToolAccessRule[];
|
|
37
|
-
}
|
|
38
|
-
export declare const SIDECHAIN_TOOL_DENY_ALWAYS: readonly ["gateway", "agents_list", "whatsapp_login", "session_status", "cron", "memory_query", "sessions_send"];
|
|
39
|
-
export declare const SIDECHAIN_TOOL_DENY_LEAF: readonly ["sessions_list", "sessions_history", "sessions_spawn"];
|
|
40
|
-
/** Tools that perform write/mutation operations — denied in read-only sidechain types. */
|
|
41
|
-
export declare const SIDECHAIN_TOOL_DENY_WRITE: readonly ["file_edit", "create_file", "replace_string_in_file", "multi_replace_string_in_file", "create_directory", "run_in_terminal", "run_command", "delete_file", "rename_file", "move_file", "git_commit", "git_push", "manage_todo_list"];
|
|
42
|
-
export declare function resolveSidechainToolAccessPolicy(params?: {
|
|
43
|
-
depth?: number;
|
|
44
|
-
maxDepth?: number;
|
|
45
|
-
role?: "leaf" | "orchestrator";
|
|
46
|
-
toolNames?: Iterable<string>;
|
|
47
|
-
}): SidechainToolAccessPolicy;
|
|
48
|
-
/**
|
|
49
|
-
* Resolve tool access policy for a specific sidechain type.
|
|
50
|
-
* Combines depth-based deny lists with type-specific access mode:
|
|
51
|
-
* - "full": only depth-based denials apply
|
|
52
|
-
* - "read-only": depth-based + all write/mutation tools denied
|
|
53
|
-
* - "none": all tools denied
|
|
54
|
-
*/
|
|
55
|
-
export declare function resolveSidechainToolAccessByType(params: {
|
|
56
|
-
type: SidechainType;
|
|
57
|
-
depth?: number;
|
|
58
|
-
maxDepth?: number;
|
|
59
|
-
role?: "leaf" | "orchestrator";
|
|
60
|
-
toolNames?: Iterable<string>;
|
|
61
|
-
}): SidechainToolAccessPolicy;
|
|
62
|
-
export interface ToolCallAccessFilterResult<T> {
|
|
63
|
-
allowed: T[];
|
|
64
|
-
denied: Array<{
|
|
65
|
-
toolCall: T;
|
|
66
|
-
reason: string;
|
|
67
|
-
}>;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Filter tool_calls against a resolved access policy.
|
|
71
|
-
* Returns allowed calls and denied calls with reasons.
|
|
72
|
-
* T must have at least { id: string; function: { name: string } }.
|
|
73
|
-
*/
|
|
74
|
-
export declare function filterToolCallsByAccessPolicy<T extends {
|
|
75
|
-
id: string;
|
|
76
|
-
function: {
|
|
77
|
-
name: string;
|
|
78
|
-
};
|
|
79
|
-
}>(toolCalls: T[], policy: SidechainToolAccessPolicy): ToolCallAccessFilterResult<T>;
|
|
80
|
-
export declare function listSidechainTypePolicies(): SidechainTypePolicy[];
|
|
81
|
-
export declare function resolveSidechainTypePolicy(type: SidechainType): SidechainTypePolicy;
|
|
82
|
-
export declare function resolveRepairSidechainType(params?: {
|
|
83
|
-
toolNames?: Iterable<string>;
|
|
84
|
-
preferCodeRepair?: boolean;
|
|
85
|
-
trigger?: string;
|
|
86
|
-
}): Extract<SidechainType, "plan-repair" | "code-repair">;
|
|
87
|
-
export declare function resolveSidechainMergePolicyByType(type: SidechainType, overrides?: {
|
|
88
|
-
forceManualReview?: boolean;
|
|
89
|
-
preferFullContext?: boolean;
|
|
90
|
-
preserveConversationHistory?: boolean;
|
|
91
|
-
}): SidechainMergePolicy;
|
|
92
|
-
export declare function resolveSidechainMergePolicy(params?: {
|
|
93
|
-
preferFullContext?: boolean;
|
|
94
|
-
forceManualReview?: boolean;
|
|
95
|
-
preserveConversationHistory?: boolean;
|
|
96
|
-
}): SidechainMergePolicy;
|
|
97
|
-
export { applyToolChoiceCompatibility, applyToolChoicePolicy, filterEligibleTools, normalizeAnthropicFunctionToolDefinition, normalizeAnthropicToolChoice, type ApplyToolChoicePolicyInput, type ApplyToolChoicePolicyResult, type ToolEligibilityLike, type ToolChoiceCompatibilityPolicy, type ToolChoiceLike, type ToolChoiceToolLike, } from "./tool-choice-policy.js";
|
|
98
|
-
export { downgradeOpenAiFunctionCallReasoningPairs, downgradeOpenAiReasoningBlocks, ensureAssistantReasoningContent, injectDanglingToolCallPlaceholders, repairOpenAiChatConversation, repairOpenAiResponsesItems, sanitizeOpenAiChatMessages, stripForcedStopAssistantToolMetadata, type ConversationRepairOptions, type ContentPart, type OpenAiChatMessageLike, type OpenAiChatToolCallRef, type OpenAiResponsesItemLike, type OpenAiToolCall, } from "./conversation-repair.js";
|
|
99
|
-
export { classifyFailoverReason, classifyFailoverReasonFromHttpStatus, isCloudflareOrHtmlErrorPage, isFailoverErrorMessage, isModelNotFoundErrorMessage, isTimeoutErrorMessage, isTransientHttpError, type FailoverReason, } from "./failover-classification.js";
|
|
100
|
-
export { FailoverError, coerceToFailoverError, describeFailoverError, isFailoverError, isTimeoutError, resolveFailoverReasonFromError, resolveFailoverStatus, } from "./failover-error.js";
|
|
101
|
-
export { repairToolCallInputs, repairToolUseResultPairing, sanitizeToolCallInputs, sanitizeToolUseResultPairing, stripToolResultDetails, stripTransientErrorMessages, type ToolCallInputRepairOptions, type ToolCallInputRepairReport, type ToolUseRepairOptions, type ToolUseRepairReport, type TranscriptMessageLike, type TranscriptToolCallLike, } from "./transcript-repair.js";
|
|
102
|
-
export { normalizeParallelToolCallsPreference, resolveParallelToolCallScheduling, type ParallelToolCallsPreference, type ResolveParallelToolCallSchedulingInput, type ResolveParallelToolCallSchedulingResult, type ToolCallBatch, type ToolCallLike, type ToolCapabilityLike, } from "./parallel-tool-calls.js";
|
|
103
|
-
export { advanceToolLoopState, createToolLoopState, recoverToolLoopStateFromChatConversation, recoverToolLoopStateFromResponsesItems, settleToolLoopState, type RepairToolLoopStateResult, type ToolLoopRepairAction, type ToolLoopState, } from "./tool-loop-state.js";
|
|
104
|
-
export { MEMORY_OBSERVATION_HOOK_VALUES, MEMORY_OBSERVATION_SOURCE_VALUES, MEMORY_WRITE_ACCESS_VALUES, type MemoryObservationHook, type MemoryObservationSource, type MemoryWriteAccess, type MemoryProviderLifecycleInvocation, } from "./memory-provider.js";
|
|
105
|
-
export { hasAlreadyFlushedForCurrentCompaction, resolveMemoryFlushProjection, resolveMemoryFlushReadPlan, shouldRunMemoryFlush, type MemoryFlushCompactionStateLike, type MemoryFlushProjection, type MemoryFlushReadPlan, type MemoryFlushTokenStateLike, } from "./memory-flush-policy.js";
|
|
106
|
-
export { executeBoundedRetryLoop, resolveScaledRetryIterations, } from "./retry-loop.js";
|
|
107
|
-
export { buildAssistantFailoverErrorDetails, pickFallbackThinkingLevel, resolveAssistantFailureActionDecision, resolveAuthProfileFailoverReason, resolveFallbackThinkingDecision, resolvePromptErrorPolicy, resolvePromptFailureActionDecision, resolveRetryableFailureReason, shouldAttemptAssistantFailureRotation, shouldAttemptPromptFailureRotation, type EmbeddedAssistantFailureAction, type EmbeddedPromptErrorPolicyResolution, type EmbeddedPromptFailureAction, } from "./embedded-failover-policy.js";
|
|
108
|
-
export { buildApprovalAwareReason, buildApprovalStepContext, summarizeApprovalAwareToolPlan, type ApprovalAwareToolCapability, type ApprovalAwareToolPlanStep, type ToolExecutionStepContext, } from "./approval-aware-tool-plan.js";
|
|
109
|
-
export { resolveWebBrowserPolicy, type ResolveWebBrowserPolicyInput, type ResolveWebBrowserPolicyResult, } from "./web-browser-policy.js";
|
|
110
|
-
export { applyCacheMarkers, computeCacheBreakpoints, createCacheBreakDetectionState, DEFAULT_PROMPT_CACHE_POLICY, detectCacheBreaks, estimateCacheSavingsRatio, quickHash, resolveForkCacheMarkerIndex, type CacheableMessage, type CacheBreakDetectionState, type CacheBreakEvent, type CacheBreakpoint, type CacheMarkingResult, type CacheRetention, type CacheSegmentKind, type PromptCachePolicy, } from "./prompt-cache-strategy.js";
|
|
111
|
-
export { computeLifecycleTransitions, DEFAULT_CURATOR_SCHEDULE_POLICY, INITIAL_CURATOR_STATE, selectReviewCandidates, shouldRunCurator, type CuratorAutoTransitionResult, type CuratorGateInput, type CuratorGateResult, type CuratorLifecycleTransition, type CuratorSchedulePolicy, type CuratorSkillLifecycleState, type CuratorSkillRecord, type CuratorState, } from "./curator-scheduler.js";
|
|
112
|
-
export { buildConsolidationPrompt, buildCuratorRunSummary, detectPrefixClusters, parseConsolidationOutput, reconcileConsolidationPlan, type ConsolidationAction, type ConsolidationPlan, type ConsolidationSkillSummary, type CuratorRunReport, type PruningAction, type ReconciledConsolidationPlan, type SkillPrefixCluster, } from "./skill-consolidation.js";
|
|
113
|
-
export { bigramSimilarity, computeSimilarity, decideSimilarityAction, DEFAULT_SKILL_SIMILARITY_POLICY, findSimilarSkills, stepCountProximity, toolSetJaccard, type SimilarityDecision, type SimilarityScore, type SimilarSkillMatch, type SkillSimilarityPolicy, type SkillSimilarityProfile, } from "./skill-similarity.js";
|
|
114
|
-
export { aggregateTeamResults, allocateTokenBudgets, buildAgentTaskPrompt, inferAggregationPolicy, inferExecutionMode, mapRoleToSidechainType, resolveAgentToolAccess, resolveExecutionOrder, resolveTeamPlan, shouldCancelTeam, TEAM_MAX_AGENTS, TEAM_MAX_DEPTH, validateTeamPlan, type AgentRole, type TeamAgentResult, type TeamAgentSpec, type TeamAggregationPolicy, type TeamExecutionMode, type TeamLifecycleState, type TeamPlan, type TeamResult, } from "./team-orchestration.js";
|
|
115
|
-
export { canDispatchDuringStreaming, createStreamingToolExecutor, type StreamingToolCall, type StreamingToolExecutor, type StreamingToolExecutorConfig, type StreamingToolResult, type ToolExecutorFn, } from "./streaming-tool-executor.js";
|
|
116
|
-
export { canForkAtDepth, buildForkedMessages, buildForkPlaceholderResults, FORK_PLACEHOLDER_RESULT, FORK_SENTINEL_TAG, generateForkChildAgentId, isInForkChild, MAX_FORK_DEPTH, MAX_SIDECHAIN_DB_DEPTH, resolveForkChildTools, type ForkChildConfig, type ForkChildMessage, type ForkContext, type ForkResult, } from "./fork-subagent.js";
|
|
117
|
-
export { getBuiltInAgent, getBuiltInAgents, isBuiltInAgent, resolveAgentToolSet, type AgentDefinition, } from "./agent-registry.js";
|
|
118
|
-
export { calculateTokenWarningState, createTurnLoopGuardState, resolveApiErrorRecovery, resolveOutputTokenEscalation, shouldAbortTurn, type ApiErrorRecovery, type TokenWarningState, type TurnLoopGuardConfig, type TurnLoopGuardState, } from "./turn-loop-guard.js";
|
|
119
|
-
export { buildPostCompactRestorationMessage, computeToolDelta, createReactiveCompactState, DEFAULT_REACTIVE_COMPACT_CONFIG, shouldAttemptReactiveCompact, type PostCompactRestorationPayload, type ReactiveCompactConfig, type ReactiveCompactState, } from "./reactive-compact.js";
|
|
120
|
-
export { aggregateTeamToolResults, mapTeamRequestToForkConfigs, resolveTeamExecutionPlan, type TeamAgentRequest, type TeamAggregatedResult, type TeamExecutionBatch, type TeamExecutionPlan, type TeamToolRequest, } from "./team-tool-loop-wiring.js";
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
export interface MemoryFlushCompactionStateLike {
|
|
2
|
-
compactionCount?: number;
|
|
3
|
-
memoryFlushCompactionCount?: number;
|
|
4
|
-
}
|
|
5
|
-
export interface MemoryFlushTokenStateLike extends MemoryFlushCompactionStateLike {
|
|
6
|
-
totalTokens?: number;
|
|
7
|
-
totalTokensFresh?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface MemoryFlushReadPlan {
|
|
10
|
-
canAttemptFlush: boolean;
|
|
11
|
-
flushThreshold: number;
|
|
12
|
-
shouldReadTranscriptForOutput: boolean;
|
|
13
|
-
shouldReadTranscript: boolean;
|
|
14
|
-
shouldCheckTranscriptSizeForForcedFlush: boolean;
|
|
15
|
-
shouldReadSessionLog: boolean;
|
|
16
|
-
}
|
|
17
|
-
export interface MemoryFlushProjection {
|
|
18
|
-
shouldForceFlushByTranscriptSize: boolean;
|
|
19
|
-
shouldPersistTranscriptPromptTokens: boolean;
|
|
20
|
-
promptTokensSnapshot: number;
|
|
21
|
-
hasFreshPromptTokensSnapshot: boolean;
|
|
22
|
-
projectedTokenCount: number | undefined;
|
|
23
|
-
tokenCountForFlush: number | undefined;
|
|
24
|
-
}
|
|
25
|
-
export declare function hasAlreadyFlushedForCurrentCompaction(entry: MemoryFlushCompactionStateLike): boolean;
|
|
26
|
-
export declare function shouldRunMemoryFlush(params: {
|
|
27
|
-
entry?: MemoryFlushTokenStateLike;
|
|
28
|
-
tokenCount?: number;
|
|
29
|
-
resolveFreshSessionTotalTokens: (entry: MemoryFlushTokenStateLike) => number | undefined;
|
|
30
|
-
contextWindowTokens: number;
|
|
31
|
-
reserveTokensFloor: number;
|
|
32
|
-
softThresholdTokens: number;
|
|
33
|
-
}): boolean;
|
|
34
|
-
export declare function resolveMemoryFlushReadPlan(params: {
|
|
35
|
-
memoryFlushWritable: boolean;
|
|
36
|
-
isHeartbeat: boolean;
|
|
37
|
-
isCli: boolean;
|
|
38
|
-
hasSessionEntry: boolean;
|
|
39
|
-
hasFreshPersistedPromptTokens: boolean;
|
|
40
|
-
promptTokenEstimate?: number;
|
|
41
|
-
persistedPromptTokens?: number;
|
|
42
|
-
contextWindowTokens: number;
|
|
43
|
-
reserveTokensFloor: number;
|
|
44
|
-
softThresholdTokens: number;
|
|
45
|
-
transcriptOutputReadBufferTokens: number;
|
|
46
|
-
forceFlushTranscriptBytes: number;
|
|
47
|
-
}): MemoryFlushReadPlan;
|
|
48
|
-
export declare function resolveMemoryFlushProjection(params: {
|
|
49
|
-
transcriptByteSize?: number;
|
|
50
|
-
forceFlushTranscriptBytes: number;
|
|
51
|
-
transcriptPromptTokens?: number;
|
|
52
|
-
transcriptOutputTokens?: number;
|
|
53
|
-
persistedPromptTokens?: number;
|
|
54
|
-
hasFreshPersistedPromptTokens: boolean;
|
|
55
|
-
promptTokenEstimate?: number;
|
|
56
|
-
resolveEffectivePromptTokens: (promptTokensSnapshot: number, transcriptOutputTokens: number | undefined, promptTokenEstimate: number | undefined) => number | undefined;
|
|
57
|
-
}): MemoryFlushProjection;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { MEMORY_OBSERVATION_HOOK_VALUES, type MemoryObservationHook, MEMORY_OBSERVATION_SOURCE_VALUES, type MemoryObservationSource, MEMORY_WRITE_ACCESS_VALUES, type MemoryWriteAccess } from "qlogicagent-runtime-contracts";
|
|
2
|
-
export { MEMORY_OBSERVATION_HOOK_VALUES, type MemoryObservationHook, MEMORY_OBSERVATION_SOURCE_VALUES, type MemoryObservationSource, MEMORY_WRITE_ACCESS_VALUES, type MemoryWriteAccess, };
|
|
3
|
-
export interface MemoryProviderLifecycleInvocation {
|
|
4
|
-
hook: MemoryObservationHook;
|
|
5
|
-
source: MemoryObservationSource;
|
|
6
|
-
sessionId: string;
|
|
7
|
-
turnId?: string;
|
|
8
|
-
executionId?: string;
|
|
9
|
-
rootExecutionId?: string;
|
|
10
|
-
parentExecutionId?: string;
|
|
11
|
-
sidechainId?: string;
|
|
12
|
-
attemptId?: string;
|
|
13
|
-
writeAccess: MemoryWriteAccess;
|
|
14
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export type ParallelToolCallsPreference = {
|
|
2
|
-
kind: "enabled";
|
|
3
|
-
enabled: boolean;
|
|
4
|
-
} | {
|
|
5
|
-
kind: "suppressed";
|
|
6
|
-
} | {
|
|
7
|
-
kind: "invalid";
|
|
8
|
-
summary: string;
|
|
9
|
-
};
|
|
10
|
-
export interface ToolCallLike {
|
|
11
|
-
id: string;
|
|
12
|
-
function: {
|
|
13
|
-
name: string;
|
|
14
|
-
arguments?: string;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export interface ToolCapabilityLike {
|
|
18
|
-
name: string;
|
|
19
|
-
requiresApproval?: boolean;
|
|
20
|
-
approvalMode?: string;
|
|
21
|
-
parallelSafe?: boolean;
|
|
22
|
-
serialOnly?: boolean;
|
|
23
|
-
}
|
|
24
|
-
export interface ToolCallBatch<TCall extends ToolCallLike> {
|
|
25
|
-
mode: "parallel" | "serial";
|
|
26
|
-
calls: TCall[];
|
|
27
|
-
}
|
|
28
|
-
export interface ResolveParallelToolCallSchedulingInput<TCall extends ToolCallLike, TCapability extends ToolCapabilityLike> {
|
|
29
|
-
requestedPreference?: unknown;
|
|
30
|
-
providerSupportsParallel?: boolean;
|
|
31
|
-
toolCalls: readonly TCall[];
|
|
32
|
-
toolCapabilities?: readonly TCapability[];
|
|
33
|
-
}
|
|
34
|
-
export interface ResolveParallelToolCallSchedulingResult<TCall extends ToolCallLike> {
|
|
35
|
-
enabled: boolean;
|
|
36
|
-
mode: "parallel" | "serial";
|
|
37
|
-
batches: Array<ToolCallBatch<TCall>>;
|
|
38
|
-
warnings: string[];
|
|
39
|
-
}
|
|
40
|
-
export declare function normalizeParallelToolCallsPreference(rawValue: unknown): ParallelToolCallsPreference | undefined;
|
|
41
|
-
export declare function resolveParallelToolCallScheduling<TCall extends ToolCallLike, TCapability extends ToolCapabilityLike>(params: ResolveParallelToolCallSchedulingInput<TCall, TCapability>): ResolveParallelToolCallSchedulingResult<TCall>;
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/** Retention hint passed to the provider. */
|
|
2
|
-
export type CacheRetention = "none" | "short" | "long";
|
|
3
|
-
/** A message in the conversation array eligible for cache marking. */
|
|
4
|
-
export interface CacheableMessage {
|
|
5
|
-
role: string;
|
|
6
|
-
content?: string | unknown;
|
|
7
|
-
name?: string;
|
|
8
|
-
tool_calls?: unknown;
|
|
9
|
-
tool_call_id?: string;
|
|
10
|
-
}
|
|
11
|
-
/** Segment classification for stability analysis. */
|
|
12
|
-
export type CacheSegmentKind = "system" | "tool-definition" | "conversation" | "recent";
|
|
13
|
-
/** Configuration for the cache marking policy. */
|
|
14
|
-
export interface PromptCachePolicy {
|
|
15
|
-
/** Max breakpoints the provider supports (Anthropic: 4). */
|
|
16
|
-
maxBreakpoints: number;
|
|
17
|
-
/** Cache retention hint. */
|
|
18
|
-
retention: CacheRetention;
|
|
19
|
-
/** Minimum estimated tokens in a segment to justify a breakpoint. */
|
|
20
|
-
minSegmentTokens: number;
|
|
21
|
-
/** Number of trailing messages considered "recent" (never marked). */
|
|
22
|
-
recentTailCount: number;
|
|
23
|
-
/** Whether tool-definition blocks should be treated as stable prefix. */
|
|
24
|
-
markToolDefinitions: boolean;
|
|
25
|
-
}
|
|
26
|
-
/** A computed breakpoint recommendation. */
|
|
27
|
-
export interface CacheBreakpoint {
|
|
28
|
-
/** Zero-based index in the original message array. */
|
|
29
|
-
index: number;
|
|
30
|
-
/** Classification of the segment ending at this index. */
|
|
31
|
-
segment: CacheSegmentKind;
|
|
32
|
-
/** Estimated tokens in this segment (if estimator provided). */
|
|
33
|
-
estimatedTokens?: number;
|
|
34
|
-
}
|
|
35
|
-
/** Result of the cache marking analysis. */
|
|
36
|
-
export interface CacheMarkingResult {
|
|
37
|
-
/** Recommended breakpoints, ordered by index ascending. */
|
|
38
|
-
breakpoints: CacheBreakpoint[];
|
|
39
|
-
/** Total estimated cacheable tokens (sum of breakpoint segments). */
|
|
40
|
-
estimatedCacheableTokens: number;
|
|
41
|
-
/** The retention hint from policy. */
|
|
42
|
-
retention: CacheRetention;
|
|
43
|
-
}
|
|
44
|
-
export declare const DEFAULT_PROMPT_CACHE_POLICY: PromptCachePolicy;
|
|
45
|
-
/**
|
|
46
|
-
* Analyse a message array and return recommended cache breakpoints.
|
|
47
|
-
*
|
|
48
|
-
* The algorithm:
|
|
49
|
-
* 1. Classify each message into segments (system / tool-def / conversation / recent).
|
|
50
|
-
* 2. Identify segment boundaries where the classification changes.
|
|
51
|
-
* 3. Rank boundaries by estimated token cost (heaviest first).
|
|
52
|
-
* 4. Select the top `maxBreakpoints` that meet `minSegmentTokens`.
|
|
53
|
-
*
|
|
54
|
-
* @param messages The conversation message array (in order).
|
|
55
|
-
* @param estimateTokens Optional per-message token estimator. Falls back to
|
|
56
|
-
* character-length heuristic (1 token ≈ 4 chars).
|
|
57
|
-
* @param policy Cache marking policy (uses defaults if omitted).
|
|
58
|
-
*/
|
|
59
|
-
export declare function computeCacheBreakpoints(messages: readonly CacheableMessage[], estimateTokens?: (msg: CacheableMessage) => number, policy?: Partial<PromptCachePolicy>): CacheMarkingResult;
|
|
60
|
-
/**
|
|
61
|
-
* Apply cache_control markers to a mutable message array based on breakpoints.
|
|
62
|
-
*
|
|
63
|
-
* For each breakpoint index, the last content block of that message gets a
|
|
64
|
-
* `cache_control: { type: "ephemeral" }` annotation (Anthropic format).
|
|
65
|
-
* String content is promoted to a text content block array.
|
|
66
|
-
*
|
|
67
|
-
* This is a pure transform — it returns a new array with shallow-cloned messages.
|
|
68
|
-
*/
|
|
69
|
-
export declare function applyCacheMarkers<T extends CacheableMessage>(messages: readonly T[], breakpoints: readonly CacheBreakpoint[]): T[];
|
|
70
|
-
/**
|
|
71
|
-
* Estimate the cache savings ratio for a turn.
|
|
72
|
-
*
|
|
73
|
-
* @param totalTokens Total input tokens for the turn.
|
|
74
|
-
* @param cacheableTokens Tokens covered by cache breakpoints.
|
|
75
|
-
* @param cacheHitRatio Fraction of cacheable tokens actually served from cache (0–1).
|
|
76
|
-
* @returns Estimated fraction of input tokens saved (0–1).
|
|
77
|
-
*/
|
|
78
|
-
export declare function estimateCacheSavingsRatio(totalTokens: number, cacheableTokens: number, cacheHitRatio?: number): number;
|
|
79
|
-
/**
|
|
80
|
-
* Determine the optimal cache marker position for fork scenarios.
|
|
81
|
-
*
|
|
82
|
-
* CC pattern:
|
|
83
|
-
* - Normal request: marker on messages[length - 1] (last message)
|
|
84
|
-
* - Fork (skipCacheWrite): marker on messages[length - 2] (shared prefix point)
|
|
85
|
-
*
|
|
86
|
-
* This ensures all fork children produce byte-identical API request prefix up to
|
|
87
|
-
* the marker, maximising cache reuse.
|
|
88
|
-
*/
|
|
89
|
-
export declare function resolveForkCacheMarkerIndex(messagesLength: number, options?: {
|
|
90
|
-
isForkChild?: boolean;
|
|
91
|
-
skipCacheWrite?: boolean;
|
|
92
|
-
}): number;
|
|
93
|
-
/**
|
|
94
|
-
* A cache break occurs when any property of the API request that affects
|
|
95
|
-
* the prefix cache changes between requests. Track these to diagnose
|
|
96
|
-
* unexpected cache misses.
|
|
97
|
-
*/
|
|
98
|
-
export interface CacheBreakDetectionState {
|
|
99
|
-
systemHash: string | null;
|
|
100
|
-
toolsHash: string | null;
|
|
101
|
-
modelId: string | null;
|
|
102
|
-
thinkingEnabled: boolean | null;
|
|
103
|
-
}
|
|
104
|
-
export declare function createCacheBreakDetectionState(): CacheBreakDetectionState;
|
|
105
|
-
export interface CacheBreakEvent {
|
|
106
|
-
field: "system" | "tools" | "model" | "thinking";
|
|
107
|
-
previousHash: string | null;
|
|
108
|
-
currentHash: string | null;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Detect if a cache break has occurred by comparing current request properties
|
|
112
|
-
* against the last known state.
|
|
113
|
-
*
|
|
114
|
-
* Returns the list of fields that changed (empty = no break).
|
|
115
|
-
*/
|
|
116
|
-
export declare function detectCacheBreaks(state: CacheBreakDetectionState, current: {
|
|
117
|
-
systemHash: string;
|
|
118
|
-
toolsHash: string;
|
|
119
|
-
modelId: string;
|
|
120
|
-
thinkingEnabled: boolean;
|
|
121
|
-
}): CacheBreakEvent[];
|
|
122
|
-
/**
|
|
123
|
-
* Compute a lightweight hash for cache break detection.
|
|
124
|
-
* Uses DJB2 algorithm (fast, good distribution for strings).
|
|
125
|
-
*/
|
|
126
|
-
export declare function quickHash(input: string): string;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reactive Compact — Emergency context compression when API returns prompt-too-long.
|
|
3
|
-
*
|
|
4
|
-
* Aligned with Claude Code's reactive compact chain:
|
|
5
|
-
* 1. API 413 → withhold error → attempt reactive compact → retry
|
|
6
|
-
* 2. Only one reactive compact attempt per turn (prevent infinite loops)
|
|
7
|
-
* 3. Falls back to abort if compact fails
|
|
8
|
-
*
|
|
9
|
-
* Also handles post-compact restoration:
|
|
10
|
-
* - Todo list re-injection
|
|
11
|
-
* - Skill context re-injection
|
|
12
|
-
* - Tool delta re-injection (new/removed tools since last compact)
|
|
13
|
-
*/
|
|
14
|
-
export interface ReactiveCompactConfig {
|
|
15
|
-
/** Maximum consecutive auto-compact failures before giving up (CC: 3). */
|
|
16
|
-
maxConsecutiveFailures: number;
|
|
17
|
-
/** Minimum messages to keep after reactive compact. */
|
|
18
|
-
minMessagesAfterCompact: number;
|
|
19
|
-
/** Target token usage after compact (percentage of context window). */
|
|
20
|
-
targetUsagePercent: number;
|
|
21
|
-
}
|
|
22
|
-
export declare const DEFAULT_REACTIVE_COMPACT_CONFIG: ReactiveCompactConfig;
|
|
23
|
-
export interface PostCompactRestorationPayload {
|
|
24
|
-
/** Current active todo list to re-inject after compact. */
|
|
25
|
-
todoList?: Array<{
|
|
26
|
-
id: number;
|
|
27
|
-
title: string;
|
|
28
|
-
status: string;
|
|
29
|
-
}>;
|
|
30
|
-
/** Active skill context (if LLM is executing a skill). */
|
|
31
|
-
activeSkillContext?: {
|
|
32
|
-
name: string;
|
|
33
|
-
step: number;
|
|
34
|
-
instructions: string;
|
|
35
|
-
};
|
|
36
|
-
/** Tool delta since last compact (tools added/removed from available set). */
|
|
37
|
-
toolDelta?: {
|
|
38
|
-
added: string[];
|
|
39
|
-
removed: string[];
|
|
40
|
-
};
|
|
41
|
-
/** Custom restoration blocks from memory hooks. */
|
|
42
|
-
customBlocks?: Array<{
|
|
43
|
-
label: string;
|
|
44
|
-
content: string;
|
|
45
|
-
}>;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Build the restoration message to inject after a compact operation.
|
|
49
|
-
* This ensures critical state survives context compression.
|
|
50
|
-
*/
|
|
51
|
-
export declare function buildPostCompactRestorationMessage(payload: PostCompactRestorationPayload): string | null;
|
|
52
|
-
export interface ReactiveCompactState {
|
|
53
|
-
/** Number of consecutive compact failures. */
|
|
54
|
-
consecutiveFailures: number;
|
|
55
|
-
/** Whether reactive compact has been attempted in this turn. */
|
|
56
|
-
attemptedThisTurn: boolean;
|
|
57
|
-
/** Last compact timestamp. */
|
|
58
|
-
lastCompactAt: number | null;
|
|
59
|
-
/** Tool names at time of last compact (for delta calculation). */
|
|
60
|
-
toolsAtLastCompact: string[];
|
|
61
|
-
}
|
|
62
|
-
export declare function createReactiveCompactState(): ReactiveCompactState;
|
|
63
|
-
/**
|
|
64
|
-
* Determine if reactive compact should be attempted.
|
|
65
|
-
*/
|
|
66
|
-
export declare function shouldAttemptReactiveCompact(state: ReactiveCompactState, config?: ReactiveCompactConfig): boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Calculate the tool delta since last compact.
|
|
69
|
-
*/
|
|
70
|
-
export declare function computeToolDelta(currentTools: string[], toolsAtLastCompact: string[]): {
|
|
71
|
-
added: string[];
|
|
72
|
-
removed: string[];
|
|
73
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare function executeBoundedRetryLoop<TResult>(params: {
|
|
2
|
-
maxIterations: number;
|
|
3
|
-
onRetryLimit: (params: {
|
|
4
|
-
iterations: number;
|
|
5
|
-
maxIterations: number;
|
|
6
|
-
}) => Promise<TResult> | TResult;
|
|
7
|
-
executeIteration: (params: {
|
|
8
|
-
iteration: number;
|
|
9
|
-
}) => Promise<{
|
|
10
|
-
kind: "continue";
|
|
11
|
-
} | {
|
|
12
|
-
kind: "return";
|
|
13
|
-
result: TResult;
|
|
14
|
-
}>;
|
|
15
|
-
}): Promise<TResult>;
|
|
16
|
-
export declare function resolveScaledRetryIterations(params: {
|
|
17
|
-
candidateCount: number;
|
|
18
|
-
baseIterations?: number;
|
|
19
|
-
perCandidateIterations?: number;
|
|
20
|
-
minIterations?: number;
|
|
21
|
-
maxIterations?: number;
|
|
22
|
-
}): number;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { type SkillCandidateAction, type SkillCandidateArtifactContract, type SkillCandidateEffectivenessContract, type SkillCandidateReviewContract, type SkillCandidateSourceExecutionContract } from "../contracts/skill-candidate.js";
|
|
2
|
-
export type SkillImprovementPolicyContract = {
|
|
3
|
-
reviewRequired: boolean;
|
|
4
|
-
canaryRequired: boolean;
|
|
5
|
-
autoPromote: boolean;
|
|
6
|
-
minCanarySampleCount: number;
|
|
7
|
-
minSuccessRate: number;
|
|
8
|
-
maxRegressionRate: number;
|
|
9
|
-
maxCostIncreaseRate: number;
|
|
10
|
-
staleAfterHours: number;
|
|
11
|
-
};
|
|
12
|
-
export type SkillCandidateImprovementEvidenceBundleContract = {
|
|
13
|
-
artifact?: SkillCandidateArtifactContract | null;
|
|
14
|
-
sourceExecution?: SkillCandidateSourceExecutionContract | null;
|
|
15
|
-
sourceSessionKey?: string | null;
|
|
16
|
-
diffSummary?: string | null;
|
|
17
|
-
baselineCandidateId?: string | null;
|
|
18
|
-
rolloutNotes?: string | null;
|
|
19
|
-
validationRefs?: string[];
|
|
20
|
-
evidence?: Record<string, unknown>;
|
|
21
|
-
};
|
|
22
|
-
export declare function createDefaultSkillImprovementPolicy(overrides?: Partial<SkillImprovementPolicyContract>): SkillImprovementPolicyContract;
|
|
23
|
-
export declare function normalizeSkillImprovementPolicy(value: unknown, fallback?: SkillImprovementPolicyContract): SkillImprovementPolicyContract;
|
|
24
|
-
export declare function buildSkillCandidateEvidencePayload(params: {
|
|
25
|
-
evidence?: Record<string, unknown> | null;
|
|
26
|
-
artifact?: SkillCandidateArtifactContract | null;
|
|
27
|
-
sourceExecution?: SkillCandidateSourceExecutionContract | null;
|
|
28
|
-
sourceSessionKey?: string | null;
|
|
29
|
-
}): Record<string, unknown>;
|
|
30
|
-
export declare function buildSkillCandidateImprovementEvidenceBundle(params: SkillCandidateImprovementEvidenceBundleContract): Record<string, unknown>;
|
|
31
|
-
export declare function buildSkillCandidateLatestReview(params: {
|
|
32
|
-
action: SkillCandidateAction;
|
|
33
|
-
actor?: string | null;
|
|
34
|
-
notes?: string | null;
|
|
35
|
-
payload?: Record<string, unknown> | null;
|
|
36
|
-
createdAt?: string;
|
|
37
|
-
}): SkillCandidateReviewContract;
|
|
38
|
-
export declare function buildSkillCandidateEffectivenessSummary(params: {
|
|
39
|
-
phase: "canary" | "published";
|
|
40
|
-
sampleCount?: number;
|
|
41
|
-
successCount?: number;
|
|
42
|
-
failureCount?: number;
|
|
43
|
-
regressionCount?: number;
|
|
44
|
-
avgLatencyMs?: number;
|
|
45
|
-
avgCostUsd?: number;
|
|
46
|
-
score?: number;
|
|
47
|
-
staleReason?: string | null;
|
|
48
|
-
notes?: string | null;
|
|
49
|
-
summary?: Record<string, unknown> | null;
|
|
50
|
-
lastObservedAt?: string;
|
|
51
|
-
updatedAt?: string;
|
|
52
|
-
}): SkillCandidateEffectivenessContract;
|