qlogicagent 2.19.12 → 2.19.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.js +26 -25
- package/dist/cli.js +1 -1
- package/dist/host-contract.js +1 -1
- package/dist/index.js +364 -360
- package/dist/orchestration.js +7 -7
- package/dist/project-memory-host.js +10 -10
- package/dist/protocol.js +1 -1
- package/dist/types/cli/handlers/memory-handler.d.ts +4 -35
- package/dist/types/cli/rpc-registry.d.ts +4 -4
- package/dist/types/cli/task-distillation-coordinator.d.ts +48 -11
- package/dist/types/contracts/error-category.d.ts +11 -0
- package/dist/types/contracts/hooks.d.ts +2 -0
- package/dist/types/host-contract/index.d.ts +3 -3
- package/dist/types/orchestration/error-handling/error-classification.d.ts +2 -2
- package/dist/types/runtime/execution/dream-agent.d.ts +11 -1
- package/dist/types/runtime/hooks/memory-hooks.d.ts +10 -3
- package/dist/types/runtime/infra/llmrouter-managed-inference.d.ts +1 -1
- package/dist/types/runtime/memory/find-relevant-memories.d.ts +0 -44
- package/dist/types/runtime/ports/memory-provider.d.ts +15 -2
- package/dist/types/skills/memory/host-memory-provider.d.ts +43 -0
- package/dist/types/skills/memory/task-distillation.d.ts +29 -19
- package/package.json +2 -2
- package/dist/types/runtime/infra/codex-llmrouter-compat-proxy.d.ts +0 -4
- package/dist/types/skills/memory/local-store-records.d.ts +0 -206
- package/dist/types/skills/memory/local-store.d.ts +0 -376
- package/dist/types/skills/memory/memory-attachment-store.d.ts +0 -62
- package/dist/types/skills/memory/memory-consolidation.d.ts +0 -64
- package/dist/types/skills/memory/memory-db-path.d.ts +0 -13
- package/dist/types/skills/memory/proposal-consumer.d.ts +0 -51
- package/dist/types/skills/memory/sqlite-memory-mappers.d.ts +0 -7
- package/dist/types/skills/memory/sqlite-memory-schema.d.ts +0 -11
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { LocalMemoryStore } from "./local-store.js";
|
|
2
|
-
/** A pre-extracted memory item ready to be stored (no LLM needed). */
|
|
3
|
-
export interface ExtractedMemoryItem {
|
|
4
|
-
text: string;
|
|
5
|
-
category?: string;
|
|
6
|
-
importance?: number;
|
|
7
|
-
speaker?: string;
|
|
8
|
-
event_date?: string;
|
|
9
|
-
tags?: string[];
|
|
10
|
-
/** Ids of already-uploaded attachments to link to this memory on commit. */
|
|
11
|
-
attachmentIds?: string[];
|
|
12
|
-
/**
|
|
13
|
-
* Explicit confidence for evidence-bearing sources (feedback distillation — §10). When set,
|
|
14
|
-
* proposeExtracted uses it verbatim instead of the source-derived default. Other callers omit it.
|
|
15
|
-
*/
|
|
16
|
-
confidence?: number;
|
|
17
|
-
/**
|
|
18
|
-
* Evidence trail for distillation-style sources. `refs` (e.g. feedbackIds + turn:<id>) is stored
|
|
19
|
-
* on the observation for audit; `idempotencyKey` makes the proposal insert crash-safe + dedup'd.
|
|
20
|
-
*/
|
|
21
|
-
evidence?: {
|
|
22
|
-
kind: string;
|
|
23
|
-
refs: string[];
|
|
24
|
-
idempotencyKey: string;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
export interface MemoryConsolidationOptions {
|
|
28
|
-
source?: string;
|
|
29
|
-
sessionId?: string;
|
|
30
|
-
}
|
|
31
|
-
export interface MemoryConsolidationResult {
|
|
32
|
-
observationsAdded: number;
|
|
33
|
-
proposalsAdded: number;
|
|
34
|
-
claimsAdded: number;
|
|
35
|
-
conflictsAdded: number;
|
|
36
|
-
memoriesAdded: number;
|
|
37
|
-
observationIds: string[];
|
|
38
|
-
proposalIds: string[];
|
|
39
|
-
claimIds: string[];
|
|
40
|
-
conflictIds: string[];
|
|
41
|
-
}
|
|
42
|
-
export declare class MemoryConsolidator {
|
|
43
|
-
private readonly store;
|
|
44
|
-
private readonly embed;
|
|
45
|
-
constructor(store: LocalMemoryStore, embed: (text: string) => Promise<Float32Array | undefined>);
|
|
46
|
-
observe(items: ExtractedMemoryItem[], userId: string, options?: MemoryConsolidationOptions): Promise<MemoryConsolidationResult>;
|
|
47
|
-
proposeExtracted(items: ExtractedMemoryItem[], userId: string, options?: MemoryConsolidationOptions): Promise<MemoryConsolidationResult>;
|
|
48
|
-
commitExtracted(items: ExtractedMemoryItem[], userId: string, options?: MemoryConsolidationOptions): Promise<MemoryConsolidationResult>;
|
|
49
|
-
/**
|
|
50
|
-
* Find an existing active memory that is a near-duplicate of `text`.
|
|
51
|
-
* Token containment (Latin/digit words + CJK bigrams) against recent
|
|
52
|
-
* memories; digit-bearing token mismatches veto the match because numbers
|
|
53
|
-
* and ids are precise facts, not phrasing variance.
|
|
54
|
-
*/
|
|
55
|
-
private findNearDuplicateMemory;
|
|
56
|
-
}
|
|
57
|
-
/** Containment threshold above which two texts count as the same memory.
|
|
58
|
-
* Exported: the proposal consumer uses the SAME bar to group same-fact proposals. */
|
|
59
|
-
export declare const NEAR_DUPLICATE_CONTAINMENT = 0.82;
|
|
60
|
-
/** Latin/digit words plus CJK character bigrams from normalized text. */
|
|
61
|
-
export declare function dedupTokens(text: string): Set<string>;
|
|
62
|
-
/** True when either side has a digit-bearing token the other side lacks. */
|
|
63
|
-
export declare function digitTokensDiffer(a: Set<string>, b: Set<string>): boolean;
|
|
64
|
-
export declare function sourcePriorityOf(source: string): number;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { PathService } from "../../runtime/ports/index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Resolve the database file path for L2 vector memory storage.
|
|
4
|
-
* L2 vector memory is cross-project for one owner, but physically isolated by
|
|
5
|
-
* profile at ~/.qlogicagent/profiles/<owner_user_id>/memory/.
|
|
6
|
-
*/
|
|
7
|
-
export declare function resolveMemoryDbPath(ownerUserId?: string, pathService?: PathService): string;
|
|
8
|
-
/**
|
|
9
|
-
* Persistent attachment directory for long-term memory, beside the memory DB:
|
|
10
|
-
* ~/.qlogicagent/profiles/<owner_user_id>/memory/attachments/
|
|
11
|
-
* Files here live as long as the memories that reference them (no expiry).
|
|
12
|
-
*/
|
|
13
|
-
export declare function resolveMemoryAttachmentsDir(ownerUserId?: string, pathService?: PathService): string;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Proposal consumer (P0 — the factual-memory half of the promotion ladder).
|
|
3
|
-
*
|
|
4
|
-
* implicit-extract / feedback-distillation / dream all write PROPOSALS
|
|
5
|
-
* (status=pending). Before this module existed nothing ever read them back:
|
|
6
|
-
* the three automatic learning paths burned model calls writing dead rows.
|
|
7
|
-
*
|
|
8
|
-
* Trust ladder — evidence gates autonomy, mirroring the V3 skill-promotion
|
|
9
|
-
* doctrine (automatic only when the data says so; visible; revertible):
|
|
10
|
-
* - CORROBORATED: the same fact proposed >=2 times from independent
|
|
11
|
-
* contexts (different session, or different source) -> auto-commit as
|
|
12
|
-
* source "corroborated" (priority 70, so it actually becomes an active
|
|
13
|
-
* searchable memory — committing with the original implicit-extract
|
|
14
|
-
* priority 40 would just create another pending claim, i.e. the black
|
|
15
|
-
* hole one level deeper).
|
|
16
|
-
* - feedback-distillation proposals commit ALONE: their >=2-evidence bar
|
|
17
|
-
* was already enforced upstream (MIN_EVIDENCE + idempotency key, §10).
|
|
18
|
-
* - dream-tier sources (priority <= 20) never commit alone; they only
|
|
19
|
-
* corroborate facts seen elsewhere.
|
|
20
|
-
* - Everything else waits, and past the TTL flips to status "expired" —
|
|
21
|
-
* a visible terminal state, not a silent delete; the memory surface can
|
|
22
|
-
* still show expired proposals for manual rescue.
|
|
23
|
-
*
|
|
24
|
-
* Pure planning logic — no I/O; the provider executes the plan.
|
|
25
|
-
*/
|
|
26
|
-
import type { MemoryProposalRecord } from "./local-store-records.js";
|
|
27
|
-
import type { ExtractedMemoryItem } from "./memory-consolidation.js";
|
|
28
|
-
/** Uncorroborated proposals older than this flip to "expired". */
|
|
29
|
-
export declare const PROPOSAL_TTL_MS: number;
|
|
30
|
-
/** Independent contexts required for auto-commit. */
|
|
31
|
-
export declare const PROPOSAL_MIN_CORROBORATION = 2;
|
|
32
|
-
/** Idle-pass work cap; the rest stays pending for the next pass. */
|
|
33
|
-
export declare const PROPOSAL_MAX_COMMITS_PER_PASS = 20;
|
|
34
|
-
/** Source stamped on corroborated commits — registered in sourcePriorityOf. */
|
|
35
|
-
export declare const CORROBORATED_SOURCE = "corroborated";
|
|
36
|
-
export interface ProposalCommitGroup {
|
|
37
|
-
proposalIds: string[];
|
|
38
|
-
item: ExtractedMemoryItem;
|
|
39
|
-
/** Source used for the commit (drives claim authority). */
|
|
40
|
-
source: string;
|
|
41
|
-
}
|
|
42
|
-
export interface ProposalConsumptionSummary {
|
|
43
|
-
commitGroups: ProposalCommitGroup[];
|
|
44
|
-
expiredIds: string[];
|
|
45
|
-
}
|
|
46
|
-
export interface ProposalConsumptionOptions {
|
|
47
|
-
now?: number;
|
|
48
|
-
ttlMs?: number;
|
|
49
|
-
maxCommitsPerPass?: number;
|
|
50
|
-
}
|
|
51
|
-
export declare function planProposalConsumption(pending: readonly MemoryProposalRecord[], opts?: ProposalConsumptionOptions): ProposalConsumptionSummary;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { MemoryClaimRecord, MemoryConflictRecord, MemoryProposalRecord, MemoryRecord } from "./local-store-records.js";
|
|
2
|
-
export declare function rowToRecord(row: unknown): MemoryRecord;
|
|
3
|
-
export declare function rowToClaimRecord(row: unknown): MemoryClaimRecord;
|
|
4
|
-
export declare function rowToProposalRecord(row: unknown): MemoryProposalRecord;
|
|
5
|
-
export declare function rowToConflictRecord(row: unknown): MemoryConflictRecord;
|
|
6
|
-
export declare function parseJsonObject(raw: unknown): Record<string, unknown>;
|
|
7
|
-
export declare function parseJsonArray(raw: unknown): string[];
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { SqliteDatabase } from "./local-store-records.js";
|
|
2
|
-
export declare const MEMORY_SCHEMA_SQL = "\nCREATE TABLE IF NOT EXISTS memories (\n id TEXT PRIMARY KEY,\n text TEXT NOT NULL,\n user_id TEXT NOT NULL,\n category TEXT NOT NULL DEFAULT 'general',\n importance REAL NOT NULL DEFAULT 0.5,\n confidence REAL NOT NULL DEFAULT 1.0,\n source TEXT NOT NULL DEFAULT 'agent',\n session_id TEXT NOT NULL DEFAULT '',\n event_date TEXT NOT NULL DEFAULT '',\n tags TEXT NOT NULL DEFAULT '[]',\n embedding BLOB,\n created_at INTEGER NOT NULL,\n updated_at INTEGER NOT NULL,\n access_count INTEGER NOT NULL DEFAULT 0,\n last_accessed_at INTEGER NOT NULL DEFAULT 0,\n is_archived INTEGER NOT NULL DEFAULT 0,\n text_seg TEXT NOT NULL DEFAULT '',\n embedding_model TEXT NOT NULL DEFAULT '',\n embedding_dims INTEGER NOT NULL DEFAULT 0\n);\n\nCREATE INDEX IF NOT EXISTS idx_memories_user ON memories(user_id);\nCREATE INDEX IF NOT EXISTS idx_memories_user_category ON memories(user_id, category);\nCREATE INDEX IF NOT EXISTS idx_memories_user_importance ON memories(user_id, importance DESC);\nCREATE INDEX IF NOT EXISTS idx_memories_created ON memories(created_at DESC);\n\nCREATE TABLE IF NOT EXISTS memory_observations (\n id TEXT PRIMARY KEY,\n user_id TEXT NOT NULL,\n text TEXT NOT NULL,\n source TEXT NOT NULL,\n source_priority INTEGER NOT NULL DEFAULT 0,\n session_id TEXT NOT NULL DEFAULT '',\n evidence_type TEXT NOT NULL DEFAULT 'text',\n payload TEXT NOT NULL DEFAULT '{}',\n created_at INTEGER NOT NULL\n);\n\nCREATE INDEX IF NOT EXISTS idx_memory_observations_user_created ON memory_observations(user_id, created_at DESC);\nCREATE INDEX IF NOT EXISTS idx_memory_observations_source ON memory_observations(user_id, source);\n\nCREATE TABLE IF NOT EXISTS memory_proposals (\n id TEXT PRIMARY KEY,\n user_id TEXT NOT NULL,\n observation_ids TEXT NOT NULL DEFAULT '[]',\n text TEXT NOT NULL,\n category TEXT NOT NULL DEFAULT 'general',\n importance REAL NOT NULL DEFAULT 0.5,\n confidence REAL NOT NULL DEFAULT 0.5,\n source TEXT NOT NULL DEFAULT 'agent',\n source_priority INTEGER NOT NULL DEFAULT 0,\n entity TEXT NOT NULL DEFAULT '',\n predicate TEXT NOT NULL DEFAULT '',\n value_json TEXT NOT NULL DEFAULT '{}',\n valid_time TEXT NOT NULL DEFAULT '',\n tags TEXT NOT NULL DEFAULT '[]',\n status TEXT NOT NULL DEFAULT 'pending',\n related_claim_ids TEXT NOT NULL DEFAULT '[]',\n idempotency_key TEXT,\n created_at INTEGER NOT NULL,\n updated_at INTEGER NOT NULL\n);\n\nCREATE INDEX IF NOT EXISTS idx_memory_proposals_user_status ON memory_proposals(user_id, status);\nCREATE INDEX IF NOT EXISTS idx_memory_proposals_fact ON memory_proposals(user_id, entity, predicate, valid_time);\n\nCREATE TABLE IF NOT EXISTS memory_claims (\n id TEXT PRIMARY KEY,\n memory_id TEXT NOT NULL DEFAULT '',\n user_id TEXT NOT NULL,\n entity TEXT NOT NULL DEFAULT '',\n predicate TEXT NOT NULL DEFAULT '',\n value_json TEXT NOT NULL DEFAULT '{}',\n text TEXT NOT NULL,\n category TEXT NOT NULL DEFAULT 'general',\n importance REAL NOT NULL DEFAULT 0.5,\n confidence REAL NOT NULL DEFAULT 0.5,\n source TEXT NOT NULL DEFAULT 'agent',\n source_priority INTEGER NOT NULL DEFAULT 0,\n status TEXT NOT NULL DEFAULT 'active',\n valid_time TEXT NOT NULL DEFAULT '',\n evidence_ids TEXT NOT NULL DEFAULT '[]',\n supersedes_claim_id TEXT NOT NULL DEFAULT '',\n conflict_group_id TEXT NOT NULL DEFAULT '',\n created_at INTEGER NOT NULL,\n updated_at INTEGER NOT NULL\n);\n\nCREATE INDEX IF NOT EXISTS idx_memory_claims_user_status ON memory_claims(user_id, status);\nCREATE INDEX IF NOT EXISTS idx_memory_claims_memory ON memory_claims(memory_id);\nCREATE INDEX IF NOT EXISTS idx_memory_claims_fact ON memory_claims(user_id, entity, predicate, valid_time);\n\nCREATE TABLE IF NOT EXISTS memory_conflicts (\n id TEXT PRIMARY KEY,\n user_id TEXT NOT NULL,\n claim_a_id TEXT NOT NULL,\n claim_b_id TEXT NOT NULL,\n reason TEXT NOT NULL,\n status TEXT NOT NULL DEFAULT 'open',\n created_at INTEGER NOT NULL,\n updated_at INTEGER NOT NULL\n);\n\nCREATE INDEX IF NOT EXISTS idx_memory_conflicts_user_status ON memory_conflicts(user_id, status);\n\nCREATE TABLE IF NOT EXISTS memory_attachments (\n id TEXT PRIMARY KEY,\n memory_id TEXT NOT NULL DEFAULT '',\n user_id TEXT NOT NULL,\n kind TEXT NOT NULL DEFAULT 'file',\n filename TEXT NOT NULL DEFAULT '',\n mime_type TEXT NOT NULL DEFAULT '',\n size INTEGER NOT NULL DEFAULT 0,\n rel_path TEXT NOT NULL,\n extracted_text TEXT NOT NULL DEFAULT '',\n created_at INTEGER NOT NULL\n);\n\nCREATE INDEX IF NOT EXISTS idx_memory_attachments_memory ON memory_attachments(memory_id);\nCREATE INDEX IF NOT EXISTS idx_memory_attachments_orphan ON memory_attachments(user_id, memory_id, created_at);\n\n";
|
|
3
|
-
/**
|
|
4
|
-
* FTS index + sync triggers, kept as a separate DDL block because the CJK
|
|
5
|
-
* migration below must DROP and re-create exactly this set — a second copy
|
|
6
|
-
* would drift. The index covers the pre-segmented shadow column `text_seg`
|
|
7
|
-
* (see fts-segment.ts), NOT raw `text`: unicode61 cannot segment CJK, so raw
|
|
8
|
-
* Chinese text is unsearchable by keyword.
|
|
9
|
-
*/
|
|
10
|
-
export declare const MEMORY_FTS_SCHEMA_SQL = "\nCREATE VIRTUAL TABLE IF NOT EXISTS memories_fts USING fts5(\n id UNINDEXED,\n user_id UNINDEXED,\n text_seg,\n category,\n tags,\n content=memories,\n content_rowid=rowid,\n tokenize='unicode61 remove_diacritics 2'\n);\n\nCREATE TRIGGER IF NOT EXISTS memories_ai AFTER INSERT ON memories BEGIN\n INSERT INTO memories_fts(rowid, id, user_id, text_seg, category, tags)\n VALUES (new.rowid, new.id, new.user_id, new.text_seg, new.category, new.tags);\nEND;\n\nCREATE TRIGGER IF NOT EXISTS memories_ad AFTER DELETE ON memories BEGIN\n INSERT INTO memories_fts(memories_fts, rowid, id, user_id, text_seg, category, tags)\n VALUES ('delete', old.rowid, old.id, old.user_id, old.text_seg, old.category, old.tags);\nEND;\n\nCREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE ON memories BEGIN\n INSERT INTO memories_fts(memories_fts, rowid, id, user_id, text_seg, category, tags)\n VALUES ('delete', old.rowid, old.id, old.user_id, old.text_seg, old.category, old.tags);\n INSERT INTO memories_fts(rowid, id, user_id, text_seg, category, tags)\n VALUES (new.rowid, new.id, new.user_id, new.text_seg, new.category, new.tags);\nEND;\n";
|
|
11
|
-
export declare function initializeMemorySchema(db: SqliteDatabase): void;
|