qlogicagent 2.16.5 → 2.16.7
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 +20 -20
- package/dist/cli.js +375 -370
- package/dist/index.js +374 -369
- package/dist/orchestration.js +10 -10
- package/dist/protocol.js +1 -1
- package/dist/types/agent/tool-loop/loop-helpers.d.ts +1 -4
- package/dist/types/agent/tool-loop/pseudo-tool-output.d.ts +8 -0
- package/dist/types/agent/tool-loop/tool-failure-policy.d.ts +0 -1
- package/dist/types/agent/tool-loop/tool-guardrails.d.ts +24 -0
- package/dist/types/agent/tool-loop/tool-result-classification.d.ts +10 -0
- package/dist/types/cli/acp-commands.d.ts +1 -2
- package/dist/types/cli/base-tool-bootstrap.d.ts +1 -0
- package/dist/types/cli/handlers/files-handler.d.ts +5 -0
- package/dist/types/cli/handlers/message-feedback-handler.d.ts +29 -0
- package/dist/types/cli/handlers/pinned-skill-context.d.ts +2 -0
- package/dist/types/cli/handlers/project-handler.d.ts +1 -0
- package/dist/types/cli/handlers/turn-baseline-handler.d.ts +8 -0
- package/dist/types/cli/handlers/turn-handler.d.ts +5 -0
- package/dist/types/cli/handlers/working-materials-handler.d.ts +9 -0
- package/dist/types/cli/idle-dream-coordinator.d.ts +6 -0
- package/dist/types/cli/mcp-bootstrap.d.ts +1 -0
- package/dist/types/cli/rpc-registry.d.ts +6 -0
- package/dist/types/cli/skill-invocation-service.d.ts +2 -0
- package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +1 -0
- package/dist/types/cli/stdio-runtime-bootstrap.d.ts +1 -0
- package/dist/types/cli/tool-bootstrap-core-registration.d.ts +1 -0
- package/dist/types/cli/tool-bootstrap.d.ts +1 -0
- package/dist/types/protocol/methods.d.ts +24 -0
- package/dist/types/protocol/wire/agent-events.d.ts +2 -2
- package/dist/types/protocol/wire/gateway-rpc.d.ts +160 -0
- package/dist/types/protocol/wire/notification-payloads.d.ts +27 -0
- package/dist/types/runtime/execution/untrusted-tool-result.d.ts +2 -0
- package/dist/types/runtime/infra/feedback-distillation-worker.d.ts +20 -0
- package/dist/types/runtime/infra/feedback-distillation.d.ts +30 -0
- package/dist/types/runtime/infra/feedback-event-store.d.ts +160 -0
- package/dist/types/runtime/infra/feedback-outbox.d.ts +26 -0
- package/dist/types/runtime/infra/feedback-redaction.d.ts +71 -0
- package/dist/types/runtime/infra/feedback-upload-client.d.ts +39 -0
- package/dist/types/runtime/infra/feedback-upload-worker.d.ts +11 -0
- package/dist/types/runtime/infra/skill-resolver.d.ts +8 -2
- package/dist/types/runtime/infra/turn-baseline-store.d.ts +102 -0
- package/dist/types/runtime/infra/turn-telemetry-store.d.ts +59 -0
- package/dist/types/runtime/infra/working-materials-store.d.ts +35 -0
- package/dist/types/runtime/ports/memory-provider.d.ts +6 -0
- package/dist/types/runtime/ports/tool-contracts.d.ts +1 -0
- package/dist/types/runtime/prompt/fresh-workspace-evidence.d.ts +14 -0
- package/dist/types/skills/mcp/mcp-manager.d.ts +31 -2
- package/dist/types/skills/memory/local-memory-provider.d.ts +3 -3
- package/dist/types/skills/memory/local-store-records.d.ts +18 -1
- package/dist/types/skills/memory/local-store.d.ts +8 -195
- package/dist/types/skills/memory/memory-consolidation.d.ts +14 -0
- package/dist/types/skills/memory/sqlite-memory-schema.d.ts +1 -1
- package/dist/types/skills/skill-system/skill-bundles.d.ts +8 -0
- package/dist/types/skills/skill-system/skill-frontmatter.d.ts +1 -5
- package/dist/types/skills/skill-system/skill-lifecycle.d.ts +13 -1
- package/dist/types/skills/skill-system/skill-preprocessing.d.ts +11 -0
- package/dist/types/skills/skill-system/skill-types.d.ts +0 -75
- package/dist/types/skills/skill-system/skill-validation.d.ts +1 -0
- package/dist/types/skills/tools/skill-tool.d.ts +3 -2
- package/dist/vendor/hatch-pet/LICENSE.txt +201 -201
- package/dist/vendor/hatch-pet/NOTICE.md +25 -25
- package/dist/vendor/hatch-pet/references/animation-rows.md +29 -29
- package/dist/vendor/hatch-pet/references/codex-pet-contract.md +35 -35
- package/dist/vendor/hatch-pet/references/qa-rubric.md +66 -66
- package/dist/vendor/hatch-pet/scripts/compose_atlas.py +169 -169
- package/dist/vendor/hatch-pet/scripts/derive_running_left_from_running_right.py +150 -150
- package/dist/vendor/hatch-pet/scripts/extract_strip_frames.py +408 -408
- package/dist/vendor/hatch-pet/scripts/inspect_frames.py +256 -256
- package/dist/vendor/hatch-pet/scripts/make_contact_sheet.py +96 -96
- package/dist/vendor/hatch-pet/scripts/prepare_pet_run.py +834 -834
- package/dist/vendor/hatch-pet/scripts/render_animation_previews.py +78 -78
- package/dist/vendor/hatch-pet/scripts/validate_atlas.py +157 -157
- package/package.json +3 -2
- package/dist/types/skills/skill-system/skill-source.d.ts +0 -38
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type AgentRpcError, type AgentRpcRequest } from "../../protocol/wire/index.js";
|
|
2
|
+
export interface WorkingMaterialsHandlerHost {
|
|
3
|
+
sendResponse(id: string | number, result?: unknown, error?: AgentRpcError): void;
|
|
4
|
+
}
|
|
5
|
+
export declare function handleWorkingMaterialsGet(this: WorkingMaterialsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
6
|
+
export declare function handleWorkingMaterialsReplace(this: WorkingMaterialsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
7
|
+
export declare function handleWorkingMaterialsUpsert(this: WorkingMaterialsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
8
|
+
export declare function handleWorkingMaterialsRemove(this: WorkingMaterialsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
9
|
+
export declare function handleWorkingMaterialsReorder(this: WorkingMaterialsHandlerHost, msg: AgentRpcRequest): Promise<void>;
|
|
@@ -28,6 +28,12 @@ export interface IdleDreamCoordinatorOptions {
|
|
|
28
28
|
sessionId: string;
|
|
29
29
|
}>>;
|
|
30
30
|
runDream(message: AgentRpcRequest): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Optional idle-time hook run on every idle fire BEFORE the dream gates (so it is not blocked by
|
|
33
|
+
* dream cooldown / missing LLM transport). Used for the feedback redaction+upload sweep
|
|
34
|
+
* (design §9 item 5). Errors are swallowed so a sweep failure never breaks dream.
|
|
35
|
+
*/
|
|
36
|
+
onIdle?(): Promise<void>;
|
|
31
37
|
}
|
|
32
38
|
export declare class IdleDreamCoordinator {
|
|
33
39
|
private readonly options;
|
|
@@ -13,6 +13,7 @@ export interface McpBootstrapDeps {
|
|
|
13
13
|
}
|
|
14
14
|
export declare const mcpToolRegistrationModule: import("../runtime/ports/tool-contracts.js").ToolRegistrationModule<McpBootstrapDeps>;
|
|
15
15
|
export declare function configureMcpBootstrap(deps: McpBootstrapDeps): void;
|
|
16
|
+
export declare function readUserMcpConfig(pathService: PathService, log?: RuntimeLogger): unknown;
|
|
16
17
|
export declare function buildMcpBootstrapEntries(params: {
|
|
17
18
|
turnMcpConfig?: unknown;
|
|
18
19
|
userMcpConfig?: unknown;
|
|
@@ -12,7 +12,10 @@ import { type ProjectHandlerHost } from "./handlers/project-handler.js";
|
|
|
12
12
|
import { type SessionHandlerHost } from "./handlers/session-handler.js";
|
|
13
13
|
import { type SettingsHandlerHost } from "./handlers/settings-handler.js";
|
|
14
14
|
import { type SkillsHandlerHost } from "./handlers/skills-handler.js";
|
|
15
|
+
import { type TurnBaselineHandlerHost } from "./handlers/turn-baseline-handler.js";
|
|
16
|
+
import { type MessageFeedbackHandlerHost } from "./handlers/message-feedback-handler.js";
|
|
15
17
|
import { type TurnControlHandlerHost } from "./handlers/turn-handler.js";
|
|
18
|
+
import { type WorkingMaterialsHandlerHost } from "./handlers/working-materials-handler.js";
|
|
16
19
|
import { type DreamHandlerHost } from "./handlers/dream-handler.js";
|
|
17
20
|
import type { MultiAgentHandlerHost } from "./multi-agent-handler-host.js";
|
|
18
21
|
export type RpcMethodHandler = (msg: AgentRpcRequest) => void;
|
|
@@ -48,6 +51,9 @@ export interface RpcHandlerHosts {
|
|
|
48
51
|
settings: SettingsHandlerHost;
|
|
49
52
|
dream: DreamHandlerHost;
|
|
50
53
|
turn: TurnControlHandlerHost;
|
|
54
|
+
turnBaseline: TurnBaselineHandlerHost;
|
|
55
|
+
messageFeedback: MessageFeedbackHandlerHost;
|
|
56
|
+
workingMaterials: WorkingMaterialsHandlerHost;
|
|
51
57
|
/** agents/solo/product are served by the multi-agent sub-host. */
|
|
52
58
|
multiAgent: MultiAgentHandlerHost;
|
|
53
59
|
/**
|
|
@@ -2,6 +2,7 @@ import type { LLMRequest } from "../agent/types.js";
|
|
|
2
2
|
import type { ModelPurpose } from "../runtime/infra/model-registry.js";
|
|
3
3
|
import type { RpcHandlerHosts } from "./rpc-registry.js";
|
|
4
4
|
type DirectStdioRpcHost = RpcHandlerHosts["config"] & RpcHandlerHosts["control"] & RpcHandlerHosts["files"] & RpcHandlerHosts["skills"] & RpcHandlerHosts["project"] & RpcHandlerHosts["community"] & RpcHandlerHosts["settings"] & RpcHandlerHosts["petConfirm"] & {
|
|
5
|
+
currentTurnId?: string;
|
|
5
6
|
readonly multiAgentHandlerHost: RpcHandlerHosts["multiAgent"];
|
|
6
7
|
readonly workflowHandlerHost: RpcHandlerHosts["workflow"];
|
|
7
8
|
};
|
|
@@ -6,6 +6,7 @@ export interface StdioRuntimeBootstrapDeps {
|
|
|
6
6
|
verbose: boolean;
|
|
7
7
|
getActiveProjectRoot(): string;
|
|
8
8
|
getCurrentSessionId?(): string | undefined;
|
|
9
|
+
getCurrentTurnId?(): string | undefined;
|
|
9
10
|
resolveClientForPurpose(purpose: ModelPurpose): {
|
|
10
11
|
transport: LLMTransport;
|
|
11
12
|
apiKey: string;
|
|
@@ -11,6 +11,7 @@ export interface LocalCoreToolRegistrationContext {
|
|
|
11
11
|
backgroundTaskRuntime: BackgroundTaskManager | null;
|
|
12
12
|
getBackgroundTaskRuntime?: () => BackgroundTaskManager | null;
|
|
13
13
|
getTaskScopeKey?: () => string | undefined;
|
|
14
|
+
getCurrentTurnId?: () => string | undefined;
|
|
14
15
|
askUserCallback: ((questions: AskUserQuestion[]) => Promise<Record<string, string> | null>) | null;
|
|
15
16
|
getAskUserCallback?: () => ((questions: AskUserQuestion[]) => Promise<Record<string, string> | null>) | null;
|
|
16
17
|
onExecProgress?: (progress: ExecProgress) => void;
|
|
@@ -732,6 +732,14 @@ export type FilesCreateParams = GatewayRpcMethodMap["files.create"]["params"];
|
|
|
732
732
|
export type FilesCreateResult = GatewayRpcMethodMap["files.create"]["result"];
|
|
733
733
|
export type FilesRenameParams = GatewayRpcMethodMap["files.rename"]["params"];
|
|
734
734
|
export type FilesRenameResult = GatewayRpcMethodMap["files.rename"]["result"];
|
|
735
|
+
export type FilesMoveParams = GatewayRpcMethodMap["files.move"]["params"];
|
|
736
|
+
export type FilesMoveResult = GatewayRpcMethodMap["files.move"]["result"];
|
|
737
|
+
export type FilesCopyParams = GatewayRpcMethodMap["files.copy"]["params"];
|
|
738
|
+
export type FilesCopyResult = GatewayRpcMethodMap["files.copy"]["result"];
|
|
739
|
+
export type FilesSearchParams = GatewayRpcMethodMap["files.search"]["params"];
|
|
740
|
+
export type FilesSearchResult = GatewayRpcMethodMap["files.search"]["result"];
|
|
741
|
+
export type FilesUndoOperationParams = GatewayRpcMethodMap["files.undoOperation"]["params"];
|
|
742
|
+
export type FilesUndoOperationResult = GatewayRpcMethodMap["files.undoOperation"]["result"];
|
|
735
743
|
export type FilesDeleteParams = GatewayRpcMethodMap["files.delete"]["params"];
|
|
736
744
|
export type FilesDeleteResult = GatewayRpcMethodMap["files.delete"]["result"];
|
|
737
745
|
export type FilesGitStatusParams = GatewayRpcMethodMap["files.gitStatus"]["params"];
|
|
@@ -1144,6 +1152,22 @@ export interface RpcMethodMap {
|
|
|
1144
1152
|
params: FilesRenameParams;
|
|
1145
1153
|
result: FilesRenameResult;
|
|
1146
1154
|
};
|
|
1155
|
+
"files.move": {
|
|
1156
|
+
params: FilesMoveParams;
|
|
1157
|
+
result: FilesMoveResult;
|
|
1158
|
+
};
|
|
1159
|
+
"files.copy": {
|
|
1160
|
+
params: FilesCopyParams;
|
|
1161
|
+
result: FilesCopyResult;
|
|
1162
|
+
};
|
|
1163
|
+
"files.search": {
|
|
1164
|
+
params: FilesSearchParams;
|
|
1165
|
+
result: FilesSearchResult;
|
|
1166
|
+
};
|
|
1167
|
+
"files.undoOperation": {
|
|
1168
|
+
params: FilesUndoOperationParams;
|
|
1169
|
+
result: FilesUndoOperationResult;
|
|
1170
|
+
};
|
|
1147
1171
|
"files.delete": {
|
|
1148
1172
|
params: FilesDeleteParams;
|
|
1149
1173
|
result: FilesDeleteResult;
|
|
@@ -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.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.tool_use_summary", "turn.tool_selection_policy", "turn.lifecycle", "turn.document_maintenance", "turn.artifact_contract", "turn.usage_update", "team.member.notification", "session.info", "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.tool_use_summary", "turn.tool_selection_policy", "turn.lifecycle", "turn.document_maintenance", "turn.artifact_contract", "turn.usage_update", "team.member.notification", "session.info", "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"];
|
|
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.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.tool_use_summary", "turn.tool_selection_policy", "turn.lifecycle", "turn.document_maintenance", "turn.artifact_contract", "turn.usage_update", "team.member.notification", "session.info", "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.tool_use_summary", "turn.tool_selection_policy", "turn.lifecycle", "turn.document_maintenance", "turn.artifact_contract", "turn.usage_update", "team.member.notification", "session.info", "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"];
|
|
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. */
|
|
@@ -408,13 +408,71 @@ export interface GatewayRpcMethodMap {
|
|
|
408
408
|
newPath?: string;
|
|
409
409
|
};
|
|
410
410
|
};
|
|
411
|
+
"files.move": {
|
|
412
|
+
params: {
|
|
413
|
+
projectId: string;
|
|
414
|
+
sourcePath: string;
|
|
415
|
+
targetDir: string;
|
|
416
|
+
conflictStrategy?: "error" | "keepBoth" | "replace" | "skip";
|
|
417
|
+
};
|
|
418
|
+
result: {
|
|
419
|
+
ok: boolean;
|
|
420
|
+
newPath?: string;
|
|
421
|
+
operationId?: string;
|
|
422
|
+
movedFrom?: string;
|
|
423
|
+
movedTo?: string;
|
|
424
|
+
skipped?: string[];
|
|
425
|
+
};
|
|
426
|
+
};
|
|
427
|
+
"files.copy": {
|
|
428
|
+
params: {
|
|
429
|
+
projectId: string;
|
|
430
|
+
sourcePath: string;
|
|
431
|
+
targetDir: string;
|
|
432
|
+
conflictStrategy?: "error" | "keepBoth" | "replace" | "skip";
|
|
433
|
+
};
|
|
434
|
+
result: {
|
|
435
|
+
ok: boolean;
|
|
436
|
+
newPath?: string;
|
|
437
|
+
operationId?: string;
|
|
438
|
+
createdPaths?: string[];
|
|
439
|
+
skipped?: string[];
|
|
440
|
+
};
|
|
441
|
+
};
|
|
442
|
+
"files.undoOperation": {
|
|
443
|
+
params: {
|
|
444
|
+
projectId: string;
|
|
445
|
+
operationId: string;
|
|
446
|
+
};
|
|
447
|
+
result: {
|
|
448
|
+
ok: boolean;
|
|
449
|
+
};
|
|
450
|
+
};
|
|
411
451
|
"files.delete": {
|
|
412
452
|
params: {
|
|
413
453
|
projectId: string;
|
|
414
454
|
path: string;
|
|
455
|
+
mode?: "trash" | "permanent";
|
|
415
456
|
};
|
|
416
457
|
result: {
|
|
417
458
|
ok: boolean;
|
|
459
|
+
operationId?: string;
|
|
460
|
+
trashed?: boolean;
|
|
461
|
+
};
|
|
462
|
+
};
|
|
463
|
+
"files.search": {
|
|
464
|
+
params: {
|
|
465
|
+
projectId: string;
|
|
466
|
+
query: string;
|
|
467
|
+
limit?: number;
|
|
468
|
+
};
|
|
469
|
+
result: {
|
|
470
|
+
matches: Array<{
|
|
471
|
+
name: string;
|
|
472
|
+
path: string;
|
|
473
|
+
type: "file" | "directory";
|
|
474
|
+
}>;
|
|
475
|
+
truncated: boolean;
|
|
418
476
|
};
|
|
419
477
|
};
|
|
420
478
|
"files.gitStatus": {
|
|
@@ -428,6 +486,108 @@ export interface GatewayRpcMethodMap {
|
|
|
428
486
|
}>;
|
|
429
487
|
};
|
|
430
488
|
};
|
|
489
|
+
"turnBaseline.getSummary": {
|
|
490
|
+
params: {
|
|
491
|
+
projectId: string;
|
|
492
|
+
turnId: string;
|
|
493
|
+
};
|
|
494
|
+
result: {
|
|
495
|
+
summary: unknown | null;
|
|
496
|
+
};
|
|
497
|
+
};
|
|
498
|
+
"turnBaseline.getFileDiff": {
|
|
499
|
+
params: {
|
|
500
|
+
projectId: string;
|
|
501
|
+
turnId: string;
|
|
502
|
+
path: string;
|
|
503
|
+
};
|
|
504
|
+
result: {
|
|
505
|
+
path: string;
|
|
506
|
+
previousPath?: string;
|
|
507
|
+
status: string;
|
|
508
|
+
original: string;
|
|
509
|
+
modified: string;
|
|
510
|
+
language?: string;
|
|
511
|
+
additions?: number;
|
|
512
|
+
deletions?: number;
|
|
513
|
+
};
|
|
514
|
+
};
|
|
515
|
+
"turnBaseline.listRecent": {
|
|
516
|
+
params: {
|
|
517
|
+
projectId: string;
|
|
518
|
+
sessionId?: string;
|
|
519
|
+
limit?: number;
|
|
520
|
+
};
|
|
521
|
+
result: {
|
|
522
|
+
summaries: unknown[];
|
|
523
|
+
};
|
|
524
|
+
};
|
|
525
|
+
"turnBaseline.getFileBaseline": {
|
|
526
|
+
params: {
|
|
527
|
+
projectId: string;
|
|
528
|
+
turnId: string;
|
|
529
|
+
path: string;
|
|
530
|
+
};
|
|
531
|
+
result: {
|
|
532
|
+
path: string;
|
|
533
|
+
content: string | null;
|
|
534
|
+
snapshot: unknown | null;
|
|
535
|
+
};
|
|
536
|
+
};
|
|
537
|
+
"workingMaterials.get": {
|
|
538
|
+
params: {
|
|
539
|
+
projectId: string;
|
|
540
|
+
sessionId: string;
|
|
541
|
+
};
|
|
542
|
+
result: {
|
|
543
|
+
items: unknown[];
|
|
544
|
+
missing: unknown[];
|
|
545
|
+
};
|
|
546
|
+
};
|
|
547
|
+
"workingMaterials.replace": {
|
|
548
|
+
params: {
|
|
549
|
+
projectId: string;
|
|
550
|
+
sessionId: string;
|
|
551
|
+
items: unknown[];
|
|
552
|
+
};
|
|
553
|
+
result: {
|
|
554
|
+
ok: boolean;
|
|
555
|
+
items: unknown[];
|
|
556
|
+
};
|
|
557
|
+
};
|
|
558
|
+
"workingMaterials.upsert": {
|
|
559
|
+
params: {
|
|
560
|
+
projectId: string;
|
|
561
|
+
sessionId: string;
|
|
562
|
+
item: unknown;
|
|
563
|
+
};
|
|
564
|
+
result: {
|
|
565
|
+
ok: boolean;
|
|
566
|
+
items: unknown[];
|
|
567
|
+
};
|
|
568
|
+
};
|
|
569
|
+
"workingMaterials.remove": {
|
|
570
|
+
params: {
|
|
571
|
+
projectId: string;
|
|
572
|
+
sessionId: string;
|
|
573
|
+
id: string;
|
|
574
|
+
};
|
|
575
|
+
result: {
|
|
576
|
+
ok: boolean;
|
|
577
|
+
items: unknown[];
|
|
578
|
+
};
|
|
579
|
+
};
|
|
580
|
+
"workingMaterials.reorder": {
|
|
581
|
+
params: {
|
|
582
|
+
projectId: string;
|
|
583
|
+
sessionId: string;
|
|
584
|
+
ids: string[];
|
|
585
|
+
};
|
|
586
|
+
result: {
|
|
587
|
+
ok: boolean;
|
|
588
|
+
items: unknown[];
|
|
589
|
+
};
|
|
590
|
+
};
|
|
431
591
|
"skills.list": {
|
|
432
592
|
params: {
|
|
433
593
|
projectId?: string;
|
|
@@ -81,6 +81,32 @@ export interface TurnRecoveryNotification {
|
|
|
81
81
|
detail?: string;
|
|
82
82
|
item?: NotificationThreadItem;
|
|
83
83
|
}
|
|
84
|
+
export type TurnFileChangeStatus = "added" | "modified" | "deleted" | "renamed" | "moved" | "copied" | "unchanged";
|
|
85
|
+
export interface TurnFileChangeRecord {
|
|
86
|
+
path: string;
|
|
87
|
+
previousPath?: string;
|
|
88
|
+
status: TurnFileChangeStatus;
|
|
89
|
+
additions?: number;
|
|
90
|
+
deletions?: number;
|
|
91
|
+
}
|
|
92
|
+
export interface TurnFileChangeSummaryWire {
|
|
93
|
+
turnId: string;
|
|
94
|
+
sessionId: string;
|
|
95
|
+
projectId: string;
|
|
96
|
+
state: "running" | "completed" | "failed" | "cancelled";
|
|
97
|
+
startedAt: string;
|
|
98
|
+
completedAt?: string;
|
|
99
|
+
filesChanged: number;
|
|
100
|
+
files: TurnFileChangeRecord[];
|
|
101
|
+
truncated?: boolean;
|
|
102
|
+
}
|
|
103
|
+
export interface TurnFileChangesNotification {
|
|
104
|
+
sessionId: string;
|
|
105
|
+
turnId: string;
|
|
106
|
+
projectId: string;
|
|
107
|
+
state: "completed" | "failed" | "cancelled";
|
|
108
|
+
summary: TurnFileChangeSummaryWire;
|
|
109
|
+
}
|
|
84
110
|
/** Tool invocation started. */
|
|
85
111
|
export interface TurnToolCallNotification {
|
|
86
112
|
turnId: string;
|
|
@@ -948,6 +974,7 @@ export interface NotificationMethodMap {
|
|
|
948
974
|
"turn.end": TurnEndNotification;
|
|
949
975
|
"turn.error": TurnErrorNotification;
|
|
950
976
|
"turn.recovery": TurnRecoveryNotification;
|
|
977
|
+
"turn.file_changes": TurnFileChangesNotification;
|
|
951
978
|
"turn.tool_call": TurnToolCallNotification;
|
|
952
979
|
"turn.tool_result": TurnToolResultNotification;
|
|
953
980
|
"turn.tool_blocked": TurnToolBlockedNotification;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feedback distillation worker (design §11; mini-design 2026-06-28 v2) — the idle-triggered sweep
|
|
3
|
+
* that turns a project's accumulated feedback into memory proposals. Scheduling mirrors the upload
|
|
4
|
+
* worker + dream: a pure work unit, callers serialize per project (§9.1 rule 9). It is append-only
|
|
5
|
+
* into the SHARED memory pipeline (proposeExtracted, source="feedback") — it never promotes; dream /
|
|
6
|
+
* consolidator own merge + promote (§11.2). The store-level idempotency key (§10) makes the sweep
|
|
7
|
+
* safe to re-run: a retried sweep, or a worker restart mid-sweep, never duplicates a proposal.
|
|
8
|
+
*/
|
|
9
|
+
import type { MemoryDreamProvider } from "../ports/memory-provider.js";
|
|
10
|
+
export interface FeedbackDistillationResult {
|
|
11
|
+
candidates: number;
|
|
12
|
+
proposed: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* One distillation sweep for a project: cluster active feedback into candidates, append each as a
|
|
16
|
+
* memory proposal. Fail-soft per candidate — one rejected proposal never aborts the rest of the
|
|
17
|
+
* sweep. Returns counts for logging. The memory provider must expose proposeExtracted (the dream
|
|
18
|
+
* provider does); if it doesn't, the sweep is a no-op.
|
|
19
|
+
*/
|
|
20
|
+
export declare function runFeedbackDistillationSweep(projectId: string, sink: Pick<MemoryDreamProvider, "proposeExtracted">, userId: string): Promise<FeedbackDistillationResult>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { FeedbackEvent } from "./feedback-event-store.js";
|
|
2
|
+
/** Minimum corroborating active events before a cluster becomes a proposal (mini-design §3.4). */
|
|
3
|
+
export declare const MIN_EVIDENCE = 2;
|
|
4
|
+
export interface FeedbackDistillationCandidate {
|
|
5
|
+
clusterKey: string;
|
|
6
|
+
/** Template preference sentence (dream LLM refines later — mini-design §9.3). */
|
|
7
|
+
text: string;
|
|
8
|
+
category: string;
|
|
9
|
+
importance: number;
|
|
10
|
+
confidence: number;
|
|
11
|
+
/** Audit trail + crash-safe idempotency, consumed by the extended proposeExtracted (§10). */
|
|
12
|
+
evidence: {
|
|
13
|
+
kind: "feedback";
|
|
14
|
+
refs: string[];
|
|
15
|
+
idempotencyKey: string;
|
|
16
|
+
};
|
|
17
|
+
/** Cluster diagnostics — not persisted as-is; surfaced for tests + logging. */
|
|
18
|
+
stats: {
|
|
19
|
+
evidence: number;
|
|
20
|
+
crossSession: boolean;
|
|
21
|
+
feedbackIds: string[];
|
|
22
|
+
turnIds: string[];
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Cluster a project's feedback events into proposal candidates. Only active events count
|
|
27
|
+
* (retracted / replaced are filtered — §11.1). Clusters below MIN_EVIDENCE are dropped. Output is
|
|
28
|
+
* sorted by clusterKey for deterministic ordering across runs.
|
|
29
|
+
*/
|
|
30
|
+
export declare function distillFeedback(events: FeedbackEvent[]): FeedbackDistillationCandidate[];
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
export type FeedbackRating = "up" | "down";
|
|
2
|
+
export type FeedbackState = "active" | "retracted" | "replaced";
|
|
3
|
+
export type TelemetryStatus = "complete" | "partial" | "missing";
|
|
4
|
+
export type FeedbackReason = "missed_requirement" | "incomplete" | "broken_file_link_or_panel" | "code_or_test_failed" | "factually_wrong" | "too_verbose" | "too_short" | "wrong_style" | "other";
|
|
5
|
+
export interface FeedbackUsage {
|
|
6
|
+
inputTokens?: number;
|
|
7
|
+
outputTokens?: number;
|
|
8
|
+
totalTokens?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface FeedbackToolSummary {
|
|
11
|
+
calledTools: string[];
|
|
12
|
+
failedTools: string[];
|
|
13
|
+
blockedTools: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface FeedbackFileContext {
|
|
16
|
+
changedFileCount?: number;
|
|
17
|
+
changedPathsPreview?: string[];
|
|
18
|
+
hasTurnFileChanges?: boolean;
|
|
19
|
+
diffOpenState?: "not_applicable" | "opened" | "failed" | "unknown";
|
|
20
|
+
}
|
|
21
|
+
export interface FeedbackBrowserContext {
|
|
22
|
+
url?: string;
|
|
23
|
+
hadToastError?: boolean;
|
|
24
|
+
visiblePanel?: "chat" | "artifact" | "diff" | "unknown";
|
|
25
|
+
}
|
|
26
|
+
export interface FeedbackEvent {
|
|
27
|
+
feedbackId: string;
|
|
28
|
+
rating: FeedbackRating;
|
|
29
|
+
reason?: FeedbackReason;
|
|
30
|
+
comment?: string;
|
|
31
|
+
state: FeedbackState;
|
|
32
|
+
projectId?: string;
|
|
33
|
+
sessionId: string;
|
|
34
|
+
turnId: string;
|
|
35
|
+
assistantMessageId: string;
|
|
36
|
+
userId?: string;
|
|
37
|
+
telemetryStatus: TelemetryStatus;
|
|
38
|
+
messageRole: "assistant";
|
|
39
|
+
messagePreview: string;
|
|
40
|
+
messageHash: string;
|
|
41
|
+
model?: string;
|
|
42
|
+
provider?: string;
|
|
43
|
+
agentMode?: "chat" | "solo" | "product" | "workflow" | "unknown";
|
|
44
|
+
sourceChannel?: string;
|
|
45
|
+
usage?: FeedbackUsage;
|
|
46
|
+
toolSummary?: FeedbackToolSummary;
|
|
47
|
+
fileContext?: FeedbackFileContext;
|
|
48
|
+
browserContext?: FeedbackBrowserContext;
|
|
49
|
+
upload?: {
|
|
50
|
+
eligible: boolean;
|
|
51
|
+
uploadedAt?: string;
|
|
52
|
+
uploadBatchId?: string;
|
|
53
|
+
redactionVersion?: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Local distillation bookkeeping (mini-design §6): records that this event was folded into a
|
|
57
|
+
* memory proposal, and under which cluster + idempotency key. Observability only — the crash-safe
|
|
58
|
+
* dedup guard is the store-level idempotency key on the proposal, not this field.
|
|
59
|
+
*/
|
|
60
|
+
distill?: {
|
|
61
|
+
proposedAt: string;
|
|
62
|
+
clusterKey: string;
|
|
63
|
+
idempotencyKey: string;
|
|
64
|
+
};
|
|
65
|
+
createdAt: string;
|
|
66
|
+
updatedAt: string;
|
|
67
|
+
}
|
|
68
|
+
/** Telemetry-joined + click-time context the handler assembles before persisting. */
|
|
69
|
+
export interface FeedbackContext {
|
|
70
|
+
telemetryStatus: TelemetryStatus;
|
|
71
|
+
messagePreview: string;
|
|
72
|
+
messageHash: string;
|
|
73
|
+
userId?: string;
|
|
74
|
+
model?: string;
|
|
75
|
+
provider?: string;
|
|
76
|
+
agentMode?: FeedbackEvent["agentMode"];
|
|
77
|
+
sourceChannel?: string;
|
|
78
|
+
usage?: FeedbackUsage;
|
|
79
|
+
toolSummary?: FeedbackToolSummary;
|
|
80
|
+
fileContext?: FeedbackFileContext;
|
|
81
|
+
browserContext?: FeedbackBrowserContext;
|
|
82
|
+
}
|
|
83
|
+
export interface FeedbackSubmitInput {
|
|
84
|
+
rating: FeedbackRating;
|
|
85
|
+
reason?: FeedbackReason;
|
|
86
|
+
comment?: string;
|
|
87
|
+
projectId: string;
|
|
88
|
+
sessionId: string;
|
|
89
|
+
turnId: string;
|
|
90
|
+
assistantMessageId: string;
|
|
91
|
+
context: FeedbackContext;
|
|
92
|
+
}
|
|
93
|
+
export interface FeedbackStateEntry {
|
|
94
|
+
turnId: string;
|
|
95
|
+
assistantMessageId: string;
|
|
96
|
+
feedbackId: string;
|
|
97
|
+
rating: FeedbackRating;
|
|
98
|
+
reason?: FeedbackReason;
|
|
99
|
+
state: FeedbackState;
|
|
100
|
+
updatedAt: string;
|
|
101
|
+
}
|
|
102
|
+
export declare function hashMessageContent(content: string): string;
|
|
103
|
+
/**
|
|
104
|
+
* Create / switch / re-activate the feedback for a turn. Returns the stable feedbackId and the
|
|
105
|
+
* resulting state. Submitting the SAME rating while already active is a no-op (idempotent retry).
|
|
106
|
+
*/
|
|
107
|
+
export declare function submitFeedback(input: FeedbackSubmitInput): Promise<{
|
|
108
|
+
feedbackId: string;
|
|
109
|
+
state: FeedbackState;
|
|
110
|
+
}>;
|
|
111
|
+
/**
|
|
112
|
+
* Retract the active feedback for a turn (the frontend calls this when the user re-clicks the
|
|
113
|
+
* already-selected button). Idempotent: retracting when there is nothing active is a no-op.
|
|
114
|
+
*/
|
|
115
|
+
export declare function retractFeedback(input: {
|
|
116
|
+
projectId: string;
|
|
117
|
+
turnId: string;
|
|
118
|
+
feedbackId?: string;
|
|
119
|
+
}): Promise<{
|
|
120
|
+
ok: boolean;
|
|
121
|
+
feedbackId?: string;
|
|
122
|
+
state: FeedbackState | null;
|
|
123
|
+
}>;
|
|
124
|
+
/**
|
|
125
|
+
* Hydrate feedback state for a session's messages (initial render / refresh). Returns only ACTIVE
|
|
126
|
+
* feedback (absent = not rated) — the fixed contract per design §8.3, so the UI never has to
|
|
127
|
+
* interpret retracted/replaced records.
|
|
128
|
+
*/
|
|
129
|
+
export declare function getFeedbackState(input: {
|
|
130
|
+
projectId: string;
|
|
131
|
+
sessionId: string;
|
|
132
|
+
turnIds?: string[];
|
|
133
|
+
assistantMessageIds?: string[];
|
|
134
|
+
}): Promise<{
|
|
135
|
+
states: FeedbackStateEntry[];
|
|
136
|
+
}>;
|
|
137
|
+
/**
|
|
138
|
+
* Events eligible for cloud upload that have not yet been assigned to a batch (design §10). The
|
|
139
|
+
* worker redacts + ships these; once assigned a batchId (delivered or queued for retry) they are
|
|
140
|
+
* skipped until a state change resets the upload marks.
|
|
141
|
+
*/
|
|
142
|
+
export declare function listUploadableFeedback(projectId: string): Promise<FeedbackEvent[]>;
|
|
143
|
+
/** Mark an event as assigned to an in-flight upload batch (queued for retry, not yet delivered). */
|
|
144
|
+
export declare function assignFeedbackBatch(projectId: string, turnId: string, uploadBatchId: string): Promise<void>;
|
|
145
|
+
/** Mark an event as successfully uploaded (stamps uploadedAt + batch + redactionVersion). */
|
|
146
|
+
export declare function markFeedbackUploaded(projectId: string, turnId: string, uploadBatchId: string, redactionVersion: string): Promise<void>;
|
|
147
|
+
/**
|
|
148
|
+
* Active feedback eligible for memory distillation (mini-design §3.1). Distillation re-clusters the
|
|
149
|
+
* full active set every sweep; the store-level idempotency key (not a per-event flag) prevents
|
|
150
|
+
* duplicate proposals, so this intentionally returns ALL active events — already distilled or not.
|
|
151
|
+
* A newly added active event simply changes a cluster's id set and yields a fresh proposal.
|
|
152
|
+
*/
|
|
153
|
+
export declare function listDistillableFeedback(projectId: string): Promise<FeedbackEvent[]>;
|
|
154
|
+
/** Stamp local distillation bookkeeping on an event (which cluster + idempotency key folded it in). */
|
|
155
|
+
export declare function markFeedbackDistilled(projectId: string, turnId: string, info: {
|
|
156
|
+
clusterKey: string;
|
|
157
|
+
idempotencyKey: string;
|
|
158
|
+
}): Promise<void>;
|
|
159
|
+
/** Test helper: read the raw stored event for a turn (including retracted), or null. */
|
|
160
|
+
export declare function __getFeedbackEventForTest(projectId: string, turnId: string): Promise<FeedbackEvent | null>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type OutboxOp = "uploadBatch";
|
|
2
|
+
export interface OutboxEntry {
|
|
3
|
+
entryId: string;
|
|
4
|
+
/** Dedup key — re-enqueuing the same logical op is a no-op (no double upload). */
|
|
5
|
+
idempotencyKey: string;
|
|
6
|
+
op: OutboxOp;
|
|
7
|
+
payload: unknown;
|
|
8
|
+
attempts: number;
|
|
9
|
+
createdAt: string;
|
|
10
|
+
nextAttemptAt: string;
|
|
11
|
+
lastError?: string;
|
|
12
|
+
}
|
|
13
|
+
/** Enqueue a failed op for retry. Idempotent: an existing entry with the same key is kept as-is. */
|
|
14
|
+
export declare function enqueueOutbox(projectId: string, input: {
|
|
15
|
+
idempotencyKey: string;
|
|
16
|
+
op: OutboxOp;
|
|
17
|
+
payload: unknown;
|
|
18
|
+
}, now?: Date): Promise<OutboxEntry>;
|
|
19
|
+
/** Entries whose backoff window has elapsed and that have not exhausted their retry budget. */
|
|
20
|
+
export declare function listDueOutbox(projectId: string, now?: Date): Promise<OutboxEntry[]>;
|
|
21
|
+
/** Drop a successfully-delivered entry. */
|
|
22
|
+
export declare function removeOutbox(projectId: string, entryId: string): Promise<void>;
|
|
23
|
+
/** Record a failed attempt: bump attempts + schedule the next retry with exponential backoff. */
|
|
24
|
+
export declare function markOutboxFailure(projectId: string, entryId: string, error: string, now?: Date): Promise<void>;
|
|
25
|
+
/** Entries that have exhausted their retry budget — kept for local audit, never re-sent. */
|
|
26
|
+
export declare function listExhaustedOutbox(projectId: string): Promise<OutboxEntry[]>;
|