qlogicagent 2.24.9 → 2.24.11
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 +4 -0
- package/dist/agent.js +7 -11
- package/dist/cli.js +7 -7
- package/dist/embedded.js +11 -0
- package/dist/index.js +150 -163
- package/dist/orchestration.js +10 -16
- package/dist/skills/builtin/web-research/SKILL.md +8 -5
- package/dist/types/agent/tool-loop/compression-pipeline.d.ts +5 -11
- package/dist/types/agent/tool-loop/stream-error-recovery.d.ts +2 -7
- package/dist/types/agent/tool-loop.d.ts +3 -12
- package/dist/types/agent/types.d.ts +2 -7
- package/dist/types/cli/core-tools/fork-system-prompt.d.ts +13 -21
- package/dist/types/cli/handlers/turn-handler.d.ts +2 -2
- package/dist/types/cli/stdio-acp-protocol-coordinator.d.ts +1 -1
- package/dist/types/embedded/contracts.d.ts +244 -0
- package/dist/types/embedded/default-runtime-ports.d.ts +3 -0
- package/dist/types/embedded/embedded-tool-executor.d.ts +9 -0
- package/dist/types/embedded/index.d.ts +3 -0
- package/dist/types/orchestration/error-handling/retry-loop.d.ts +0 -9
- package/dist/types/orchestration/index.d.ts +2 -4
- package/dist/types/protocol/wire/acp-protocol.d.ts +6 -3
- package/dist/types/protocol/wire/index.d.ts +2 -2
- package/dist/types/protocol/wire/notification-payloads.d.ts +7 -0
- package/dist/types/runtime/config/tunable-defaults.d.ts +0 -3
- package/dist/types/runtime/context/context-compression-strategies.d.ts +0 -108
- package/dist/types/runtime/execution/tool-result-storage.d.ts +0 -11
- package/dist/types/runtime/hooks/context-compression.d.ts +9 -12
- package/dist/types/runtime/infra/file-watcher.d.ts +1 -3
- package/dist/types/runtime/ports/agent-runtime-ports.d.ts +0 -13
- package/dist/types/runtime/ports/model-transport-contracts.d.ts +15 -0
- package/dist/types/runtime/prompt/instruction-loader.d.ts +13 -13
- package/dist/types/runtime/prompt/system-prompt-sections.d.ts +9 -11
- package/package.json +10 -2
- package/dist/types/orchestration/context/context-collapse.d.ts +0 -58
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Repository instruction discovery and model-message projection.
|
|
3
3
|
*
|
|
4
4
|
* Discovers and loads project instruction files following CC's walkup model:
|
|
5
5
|
* 1. Project instructions (INSTRUCTIONS.md, .qlogicagent/INSTRUCTIONS.md,
|
|
@@ -17,9 +17,12 @@
|
|
|
17
17
|
* - TEXT_FILE_EXTENSIONS whitelist
|
|
18
18
|
* - MAX_INCLUDE_DEPTH circular reference prevention
|
|
19
19
|
*
|
|
20
|
-
*
|
|
20
|
+
* Instruction files remain repository/user-owned content. They are projected as a
|
|
21
|
+
* user-role message immediately before the current direct user request; they must
|
|
22
|
+
* never be concatenated into the Host-owned system prompt.
|
|
21
23
|
*/
|
|
22
24
|
import type { HookRegistry } from "../../contracts/hooks.js";
|
|
25
|
+
import type { ChatMessage } from "../../agent/types.js";
|
|
23
26
|
export type InstructionType = "User" | "Project" | "Local";
|
|
24
27
|
export interface InstructionFileInfo {
|
|
25
28
|
path: string;
|
|
@@ -30,10 +33,6 @@ export interface InstructionFileInfo {
|
|
|
30
33
|
/** Glob patterns from frontmatter — file only applies when target path matches */
|
|
31
34
|
globs?: string[];
|
|
32
35
|
}
|
|
33
|
-
export interface LiteralResponseRequirement {
|
|
34
|
-
marker: string;
|
|
35
|
-
placement: "prefix" | "suffix" | "include";
|
|
36
|
-
}
|
|
37
36
|
/**
|
|
38
37
|
* Load all instruction files following CC's discovery order.
|
|
39
38
|
*
|
|
@@ -48,15 +47,18 @@ export interface LiteralResponseRequirement {
|
|
|
48
47
|
* @param hooks - Optional hook registry for instructions.loaded event
|
|
49
48
|
*/
|
|
50
49
|
export declare function loadInstructions(cwd: string, hooks?: HookRegistry): Promise<InstructionFileInfo[]>;
|
|
50
|
+
/** Build one lower-authority user message from the repository instruction files. */
|
|
51
|
+
export declare function buildRepositoryInstructionMessage(files: InstructionFileInfo[]): string;
|
|
51
52
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
53
|
+
* Insert repository context immediately before the current direct user request.
|
|
54
|
+
* The direct request remains the latest user message and therefore wins same-role
|
|
55
|
+
* conflicts. A fresh projection is built for each turn, so Host history is never
|
|
56
|
+
* mutated and the adapter does not create a second transcript store.
|
|
54
57
|
*/
|
|
55
|
-
export declare function
|
|
56
|
-
export declare function extractLiteralResponseRequirements(files: InstructionFileInfo[]): LiteralResponseRequirement[];
|
|
58
|
+
export declare function insertRepositoryInstructionMessage(messages: ChatMessage[], repositoryInstructionMessage?: string): ChatMessage[];
|
|
57
59
|
/**
|
|
58
60
|
* Get conditional rules that match a target file path.
|
|
59
|
-
*
|
|
61
|
+
* Return conditional rules applicable to a target path.
|
|
60
62
|
*/
|
|
61
63
|
export declare function getConditionalRules(cwd: string, targetPath: string): Promise<InstructionFileInfo[]>;
|
|
62
64
|
/**
|
|
@@ -65,5 +67,3 @@ export declare function getConditionalRules(cwd: string, targetPath: string): Pr
|
|
|
65
67
|
* visible on the next turn without depending on a filesystem watcher.
|
|
66
68
|
*/
|
|
67
69
|
export declare function getInstructions(cwd: string, hooks?: HookRegistry): Promise<InstructionFileInfo[]>;
|
|
68
|
-
/** Clear the instruction cache. Called after file changes or compaction. */
|
|
69
|
-
export declare function resetInstructionCache(): void;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Host-owned system prompt sections.
|
|
3
3
|
*
|
|
4
4
|
* Provides a section-based system prompt assembly mechanism:
|
|
5
5
|
* - Memoized sections (computed once, cached until clear)
|
|
6
|
-
* -
|
|
6
|
+
* - Host-provided appendSystemPrompt / customSystemPrompt
|
|
7
7
|
* - Clear on session reset / compact
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Repository files are deliberately excluded from this assembly. They are
|
|
10
|
+
* lower-authority user messages, not Host system policy.
|
|
10
11
|
*/
|
|
11
12
|
type ComputeFn = () => string | null | Promise<string | null>;
|
|
12
13
|
export interface SystemPromptSection {
|
|
@@ -30,11 +31,9 @@ export declare function clearSystemPromptSections(): void;
|
|
|
30
31
|
export interface SystemPromptAssemblyOptions {
|
|
31
32
|
/** Base system prompt (from Gateway config) */
|
|
32
33
|
basePrompt?: string;
|
|
33
|
-
/**
|
|
34
|
-
instructionBlock?: string;
|
|
35
|
-
/** User-provided custom system prompt (replaces base) */
|
|
34
|
+
/** Host-provided custom system prompt (replaces base) */
|
|
36
35
|
customSystemPrompt?: string;
|
|
37
|
-
/**
|
|
36
|
+
/** Host-provided append text (appended after all sections) */
|
|
38
37
|
appendSystemPrompt?: string;
|
|
39
38
|
/** Dynamic sections to resolve */
|
|
40
39
|
sections?: SystemPromptSection[];
|
|
@@ -43,10 +42,9 @@ export interface SystemPromptAssemblyOptions {
|
|
|
43
42
|
* Assemble the final system prompt from all sources.
|
|
44
43
|
*
|
|
45
44
|
* Order:
|
|
46
|
-
* 1.
|
|
47
|
-
* 2.
|
|
48
|
-
* 3.
|
|
49
|
-
* 4. Append system prompt (user-provided suffix)
|
|
45
|
+
* 1. Custom system prompt (replaces base) OR base prompt
|
|
46
|
+
* 2. Resolved Host sections
|
|
47
|
+
* 3. Append system prompt (Host-provided suffix)
|
|
50
48
|
*/
|
|
51
49
|
export declare function assembleSystemPrompt(opts: SystemPromptAssemblyOptions): Promise<string>;
|
|
52
50
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qlogicagent",
|
|
3
|
-
"version": "2.24.
|
|
3
|
+
"version": "2.24.11",
|
|
4
4
|
"packageManager": "pnpm@10.23.0",
|
|
5
5
|
"description": "XiaozhiClaw standard ACP Agent adapter",
|
|
6
6
|
"type": "module",
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
"./orchestration": {
|
|
25
25
|
"types": "./dist/types/orchestration/index.d.ts",
|
|
26
26
|
"default": "./dist/orchestration.js"
|
|
27
|
+
},
|
|
28
|
+
"./embedded": {
|
|
29
|
+
"types": "./dist/types/embedded/index.d.ts",
|
|
30
|
+
"default": "./dist/embedded.js"
|
|
27
31
|
}
|
|
28
32
|
},
|
|
29
33
|
"files": [
|
|
@@ -42,6 +46,9 @@
|
|
|
42
46
|
],
|
|
43
47
|
"orchestration": [
|
|
44
48
|
"./dist/types/orchestration/index.d.ts"
|
|
49
|
+
],
|
|
50
|
+
"embedded": [
|
|
51
|
+
"./dist/types/embedded/index.d.ts"
|
|
45
52
|
]
|
|
46
53
|
}
|
|
47
54
|
},
|
|
@@ -65,6 +72,7 @@
|
|
|
65
72
|
"check:architecture-boundaries": "node scripts/check-architecture-boundaries.mjs",
|
|
66
73
|
"check:provider-core-boundary": "node scripts/check-provider-core-boundary.mjs",
|
|
67
74
|
"check:provider-core-release-sync": "node scripts/check-provider-core-release-sync.mjs",
|
|
75
|
+
"check:embedded-core": "npm run build && node scripts/check-embedded-core.mjs",
|
|
68
76
|
"check:workspace-hygiene": "node scripts/check-workspace-hygiene.mjs",
|
|
69
77
|
"check:workspace-hygiene:strict": "node scripts/check-workspace-hygiene.mjs --strict",
|
|
70
78
|
"check:package-artifact": "npm run build && node scripts/check-package-artifact.mjs",
|
|
@@ -78,7 +86,7 @@
|
|
|
78
86
|
"@agentclientprotocol/sdk": "^0.25.0",
|
|
79
87
|
"@napi-rs/canvas": "0.1.100",
|
|
80
88
|
"@xiaozhiclaw/module-sdk": "0.4.5",
|
|
81
|
-
"@xiaozhiclaw/provider-core": "0.1.
|
|
89
|
+
"@xiaozhiclaw/provider-core": "0.1.43",
|
|
82
90
|
"ajv": "8.20.0",
|
|
83
91
|
"better-sqlite3": "^12.10.0",
|
|
84
92
|
"dotenv": "^17.3.1",
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Context Collapse — staged lightweight context reduction that runs
|
|
3
|
-
* BEFORE autocompact and can drain on 413 BEFORE reactive compact.
|
|
4
|
-
*
|
|
5
|
-
* CC parity: services/contextCollapse/index.ts
|
|
6
|
-
*
|
|
7
|
-
* Architecture:
|
|
8
|
-
* 1. applyCollapsesIfNeeded() — runs every iteration, projects the
|
|
9
|
-
* collapsed view and maybe commits more collapses (by summarizing
|
|
10
|
-
* old tool-result groups into compact summaries).
|
|
11
|
-
* 2. recoverFromOverflow() — drain all staged collapses on a real
|
|
12
|
-
* API 413. If it can free enough context, the retry may succeed
|
|
13
|
-
* without reactive compact (which is heavier and destroys more
|
|
14
|
-
* context).
|
|
15
|
-
*
|
|
16
|
-
* Collapses are ordered "stages" — oldest first. Each stage replaces
|
|
17
|
-
* a contiguous run of old messages with a single summary line.
|
|
18
|
-
*/
|
|
19
|
-
export interface CollapseStage {
|
|
20
|
-
/** UUID of the stage (for dedup and ordering). */
|
|
21
|
-
id: string;
|
|
22
|
-
/** Index range [start, end) in the original message array. */
|
|
23
|
-
range: [number, number];
|
|
24
|
-
/** Summary text that replaces the range. */
|
|
25
|
-
summary: string;
|
|
26
|
-
/** Whether this stage has been committed (applied to messages). */
|
|
27
|
-
committed: boolean;
|
|
28
|
-
}
|
|
29
|
-
export interface CollapseStore {
|
|
30
|
-
stages: CollapseStage[];
|
|
31
|
-
}
|
|
32
|
-
export declare function createCollapseStore(): CollapseStore;
|
|
33
|
-
/**
|
|
34
|
-
* Evaluate whether new collapses should be staged.
|
|
35
|
-
*
|
|
36
|
-
* Heuristic: if the conversation has > thresholdMessages non-system messages,
|
|
37
|
-
* group old tool-result runs into collapse stages.
|
|
38
|
-
*/
|
|
39
|
-
export declare function applyCollapsesIfNeeded<T extends {
|
|
40
|
-
role: string;
|
|
41
|
-
content?: string | unknown;
|
|
42
|
-
}>(messages: T[], store: CollapseStore, opts?: {
|
|
43
|
-
thresholdMessages?: number;
|
|
44
|
-
}): {
|
|
45
|
-
messages: T[];
|
|
46
|
-
stagedCount: number;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Drain all staged (uncommitted) collapses — called on 413 recovery.
|
|
50
|
-
* Commits every pending stage and returns the collapsed messages.
|
|
51
|
-
*/
|
|
52
|
-
export declare function recoverFromOverflow<T extends {
|
|
53
|
-
role: string;
|
|
54
|
-
content?: string | unknown;
|
|
55
|
-
}>(messages: T[], store: CollapseStore): {
|
|
56
|
-
messages: T[];
|
|
57
|
-
committed: number;
|
|
58
|
-
};
|