qlogicagent 2.18.3 → 2.18.5

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.
Files changed (47) hide show
  1. package/dist/agent.js +3 -3
  2. package/dist/cli.js +1 -1
  3. package/dist/index.js +559 -519
  4. package/dist/orchestration.js +1 -1
  5. package/dist/protocol.js +1 -1
  6. package/dist/skills/mcp/astraclaw-native-mcp-server.js +6 -6
  7. package/dist/types/cli/handlers/agents-handler.d.ts +33 -0
  8. package/dist/types/cli/handlers/community-handler.d.ts +1 -2
  9. package/dist/types/cli/handlers/memory-handler.d.ts +7 -1
  10. package/dist/types/cli/handlers/turn-handler.d.ts +10 -0
  11. package/dist/types/cli/orchestration-memory-context.d.ts +22 -0
  12. package/dist/types/orchestration/agent-instance.d.ts +5 -0
  13. package/dist/types/orchestration/goal-mode-adapters.d.ts +4 -0
  14. package/dist/types/orchestration/planner-memory-brief.d.ts +39 -0
  15. package/dist/types/orchestration/solo-spec-builder.d.ts +3 -0
  16. package/dist/types/protocol/methods.d.ts +0 -26
  17. package/dist/types/protocol/wire/agent-methods.d.ts +0 -12
  18. package/dist/types/protocol/wire/gateway-rpc.d.ts +11 -14
  19. package/dist/types/protocol/wire/index.d.ts +1 -1
  20. package/dist/types/protocol/wire/memory-provider-lifecycle.d.ts +0 -16
  21. package/dist/types/runtime/community/community-consent-client.d.ts +0 -21
  22. package/dist/types/runtime/execution/memory-decay.d.ts +1 -1
  23. package/dist/types/runtime/hooks/memory-hooks.d.ts +6 -0
  24. package/dist/types/runtime/infra/agent-paths.d.ts +9 -7
  25. package/dist/types/runtime/infra/astraclaw-capabilities.d.ts +0 -6
  26. package/dist/types/runtime/infra/checkpoint-backend.d.ts +1 -1
  27. package/dist/types/runtime/infra/migrate-device-scope.d.ts +49 -0
  28. package/dist/types/runtime/infra/project-data-paths.d.ts +4 -3
  29. package/dist/types/runtime/infra/project-skill-manifest.d.ts +3 -2
  30. package/dist/types/runtime/ports/index.d.ts +1 -1
  31. package/dist/types/runtime/ports/memory-provider.d.ts +22 -7
  32. package/dist/types/skills/memory/fts-segment.d.ts +20 -0
  33. package/dist/types/skills/memory/local-memory-provider.d.ts +55 -10
  34. package/dist/types/skills/memory/local-store-records.d.ts +6 -1
  35. package/dist/types/skills/memory/local-store.d.ts +96 -17
  36. package/dist/types/skills/memory/memdir.d.ts +16 -6
  37. package/dist/types/skills/memory/memory-consolidation.d.ts +7 -0
  38. package/dist/types/skills/memory/proposal-consumer.d.ts +51 -0
  39. package/dist/types/skills/memory/sqlite-memory-mappers.d.ts +2 -1
  40. package/dist/types/skills/memory/sqlite-memory-schema.d.ts +9 -1
  41. package/dist/types/skills/tools/image-generate-tool.d.ts +1 -1
  42. package/package.json +3 -2
  43. package/dist/types/cli/tool-bootstrap-community-registration.d.ts +0 -9
  44. package/dist/types/runtime/community/community-discovery-cache.d.ts +0 -24
  45. package/dist/types/runtime/community/community-discovery-coordinator.d.ts +0 -33
  46. package/dist/types/runtime/hooks/community-discovery-hook.d.ts +0 -18
  47. package/dist/types/skills/tools/community-seek-tool.d.ts +0 -49
@@ -32,6 +32,9 @@ export interface SpecChatDeps {
32
32
  * the handler relays these labels (solo.specProgress) to replace the frozen "思考中" with the real
33
33
  * phase (分析 → 确认 → 拟定). Best-effort: never throws into the round. */
34
34
  onPhase?: (phase: string) => void;
35
+ /** (a) Owner global memory cheat-sheet — the spec moderator must honor standing
36
+ * preferences/boundaries (language, style, hard limits) when drafting the spec. */
37
+ globalMemoryIndex?: string | null;
35
38
  }
36
39
  /** R3 多轮对话式 spec:agent 通过此工具产出/更新结构化规格(类比 plan_mode 的 plan 入参)。 */
37
40
  export declare const SET_SPEC_TOOL_NAME = "set_spec";
@@ -342,28 +342,6 @@ export interface ConfigUpdateResult {
342
342
  reason: string;
343
343
  }>;
344
344
  }
345
- export interface CommunityMatchRegistryParams {
346
- intent: string;
347
- topK?: 1 | 2 | 3;
348
- preferOfficial?: boolean;
349
- }
350
- export interface CommunityRegistryMatchResult {
351
- id: string;
352
- type: string;
353
- title: string;
354
- summary: string;
355
- capabilityTags: string[];
356
- sourceTier: CommunityInstallSourceTier;
357
- trustStage: CommunityInstallTrustStage;
358
- resourceRiskTier: CommunityInstallRiskTier;
359
- effectiveRiskTier: CommunityInstallRiskTier;
360
- latestVersion: string | null;
361
- canonical: true;
362
- }
363
- export interface CommunityMatchRegistryResult {
364
- ok: boolean;
365
- matches: CommunityRegistryMatchResult[];
366
- }
367
345
  export type CommunityInstallRiskTier = "R0" | "R1" | "R2" | "R3";
368
346
  export type CommunityInstallSourceTier = "official" | "community";
