qlogicagent 2.24.1 → 2.24.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/README.md +52 -324
- package/dist/agent.js +38 -43
- package/dist/cli.js +7 -7
- package/dist/default-project-knowledge/INSTRUCTIONS.md +7 -7
- package/dist/default-project-knowledge/rules/project-workflow.md +6 -6
- package/dist/index.js +265 -1018
- package/dist/orchestration.js +10 -10
- package/dist/types/agent/runtime-vars.d.ts +1 -16
- package/dist/types/agent/tool-loop/compression-pipeline.d.ts +0 -2
- package/dist/types/agent/tool-loop.d.ts +0 -6
- package/dist/types/agent/types.d.ts +3 -22
- package/dist/types/cli/acp-commands.d.ts +4 -5
- package/dist/types/cli/acp-message-router.d.ts +1 -2
- package/dist/types/cli/acp-session-handlers.d.ts +6 -12
- package/dist/types/cli/acp-session-host.d.ts +5 -48
- package/dist/types/cli/adapter-launch-config.d.ts +14 -0
- package/dist/types/cli/agent-runtime-bootstrap.d.ts +2 -23
- package/dist/types/cli/agent-runtime-session-state.d.ts +1 -6
- package/dist/types/cli/base-tool-bootstrap.d.ts +0 -2
- package/dist/types/cli/cli-acp-request-handler.d.ts +3 -5
- package/dist/types/cli/core-tool-coordinator.d.ts +0 -4
- package/dist/types/cli/core-tools/agent-tool-service.d.ts +0 -3
- package/dist/types/cli/core-tools/fork-system-prompt.d.ts +1 -5
- package/dist/types/cli/handlers/files-handler.d.ts +0 -6
- package/dist/types/cli/handlers/turn-handler.d.ts +7 -83
- package/dist/types/cli/main.d.ts +2 -4
- package/dist/types/cli/permission-approval-bridge.d.ts +2 -6
- package/dist/types/cli/permission-bootstrap.d.ts +2 -12
- package/dist/types/cli/plugin-bootstrap.d.ts +2 -4
- package/dist/types/cli/runtime-hook-bootstrap.d.ts +0 -21
- package/dist/types/cli/session-context.d.ts +4 -14
- package/dist/types/cli/session-coordinator.d.ts +1 -9
- package/dist/types/cli/stdio-acp-protocol-coordinator.d.ts +2 -9
- package/dist/types/cli/stdio-acp-request-host.d.ts +3 -15
- package/dist/types/cli/stdio-agent-session-bootstrap.d.ts +3 -23
- package/dist/types/cli/stdio-runtime-bootstrap.d.ts +0 -8
- package/dist/types/cli/stdio-runtime-services.d.ts +2 -13
- package/dist/types/cli/stdio-server.d.ts +6 -128
- package/dist/types/cli/tool-bootstrap.d.ts +4 -8
- package/dist/types/cli/tool-catalog.d.ts +2 -2
- package/dist/types/cli/tool-invoker-factory.d.ts +0 -2
- package/dist/types/cli/tool-registry-adapter.d.ts +3 -7
- package/dist/types/cli/tool-result-processor.d.ts +0 -1
- package/dist/types/cli/turn-core.d.ts +6 -10
- package/dist/types/cli/turn-event-forwarder.d.ts +6 -3
- package/dist/types/cli/turn-lifecycle.d.ts +0 -3
- package/dist/types/cli/turn-project-router.d.ts +0 -7
- package/dist/types/contracts/hooks.d.ts +1 -20
- package/dist/types/contracts/tool-execution-evidence.d.ts +20 -1
- package/dist/types/contracts/turn-event.d.ts +2 -2
- package/dist/types/orchestration/index.d.ts +1 -1
- package/dist/types/protocol/notifications.d.ts +2 -9
- package/dist/types/protocol/wire/acp-protocol.d.ts +12 -186
- package/dist/types/protocol/wire/capability-transport.d.ts +0 -2
- package/dist/types/protocol/wire/index.d.ts +2 -10
- package/dist/types/protocol/wire/notification-payloads.d.ts +4 -989
- package/dist/types/protocol/wire/thread-protocol.d.ts +24 -3
- package/dist/types/runtime/config/tunable-defaults.d.ts +3 -75
- package/dist/types/runtime/execution/forked-agent.d.ts +2 -5
- package/dist/types/runtime/execution/streaming-tool-executor.d.ts +0 -2
- package/dist/types/runtime/execution/tool-result-storage.d.ts +13 -4
- package/dist/types/runtime/infra/agent-paths.d.ts +4 -54
- package/dist/types/runtime/infra/agent-project-projection.d.ts +20 -0
- package/dist/types/runtime/infra/background-tasks.d.ts +3 -3
- package/dist/types/runtime/infra/default-path-service.d.ts +0 -7
- package/dist/types/runtime/infra/llmrouter-catalog.d.ts +1 -1
- package/dist/types/runtime/infra/model-registry.d.ts +6 -9
- package/dist/types/runtime/infra/project-store.d.ts +3 -3
- package/dist/types/runtime/infra/subagent-turn-snapshot.d.ts +54 -7
- package/dist/types/runtime/infra/task-runtime.d.ts +1 -1
- package/dist/types/runtime/ports/agent-runtime-ports.d.ts +1 -3
- package/dist/types/runtime/ports/index.d.ts +0 -4
- package/dist/types/runtime/ports/path-service.d.ts +1 -9
- package/dist/types/runtime/ports/tool-contracts.d.ts +0 -1
- package/dist/types/runtime/session/agent-session-projection.d.ts +37 -0
- package/dist/types/runtime/tasks/task-types.d.ts +2 -25
- package/dist/types/skills/mcp/mcp-manager.d.ts +2 -2
- package/dist/types/skills/plugins/plugin-loader.d.ts +1 -1
- package/dist/types/skills/skill-system/skill-category.d.ts +4 -2
- package/dist/types/skills/tools.d.ts +1 -18
- package/dist/types/test-support/project-store-fixture.d.ts +4 -4
- package/dist/types/transport/acp-event-emitter.d.ts +1 -20
- package/dist/types/transport/acp-server.d.ts +8 -88
- package/package.json +4 -96
- package/dist/agent-contract.js +0 -1
- package/dist/host-contract.js +0 -1
- package/dist/host-session-collection-contract.js +0 -1
- package/dist/memory-category-contract.js +0 -1
- package/dist/permissions.js +0 -1
- package/dist/plugin-marketplace-compute.js +0 -1
- package/dist/project-memory-host.js +0 -38
- package/dist/protocol.js +0 -1
- package/dist/skill-category-contract.js +0 -1
- package/dist/tunables.js +0 -1
- package/dist/types/agent/memory-recall-context.d.ts +0 -22
- package/dist/types/agent/memory-recall-injection.d.ts +0 -32
- package/dist/types/cli/acp-extended-handlers.d.ts +0 -110
- package/dist/types/cli/acp-extended-host-adapter.d.ts +0 -20
- package/dist/types/cli/community-resource-installer.d.ts +0 -39
- package/dist/types/cli/community-skill-installer.d.ts +0 -18
- package/dist/types/cli/community-workflow-installer.d.ts +0 -29
- package/dist/types/cli/default-project-bootstrap.d.ts +0 -12
- package/dist/types/cli/dream-host-adapter.d.ts +0 -24
- package/dist/types/cli/gateway-rpc-connection.d.ts +0 -50
- package/dist/types/cli/handlers/community-handler.d.ts +0 -14
- package/dist/types/cli/handlers/config-handler.d.ts +0 -19
- package/dist/types/cli/handlers/control-handler.d.ts +0 -29
- package/dist/types/cli/handlers/dream-handler.d.ts +0 -41
- package/dist/types/cli/handlers/goal-handler.d.ts +0 -66
- package/dist/types/cli/handlers/memory-handler.d.ts +0 -23
- package/dist/types/cli/handlers/product-handler.d.ts +0 -35
- package/dist/types/cli/handlers/session-handler.d.ts +0 -29
- package/dist/types/cli/handlers/skill-curator-handler.d.ts +0 -8
- package/dist/types/cli/handlers/solo-handler.d.ts +0 -25
- package/dist/types/cli/handlers/turn-baseline-handler.d.ts +0 -8
- package/dist/types/cli/handlers/workflow-compute-handler.d.ts +0 -8
- package/dist/types/cli/handlers/working-materials-handler.d.ts +0 -9
- package/dist/types/cli/idle-dream-coordinator.d.ts +0 -57
- package/dist/types/cli/memory-background-coordinator.d.ts +0 -26
- package/dist/types/cli/memory-candidate-service.d.ts +0 -75
- package/dist/types/cli/memory-coordinator.d.ts +0 -40
- package/dist/types/cli/multi-agent-handler-host.d.ts +0 -16
- package/dist/types/cli/multi-agent-state-coordinator.d.ts +0 -8
- package/dist/types/cli/orchestration-memory-context.d.ts +0 -23
- package/dist/types/cli/product-acp-params.d.ts +0 -30
- package/dist/types/cli/product-coordinator.d.ts +0 -21
- package/dist/types/cli/project-memory-store-factory.d.ts +0 -12
- package/dist/types/cli/project-template-seeder.d.ts +0 -5
- package/dist/types/cli/rpc-registry.d.ts +0 -56
- package/dist/types/cli/session-history-coordinator.d.ts +0 -8
- package/dist/types/cli/session-query-service.d.ts +0 -27
- package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +0 -56
- package/dist/types/cli/stdio-session-runtime-coordinator.d.ts +0 -17
- package/dist/types/cli/task-distillation-coordinator.d.ts +0 -146
- package/dist/types/cli/turn-ask-user-setup.d.ts +0 -24
- package/dist/types/cli/turn-suggestion-generator.d.ts +0 -15
- package/dist/types/contracts/memory-recall-packet.d.ts +0 -31
- package/dist/types/contracts/memory-response-contract.d.ts +0 -2
- package/dist/types/host-contract/fts-segment.d.ts +0 -20
- package/dist/types/host-contract/index.d.ts +0 -1819
- package/dist/types/host-contract/memory-category.d.ts +0 -8
- package/dist/types/host-contract/skill-category.d.ts +0 -5
- package/dist/types/host-session-collection-contract.d.ts +0 -65
- package/dist/types/orchestration/agent-instance.d.ts +0 -215
- package/dist/types/orchestration/agent-roster.d.ts +0 -32
- package/dist/types/orchestration/dag-scheduler.d.ts +0 -219
- package/dist/types/orchestration/delegate-approval-policy.d.ts +0 -8
- package/dist/types/orchestration/delegate-bridge.d.ts +0 -8
- package/dist/types/orchestration/goal-acceptance.d.ts +0 -17
- package/dist/types/orchestration/goal-context-envelope.d.ts +0 -7
- package/dist/types/orchestration/goal-loop-coordinator.d.ts +0 -151
- package/dist/types/orchestration/goal-mode-adapters.d.ts +0 -152
- package/dist/types/orchestration/goal-run-persistence.d.ts +0 -21
- package/dist/types/orchestration/goal-run-types.d.ts +0 -225
- package/dist/types/orchestration/planner-memory-brief.d.ts +0 -39
- package/dist/types/orchestration/product-budget.d.ts +0 -94
- package/dist/types/orchestration/product-checkpoint.d.ts +0 -50
- package/dist/types/orchestration/product-dag-mutation-applier.d.ts +0 -10
- package/dist/types/orchestration/product-persistence.d.ts +0 -90
- package/dist/types/orchestration/product-planner.d.ts +0 -332
- package/dist/types/orchestration/product-run-coordinator.d.ts +0 -49
- package/dist/types/orchestration/product-worktree.d.ts +0 -19
- package/dist/types/orchestration/run-state-host-authority.d.ts +0 -7
- package/dist/types/orchestration/solo-evaluator.d.ts +0 -179
- package/dist/types/orchestration/solo-persistence.d.ts +0 -47
- package/dist/types/orchestration/solo-spec-builder.d.ts +0 -58
- package/dist/types/orchestration/testing/delegate-test-bridge.d.ts +0 -23
- package/dist/types/orchestration/testing/host-agent-provider-directory-fixture.d.ts +0 -7
- package/dist/types/orchestration/testing/run-state-client-double.d.ts +0 -13
- package/dist/types/orchestration/workflow/budget-permission-gate.d.ts +0 -94
- package/dist/types/orchestration/workflow/builtin-capabilities.d.ts +0 -3
- package/dist/types/orchestration/workflow/builtin-executors.d.ts +0 -18
- package/dist/types/orchestration/workflow/capability-catalog.d.ts +0 -72
- package/dist/types/orchestration/workflow/cron-schedule.d.ts +0 -36
- package/dist/types/orchestration/workflow/data-item.d.ts +0 -39
- package/dist/types/orchestration/workflow/expression.d.ts +0 -60
- package/dist/types/orchestration/workflow/host-executors.d.ts +0 -15
- package/dist/types/orchestration/workflow/n8n-expression.d.ts +0 -48
- package/dist/types/orchestration/workflow/n8n-import.d.ts +0 -64
- package/dist/types/orchestration/workflow/n8n-template-compat.d.ts +0 -5
- package/dist/types/orchestration/workflow/node-registry.d.ts +0 -32
- package/dist/types/orchestration/workflow/node-schema.d.ts +0 -249
- package/dist/types/orchestration/workflow/params-schema.d.ts +0 -69
- package/dist/types/orchestration/workflow/qla-executor-host.d.ts +0 -63
- package/dist/types/orchestration/workflow/run-checkpoint-store.d.ts +0 -53
- package/dist/types/orchestration/workflow/run-history-store.d.ts +0 -103
- package/dist/types/orchestration/workflow/semantic-acceptance.d.ts +0 -65
- package/dist/types/orchestration/workflow/trigger-validation.d.ts +0 -22
- package/dist/types/orchestration/workflow/workflow-audit-store.d.ts +0 -31
- package/dist/types/orchestration/workflow/workflow-authoring.d.ts +0 -74
- package/dist/types/orchestration/workflow/workflow-bundle.d.ts +0 -51
- package/dist/types/orchestration/workflow/workflow-controller.d.ts +0 -237
- package/dist/types/orchestration/workflow/workflow-edit-context.d.ts +0 -46
- package/dist/types/orchestration/workflow/workflow-error.d.ts +0 -28
- package/dist/types/orchestration/workflow/workflow-intent-contract.d.ts +0 -56
- package/dist/types/orchestration/workflow/workflow-patch.d.ts +0 -122
- package/dist/types/orchestration/workflow/workflow-render.d.ts +0 -40
- package/dist/types/orchestration/workflow/workflow-runtime.d.ts +0 -184
- package/dist/types/orchestration/workflow/workflow-scheduler.d.ts +0 -122
- package/dist/types/orchestration/workflow/workflow-store.d.ts +0 -85
- package/dist/types/orchestration/workflow/workflow-template-setup.d.ts +0 -65
- package/dist/types/orchestration/workflow/workflow-trigger.d.ts +0 -43
- package/dist/types/orchestration/workflow-chat-builder.d.ts +0 -152
- package/dist/types/orchestration/worktree-task-prompt.d.ts +0 -1
- package/dist/types/permissions.d.ts +0 -4
- package/dist/types/project-memory-host.d.ts +0 -4
- package/dist/types/protocol/agent-contract.d.ts +0 -93
- package/dist/types/protocol/methods.d.ts +0 -645
- package/dist/types/protocol/wire/acp-agent-management.d.ts +0 -533
- package/dist/types/protocol/wire/agent-events.d.ts +0 -1
- package/dist/types/protocol/wire/agent-methods.d.ts +0 -500
- package/dist/types/protocol/wire/agent-rpc.d.ts +0 -100
- package/dist/types/protocol/wire/gateway-contract.d.ts +0 -61
- package/dist/types/protocol/wire/gateway-rpc.d.ts +0 -1177
- package/dist/types/protocol/wire/memory-provider-lifecycle.d.ts +0 -31
- package/dist/types/protocol/wire/turn.d.ts +0 -208
- package/dist/types/runtime/community/autonomy-budget.d.ts +0 -26
- package/dist/types/runtime/community/community-consent-client.d.ts +0 -55
- package/dist/types/runtime/community/package-materialize.d.ts +0 -19
- package/dist/types/runtime/community/ranged-download.d.ts +0 -21
- package/dist/types/runtime/community/registry-signature.d.ts +0 -48
- package/dist/types/runtime/execution/dream-agent.d.ts +0 -273
- package/dist/types/runtime/execution/dream-category-context.d.ts +0 -47
- package/dist/types/runtime/execution/memory-decay.d.ts +0 -73
- package/dist/types/runtime/execution/turn-progress-notifier.d.ts +0 -16
- package/dist/types/runtime/hooks/memory-hooks.d.ts +0 -111
- package/dist/types/runtime/infra/acp-host-handler.d.ts +0 -31
- package/dist/types/runtime/infra/acp-protocol-adapter.d.ts +0 -209
- package/dist/types/runtime/infra/acp-usage-tracker.d.ts +0 -46
- package/dist/types/runtime/infra/cloud-auth-host-authority.d.ts +0 -4
- package/dist/types/runtime/infra/feedback-distillation-worker.d.ts +0 -20
- package/dist/types/runtime/infra/feedback-distillation.d.ts +0 -32
- package/dist/types/runtime/infra/feedback-event-store.d.ts +0 -179
- package/dist/types/runtime/infra/feedback-host-authority.d.ts +0 -4
- package/dist/types/runtime/infra/feedback-outbox.d.ts +0 -26
- package/dist/types/runtime/infra/feedback-redaction.d.ts +0 -71
- package/dist/types/runtime/infra/feedback-upload-client.d.ts +0 -39
- package/dist/types/runtime/infra/feedback-upload-worker.d.ts +0 -11
- package/dist/types/runtime/infra/host-agent-provider-directory.d.ts +0 -17
- package/dist/types/runtime/infra/project-authority-facade.d.ts +0 -11
- package/dist/types/runtime/infra/project-data-paths.d.ts +0 -24
- package/dist/types/runtime/infra/project-host-authority.d.ts +0 -11
- package/dist/types/runtime/infra/project-instructions-store.d.ts +0 -30
- package/dist/types/runtime/infra/turn-baseline-store.d.ts +0 -102
- package/dist/types/runtime/infra/turn-telemetry-store.d.ts +0 -100
- package/dist/types/runtime/infra/working-materials-store.d.ts +0 -29
- package/dist/types/runtime/memory/find-relevant-memories.d.ts +0 -26
- package/dist/types/runtime/memory/implicit-extraction.d.ts +0 -69
- package/dist/types/runtime/memory/memory-recall-attribution.d.ts +0 -24
- package/dist/types/runtime/ports/memory-provider.d.ts +0 -219
- package/dist/types/runtime/ports/memory-recall-source.d.ts +0 -14
- package/dist/types/runtime/ports/memory-writer.d.ts +0 -70
- package/dist/types/runtime/ports/project-memory-store.d.ts +0 -49
- package/dist/types/runtime/prompt/host-skill-directory.d.ts +0 -16
- package/dist/types/runtime/session/group-session-split.d.ts +0 -38
- package/dist/types/runtime/session/inbound-upload-persistence.d.ts +0 -47
- package/dist/types/runtime/session/session-catalog.d.ts +0 -12
- package/dist/types/runtime/session/session-deletion-guard.d.ts +0 -4
- package/dist/types/runtime/session/session-locator.d.ts +0 -26
- package/dist/types/runtime/session/session-metadata-store.d.ts +0 -8
- package/dist/types/runtime/session/session-paths.d.ts +0 -8
- package/dist/types/runtime/session/session-permission-store.d.ts +0 -6
- package/dist/types/runtime/session/session-persistence.d.ts +0 -37
- package/dist/types/runtime/session/session-recovery.d.ts +0 -62
- package/dist/types/runtime/session/session-resource-key.d.ts +0 -28
- package/dist/types/runtime/session/session-resume.d.ts +0 -9
- package/dist/types/runtime/session/session-schema.d.ts +0 -10
- package/dist/types/runtime/session/session-summary.d.ts +0 -7
- package/dist/types/runtime/session/session-title.d.ts +0 -9
- package/dist/types/runtime/session/session-transcript-store.d.ts +0 -30
- package/dist/types/runtime/session/session-types.d.ts +0 -113
- package/dist/types/runtime/session/session-write-queue.d.ts +0 -3
- package/dist/types/skills/memory/host-memory-provider.d.ts +0 -235
- package/dist/types/skills/memory/memdir.d.ts +0 -111
- package/dist/types/skills/memory/memory-content-safety.d.ts +0 -1
- package/dist/types/skills/memory/memory-vector-utils.d.ts +0 -2
- package/dist/types/skills/memory/task-distillation.d.ts +0 -183
- package/dist/types/skills/plugins/plugin-marketplace.d.ts +0 -43
- package/dist/types/skills/skill-system/skill-bundles.d.ts +0 -8
- package/dist/types/skills/skill-system/skill-lifecycle.d.ts +0 -89
- package/dist/types/test-support/run-state-authority-setup.d.ts +0 -1
- package/dist/types/transport/delegate-client.d.ts +0 -82
- package/dist/types/transport/host-capability-client.d.ts +0 -21
- package/dist/types/transport/host-cloud-auth-client.d.ts +0 -10
- package/dist/types/transport/host-community-client.d.ts +0 -7
- package/dist/types/transport/host-feedback-client.d.ts +0 -25
- package/dist/types/transport/host-profile-client.d.ts +0 -19
- package/dist/types/transport/host-project-client.d.ts +0 -16
- package/dist/types/transport/host-request-client.d.ts +0 -42
- package/dist/types/transport/host-run-state-client.d.ts +0 -23
- package/dist/types/transport/host-session-client.d.ts +0 -30
- package/dist/types/tunables.d.ts +0 -2
- package/dist/types/workflow-host.d.ts +0 -38
- package/dist/workflow-host.js +0 -11
- /package/dist/types/{host-contract → protocol/wire}/acp-content.d.ts +0 -0
- /package/dist/types/{host-contract → runtime/infra}/project-id.d.ts +0 -0
- /package/dist/types/{host-contract → runtime/infra}/provider-profile.d.ts +0 -0
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ACP Protocol Adapter — a thin wrapper over the official @agentclientprotocol/sdk
|
|
3
|
-
* `ClientSideConnection`. qlogicagent is the ACP *client* (host); spawned external
|
|
4
|
-
* agents (codex-acp, claude-agent-acp, xiaozhiclaw, …) are the ACP *agents*.
|
|
5
|
-
*
|
|
6
|
-
* The SDK owns the wire protocol entirely: JSON-RPC 2.0 / NDJSON framing, request↔response
|
|
7
|
-
* correlation, and the reverse-RPC dispatch. This module owns only the three concerns the SDK
|
|
8
|
-
* leaves to the host:
|
|
9
|
-
* 1. bridging a Node ChildProcess's stdio to the SDK's web-stream transport (ndJsonStream)
|
|
10
|
-
* 2. mapping our loose `AcpHostRequestHandler` onto the typed SDK `Client` interface
|
|
11
|
-
* 3. translating SDK `session/update` notifications into qlogicagent's internal `turn.*` methods
|
|
12
|
-
*
|
|
13
|
-
* Extension capabilities (clientCapabilities.qlogicagent) are forwarded verbatim — the SDK does
|
|
14
|
-
* not strip outgoing params (validation runs only on the receiving side), so xiaozhiclaw interop is
|
|
15
|
-
* preserved.
|
|
16
|
-
*/
|
|
17
|
-
import type { ChildProcess } from "node:child_process";
|
|
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;
|
|
25
|
-
/**
|
|
26
|
-
* Handler for agent→host requests (fs, terminal, permission, elicitation).
|
|
27
|
-
* Host implementations should implement the methods they support. This is intentionally loose
|
|
28
|
-
* (Record-typed) — {@link AcpProtocolAdapter} bridges it onto the SDK's strongly-typed Client.
|
|
29
|
-
*/
|
|
30
|
-
export interface AcpHostRequestHandler {
|
|
31
|
-
/** Read a text file from the host filesystem. */
|
|
32
|
-
readTextFile?(params: {
|
|
33
|
-
path: string;
|
|
34
|
-
}): Promise<{
|
|
35
|
-
content: string;
|
|
36
|
-
} | undefined>;
|
|
37
|
-
/** Write a text file on the host filesystem. */
|
|
38
|
-
writeTextFile?(params: {
|
|
39
|
-
path: string;
|
|
40
|
-
content: string;
|
|
41
|
-
}): Promise<Record<string, unknown> | undefined>;
|
|
42
|
-
/** Request permission for a tool call. Returns the chosen option id (host responsibility). */
|
|
43
|
-
requestPermission?(params: Record<string, unknown>): Promise<{
|
|
44
|
-
optionId: string;
|
|
45
|
-
}>;
|
|
46
|
-
/** Elicitation request (ask user for input). */
|
|
47
|
-
elicitation?(params: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
48
|
-
/** Create a terminal session. */
|
|
49
|
-
createTerminal?(params: Record<string, unknown>): Promise<Record<string, unknown> | undefined>;
|
|
50
|
-
/** Terminal output data. */
|
|
51
|
-
terminalOutput?(params: Record<string, unknown>): Promise<Record<string, unknown> | undefined>;
|
|
52
|
-
/** Release a terminal. */
|
|
53
|
-
releaseTerminal?(params: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
54
|
-
/** Wait for terminal exit. */
|
|
55
|
-
waitForTerminalExit?(params: Record<string, unknown>): Promise<Record<string, unknown> | undefined>;
|
|
56
|
-
/** Kill a terminal. */
|
|
57
|
-
killTerminal?(params: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
58
|
-
/** Extension method (unknown method from agent). */
|
|
59
|
-
extMethod?(method: string, params: unknown): Promise<unknown>;
|
|
60
|
-
}
|
|
61
|
-
/** Internal representation of an ACP notification translated to qlogicagent format. */
|
|
62
|
-
export interface TranslatedNotification {
|
|
63
|
-
method: string;
|
|
64
|
-
params: Record<string, unknown>;
|
|
65
|
-
}
|
|
66
|
-
/** An auth method an agent advertises when it needs the user to log in (subset of ACP shape). */
|
|
67
|
-
export interface AcpAuthMethod {
|
|
68
|
-
id?: string;
|
|
69
|
-
name?: string;
|
|
70
|
-
description?: string;
|
|
71
|
-
/**
|
|
72
|
-
* ACP auth-method discriminator (when the agent follows the discriminated schema):
|
|
73
|
-
* - "agent" : the agent self-drives login (opens its own browser / prints a device code)
|
|
74
|
-
* - "env_var" : the user supplies a key — surface a key dialog (≈ userKey)
|
|
75
|
-
* - "terminal" : run an interactive login command (the agent's own `login` subcommand)
|
|
76
|
-
* Drives how the host routes the login affordance (see classifyAuthMethod). Absent on agents that
|
|
77
|
-
* don't tag their methods — those fall back to guide-only.
|
|
78
|
-
*/
|
|
79
|
-
type?: "agent" | "env_var" | "terminal" | string;
|
|
80
|
-
/** For a terminal-type method: the command + args the host runs to start the interactive login. */
|
|
81
|
-
args?: string[];
|
|
82
|
-
/** For a terminal-type method: extra env for the login command. */
|
|
83
|
-
env?: Record<string, string>;
|
|
84
|
-
}
|
|
85
|
-
/** How the host should surface a login for an advertised auth method (spec §7). */
|
|
86
|
-
export type AuthMethodRouting = "agent" | "key" | "terminal" | "guide";
|
|
87
|
-
/**
|
|
88
|
-
* Route an advertised auth method to the right login affordance:
|
|
89
|
-
* agent → drive the ACP `authenticate` request; env_var → open a key dialog (userKey); terminal →
|
|
90
|
-
* run the agent's interactive login command; otherwise guide-only (show the command, user runs it).
|
|
91
|
-
* Gating login on a concrete classified method (never a heuristic) prevents firing an uncompletable
|
|
92
|
-
* login (e.g. claude's key-only method) — spec §7 risk.
|
|
93
|
-
*/
|
|
94
|
-
export declare function classifyAuthMethod(method: AcpAuthMethod | undefined): AuthMethodRouting;
|
|
95
|
-
/**
|
|
96
|
-
* Thrown when an agent rejects session setup because the user must authenticate first — e.g. kimi
|
|
97
|
-
* returns -32000 "Authentication required" with a `kimi login` authMethod. Carries the agent's
|
|
98
|
-
* advertised authMethods and `retryable = false`, so the spawn layer surfaces it immediately (a
|
|
99
|
-
* missing login never heals by retrying) with an actionable message instead of a generic failure.
|
|
100
|
-
*/
|
|
101
|
-
export declare class AcpAuthRequiredError extends Error {
|
|
102
|
-
readonly retryable: false;
|
|
103
|
-
readonly authMethods: AcpAuthMethod[];
|
|
104
|
-
constructor(message: string, authMethods: AcpAuthMethod[]);
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Recognise the ACP "authentication required" failure (by code -32000, an authMethods payload, or
|
|
108
|
-
* message text) and convert it to an {@link AcpAuthRequiredError} whose message tells the user how
|
|
109
|
-
* to log in (from the agent's own authMethod description). Returns null for any other error.
|
|
110
|
-
*/
|
|
111
|
-
export declare function asAuthRequiredError(err: unknown, fallbackAuthMethods?: AcpAuthMethod[]): AcpAuthRequiredError | null;
|
|
112
|
-
export declare class AcpProtocolAdapter {
|
|
113
|
-
private conn;
|
|
114
|
-
private child;
|
|
115
|
-
private onNotification;
|
|
116
|
-
private hostHandler;
|
|
117
|
-
/** Sessions whose session/set_model FAILED — running on the agent's default model, not the managed one. */
|
|
118
|
-
private modelMismatches;
|
|
119
|
-
/**
|
|
120
|
-
* Attach to a child process's stdio for ACP communication.
|
|
121
|
-
* Constructs the official ClientSideConnection over the child's stdin/stdout. The connection's
|
|
122
|
-
* read loop starts immediately, so incoming notifications + reverse-RPC are live after this call.
|
|
123
|
-
*
|
|
124
|
-
* @param child The spawned ACP agent process
|
|
125
|
-
* @param onNotification Callback for agent notifications (raw method + params; caller translates)
|
|
126
|
-
* @param hostHandler Optional handler for agent→host requests (fs, terminal, permission)
|
|
127
|
-
*/
|
|
128
|
-
attach(child: ChildProcess, onNotification?: (method: string, params: unknown) => void, hostHandler?: AcpHostRequestHandler): void;
|
|
129
|
-
/**
|
|
130
|
-
* qlogicagent extends ACP `session/update` with an `x_*` variant namespace (x_relay, x_session_info, …) that the standard SDK schema does not model and therefore rejects. Detect
|
|
131
|
-
* those notifications on the read side and dispatch them to onNotification directly — bypassing the
|
|
132
|
-
* SDK's strict validation — so the host's usage/progress accumulation runs exactly as it does for the
|
|
133
|
-
* internal-agent path. Returns true when the message was consumed here (and must be hidden from the
|
|
134
|
-
* SDK); false for everything else (standard updates, requests, responses) which the SDK handles.
|
|
135
|
-
*/
|
|
136
|
-
private consumeExtensionNotification;
|
|
137
|
-
/**
|
|
138
|
-
* Build the SDK Client implementation (agent→host reverse-RPC) from our loose host handler.
|
|
139
|
-
* Re-reads this.hostHandler / this.onNotification on each call so detach() takes effect.
|
|
140
|
-
*/
|
|
141
|
-
private buildClient;
|
|
142
|
-
/** Detach from the child process. The SDK read loop ends when the child's stdout closes. */
|
|
143
|
-
detach(): void;
|
|
144
|
-
private requireConn;
|
|
145
|
-
/** Race a connection call against a timeout; optionally run a side effect (e.g. cancel) on timeout. */
|
|
146
|
-
private withTimeout;
|
|
147
|
-
private withActivityTimeout;
|
|
148
|
-
/**
|
|
149
|
-
* Perform the ACP initialize handshake. Sends standard clientInfo + clientCapabilities plus the
|
|
150
|
-
* qlogicagent extension capability (forwarded verbatim by the SDK).
|
|
151
|
-
*/
|
|
152
|
-
initialize(_child?: ChildProcess): Promise<AcpInitializeResult>;
|
|
153
|
-
/**
|
|
154
|
-
* Create an ACP session (session/new). A non-standard systemPrompt is forwarded under `_meta`
|
|
155
|
-
* (the ACP extension mechanism) so it survives validation on the agent side.
|
|
156
|
-
*/
|
|
157
|
-
createSession(_child: ChildProcess, options: {
|
|
158
|
-
cwd: string;
|
|
159
|
-
mcpServers?: McpServerConfig[];
|
|
160
|
-
additionalDirectories?: string[];
|
|
161
|
-
systemPrompt?: string;
|
|
162
|
-
/** Platform/managed model to select over ACP after session/new (see selectSessionModel). */
|
|
163
|
-
model?: string;
|
|
164
|
-
}): Promise<AcpSessionResult>;
|
|
165
|
-
/**
|
|
166
|
-
* Select the platform/managed model over ACP after session/new. External CLIs (notably
|
|
167
|
-
* claude-code-acp) default to their OWN model (e.g. Sonnet 4.5) and merely EXPOSE the injected
|
|
168
|
-
* ANTHROPIC_MODEL/OPENAI_MODEL as an "available" option — they do NOT select it. Left on the default,
|
|
169
|
-
* the first prompt fails ("issue with the selected model …") because the platform shelf has no such
|
|
170
|
-
* model, and it surfaces as a cryptic "Agent process stdio closed". Best-effort: when the agent
|
|
171
|
-
* advertised its models, only switch if it offers `desired` and isn't already on it; otherwise attempt
|
|
172
|
-
* anyway and swallow rejection (the session still exists on its default model — the wrong-model prompt
|
|
173
|
-
* error is the backstop). Uses the generic sendRequest because the SDK has no typed set_model yet.
|
|
174
|
-
*/
|
|
175
|
-
private selectSessionModel;
|
|
176
|
-
/**
|
|
177
|
-
* The recorded session/set_model failure for a session, if any — the session is alive but on
|
|
178
|
-
* the agent's DEFAULT model instead of the managed/platform one (wrong vendor/billing/capability).
|
|
179
|
-
*/
|
|
180
|
-
getModelMismatch(sessionId: string): {
|
|
181
|
-
desired: string;
|
|
182
|
-
error: string;
|
|
183
|
-
} | undefined;
|
|
184
|
-
/**
|
|
185
|
-
* Send a prompt to a running ACP session (session/prompt). Content streams back via session/update
|
|
186
|
-
* notifications during execution; the response carries only { stopReason, usage? }. On timeout the
|
|
187
|
-
* turn is cancelled (session/cancel) so the agent stops cleanly.
|
|
188
|
-
*/
|
|
189
|
-
sendPrompt(_child: ChildProcess, sessionId: string, content: string, timeoutInput?: AcpPromptTimeoutInput): Promise<AcpPromptResponse>;
|
|
190
|
-
/**
|
|
191
|
-
* Resume an existing ACP session (session/load — replays history via notifications).
|
|
192
|
-
* Only valid when the agent advertised the loadSession capability.
|
|
193
|
-
*/
|
|
194
|
-
resumeSession(_child: ChildProcess, sessionId: string, options?: {
|
|
195
|
-
cwd?: string;
|
|
196
|
-
mcpServers?: McpServerConfig[];
|
|
197
|
-
model?: string;
|
|
198
|
-
}): Promise<AcpSessionResult>;
|
|
199
|
-
/**
|
|
200
|
-
* Translate an ACP notification into qlogicagent's internal format.
|
|
201
|
-
* Returns null if the notification is not translatable (handled separately).
|
|
202
|
-
*
|
|
203
|
-
* Standard ACP: agent sends "session/update" with params { sessionId, update: { sessionUpdate, … } }.
|
|
204
|
-
* Used by both the external-agent path (this adapter) and the internal/builtin agent path, so it
|
|
205
|
-
* stays a pure static function decoupled from the connection.
|
|
206
|
-
*/
|
|
207
|
-
static translateNotification(method: string, params: unknown): TranslatedNotification | null;
|
|
208
|
-
}
|
|
209
|
-
export {};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ACP Usage Tracker — 3-tier token usage tracking for external ACP agents.
|
|
3
|
-
*
|
|
4
|
-
* Tier 1: Real-time `usage_update` notifications (preferred).
|
|
5
|
-
* Tier 2: Per-turn `PromptResponse.usage` fallback.
|
|
6
|
-
* Tier 3: Graceful degradation — no usage data, no budget enforcement.
|
|
7
|
-
*
|
|
8
|
-
* The tracker prevents double-counting when an agent sends both
|
|
9
|
-
* usage_update notifications AND prompt response usage.
|
|
10
|
-
*/
|
|
11
|
-
import type { AcpUsageUpdatePayload, AcpPromptResponseUsage } from "../../protocol/wire/acp-agent-management.js";
|
|
12
|
-
export interface AccumulatedUsage {
|
|
13
|
-
inputTokens: number;
|
|
14
|
-
outputTokens: number;
|
|
15
|
-
totalTokens: number;
|
|
16
|
-
cachedReadTokens: number;
|
|
17
|
-
thoughtTokens: number;
|
|
18
|
-
/** Total cost (USD), if reported. */
|
|
19
|
-
cost: number;
|
|
20
|
-
/** Whether at least one usage_update was received (Tier 1 active). */
|
|
21
|
-
hasTier1: boolean;
|
|
22
|
-
/** Number of turns processed (Tier 2 fallback). */
|
|
23
|
-
turnCount: number;
|
|
24
|
-
}
|
|
25
|
-
export declare class AcpUsageTracker {
|
|
26
|
-
private usage;
|
|
27
|
-
/**
|
|
28
|
-
* Tier 1: Handle a `usage_update` notification from ACP agent.
|
|
29
|
-
* Sets the hasTier1 flag to prevent double-counting from Tier 2.
|
|
30
|
-
*/
|
|
31
|
-
onUsageUpdate(payload: AcpUsageUpdatePayload): void;
|
|
32
|
-
/**
|
|
33
|
-
* Tier 2: Handle per-turn usage from PromptResponse.
|
|
34
|
-
* Only applied if Tier 1 is NOT active (prevents double-counting).
|
|
35
|
-
*/
|
|
36
|
-
onPromptResponseUsage(usage: AcpPromptResponseUsage | undefined): void;
|
|
37
|
-
/** Get the current accumulated usage snapshot. */
|
|
38
|
-
getUsage(): Readonly<AccumulatedUsage>;
|
|
39
|
-
/** Reset all counters. */
|
|
40
|
-
reset(): void;
|
|
41
|
-
/**
|
|
42
|
-
* Check whether we have any usage data.
|
|
43
|
-
* Returns false in Tier 3 (graceful degradation).
|
|
44
|
-
*/
|
|
45
|
-
hasData(): boolean;
|
|
46
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { HostCloudAuthClient } from "../../transport/host-cloud-auth-client.js";
|
|
2
|
-
/** Process-lifetime binding installed after ACP Host capability negotiation. */
|
|
3
|
-
export declare function configureHostCloudAuthAuthority(resolver: () => HostCloudAuthClient | undefined): void;
|
|
4
|
-
export declare function getHostCloudAuthAuthority(): HostCloudAuthClient | undefined;
|
|
@@ -1,20 +0,0 @@
|
|
|
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>;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { FeedbackEvent } from "./feedback-event-store.js";
|
|
2
|
-
type DistillableFeedback = Pick<FeedbackEvent, "feedbackId" | "rating" | "reason" | "state" | "sessionId" | "turnId">;
|
|
3
|
-
/** Minimum corroborating active events before a cluster becomes a proposal (mini-design §3.4). */
|
|
4
|
-
export declare const MIN_EVIDENCE = 2;
|
|
5
|
-
export interface FeedbackDistillationCandidate {
|
|
6
|
-
clusterKey: string;
|
|
7
|
-
/** Template preference sentence (dream LLM refines later — mini-design §9.3). */
|
|
8
|
-
text: string;
|
|
9
|
-
category: string;
|
|
10
|
-
importance: number;
|
|
11
|
-
confidence: number;
|
|
12
|
-
/** Audit trail + crash-safe idempotency, consumed by the extended proposeExtracted (§10). */
|
|
13
|
-
evidence: {
|
|
14
|
-
kind: "feedback";
|
|
15
|
-
refs: string[];
|
|
16
|
-
idempotencyKey: string;
|
|
17
|
-
};
|
|
18
|
-
/** Cluster diagnostics — not persisted as-is; surfaced for tests + logging. */
|
|
19
|
-
stats: {
|
|
20
|
-
evidence: number;
|
|
21
|
-
crossSession: boolean;
|
|
22
|
-
feedbackIds: string[];
|
|
23
|
-
turnIds: string[];
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Cluster a project's feedback events into proposal candidates. Only active events count
|
|
28
|
-
* (retracted / replaced are filtered — §11.1). Clusters below MIN_EVIDENCE are dropped. Output is
|
|
29
|
-
* sorted by clusterKey for deterministic ordering across runs.
|
|
30
|
-
*/
|
|
31
|
-
export declare function distillFeedback(events: DistillableFeedback[]): FeedbackDistillationCandidate[];
|
|
32
|
-
export {};
|
|
@@ -1,179 +0,0 @@
|
|
|
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 interface FeedbackSummary {
|
|
103
|
-
total: number;
|
|
104
|
-
active: number;
|
|
105
|
-
retracted: number;
|
|
106
|
-
replaced: number;
|
|
107
|
-
upCount: number;
|
|
108
|
-
downCount: number;
|
|
109
|
-
byReason: Record<string, number>;
|
|
110
|
-
byModel: Record<string, number>;
|
|
111
|
-
byAgentMode: Record<string, number>;
|
|
112
|
-
telemetryStatusCounts: Record<TelemetryStatus, number>;
|
|
113
|
-
}
|
|
114
|
-
export declare function hashMessageContent(content: string): string;
|
|
115
|
-
/**
|
|
116
|
-
* Create / switch / re-activate the feedback for a turn. Returns the stable feedbackId and the
|
|
117
|
-
* resulting state. Submitting the SAME rating while already active is a no-op (idempotent retry).
|
|
118
|
-
*/
|
|
119
|
-
export declare function submitFeedback(input: FeedbackSubmitInput): Promise<{
|
|
120
|
-
feedbackId: string;
|
|
121
|
-
state: FeedbackState;
|
|
122
|
-
}>;
|
|
123
|
-
/**
|
|
124
|
-
* Retract the active feedback for a turn (the frontend calls this when the user re-clicks the
|
|
125
|
-
* already-selected button). Idempotent: retracting when there is nothing active is a no-op.
|
|
126
|
-
*/
|
|
127
|
-
export declare function retractFeedback(input: {
|
|
128
|
-
projectId: string;
|
|
129
|
-
turnId: string;
|
|
130
|
-
feedbackId?: string;
|
|
131
|
-
}): Promise<{
|
|
132
|
-
ok: boolean;
|
|
133
|
-
feedbackId?: string;
|
|
134
|
-
state: FeedbackState | null;
|
|
135
|
-
}>;
|
|
136
|
-
/**
|
|
137
|
-
* Hydrate feedback state for a session's messages (initial render / refresh). Returns only ACTIVE
|
|
138
|
-
* feedback (absent = not rated) — the fixed contract per design §8.3, so the UI never has to
|
|
139
|
-
* interpret retracted/replaced records.
|
|
140
|
-
*/
|
|
141
|
-
export declare function getFeedbackState(input: {
|
|
142
|
-
projectId: string;
|
|
143
|
-
sessionId: string;
|
|
144
|
-
turnIds?: string[];
|
|
145
|
-
assistantMessageIds?: string[];
|
|
146
|
-
}): Promise<{
|
|
147
|
-
states: FeedbackStateEntry[];
|
|
148
|
-
}>;
|
|
149
|
-
/** Local single-instance aggregate used by messageFeedback.summary. Raw message text is not returned. */
|
|
150
|
-
export declare function summarizeFeedback(input: {
|
|
151
|
-
projectId: string;
|
|
152
|
-
sessionId?: string;
|
|
153
|
-
since?: string;
|
|
154
|
-
until?: string;
|
|
155
|
-
}): Promise<FeedbackSummary>;
|
|
156
|
-
/**
|
|
157
|
-
* Events eligible for cloud upload that have not yet been assigned to a batch (design §10). The
|
|
158
|
-
* worker redacts + ships these; once assigned a batchId (delivered or queued for retry) they are
|
|
159
|
-
* skipped until a state change resets the upload marks.
|
|
160
|
-
*/
|
|
161
|
-
export declare function listUploadableFeedback(projectId: string): Promise<FeedbackEvent[]>;
|
|
162
|
-
/** Mark an event as assigned to an in-flight upload batch (queued for retry, not yet delivered). */
|
|
163
|
-
export declare function assignFeedbackBatch(projectId: string, turnId: string, uploadBatchId: string): Promise<void>;
|
|
164
|
-
/** Mark an event as successfully uploaded (stamps uploadedAt + batch + redactionVersion). */
|
|
165
|
-
export declare function markFeedbackUploaded(projectId: string, turnId: string, uploadBatchId: string, redactionVersion: string): Promise<void>;
|
|
166
|
-
/**
|
|
167
|
-
* Active feedback eligible for memory distillation (mini-design §3.1). Distillation re-clusters the
|
|
168
|
-
* full active set every sweep; the store-level idempotency key (not a per-event flag) prevents
|
|
169
|
-
* duplicate proposals, so this intentionally returns ALL active events — already distilled or not.
|
|
170
|
-
* A newly added active event simply changes a cluster's id set and yields a fresh proposal.
|
|
171
|
-
*/
|
|
172
|
-
export declare function listDistillableFeedback(projectId: string): Promise<FeedbackEvent[]>;
|
|
173
|
-
/** Stamp local distillation bookkeeping on an event (which cluster + idempotency key folded it in). */
|
|
174
|
-
export declare function markFeedbackDistilled(projectId: string, turnId: string, info: {
|
|
175
|
-
clusterKey: string;
|
|
176
|
-
idempotencyKey: string;
|
|
177
|
-
}): Promise<void>;
|
|
178
|
-
/** Test helper: read the raw stored event for a turn (including retracted), or null. */
|
|
179
|
-
export declare function __getFeedbackEventForTest(projectId: string, turnId: string): Promise<FeedbackEvent | null>;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { HostFeedbackClient } from "../../transport/host-feedback-client.js";
|
|
2
|
-
/** Process-lifetime binding installed by stdio-server after ACP initialize capability negotiation. */
|
|
3
|
-
export declare function configureHostFeedbackAuthority(resolver: () => HostFeedbackClient | undefined): void;
|
|
4
|
-
export declare function getHostFeedbackAuthority(): HostFeedbackClient | undefined;
|
|
@@ -1,26 +0,0 @@
|
|
|
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[]>;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { FeedbackEvent, FeedbackRating, FeedbackReason, FeedbackState, FeedbackToolSummary, FeedbackUsage, TelemetryStatus } from "./feedback-event-store.js";
|
|
2
|
-
/** Bump when the redaction rules change so uploaded samples stay traceable (§8.6/§13). */
|
|
3
|
-
export declare const REDACTION_VERSION = "feedback-redaction-v1";
|
|
4
|
-
export interface RedactedFeedbackEvent {
|
|
5
|
-
feedbackId: string;
|
|
6
|
-
rating: FeedbackRating;
|
|
7
|
-
reason?: FeedbackReason;
|
|
8
|
-
state: FeedbackState;
|
|
9
|
-
/** Hashed identity — correlate without exposing local ids (§8.6). */
|
|
10
|
-
messageHash: string;
|
|
11
|
-
sessionIdHash: string;
|
|
12
|
-
projectIdHash?: string;
|
|
13
|
-
turnIdHash: string;
|
|
14
|
-
/** ≤500 chars, secrets/emails/absolute-paths scrubbed (§13). */
|
|
15
|
-
messagePreview: string;
|
|
16
|
-
model?: string;
|
|
17
|
-
provider?: string;
|
|
18
|
-
agentMode?: FeedbackEvent["agentMode"];
|
|
19
|
-
sourceChannel?: string;
|
|
20
|
-
usage?: FeedbackUsage;
|
|
21
|
-
/** Tool names only (never args). */
|
|
22
|
-
toolSummary?: FeedbackToolSummary;
|
|
23
|
-
fileContext?: {
|
|
24
|
-
changedFileCount?: number;
|
|
25
|
-
hasTurnFileChanges?: boolean;
|
|
26
|
-
diffOpenState?: "not_applicable" | "opened" | "failed" | "unknown";
|
|
27
|
-
};
|
|
28
|
-
browserContext?: {
|
|
29
|
-
hadToastError?: boolean;
|
|
30
|
-
visiblePanel?: "chat" | "artifact" | "diff" | "unknown";
|
|
31
|
-
};
|
|
32
|
-
telemetryStatus: TelemetryStatus;
|
|
33
|
-
redactionVersion: string;
|
|
34
|
-
createdAt: string;
|
|
35
|
-
}
|
|
36
|
-
export interface FeedbackRollup {
|
|
37
|
-
rollupId: string;
|
|
38
|
-
periodStart: string;
|
|
39
|
-
periodEnd: string;
|
|
40
|
-
total: number;
|
|
41
|
-
upCount: number;
|
|
42
|
-
downCount: number;
|
|
43
|
-
/** Down-vote reason → count. */
|
|
44
|
-
byReason: Record<string, number>;
|
|
45
|
-
byModel: Record<string, {
|
|
46
|
-
up: number;
|
|
47
|
-
down: number;
|
|
48
|
-
}>;
|
|
49
|
-
byAgentMode: Record<string, {
|
|
50
|
-
up: number;
|
|
51
|
-
down: number;
|
|
52
|
-
}>;
|
|
53
|
-
telemetryStatusCounts: {
|
|
54
|
-
complete: number;
|
|
55
|
-
partial: number;
|
|
56
|
-
missing: number;
|
|
57
|
-
};
|
|
58
|
-
redactionVersion: string;
|
|
59
|
-
createdAt: string;
|
|
60
|
-
}
|
|
61
|
-
/** Truncate to the preview limit and scrub api keys / emails / absolute paths (§13). */
|
|
62
|
-
export declare function sanitizePreview(text: string): string;
|
|
63
|
-
/** Map a local feedback event to its upload-safe redacted form (§8.6/§13). */
|
|
64
|
-
export declare function redactFeedbackEvent(event: FeedbackEvent, redactionVersion?: string): RedactedFeedbackEvent;
|
|
65
|
-
/** Pre-aggregate a batch of local events into a rollup for low-cost trend upload (§10). */
|
|
66
|
-
export declare function aggregateFeedbackRollup(events: FeedbackEvent[], input: {
|
|
67
|
-
rollupId: string;
|
|
68
|
-
periodStart: string;
|
|
69
|
-
periodEnd: string;
|
|
70
|
-
redactionVersion?: string;
|
|
71
|
-
}): FeedbackRollup;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Feedback upload client — the single HTTP exit that ships redacted feedback to the llmrouter
|
|
3
|
-
* feedback backend (design §8.6, §9.1 rule 4). The redaction worker calls this directly; the
|
|
4
|
-
* messageFeedback.uploadBatch RPC wraps it for manual/test triggers.
|
|
5
|
-
*
|
|
6
|
-
* Transport mirrors the usage client: append the route to the llmrouter base already injected into
|
|
7
|
-
* the agent (QLOGIC_LLMROUTER_BASE_URL, e.g. https://www.qlogicagent.com/api) and authenticate with
|
|
8
|
-
* the injected Bearer QLOGIC_LLMROUTER_ACCESS_TOKEN. Feedback lands at <base>/client/feedback, so a
|
|
9
|
-
* batch POSTs to <base>/client/feedback/uploadBatch — the contract the llmrouter ingest endpoint
|
|
10
|
-
* (Phase 3b) implements. No dedicated feedback env: one llmrouter base, like /client/usage.
|
|
11
|
-
*/
|
|
12
|
-
import type { FeedbackRollup, RedactedFeedbackEvent } from "./feedback-redaction.js";
|
|
13
|
-
export interface UploadBatchInput {
|
|
14
|
-
batchId: string;
|
|
15
|
-
events: RedactedFeedbackEvent[];
|
|
16
|
-
rollups: FeedbackRollup[];
|
|
17
|
-
redactionVersion: string;
|
|
18
|
-
clientBuild?: string;
|
|
19
|
-
runtimeVersion?: string;
|
|
20
|
-
qlogicagentVersion?: string;
|
|
21
|
-
}
|
|
22
|
-
export interface UploadBatchResult {
|
|
23
|
-
ok: boolean;
|
|
24
|
-
accepted?: number;
|
|
25
|
-
status?: number;
|
|
26
|
-
error?: string;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Resolve the feedback ingest base, derived from the llmrouter base already injected into the agent
|
|
30
|
-
* (QLOGIC_LLMROUTER_BASE_URL), mirroring how the usage client reaches /client/usage. Returns
|
|
31
|
-
* undefined when llmrouter is not configured.
|
|
32
|
-
*/
|
|
33
|
-
export declare function resolveFeedbackUploadBaseUrl(): string | undefined;
|
|
34
|
-
/**
|
|
35
|
-
* Ship one redacted batch to llmrouter. Fail-soft: an unconfigured base or a transport/HTTP error
|
|
36
|
-
* returns { ok: false }, so the caller (worker) keeps the events eligible and queues a retry rather
|
|
37
|
-
* than dropping feedback. Idempotent at the server by batchId + event id (§9.1 rule 5).
|
|
38
|
-
*/
|
|
39
|
-
export declare function uploadFeedbackBatch(input: UploadBatchInput, signal?: AbortSignal): Promise<UploadBatchResult>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface FeedbackSweepResult {
|
|
2
|
-
uploaded: number;
|
|
3
|
-
queued: number;
|
|
4
|
-
retried: number;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* One feedback upload sweep for a project. Retries due outbox batches, then redacts + ships any
|
|
8
|
-
* newly uploadable events. Fail-soft: a failed upload is queued in the outbox (its events assigned
|
|
9
|
-
* the batchId so they are not re-picked) and retried on a later sweep with backoff.
|
|
10
|
-
*/
|
|
11
|
-
export declare function runFeedbackUploadSweep(projectId: string, now?: Date): Promise<FeedbackSweepResult>;
|