qlogicagent 2.18.1 → 2.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.js +25 -21
- package/dist/cli.js +1 -1
- package/dist/index.js +445 -437
- package/dist/protocol.js +1 -1
- package/dist/skills/mcp/astraclaw-native-mcp-server.js +5 -5
- 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/handlers/workflow-handler.d.ts +1 -0
- package/dist/types/orchestration/agent-instance.d.ts +7 -1
- package/dist/types/orchestration/agent-roster.d.ts +12 -0
- package/dist/types/orchestration/dag-scheduler.d.ts +3 -0
- package/dist/types/orchestration/delegation-coordinator.d.ts +6 -1
- package/dist/types/orchestration/goal-loop-coordinator.d.ts +4 -1
- package/dist/types/orchestration/goal-mode-adapters.d.ts +3 -1
- package/dist/types/orchestration/goal-run-types.d.ts +2 -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/workflow/budget-permission-gate.d.ts +9 -0
- package/dist/types/orchestration/workflow/node-schema.d.ts +4 -1
- package/dist/types/orchestration/workflow/workflow-trigger.d.ts +5 -1
- 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/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/infra/acp-protocol-adapter.d.ts +9 -1
- package/dist/types/runtime/infra/external-agent-pool.d.ts +12 -0
- package/dist/types/runtime/ports/agent-runtime-ports.d.ts +4 -1
- package/dist/types/runtime/prompt/environment-context.d.ts +10 -0
- package/dist/types/runtime/prompt/fresh-workspace-evidence.d.ts +0 -2
- package/dist/types/runtime/session/inbound-upload-persistence.d.ts +8 -0
- package/dist/types/runtime/session/session-resource-key.d.ts +28 -0
- package/dist/types/runtime/session/session-transcript-store.d.ts +2 -0
- package/dist/types/runtime/session/session-types.d.ts +29 -0
- package/package.json +4 -3
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* Turn-lifecycle events relayed to the Control UI WebSocket.
|
|
14
14
|
* These are the "chat session" events that every UI client needs.
|
|
15
15
|
*/
|
|
16
|
-
export declare const AGENT_WS_EVENT_NAMES: readonly ["turn.start", "turn.delta", "turn.end", "turn.error", "turn.recovery", "turn.file_changes", "turn.tool_call", "turn.tool_result", "turn.tool_blocked", "turn.reasoning_delta", "turn.approval_request", "turn.skill_instruction", "turn.ask_user", "turn.media_result", "turn.media_progress", "turn.media_usage", "turn.media_capability_check", "turn.plan_update", "turn.suggestions", "turn.sidechain_started", "turn.subagent_started", "turn.subagent_delta", "turn.subagent_ended", "turn.sidechain_completed", "turn.task_updated", "turn.todos_updated", "turn.exec_progress", "turn.progress", "turn.tool_use_summary", "turn.tool_selection_policy", "turn.lifecycle", "turn.document_maintenance", "turn.artifact_contract", "turn.usage_update", "team.member.notification", "session.info", "session.recovery_pending", "memory.updated", "skills.updated", "pet.soul_ready", "pet.reaction", "pet.growth", "pet.state", "pet.confirm", "pet.asset.updated", "system.activity", "workflow.created", "workflow.updated", "workflow.deleted", "workflow.runStarted", "workflow.runCompleted", "workflow.runFailed", "workflow.nodeStatus", "workflow.triggerDropped", "workflow.alert", "workflow.approvalRequested"];
|
|
16
|
+
export declare const AGENT_WS_EVENT_NAMES: readonly ["turn.start", "turn.delta", "turn.end", "turn.error", "turn.recovery", "turn.file_changes", "turn.tool_call", "turn.tool_result", "turn.tool_blocked", "turn.reasoning_delta", "turn.approval_request", "turn.skill_instruction", "turn.ask_user", "turn.media_result", "turn.media_progress", "turn.media_usage", "turn.media_capability_check", "turn.plan_update", "turn.suggestions", "turn.sidechain_started", "turn.subagent_started", "turn.subagent_delta", "turn.subagent_ended", "turn.sidechain_completed", "turn.task_updated", "turn.todos_updated", "turn.exec_progress", "turn.progress", "turn.tool_use_summary", "turn.tool_selection_policy", "turn.lifecycle", "turn.document_maintenance", "turn.artifact_contract", "turn.usage_update", "team.member.notification", "session.info", "session.recovery_pending", "memory.updated", "skills.updated", "pet.soul_ready", "pet.reaction", "pet.growth", "pet.state", "pet.confirm", "pet.asset.updated", "system.activity", "workflow.created", "workflow.updated", "workflow.deleted", "workflow.runStarted", "workflow.runCompleted", "workflow.runFailed", "workflow.nodeStatus", "workflow.triggerDropped", "workflow.alert", "workflow.approvalRequested", "workflow.approvalTimedOut"];
|
|
17
17
|
/**
|
|
18
18
|
* Agent Team events (Solo Mode, Product Mode, Plan lifecycle).
|
|
19
19
|
* Relayed to the UI's team/orchestration panel.
|
|
@@ -23,7 +23,7 @@ export declare const AGENT_TEAM_WS_EVENT_NAMES: readonly ["solo.progress", "solo
|
|
|
23
23
|
* All agent notifications that Gateway should relay to WS clients.
|
|
24
24
|
* Union of session events + team events.
|
|
25
25
|
*/
|
|
26
|
-
export declare const ALL_AGENT_WS_EVENT_NAMES: readonly ["turn.start", "turn.delta", "turn.end", "turn.error", "turn.recovery", "turn.file_changes", "turn.tool_call", "turn.tool_result", "turn.tool_blocked", "turn.reasoning_delta", "turn.approval_request", "turn.skill_instruction", "turn.ask_user", "turn.media_result", "turn.media_progress", "turn.media_usage", "turn.media_capability_check", "turn.plan_update", "turn.suggestions", "turn.sidechain_started", "turn.subagent_started", "turn.subagent_delta", "turn.subagent_ended", "turn.sidechain_completed", "turn.task_updated", "turn.todos_updated", "turn.exec_progress", "turn.progress", "turn.tool_use_summary", "turn.tool_selection_policy", "turn.lifecycle", "turn.document_maintenance", "turn.artifact_contract", "turn.usage_update", "team.member.notification", "session.info", "session.recovery_pending", "memory.updated", "skills.updated", "pet.soul_ready", "pet.reaction", "pet.growth", "pet.state", "pet.confirm", "pet.asset.updated", "system.activity", "workflow.created", "workflow.updated", "workflow.deleted", "workflow.runStarted", "workflow.runCompleted", "workflow.runFailed", "workflow.nodeStatus", "workflow.triggerDropped", "workflow.alert", "workflow.approvalRequested", "solo.progress", "solo.specProgress", "solo.agentDelta", "solo.agentActivity", "solo.agentUsage", "solo.evaluation", "product.taskStarted", "product.taskOutput", "product.members", "product.agentActivity", "product.taskCompleted", "product.taskFailed", "product.budgetUpdate", "product.budgetWarning", "product.checkpointed", "product.completed", "product.dagTopology", "plan.interrupted", "goal.run_state_changed", "goal.phase_boundary", "goal.goal_edited", "goal.message_queued", "goal.acceptance_updated"];
|
|
26
|
+
export declare const ALL_AGENT_WS_EVENT_NAMES: readonly ["turn.start", "turn.delta", "turn.end", "turn.error", "turn.recovery", "turn.file_changes", "turn.tool_call", "turn.tool_result", "turn.tool_blocked", "turn.reasoning_delta", "turn.approval_request", "turn.skill_instruction", "turn.ask_user", "turn.media_result", "turn.media_progress", "turn.media_usage", "turn.media_capability_check", "turn.plan_update", "turn.suggestions", "turn.sidechain_started", "turn.subagent_started", "turn.subagent_delta", "turn.subagent_ended", "turn.sidechain_completed", "turn.task_updated", "turn.todos_updated", "turn.exec_progress", "turn.progress", "turn.tool_use_summary", "turn.tool_selection_policy", "turn.lifecycle", "turn.document_maintenance", "turn.artifact_contract", "turn.usage_update", "team.member.notification", "session.info", "session.recovery_pending", "memory.updated", "skills.updated", "pet.soul_ready", "pet.reaction", "pet.growth", "pet.state", "pet.confirm", "pet.asset.updated", "system.activity", "workflow.created", "workflow.updated", "workflow.deleted", "workflow.runStarted", "workflow.runCompleted", "workflow.runFailed", "workflow.nodeStatus", "workflow.triggerDropped", "workflow.alert", "workflow.approvalRequested", "workflow.approvalTimedOut", "solo.progress", "solo.specProgress", "solo.agentDelta", "solo.agentActivity", "solo.agentUsage", "solo.evaluation", "product.taskStarted", "product.taskOutput", "product.members", "product.agentActivity", "product.taskCompleted", "product.taskFailed", "product.budgetUpdate", "product.budgetWarning", "product.checkpointed", "product.completed", "product.dagTopology", "plan.interrupted", "goal.run_state_changed", "goal.phase_boundary", "goal.goal_edited", "goal.message_queued", "goal.acceptance_updated"];
|
|
27
27
|
/** Type-level event name for session events. */
|
|
28
28
|
export type AgentWsEventName = (typeof AGENT_WS_EVENT_NAMES)[number];
|
|
29
29
|
/** Type-level event name for team events. */
|
|
@@ -28,6 +28,8 @@ export interface StreamingToolExecutorConfig {
|
|
|
28
28
|
toolInvoker: ToolInvoker;
|
|
29
29
|
hooks?: HookRegistry;
|
|
30
30
|
sessionId: string;
|
|
31
|
+
/** Turn workspace/cwd - routes oversized tool-result spillover to the session data dir. */
|
|
32
|
+
projectRoot?: string;
|
|
31
33
|
turnId: string;
|
|
32
34
|
log: AgentLogger;
|
|
33
35
|
signal?: AbortSignal;
|
|
@@ -48,7 +48,7 @@ export declare function generatePreview(content: string, maxBytes: number): {
|
|
|
48
48
|
preview: string;
|
|
49
49
|
hasMore: boolean;
|
|
50
50
|
};
|
|
51
|
-
export declare function persistToolResult(content: string, toolCallId: string, sessionId: string): Promise<PersistedToolResult | null>;
|
|
51
|
+
export declare function persistToolResult(content: string, toolCallId: string, sessionId: string, projectRoot: string | undefined): Promise<PersistedToolResult | null>;
|
|
52
52
|
/**
|
|
53
53
|
* Build a reference message for large tool results (CC buildLargeToolResultMessage parity).
|
|
54
54
|
*/
|
|
@@ -58,7 +58,7 @@ export declare function buildLargeToolResultMessage(result: PersistedToolResult)
|
|
|
58
58
|
* Falls back to hard truncation if persistence fails.
|
|
59
59
|
* Called at tool execution time in streaming-tool-executor.ts.
|
|
60
60
|
*/
|
|
61
|
-
export declare function maybePersistLargeToolResult(content: string, toolCallId: string, sessionId: string, threshold?: number): Promise<string>;
|
|
61
|
+
export declare function maybePersistLargeToolResult(content: string, toolCallId: string, sessionId: string, projectRoot: string | undefined, threshold?: number): Promise<string>;
|
|
62
62
|
interface MessageLike {
|
|
63
63
|
role: string;
|
|
64
64
|
content?: string | unknown;
|
|
@@ -78,10 +78,12 @@ interface MessageLike {
|
|
|
78
78
|
* replaced later (would break prompt cache).
|
|
79
79
|
*
|
|
80
80
|
* @param state — MUTATED in place (seenIds and replacements updated)
|
|
81
|
-
* @returns messages with replacements applied + count of new replacements
|
|
81
|
+
* @returns messages with replacements applied + count of new replacements +
|
|
82
|
+
* total original bytes spilled this pass (so the caller can surface it)
|
|
82
83
|
*/
|
|
83
|
-
export declare function enforceToolResultBudget(messages: MessageLike[], state: ContentReplacementState, sessionId: string, limit?: number): Promise<{
|
|
84
|
+
export declare function enforceToolResultBudget(messages: MessageLike[], state: ContentReplacementState, sessionId: string, projectRoot: string | undefined, limit?: number): Promise<{
|
|
84
85
|
messages: MessageLike[];
|
|
85
86
|
newlyReplacedCount: number;
|
|
87
|
+
newlyPersistedBytes: number;
|
|
86
88
|
}>;
|
|
87
89
|
export {};
|
|
@@ -16,6 +16,12 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import type { ChildProcess } from "node:child_process";
|
|
18
18
|
import type { AcpInitializeResult, AcpSessionResult, AcpPromptResponse, McpServerConfig } from "../../protocol/wire/acp-agent-management.js";
|
|
19
|
+
interface AcpPromptTimeoutOptions {
|
|
20
|
+
timeoutMs?: number;
|
|
21
|
+
getLastActivityAt?: () => number | undefined;
|
|
22
|
+
checkIntervalMs?: number;
|
|
23
|
+
}
|
|
24
|
+
type AcpPromptTimeoutInput = number | AcpPromptTimeoutOptions;
|
|
19
25
|
/**
|
|
20
26
|
* Handler for agent→host requests (fs, terminal, permission, elicitation).
|
|
21
27
|
* Host implementations should implement the methods they support. This is intentionally loose
|
|
@@ -137,6 +143,7 @@ export declare class AcpProtocolAdapter {
|
|
|
137
143
|
private requireConn;
|
|
138
144
|
/** Race a connection call against a timeout; optionally run a side effect (e.g. cancel) on timeout. */
|
|
139
145
|
private withTimeout;
|
|
146
|
+
private withActivityTimeout;
|
|
140
147
|
/**
|
|
141
148
|
* Perform the ACP initialize handshake. Sends standard clientInfo + clientCapabilities plus the
|
|
142
149
|
* qlogicagent extension capability (forwarded verbatim by the SDK).
|
|
@@ -170,7 +177,7 @@ export declare class AcpProtocolAdapter {
|
|
|
170
177
|
* notifications during execution; the response carries only { stopReason, usage? }. On timeout the
|
|
171
178
|
* turn is cancelled (session/cancel) so the agent stops cleanly.
|
|
172
179
|
*/
|
|
173
|
-
sendPrompt(_child: ChildProcess, sessionId: string, content: string,
|
|
180
|
+
sendPrompt(_child: ChildProcess, sessionId: string, content: string, timeoutInput?: AcpPromptTimeoutInput): Promise<AcpPromptResponse>;
|
|
174
181
|
/**
|
|
175
182
|
* Resume an existing ACP session (session/load — replays history via notifications).
|
|
176
183
|
* Only valid when the agent advertised the loadSession capability.
|
|
@@ -190,3 +197,4 @@ export declare class AcpProtocolAdapter {
|
|
|
190
197
|
*/
|
|
191
198
|
static translateNotification(method: string, params: unknown): TranslatedNotification | null;
|
|
192
199
|
}
|
|
200
|
+
export {};
|
|
@@ -44,6 +44,18 @@ export declare function poolKey(agentId: string, cwd: string, sessionId?: string
|
|
|
44
44
|
export declare function getAlivePooledAgent(key: string): PooledAgentEntry | undefined;
|
|
45
45
|
/** Register a freshly-spawned entry, evicting any stale same-key entry and enforcing MAX_POOL. */
|
|
46
46
|
export declare function registerPooledAgent(key: string, entry: PooledAgentEntry): void;
|
|
47
|
+
/**
|
|
48
|
+
* Move a live pooled entry from one key to another without disposing it — the same ACP process keeps
|
|
49
|
+
* running, only its pool key changes. Disposes any stale occupant of the destination key. Returns the
|
|
50
|
+
* moved entry, or undefined if `fromKey` has no live entry (a dead one is reaped). No-op returning the
|
|
51
|
+
* existing entry when the keys are equal.
|
|
52
|
+
*
|
|
53
|
+
* Merge note (session-identity-alignment): the second caller this was extracted for — the transient→native
|
|
54
|
+
* X→Y re-key after a native agent reported its own id — is GONE. Under canonical-id-stable, the frontend
|
|
55
|
+
* never converges to Y, so the pool key never changes mid-conversation; the sole caller is adoptWarmedAgent
|
|
56
|
+
* (warm → real session key). Kept as the general re-key primitive.
|
|
57
|
+
*/
|
|
58
|
+
export declare function rekeyPooledAgent(fromKey: string, toKey: string): PooledAgentEntry | undefined;
|
|
47
59
|
/**
|
|
48
60
|
* Re-key a pre-warmed entry (spawned before a session existed, under WARM_SESSION) onto the real
|
|
49
61
|
* session key, so the first turn adopts the warmed process and skips the cold start. Does not
|
|
@@ -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: {
|
|
@@ -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).
|
|
@@ -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
|
/**
|
|
@@ -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>;
|
|
@@ -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;
|
|
@@ -3,6 +3,8 @@ 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
|
}
|
|
7
9
|
export declare function appendMessage(sessionId: string, message: ChatMessage, projectRoot: string, turnId?: string, metadata?: {
|
|
8
10
|
usage?: TokenUsage;
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qlogicagent",
|
|
3
|
-
"version": "2.18.
|
|
3
|
+
"version": "2.18.2",
|
|
4
4
|
"description": "XiaozhiClaw Agent CLI — subprocess architecture (JSON-RPC over stdio)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -70,11 +70,12 @@
|
|
|
70
70
|
"start": "node dist/cli.js",
|
|
71
71
|
"test": "vitest run",
|
|
72
72
|
"test:replay": "vitest run benchmarks/transcript-replay",
|
|
73
|
-
"check": "pnpm run check:encoding-corruption && tsc --noEmit && pnpm test && pnpm run check:architecture-boundaries && pnpm run check:provider-core-boundary && pnpm run check:provider-core-release-sync && pnpm run check:pet-core-boundary && pnpm run check:workspace-hygiene && pnpm run check:package-artifact",
|
|
73
|
+
"check": "pnpm run check:encoding-corruption && pnpm run check:mechanical-rules && tsc --noEmit && pnpm test && pnpm run check:architecture-boundaries && pnpm run check:provider-core-boundary && pnpm run check:provider-core-release-sync && pnpm run check:pet-core-boundary && pnpm run check:workspace-hygiene && pnpm run check:package-artifact",
|
|
74
74
|
"test:watch": "vitest",
|
|
75
75
|
"benchmark:hermes-superiority": "tsx benchmarks/hermes-superiority/runner.ts",
|
|
76
76
|
"lint": "oxlint .",
|
|
77
77
|
"check:encoding-corruption": "node scripts/check-encoding-corruption.mjs",
|
|
78
|
+
"check:mechanical-rules": "node scripts/check-mechanical-rules.mjs",
|
|
78
79
|
"check:architecture-boundaries": "node scripts/check-architecture-boundaries.mjs",
|
|
79
80
|
"check:provider-core-boundary": "node scripts/check-provider-core-boundary.mjs",
|
|
80
81
|
"check:provider-core-release-sync": "node scripts/check-provider-core-release-sync.mjs",
|
|
@@ -94,7 +95,7 @@
|
|
|
94
95
|
"@agentclientprotocol/sdk": "^0.25.0",
|
|
95
96
|
"@napi-rs/canvas": "0.1.100",
|
|
96
97
|
"@xiaozhiclaw/pet-core": "0.1.3",
|
|
97
|
-
"@xiaozhiclaw/provider-core": "^0.1.
|
|
98
|
+
"@xiaozhiclaw/provider-core": "^0.1.21",
|
|
98
99
|
"better-sqlite3": "^12.10.0",
|
|
99
100
|
"dotenv": "^17.3.1",
|
|
100
101
|
"ioredis": "^5.11.1",
|