369
347
  export type CommunityInstallTrustStage = "quarantine" | "trial" | "trusted";
@@ -660,10 +638,6 @@ export interface RpcMethodMap {
660
638
  params: ConfigUpdateParams;
661
639
  result: ConfigUpdateResult;
662
640
  };
663
- "community.matchRegistry": {
664
- params: CommunityMatchRegistryParams;
665
- result: CommunityMatchRegistryResult;
666
- };
667
641
  "community.resolveInstall": {
668
642
  params: CommunityResolveInstallParams;
669
643
  result: CommunityResolveInstallResult;
@@ -623,7 +623,6 @@ export interface AgentRpcMethodMap extends GatewayRpcMethodMap {
623
623
  };
624
624
  "memory.atlas": GatewayRpcMethodMap["memory.atlas"];
625
625
  "memory.activity": GatewayRpcMethodMap["memory.activity"];
626
- "memory.observe": GatewayRpcMethodMap["memory.observe"];
627
626
  "memory.propose": GatewayRpcMethodMap["memory.propose"];
628
627
  "memory.consolidate": GatewayRpcMethodMap["memory.consolidate"];
629
628
  "memory.update": GatewayRpcMethodMap["memory.update"];
@@ -835,17 +834,6 @@ export interface AgentRpcMethodMap extends GatewayRpcMethodMap {
835
834
  value: unknown;
836
835
  };
837
836
  };
838
- "community.matchRegistry": {
839
- params: {
840
- intent: string;
841
- topK?: 1 | 2 | 3;
842
- preferOfficial?: boolean;
843
- };
844
- result: {
845
- ok: boolean;
846
- matches: Array<Record<string, unknown>>;
847
- };
848
- };
849
837
  "community.resolveInstall": {
850
838
  params: {
851
839
  resourceId: string;
@@ -115,6 +115,7 @@ export interface GatewayRpcMethodMap {
115
115
  limit?: number;
116
116
  projectId?: string;
117
117
  archived?: boolean;
118
+ agentId?: string;
118
119
  };
119
120
  result: {
120
121
  sessions: Array<{
@@ -128,6 +129,16 @@ export interface GatewayRpcMethodMap {
128
129
  pinnedAt?: string | null;
129
130
  archivedAt?: string | null;
130
131
  projectId: string;
132
+ agentId?: string;
133
+ source?: "native";
134
+ nativeRef?: {
135
+ agentId: string;
136
+ kind: "codex" | "claude";
137
+ file: string;
138
+ };
139
+ sealedAt?: string | null;
140
+ previousSessionId?: string | null;
141
+ carryoverSummary?: string | null;
131
142
  }>;
132
143
  };
133
144
  };
@@ -711,20 +722,6 @@ export interface GatewayRpcMethodMap {
711
722
  }>;
712
723
  };
713
724
  };
