qlogicagent 2.10.50 → 2.11.1

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 (44) hide show
  1. package/dist/cli.js +321 -362
  2. package/dist/index.js +321 -362
  3. package/dist/pet-contracts.js +1 -1
  4. package/dist/protocol.js +1 -1
  5. package/dist/types/cli/acp-commands.d.ts +32 -0
  6. package/dist/types/cli/acp-session-handlers.d.ts +36 -25
  7. package/dist/types/cli/acp-session-host.d.ts +24 -0
  8. package/dist/types/cli/handlers/memory-handler.d.ts +10 -1
  9. package/dist/types/cli/handlers/pet-handler.d.ts +5 -11
  10. package/dist/types/cli/media-runtime-facade.d.ts +9 -1
  11. package/dist/types/cli/memory-candidate-service.d.ts +10 -1
  12. package/dist/types/cli/pet-runtime.d.ts +28 -6
  13. package/dist/types/cli/provider-core-facade.d.ts +3 -0
  14. package/dist/types/pet-contracts.d.ts +1 -1
  15. package/dist/types/protocol/methods.d.ts +1 -38
  16. package/dist/types/protocol/wire/acp-protocol.d.ts +64 -162
  17. package/dist/types/protocol/wire/agent-events.d.ts +2 -2
  18. package/dist/types/protocol/wire/agent-methods.d.ts +1 -30
  19. package/dist/types/protocol/wire/agent-rpc.d.ts +0 -15
  20. package/dist/types/protocol/wire/chat-types.d.ts +3 -3
  21. package/dist/types/protocol/wire/gateway-rpc.d.ts +30 -0
  22. package/dist/types/protocol/wire/index.d.ts +3 -3
  23. package/dist/types/protocol/wire/notification-payloads.d.ts +39 -5
  24. package/dist/types/protocol/wire/pet-contracts.d.ts +75 -2
  25. package/dist/types/protocol/wire/thread-protocol.d.ts +0 -12
  26. package/dist/types/runtime/infra/acp-detector.d.ts +5 -0
  27. package/dist/types/runtime/infra/acp-host-handler.d.ts +23 -0
  28. package/dist/types/runtime/pet/index.d.ts +4 -4
  29. package/dist/types/runtime/pet/pet-file-loader.d.ts +4 -61
  30. package/dist/types/runtime/pet/pet-profile-service.d.ts +51 -10
  31. package/dist/types/runtime/pet/petdex-asset.d.ts +138 -0
  32. package/dist/types/runtime/pet/petdex-forge-service.d.ts +110 -0
  33. package/dist/types/runtime/ports/memory-provider.d.ts +35 -0
  34. package/dist/types/skills/memory/local-memory-provider.d.ts +25 -0
  35. package/dist/types/skills/memory/local-store.d.ts +48 -0
  36. package/dist/types/skills/memory/memory-attachment-store.d.ts +62 -0
  37. package/dist/types/skills/memory/memory-consolidation.d.ts +2 -0
  38. package/dist/types/skills/memory/memory-db-path.d.ts +6 -0
  39. package/dist/types/skills/memory/sqlite-memory-schema.d.ts +1 -1
  40. package/dist/types/skills/tools/petdex-create-tool.d.ts +61 -0
  41. package/dist/types/transport/acp-server.d.ts +26 -8
  42. package/package.json +4 -2
  43. package/dist/types/runtime/pet/pet-consistency.d.ts +0 -79
  44. package/dist/types/runtime/pet/pet-skeleton.d.ts +0 -70
@@ -132,18 +132,6 @@ export interface ThreadCreateParams {
132
132
  /** LLM configuration. */
133
133
  config?: Record<string, unknown>;
134
134
  }
135
- /** `thread/turn` params — submit a user message to a thread. */
136
- export interface ThreadTurnParams {
137
- /** Thread ID. */
138
- threadId: string;
139
- /** User message(s). */
140
- messages: Array<{
141
- role: "user";
142
- content: string;
143
- }>;
144
- /** Override LLM config for this turn. */
145
- config?: Record<string, unknown>;
146
- }
147
135
  /** `thread/list` result. */
