qlogicagent 2.18.9 → 2.18.10

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 (62) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/host-contract.js +1 -1
  3. package/dist/index.js +445 -984
  4. package/dist/pet-host.js +8 -8
  5. package/dist/project-memory-host.js +40 -0
  6. package/dist/protocol.js +1 -1
  7. package/dist/types/cli/acp-session-host.d.ts +1 -1
  8. package/dist/types/cli/community-resource-installer.d.ts +3 -5
  9. package/dist/types/cli/default-project-bootstrap.d.ts +1 -1
  10. package/dist/types/cli/handlers/agents-handler.d.ts +8 -6
  11. package/dist/types/cli/handlers/community-handler.d.ts +0 -4
  12. package/dist/types/cli/handlers/control-handler.d.ts +1 -1
  13. package/dist/types/cli/handlers/project-handler.d.ts +1 -1
  14. package/dist/types/cli/handlers/session-handler.d.ts +0 -7
  15. package/dist/types/cli/handlers/solo-handler.d.ts +0 -2
  16. package/dist/types/cli/memory-coordinator.d.ts +1 -1
  17. package/dist/types/cli/multi-agent-state-coordinator.d.ts +0 -3
  18. package/dist/types/cli/pet-runtime.d.ts +5 -5
  19. package/dist/types/cli/product-coordinator.d.ts +0 -2
  20. package/dist/types/cli/project-memory-store-factory.d.ts +11 -1
  21. package/dist/types/cli/rpc-registry.d.ts +0 -2
  22. package/dist/types/cli/stdio-runtime-bootstrap.d.ts +2 -0
  23. package/dist/types/cli/stdio-runtime-services.d.ts +2 -0
  24. package/dist/types/cli/stdio-server.d.ts +3 -1
  25. package/dist/types/config/cn-mirror.d.ts +2 -2
  26. package/dist/types/host-contract/index.d.ts +167 -9
  27. package/dist/types/orchestration/agent-instance.d.ts +1 -3
  28. package/dist/types/orchestration/goal-mode-adapters.d.ts +0 -3
  29. package/dist/types/orchestration/goal-run-persistence.d.ts +0 -3
  30. package/dist/types/orchestration/product-persistence.d.ts +1 -4
  31. package/dist/types/orchestration/product-planner.d.ts +2 -3
  32. package/dist/types/orchestration/run-state-host-authority.d.ts +7 -0
  33. package/dist/types/orchestration/solo-evaluator.d.ts +2 -3
  34. package/dist/types/orchestration/solo-persistence.d.ts +4 -7
  35. package/dist/types/orchestration/testing/delegate-test-bridge.d.ts +13 -2
  36. package/dist/types/orchestration/workflow/node-schema.d.ts +2 -1
  37. package/dist/types/orchestration/workflow/qla-executor-host.d.ts +1 -1
  38. package/dist/types/orchestration/workflow/workflow-bundle.d.ts +1 -1
  39. package/dist/types/project-memory-host.d.ts +3 -0
  40. package/dist/types/protocol/wire/acp-agent-management.d.ts +1 -1
  41. package/dist/types/protocol/wire/acp-protocol.d.ts +1 -1
  42. package/dist/types/runtime/infra/acp-detector.d.ts +1 -1
  43. package/dist/types/runtime/infra/background-tasks.d.ts +1 -1
  44. package/dist/types/runtime/pet/pet-community-assets.d.ts +7 -17
  45. package/dist/types/runtime/pet/petdex-vision-qa.d.ts +12 -0
  46. package/dist/types/runtime/ports/memory-recall-source.d.ts +10 -0
  47. package/dist/types/runtime/ports/project-memory-store.d.ts +1 -1
  48. package/dist/types/runtime/session/session-persistence.d.ts +3 -4
  49. package/dist/types/skills/memory/host-memory-provider.d.ts +2 -2
  50. package/dist/types/skills/memory/memory-config-resolver.d.ts +4 -0
  51. package/dist/types/skills/memory/task-distillation.d.ts +1 -1
  52. package/dist/types/test-support/run-state-authority-setup.d.ts +1 -0
  53. package/dist/types/transport/host-pet-client.d.ts +20 -0
  54. package/dist/types/transport/host-run-state-client.d.ts +17 -0
  55. package/dist/workflow-host.js +9 -9
  56. package/package.json +12 -2
  57. package/dist/runtime/infra/mcp-bridge-server.js +0 -338
  58. package/dist/types/cli/handlers/message-feedback-handler.d.ts +0 -31
  59. package/dist/types/runtime/infra/agent-process.d.ts +0 -368
  60. package/dist/types/runtime/infra/external-agent-pool.d.ts +0 -89
  61. package/dist/types/skills/memory/local-memory-provider.d.ts +0 -325
  62. package/dist/types/skills/memory/memory-provider-factory.d.ts +0 -33