714
- "memory.observe": {
715
- params: {
716
- text: string;
717
- category?: string;
718
- importance?: number;
719
- source?: string;
720
- tags?: string[];
721
- };
722
- result: {
723
- ok: boolean;
724
- observationsAdded: number;
725
- observationIds: string[];
726
- };
727
- };
728
725
  "memory.propose": {
729
726
  params: MemoryTextMutationParams;
730
727
  result: {
@@ -12,7 +12,7 @@ export { type ApprovalRequiredToolContract, type ModelSelectionReason, type Pend
12
12
  export { type GatewayChannelExecutionEgressContract, type GatewayChannelExecutionEgressKind, type GatewayChannelExecutionIngressBindingContract, type GatewayChannelExecutionIngressSource, } from "./channel-ingress.js";
13
13
  export { CAPABILITY_MANIFEST_DIFF_SECTIONS, cloneCapabilityManifestSnapshot, createCapabilityManifestDiffPayload, deriveCapabilityToolNamespaces, deriveCapabilityWorkspaceIds, mergeCapabilityManifestSnapshot, type CapabilityManifestApprovalMode, type CapabilityManifestApprovalPolicyContract, type CapabilityManifestDiffSection, type CapabilityMcpManifestContract, type CapabilityManifestSnapshotContract, type HostCapabilitySnapshotContract, type CapabilityPluginManifestContract, type RuntimeCapabilityViewContract, type RuntimeToolEligibilityContract, type CapabilitySkillManifestContract, type CapabilityToolManifestContract, type CapabilityWorkspaceSummaryContract, type ToolEligibilityResolvedSource, type ToolEligibilityReasonCode, type ToolEligibilityStatus, } from "./capability-manifest.js";
14
14
  export { WEB_ACTION_SCOPE_VALUES, WEB_APPROVAL_DEFAULT_VALUES, WEB_CAPABILITY_FAMILY_VALUES, WEB_CAPABILITY_ID_VALUES, WEB_DEGRADATION_TARGET_VALUES, WEB_ESCALATION_REASON_VALUES, WEB_EXECUTION_MODE_VALUES, WEB_POLICY_RISK_CLASS_VALUES, WEB_RETRY_POLICY_VALUES, WEB_STATEFULNESS_VALUES, WEB_TASK_MODE_VALUES, type WebActionScope, type WebApprovalDefault, type WebCapabilityDescriptorContract, type WebCapabilityFamily, type WebCapabilityId, type WebDegradationTarget, type WebEscalationReason, type WebExecutionMode, type WebPolicyRiskClass, type WebRetryPolicy, type WebStatefulness, type WebTaskMode, type ToolRiskLevel, } from "./web-capability.js";
15
- export { MEMORY_OBSERVATION_HOOK_VALUES, MEMORY_OBSERVATION_SOURCE_VALUES, MEMORY_WRITE_ACCESS_VALUES, type MemoryContextBlock, type MemoryIngestMessage, type MemoryIngestOptions, type MemoryLlmConfig, type MemoryObservedMsg, type MemoryObservedPayload, type MemoryObservationEnvelope, type MemoryObservationHook, type MemoryObservationSource, type MemoryObserveRequestMsg, type MemoryProvider, type MemorySearchOptions, type MemorySearchResult, type MemoryWriteAccess, } from "./memory-provider-lifecycle.js";
15
+ export { MEMORY_OBSERVATION_HOOK_VALUES, MEMORY_OBSERVATION_SOURCE_VALUES, MEMORY_WRITE_ACCESS_VALUES, type MemoryContextBlock, type MemoryIngestOptions, type MemoryLlmConfig, type MemoryObservedPayload, type MemoryObservationEnvelope, type MemoryObservationHook, type MemoryObservationSource, type MemoryProvider, type MemorySearchOptions, type MemorySearchResult, type MemoryWriteAccess, } from "./memory-provider-lifecycle.js";
16
16
  export { RESOURCE_MANIFEST_SCHEMA_VERSION, RUNTIME_ASSET_IDS, RUNTIME_PROFILE_IDS, createDefaultRuntimeResourceProfiles, getManifestShortcutEntry, getRuntimeResourceAsset, getRuntimeResourceProfile, getRuntimeResourceProfileAssets, normalizeRuntimeResourceManifest, upsertRuntimeResourceAsset, type RuntimeManifestShortcutEntry, type RuntimeResourceArtifact, type RuntimeResourceAsset, type RuntimeResourceAssetDelivery, type RuntimeResourceAssetKind, type RuntimeResourceAssetMap, type RuntimeResourceManifest, type RuntimeResourcePlatform, type RuntimeResourceProfile, type RuntimeResourceProfileMap, } from "./resource-manifest.js";
17
17
  export { MUTATION_CHECKPOINT_ENTRY_KIND_VALUES, MUTATION_CHECKPOINT_BACKEND_VALUES, MUTATION_CHECKPOINT_PHASE_VALUES, type MutationCheckpointBackend, type MutationCheckpointContract, type MutationCheckpointEntryKind, type MutationCheckpointPhase, type MutationCheckpointRestoreAckContract, type MutationCheckpointRollbackResultContract, type MutationCheckpointRestoreContract, type MutationCheckpointSnapshotEntryContract, } from "./checkpoint.js";
18
18
  export { type MutationCheckpointRuntimeManager, type MutationCheckpointRuntimeManagerDeps, } from "./checkpoint-runtime.js";
@@ -29,16 +29,6 @@ export interface MemoryObservedPayload extends MemoryObservationEnvelope {
29
29
  blocks?: MemoryContextBlock[];
30
30
  error?: string;
31
31
  }
32
- export interface MemoryObservedMsg {
33
- type: "memory.observed";
34
- id: string;
35
- payload: MemoryObservedPayload;
36
- }
37
- export interface MemoryObserveRequestMsg {
38
- type: "memory.observe";
39
- id: string;
40
- payload: MemoryObservationEnvelope;
41
- }
42
32
  export interface MemoryLlmConfig {
43
33
  provider: string;
44
34
  baseUrl: string;
@@ -70,7 +60,6 @@ export interface MemoryIngestOptions {
70
60
  export interface MemoryProvider {
71
61
  readonly providerId: string;
72
62
  search(query: string, userId: string, options?: MemorySearchOptions): Promise<MemorySearchResult[]>;
73
- ingest(messages: MemoryIngestMessage[], userId: string, options?: MemoryIngestOptions): Promise<void>;
74
63
  /** Store a plain text memory entry (no LLM extraction — agent decides content). */
75
64
  addText?(text: string, userId: string, options?: MemoryIngestOptions): Promise<{
76
65
  memoriesAdded: number;
@@ -78,8 +67,3 @@ export interface MemoryProvider {
78
67
  /** Remove a memory entry by ID. */
79
68
  remove?(memoryId: string): Promise<boolean>;
80
69
  }
81
- export interface MemoryIngestMessage {
82
- role: string;
83
- content: string;
84
- timestamp?: number;
85
- }
@@ -7,26 +7,6 @@ export interface CommunityRuntimeResolution {
7
7
  checksum: string;
8
8
  sizeBytes: number;
9
9
  }
10
- export interface CommunityRegistryMatchInput {
11
- intent: string;
12
- topK?: number;
13
- preferOfficial?: boolean;
14
- }
15
- export interface CommunityRegistryMatchResult {
16
- id: string;
17
- type: string;
18
- title: string;
19
- summary: string;
20
- /** RESOURCE_CATEGORIES key(search 表演锚点;hub match 返回 ResourceView.category)。 */
21
- category: string | null;
22
- capabilityTags: string[];
23
- sourceTier: CommunityInstallSourceTier;
24
- trustStage: CommunityInstallTrustStage;
25
- resourceRiskTier: CommunityInstallRiskTier;
26
- effectiveRiskTier: CommunityInstallRiskTier;
27
- latestVersion: string | null;
28
- canonical: true;
29
- }
30
10
  export type CommunityInstallRiskTier = "R0" | "R1" | "R2" | "R3";
31
11
  export type CommunityInstallSourceTier = "official" | "community";
32
12
  export type CommunityInstallTrustStage = "quarantine" | "trial" | "trusted";
@@ -71,7 +51,6 @@ export interface CommunityConsentClientOptions {
71
51
  clientVersion?: string;
72
52
  }
73
53
  export interface CommunityConsentClient {
74
- matchRegistry(input: CommunityRegistryMatchInput): Promise<CommunityRegistryMatchResult[]>;
75
54
  resolveInstall(resourceId: string, version?: string): Promise<CommunityInstallResolution>;
76
55
  /** List a resource's published versions for the version/rollback menu (WS-B3). The
77
56
  * default client always implements it; optional so lightweight mocks may omit it. */
@@ -32,7 +32,7 @@ export declare function markDecayComplete(memoryRoot: string): Promise<void>;
32
32
  export interface DecayCycleDeps {
33
33
  /** Memory provider with triggerDecay method. */
34
34
  adapter: {
35
- triggerDecay(userId: string, maxAgeDays?: number): Promise<{
35
+ triggerDecay(userId: string): Promise<{
36
36
  decayed: number;
37
37
  }>;
38
38
  };
@@ -7,6 +7,12 @@ export declare const MEMORY_PREFETCH_CONFIG: {
7
7
  readonly LIMIT_PER_RECALL: 10;
8
8
  readonly MAX_SURFACED_ENTRIES: 100;
9
9
  };
10
+ /**
11
+ * Fallback for hosts that don't inject deps.procedureTag. MUST stay equal to
12
+ * skills/memory/task-distillation PROCEDURE_TAG (runtime cannot import skills
13
+ * per the architecture boundary; task-distillation.test.ts asserts equality).
14
+ */
15
+ export declare const PROCEDURE_TAG_FALLBACK = "distilled@v1";
10
16
  export interface MemoryHooksDeps {
11
17
  /** QMemory adapter (MemoryProvider with search/health). */
12
18
  memoryProvider?: MemoryProvider;
@@ -26,9 +26,9 @@ export declare function getOwnerProfileDir(ownerUserId?: string): string;
26
26
  export declare function getProfileMemoryDir(ownerUserId?: string): string;
27
27
  /** Dir name for our per-project companion data (sessions/checkpoints/uploads). */
28
28
  export declare const PROJECT_DATA_DIRNAME = "projectData";
29
- /** Root of the projectData tree for the current owner. */
29
+ /** Root of the projectData tree on this device (`~/.qlogicagent/projectData/`). */
30
30
  export declare function getProjectDataRoot(): string;
31
- /** `profiles/<owner>/projectData/<projectId>/` (projectId is the path-derived key). */
31
+ /** `~/.qlogicagent/projectData/<projectId>/` (projectId is the path-derived key). */
32
32
  export declare function getProjectDataDirById(projectId: string): string;
33
33
  /**
34
34
  * Ensure the user agent home directory exists and is writable.
@@ -38,9 +38,9 @@ export declare function getProjectDataDirById(projectId: string): string;
38
38
  export declare function ensureUserAgentHome(): string;
39
39
  /** `~/.qlogicagent/profiles/<owner>/.credentials.json` */
40
40
  export declare function getUserCredentialsPath(): string;
41
- /** `~/.qlogicagent/profiles/<owner>/plugins/` */
41
+ /** `~/.qlogicagent/plugins/` — device-scoped. */
42
42
  export declare function getUserPluginsDir(): string;
43
- /** `~/.qlogicagent/profiles/<owner>/skills/` */
43
+ /** `~/.qlogicagent/skills/` — device-scoped single global skill store. */
44
44
  export declare function getUserSkillsDir(): string;
45
45
  /** `~/.qlogicagent/profiles/<owner>/settings.json` */
46
46
  export declare function getUserSettingsPath(): string;
@@ -48,11 +48,13 @@ export declare function getUserSettingsPath(): string;
48
48
  export declare function getUserCacheDir(): string;
49
49
  /** `~/.qlogicagent/debug-logs/` */
50
50
  export declare function getUserDebugLogsDir(): string;
51
- /** `~/.qlogicagent/profiles/<owner>/plugin-cache/` */
51
+ /** `~/.qlogicagent/plugin-cache/` — device-scoped (download cache for installs). */
52
52
  export declare function getUserPluginCacheDir(): string;
53
- /** `~/.qlogicagent/profiles/<owner>/mcp.json` */
53
+ /** `~/.qlogicagent/mcp.json` — device-scoped installed MCP server definitions.
54
+ * The gateway's preinstall writes here too (its mcp-config.ts mirrors this path) — keeping both
55
+ * sides on the device level is what makes the preinstalled github MCP visible to every login. */
54
56
  export declare function getUserMcpConfigPath(): string;
55
- /** `~/.qlogicagent/profiles/<owner>/marketplace.json` */
57
+ /** `~/.qlogicagent/marketplace.json` — device-scoped marketplace sources. */
56
58
  export declare function getUserMarketplaceConfigPath(): string;
57
59
  /** `~/.qlogicagent/profiles/<owner>/workflows/` */
58
60
  export declare function getUserWorkflowsDir(): string;
@@ -30,10 +30,4 @@ export declare function buildAstraClawCapabilitiesSystemPrompt(input: {
30
30
  availableToolNames?: Iterable<string>;
31
31
  currentEnvironment?: string;
32
32
  }): Promise<string | undefined>;
33
- export declare function buildAstraClawCapabilitiesPromptPreamble(input: {
34
- projectRoot: string;
35
- mcpAvailable: boolean;
36
- availableToolNames?: Iterable<string>;
37
- currentEnvironment?: string;
38
- }): Promise<string | undefined>;
39
33
  export declare function handleAstraClawCapabilityToolCall(input: AstraClawCapabilityToolInput): Promise<AstraClawCapabilityToolResult>;
@@ -2,7 +2,7 @@
2
2
  * Local Checkpoint Backend — git-based shadow repo implementation.
3
3
  *
4
4
  * Creates and manages checkpoint snapshots in the centralized companion store
5
- * `~/.qlogicagent/profiles/<owner>/projectData/<projectId>/checkpoints/<sessionId>/`
5
+ * `~/.qlogicagent/projectData/<projectId>/checkpoints/<sessionId>/`
6
6
  * (NOT inside the user's workspace) using a shadow git repository independent of the user's .git.
7
7
  */
8
8
  import type { CheckpointBackend } from "../ports/checkpoint-contracts.js";
@@ -0,0 +1,49 @@
1
+ /**
2
+ * One-shot migration: fold legacy PER-PROFILE install assets into the device-level store.
3
+ *
4
+ * 设计裁定:安装的插件/技能/MCP 是【设备资产】,跟随机器;只有会话/记忆/设置/偏好随登录身份
5
+ * (owner profile)。历史版本把 skills/plugins/mcp.json/skill-lifecycle.json 挂在
6
+ * profiles/<owner>/ 下,登录切身份 → 引擎换 profile → 已装插件"消失"、预装跨身份失效。
7
+ *
8
+ * 折并规则(活跃 owner 的 profile 先处理,它的副本优先):
9
+ * - skills/<name>: 设备层缺 → 整目录 rename 进设备 store;同名且 SKILL.md 内容一致 → 丢弃
10
+ * profile 副本;同名不同内容 → 原地保留 + 大声告警(绝不静默覆盖)。
11
+ * - plugins/<name>: 设备层缺 → rename;同名 → 原地保留 + 告警(插件目录内容不可比对)。
12
+ * - skill-lifecycle.json: 按技能名合并进设备层 store(先到优先),消费掉的文件改名
13
+ * `*.migrated-to-device` 留痕。
14
+ * - mcp.json: 服务器按名合并(先到优先、绝不覆盖已有键),消费掉的文件同样改名留痕。
15
+ * - marketplace.json: 设备层缺 → rename 采用;已有 → 原地保留 + 告警。
16
+ * - skills-disabled.json(全局静音表): 与技能 store 同为设备资产 —— 各 profile 取【并集】合入
17
+ * 设备层(保守方向:任何身份下停放/静音过的技能绝不因迁移静默点亮;agent 自建技能的
18
+ * "默认停放"正是靠这张表,漏并会让它们在别的身份下全部亮起)。消费掉的文件改名留痕。
19
+ * - plugin-cache/、cache/community-installs/: 纯下载缓存,直接删除。
20
+ *
21
+ * 会话伴生数据(第二批裁定,对齐 codex/VS Code —— 会话也随设备):
22
+ * - projectData/<pid>/: 设备层缺该 pid → 整目录 rename;同 pid 跨 profile(同一 workspace 在
23
+ * 多身份下用过,path-derived id 相同)→ 结构化合并:sessions/、checkpoints/、uploads/ 的
24
+ * 子项按【uuid 名】跳已存在(同名=同一会话的陈旧副本,活跃身份先到先得);sessions/.deleted
25
+ * 墓碑按文件名并集;project.json back-ref 先到先得(输家副本可安全删除,注册表每次写都会重生成)。
26
+ * 未能并尽的残留原地保留 + 计入 conflicts(绝不静默销毁)。
27
+ * - projects.json(注册表): 按项目 id 合并(先到先得);activeProjectId 继承第一个有效值
28
+ * (活跃身份优先)。折并须在 rebuildIndexFromBackrefs 之前跑 —— 否则自愈会先用空注册表
29
+ * 重建、丢掉 active 指针等索引态。
30
+ *
31
+ * 幂等:按目录状态驱动(profile 里没有遗留 → 全程 no-op),每次启动同步段调用都安全。
32
+ */
33
+ export interface DeviceScopeMigrationResult {
34
+ movedSkills: string[];
35
+ movedPlugins: string[];
36
+ /** projectData/<pid> trees moved or merged into the device store. */
37
+ movedProjects: string[];
38
+ /** Same-name different-content entries left in place (loud warning emitted). */
39
+ conflicts: string[];
40
+ /** Profile files (lifecycle/mcp/marketplace/registry/mute) whose content was folded into the device store. */
41
+ mergedFiles: string[];
42
+ }
43
+ /**
44
+ * Fold every profile's legacy install assets into the device-level store. Bounded (rename-based),
45
+ * idempotent, best-effort with loud per-item diagnostics. Call from the SYNCHRONOUS bootstrap
46
+ * section BEFORE anything reads the skill store — on an upgraded machine every installed skill
47
+ * still lives under profiles/ until this runs.
48
+ */
49
+ export declare function migrateDeviceScopeInstalls(): DeviceScopeMigrationResult;
@@ -2,17 +2,18 @@
2
2
  * Project Data Paths — centralized location for our per-project COMPANION data (the "account
3
3
  * book"): session transcripts/metadata, checkpoint shadow repos, uploaded attachments, deletion
4
4
  * tombstones. Mirrors VS Code's workspaceStorage: this data is OURS and lives in a centralized,
5
- * per-project-id, physically-isolated dir under the owner profile — NEVER inside the user's
5
+ * per-project-id, physically-isolated dir at the DEVICE level — NEVER inside the user's
6
6
  * workspace folder. The workspace folder holds only user work product (code/docs/generated media).
7
+ * 设备级(用户裁定,对齐 codex/VS Code):会话数据跟随机器;登录身份只属于云同步/计费层。
7
8
  *
8
- * ~/.qlogicagent/profiles/<owner>/projectData/<projectId>/{sessions,checkpoints,uploads}/
9
+ * ~/.qlogicagent/projectData/<projectId>/{sessions,checkpoints,uploads}/
9
10
  *
10
11
  * projectId is the PATH-DERIVED key (deriveProjectId(workspaceDir), see agent-paths) — the
11
12
  * mainstream model (VS Code / cc-haha): same folder → same id, deterministic, recomputable, no
12
13
  * central-registry dependency for the storage key. Deleting a project = `rm` projectData/<id>/.
13
14
  */
14
15
  export { getProjectDataDirById, getProjectDataRoot } from "./agent-paths.js";
15
- /** `~/.qlogicagent/profiles/<owner>/projectData/<projectId>/` for a projectId or workspaceDir. */
16
+ /** `~/.qlogicagent/projectData/<projectId>/` for a projectId or workspaceDir. */
16
17
  export declare function getProjectDataDir(projectIdOrWorkspaceDir: string): string;
17
18
  /** `projectData/<id>/sessions/` */
18
19
  export declare function getProjectDataSessionsRoot(projectIdOrWorkspaceDir: string): string;
@@ -2,9 +2,10 @@
2
2
  * Skill mute registries — under the single-store model, EVERY skill is global. There is no
3
3
  * project-scoped / opt-in concept; instead there are two opt-OUT mute lists:
4
4
  *
5
- * - owner-level (~/.qlogicagent/profiles/<owner>/skills-disabled.json) — off in EVERY project
5
+ * - device-level (~/.qlogicagent/skills-disabled.json) — off in EVERY project
6
6
  * (the plugin card's on/off switch; also where agent-learned skills land, disabled, until the
7
- * user reviews and enables them).
7
+ * user reviews and enables them). 与技能 store 同域:插件及其开关都是设备资产,登录身份切换
8
+ * 不得改变哪些技能是开着的(此前 per-owner 键控会让 A 身份停放的技能在 B 身份下点亮)。
8
9
  * - per-project (<cwd>/.qlogicagent/skills-disabled.json) — off in THIS project only
9
10
  * (the "project skills" opt-out, to cut down which skills an agent sees in a given project).
10
11
  *
@@ -1,6 +1,6 @@
1
1
  export type { MemoryWriter, MemoryWriteMetadata } from "./memory-writer.js";
2
2
  export type { MemoryRecallSource } from "./memory-recall-source.js";
3
- export type { MemoryProvider, MemorySearchOptions, MemorySearchResult, MemoryIngestMessage, MemoryIngestOptions, MemoryExtractionItem, MemoryConsolidationWriteResult, MemoryLearningSink, MemoryToolLocalProvider, MemoryActivitySummary, MemoryAtlasRecord, MemoryAtlasResult, MemoryUpdatePatch, MemoryHandlerProvider, MemoryDreamProvider, MemoryDecayProvider, MemoryRuntimeHookProvider, MemoryToolProvider, MemoryDreamRuntimeProvider, } from "./memory-provider.js";
3
+ export type { MemoryProvider, MemorySearchOptions, MemorySearchResult, MemoryIngestOptions, MemoryExtractionItem, MemoryConsolidationWriteResult, MemoryLearningSink, MemoryToolLocalProvider, MemoryActivitySummary, MemoryAtlasRecord, MemoryAtlasResult, MemoryUpdatePatch, MemoryHandlerProvider, MemoryDreamProvider, MemoryDecayProvider, MemoryRuntimeHookProvider, MemoryToolProvider, MemoryDreamRuntimeProvider, } from "./memory-provider.js";
4
4
  export type { PathService } from "./path-service.js";
5
5
  export type { ConfigPort } from "./config-port.js";
6
6
  export { createRecordConfigPort } from "./config-port.js";
@@ -17,11 +17,6 @@ export interface MemorySearchResult {
17
17
  source?: string;
18
18
  metadata?: Record<string, unknown>;
19
19
  }
20
- export interface MemoryIngestMessage {
21
- role: string;
22
- content: string;
23
- timestamp?: number;
24
- }
25
20
  export interface MemoryIngestOptions {
26
21
  llmConfig?: unknown;
27
22
  source?: string;
@@ -56,7 +51,6 @@ export interface MemoryConsolidationWriteResult {
56
51
  export interface MemoryProvider {
57
52
  readonly providerId: string;
58
53
  search(query: string, userId: string, options?: MemorySearchOptions): Promise<MemorySearchResult[]>;
59
- ingest?(messages: MemoryIngestMessage[], userId: string, options?: MemoryIngestOptions): Promise<void>;
60
54
  addText?(text: string, userId: string, options?: MemoryIngestOptions): Promise<{
61
55
  memoriesAdded: number;
62
56
  }>;
@@ -159,6 +153,27 @@ export interface MemoryHandlerProvider extends MemoryProvider {
159
153
  } | null>;
160
154
  /** Persist understood/extracted text on an attachment row. */
161
155
  setAttachmentText?(id: string, text: string): void;
156
+ /** Factual proposals for the candidate surface: pending (default) awaiting
157
+ * corroboration, or expired (read-only history of what timed out). */
158
+ listPendingProposals?(userId: string, limit?: number, status?: "pending" | "expired"): Array<{
159
+ id: string;
160
+ text: string;
161
+ category: string;
162
+ importance: number;
163
+ confidence: number;
164
+ source: string;
165
+ tags: string[];
166
+ createdAt: number;
167
+ }>;
168
+ /** UI resolution of one pending proposal: confirm commits it with manual authority; dismiss rejects it. */
169
+ resolveProposal?(userId: string, proposalId: string, action: "confirm" | "dismiss"): Promise<boolean>;
170
+ /** Evidence-laddered backlog consumption (corroborated commit / feedback solo / TTL expiry). */
171
+ consumePendingProposals?(userId: string): Promise<{
172
+ committed: number;
173
+ merged: number;
174
+ expiredIds: string[];
175
+ pendingLeft: number;
176
+ }>;
162
177
  }
163
178
  export interface MemoryDreamProvider {
164
179
  search(query: string, userId: string, options?: {
@@ -180,7 +195,7 @@ export interface MemoryDreamProvider {
180
195
  getAllProfiles?(userId: string): Record<string, string>;
181
196
  }
182
197
  export interface MemoryDecayProvider {
183
- triggerDecay(userId: string, maxAgeDays?: number): Promise<{
198
+ triggerDecay(userId: string): Promise<{
184
199
  decayed: number;
185
200
  }>;
186
201
  }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * FTS pre-segmentation for CJK-aware keyword search.
3
+ *
4
+ * SQLite FTS5's unicode61 tokenizer does not segment CJK: a run of Chinese
5
+ * characters indexes as ONE token, so a query like 咖啡 can never match a
6
+ * memory containing 用户喜欢喝美式咖啡. Instead of switching tokenizers
7
+ * (trigram misses 2-char Chinese words, ICU is not bundled), we index a
8
+ * pre-segmented shadow column (`memories.text_seg`) and segment queries with
9
+ * the SAME function:
10
+ * - Latin/digit runs stay whole words ("docker", "v2")
11
+ * - CJK runs become character bigrams (咖啡, 啡因) + the single char for
12
+ * 1-char runs — the same scheme the near-duplicate gate already uses.
13
+ *
14
+ * Index side and query side MUST share this function; drift between them
15
+ * silently zeroes recall.
16
+ */
17
+ /** Segment text into FTS-friendly tokens (lowercased). */
18
+ export declare function segmentForFts(text: string): string[];
19
+ /** Render the segmented shadow text stored in memories.text_seg. */
20
+ export declare function segmentTextForFts(text: string): string;
@@ -8,8 +8,8 @@
8
8
  * - With embedding API configured: hybrid search (FTS + vector)
9
9
  * - Without embedding: FTS-only search (still useful for exact/keyword matches)
10
10
  */
11
- import type { MemoryProvider, MemorySearchResult, MemorySearchOptions, MemoryIngestMessage, MemoryIngestOptions } from "../../protocol/wire/index.js";
12
- import type { MemoryClaimRecord, MemoryConflictRecord, MemoryUpdateInput, SqliteDatabase } from "./local-store.js";
11
+ import type { MemoryProvider, MemorySearchResult, MemorySearchOptions, MemoryIngestOptions } from "../../protocol/wire/index.js";
12
+ import type { MemoryClaimRecord, MemoryConflictRecord, MemoryProposalRecord, MemoryUpdateInput, SqliteDatabase } from "./local-store.js";
13
13
  import { type AdoptedAttachment } from "./memory-attachment-store.js";
14
14
  import { type LocalEmbeddingConfig } from "./local-embedding.js";
15
15
  import { type ExtractedMemoryItem, type MemoryConsolidationResult } from "./memory-consolidation.js";
@@ -32,6 +32,10 @@ export declare class LocalMemoryProvider implements MemoryProvider {
32
32
  private attachmentStore;
33
33
  private userIdPrefix;
34
34
  private dbPath;
35
+ private attachmentsDir;
36
+ /** Active embedding model id — stamped onto stored vectors and used to skip
37
+ * incomparable vectors at search time (model switch = silent noise otherwise). */
38
+ private embeddingModelId;
35
39
  /** One-shot flag: the embedding-degradation trace is logged once per provider instance. */
36
40
  private embeddingFailureLogged;
37
41
  constructor(config: LocalMemoryProviderConfig);
@@ -67,7 +71,6 @@ export declare class LocalMemoryProvider implements MemoryProvider {
67
71
  private noteEmbeddingFailure;
68
72
  private buildEmbedding;
69
73
  search(query: string, userId: string, options?: MemorySearchOptions): Promise<MemorySearchResult[]>;
70
- ingest(messages: MemoryIngestMessage[], userId: string, options?: MemoryIngestOptions): Promise<void>;
71
74
  /** Public embedding access for task-distillation signatures (R3). Null when
72
75
  * the embedding provider is unavailable — callers must degrade, not throw. */
73
76
  embedText(text: string): Promise<Float32Array | null>;
@@ -79,12 +82,47 @@ export declare class LocalMemoryProvider implements MemoryProvider {
79
82
  }>;
80
83
  remove(memoryId: string): Promise<boolean>;
81
84
  update(memoryId: string, input: MemoryUpdateInput): Promise<boolean>;
85
+ /**
86
+ * Prompt-injection screen for L2 writes. The memory-tool path already checks
87
+ * this, but implicit extraction / distillation / RPC ingestion used to write
88
+ * UNSCREENED — recalled memories land in a system message, so this is the
89
+ * last write-side gate. Rejections are traced, never silent.
90
+ */
91
+ private screenUnsafeItems;
82
92
  /**
83
93
  * Commit extracted memory items through the single consolidation pipeline.
84
94
  */
85
95
  ingestExtracted(items: ExtractedMemoryItem[], userId: string, options?: MemoryIngestOptions): Promise<MemoryConsolidationResult>;
86
96
  observeExtracted(items: ExtractedMemoryItem[], userId: string, options?: MemoryIngestOptions): Promise<MemoryConsolidationResult>;
87
97
  proposeExtracted(items: ExtractedMemoryItem[], userId: string, options?: MemoryIngestOptions): Promise<MemoryConsolidationResult>;
98
+ /**
99
+ * Consume the pending-proposal backlog (the "proposals black hole" fix).
100
+ *
101
+ * Trust ladder, mirroring V3's graduated autonomy:
102
+ * - CORROBORATED facts — the same fact proposed again from an independent
103
+ * context (different session or different source) — commit automatically,
104
+ * with a trace. Evidence, not a confidence score, is the auto gate.
105
+ * - Feedback-distillation proposals commit alone: their >=2-evidence bar
106
+ * was already enforced upstream (idempotency-keyed sweep, §10).
107
+ * - dream-source proposals never commit alone; they only corroborate.
108
+ * - Everything else waits for corroboration and EXPIRES after the TTL —
109
+ * visibly (status=expired), not by silent deletion.
110
+ */
111
+ consumePendingProposals(userId: string, opts?: {
112
+ now?: number;
113
+ ttlMs?: number;
114
+ maxCommitsPerPass?: number;
115
+ }): Promise<{
116
+ committed: number;
117
+ merged: number;
118
+ expiredIds: string[];
119
+ pendingLeft: number;
120
+ }>;
121
+ /** Proposals for the memory candidate surface: pending (default) or the
122
+ * read-only expired history. Other statuses stay internal. */
123
+ listPendingProposals(userId: string, limit?: number, status?: "pending" | "expired"): MemoryProposalRecord[];
124
+ /** Resolve one pending proposal from the UI: confirm -> commit now; dismiss -> rejected. */
125
+ resolveProposal(userId: string, proposalId: string, action: "confirm" | "dismiss"): Promise<boolean>;
88
126
  listClaims(userId: string): MemoryClaimRecord[];
89
127
  listConflicts(userId: string): MemoryConflictRecord[];
90
128
  /**
@@ -106,7 +144,7 @@ export declare class LocalMemoryProvider implements MemoryProvider {
106
144
  * Trigger memory decay - multi-strategy (temporal + staleness + noise).
107
145
  * Also enforces capacity limit and runs vacuum for space reclamation.
108
146
  */
109
- triggerDecay(userId: string, _maxAgeDays?: number): Promise<{
147
+ triggerDecay(userId: string): Promise<{
110
148
  decayed: number;
111
149
  }>;
112
150
  /**
@@ -177,9 +215,6 @@ export declare class LocalMemoryProvider implements MemoryProvider {
177
215
  pageSize?: number;
178
216
  activeOnly?: boolean;
179
217
  }): import("./local-store-records.js").MemoryRecord[];
180
- /**
181
- * Find memories by event date (+/- tolerance). For temporal context retrieval.
182
- */
183
218
  /**
184
219
  * Return the final atlas payload: a bounded interactive record window plus
185
220
  * whole-history buckets/clusters for large timelines.
@@ -193,7 +228,8 @@ export declare class LocalMemoryProvider implements MemoryProvider {
193
228
  clusterLimit?: number;
194
229
  activeOnly?: boolean;
195
230
  }): import("./local-store-records.js").MemoryAtlasResult;
196
- findByEventDate(userId: string, targetDate: string, toleranceDays?: number): import("./local-store-records.js").MemorySearchHit[];
231
+ /** Complete tag-scoped listing (resident refresh / onboarding purge) — see store.listByTag. */
232
+ listMemoriesByTag(userId: string, tag: string, limit?: number): import("./local-store-records.js").MemoryRecord[];
197
233
  /**
198
234
  * Find related memories (event continuity detection).
199
235
  * Given a new memory, finds existing memories that are semantically related
@@ -244,7 +280,8 @@ export declare class LocalMemoryProvider implements MemoryProvider {
244
280
  metadata?: Record<string, unknown>;
245
281
  }>;
246
282
  /**
247
- * Health check - always healthy for local store.
283
+ * Health check a real probe, not a constant: reports the actual active row
284
+ * count and turns DB access errors into status "error" instead of "healthy".
248
285
  */
249
286
  health(): Promise<{
250
287
  status: string;
@@ -256,7 +293,15 @@ export declare class LocalMemoryProvider implements MemoryProvider {
256
293
  */
257
294
  count(userId: string): number;
258
295
  /**
259
- * Reset all memories for a user.
296
+ * Reset ALL long-term memory state for a user: every SQLite table (memories,
297
+ * observations, proposals, claims, conflicts, attachments index, profile KV),
298
+ * the attachment files on disk, and the task-distillation working stores
299
+ * (candidate prompts are stored in clear text — they are memory-domain data
300
+ * and must not survive a "clear my memory"). promotion-proposals.json is
301
+ * deliberately KEPT: it is the audit trail of the user's own promote/demote
302
+ * decisions and the demote map for already-created skills.
303
+ *
304
+ * Returns the number of memory rows removed (wire-compat with the old shape).
260
305
  */
261
306
  resetUser(userId: string): Promise<number>;
262
307
  /**
@@ -38,6 +38,9 @@ export interface MemoryInsertInput {
38
38
  eventDate?: string;
39
39
  tags?: string[];
40
40
  embedding?: Float32Array;
41
+ /** Provenance of `embedding` (model id). Vectors from different models are not
42
+ * comparable; search skips rows whose model/dims mismatch the query's. */
43
+ embeddingModel?: string;
41
44
  }
42
45
  export interface MemoryUpdateInput {
43
46
  text?: string;
@@ -47,6 +50,8 @@ export interface MemoryUpdateInput {
47
50
  eventDate?: string;
48
51
  tags?: string[];
49
52
  embedding?: Float32Array | null;
53
+ /** Provenance of the replacement embedding (see MemoryInsertInput). */
54
+ embeddingModel?: string;
50
55
  }
51
56
  export interface MemorySearchHit {
52
57
  id: string;
@@ -97,7 +102,7 @@ export interface MemoryAtlasResult {
97
102
  }
98
103
  export type MemorySourceKind = "manual" | "explicit" | "document" | "image" | "video" | "auto" | "turn" | "dream" | "agent" | "feedback";
99
104
  export type MemoryClaimStatus = "active" | "superseded" | "conflicted" | "archived" | "pending_confirmation";
100
- export type MemoryProposalStatus = "pending" | "accepted" | "merged" | "conflicted" | "rejected";
105
+ export type MemoryProposalStatus = "pending" | "accepted" | "merged" | "conflicted" | "rejected" | "expired";
101
106
  export interface MemoryObservationInput {
102
107
  userId: string;
103
108
  text: string;