148
136
  export interface ThreadListResult {
149
137
  threads: Array<{
@@ -8,6 +8,11 @@
8
8
  */
9
9
  import type { AcpBackendConfig, AgentDescriptor, AgentConfigStoreData } from "../../protocol/wire/acp-agent-management.js";
10
10
  export declare const ACP_BACKENDS: Record<string, AcpBackendConfig>;
11
+ export declare function resolveWindowsCopilotLoader(): string | null;
12
+ export declare function normalizeWindowsAcpCommand(cliPath: string, args: string[]): {
13
+ cliPath: string;
14
+ acpArgs: string[];
15
+ };
11
16
  export declare class AcpDetector {
12
17
  private cache;
13
18
  private configStore;
@@ -0,0 +1,23 @@
1
+ import type { AcpHostRequestHandler } from "./acp-protocol-adapter.js";
2
+ interface HostHandlerOpts {
3
+ cwd: string;
4
+ }
5
+ /**
6
+ * Host-side reverse-RPC handler for an EXTERNAL ACP agent (codex/copilot/…).
7
+ *
8
+ * Auto-allows permissions (the external agent runs under the qlogicagent host's
9
+ * trust, matching the internal sub-agent baseline), serves fs read/write confined
10
+ * to the agent cwd, and runs terminals as real child processes. Terminals are
11
+ * tracked in a Map so the agent process lifecycle (detach/kill) can reap them via
12
+ * disposeAll().
13
+ *
14
+ * Terminal response shapes align with the official ACP schema
15
+ * (@zed-industries/agent-client-protocol):
16
+ * - createTerminal -> { terminalId }
17
+ * - terminalOutput -> { output, truncated, exitStatus: {exitCode, signal} | null }
18
+ * - waitForTerminalExit -> { exitCode, signal }
19
+ */
20
+ export declare function createAcpHostHandler(opts: HostHandlerOpts): AcpHostRequestHandler & {
21
+ disposeAll(): void;
22
+ };
23
+ export {};
@@ -3,9 +3,9 @@
3
3
  */
4
4
  export { PetSoulService } from "./pet-soul-service.js";
5
5
  export type { PetSoul, PetStats, PetBreed } from "./pet-types.js";
6
- export { PetProfileService, type PetProfile, type PetPreferences, type PetCustomPet, type PetCustomPetSummary, type JourneySnapshot } from "./pet-profile-service.js";
6
+ export { PetProfileService, type PetProfile, type PetPreferences, type PetdexPetAsset, type PetdexPetAssetSummary, type JourneySnapshot } from "./pet-profile-service.js";
7
+ export { PETDEX_ANIMATION_IDS, createPetdexAssetFromSpritesheet, listBuiltinPetdexAssetIds, listBuiltinPetdexAssets, petdexImageDataUrl, toPetdexAssetSummary, writePetdexAssetPackage, type PetdexAnimationId, type PetdexValidationReport } from "./petdex-asset.js";
8
+ export { buildPetdexAtlasPrompt, forgePetdexAsset, forgePetdexAssetPackage, readGeneratedPetdexImage } from "./petdex-forge-service.js";
7
9
  export { maybeGenerateReaction, generateLLMReaction, type ReactionPool, type LLMReactionContext, type ReactionStyle } from "./pet-reaction-service.js";
8
10
  export { PetGrowthEngine, type GrowthEvent, type MoltResult, type PetDisplayTrait } from "./pet-growth-engine.js";
9
- export { loadPetFile, validatePetManifest, sanitizeSvg, type PetManifest, type PetFileBundle } from "./pet-file-loader.js";
10
- export { buildSkeletonPrompt, parseSkeleton, renderState, extractColors, validateSkeleton, STATE_ANIMATION_MAP, type PetSkeleton, type SkeletonPart, type StateAnimationParams } from "./pet-skeleton.js";
11
- export { evaluateConsistency, evaluateConsistencyWithVision, structuralConsistencyScore, buildConsistencyPrompt, parseConsistencyResponse, buildRetryPrompt, DEFAULT_THRESHOLD, DEFAULT_MAX_RETRIES, type ConsistencyResult, type ConsistencyReport, type ConsistencyOptions } from "./pet-consistency.js";
11
+ export { loadPetFile, validatePetManifest, type PetManifest, type PetFileBundle } from "./pet-file-loader.js";
@@ -1,62 +1,5 @@
1
- /**
2
- * Pet File Loader — loads, validates, and sanitizes .pet bundles.
3
- *
4
- * Design §14.2: .pet is a zip file containing manifest.json + SVG states + thumbnail.
5
- * Design §16.2: Security — SVG sanitize (remove scripts, foreign objects, event handlers).
6
- *
7
- * This module handles:
8
- * - Zip extraction
9
- * - Manifest JSON Schema validation
10
- * - SVG sanitization (whitelist-based)
11
- * - File size enforcement
12
- */
13
- export interface PetManifest {
14
- version: number;
15
- name: string;
16
- author: string;
17
- created: string;
18
- generator?: string;
19
- source?: {
20
- type: "image" | "text" | "dialogue";
21
- prompt?: string;
22
- };
23
- dimensions: {
24
- width: number;
25
- height: number;
26
- };
27
- states: Record<string, {
28
- file: string;
29
- loop: boolean;
30
- duration?: number;
31
- }>;
32
- eyeTracking?: {
33
- enabled: boolean;
34
- pupils: string[];
35
- maxOffset: number;
36
- };
37
- colors?: {
38
- primary: string;
39
- secondary?: string;
40
- accent?: string;
41
- };
42
- }
43
- export interface PetFileBundle {
44
- manifest: PetManifest;
45
- svgs: Record<string, string>;
46
- thumbnail?: string;
47
- hash: string;
48
- }
49
- /**
50
- * Load and validate a .pet file from disk.
51
- * Returns a PetFileBundle with sanitized SVGs, or throws on validation failure.
52
- */
1
+ import { type PetdexAssetManifest, type PetdexAssetPackage, type PetdexAssetValidation } from "./petdex-asset.js";
2
+ export type PetManifest = PetdexAssetManifest;
3
+ export type PetFileBundle = PetdexAssetPackage;
53
4
  export declare function loadPetFile(filePath: string): Promise<PetFileBundle>;
54
- /**
55
- * Validate manifest structure. Throws on invalid.
56
- */
57
- export declare function validatePetManifest(manifest: unknown): asserts manifest is PetManifest;
58
- /**
59
- * Sanitize SVG content — remove dangerous elements and attributes.
60
- * Whitelist-based approach (design §16.2).
61
- */
62
- export declare function sanitizeSvg(svgContent: string): string;
5
+ export declare function validatePetManifest(manifest: unknown, spritesheet?: Buffer): PetdexAssetValidation;
@@ -1,19 +1,52 @@
1
1
  import type { PetSoul } from "./pet-types.js";
2
2
  export interface PetPreferences {
3
3
  enabled: boolean;
4
- selectedBreed: string;
5
- selectedCustomPetId: string | null;
4
+ selectedPetAssetId: string;
6
5
  }
7
- export interface PetCustomPetSummary {
6
+ export interface PetdexPetAssetSummary {
8
7
  id: string;
8
+ assetKind: "petdex";
9
+ sourceKind?: "builtin" | "upload" | "forge";
9
10
  name: string;
10
11
  description: string;
11
12
  createdAt: string;
12
13
  updatedAt: string;
14
+ atlas: PetdexPetAssetSummaryAtlas;
15
+ animations?: Record<string, PetdexPetAnimation>;
16
+ thumbnail?: {
17
+ frame: number;
18
+ };
13
19
  }
14
- export interface PetCustomPet extends PetCustomPetSummary {
15
- svgs: Record<string, string>;
16
- sourcePrompt?: string;
20
+ export interface PetdexPetAssetSummaryAtlas {
21
+ format: "webp";
22
+ columns: 8;
23
+ rows: 9;
24
+ frameCount: 72;
25
+ cellWidth: 192;
26
+ cellHeight: 208;
27
+ width: 1536;
28
+ height: 1872;
29
+ sha256: string;
30
+ }
31
+ export interface PetdexPetAssetAtlas extends PetdexPetAssetSummaryAtlas {
32
+ image: "spritesheet.webp";
33
+ }
34
+ export interface PetdexPetAnimation {
35
+ frames: number[];
36
+ fps: number;
37
+ loop: boolean;
38
+ }
39
+ export interface PetdexPetAsset extends Omit<PetdexPetAssetSummary, "atlas"> {
40
+ schema: "qlogic.petdex.asset.v1";
41
+ atlas: PetdexPetAssetAtlas;
42
+ source: {
43
+ kind: "builtin" | "upload" | "forge";
44
+ prompt: string | null;
45
+ };
46
+ animations: Record<string, PetdexPetAnimation>;
47
+ thumbnail: {
48
+ frame: number;
49
+ };
17
50
  }
18
51
  export interface JourneySnapshot {
19
52
  date: string;
@@ -27,7 +60,7 @@ export interface PetProfile {
27
60
  ownerUserId: string;
28
61
  soul: PetSoul | null;
29
62
  preferences: PetPreferences;
30
- customPets: PetCustomPetSummary[];
63
+ customPets: PetdexPetAssetSummary[];
31
64
  journeyDates: string[];
32
65
  updatedAt: string;
33
66
  }
@@ -42,10 +75,18 @@ export declare class PetProfileService {
42
75
  saveJourneySnapshot(snapshot: JourneySnapshot): PetProfile;
43
76
  listJourneyDates(): string[];
44
77
  getJourneySnapshot(date: string): JourneySnapshot | null;
45
- upsertCustomPet(pet: PetCustomPet): PetProfile;
78
+ upsertCustomPet(pet: PetdexPetAsset): PetProfile;
46
79
  deleteCustomPet(id: string): PetProfile;
47
- listCustomPets(): PetCustomPet[];
48
- getCustomPet(id: string): PetCustomPet | null;
80
+ listCustomPets(): PetdexPetAssetSummary[];
81
+ getCustomPet(id: string): PetdexPetAsset | null;
82
+ getCustomPetSpritesheet(id: string): Buffer | null;
83
+ findReusableCustomPetId(params: {
84
+ sourceKind: "upload" | "forge";
85
+ name: string;
86
+ description: string;
87
+ }): string | null;
88
+ compactDuplicateCustomPets(): PetProfile;
89
+ writeCustomPetAssetFiles(pet: PetdexPetAsset, spritesheet: Buffer, validation: unknown, productionRun?: unknown): PetProfile;
49
90
  private defaultProfile;
50
91
  private normalizeProfile;
51
92
  private writeProfile;
@@ -0,0 +1,138 @@
1
+ export declare const PETDEX_SCHEMA: "qlogic.petdex.asset.v1";
2
+ export declare const PETDEX_VALIDATION_SCHEMA: "qlogic.petdex.validation.v1";
3
+ export declare const PETDEX_ATLAS_CONTRACT: {
4
+ readonly format: "webp";
5
+ readonly columns: 8;
6
+ readonly rows: 9;
7
+ readonly frameCount: 72;
8
+ readonly cellWidth: 192;
9
+ readonly cellHeight: 208;
10
+ readonly width: 1536;
11
+ readonly height: 1872;
12
+ };
13
+ export declare const PETDEX_ANIMATION_IDS: readonly ["idle", "thinking", "working", "done", "happy", "error", "attention", "dragging", "sleeping"];
14
+ export type PetdexAnimationId = typeof PETDEX_ANIMATION_IDS[number];
15
+ export interface PetdexAnimation {
16
+ frames: number[];
17
+ fps: number;
18
+ loop: boolean;
19
+ }
20
+ export interface PetdexAtlas {
21
+ image: "spritesheet.webp";
22
+ format: "webp";
23
+ columns: 8;
24
+ rows: 9;
25
+ frameCount: 72;
26
+ cellWidth: 192;
27
+ cellHeight: 208;
28
+ width: 1536;
29
+ height: 1872;
30
+ sha256: string;
31
+ imageUrl?: string;
32
+ }
33
+ export interface PetdexAssetSource {
34
+ kind: "builtin" | "upload" | "forge";
35
+ prompt: string | null;
36
+ }
37
+ export interface PetdexPetAsset {
38
+ schema: typeof PETDEX_SCHEMA;
39
+ id: string;
40
+ assetKind: "petdex";
41
+ name: string;
42
+ description: string;
43
+ createdAt: string;
44
+ updatedAt: string;
45
+ source: PetdexAssetSource;
46
+ atlas: PetdexAtlas;
47
+ animations: Record<PetdexAnimationId, PetdexAnimation>;
48
+ thumbnail: {
49
+ frame: number;
50
+ };
51
+ sourcePrompt?: string;
52
+ }
53
+ export type PetdexAssetManifest = PetdexPetAsset;
54
+ export interface PetdexPetAssetSummary {
55
+ id: string;
56
+ assetKind: "petdex";
57
+ sourceKind: PetdexAssetSource["kind"];
58
+ name: string;
59
+ description: string;
60
+ createdAt: string;
61
+ updatedAt: string;
62
+ atlas: Omit<PetdexAtlas, "image" | "imageUrl"> & {
63
+ imageUrl?: string;
64
+ };
65
+ animations?: Record<PetdexAnimationId, PetdexAnimation>;
66
+ thumbnail?: {
67
+ frame: number;
68
+ };
69
+ }
70
+ export interface PetdexValidationReport {
71
+ schema: typeof PETDEX_VALIDATION_SCHEMA;
72
+ assetId: string;
73
+ valid: boolean;
74
+ validatedAt: string;
75
+ errors: string[];
76
+ warnings: string[];
77
+ atlas: {
78
+ format: "webp";
79
+ columns: 8;
80
+ rows: 9;
81
+ frameCount: 72;
82
+ cellWidth: 192;
83
+ cellHeight: 208;
84
+ width: number;
85
+ height: number;
86
+ sha256: string;
87
+ };
88
+ animations: {
89
+ ids: PetdexAnimationId[];
90
+ minFrame: number;
91
+ maxFrame: number;
92
+ };
93
+ }
94
+ export interface LoadedPetdexPackage {
95
+ manifest: PetdexPetAsset;
96
+ spritesheet: Buffer;
97
+ validation: PetdexValidationReport;
98
+ }
99
+ export type PetdexAssetPackage = LoadedPetdexPackage;
100
+ export type PetdexAssetValidation = PetdexValidationReport;
101
+ export interface PetdexImportResult {
102
+ asset: PetdexPetAsset;
103
+ summary: PetdexPetAssetSummary;
104
+ validation: PetdexValidationReport;
105
+ }
106
+ export declare function createDefaultPetdexAnimations(): Record<PetdexAnimationId, PetdexAnimation>;
107
+ export declare function toPetdexAssetSummary(asset: PetdexPetAsset, imageUrl?: string): PetdexPetAssetSummary;
108
+ export declare function validatePetdexAssetManifest(manifest: unknown, spritesheet: Buffer): PetdexValidationReport;
109
+ export declare function loadPetdexAssetPackage(filePath: string): Promise<LoadedPetdexPackage>;
110
+ export declare function buildPetdexAssetImport(filePath: string, targetDir: string): Promise<PetdexImportResult>;
111
+ export declare function writePetdexAssetPackage(params: {
112
+ asset: PetdexPetAsset;
113
+ spritesheet: Buffer;
114
+ validation: PetdexValidationReport;
115
+ productionRun?: unknown;
116
+ outputDir: string;
117
+ fileName?: string;
118
+ }): Promise<string>;
119
+ export declare function createPetdexAssetFromSpritesheet(params: {
120
+ id?: string;
121
+ name: string;
122
+ description: string;
123
+ prompt?: string | null;
124
+ spritesheet: Buffer;
125
+ now?: string;
126
+ sourceKind?: PetdexAssetSource["kind"];
127
+ }): Promise<{
128
+ asset: PetdexPetAsset;
129
+ spritesheet: Buffer;
130
+ validation: PetdexValidationReport;
131
+ }>;
132
+ export declare function listBuiltinPetdexAssetIds(): string[];
133
+ export declare function listBuiltinPetdexAssets(): Promise<Array<{
134
+ asset: PetdexPetAsset;
135
+ spritesheet: Buffer;
136
+ validation: PetdexValidationReport;
137
+ }>>;
138
+ export declare function petdexImageDataUrl(spritesheet: Buffer): string;
@@ -0,0 +1,110 @@
1
+ import { PETDEX_ATLAS_CONTRACT, type PetdexAnimationId, type PetdexPetAsset, type PetdexValidationReport } from "./petdex-asset.js";
2
+ export interface PetdexForgeRequest {
3
+ id?: string;
4
+ name: string;
5
+ description: string;
6
+ prompt?: string | null;
7
+ referenceImageUrl?: string;
8
+ referenceMode?: "identity" | "refine";
9
+ baseSpritesheet?: Buffer;
10
+ refineAnimationId?: PetdexAnimationId;
11
+ refineFrameIndexes?: number[];
12
+ }
13
+ export interface PetdexImageGenerationRequest {
14
+ prompt: string;
15
+ purpose: "petdex-reference" | "petdex-row-strip";
16
+ animationId?: PetdexAnimationId;
17
+ style: string;
18
+ size: string;
19
+ imageUrl?: string;
20
+ referenceImages?: PetdexProductionReferenceImage[];
21
+ n: 1;
22
+ quality: "auto";
23
+ }
24
+ export interface PetdexImageGenerationResult {
25
+ mediaUrls: string[];
26
+ model?: string;
27
+ size?: string;
28
+ durationMs?: number;
29
+ provider?: string;
30
+ billingUnit?: string;
31
+ billingQuantity?: number;
32
+ }
33
+ export interface PetdexForgeOutput {
34
+ asset: PetdexPetAsset;
35
+ spritesheet: Buffer;
36
+ validation: PetdexValidationReport;
37
+ prompt: string;
38
+ productionRun: PetdexProductionRun;
39
+ model?: string;
40
+ size?: string;
41
+ durationMs?: number;
42
+ mediaUsage?: {
43
+ provider: string;
44
+ model: string;
45
+ billingUnit: string;
46
+ billingQuantity: number;
47
+ };
48
+ }
49
+ export declare const PETDEX_PRODUCTION_SCHEMA: "qlogic.petdex.production.v1";
50
+ export interface PetdexProductionReferenceImage {
51
+ role: "canonical-reference" | "layout-guide" | "existing-atlas";
52
+ imageUrl: string;
53
+ }
54
+ export interface PetdexProductionJob {
55
+ id: string;
56
+ kind: "reference" | "row-strip";
57
+ status: "complete";
58
+ animationId?: PetdexAnimationId;
59
+ prompt: string;
60
+ inputImages: PetdexProductionReferenceImage[];
61
+ outputUrl: string;
62
+ }
63
+ export interface PetdexProductionRun {
64
+ schema: typeof PETDEX_PRODUCTION_SCHEMA;
65
+ status: "complete";
66
+ sourceMode: "text" | "reference" | "refine";
67
+ contract: typeof PETDEX_ATLAS_CONTRACT;
68
+ jobs: PetdexProductionJob[];
69
+ qa: {
70
+ contactSheet: {
71
+ rows: typeof PETDEX_ATLAS_CONTRACT.rows;
72
+ columns: typeof PETDEX_ATLAS_CONTRACT.columns;
73
+ frameCount: typeof PETDEX_ATLAS_CONTRACT.frameCount;
74
+ };
75
+ rowReports: Array<{
76
+ animationId: PetdexAnimationId;
77
+ status: "pass";
78
+ frames: typeof PETDEX_ATLAS_CONTRACT.columns;
79
+ }>;
80
+ };
81
+ }
82
+ export interface PetdexForgePackageOutput extends PetdexForgeOutput {
83
+ packagePath: string;
84
+ assetDir: string;
85
+ manifestPath: string;
86
+ spritesheetPath: string;
87
+ validationPath: string;
88
+ productionRunPath: string;
89
+ }
90
+ export type GeneratePetdexImage = (request: PetdexImageGenerationRequest) => Promise<PetdexImageGenerationResult>;
91
+ export type UploadPetdexReferenceImage = (input: {
92
+ buffer: Buffer;
93
+ mimeType: string;
94
+ filename: string;
95
+ }) => Promise<string>;
96
+ export interface PetdexProductionOptions {
97
+ uploadReferenceImage?: UploadPetdexReferenceImage;
98
+ }
99
+ export declare function forgePetdexAsset(input: PetdexForgeRequest, generateImage: GeneratePetdexImage, options?: PetdexProductionOptions): Promise<PetdexForgeOutput>;
100
+ export declare function forgePetdexAssetPackage(params: {
101
+ input: PetdexForgeRequest;
102
+ outputDir: string;
103
+ generateImage: GeneratePetdexImage;
104
+ uploadReferenceImage?: UploadPetdexReferenceImage;
105
+ }): Promise<PetdexForgePackageOutput>;
106
+ export declare function buildPetdexAtlasPrompt(description: string, prompt?: string | null, referenceMode?: "identity" | "refine"): string;
107
+ export declare function buildPetdexCharacterPrompt(description: string, prompt?: string | null, referenceMode?: "identity" | "refine"): string;
108
+ export declare function buildPetdexReferencePrompt(description: string, prompt?: string | null, referenceMode?: "identity" | "refine"): string;
109
+ export declare function buildPetdexRowPrompt(animationId: PetdexAnimationId, description: string, prompt?: string | null, referenceMode?: "identity" | "refine"): string;
110
+ export declare function readGeneratedPetdexImage(mediaUrl: string): Promise<Buffer>;
@@ -33,6 +33,8 @@ export interface MemoryExtractionItem {
33
33
  source?: string;
34
34
  event_date?: string;
35
35
  tags?: string[];
36
+ /** Ids of already-uploaded attachments to link to this memory on commit. */
37
+ attachmentIds?: string[];
36
38
  }
37
39
  export interface MemoryConsolidationWriteResult {
38
40
  memoriesAdded?: number;
@@ -77,6 +79,15 @@ export interface MemoryActivitySummary {
77
79
  date: string;
78
80
  }>;
79
81
  }
82
+ /** Lightweight attachment reference carried on atlas/detail records (no bytes). */
83
+ export interface MemoryAtlasAttachmentRef {
84
+ id: string;
85
+ kind: string;
86
+ filename: string;
87
+ mimeType: string;
88
+ size: number;
89
+ url: string;
90
+ }
80
91
  export interface MemoryAtlasRecord {
81
92
  id: string;
82
93
  text: string;
@@ -92,6 +103,7 @@ export interface MemoryAtlasRecord {
92
103
  accessCount?: number;
93
104
  lastAccessedAt?: string | number;
94
105
  isArchived?: boolean;
106
+ attachments?: MemoryAtlasAttachmentRef[];
95
107
  }
96
108
  export interface MemoryAtlasResult {
97
109
  totalCount?: number;
@@ -116,6 +128,29 @@ export interface MemoryHandlerProvider extends MemoryProvider {
116
128
  proposeExtracted?(items: MemoryExtractionItem[], userId: string, options?: MemoryIngestOptions): Promise<MemoryConsolidationWriteResult>;
117
129
  ingestExtracted?(items: MemoryExtractionItem[], userId: string, options?: MemoryIngestOptions): Promise<MemoryConsolidationWriteResult>;
118
130
  update?(id: string, patch: MemoryUpdatePatch): Promise<boolean>;
131
+ /** Persist an uploaded attachment (orphan until linked at commit). */
132
+ adoptAttachment?(input: {
133
+ data?: Buffer;
134
+ sourceUrl?: string;
135
+ filename: string;
136
+ mimeType: string;
137
+ userId: string;
138
+ }): Promise<MemoryAtlasAttachmentRef>;
139
+ /** Resolve an attachment id to its on-disk path (for serving). */
140
+ locateAttachment?(id: string): Promise<{
141
+ absPath: string;
142
+ mimeType: string;
143
+ filename: string;
144
+ } | null>;
145
+ /** Drop uploads never saved to a memory. */
146
+ purgeOrphanAttachments?(): Promise<void>;
147
+ /** Read an attachment's bytes + mime (for multimodal understanding). */
148
+ readAttachmentBytes?(id: string): Promise<{
149
+ bytes: Buffer;
150
+ mimeType: string;
151
+ } | null>;
152
+ /** Persist understood/extracted text on an attachment row. */
153
+ setAttachmentText?(id: string, text: string): void;
119
154
  }
120
155
  export interface MemoryDreamProvider {
121
156
  search(query: string, userId: string, options?: {
@@ -10,6 +10,7 @@
10
10
  */
11
11
  import type { MemoryProvider, MemorySearchResult, MemorySearchOptions, MemoryIngestMessage, MemoryIngestOptions } from "../../protocol/wire/index.js";
12
12
  import type { MemoryClaimRecord, MemoryConflictRecord, MemoryUpdateInput, SqliteDatabase } from "./local-store.js";
13
+ import { type AdoptedAttachment } from "./memory-attachment-store.js";
13
14
  import { type LocalEmbeddingConfig } from "./local-embedding.js";
14
15
  import { type ExtractedMemoryItem, type MemoryConsolidationResult } from "./memory-consolidation.js";
15
16
  export type { ExtractedMemoryItem } from "./memory-consolidation.js";
@@ -28,9 +29,33 @@ export declare class LocalMemoryProvider implements MemoryProvider {
28
29
  private store;
29
30
  private embedding;
30
31
  private consolidator;
32
+ private attachmentStore;
31
33
  private userIdPrefix;
32
34
  private dbPath;
33
35
  constructor(config: LocalMemoryProviderConfig);
36
+ /** Persist an uploaded attachment (orphan until linked at commit). */
37
+ adoptAttachment(input: {
38
+ data?: Buffer;
39
+ sourceUrl?: string;
40
+ filename: string;
41
+ mimeType: string;
42
+ userId: string;
43
+ }): Promise<AdoptedAttachment>;
44
+ /** Resolve an attachment id to its on-disk path (for serving). */
45
+ locateAttachment(id: string): Promise<{
46
+ absPath: string;
47
+ mimeType: string;
48
+ filename: string;
49
+ } | null>;
50
+ /** Drop uploads that were never saved to a memory. */
51
+ purgeOrphanAttachments(): Promise<void>;
52
+ /** Read an attachment's bytes + mime (P2 multimodal understanding). */
53
+ readAttachmentBytes(id: string): Promise<{
54
+ bytes: Buffer;
55
+ mimeType: string;
56
+ } | null>;
57
+ /** Persist the understood/extracted text on an attachment row. */
58
+ setAttachmentText(id: string, text: string): void;
34
59
  private resolveUserId;
35
60
  private buildEmbedding;
36
61
  search(query: string, userId: string, options?: MemorySearchOptions): Promise<MemorySearchResult[]>;
@@ -30,6 +30,41 @@ export interface MemoryRecord {
30
30
  accessCount: number;
31
31
  lastAccessedAt: number;
32
32
  isArchived: boolean;
33
+ /** Lightweight attachment refs (populated by the provider for atlas/detail). */
34
+ attachments?: MemoryAttachmentRef[];
35
+ }
36
+ /** Lightweight attachment reference carried on records / atlas wire (no bytes, no extractedText). */
37
+ export interface MemoryAttachmentRef {
38
+ id: string;
39
+ kind: string;
40
+ filename: string;
41
+ mimeType: string;
42
+ size: number;
43
+ url: string;
44
+ }
45
+ /** Full attachment index row (DB-backed; file bytes live on disk under the attachments dir). */
46
+ export interface MemoryAttachmentRow {
47
+ id: string;
48
+ memoryId: string;
49
+ userId: string;
50
+ kind: string;
51
+ filename: string;
52
+ mimeType: string;
53
+ size: number;
54
+ relPath: string;
55
+ extractedText: string;
56
+ createdAt: number;
57
+ }
58
+ export interface MemoryAttachmentInsert {
59
+ id: string;
60
+ userId: string;
61
+ kind: string;
62
+ filename: string;
63
+ mimeType: string;
64
+ size: number;
65
+ relPath: string;
66
+ extractedText?: string;
67
+ memoryId?: string;
33
68
  }
34
69
  export interface MemoryInsertInput {
35
70
  text: string;
@@ -416,5 +451,18 @@ export declare class LocalMemoryStore {
416
451
  reason: string;
417
452
  }): string;
418
453
  listConflicts(userId: string): MemoryConflictRecord[];
454
+ insertAttachment(input: MemoryAttachmentInsert): void;
455
+ getAttachmentById(id: string): MemoryAttachmentRow | null;
456
+ listAttachmentsByMemoryId(memoryId: string): MemoryAttachmentRow[];
457
+ /** Batch-load attachments for many memories (for atlas windows). */
458
+ listAttachmentsByMemoryIds(memoryIds: string[]): Map<string, MemoryAttachmentRow[]>;
459
+ /** Link orphan/owned attachments to a committed memory. Returns linked count. */
460
+ linkAttachments(memoryId: string, attachmentIds: string[], userId: string): number;
461
+ setAttachmentExtractedText(id: string, text: string): boolean;
462
+ /** Delete attachment index rows for a memory; returns their rel paths for file cleanup. */
463
+ deleteAttachmentsByMemoryId(memoryId: string): string[];
464
+ /** Orphan attachments (uploaded but never saved to a memory) older than cutoff. */
465
+ listOrphanAttachments(cutoff: number): MemoryAttachmentRow[];
466
+ deleteAttachmentById(id: string): void;
419
467
  close(): void;
420
468
  }