@@ -1,325 +0,0 @@
1
- /**
2
- * Local Memory Provider - implements MemoryProvider using local SQLite store.
3
- *
4
- * This is the default provider for desktop use. Requires no external service.
5
- * Uses FTS5 for keyword search and optionally embedding API for vector search.
6
- *
7
- * Falls back gracefully:
8
- * - With embedding API configured: hybrid search (FTS + vector)
9
- * - Without embedding: FTS-only search (still useful for exact/keyword matches)
10
- */
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
- import { type AdoptedAttachment } from "./memory-attachment-store.js";
14
- import { type LocalEmbeddingConfig } from "./local-embedding.js";
15
- import { type ExtractedMemoryItem, type MemoryConsolidationResult } from "./memory-consolidation.js";
16
- export type { ExtractedMemoryItem } from "./memory-consolidation.js";
17
- export interface LocalMemoryProviderConfig {
18
- /** Active owner profile. Determines the physical SQLite database location. */
19
- ownerUserId?: string;
20
- /** Embedding configuration. If omitted, uses FTS-only search. */
21
- embedding?: LocalEmbeddingConfig;
22
- /** User ID prefix for multi-tenant isolation. */
23
- userIdPrefix?: string;
24
- /** Factory function to create the SQLite database instance. */
25
- createDatabase?: (dbPath: string) => SqliteDatabase;
26
- }
27
- export declare class LocalMemoryProvider implements MemoryProvider {
28
- readonly providerId = "qmemory-local";
29
- private store;
30
- private embedding;
31
- private consolidator;
32
- private attachmentStore;
33
- private userIdPrefix;
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;
39
- /** One-shot flag: the embedding-degradation trace is logged once per provider instance. */
40
- private embeddingFailureLogged;
41
- constructor(config: LocalMemoryProviderConfig);
42
- /** Persist an uploaded attachment (orphan until linked at commit). */
43
- adoptAttachment(input: {
44
- data?: Buffer;
45
- sourceUrl?: string;
46
- filename: string;
47
- mimeType: string;
48
- userId: string;
49
- }): Promise<AdoptedAttachment>;
50
- /** Resolve an attachment id to its on-disk path (for serving). */
51
- locateAttachment(id: string): Promise<{
52
- absPath: string;
53
- mimeType: string;
54
- filename: string;
55
- } | null>;
56
- /** Drop uploads that were never saved to a memory. */
57
- purgeOrphanAttachments(): Promise<void>;
58
- /** Read an attachment's bytes + mime (P2 multimodal understanding). */
59
- readAttachmentBytes(id: string): Promise<{
60
- bytes: Buffer;
61
- mimeType: string;
62
- } | null>;
63
- /** Persist the understood/extracted text on an attachment row. */
64
- setAttachmentText(id: string, text: string): void;
65
- private resolveUserId;
66
- /**
67
- * The embedding API failing silently downgrades every search to FTS-only —
68
- * leave one error-level trace per provider instance (deduped so a broken
69
- * endpoint does not flood the log on every query).
70
- */
71
- private noteEmbeddingFailure;
72
- private buildEmbedding;
73
- search(query: string, userId: string, options?: MemorySearchOptions): Promise<MemorySearchResult[]>;
74
- /** Public embedding access for task-distillation signatures (R3). Null when
75
- * the embedding provider is unavailable — callers must degrade, not throw.
76
- * B3(X7): returns number[] (not Float32Array) — this method is on the 16-method
77
- * host-state proxy surface and its result crosses the x/host.request JSON wire
78
- * in host mode; typed arrays do not survive JSON serialization. */
79
- embedText(text: string): Promise<number[] | null>;
80
- addText(text: string, userId: string, options?: MemoryIngestOptions & {
81
- category?: string;
82
- importance?: number;
83
- }): Promise<{
84
- memoriesAdded: number;
85
- }>;
86
- remove(memoryId: string): Promise<boolean>;
87
- update(memoryId: string, input: MemoryUpdateInput): Promise<boolean>;
88
- /**
89
- * Prompt-injection screen for L2 writes. The memory-tool path already checks
90
- * this, but implicit extraction / distillation / RPC ingestion used to write
91
- * UNSCREENED — recalled memories land in a system message, so this is the
92
- * last write-side gate. Rejections are traced, never silent.
93
- */
94
- private screenUnsafeItems;
95
- /**
96
- * Commit extracted memory items through the single consolidation pipeline.
97
- */
98
- ingestExtracted(items: ExtractedMemoryItem[], userId: string, options?: MemoryIngestOptions): Promise<MemoryConsolidationResult>;
99
- observeExtracted(items: ExtractedMemoryItem[], userId: string, options?: MemoryIngestOptions): Promise<MemoryConsolidationResult>;
100
- proposeExtracted(items: ExtractedMemoryItem[], userId: string, options?: MemoryIngestOptions): Promise<MemoryConsolidationResult>;
101
- /**
102
- * Consume the pending-proposal backlog (the "proposals black hole" fix).
103
- *
104
- * Trust ladder, mirroring V3's graduated autonomy:
105
- * - CORROBORATED facts — the same fact proposed again from an independent
106
- * context (different session or different source) — commit automatically,
107
- * with a trace. Evidence, not a confidence score, is the auto gate.
108
- * - Feedback-distillation proposals commit alone: their >=2-evidence bar
109
- * was already enforced upstream (idempotency-keyed sweep, §10).
110
- * - dream-source proposals never commit alone; they only corroborate.
111
- * - Everything else waits for corroboration and EXPIRES after the TTL —
112
- * visibly (status=expired), not by silent deletion.
113
- */
114
- consumePendingProposals(userId: string, opts?: {
115
- now?: number;
116
- ttlMs?: number;
117
- maxCommitsPerPass?: number;
118
- }): Promise<{
119
- committed: number;
120
- merged: number;
121
- expiredIds: string[];
122
- pendingLeft: number;
123
- }>;
124
- /** Proposals for the memory candidate surface: pending (default) or the
125
- * read-only expired history. Other statuses stay internal. */
126
- listPendingProposals(userId: string, limit?: number, status?: "pending" | "expired"): MemoryProposalRecord[];
127
- /** Resolve one pending proposal from the UI: confirm -> commit now; dismiss -> rejected. */
128
- resolveProposal(userId: string, proposalId: string, action: "confirm" | "dismiss"): Promise<boolean>;
129
- listClaims(userId: string): MemoryClaimRecord[];
130
- listConflicts(userId: string): MemoryConflictRecord[];
131
- /**
132
- * Drain the consolidation backlog: auto-resolve open conflicts and promote
133
- * corroborated pending claims. Called by dream after consolidation so the
134
- * observation→proposal→claim pipeline doesn't accumulate unresolved state
135
- * forever (the "proposals black hole").
136
- *
137
- * Conflict winner = higher source priority, then confidence, then recency.
138
- * The loser claim is superseded and its backing memory archived.
139
- */
140
- resolveConflicts(userId: string, opts?: {
141
- minEvidenceToPromote?: number;
142
- }): Promise<{
143
- conflictsResolved: number;
144
- claimsPromoted: number;
145
- }>;
146
- /**
147
- * Trigger memory decay - multi-strategy (temporal + staleness + noise).
148
- * Also enforces capacity limit and runs vacuum for space reclamation.
149
- */
150
- triggerDecay(userId: string): Promise<{
151
- decayed: number;
152
- }>;
153
- /**
154
- * Apply feedback to a memory (useful/irrelevant/outdated/wrong).
155
- * Adjusts importance or archives/deletes based on signal.
156
- */
157
- /** V3 promote/demote: archive(技能接棒,记忆退役)与 unarchive(降格回归)成对。
158
- * claims 状态随动,防 archived 记忆的 claim 继续参与冲突/召回。
159
- * B3(X7)异步化:16 面 host-state proxy 方法,签名统一 Promise(实现体仍同步)。 */
160
- setMemoryArchived(memoryId: string, archived: boolean): Promise<boolean>;
161
- feedback(memoryIds: string[], signal: "useful" | "irrelevant" | "outdated" | "wrong"): Promise<{
162
- affected: number;
163
- }>;
164
- /**
165
- * Get a user profile value.
166
- */
167
- getProfile(userId: string, key: string): string | null;
168
- /**
169
- * Set a user profile value (upsert).
170
- * B3(X7)异步化:16 面 host-state proxy 方法。
171
- */
172
- setProfile(userId: string, key: string, value: string): Promise<void>;
173
- /**
174
- * Get all profile entries for a user.
175
- * B3(X7)异步化:16 面 host-state proxy 方法。
176
- */
177
- getAllProfiles(userId: string): Promise<Record<string, string>>;
178
- /**
179
- * Delete a profile entry.
180
- */
181
- deleteProfile(userId: string, key: string): boolean;
182
- /**
183
- * Get memories within a time range, grouped by day.
184
- * Powers "what happened last week" type queries.
185
- */
186
- getTemporalSlice(userId: string, startMs: number, endMs: number, options?: {
187
- category?: string;
188
- limit?: number;
189
- }): {
190
- date: string;
191
- memories: Array<{
192
- id: string;
193
- text: string;
194
- category: string;
195
- importance: number;
196
- }>;
197
- }[];
198
- /**
199
- * Get activity summary over recent N days (daily counts + highlights).
200
- * B3(X7)异步化:16 面 host-state proxy 方法。
201
- */
202
- getActivitySummary(userId: string, days?: number): Promise<{
203
- dailyCounts: Array<{
204
- date: string;
205
- count: number;
206
- }>;
207
- highlights: Array<{
208
- id: string;
209
- text: string;
210
- category: string;
211
- importance: number;
212
- date: string;
213
- }>;
214
- }>;
215
- /**
216
- * List full memory records for a user (paginated). Used by the memory atlas
217
- * visualization, which needs the complete record shape (confidence, importance,
218
- * accessCount, timestamps, tags) to drive its 3D rendering.
219
- */
220
- list(userId: string, options?: {
221
- page?: number;
222
- pageSize?: number;
223
- activeOnly?: boolean;
224
- }): import("./local-store-records.js").MemoryRecord[];
225
- /**
226
- * Return the final atlas payload: a bounded interactive record window plus
227
- * whole-history buckets/clusters for large timelines.
228
- * B3(X7)异步化:16 面 host-state proxy 方法。
229
- */
230
- getAtlas(userId: string, options?: {
231
- pageSize?: number;
232
- windowStartAt?: number;
233
- windowEndAt?: number;
234
- windowCenterAt?: number;
235
- bucketCount?: number;
236
- clusterLimit?: number;
237
- activeOnly?: boolean;
238
- }): Promise<import("./local-store-records.js").MemoryAtlasResult>;
239
- /** Complete tag-scoped listing (resident refresh / onboarding purge) — see store.listByTag. */
240
- listMemoriesByTag(userId: string, tag: string): import("./local-store-records.js").MemoryRecord[];
241
- /**
242
- * Find related memories (event continuity detection).
243
- * Given a new memory, finds existing memories that are semantically related
244
- * (cosine 0.6-0.82) and from the past 14 days. These represent continuations
245
- * of an ongoing event/thread.
246
- *
247
- * Example: "interviewed with ByteDance on Monday" -> finds "sent ByteDance resume last week" -> linked event chain.
248
- */
249
- findRelatedEvents(text: string, userId: string, options?: {
250
- maxDaysBack?: number;
251
- minSimilarity?: number;
252
- maxSimilarity?: number;
253
- limit?: number;
254
- }): Promise<Array<{
255
- id: string;
256
- text: string;
257
- score: number;
258
- date: string;
259
- }>>;
260
- /**
261
- * Synthesize a temporal narrative from memories in a time range.
262
- * Returns a structured timeline suitable for prompt injection.
263
- * B3(X7)异步化:16 面 host-state proxy 方法。
264
- */
265
- synthesizeTimeline(userId: string, startMs: number, endMs: number): Promise<string>;
266
- /**
267
- * Rerank search results by applying recency boost, access frequency,
268
- * and importance weighting. No LLM needed - pure scoring heuristics.
269
- *
270
- * This goes beyond basic search scoring by considering:
271
- * - Temporal proximity (recent memories get boosted)
272
- * - Access frequency (frequently recalled = more relevant)
273
- * - Category alignment (if preferredCategories specified)
274
- */
275
- rerank(results: Array<{
276
- id: string;
277
- text: string;
278
- score: number;
279
- category?: string;
280
- metadata?: Record<string, unknown>;
281
- }>, options?: {
282
- preferredCategories?: string[];
283
- recencyBoostDays?: number;
284
- }): Array<{
285
- id: string;
286
- text: string;
287
- score: number;
288
- category?: string;
289
- metadata?: Record<string, unknown>;
290
- }>;
291
- /**
292
- * Health check — a real probe, not a constant: reports the actual active row
293
- * count and turns DB access errors into status "error" instead of "healthy".
294
- */
295
- health(): Promise<{
296
- status: string;
297
- memoryCount: number;
298
- dbPath: string;
299
- }>;
300
- /**
301
- * Get memory count for a user.
302
- */
303
- count(userId: string): number;
304
- /**
305
- * Reset ALL long-term memory state for a user: every SQLite table (memories,
306
- * observations, proposals, claims, conflicts, attachments index, profile KV),
307
- * the attachment files on disk, and the task-distillation working stores
308
- * (candidate prompts are stored in clear text — they are memory-domain data
309
- * and must not survive a "clear my memory"). promotion-proposals.json is
310
- * deliberately KEPT: it is the audit trail of the user's own promote/demote
311
- * decisions and the demote map for already-created skills.
312
- *
313
- * Returns the number of memory rows removed (wire-compat with the old shape).
314
- */
315
- resetUser(userId: string): Promise<number>;
316
- /**
317
- * Close the database connection.
318
- */
319
- close(): void;
320
- }
321
- /**
322
- * Create a local memory provider (convenience factory).
323
- * Caller must provide the createDatabase factory to avoid hard dependency on better-sqlite3.
324
- */
325
- export declare function createLocalMemoryProvider(config: LocalMemoryProviderConfig): LocalMemoryProvider;
@@ -1,33 +0,0 @@
1
- /**
2
- * Memory Provider Factory — creates local SQLite memory provider.
3
- *
4
- * No remote/cloud memory service exists. Memory is always local.
5
- * This factory is the single integration point for stdio-server.ts.
6
- */
7
- import type { LocalMemoryProvider } from "./local-memory-provider.js";
8
- import { type MemoryProviderFactoryConfig } from "./memory-embedding-config.js";
9
- export type { MemoryProviderFactoryConfig } from "./memory-embedding-config.js";
10
- export interface MemoryProviderFactoryResult {
11
- provider: LocalMemoryProvider | null;
12
- mode: "local" | "none";
13
- error?: string;
14
- }
15
- /**
16
- * Create the local SQLite memory provider.
17
- * Returns null (mode "none") only if better-sqlite3 is not available.
18
- */
19
- export declare function createMemoryProvider(config: MemoryProviderFactoryConfig): MemoryProviderFactoryResult;
20
- /**
21
- * Build MemoryProviderFactoryConfig from environment variables.
22
- * Used by stdio-server to auto-configure memory.
23
- *
24
- * Environment variables:
25
- * QMEMORY_EMBEDDING_TIMEOUT_MS — embedding request timeout (default: 1500)
26
- * QMEMORY_USER_PREFIX — user ID prefix for multi-tenant
27
- *
28
- * Fixed embedding resolution:
29
- * Layer 0: Explicit ModelRegistry "embedding" binding
30
- * Layer 1: LLM Router default embedding endpoint (BAAI/bge-m3)
31
- * Layer 2: FTS5 pure text (NullEmbeddingProvider)
32
- */
33
- export declare function resolveMemoryConfigFromEnv(): MemoryProviderFactoryConfig;