qlogicagent 2.18.1 → 2.18.3
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 +40 -22
- package/dist/cli.js +1 -1
- package/dist/index.js +528 -470
- package/dist/orchestration.js +11 -11
- package/dist/protocol.js +1 -1
- package/dist/skills/mcp/astraclaw-native-mcp-server.js +8 -6
- package/dist/types/agent/memory-recall-injection.d.ts +2 -1
- package/dist/types/agent/tool-loop/budget-continuation-policy.d.ts +4 -0
- package/dist/types/agent/tool-loop/completion-action-policy.d.ts +9 -1
- package/dist/types/agent/tool-loop/compression-pipeline.d.ts +2 -0
- package/dist/types/agent/tool-loop/loop-helpers.d.ts +1 -0
- package/dist/types/agent/tool-loop/tool-failure-policy.d.ts +13 -1
- package/dist/types/agent/tool-loop.d.ts +8 -0
- package/dist/types/agent/types.d.ts +2 -0
- package/dist/types/cli/credential-vault.d.ts +6 -0
- package/dist/types/cli/handlers/turn-handler.d.ts +50 -1
- package/dist/types/cli/handlers/workflow-handler.d.ts +1 -0
- package/dist/types/cli/memory-coordinator.d.ts +4 -0
- package/dist/types/cli/pet-runtime.d.ts +2 -0
- package/dist/types/cli/rpc-registry.d.ts +11 -0
- package/dist/types/cli/runtime-hook-bootstrap.d.ts +2 -0
- package/dist/types/cli/skill-tools-bootstrap.d.ts +5 -0
- package/dist/types/cli/stdio-acp-request-host.d.ts +2 -1
- package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +1 -0
- package/dist/types/cli/stdio-server.d.ts +4 -0
- package/dist/types/cli/task-distillation-coordinator.d.ts +79 -0
- package/dist/types/cli/tool-bootstrap-core-registration.d.ts +24 -0
- package/dist/types/cli/turn-core.d.ts +0 -6
- package/dist/types/cli/turn-project-router.d.ts +9 -0
- package/dist/types/contracts/hooks.d.ts +3 -0
- package/dist/types/contracts/turn-event.d.ts +8 -4
- package/dist/types/orchestration/agent-instance.d.ts +11 -1
- package/dist/types/orchestration/agent-roster.d.ts +12 -0
- package/dist/types/orchestration/context/reactive-compact.d.ts +4 -6
- package/dist/types/orchestration/dag-scheduler.d.ts +3 -0
- package/dist/types/orchestration/delegation-coordinator.d.ts +6 -1
- package/dist/types/orchestration/error-handling/retry-loop.d.ts +0 -22
- package/dist/types/orchestration/goal-loop-coordinator.d.ts +10 -1
- package/dist/types/orchestration/goal-mode-adapters.d.ts +23 -2
- package/dist/types/orchestration/goal-run-types.d.ts +12 -0
- package/dist/types/orchestration/product-budget.d.ts +13 -0
- package/dist/types/orchestration/product-planner.d.ts +7 -2
- package/dist/types/orchestration/product-run-coordinator.d.ts +1 -0
- package/dist/types/orchestration/skill-improvement.d.ts +7 -2
- package/dist/types/orchestration/workflow/budget-permission-gate.d.ts +9 -0
- package/dist/types/orchestration/workflow/node-schema.d.ts +4 -1
- package/dist/types/orchestration/workflow/run-history-store.d.ts +2 -0
- package/dist/types/orchestration/workflow/workflow-runtime.d.ts +8 -0
- package/dist/types/orchestration/workflow/workflow-trigger.d.ts +5 -1
- package/dist/types/protocol/wire/acp-agent-management.d.ts +3 -0
- package/dist/types/protocol/wire/agent-events.d.ts +2 -2
- package/dist/types/protocol/wire/gateway-rpc.d.ts +1 -0
- package/dist/types/protocol/wire/memory-provider-lifecycle.d.ts +3 -0
- package/dist/types/protocol/wire/notification-payloads.d.ts +27 -0
- package/dist/types/runtime/config/tunable-defaults.d.ts +6 -0
- package/dist/types/runtime/execution/memory-decay.d.ts +5 -1
- package/dist/types/runtime/execution/streaming-tool-executor.d.ts +2 -0
- package/dist/types/runtime/execution/tool-result-storage.d.ts +6 -4
- package/dist/types/runtime/hooks/context-compression.d.ts +5 -0
- package/dist/types/runtime/hooks/memory-hooks.d.ts +10 -0
- package/dist/types/runtime/infra/acp-detector.d.ts +8 -0
- package/dist/types/runtime/infra/acp-protocol-adapter.d.ts +19 -1
- package/dist/types/runtime/infra/agent-process.d.ts +6 -0
- package/dist/types/runtime/infra/astraclaw-capabilities.d.ts +9 -0
- package/dist/types/runtime/infra/external-agent-pool.d.ts +12 -0
- package/dist/types/runtime/infra/working-materials-store.d.ts +8 -14
- package/dist/types/runtime/pet/pet-profile-service.d.ts +7 -0
- package/dist/types/runtime/pet/petdex-forge-service.d.ts +3 -1
- package/dist/types/runtime/ports/agent-runtime-ports.d.ts +4 -1
- package/dist/types/runtime/ports/memory-provider.d.ts +2 -0
- package/dist/types/runtime/ports/project-memory-store.d.ts +2 -0
- package/dist/types/runtime/prompt/environment-context.d.ts +25 -3
- package/dist/types/runtime/prompt/fresh-workspace-evidence.d.ts +7 -2
- package/dist/types/runtime/prompt/instruction-loader.d.ts +0 -1
- package/dist/types/runtime/session/inbound-upload-persistence.d.ts +12 -0
- package/dist/types/runtime/session/session-catalog.d.ts +8 -0
- package/dist/types/runtime/session/session-resource-key.d.ts +28 -0
- package/dist/types/runtime/session/session-resume.d.ts +5 -0
- package/dist/types/runtime/session/session-transcript-store.d.ts +10 -1
- package/dist/types/runtime/session/session-types.d.ts +29 -0
- package/dist/types/skills/mcp/mcp-manager.d.ts +25 -1
- package/dist/types/skills/memory/local-memory-provider.d.ts +14 -0
- package/dist/types/skills/memory/local-store.d.ts +2 -0
- package/dist/types/skills/memory/memdir.d.ts +8 -0
- package/dist/types/skills/memory/task-distillation.d.ts +148 -0
- package/dist/types/skills/tools/search-tool.d.ts +6 -0
- package/dist/types/skills/tools/shell/task-output.d.ts +2 -0
- package/package.json +4 -3
- package/dist/types/agent/tool-loop/skill-instruction-policy.d.ts +0 -7
- package/dist/types/agent/tool-loop/tool-guardrails.d.ts +0 -24
- package/dist/types/cli/turn-skill-autopersist.d.ts +0 -22
|
@@ -17,19 +17,13 @@ export declare function getWorkingMaterials(projectId: string, sessionId: string
|
|
|
17
17
|
items: WorkingMaterialItem[];
|
|
18
18
|
missing: WorkingMaterialItem[];
|
|
19
19
|
}>;
|
|
20
|
-
export
|
|
20
|
+
export interface WorkingMaterialsWriteResult {
|
|
21
21
|
ok: true;
|
|
22
22
|
items: WorkingMaterialItem[];
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export declare function removeWorkingMaterial(projectId: string, sessionId: string, id: string): Promise<
|
|
29
|
-
|
|
30
|
-
items: WorkingMaterialItem[];
|
|
31
|
-
}>;
|
|
32
|
-
export declare function reorderWorkingMaterials(projectId: string, sessionId: string, ids: string[]): Promise<{
|
|
33
|
-
ok: true;
|
|
34
|
-
items: WorkingMaterialItem[];
|
|
35
|
-
}>;
|
|
23
|
+
/** 超过上限被淘汰的项;非空时调用方/UI 必须告知用户(绝不静默丢用户 pin 的数据)。 */
|
|
24
|
+
dropped?: WorkingMaterialItem[];
|
|
25
|
+
}
|
|
26
|
+
export declare function replaceWorkingMaterials(projectId: string, sessionId: string, items: unknown[]): Promise<WorkingMaterialsWriteResult>;
|
|
27
|
+
export declare function upsertWorkingMaterial(projectId: string, sessionId: string, item: unknown): Promise<WorkingMaterialsWriteResult>;
|
|
28
|
+
export declare function removeWorkingMaterial(projectId: string, sessionId: string, id: string): Promise<WorkingMaterialsWriteResult>;
|
|
29
|
+
export declare function reorderWorkingMaterials(projectId: string, sessionId: string, ids: string[]): Promise<WorkingMaterialsWriteResult>;
|
|
@@ -81,6 +81,13 @@ export declare class PetProfileService {
|
|
|
81
81
|
private readonly profilePath;
|
|
82
82
|
constructor(ownerUserId: string);
|
|
83
83
|
loadProfile(): PetProfile;
|
|
84
|
+
/**
|
|
85
|
+
* Load the profile for a read-modify-write cycle. A corrupt profile file must
|
|
86
|
+
* never be replaced by a rebuilt default — throw so the caller fails loudly
|
|
87
|
+
* instead of silently destroying the user's pet data.
|
|
88
|
+
*/
|
|
89
|
+
private loadProfileForWrite;
|
|
90
|
+
private readProfileState;
|
|
84
91
|
updateSoul(soul: PetSoul | null): PetProfile;
|
|
85
92
|
updatePreferences(update: Partial<PetPreferences>): PetProfile;
|
|
86
93
|
saveJourneySnapshot(snapshot: JourneySnapshot): PetProfile;
|
|
@@ -9,7 +9,9 @@ export interface PetdexForgePackageOutput extends PetdexForgeOutput {
|
|
|
9
9
|
validationPath: string;
|
|
10
10
|
productionRunPath: string;
|
|
11
11
|
}
|
|
12
|
-
export declare function forgePetdexAsset(input: PetdexForgeRequest, generateImage: GeneratePetdexImage, options?: PetdexProductionOptions): Promise<PetdexForgeOutput
|
|
12
|
+
export declare function forgePetdexAsset(input: PetdexForgeRequest, generateImage: GeneratePetdexImage, options?: PetdexProductionOptions): Promise<PetdexForgeOutput & {
|
|
13
|
+
qaSkippedJobs?: string[];
|
|
14
|
+
}>;
|
|
13
15
|
export declare function forgePetdexAssetPackage(params: {
|
|
14
16
|
input: PetdexForgeRequest;
|
|
15
17
|
outputDir: string;
|
|
@@ -39,6 +39,8 @@ export interface StreamingToolExecutorPortConfig {
|
|
|
39
39
|
signal?: AbortSignal;
|
|
40
40
|
maxConcurrentTools?: number;
|
|
41
41
|
maxExecutionMs?: number;
|
|
42
|
+
/** Turn workspace/cwd — routes oversized tool-result spillover to the session's reachable data dir. */
|
|
43
|
+
projectRoot?: string;
|
|
42
44
|
}
|
|
43
45
|
export interface ContextCompressionEnginePort {
|
|
44
46
|
compressAsync(messages: RuntimeCompressibleMessage[], budget: number, context: {
|
|
@@ -52,9 +54,10 @@ export interface ToolLoopRuntimePorts {
|
|
|
52
54
|
role: string;
|
|
53
55
|
content?: string | unknown;
|
|
54
56
|
tool_call_id?: string;
|
|
55
|
-
}>, state: unknown, sessionId: string): Promise<{
|
|
57
|
+
}>, state: unknown, sessionId: string, projectRoot: string | undefined): Promise<{
|
|
56
58
|
messages: unknown[];
|
|
57
59
|
newlyReplacedCount: number;
|
|
60
|
+
newlyPersistedBytes?: number;
|
|
58
61
|
}>;
|
|
59
62
|
getActiveContextCompressionEngine(): ContextCompressionEnginePort | null;
|
|
60
63
|
compressMessages(messages: RuntimeCompressibleMessage[], options: {
|
|
@@ -4,6 +4,8 @@ export interface MemorySearchOptions {
|
|
|
4
4
|
minScore?: number;
|
|
5
5
|
preferredCategories?: string[];
|
|
6
6
|
llmConfig?: unknown;
|
|
7
|
+
/** Drop hits whose tags contain ALL strings of any group (resident-layer exclusion). */
|
|
8
|
+
excludeTagGroups?: string[][];
|
|
7
9
|
}
|
|
8
10
|
export interface MemorySearchResult {
|
|
9
11
|
blockId: string;
|
|
@@ -41,4 +41,6 @@ export interface ProjectMemoryStore {
|
|
|
41
41
|
export interface ProjectMemoryStoreFactory {
|
|
42
42
|
getRootPath(projectRoot: string): string;
|
|
43
43
|
create(projectRoot: string): ProjectMemoryStore;
|
|
44
|
+
/** Read the user-level global memory INDEX for prompt injection (null when absent/empty). */
|
|
45
|
+
readUserIndexForPrompt(): string | null;
|
|
44
46
|
}
|
|
@@ -32,6 +32,16 @@ export interface ShellInfo {
|
|
|
32
32
|
psEdition?: "5.1" | "7+";
|
|
33
33
|
isGitBashOnWindows?: boolean;
|
|
34
34
|
}
|
|
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[];
|
|
35
45
|
/**
|
|
36
46
|
* Create a system prompt section that provides environment context.
|
|
37
47
|
* Memoized — computed once per session (environment doesn't change mid-session).
|
|
@@ -45,12 +55,24 @@ export interface ShellInfo {
|
|
|
45
55
|
*/
|
|
46
56
|
export declare function createEnvironmentContextSection(cwdOverride?: string, shellInfo?: ShellInfo): SystemPromptSection;
|
|
47
57
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
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.
|
|
50
63
|
*
|
|
51
64
|
* @param domain - Task domain from auto-detection or host override.
|
|
52
65
|
*/
|
|
53
|
-
export declare function
|
|
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
|
+
export declare function createUniversalGuidanceSection(): SystemPromptSection;
|
|
54
76
|
/**
|
|
55
77
|
* Create a system prompt section that provides tool usage guidance.
|
|
56
78
|
* CC parity: matches claude-code's getUsingYourToolsSection().
|
|
@@ -16,8 +16,6 @@ export interface FreshWorkspaceEvidencePolicy {
|
|
|
16
16
|
allowedToolNames: string[];
|
|
17
17
|
}
|
|
18
18
|
export declare function getFreshWorkspaceEvidencePolicy(messages: readonly PromptMessageLike[] | string): FreshWorkspaceEvidencePolicy;
|
|
19
|
-
/** 显式构建/创建类请求(做个游戏/网站/app…)。命中 → 第一回合就强制工具调用。 */
|
|
20
|
-
export declare function looksLikeBuildIntent(messages: readonly PromptMessageLike[] | string): boolean;
|
|
21
19
|
export declare function isLightweightChatTurn(messages: readonly PromptMessageLike[] | string): boolean;
|
|
22
20
|
export declare function isExplicitNoToolTurn(messages: readonly PromptMessageLike[] | string): boolean;
|
|
23
21
|
/**
|
|
@@ -35,4 +33,11 @@ export declare function isExplicitNoToolTurn(messages: readonly PromptMessageLik
|
|
|
35
33
|
* stay subject to the normal evidence filter.)
|
|
36
34
|
*/
|
|
37
35
|
export declare function selectFreshWorkspaceEvidenceTools<TTool extends ToolNameLike>(tools: readonly TTool[], policy: FreshWorkspaceEvidencePolicy): TTool[];
|
|
36
|
+
/**
|
|
37
|
+
* Prompt notice for an explicit "don't use tools" instruction. This INFORMS the
|
|
38
|
+
* model and leaves the judgment to it — the engine no longer strips the tool list
|
|
39
|
+
* (toolChoice="none"), which also silently disabled the reactive guards and
|
|
40
|
+
* misfired on quoted/reported speech ("he said don't use tools").
|
|
41
|
+
*/
|
|
42
|
+
export declare function createExplicitNoToolNoticeSection(): SystemPromptSection;
|
|
38
43
|
export declare function createFreshWorkspaceEvidenceSection(policy: FreshWorkspaceEvidencePolicy): SystemPromptSection | null;
|
|
@@ -54,7 +54,6 @@ export declare function loadInstructions(cwd: string, hooks?: HookRegistry): Pro
|
|
|
54
54
|
*/
|
|
55
55
|
export declare function buildInstructionsPrompt(files: InstructionFileInfo[]): string;
|
|
56
56
|
export declare function extractLiteralResponseRequirements(files: InstructionFileInfo[]): LiteralResponseRequirement[];
|
|
57
|
-
export declare function applyLiteralResponseRequirements(content: string, requirements: readonly LiteralResponseRequirement[]): string;
|
|
58
57
|
/**
|
|
59
58
|
* Get conditional rules that match a target file path.
|
|
60
59
|
* CC parity: getManagedAndUserConditionalRules() + getMemoryFilesForNestedDirectory()
|
|
@@ -15,6 +15,14 @@ import type { ChatMessage } from "../../protocol/wire/index.js";
|
|
|
15
15
|
export interface PersistedUpload {
|
|
16
16
|
url: string;
|
|
17
17
|
localPath?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the bytes were actually written to durable storage. `true` on success, `false` when a
|
|
20
|
+
* transport upload was found but persisting it FAILED (fetch error / non-ok / write error) — the
|
|
21
|
+
* returned `url` is then the short-lived transport URL that dies with the turn. `undefined` means
|
|
22
|
+
* the input was not a transport upload to begin with (already-persisted / remote / file://), which
|
|
23
|
+
* is not a failure. Honesty over silence: callers use `false` to warn instead of pretending it saved.
|
|
24
|
+
*/
|
|
25
|
+
persisted?: boolean;
|
|
18
26
|
}
|
|
19
27
|
/** 同 persistInboundUploadUrl,但返回持久化后的本地绝对路径(供模型直接 read/exec)。 */
|
|
20
28
|
export declare function persistInboundUploadUrlDetailed(url: string, projectId: string, sessionId: string): Promise<PersistedUpload>;
|
|
@@ -26,6 +34,10 @@ export declare function persistInboundUploadUrl(url: string, projectId: string,
|
|
|
26
34
|
/**
|
|
27
35
|
* Persist + rewrite the inbound uploads on the LAST user message of a turn (the new message;
|
|
28
36
|
* resumed history already carries persisted local URLs). Mutates and returns the message array.
|
|
37
|
+
*
|
|
38
|
+
* Failure parity with the document path (appendLocalDocumentNotesToText): when a media upload
|
|
39
|
+
* could NOT be persisted, the message gets a model-visible note instead of silently keeping a
|
|
40
|
+
* transport URL that expires with the turn — the model must know the reference is short-lived.
|
|
29
41
|
*/
|
|
30
42
|
export declare function persistInboundUploadsForTurn(messages: ChatMessage[], projectId: string | undefined, sessionId: string | undefined): Promise<ChatMessage[]>;
|
|
31
43
|
/**
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import type { SessionListEntry } from "./session-types.js";
|
|
2
2
|
export declare function listSessions(limit: number | undefined, projectRoot: string): Promise<SessionListEntry[]>;
|
|
3
3
|
export declare function deleteSession(sessionId: string, projectRoot: string): Promise<void>;
|
|
4
|
+
/**
|
|
5
|
+
* ⚠️ Destructive cascade with NO user-visible confirmation: every pruned session goes through
|
|
6
|
+
* deleteSession, which permanently removes its transcript + metadata + checkpoints + uploads.
|
|
7
|
+
* Currently has NO caller. If you wire this up, the deletions must be surfaced to the user
|
|
8
|
+
* (count + which sessions) — silently reaping MAX_SESSIONS-overflow would be exactly the kind of
|
|
9
|
+
* invisible data loss docs/judgment-over-mechanism.md forbids. Also note listSessions skips
|
|
10
|
+
* unreadable-metadata sessions, so a prune pass under fs errors could mis-rank what "oldest" is.
|
|
11
|
+
*/
|
|
4
12
|
export declare function pruneOldSessions(projectRoot: string): Promise<number>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single source of truth for session resource keys (canonical identity) and the derived
|
|
3
|
+
* resident-pool / delegation keys. Forbids scattered ad-hoc string concatenation of session keys
|
|
4
|
+
* (invariant I2, docs/session-identity-alignment-spec.md). Leaf module — imports nothing.
|
|
5
|
+
*/
|
|
6
|
+
/** Canonical session identity: our-minted, stable-from-creation id + its owning agent + project. */
|
|
7
|
+
export interface SessionResource {
|
|
8
|
+
/** Owning agent kind: own ("qlogicagent") / codex / claude / … (= SessionMetadata.agentId). */
|
|
9
|
+
agentId: string;
|
|
10
|
+
/** Owning project id (path-derived / opaque; not minted here). */
|
|
11
|
+
projectId: string;
|
|
12
|
+
/** Our-minted session id, stable from creation — never the native Y (Y lives in nativeBinding). */
|
|
13
|
+
canonicalSessionId: string;
|
|
14
|
+
}
|
|
15
|
+
/** Serialize the canonical session resource to its single opaque key string. */
|
|
16
|
+
export declare function buildSessionResourceKey(r: SessionResource): string;
|
|
17
|
+
/** Parse a key produced by {@link buildSessionResourceKey}; throws on a malformed key. */
|
|
18
|
+
export declare function parseSessionResourceKey(key: string): SessionResource;
|
|
19
|
+
/**
|
|
20
|
+
* Resident external-agent pool key: same agent + workspace + session ⇒ same resident process.
|
|
21
|
+
* `sessionId` may be a canonical id, the WARM_SESSION token, or undefined (defaults to "default").
|
|
22
|
+
* Byte-identical to the historical inline pool key it replaces.
|
|
23
|
+
*/
|
|
24
|
+
export declare function buildAgentPoolKey(agentId: string, cwd: string, sessionId?: string): string;
|
|
25
|
+
/** Prefix matching every pool key for `agentId` (agent-scoped eviction, exact id-boundary). */
|
|
26
|
+
export declare function agentPoolKeyPrefix(agentId: string): string;
|
|
27
|
+
/** @mention delegation serialization key for one (agent × conversation) pair. */
|
|
28
|
+
export declare function buildConvKey(agentId: string, canonicalSessionId: string): string;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { PersistedSession } from "./session-types.js";
|
|
2
|
+
/** Coded error: the session's project root cannot be read at all (deleted dir, unplugged drive,
|
|
3
|
+
* permissions). Distinguishable from the `null` return, which strictly means "this session has no
|
|
4
|
+
* persisted transcript" — conflating the two made every caller silently start a NEW empty session
|
|
5
|
+
* on a read failure (docs/judgment-over-mechanism.md: "read failed" ≠ "does not exist"). */
|
|
6
|
+
export declare const PROJECT_ROOT_UNAVAILABLE = "PROJECT_ROOT_UNAVAILABLE";
|
|
2
7
|
export declare function loadSessionForResume(sessionId: string, projectRoot: string, options?: {
|
|
3
8
|
includeDisplayMetadata?: boolean;
|
|
4
9
|
}): Promise<PersistedSession | null>;
|
|
@@ -3,11 +3,20 @@ import type { MessageDisplayMetadata, PersistedChatMessage, TokenUsage } from ".
|
|
|
3
3
|
export interface TranscriptLoadResult {
|
|
4
4
|
messages: PersistedChatMessage[];
|
|
5
5
|
corruptLines: number;
|
|
6
|
+
/** 1-based line numbers that failed to parse (bounded to the first MAX_REPORTED_CORRUPT_LINES). */
|
|
7
|
+
corruptLineNumbers: number[];
|
|
6
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Outcome of an appendMessage call. "skipped-deleted" (the session was deleted — a LEGAL late-write
|
|
11
|
+
* no-op) is deliberately distinguishable from "failed" (the write itself failed — the message is
|
|
12
|
+
* LOST and callers must leave a trace / surface it), per docs/judgment-over-mechanism.md:
|
|
13
|
+
* "does not exist" and "write failed" must never be conflated into one silent boolean.
|
|
14
|
+
*/
|
|
15
|
+
export type AppendMessageOutcome = "appended" | "skipped-deleted" | "failed";
|
|
7
16
|
export declare function appendMessage(sessionId: string, message: ChatMessage, projectRoot: string, turnId?: string, metadata?: {
|
|
8
17
|
usage?: TokenUsage;
|
|
9
18
|
displayMetadata?: MessageDisplayMetadata;
|
|
10
|
-
}): Promise<
|
|
19
|
+
}): Promise<AppendMessageOutcome>;
|
|
11
20
|
export declare function countTranscriptMessages(sessionId: string, projectRoot: string): Promise<number | null>;
|
|
12
21
|
export declare function loadTranscript(sessionId: string, projectRoot: string, options?: {
|
|
13
22
|
includeDisplayMetadata?: boolean;
|
|
@@ -18,6 +18,25 @@ export interface InflightTurnMarker {
|
|
|
18
18
|
/** 该轮是否已执行过有副作用的工具(写文件/发消息/外部 API)。安全档不据此自动续,仅用于 UI"可能重复"提示 + 为智能档铺路。 */
|
|
19
19
|
hadSideEffectTool?: boolean;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Native (codex/claude) session binding — present only on native sessions, written once the
|
|
23
|
+
* external agent reports its own session id (Y). Our `sessionId` stays the canonical identity;
|
|
24
|
+
* `nativeSessionId` is an ATTRIBUTE used ONLY when talking to the external CLI (ACP session/load),
|
|
25
|
+
* never as a map/pool/list key. `nativeRef` independently locates the external transcript file so
|
|
26
|
+
* content loads (and the binding is recoverable) without relying on `sessionId === nativeSessionId`.
|
|
27
|
+
*/
|
|
28
|
+
export interface NativeBinding {
|
|
29
|
+
/** External agent's own session id (Y) — used only for ACP session/load resume. */
|
|
30
|
+
nativeSessionId: string;
|
|
31
|
+
/** Locator for the external transcript file (loadTranscript + binding-loss fallback). */
|
|
32
|
+
nativeRef: {
|
|
33
|
+
agentId: string;
|
|
34
|
+
kind: "codex" | "claude";
|
|
35
|
+
file: string;
|
|
36
|
+
};
|
|
37
|
+
/** ISO time the binding was established (first turn the external agent reported Y). */
|
|
38
|
+
boundAt: string;
|
|
39
|
+
}
|
|
21
40
|
export interface SessionMetadata {
|
|
22
41
|
schemaVersion?: number;
|
|
23
42
|
sessionId: string;
|
|
@@ -52,10 +71,18 @@ export interface SessionMetadata {
|
|
|
52
71
|
interruptedTurnCount?: number;
|
|
53
72
|
/** 达熔断阈值放弃恢复的时间戳(UI 显示"多次中断已停止自动恢复")。 */
|
|
54
73
|
recoveryAbandonedAt?: string;
|
|
74
|
+
/** native(codex/claude)会话绑定:外部 Y + nativeRef;own 会话恒 undefined。见 {@link NativeBinding}。 */
|
|
75
|
+
nativeBinding?: NativeBinding;
|
|
55
76
|
}
|
|
56
77
|
export interface PersistedSession {
|
|
57
78
|
metadata: SessionMetadata;
|
|
58
79
|
messages: PersistedChatMessage[];
|
|
80
|
+
/**
|
|
81
|
+
* Count of transcript lines that failed to parse and were skipped on load. Surfaced so the UI can
|
|
82
|
+
* tell the user "N 条消息无法读取" instead of silently resuming a conversation with holes in it.
|
|
83
|
+
* Omitted/0 for a clean transcript.
|
|
84
|
+
*/
|
|
85
|
+
corruptLines?: number;
|
|
59
86
|
}
|
|
60
87
|
export interface MessageDisplayMetadata {
|
|
61
88
|
messageId?: string;
|
|
@@ -96,6 +123,8 @@ export interface SessionListEntry {
|
|
|
96
123
|
groupKey?: string;
|
|
97
124
|
previousSessionId?: string;
|
|
98
125
|
carryoverSummary?: string | null;
|
|
126
|
+
/** N4: native (codex/claude) binding, surfaced so session.list can shape source:"native" + nativeRef. */
|
|
127
|
+
nativeBinding?: NativeBinding;
|
|
99
128
|
}
|
|
100
129
|
export interface TaskSummaryDeps {
|
|
101
130
|
transport: import("../ports/index.js").LLMTransport;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PortableTool } from "../portable-tool.js";
|
|
1
|
+
import type { PortableTool, PortableToolResult } from "../portable-tool.js";
|
|
2
2
|
interface ToolRegistryLike {
|
|
3
3
|
addTools(tools: PortableTool[]): void;
|
|
4
4
|
getToolNames(): string[];
|
|
@@ -35,6 +35,17 @@ export interface McpSecurityIssue {
|
|
|
35
35
|
code: "dangerous_egress" | "persistence" | "ioc_public_key";
|
|
36
36
|
message: string;
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* A configured server that is NOT serving tools this session. Surfaced (not just logged)
|
|
40
|
+
* so capability queries (e.g. mcp_connectors_list) can disclose "configured but unavailable"
|
|
41
|
+
* instead of the server silently vanishing from the tool pool.
|
|
42
|
+
*/
|
|
43
|
+
export interface McpServerFailure {
|
|
44
|
+
name: string;
|
|
45
|
+
/** "config" = entry invalid, skipped before connect; "connect" = every connect attempt failed. */
|
|
46
|
+
phase: "config" | "connect";
|
|
47
|
+
error: string;
|
|
48
|
+
}
|
|
38
49
|
export interface McpManagerConfig {
|
|
39
50
|
servers: McpServerEntry[];
|
|
40
51
|
log?: {
|
|
@@ -67,7 +78,10 @@ export declare class McpManager {
|
|
|
67
78
|
private toolCatalog?;
|
|
68
79
|
private serverToolFilters;
|
|
69
80
|
private serverOAuth;
|
|
81
|
+
private failedServers;
|
|
70
82
|
constructor(config: McpManagerConfig);
|
|
83
|
+
/** Record (and loudly report) a server that will serve NO tools this session. */
|
|
84
|
+
private markServerFailed;
|
|
71
85
|
private toServerDefinition;
|
|
72
86
|
/**
|
|
73
87
|
* Connect to all configured MCP servers and snapshot their tools.
|
|
@@ -81,6 +95,8 @@ export declare class McpManager {
|
|
|
81
95
|
refreshServerTools(serverName: string): Promise<number>;
|
|
82
96
|
/** Get names of all connected servers. */
|
|
83
97
|
getConnectedServers(): string[];
|
|
98
|
+
/** Configured servers serving NO tools this session (invalid config or terminal connect failure). */
|
|
99
|
+
getFailedServers(): McpServerFailure[];
|
|
84
100
|
/** Get total number of MCP tools across all servers. */
|
|
85
101
|
getToolCount(): number;
|
|
86
102
|
/**
|
|
@@ -95,6 +111,14 @@ export declare class McpManager {
|
|
|
95
111
|
private registerTools;
|
|
96
112
|
private removeRegisteredTool;
|
|
97
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Flatten an MCP CallToolResult into a text-bearing PortableToolResult.
|
|
116
|
+
* Non-text blocks (image/audio/resource…) cannot be dropped silently: content is
|
|
117
|
+
* the only channel the model sees, so the omission is disclosed in the text —
|
|
118
|
+
* "(no text output)" for a result that DID produce blocks is a lie.
|
|
119
|
+
* Exported for unit tests only.
|
|
120
|
+
*/
|
|
121
|
+
export declare function toPortableResult(result: unknown): PortableToolResult;
|
|
98
122
|
export declare function validateMcpToolWorkspaceBoundary(toolName: string, args: unknown, workspaceRoot: string | undefined): string | null;
|
|
99
123
|
export declare function parseMcpConfig(json: unknown): McpServerEntry[];
|
|
100
124
|
export declare function filterMcpTools<T extends {
|
|
@@ -32,6 +32,8 @@ export declare class LocalMemoryProvider implements MemoryProvider {
|
|
|
32
32
|
private attachmentStore;
|
|
33
33
|
private userIdPrefix;
|
|
34
34
|
private dbPath;
|
|
35
|
+
/** One-shot flag: the embedding-degradation trace is logged once per provider instance. */
|
|
36
|
+
private embeddingFailureLogged;
|
|
35
37
|
constructor(config: LocalMemoryProviderConfig);
|
|
36
38
|
/** Persist an uploaded attachment (orphan until linked at commit). */
|
|
37
39
|
adoptAttachment(input: {
|
|
@@ -57,9 +59,18 @@ export declare class LocalMemoryProvider implements MemoryProvider {
|
|
|
57
59
|
/** Persist the understood/extracted text on an attachment row. */
|
|
58
60
|
setAttachmentText(id: string, text: string): void;
|
|
59
61
|
private resolveUserId;
|
|
62
|
+
/**
|
|
63
|
+
* The embedding API failing silently downgrades every search to FTS-only —
|
|
64
|
+
* leave one error-level trace per provider instance (deduped so a broken
|
|
65
|
+
* endpoint does not flood the log on every query).
|
|
66
|
+
*/
|
|
67
|
+
private noteEmbeddingFailure;
|
|
60
68
|
private buildEmbedding;
|
|
61
69
|
search(query: string, userId: string, options?: MemorySearchOptions): Promise<MemorySearchResult[]>;
|
|
62
70
|
ingest(messages: MemoryIngestMessage[], userId: string, options?: MemoryIngestOptions): Promise<void>;
|
|
71
|
+
/** Public embedding access for task-distillation signatures (R3). Null when
|
|
72
|
+
* the embedding provider is unavailable — callers must degrade, not throw. */
|
|
73
|
+
embedText(text: string): Promise<Float32Array | null>;
|
|
63
74
|
addText(text: string, userId: string, options?: MemoryIngestOptions & {
|
|
64
75
|
category?: string;
|
|
65
76
|
importance?: number;
|
|
@@ -102,6 +113,9 @@ export declare class LocalMemoryProvider implements MemoryProvider {
|
|
|
102
113
|
* Apply feedback to a memory (useful/irrelevant/outdated/wrong).
|
|
103
114
|
* Adjusts importance or archives/deletes based on signal.
|
|
104
115
|
*/
|
|
116
|
+
/** V3 promote/demote: archive(技能接棒,记忆退役)与 unarchive(降格回归)成对。
|
|
117
|
+
* claims 状态随动,防 archived 记忆的 claim 继续参与冲突/召回。 */
|
|
118
|
+
setMemoryArchived(memoryId: string, archived: boolean): boolean;
|
|
105
119
|
feedback(memoryIds: string[], signal: "useful" | "irrelevant" | "outdated" | "wrong"): Promise<{
|
|
106
120
|
affected: number;
|
|
107
121
|
}>;
|
|
@@ -103,6 +103,8 @@ export declare class LocalMemoryStore {
|
|
|
103
103
|
* Used by dedup gate when a similar but newer memory supersedes an older one.
|
|
104
104
|
*/
|
|
105
105
|
archive(id: string): boolean;
|
|
106
|
+
/** V3 demote(降格)恢复:archived procedure 回归召回池,与 archive 成对。 */
|
|
107
|
+
unarchive(id: string): boolean;
|
|
106
108
|
/**
|
|
107
109
|
* Temporal expiry: archive event/plan memories whose event_date has passed
|
|
108
110
|
* beyond a grace period (e.g., "meeting tomorrow" 3 days after it happened).
|
|
@@ -8,6 +8,14 @@ export declare const TOPIC_FILE_MAX_CHARS = 8192;
|
|
|
8
8
|
export declare function getMemdirPath(projectRoot: string): string;
|
|
9
9
|
/** Full path to INDEX.md */
|
|
10
10
|
export declare function getIndexPath(projectRoot: string): string;
|
|
11
|
+
/** Global-layer size budget: a cheat-sheet, not a memory store. */
|
|
12
|
+
export declare const USER_INDEX_MAX_CHARS = 2048;
|
|
13
|
+
export declare const USER_INDEX_MAX_LINES = 40;
|
|
14
|
+
/** Full path to the user-level global INDEX.md (QLOGICAGENT_HOME aware). */
|
|
15
|
+
export declare function getUserIndexPath(): string;
|
|
16
|
+
/** Read the global layer for prompt injection, capped by the cheat-sheet budget.
|
|
17
|
+
* Returns null when absent/empty — the section simply doesn't render. */
|
|
18
|
+
export declare function readUserIndexForPrompt(): string | null;
|
|
11
19
|
export interface MemdirFileInfo {
|
|
12
20
|
name: string;
|
|
13
21
|
/** Size in bytes */
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task distillation (R3, 记忆体系 v2) — 任务后蒸馏的纯逻辑层。
|
|
3
|
+
* spec: xiaozhiclaw-runtime/docs/memory-layering-and-distillation-spec.md
|
|
4
|
+
*
|
|
5
|
+
* 蒸馏对象 = "费了劲才做成的任务的做法"(程序性配方),绝不是每轮都跑:
|
|
6
|
+
* 候选采集(回合完成,轻量) → 空闲窗聚类(签名 embedding,宁严勿松) →
|
|
7
|
+
* 簇 ≥ 重复阈值才产 1 条 procedure 记忆 → 高复用晋升技能(见 coordinator)。
|
|
8
|
+
* 成功闸不用 LLM 自评:正常终态 + 同 session 近窗内未被"重做"(在线否决)。
|
|
9
|
+
* 与 feedback-distillation(反馈域)无关 —— 这里蒸馏的是任务执行模式。
|
|
10
|
+
*/
|
|
11
|
+
/** 同模式判定的余弦下限。错聚有害(把不同任务蒸成一份配方),漏聚无害(下次再攒)。 */
|
|
12
|
+
export declare const TASK_DISTILL_CLUSTER_SIM = 0.86;
|
|
13
|
+
/** 在线否决窗口:同 session 内距离 ≤N 回合出现高相似任务 = 前一次疑似被重做(纠正信号)。 */
|
|
14
|
+
export declare const TASK_DISTILL_REDO_WINDOW_TURNS = 3;
|
|
15
|
+
/** 候选滚动上限(jsonl 只保留最近 N 条,防无界增长)。 */
|
|
16
|
+
export declare const TASK_DISTILL_MAX_CANDIDATES = 200;
|
|
17
|
+
/** 晋升推荐阈值:procedure 被召回复用 ≥N 次且未被负反馈沉底。 */
|
|
18
|
+
export declare const TASK_DISTILL_PROMOTE_ACCESS = 3;
|
|
19
|
+
export declare const PROCEDURE_TAG = "distilled@v1";
|
|
20
|
+
export declare const PROCEDURE_CATEGORY = "procedure";
|
|
21
|
+
export interface TaskCandidate {
|
|
22
|
+
id: string;
|
|
23
|
+
sessionId: string;
|
|
24
|
+
/** session 内回合序号(在线否决的距离度量) */
|
|
25
|
+
turnIndex: number;
|
|
26
|
+
/** 任务首句(user prompt 头部,签名文本) */
|
|
27
|
+
promptHead: string;
|
|
28
|
+
toolCallCount: number;
|
|
29
|
+
distinctToolCount: number;
|
|
30
|
+
/** 工具调用序列(name 有序去连续重复),配方步骤的原料 */
|
|
31
|
+
toolSequence: string[];
|
|
32
|
+
durationMs: number;
|
|
33
|
+
at: number;
|
|
34
|
+
/** 签名 embedding(bge-m3);无 embedding 的候选不参与聚类(宁严勿松) */
|
|
35
|
+
embedding?: number[];
|
|
36
|
+
status: "pending" | "rejected" | "distilled";
|
|
37
|
+
}
|
|
38
|
+
export interface CandidateStoreFile {
|
|
39
|
+
candidates: TaskCandidate[];
|
|
40
|
+
}
|
|
41
|
+
export declare function candidateStorePath(profileMemoryDir: string): string;
|
|
42
|
+
export declare function readCandidateStore(path: string): CandidateStoreFile;
|
|
43
|
+
export declare function writeCandidateStore(path: string, store: CandidateStoreFile): void;
|
|
44
|
+
export declare function cosine(a: readonly number[], b: readonly number[]): number;
|
|
45
|
+
export interface CollectInput {
|
|
46
|
+
id: string;
|
|
47
|
+
sessionId: string;
|
|
48
|
+
turnIndex: number;
|
|
49
|
+
promptHead: string;
|
|
50
|
+
toolCallCount: number;
|
|
51
|
+
distinctToolCount: number;
|
|
52
|
+
toolSequence: string[];
|
|
53
|
+
durationMs: number;
|
|
54
|
+
at: number;
|
|
55
|
+
embedding?: number[];
|
|
56
|
+
/** 回合终态:非正常终态的任务不候选(成功闸①) */
|
|
57
|
+
ok: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface CollectResult {
|
|
60
|
+
accepted: boolean;
|
|
61
|
+
/** 被本次采集在线否决(疑似被重做)的旧候选 id */
|
|
62
|
+
rejectedIds: string[];
|
|
63
|
+
reason?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* 采集一个回合为蒸馏候选。
|
|
67
|
+
* 在线否决(成功闸②):同 session、距离 ≤REDO_WINDOW 回合内出现高相似新任务,
|
|
68
|
+
* 视为前一次被重做/纠正 —— 否决旧候选(新候选照常入列,它可能是成功版)。
|
|
69
|
+
* 跨 session 或距离更远的相似 = 模式重复,恰是蒸馏想要的信号,全部保留。
|
|
70
|
+
*/
|
|
71
|
+
export declare function collectCandidate(store: CandidateStoreFile, input: CollectInput): CollectResult;
|
|
72
|
+
export declare function clusterCandidates(store: CandidateStoreFile): TaskCandidate[][];
|
|
73
|
+
/** 压缩工具序列:去连续重复,保顺序。 */
|
|
74
|
+
export declare function compressToolSequence(seq: readonly string[]): string[];
|
|
75
|
+
export declare function clusterSignature(cluster: readonly TaskCandidate[]): string;
|
|
76
|
+
export declare function renderProcedureFallback(cluster: readonly TaskCandidate[]): string;
|
|
77
|
+
/** reverted = 升格后被撤销(降格) —— 与"暂不"(dismissed)分开计,是降格率仪表的分子。 */
|
|
78
|
+
export type PromotionStatus = "proposed" | "accepted" | "dismissed" | "reverted";
|
|
79
|
+
export interface PromotionProposal {
|
|
80
|
+
procedureId: string;
|
|
81
|
+
/** 配方首行(展示用) */
|
|
82
|
+
title: string;
|
|
83
|
+
accessCount: number;
|
|
84
|
+
proposedAt: number;
|
|
85
|
+
status: PromotionStatus;
|
|
86
|
+
/** 状态变迁时间(度量面:接受率/响应时长的数据源) */
|
|
87
|
+
resolvedAt?: number;
|
|
88
|
+
/** accepted 时记录升格产出的技能名(demote 反查) */
|
|
89
|
+
skillName?: string;
|
|
90
|
+
/** V3.3 自动档升格(非用户点击) */
|
|
91
|
+
auto?: boolean;
|
|
92
|
+
/** 自动升格的开场确认卡已读(「知道了」) */
|
|
93
|
+
acknowledgedAt?: number;
|
|
94
|
+
}
|
|
95
|
+
export interface PromotionStoreFile {
|
|
96
|
+
proposals: PromotionProposal[];
|
|
97
|
+
}
|
|
98
|
+
export declare function promotionStorePath(profileMemoryDir: string): string;
|
|
99
|
+
export declare function readPromotionStore(path: string): PromotionStoreFile;
|
|
100
|
+
export declare function writePromotionStore(path: string, store: PromotionStoreFile): void;
|
|
101
|
+
/** 达标条目 upsert 为提议。dismissed/accepted 是终态,永不复活(拍板②:暂不=不再打扰)。
|
|
102
|
+
* 已 proposed 的只刷新 accessCount。返回是否新增。 */
|
|
103
|
+
export declare function upsertProposal(store: PromotionStoreFile, input: {
|
|
104
|
+
procedureId: string;
|
|
105
|
+
title: string;
|
|
106
|
+
accessCount: number;
|
|
107
|
+
now: number;
|
|
108
|
+
}): boolean;
|
|
109
|
+
export declare function resolveProposal(store: PromotionStoreFile, procedureId: string, status: "accepted" | "dismissed", now: number): boolean;
|
|
110
|
+
/** 降格:accepted → reverted(区分"暂不";降格率=reverted/accepted 家族)。 */
|
|
111
|
+
export declare function revertProposal(store: PromotionStoreFile, procedureId: string, now: number): PromotionProposal | null;
|
|
112
|
+
/** 配方文本 → SKILL.md 的确定性降级模板(LLM 格式转换失败时兜底)。 */
|
|
113
|
+
export declare function renderSkillMarkdownFallback(name: string, procedureText: string): string;
|
|
114
|
+
/** 自动档解锁条件(拍板③):样本、接受率、降格率。 */
|
|
115
|
+
export declare const V3_AUTO_MIN_SAMPLES = 10;
|
|
116
|
+
export declare const V3_AUTO_MIN_ACCEPT_RATE = 0.7;
|
|
117
|
+
export declare const V3_AUTO_MAX_REVERT_RATE = 0.1;
|
|
118
|
+
/** 自动档触发严阈值(拍板④,比手动档 3 更严)。 */
|
|
119
|
+
export declare const V3_AUTO_MIN_ACCESS = 5;
|
|
120
|
+
export declare const V3_AUTO_MIN_SESSIONS = 3;
|
|
121
|
+
export interface ProcedureUsage {
|
|
122
|
+
/** 召回复用过它的 session 集合 */
|
|
123
|
+
sessions: string[];
|
|
124
|
+
/** 复用后回合失败次数(零容忍:自动档要求 0) */
|
|
125
|
+
negativeCount: number;
|
|
126
|
+
}
|
|
127
|
+
export interface ProcedureUsageStoreFile {
|
|
128
|
+
usage: Record<string, ProcedureUsage>;
|
|
129
|
+
}
|
|
130
|
+
export declare function procedureUsagePath(profileMemoryDir: string): string;
|
|
131
|
+
export declare function readProcedureUsage(path: string): ProcedureUsageStoreFile;
|
|
132
|
+
export declare function writeProcedureUsage(path: string, store: ProcedureUsageStoreFile): void;
|
|
133
|
+
export declare function recordProcedureRecall(store: ProcedureUsageStoreFile, procedureId: string, sessionId: string): void;
|
|
134
|
+
export declare function recordProcedureNegative(store: ProcedureUsageStoreFile, procedureId: string): void;
|
|
135
|
+
export interface PromotionMetrics {
|
|
136
|
+
samples: number;
|
|
137
|
+
accepted: number;
|
|
138
|
+
dismissed: number;
|
|
139
|
+
reverted: number;
|
|
140
|
+
acceptRate: number;
|
|
141
|
+
revertRate: number;
|
|
142
|
+
autoEnabled: boolean;
|
|
143
|
+
}
|
|
144
|
+
/** 手动阶段仪表(拍板③):接受率=accepted 家族/已决样本;降格率=reverted/accepted 家族。
|
|
145
|
+
* 任何时刻降格率回升超限即自动退回手动档(autoEnabled 现算,无粘滞)。 */
|
|
146
|
+
export declare function computePromotionMetrics(proposals: readonly PromotionProposal[]): PromotionMetrics;
|
|
147
|
+
/** 自动档严阈值(拍板④):复用 ≥5 + 跨 ≥3 session + 零负反馈。 */
|
|
148
|
+
export declare function qualifiesForAutoPromotion(accessCount: number, usage: ProcedureUsage | undefined): boolean;
|
|
@@ -105,6 +105,12 @@ export interface SearchToolDeps {
|
|
|
105
105
|
contextAfter?: string[];
|
|
106
106
|
}>;
|
|
107
107
|
truncated: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Optional incompleteness note from the backend (e.g. the search process was
|
|
110
|
+
* killed by timeout/output cap). Appended verbatim to the model-visible
|
|
111
|
+
* content — details alone would be silent to the model.
|
|
112
|
+
*/
|
|
113
|
+
note?: string;
|
|
108
114
|
}>;
|
|
109
115
|
/** Resolve relative path to absolute. If omitted, cwd is used. */
|
|
110
116
|
resolvePath?(input: string): string;
|
|
@@ -30,6 +30,8 @@ export declare class TaskOutput {
|
|
|
30
30
|
/** Get captured stderr. In file mode stderr is interleaved with stdout. */
|
|
31
31
|
getStderr(): string;
|
|
32
32
|
get outputFileSize(): number;
|
|
33
|
+
/** Non-null when the last spill-to-disk attempt failed (output only in memory). */
|
|
34
|
+
get spillError(): string | null;
|
|
33
35
|
/**
|
|
34
36
|
* Whether the output file content is fully contained in getStdout().
|
|
35
37
|
* If true, the file can be deleted.
|