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,235 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HostMemoryProvider —— qlogicagent 通过 Host request 访问 Host-owned memories.db。
|
|
3
|
-
*
|
|
4
|
-
* Gateway Memory 权威公开面的 **proxy 实现**:大脑逻辑(dream/distill/晋升/consolidation/召回 hook)
|
|
5
|
-
* 零改动,底下的存取经 `x/host.request`(HostRequestClient)打到 gateway 四权威 host 服务(memory 域),
|
|
6
|
-
* store(memories.db)只有 gateway 进程打开。
|
|
7
|
-
*
|
|
8
|
-
* 契约权威:host-contract §13
|
|
9
|
-
* (HostRequestParams;wire 形态 = { service:"memory", method, params:<位置参数数组> })。
|
|
10
|
-
*
|
|
11
|
-
* 【PROXY 共享面(以 host-contract 常量为准;两仓照此表,一字不差)】
|
|
12
|
-
* search / embedText / ingestExtracted / proposeExtracted / consumePendingProposals /
|
|
13
|
-
* feedback / findRelatedEvents / synthesizeTimeline / getActivitySummary / getAllProfiles /
|
|
14
|
-
* setProfile / getAtlas / setMemoryArchived / triggerDecay / resolveConflicts
|
|
15
|
-
* [A9] 追加 listActiveMemoriesByTag(晋升扫描全量列举;无窗/无 clamp/无上限)。
|
|
16
|
-
* [A10] 追加 readDistilledProcedure / promoteDistilledProcedure / demoteDistilledProcedure
|
|
17
|
-
* (精确恢复读与升/降格窄 Saga;幂等/补偿/续跑在 Host)。
|
|
18
|
-
* [A7] 追加 recordInjectedAccess(注入后记账:search 去记账后 access_count 的唯一召回侧写点)。
|
|
19
|
-
* 后台提取交接由 enqueue/list/complete/failure 四法持久化;重启不丢完成回合。
|
|
20
|
-
*
|
|
21
|
-
* 面外方法 = fail-loud throw(护栏抓漏):gate 开时 UI RPC 面(atlas 富查询/update/attachments/
|
|
22
|
-
* proposals 消费等)由 gateway host-native 应答,**不该**再落到 qla 的 provider;到达此处 = 路由/
|
|
23
|
-
* wiring bug,绝不静默回落本地(静默回落 = 本进程再开 memories.db = 双权威,正是本工程消灭的形态)。
|
|
24
|
-
*
|
|
25
|
-
* 【单进程铁则】选型本 provider 后,本进程绝不打开 memories.db(零 better-sqlite3 memory 路径引用);
|
|
26
|
-
* userId 参数原样透传(多租户前缀语义归 gateway store-owner)。
|
|
27
|
-
* 纪律:fail-loud;单轨(创建时刻一次选型,非每调用分支);零 mock。
|
|
28
|
-
*/
|
|
29
|
-
import type { HostMemoryExtractionTurnInput, HostPendingMemoryExtractionTurn, HostRequestParams } from "../../host-contract/index.js";
|
|
30
|
-
import type { CandidateStoreFile, ProcedureUsageStoreFile, PromotionStoreFile } from "./task-distillation.js";
|
|
31
|
-
import type { MemoryActivitySummary, MemoryAtlasResult, MemoryConsolidationWriteResult, MemoryDreamRuntimeProvider, MemoryExtractionItem, MemoryHandlerProvider, MemoryIngestOptions, MemoryLearningSink, MemoryExtractionQueue, MemoryRuntimeHookProvider, MemorySearchOptions, MemorySearchResult } from "../../runtime/ports/index.js";
|
|
32
|
-
/**
|
|
33
|
-
* 最小转发口(结构化契约,由 coordinator-owned HostRequestClient 满足)。
|
|
34
|
-
* 只取 request 一个方法:provider 不持有判活/连接生命周期(那归协议 coordinator/client)。
|
|
35
|
-
*/
|
|
36
|
-
export interface HostRequestRequester {
|
|
37
|
-
request(params: HostRequestParams, opts?: {
|
|
38
|
-
timeoutMs?: number;
|
|
39
|
-
signal?: AbortSignal;
|
|
40
|
-
}): Promise<unknown>;
|
|
41
|
-
}
|
|
42
|
-
export interface HostMemoryProviderConfig {
|
|
43
|
-
/** x/host.request client; its service gate runs before send. */
|
|
44
|
-
client: HostRequestRequester;
|
|
45
|
-
}
|
|
46
|
-
export declare class HostMemoryProvider implements MemoryRuntimeHookProvider, MemoryExtractionQueue, MemoryLearningSink, MemoryHandlerProvider, MemoryDreamRuntimeProvider {
|
|
47
|
-
private readonly config;
|
|
48
|
-
readonly providerId = "qmemory-host";
|
|
49
|
-
constructor(config: HostMemoryProviderConfig);
|
|
50
|
-
/**
|
|
51
|
-
* 全部 memory proxy 方法统一转发:wire 形态 = { service:"memory", method, params:<位置参数数组> }(契约 §13)。
|
|
52
|
-
* 尾部 undefined 剔除:JSON 会把数组里的 undefined 序列化成 null,gateway 侧按位展开时
|
|
53
|
-
* null ≠ undefined 会击穿方法默认参(如 days=7)——省略实参才能让默认参生效。
|
|
54
|
-
*/
|
|
55
|
-
private forward;
|
|
56
|
-
/** 面外方法护栏:fail-loud,绝不静默回落本地(见文件头)。 */
|
|
57
|
-
private unproxied;
|
|
58
|
-
search(query: string, userId: string, options?: MemorySearchOptions): Promise<MemorySearchResult[]>;
|
|
59
|
-
/** R3 蒸馏签名 embedding(gateway 调 llmrouter 现算);null = 不可用,调用方降级不炸。 */
|
|
60
|
-
embedText(text: string, signal?: AbortSignal): Promise<number[] | null>;
|
|
61
|
-
ingestExtracted(items: MemoryExtractionItem[], userId: string, options?: MemoryIngestOptions): Promise<MemoryConsolidationWriteResult>;
|
|
62
|
-
proposeExtracted(items: MemoryExtractionItem[], userId: string, options?: MemoryIngestOptions): Promise<MemoryConsolidationWriteResult>;
|
|
63
|
-
enqueueExtractionTurn(input: HostMemoryExtractionTurnInput, userId: string): Promise<{
|
|
64
|
-
jobId: string;
|
|
65
|
-
created: boolean;
|
|
66
|
-
}>;
|
|
67
|
-
claimPendingExtractionTurns(userId: string, workerId: string, options?: {
|
|
68
|
-
limit?: number;
|
|
69
|
-
leaseMs?: number;
|
|
70
|
-
}): Promise<HostPendingMemoryExtractionTurn[]>;
|
|
71
|
-
completeExtractionTurn(jobId: string, userId: string, workerId: string): Promise<{
|
|
72
|
-
deleted: boolean;
|
|
73
|
-
}>;
|
|
74
|
-
releaseExtractionTurn(jobId: string, userId: string, workerId: string): Promise<{
|
|
75
|
-
released: boolean;
|
|
76
|
-
}>;
|
|
77
|
-
recordExtractionTurnFailure(jobId: string, userId: string, workerId: string, error: string): Promise<{
|
|
78
|
-
updated: boolean;
|
|
79
|
-
}>;
|
|
80
|
-
consumePendingProposals(userId: string, opts?: {
|
|
81
|
-
now?: number;
|
|
82
|
-
ttlMs?: number;
|
|
83
|
-
maxCommitsPerPass?: number;
|
|
84
|
-
}): Promise<{
|
|
85
|
-
committed: number;
|
|
86
|
-
merged: number;
|
|
87
|
-
expiredIds: string[];
|
|
88
|
-
pendingLeft: number;
|
|
89
|
-
}>;
|
|
90
|
-
feedback(memoryIds: string[], signal: "useful" | "irrelevant" | "outdated" | "wrong", context?: {
|
|
91
|
-
sessionId?: string;
|
|
92
|
-
silent?: boolean;
|
|
93
|
-
}): Promise<{
|
|
94
|
-
affected: number;
|
|
95
|
-
}>;
|
|
96
|
-
findRelatedEvents(text: string, userId: string, options?: {
|
|
97
|
-
maxDaysBack?: number;
|
|
98
|
-
minSimilarity?: number;
|
|
99
|
-
maxSimilarity?: number;
|
|
100
|
-
limit?: number;
|
|
101
|
-
}): Promise<Array<{
|
|
102
|
-
id: string;
|
|
103
|
-
text: string;
|
|
104
|
-
score: number;
|
|
105
|
-
date: string;
|
|
106
|
-
}>>;
|
|
107
|
-
synthesizeTimeline(userId: string, startMs: number, endMs: number): Promise<string>;
|
|
108
|
-
getActivitySummary(userId: string, days?: number): Promise<MemoryActivitySummary>;
|
|
109
|
-
getAllProfiles(userId: string): Promise<Record<string, string>>;
|
|
110
|
-
setProfile(userId: string, key: string, value: string): Promise<void>;
|
|
111
|
-
getAtlas(userId: string, options?: {
|
|
112
|
-
pageSize?: number;
|
|
113
|
-
windowStartAt?: number;
|
|
114
|
-
windowEndAt?: number;
|
|
115
|
-
windowCenterAt?: number;
|
|
116
|
-
bucketCount?: number;
|
|
117
|
-
clusterLimit?: number;
|
|
118
|
-
activeOnly?: boolean;
|
|
119
|
-
}): Promise<MemoryAtlasResult>;
|
|
120
|
-
setMemoryArchived(memoryId: string, archived: boolean): Promise<boolean>;
|
|
121
|
-
triggerDecay(userId: string): Promise<{
|
|
122
|
-
decayed: number;
|
|
123
|
-
}>;
|
|
124
|
-
resolveConflicts(userId: string, opts?: {
|
|
125
|
-
minEvidenceToPromote?: number;
|
|
126
|
-
}): Promise<{
|
|
127
|
-
conflictsResolved: number;
|
|
128
|
-
claimsPromoted: number;
|
|
129
|
-
}>;
|
|
130
|
-
readProcedureUsage(): Promise<ProcedureUsageStoreFile>;
|
|
131
|
-
writeProcedureUsage(store: ProcedureUsageStoreFile): Promise<void>;
|
|
132
|
-
readDistillCandidates(): Promise<CandidateStoreFile>;
|
|
133
|
-
writeDistillCandidates(store: CandidateStoreFile): Promise<void>;
|
|
134
|
-
readPromotionProposals(): Promise<PromotionStoreFile>;
|
|
135
|
-
writePromotionProposals(store: PromotionStoreFile): Promise<void>;
|
|
136
|
-
/** [A9] 晋升扫描全量列举:owner 活跃(未归档)记忆中标签含 tag 的行,无时间窗、
|
|
137
|
-
* 无页 clamp、无静默上限,created_at 升序(getAtlas 分页会让老配方掉出扫描)。 */
|
|
138
|
-
listActiveMemoriesByTag(userId: string, tag: string): Promise<Array<{
|
|
139
|
-
id: string;
|
|
140
|
-
text: string;
|
|
141
|
-
accessCount: number;
|
|
142
|
-
importance: number;
|
|
143
|
-
}>>;
|
|
144
|
-
readDistilledProcedure(userId: string, procedureId: string, tag: string): Promise<{
|
|
145
|
-
id: string;
|
|
146
|
-
text: string;
|
|
147
|
-
accessCount: number;
|
|
148
|
-
importance: number;
|
|
149
|
-
isArchived: boolean;
|
|
150
|
-
} | null>;
|
|
151
|
-
/** [A10] 升格窄 Saga(Host 协调):create+verify → archive → proposal accepted 三步
|
|
152
|
-
* 横跨 Capability/Memory 两个 Host 存储,幂等(procedureId+确定性 skillName)、逐步
|
|
153
|
-
* 补偿、崩溃续跑全在 Host;大脑只做推理与提案后单调此法。 */
|
|
154
|
-
promoteDistilledProcedure(input: {
|
|
155
|
-
procedureId: string;
|
|
156
|
-
skillName: string;
|
|
157
|
-
content: string;
|
|
158
|
-
title: string;
|
|
159
|
-
accessCount: number;
|
|
160
|
-
auto: boolean;
|
|
161
|
-
}): Promise<{
|
|
162
|
-
outcome: "completed" | "already-completed";
|
|
163
|
-
skillName: string;
|
|
164
|
-
steps: {
|
|
165
|
-
skillCreated: boolean;
|
|
166
|
-
memoryArchived: boolean;
|
|
167
|
-
proposalAccepted: boolean;
|
|
168
|
-
};
|
|
169
|
-
}>;
|
|
170
|
-
demoteDistilledProcedure(input: {
|
|
171
|
-
procedureId: string;
|
|
172
|
-
}): Promise<{
|
|
173
|
-
outcome: "completed" | "already-completed";
|
|
174
|
-
skillName: string;
|
|
175
|
-
steps: {
|
|
176
|
-
skillDeleted: boolean;
|
|
177
|
-
memoryUnarchived: boolean;
|
|
178
|
-
proposalReverted: boolean;
|
|
179
|
-
};
|
|
180
|
-
}>;
|
|
181
|
-
/** [A7] 注入后访问记账:上报本轮真实进 prompt 的 L2 id 集(memory.after_recall 的
|
|
182
|
-
* post-cap 名单)。Host 是 access_count/last_accessed_at 的唯一写者;search() 已不再
|
|
183
|
-
* 命中即记 —— 漏调此法只会低估复用,绝不虚增。 */
|
|
184
|
-
recordInjectedAccess(memoryIds: string[], userId: string, context?: {
|
|
185
|
-
sessionId: string;
|
|
186
|
-
turnId: string;
|
|
187
|
-
}): Promise<{
|
|
188
|
-
affected: number;
|
|
189
|
-
}>;
|
|
190
|
-
recordRecallOutcome(userId: string, input: {
|
|
191
|
-
sessionId: string;
|
|
192
|
-
turnId: string;
|
|
193
|
-
event: "used" | "helped" | "harmed" | "unattributed";
|
|
194
|
-
}): Promise<{
|
|
195
|
-
affected: number;
|
|
196
|
-
}>;
|
|
197
|
-
/** 本 provider 不持有 db 句柄/文件资源;close 为 no-op(shutdown 链 closeMemoryProviders 会调)。 */
|
|
198
|
-
close(): void;
|
|
199
|
-
remove(_memoryId: string): never;
|
|
200
|
-
update(_memoryId: string, _input: unknown): never;
|
|
201
|
-
observeExtracted(_items: MemoryExtractionItem[], _userId: string, _options?: MemoryIngestOptions): never;
|
|
202
|
-
listPendingProposals(_userId: string, _limit?: number, _status?: "pending" | "expired"): never;
|
|
203
|
-
resolveProposal(_userId: string, _proposalId: string, _action: "confirm" | "dismiss"): never;
|
|
204
|
-
listClaims(_userId: string): never;
|
|
205
|
-
listConflicts(_userId: string): never;
|
|
206
|
-
getProfile(_userId: string, _key: string): never;
|
|
207
|
-
deleteProfile(_userId: string, _key: string): never;
|
|
208
|
-
getTemporalSlice(_userId: string, _startMs: number, _endMs: number, _options?: {
|
|
209
|
-
category?: string;
|
|
210
|
-
limit?: number;
|
|
211
|
-
}): never;
|
|
212
|
-
list(_userId: string, _options?: {
|
|
213
|
-
page?: number;
|
|
214
|
-
pageSize?: number;
|
|
215
|
-
activeOnly?: boolean;
|
|
216
|
-
}): never;
|
|
217
|
-
listMemoriesByTag(_userId: string, _tag: string): never;
|
|
218
|
-
rerank(_results: unknown[], _options?: unknown): never;
|
|
219
|
-
health(): never;
|
|
220
|
-
count(_userId: string): never;
|
|
221
|
-
resetUser(_userId: string): never;
|
|
222
|
-
adoptAttachment(_input: {
|
|
223
|
-
data?: Buffer;
|
|
224
|
-
sourceUrl?: string;
|
|
225
|
-
filename: string;
|
|
226
|
-
mimeType: string;
|
|
227
|
-
userId: string;
|
|
228
|
-
}): never;
|
|
229
|
-
locateAttachment(_id: string): never;
|
|
230
|
-
purgeOrphanAttachments(): never;
|
|
231
|
-
readAttachmentBytes(_id: string): never;
|
|
232
|
-
setAttachmentText(_id: string, _text: string): never;
|
|
233
|
-
}
|
|
234
|
-
/** Host Memory proxy 工厂。 */
|
|
235
|
-
export declare function createHostMemoryProvider(config: HostMemoryProviderConfig): HostMemoryProvider;
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/** Max bytes (UTF-8) for INDEX.md to inject into system prompt. */
|
|
2
|
-
export declare const INDEX_MAX_CHARS = 12288;
|
|
3
|
-
/** Max lines for INDEX.md injection. */
|
|
4
|
-
export declare const INDEX_MAX_LINES = 200;
|
|
5
|
-
/** Max chars for a single topic file. */
|
|
6
|
-
export declare const TOPIC_FILE_MAX_CHARS = 8192;
|
|
7
|
-
/** Root directory: <project>/.qlogicagent/memory/ */
|
|
8
|
-
export declare function getMemdirPath(projectRoot: string): string;
|
|
9
|
-
/** Global-layer size budget: a cheat-sheet, not a memory store. */
|
|
10
|
-
export declare const USER_INDEX_MAX_CHARS = 2048;
|
|
11
|
-
export declare const USER_INDEX_MAX_LINES = 40;
|
|
12
|
-
/** Full path to the user-level global INDEX.md (owner profile scoped). */
|
|
13
|
-
export declare function getUserIndexPath(): string;
|
|
14
|
-
/** Read the global layer for prompt injection, capped by the cheat-sheet budget.
|
|
15
|
-
* Returns null when absent/empty — the section simply doesn't render. */
|
|
16
|
-
export declare function readUserIndexForPrompt(): string | null;
|
|
17
|
-
export interface MemdirFileInfo {
|
|
18
|
-
name: string;
|
|
19
|
-
/** Size in bytes */
|
|
20
|
-
size: number;
|
|
21
|
-
/** Last modified ISO timestamp */
|
|
22
|
-
modifiedAt: string;
|
|
23
|
-
/** First non-empty line (preview) */
|
|
24
|
-
preview?: string;
|
|
25
|
-
}
|
|
26
|
-
export interface MemdirResult {
|
|
27
|
-
ok: boolean;
|
|
28
|
-
message: string;
|
|
29
|
-
/** File path relative to memdir */
|
|
30
|
-
file?: string;
|
|
31
|
-
/** Current INDEX.md char usage */
|
|
32
|
-
indexUsage?: string;
|
|
33
|
-
}
|
|
34
|
-
export { isMemoryContentSafe } from "./memory-content-safety.js";
|
|
35
|
-
export declare class Memdir {
|
|
36
|
-
private readonly root;
|
|
37
|
-
constructor(projectRoot: string);
|
|
38
|
-
/** Get the root directory path of this MEMDIR. */
|
|
39
|
-
getRootPath(): string;
|
|
40
|
-
/** Ensure memdir exists with a default INDEX.md if missing. */
|
|
41
|
-
ensureInitialized(): void;
|
|
42
|
-
/**
|
|
43
|
-
* Get INDEX.md content for system prompt injection.
|
|
44
|
-
* Truncated to INDEX_MAX_CHARS / INDEX_MAX_LINES.
|
|
45
|
-
*/
|
|
46
|
-
getIndexForPrompt(): string;
|
|
47
|
-
/** Get raw INDEX.md content (untruncated). */
|
|
48
|
-
getIndexRaw(): string;
|
|
49
|
-
/** Get INDEX.md usage stats. */
|
|
50
|
-
getIndexUsage(): {
|
|
51
|
-
chars: number;
|
|
52
|
-
lines: number;
|
|
53
|
-
percent: number;
|
|
54
|
-
};
|
|
55
|
-
/** Append a line/entry to INDEX.md. */
|
|
56
|
-
addToIndex(content: string): Promise<MemdirResult>;
|
|
57
|
-
/**
|
|
58
|
-
* Auto-compact INDEX.md by removing oldest non-structural entries to make room.
|
|
59
|
-
* Returns the compacted content with the new entry appended, or null if impossible.
|
|
60
|
-
*
|
|
61
|
-
* Entry-aware: removes complete logical entries (a non-indented line plus its
|
|
62
|
-
* continuation lines that start with whitespace/'-') to avoid half-entries.
|
|
63
|
-
*/
|
|
64
|
-
private autoCompactIndex;
|
|
65
|
-
/** Replace text in INDEX.md (str_replace semantics). */
|
|
66
|
-
replaceInIndex(oldText: string, newText: string): Promise<MemdirResult>;
|
|
67
|
-
/** Remove text from INDEX.md. */
|
|
68
|
-
removeFromIndex(oldText: string): Promise<MemdirResult>;
|
|
69
|
-
/** List all memory files (excluding INDEX.md). */
|
|
70
|
-
listFiles(): Promise<MemdirFileInfo[]>;
|
|
71
|
-
/** Create a new topic file. Fails if it already exists. */
|
|
72
|
-
createFile(name: string, content: string): Promise<MemdirResult>;
|
|
73
|
-
/** Write/overwrite a topic file. Auto-splits if content > 8KB. */
|
|
74
|
-
writeFile(name: string, content: string): Promise<MemdirResult>;
|
|
75
|
-
/**
|
|
76
|
-
* Auto-split: write oversized content into numbered part files.
|
|
77
|
-
* e.g. "lesson-docker.md" → "lesson-docker-1.md", "lesson-docker-2.md"
|
|
78
|
-
*/
|
|
79
|
-
private writeFileSplit;
|
|
80
|
-
/** Read a topic file. */
|
|
81
|
-
readFile(name: string): Promise<{
|
|
82
|
-
ok: boolean;
|
|
83
|
-
content?: string;
|
|
84
|
-
message: string;
|
|
85
|
-
}>;
|
|
86
|
-
/** Delete a topic file. INDEX.md cannot be deleted. */
|
|
87
|
-
deleteFile(name: string): Promise<MemdirResult>;
|
|
88
|
-
/**
|
|
89
|
-
* Search all memory files for keyword matches. Returns matching snippets.
|
|
90
|
-
* Tokenization shares fts-segment (latin words + CJK bigrams) with the L2
|
|
91
|
-
* keyword index — the old whitespace split treated a whole Chinese sentence
|
|
92
|
-
* as one "word", so multi-term Chinese queries scored all-or-nothing.
|
|
93
|
-
*/
|
|
94
|
-
searchLocal(query: string): Promise<Array<{
|
|
95
|
-
file: string;
|
|
96
|
-
snippet: string;
|
|
97
|
-
score: number;
|
|
98
|
-
mtimeMs: number;
|
|
99
|
-
}>>;
|
|
100
|
-
private writeIndex;
|
|
101
|
-
private writeIndexUnlocked;
|
|
102
|
-
private ensureDir;
|
|
103
|
-
/**
|
|
104
|
-
* Append an entry to the file listing section of INDEX.md (idempotent).
|
|
105
|
-
* Returns whether the entry is present afterwards. On overflow it first
|
|
106
|
-
* tries the same auto-compaction as addToIndex; a false return means the
|
|
107
|
-
* file exists but is INVISIBLE to recall — callers must surface that
|
|
108
|
-
* (the old behavior skipped silently and quietly orphaned topic files).
|
|
109
|
-
*/
|
|
110
|
-
private appendIndexEntry;
|
|
111
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isMemoryContentSafe(text: string): boolean;
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task distillation (R3, 记忆体系 v2) — 任务后蒸馏的纯逻辑层。
|
|
3
|
-
* spec: xiaozhiclaw-runtime/docs/memory-layering-and-distillation-spec.md
|
|
4
|
-
*
|
|
5
|
-
* 蒸馏对象 = "费了劲才做成的任务的做法"(程序性配方),绝不是每轮都跑:
|
|
6
|
-
* 候选采集(回合完成,轻量) → 空闲窗聚类(签名 embedding,宁严勿松) →
|
|
7
|
-
* 簇 ≥ 重复阈值才产 1 条 procedure 记忆 → 通过来源与前台结果验证后才可晋升技能。
|
|
8
|
-
* 成功闸不用 LLM 自评:正常终态 + 同 session 近窗内未被"重做"(在线否决)。
|
|
9
|
-
* 与 feedback-distillation(反馈域)无关 —— 这里蒸馏的是任务执行模式。
|
|
10
|
-
*
|
|
11
|
-
* 【X7 已完成】本文件是纯逻辑层,不做任何本地文件 IO。三份 profile JSON
|
|
12
|
-
* (task-distill-candidates / promotion-proposals / procedure-usage,均 A 域)的读写权威
|
|
13
|
-
* 已全部归 gateway MemoryProfileService(唯一写者);qlogicagent 大脑经 HostMemoryProvider
|
|
14
|
-
* proxy 的 read/write{DistillCandidates,PromotionProposals,ProcedureUsage} 存取,本文件只提供
|
|
15
|
-
* 采集/聚类/晋升的确定性算法由本模块及其测试锁定。
|
|
16
|
-
*/
|
|
17
|
-
import { type HubSkillCategory } from "../skill-system/skill-category.js";
|
|
18
|
-
import type { ProcedureVerificationEvidence } from "../../host-contract/index.js";
|
|
19
|
-
/** 同模式判定的余弦下限。错聚有害(把不同任务蒸成一份配方),漏聚无害(下次再攒)。 */
|
|
20
|
-
export declare const TASK_DISTILL_CLUSTER_SIM = 0.86;
|
|
21
|
-
/** 在线否决窗口:同 session 内距离 ≤N 回合出现高相似任务 = 前一次疑似被重做(纠正信号)。 */
|
|
22
|
-
export declare const TASK_DISTILL_REDO_WINDOW_TURNS = 3;
|
|
23
|
-
/** 候选滚动上限(jsonl 只保留最近 N 条,防无界增长)。 */
|
|
24
|
-
export declare const TASK_DISTILL_MAX_CANDIDATES = 200;
|
|
25
|
-
/** 晋升候选发现阈值:procedure 实际进入 prompt(注入闸后)≥N 次。
|
|
26
|
-
* [A7 重标定] 记账点已从 before_recall(检索命中)移到实际注入之后:旧口径把 dream/
|
|
27
|
-
* planner brief/写入去重探测等 8 条非召回链路的 search 命中都算成"复用",恒 ≥ 真实值;
|
|
28
|
-
* 新口径 = 模型真看到过的次数。阈值数值保留 3:设计意图本就是"真实复用 3 次",旧记账
|
|
29
|
-
* 只是高估了它 —— 同数值在新口径下只会更严、名副其实。存量 access_count 含检索热度成分,
|
|
30
|
-
* 不回溯清洗(负反馈门与 importance>0.5 门兜底)。 */
|
|
31
|
-
export declare const TASK_DISTILL_PROMOTE_ACCESS = 3;
|
|
32
|
-
export declare const PROCEDURE_TAG = "distilled@v1";
|
|
33
|
-
export declare const PROCEDURE_CATEGORY = "procedure";
|
|
34
|
-
export interface TaskCandidate {
|
|
35
|
-
id: string;
|
|
36
|
-
sessionId: string;
|
|
37
|
-
/** session 内回合序号(在线否决的距离度量) */
|
|
38
|
-
turnIndex: number;
|
|
39
|
-
/** 任务首句(user prompt 头部,签名文本) */
|
|
40
|
-
promptHead: string;
|
|
41
|
-
toolCallCount: number;
|
|
42
|
-
distinctToolCount: number;
|
|
43
|
-
/** 工具调用序列(name 有序去连续重复),配方步骤的原料 */
|
|
44
|
-
toolSequence: string[];
|
|
45
|
-
durationMs: number;
|
|
46
|
-
at: number;
|
|
47
|
-
/** 签名 embedding(优先用于语义聚类);缺失时仅允许跨会话的严格同配方聚类。 */
|
|
48
|
-
embedding?: number[];
|
|
49
|
-
status: "pending" | "rejected" | "distilled";
|
|
50
|
-
}
|
|
51
|
-
export interface CandidateStoreFile {
|
|
52
|
-
candidates: TaskCandidate[];
|
|
53
|
-
}
|
|
54
|
-
/** 滚动上限 + 过期清理(与技能模式同款 30 天窗口)。写入前就地裁剪 —— [X7] 代理写盘时
|
|
55
|
-
* 由大脑侧先裁再送 gateway store-owner(store-owner 只忠实持久化,不重述裁剪常量)。 */
|
|
56
|
-
export declare function capCandidateStore(store: CandidateStoreFile, now?: number): void;
|
|
57
|
-
export declare function cosine(a: readonly number[], b: readonly number[]): number;
|
|
58
|
-
export interface CollectInput {
|
|
59
|
-
id: string;
|
|
60
|
-
sessionId: string;
|
|
61
|
-
turnIndex: number;
|
|
62
|
-
promptHead: string;
|
|
63
|
-
toolCallCount: number;
|
|
64
|
-
distinctToolCount: number;
|
|
65
|
-
toolSequence: string[];
|
|
66
|
-
durationMs: number;
|
|
67
|
-
at: number;
|
|
68
|
-
embedding?: number[];
|
|
69
|
-
/** 回合终态:非正常终态的任务不候选(成功闸①) */
|
|
70
|
-
ok: boolean;
|
|
71
|
-
}
|
|
72
|
-
export interface CollectResult {
|
|
73
|
-
accepted: boolean;
|
|
74
|
-
/** 被本次采集在线否决(疑似被重做)的旧候选 id */
|
|
75
|
-
rejectedIds: string[];
|
|
76
|
-
reason?: string;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* 采集一个回合为蒸馏候选。
|
|
80
|
-
* 在线否决(成功闸②):同 session、距离 ≤REDO_WINDOW 回合内出现高相似新任务,
|
|
81
|
-
* 视为前一次被重做/纠正 —— 否决旧候选(新候选照常入列,它可能是成功版)。
|
|
82
|
-
* 跨 session 或距离更远的相似 = 模式重复,恰是蒸馏想要的信号,全部保留。
|
|
83
|
-
*/
|
|
84
|
-
export declare function collectCandidate(store: CandidateStoreFile, input: CollectInput): CollectResult;
|
|
85
|
-
/** Attach a background-produced embedding to an already durable candidate while
|
|
86
|
-
* preserving the same-session redo rejection rule used by inline collection. */
|
|
87
|
-
export declare function attachCandidateEmbedding(store: CandidateStoreFile, candidateId: string, embedding: number[]): string[];
|
|
88
|
-
export declare function clusterCandidates(store: CandidateStoreFile): TaskCandidate[][];
|
|
89
|
-
/** 压缩工具序列:去连续重复,保顺序。 */
|
|
90
|
-
export declare function compressToolSequence(seq: readonly string[]): string[];
|
|
91
|
-
export declare function clusterSignature(cluster: readonly TaskCandidate[]): string;
|
|
92
|
-
export declare function renderProcedureFallback(cluster: readonly TaskCandidate[]): string;
|
|
93
|
-
/** reverted = 升格后被撤销(降格) —— 与"暂不"(dismissed)分开计,是降格率仪表的分子。 */
|
|
94
|
-
export type PromotionStatus = "proposed" | "accepted" | "dismissed" | "reverted";
|
|
95
|
-
export interface PromotionProposal {
|
|
96
|
-
procedureId: string;
|
|
97
|
-
/** Host/Hub 单一技能分类;候选展示与最终 SKILL.md 使用同一枚举。 */
|
|
98
|
-
category: HubSkillCategory;
|
|
99
|
-
/** 配方首行(展示用) */
|
|
100
|
-
title: string;
|
|
101
|
-
accessCount: number;
|
|
102
|
-
proposedAt: number;
|
|
103
|
-
status: PromotionStatus;
|
|
104
|
-
/** 状态变迁时间(度量面:接受率/响应时长的数据源) */
|
|
105
|
-
resolvedAt?: number;
|
|
106
|
-
/** accepted 时记录升格产出的技能名(demote 反查) */
|
|
107
|
-
skillName?: string;
|
|
108
|
-
/** V3.3 自动档升格(非用户点击) */
|
|
109
|
-
auto?: boolean;
|
|
110
|
-
/** 自动升格的开场确认卡已读(「知道了」) */
|
|
111
|
-
acknowledgedAt?: number;
|
|
112
|
-
/** Host 根据来源成功样本与前台真实结果账计算;缺失或 passed=false 均不得升格。 */
|
|
113
|
-
verification: ProcedureVerificationEvidence;
|
|
114
|
-
}
|
|
115
|
-
export interface PromotionStoreFile {
|
|
116
|
-
proposals: PromotionProposal[];
|
|
117
|
-
}
|
|
118
|
-
/** 达标条目 upsert 为提议。dismissed/accepted 是终态,永不复活(拍板②:暂不=不再打扰)。
|
|
119
|
-
* 已 proposed 的只刷新 accessCount。返回是否新增。 */
|
|
120
|
-
export declare function upsertProposal(store: PromotionStoreFile, input: {
|
|
121
|
-
procedureId: string;
|
|
122
|
-
title: string;
|
|
123
|
-
category: HubSkillCategory;
|
|
124
|
-
accessCount: number;
|
|
125
|
-
now: number;
|
|
126
|
-
verification: ProcedureVerificationEvidence;
|
|
127
|
-
}): boolean;
|
|
128
|
-
/** One-way migration for proposals written before category became a Host contract. */
|
|
129
|
-
export declare function migratePromotionProposalCategories(store: PromotionStoreFile): boolean;
|
|
130
|
-
export declare function resolveProposal(store: PromotionStoreFile, procedureId: string, status: "accepted" | "dismissed", now: number): boolean;
|
|
131
|
-
/** 降格:accepted → reverted(区分"暂不";降格率=reverted/accepted 家族)。 */
|
|
132
|
-
export declare function revertProposal(store: PromotionStoreFile, procedureId: string, now: number): PromotionProposal | null;
|
|
133
|
-
/** 配方文本 → SKILL.md 的确定性降级模板(LLM 格式转换失败时兜底)。
|
|
134
|
-
* description 上限与写盘校验器同源(skill-validation MAX_DESCRIPTION_LENGTH):
|
|
135
|
-
* 曾经这里按 100 截,校验器按 60 打回,长标题配方在写盘前被自己仓拒绝。 */
|
|
136
|
-
export declare function renderSkillMarkdownFallback(name: string, procedureText: string): string;
|
|
137
|
-
/** 自动档解锁条件(拍板③):样本、接受率、降格率。 */
|
|
138
|
-
export declare const V3_AUTO_MIN_SAMPLES = 10;
|
|
139
|
-
export declare const V3_AUTO_MIN_ACCEPT_RATE = 0.7;
|
|
140
|
-
export declare const V3_AUTO_MAX_REVERT_RATE = 0.1;
|
|
141
|
-
/** 自动档触发严阈值(拍板④,比手动档 3 更严)。
|
|
142
|
-
* [A7 重标定] ACCESS 与 SESSIONS 的数据源都已移到"实际注入 prompt 之后"记账
|
|
143
|
-
* (memory.after_recall 的 post-cap 名单):≥5 次 = 真进过 5 次对话,≥3 session =
|
|
144
|
-
* 真在 3 个会话里被模型看到过。数值保留 —— 拍板④要的"严"指真实复用强度,旧记账
|
|
145
|
-
* 用检索命中冒充它;新口径同数值语义只紧不松,无需放宽(若自动档长期不可达,应
|
|
146
|
-
* 优先怀疑召回质量而不是降门槛)。 */
|
|
147
|
-
export declare const V3_AUTO_MIN_ACCESS = 5;
|
|
148
|
-
export declare const V3_AUTO_MIN_SESSIONS = 3;
|
|
149
|
-
export interface ProcedureUsage {
|
|
150
|
-
/** 实际注入 prompt 复用过它的 session 集合([A7] 记账在注入闸后,不再是检索命中) */
|
|
151
|
-
sessions: string[];
|
|
152
|
-
/** 复用后回合失败次数(零容忍:自动档要求 0) */
|
|
153
|
-
negativeCount: number;
|
|
154
|
-
}
|
|
155
|
-
export interface ProcedureUsageStoreFile {
|
|
156
|
-
usage: Record<string, ProcedureUsage>;
|
|
157
|
-
}
|
|
158
|
-
export declare function recordProcedureRecall(store: ProcedureUsageStoreFile, procedureId: string, sessionId: string): void;
|
|
159
|
-
export declare function recordProcedureNegative(store: ProcedureUsageStoreFile, procedureId: string): void;
|
|
160
|
-
export interface PromotionMetrics {
|
|
161
|
-
samples: number;
|
|
162
|
-
accepted: number;
|
|
163
|
-
dismissed: number;
|
|
164
|
-
reverted: number;
|
|
165
|
-
acceptRate: number;
|
|
166
|
-
revertRate: number;
|
|
167
|
-
autoEnabled: boolean;
|
|
168
|
-
}
|
|
169
|
-
/** 手动阶段仪表(拍板③):接受率=accepted 家族/已决样本;降格率=reverted/accepted 家族。
|
|
170
|
-
* 任何时刻降格率回升超限即自动退回手动档(autoEnabled 现算,无粘滞)。 */
|
|
171
|
-
export declare function computePromotionMetrics(proposals: readonly PromotionProposal[]): PromotionMetrics;
|
|
172
|
-
/**
|
|
173
|
-
* Release acceptance may bypass only the historical manual-decision calibration wait.
|
|
174
|
-
* The real access/session/negative-feedback gates remain enforced by
|
|
175
|
-
* qualifiesForAutoPromotion, and the flag is process-scoped by the isolated harness.
|
|
176
|
-
*/
|
|
177
|
-
export declare function isAutoPromotionCalibrationEnabled(metrics: Pick<PromotionMetrics, "autoEnabled">, env?: Readonly<Record<string, string | undefined>>): boolean;
|
|
178
|
-
/** 自动档严阈值(拍板④):复用 ≥5 + 跨 ≥3 session + 零负反馈。
|
|
179
|
-
* [A7] 三个输入如今全部以"实际注入 prompt"为记账点:accessCount 来自 Host 的
|
|
180
|
-
* recordInjectedAccess(post-cap 名单),sessions 来自 after_recall 侧的
|
|
181
|
-
* recordProcedureRecalls,negativeCount 也只指控被注入过的配方 —— 自动落盘技能的
|
|
182
|
-
* 每一分证据都对应模型真实看到并用过它的回合。 */
|
|
183
|
-
export declare function qualifiesForAutoPromotion(accessCount: number, usage: ProcedureUsage | undefined): boolean;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { type BundledNpmRuntime } from "../../runtime/infra/bundled-node.js";
|
|
2
|
-
export interface MarketplaceSource {
|
|
3
|
-
type: "npm" | "git" | "url";
|
|
4
|
-
specifier: string;
|
|
5
|
-
version?: string;
|
|
6
|
-
}
|
|
7
|
-
export interface MarketplaceConfig {
|
|
8
|
-
enabledPlugins: MarketplaceSource[];
|
|
9
|
-
allowlist?: string[];
|
|
10
|
-
blocklist?: string[];
|
|
11
|
-
}
|
|
12
|
-
export interface MarketplaceLogger {
|
|
13
|
-
info(msg: string): void;
|
|
14
|
-
warn(msg: string): void;
|
|
15
|
-
}
|
|
16
|
-
export interface StageMarketplaceNpmPluginRequest {
|
|
17
|
-
specifier: string;
|
|
18
|
-
version?: string;
|
|
19
|
-
/** Existing directory allocated and owned by the gateway. */
|
|
20
|
-
stageDir: string;
|
|
21
|
-
}
|
|
22
|
-
export interface StagedMarketplacePlugin {
|
|
23
|
-
name: string;
|
|
24
|
-
version: string;
|
|
25
|
-
contentDir: string;
|
|
26
|
-
}
|
|
27
|
-
type ExecResult = {
|
|
28
|
-
stdout: string;
|
|
29
|
-
stderr: string;
|
|
30
|
-
};
|
|
31
|
-
type ExecFile = (file: string, args: string[], options: Record<string, unknown>) => Promise<ExecResult>;
|
|
32
|
-
export interface MarketplaceComputeDeps {
|
|
33
|
-
resolveNpm?: () => BundledNpmRuntime | null;
|
|
34
|
-
execFile?: ExecFile;
|
|
35
|
-
}
|
|
36
|
-
export declare function resolveNpmExec(runtime: BundledNpmRuntime | null, args: string[]): {
|
|
37
|
-
file: string;
|
|
38
|
-
argv: string[];
|
|
39
|
-
env?: NodeJS.ProcessEnv;
|
|
40
|
-
};
|
|
41
|
-
/** Download and materialize one npm plugin strictly inside the supplied stage. */
|
|
42
|
-
export declare function stageMarketplaceNpmPlugin(request: StageMarketplaceNpmPluginRequest, log: MarketplaceLogger, deps?: MarketplaceComputeDeps): Promise<StagedMarketplacePlugin>;
|
|
43
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export interface SkillBundle {
|
|
2
|
-
name: string;
|
|
3
|
-
skills: string[];
|
|
4
|
-
filePath: string;
|
|
5
|
-
}
|
|
6
|
-
export declare function getSkillBundlesDir(): string;
|
|
7
|
-
export declare function listSkillBundles(bundleDir?: string): SkillBundle[];
|
|
8
|
-
export declare function resolveSkillBundle(name: string, bundleDir?: string): SkillBundle | undefined;
|