@duetso/agent 0.1.201 → 0.1.202
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -3
- package/dist/package.json +1 -1
- package/dist/src/cli/help.d.ts +1 -0
- package/dist/src/cli/help.d.ts.map +1 -1
- package/dist/src/cli/help.js +58 -5
- package/dist/src/cli/help.js.map +1 -1
- package/dist/src/cli/inline-slash.js +1 -1
- package/dist/src/cli/memory-add.d.ts +8 -1
- package/dist/src/cli/memory-add.d.ts.map +1 -1
- package/dist/src/cli/memory-add.js +49 -53
- package/dist/src/cli/memory-add.js.map +1 -1
- package/dist/src/cli/memory-db.d.ts +23 -0
- package/dist/src/cli/memory-db.d.ts.map +1 -1
- package/dist/src/cli/memory-db.js +48 -1
- package/dist/src/cli/memory-db.js.map +1 -1
- package/dist/src/cli/memory-json.d.ts +67 -0
- package/dist/src/cli/memory-json.d.ts.map +1 -0
- package/dist/src/cli/memory-json.js +28 -0
- package/dist/src/cli/memory-json.js.map +1 -0
- package/dist/src/cli/memory-query.d.ts +20 -1
- package/dist/src/cli/memory-query.d.ts.map +1 -1
- package/dist/src/cli/memory-query.js +45 -20
- package/dist/src/cli/memory-query.js.map +1 -1
- package/dist/src/cli/memory-recall.d.ts +53 -0
- package/dist/src/cli/memory-recall.d.ts.map +1 -0
- package/dist/src/cli/memory-recall.js +217 -0
- package/dist/src/cli/memory-recall.js.map +1 -0
- package/dist/src/cli/memory.d.ts +3 -1
- package/dist/src/cli/memory.d.ts.map +1 -1
- package/dist/src/cli/memory.js +10 -4
- package/dist/src/cli/memory.js.map +1 -1
- package/dist/src/cli/rpc.d.ts +19 -3
- package/dist/src/cli/rpc.d.ts.map +1 -1
- package/dist/src/cli/rpc.js +19 -3
- package/dist/src/cli/rpc.js.map +1 -1
- package/dist/src/cli/run.d.ts +8 -0
- package/dist/src/cli/run.d.ts.map +1 -1
- package/dist/src/cli/run.js +6 -5
- package/dist/src/cli/run.js.map +1 -1
- package/dist/src/cli/shared.d.ts +16 -3
- package/dist/src/cli/shared.d.ts.map +1 -1
- package/dist/src/cli/shared.js +19 -4
- package/dist/src/cli/shared.js.map +1 -1
- package/dist/src/cli/train.d.ts.map +1 -1
- package/dist/src/cli/train.js +39 -22
- package/dist/src/cli/train.js.map +1 -1
- package/dist/src/cli.d.ts +1 -0
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +1 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/memory/recall.d.ts +44 -0
- package/dist/src/memory/recall.d.ts.map +1 -1
- package/dist/src/memory/recall.js +92 -6
- package/dist/src/memory/recall.js.map +1 -1
- package/dist/src/tui/app.d.ts +2 -2
- package/dist/src/tui/app.d.ts.map +1 -1
- package/dist/src/tui/app.js +20 -2
- package/dist/src/tui/app.js.map +1 -1
- package/dist/src/tui/paste-controller.d.ts +3 -0
- package/dist/src/tui/paste-controller.d.ts.map +1 -1
- package/dist/src/tui/paste-controller.js +25 -0
- package/dist/src/tui/paste-controller.js.map +1 -1
- package/dist/src/tui/session-subscription.d.ts +10 -0
- package/dist/src/tui/session-subscription.d.ts.map +1 -1
- package/dist/src/tui/session-subscription.js +22 -5
- package/dist/src/tui/session-subscription.js.map +1 -1
- package/dist/src/tui/slash-commands.d.ts +4 -4
- package/dist/src/tui/slash-commands.js +4 -4
- package/dist/src/turn-runner/tools.d.ts.map +1 -1
- package/dist/src/turn-runner/tools.js +15 -54
- package/dist/src/turn-runner/tools.js.map +1 -1
- package/dist/src/types/memory.d.ts +11 -0
- package/dist/src/types/memory.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Observation, ObservationKind, ObservationPriority, ObservationSource } from "../types/memory.js";
|
|
2
|
+
/**
|
|
3
|
+
* Canonical JSON shape for a single memory row, shared by every command that
|
|
4
|
+
* emits an observation (`memory recall`, `memory` query, `memory add`). Kept
|
|
5
|
+
* in one place — see {@link toMemoryJson} — so consumers parse one type
|
|
6
|
+
* everywhere instead of one shape per command.
|
|
7
|
+
*
|
|
8
|
+
* Deviations from the in-memory {@link Observation}:
|
|
9
|
+
* - `createdAt`/`lastUsedAt` are ISO 8601 strings, not millisecond epochs,
|
|
10
|
+
* so wire consumers never have to guess the unit.
|
|
11
|
+
* - `source` is flattened to its `kind` string; the structured
|
|
12
|
+
* `{ kind, name? }` union is a runtime-only detail.
|
|
13
|
+
* - The two ranking scores are named explicitly (`packScore`,
|
|
14
|
+
* `relevanceScore`); there is deliberately no generic `score` field.
|
|
15
|
+
*/
|
|
16
|
+
export interface MemoryJson {
|
|
17
|
+
/** Stable persistence key for the row. */
|
|
18
|
+
id: string;
|
|
19
|
+
/** The memory text. */
|
|
20
|
+
content: string;
|
|
21
|
+
/** Raw observation, reflection, single user note, or bulk-curated manual row. */
|
|
22
|
+
kind: ObservationKind;
|
|
23
|
+
/** Flattened source origin — the `kind` of the structured {@link ObservationSource}. */
|
|
24
|
+
source: ObservationSource["kind"];
|
|
25
|
+
/** Importance signal used by recall and context ranking. */
|
|
26
|
+
priority: ObservationPriority;
|
|
27
|
+
/** When the row was stored, as an ISO 8601 timestamp. */
|
|
28
|
+
createdAt: string;
|
|
29
|
+
/** Most recent turn that used the row, as an ISO 8601 timestamp. */
|
|
30
|
+
lastUsedAt: string;
|
|
31
|
+
/** Calendar date the observation is anchored to. */
|
|
32
|
+
observedDate: string;
|
|
33
|
+
/** Concrete date mentioned by the user/tool when different from `observedDate`. */
|
|
34
|
+
referencedDate?: string;
|
|
35
|
+
/** Original relative date phrase ("tomorrow", "last week") when useful. */
|
|
36
|
+
relativeDate?: string;
|
|
37
|
+
/** 24-hour local time attached to the observation, when available. */
|
|
38
|
+
timeOfDay?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Session that authored the row. Absent on legacy/global rows that predate
|
|
41
|
+
* session tracking; echoed only when the observation actually carries one.
|
|
42
|
+
*/
|
|
43
|
+
sessionId?: string;
|
|
44
|
+
/** Lightweight filtering/grouping labels. */
|
|
45
|
+
tags: string[];
|
|
46
|
+
/**
|
|
47
|
+
* Global-pack ranking score (recency × priority × kind bias). Included only
|
|
48
|
+
* when the caller computed a pack score for this row.
|
|
49
|
+
*/
|
|
50
|
+
packScore?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Query-relevance score (RRF-fused across phrasings). Included only in
|
|
53
|
+
* `memory recall` output; absent — never null — everywhere else.
|
|
54
|
+
*/
|
|
55
|
+
relevanceScore?: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Serialize an {@link Observation} into the canonical {@link MemoryJson}
|
|
59
|
+
* shape. Optional ranking scores are attached only when provided, matching
|
|
60
|
+
* the contract that both scores are named explicitly and omitted rather than
|
|
61
|
+
* emitted as null.
|
|
62
|
+
*/
|
|
63
|
+
export declare function toMemoryJson(observation: Observation, opts?: {
|
|
64
|
+
packScore?: number;
|
|
65
|
+
relevanceScore?: number;
|
|
66
|
+
}): MemoryJson;
|
|
67
|
+
//# sourceMappingURL=memory-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-json.d.ts","sourceRoot":"","sources":["../../../src/cli/memory-json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,UAAU;IACzB,0CAA0C;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,IAAI,EAAE,eAAe,CAAC;IACtB,wFAAwF;IACxF,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAClC,4DAA4D;IAC5D,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAC;IACrB,mFAAmF;IACnF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,2EAA2E;IAC3E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,IAAI,EAAE,MAAM,EAAE,CAAC;IACf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,WAAW,EAAE,WAAW,EACxB,IAAI,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAO,GACzD,UAAU,CAoBZ"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialize an {@link Observation} into the canonical {@link MemoryJson}
|
|
3
|
+
* shape. Optional ranking scores are attached only when provided, matching
|
|
4
|
+
* the contract that both scores are named explicitly and omitted rather than
|
|
5
|
+
* emitted as null.
|
|
6
|
+
*/
|
|
7
|
+
export function toMemoryJson(observation, opts = {}) {
|
|
8
|
+
return {
|
|
9
|
+
id: observation.id,
|
|
10
|
+
content: observation.content,
|
|
11
|
+
kind: observation.kind,
|
|
12
|
+
source: observation.source.kind,
|
|
13
|
+
priority: observation.priority,
|
|
14
|
+
createdAt: new Date(observation.createdAt).toISOString(),
|
|
15
|
+
lastUsedAt: new Date(observation.lastUsedAt).toISOString(),
|
|
16
|
+
observedDate: observation.observedDate,
|
|
17
|
+
...(observation.referencedDate !== undefined
|
|
18
|
+
? { referencedDate: observation.referencedDate }
|
|
19
|
+
: {}),
|
|
20
|
+
...(observation.relativeDate !== undefined ? { relativeDate: observation.relativeDate } : {}),
|
|
21
|
+
...(observation.timeOfDay !== undefined ? { timeOfDay: observation.timeOfDay } : {}),
|
|
22
|
+
...(observation.sessionId !== undefined ? { sessionId: observation.sessionId } : {}),
|
|
23
|
+
tags: observation.tags,
|
|
24
|
+
...(opts.packScore !== undefined ? { packScore: opts.packScore } : {}),
|
|
25
|
+
...(opts.relevanceScore !== undefined ? { relevanceScore: opts.relevanceScore } : {}),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=memory-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-json.js","sourceRoot":"","sources":["../../../src/cli/memory-json.ts"],"names":[],"mappings":"AA+DA;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAC1B,WAAwB,EACxB,OAAwD,EAAE;IAE1D,OAAO;QACL,EAAE,EAAE,WAAW,CAAC,EAAE;QAClB,OAAO,EAAE,WAAW,CAAC,OAAO;QAC5B,IAAI,EAAE,WAAW,CAAC,IAAI;QACtB,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI;QAC/B,QAAQ,EAAE,WAAW,CAAC,QAAQ;QAC9B,SAAS,EAAE,IAAI,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;QACxD,UAAU,EAAE,IAAI,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE;QAC1D,YAAY,EAAE,WAAW,CAAC,YAAY;QACtC,GAAG,CAAC,WAAW,CAAC,cAAc,KAAK,SAAS;YAC1C,CAAC,CAAC,EAAE,cAAc,EAAE,WAAW,CAAC,cAAc,EAAE;YAChD,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,WAAW,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,WAAW,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7F,GAAG,CAAC,WAAW,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,WAAW,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpF,GAAG,CAAC,WAAW,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,WAAW,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpF,IAAI,EAAE,WAAW,CAAC,IAAI;QACtB,GAAG,CAAC,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACtE,GAAG,CAAC,IAAI,CAAC,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtF,CAAC;AACJ,CAAC"}
|
|
@@ -3,9 +3,22 @@ import { type MemoryQueryFilters } from "./memory-db.js";
|
|
|
3
3
|
interface MemoryQueryIO {
|
|
4
4
|
stdout: NodeJS.WritableStream;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* An observation paired with its global-pack ranking score. `packScore` uses
|
|
8
|
+
* the same name the canonical {@link toMemoryJson} shape emits, so the table
|
|
9
|
+
* renderer and the JSON output read one field instead of drifting.
|
|
10
|
+
*/
|
|
6
11
|
type ScoredObservation = Observation & {
|
|
7
|
-
|
|
12
|
+
packScore: number;
|
|
8
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* The canonical `--priority` and `--source` value sets, compile-time-checked
|
|
16
|
+
* to enumerate every union member. Exported so sibling memory commands
|
|
17
|
+
* (e.g. `memory add`) validate the same axes against one source of truth
|
|
18
|
+
* instead of redeclaring parallel literal lists that can silently drift.
|
|
19
|
+
*/
|
|
20
|
+
export declare const PRIORITIES: ("high" | "medium" | "low")[];
|
|
21
|
+
export declare const SOURCES: ("user" | "agent" | "system" | "api" | "import")[];
|
|
9
22
|
export interface MemoryQueryOptions {
|
|
10
23
|
dbPath: string;
|
|
11
24
|
json: boolean;
|
|
@@ -18,6 +31,12 @@ export interface MemoryQueryOptions {
|
|
|
18
31
|
*/
|
|
19
32
|
queryMode: boolean;
|
|
20
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Validate a flag value against a closed set, exiting `64` (usage error) on a
|
|
36
|
+
* missing or out-of-set value. Shared across memory subcommands so every enum
|
|
37
|
+
* flag reports the same message shape and exit code.
|
|
38
|
+
*/
|
|
39
|
+
export declare function parseEnum<T extends string>(raw: string | undefined, allowed: readonly T[], flag: string): T;
|
|
21
40
|
/**
|
|
22
41
|
* Parse the shared `duet memory` argument set. The same flags drive both the
|
|
23
42
|
* interactive TUI (bare invocation) and the scriptable query (any filter or
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-query.d.ts","sourceRoot":"","sources":["../../../src/cli/memory-query.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAwC,MAAM,oBAAoB,CAAC;AAE5F,OAAO,EAAE,KAAK,kBAAkB,EAAkC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"memory-query.d.ts","sourceRoot":"","sources":["../../../src/cli/memory-query.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAwC,MAAM,oBAAoB,CAAC;AAE5F,OAAO,EAAE,KAAK,kBAAkB,EAAkC,MAAM,gBAAgB,CAAC;AAIzF,UAAU,aAAa;IACrB,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC;CAC/B;AAED;;;;GAIG;AACH,KAAK,iBAAiB,GAAG,WAAW,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAe7D;;;;;GAKG;AACH,eAAO,MAAM,UAAU,+BAAmE,CAAC;AAE3F,eAAO,MAAM,OAAO,oDAA6E,CAAC;AAElG,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,kBAAkB,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,SAAS,EAAE,OAAO,CAAC;CACpB;AA4BD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EACxC,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,OAAO,EAAE,SAAS,CAAC,EAAE,EACrB,IAAI,EAAE,MAAM,GACX,CAAC,CAMH;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,kBAAkB,GAAG,SAAS,CA2E9E;AAOD,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,iBAAiB,EAAE,GAAG,MAAM,CA4C3E;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,kBAAkB,EAC3B,EAAE,GAAE,aAA0C,GAC7C,OAAO,CAAC,IAAI,CAAC,CAmBf"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { DEFAULT_MEMORY_DB_PATH } from "../session/session-manager.js";
|
|
2
2
|
import { printMemoryHelp } from "./help.js";
|
|
3
3
|
import { scoreObservation, withMemoryDb } from "./memory-db.js";
|
|
4
|
-
import {
|
|
4
|
+
import { toMemoryJson } from "./memory-json.js";
|
|
5
|
+
import { resolveUserPath, usageError } from "./shared.js";
|
|
5
6
|
/**
|
|
6
7
|
* Build a runtime filter list that must enumerate *every* member of `T`.
|
|
7
8
|
* A bare `satisfies readonly T[]` only checks each element is a valid `T`; it
|
|
@@ -14,40 +15,51 @@ function exhaustiveList() {
|
|
|
14
15
|
return (list) => list;
|
|
15
16
|
}
|
|
16
17
|
const KINDS = exhaustiveList()(["observation", "reflection", "note", "manual"]);
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* The canonical `--priority` and `--source` value sets, compile-time-checked
|
|
20
|
+
* to enumerate every union member. Exported so sibling memory commands
|
|
21
|
+
* (e.g. `memory add`) validate the same axes against one source of truth
|
|
22
|
+
* instead of redeclaring parallel literal lists that can silently drift.
|
|
23
|
+
*/
|
|
24
|
+
export const PRIORITIES = exhaustiveList()(["high", "medium", "low"]);
|
|
25
|
+
export const SOURCES = exhaustiveList()(["user", "agent", "system", "api", "import"]);
|
|
19
26
|
/** Parse UTC date filters; date-only bounds cover the whole day. */
|
|
20
27
|
function parseDateBound(raw, flag, edge) {
|
|
21
28
|
if (/^\d{4}-\d{2}-\d{2}$/.test(raw)) {
|
|
22
29
|
const iso = `${raw}T${edge === "start" ? "00:00:00.000" : "23:59:59.999"}Z`;
|
|
23
30
|
const ms = Date.parse(iso);
|
|
24
31
|
if (Number.isNaN(ms))
|
|
25
|
-
|
|
32
|
+
usageError(`Invalid ${flag} date: ${raw}`);
|
|
26
33
|
// Reject impossible calendar dates (e.g. 2026-02-31) that JS silently
|
|
27
34
|
// normalizes into a different day rather than returning NaN — otherwise a
|
|
28
35
|
// typo slides the createdAt window and the wrong rows get exported.
|
|
29
36
|
if (new Date(ms).toISOString().slice(0, 10) !== raw) {
|
|
30
|
-
|
|
37
|
+
usageError(`Invalid ${flag} date: ${raw} is not a real calendar date`);
|
|
31
38
|
}
|
|
32
39
|
return ms;
|
|
33
40
|
}
|
|
34
41
|
if (/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/.test(raw)) {
|
|
35
42
|
const ms = Date.parse(`${raw}Z`);
|
|
36
43
|
if (Number.isNaN(ms))
|
|
37
|
-
|
|
44
|
+
usageError(`Invalid ${flag} datetime: ${raw}`);
|
|
38
45
|
// Same round-trip guard for the datetime form (e.g. 2026-02-31T00:00:00).
|
|
39
46
|
if (new Date(ms).toISOString().slice(0, 19) !== raw) {
|
|
40
|
-
|
|
47
|
+
usageError(`Invalid ${flag} datetime: ${raw} is not a real calendar datetime`);
|
|
41
48
|
}
|
|
42
49
|
return ms;
|
|
43
50
|
}
|
|
44
|
-
|
|
51
|
+
usageError(`Invalid ${flag} value: ${raw} (expected YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS)`);
|
|
45
52
|
}
|
|
46
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Validate a flag value against a closed set, exiting `64` (usage error) on a
|
|
55
|
+
* missing or out-of-set value. Shared across memory subcommands so every enum
|
|
56
|
+
* flag reports the same message shape and exit code.
|
|
57
|
+
*/
|
|
58
|
+
export function parseEnum(raw, allowed, flag) {
|
|
47
59
|
if (!raw || raw.startsWith("-"))
|
|
48
|
-
|
|
60
|
+
usageError(`Missing value for ${flag}`);
|
|
49
61
|
if (!allowed.includes(raw)) {
|
|
50
|
-
|
|
62
|
+
usageError(`Invalid ${flag} value: ${raw} (expected one of ${allowed.join(", ")})`);
|
|
51
63
|
}
|
|
52
64
|
return raw;
|
|
53
65
|
}
|
|
@@ -68,7 +80,7 @@ export function parseMemoryArgs(args) {
|
|
|
68
80
|
switch (arg) {
|
|
69
81
|
case "--db":
|
|
70
82
|
if (!args[i + 1] || args[i + 1]?.startsWith("-"))
|
|
71
|
-
|
|
83
|
+
usageError(`Missing value for ${arg}`);
|
|
72
84
|
dbPath = resolveUserPath(args[++i]);
|
|
73
85
|
break;
|
|
74
86
|
// `--type` and `--kind` are aliases for the same `Observation.kind` axis.
|
|
@@ -85,10 +97,18 @@ export function parseMemoryArgs(args) {
|
|
|
85
97
|
filters.source = parseEnum(args[++i], SOURCES, arg);
|
|
86
98
|
hasFilter = true;
|
|
87
99
|
break;
|
|
100
|
+
case "--session": {
|
|
101
|
+
const raw = args[++i];
|
|
102
|
+
if (!raw || raw.startsWith("-"))
|
|
103
|
+
usageError(`Missing value for ${arg}`);
|
|
104
|
+
filters.sessionId = raw;
|
|
105
|
+
hasFilter = true;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
88
108
|
case "--from": {
|
|
89
109
|
const raw = args[++i];
|
|
90
110
|
if (!raw || raw.startsWith("-"))
|
|
91
|
-
|
|
111
|
+
usageError(`Missing value for ${arg}`);
|
|
92
112
|
filters.fromMs = parseDateBound(raw, arg, "start");
|
|
93
113
|
hasFilter = true;
|
|
94
114
|
break;
|
|
@@ -96,7 +116,7 @@ export function parseMemoryArgs(args) {
|
|
|
96
116
|
case "--to": {
|
|
97
117
|
const raw = args[++i];
|
|
98
118
|
if (!raw || raw.startsWith("-"))
|
|
99
|
-
|
|
119
|
+
usageError(`Missing value for ${arg}`);
|
|
100
120
|
filters.toMs = parseDateBound(raw, arg, "end");
|
|
101
121
|
hasFilter = true;
|
|
102
122
|
break;
|
|
@@ -108,7 +128,7 @@ export function parseMemoryArgs(args) {
|
|
|
108
128
|
const raw = args[++i];
|
|
109
129
|
const seconds = Number(raw);
|
|
110
130
|
if (!Number.isFinite(seconds) || seconds < 0) {
|
|
111
|
-
|
|
131
|
+
usageError(`Invalid --wait value: ${raw} (expected non-negative number of seconds)`);
|
|
112
132
|
}
|
|
113
133
|
waitBudgetMs = seconds * 1000;
|
|
114
134
|
break;
|
|
@@ -118,11 +138,11 @@ export function parseMemoryArgs(args) {
|
|
|
118
138
|
printMemoryHelp();
|
|
119
139
|
return undefined;
|
|
120
140
|
default:
|
|
121
|
-
|
|
141
|
+
usageError(`Unknown memory option: ${arg}`);
|
|
122
142
|
}
|
|
123
143
|
}
|
|
124
144
|
if (filters.fromMs !== undefined && filters.toMs !== undefined && filters.fromMs > filters.toMs) {
|
|
125
|
-
|
|
145
|
+
usageError("--from must not be after --to");
|
|
126
146
|
}
|
|
127
147
|
return { dbPath, json, filters, waitBudgetMs, queryMode: json || hasFilter };
|
|
128
148
|
}
|
|
@@ -139,7 +159,7 @@ export function formatMemoryTable(observations) {
|
|
|
139
159
|
kind: o.kind,
|
|
140
160
|
priority: o.priority,
|
|
141
161
|
source: o.source.kind,
|
|
142
|
-
score: o.
|
|
162
|
+
score: o.packScore.toFixed(2),
|
|
143
163
|
content: truncate(o.content, 60),
|
|
144
164
|
id: o.id,
|
|
145
165
|
}));
|
|
@@ -183,8 +203,13 @@ export async function runMemoryQuery(options, io = { stdout: process.stdout }) {
|
|
|
183
203
|
const now = Date.now();
|
|
184
204
|
const scored = observations.map((o) => ({
|
|
185
205
|
...o,
|
|
186
|
-
|
|
206
|
+
packScore: scoreObservation(o, now),
|
|
187
207
|
}));
|
|
188
|
-
|
|
208
|
+
if (options.json) {
|
|
209
|
+
const json = scored.map((o) => toMemoryJson(o, { packScore: o.packScore }));
|
|
210
|
+
io.stdout.write(`${JSON.stringify(json, null, 2)}\n`);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
io.stdout.write(`${formatMemoryTable(scored)}\n`);
|
|
189
214
|
}
|
|
190
215
|
//# sourceMappingURL=memory-query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-query.js","sourceRoot":"","sources":["../../../src/cli/memory-query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAA2B,gBAAgB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"memory-query.js","sourceRoot":"","sources":["../../../src/cli/memory-query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAA2B,gBAAgB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAa1D;;;;;;;GAOG;AACH,SAAS,cAAc;IACrB,OAAO,CAAyB,IAAyC,EAAK,EAAE,CAAC,IAAI,CAAC;AACxF,CAAC;AAED,MAAM,KAAK,GAAG,cAAc,EAAmB,CAAC,CAAC,aAAa,EAAE,YAAY,EAAE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C,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QACtD,OAAO;IACT,CAAC;IACD,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type EmbedFn } from "../memory/embedding.js";
|
|
2
|
+
import { type RecallScope } from "../memory/recall.js";
|
|
3
|
+
import type { Observation } from "../types/memory.js";
|
|
4
|
+
interface RecallCommandOptions {
|
|
5
|
+
dbPath: string;
|
|
6
|
+
/** Search text from `--query <q>` or positional args, joined with spaces. */
|
|
7
|
+
query: string;
|
|
8
|
+
scope: RecallScope;
|
|
9
|
+
/** Session id used to evaluate `--scope session|global`; ignored for `all`. */
|
|
10
|
+
sessionId?: string;
|
|
11
|
+
limit: number;
|
|
12
|
+
/** Run paraphrase expansion before fusion. Off by default to keep it cheap. */
|
|
13
|
+
expand: boolean;
|
|
14
|
+
/** Model used to generate paraphrases when `--expand` is set. */
|
|
15
|
+
model: string;
|
|
16
|
+
json: boolean;
|
|
17
|
+
waitBudgetMs?: number;
|
|
18
|
+
}
|
|
19
|
+
interface RecallCommandIO {
|
|
20
|
+
stdout: NodeJS.WritableStream;
|
|
21
|
+
/**
|
|
22
|
+
* Embedding client for the vector path. Defaults to the Duet endpoint
|
|
23
|
+
* client; tests inject a stub (or a throwing one) to exercise fusion and
|
|
24
|
+
* the keyword-only fallback without a network call.
|
|
25
|
+
*/
|
|
26
|
+
embed?: EmbedFn;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Run `duet memory recall <query>` — the CLI surface over the same hybrid
|
|
30
|
+
* retrieval pipeline the runner's `recall_memory` tool uses. Both call
|
|
31
|
+
* {@link recallMemoryExpanded}, so a query returns the same fused ranking
|
|
32
|
+
* whether it comes from the model mid-turn or from the shell.
|
|
33
|
+
*
|
|
34
|
+
* Embeddings come from the Duet endpoint via {@link createEmbeddingClient};
|
|
35
|
+
* when `DUET_API_KEY` is unset the vector path degrades to keyword-only and
|
|
36
|
+
* the output is flagged as such, matching the tool's fallback. Passing
|
|
37
|
+
* `--expand` adds model-generated paraphrases (default {@link
|
|
38
|
+
* DEFAULT_CLI_MEMORY_MODEL}) before fusion, again matching the tool.
|
|
39
|
+
*/
|
|
40
|
+
export declare function runMemoryRecallCommand(args: string[], io?: RecallCommandIO): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Parse `duet memory recall` flags and positional query. Pure (no I/O) so it
|
|
43
|
+
* can be unit-tested. Returns `undefined` when `--help` was handled.
|
|
44
|
+
*/
|
|
45
|
+
export declare function parseMemoryRecallArgs(args: string[]): RecallCommandOptions | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Render fused recall hits as an aligned table. Rows are printed in ranked
|
|
48
|
+
* order (best match first), so a RANK column carries the ordering rather than
|
|
49
|
+
* the global-pack `score` the filter-query path prints.
|
|
50
|
+
*/
|
|
51
|
+
export declare function formatRecallTable(observations: Observation[]): string;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=memory-recall.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-recall.d.ts","sourceRoot":"","sources":["../../../src/cli/memory-recall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAG7E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAMtD,UAAU,oBAAoB;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,WAAW,CAAC;IACnB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,MAAM,EAAE,OAAO,CAAC;IAChB,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC;IAC9B;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAID;;;;;;;;;;;GAWG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,MAAM,EAAE,EACd,EAAE,GAAE,eAA4C,GAC/C,OAAO,CAAC,IAAI,CAAC,CA8Cf;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,oBAAoB,GAAG,SAAS,CAuGtF;AAOD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,WAAW,EAAE,GAAG,MAAM,CA4CrE"}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { createEmbeddingClient } from "../memory/embedding.js";
|
|
2
|
+
import { recallMemoryExpanded } from "../memory/recall.js";
|
|
3
|
+
import { DEFAULT_CLI_MEMORY_MODEL } from "../model-resolution/resolver.js";
|
|
4
|
+
import { DEFAULT_MEMORY_DB_PATH } from "../session/session-manager.js";
|
|
5
|
+
import { printMemoryRecallHelp } from "./help.js";
|
|
6
|
+
import { scoreObservation, withMemorySession } from "./memory-db.js";
|
|
7
|
+
import { toMemoryJson } from "./memory-json.js";
|
|
8
|
+
import { resolveUserPath, usageError } from "./shared.js";
|
|
9
|
+
const SCOPES = ["session", "global", "all"];
|
|
10
|
+
/**
|
|
11
|
+
* Run `duet memory recall <query>` — the CLI surface over the same hybrid
|
|
12
|
+
* retrieval pipeline the runner's `recall_memory` tool uses. Both call
|
|
13
|
+
* {@link recallMemoryExpanded}, so a query returns the same fused ranking
|
|
14
|
+
* whether it comes from the model mid-turn or from the shell.
|
|
15
|
+
*
|
|
16
|
+
* Embeddings come from the Duet endpoint via {@link createEmbeddingClient};
|
|
17
|
+
* when `DUET_API_KEY` is unset the vector path degrades to keyword-only and
|
|
18
|
+
* the output is flagged as such, matching the tool's fallback. Passing
|
|
19
|
+
* `--expand` adds model-generated paraphrases (default {@link
|
|
20
|
+
* DEFAULT_CLI_MEMORY_MODEL}) before fusion, again matching the tool.
|
|
21
|
+
*/
|
|
22
|
+
export async function runMemoryRecallCommand(args, io = { stdout: process.stdout }) {
|
|
23
|
+
const options = parseMemoryRecallArgs(args);
|
|
24
|
+
if (!options)
|
|
25
|
+
return;
|
|
26
|
+
const embed = io.embed ?? createEmbeddingClient();
|
|
27
|
+
const result = await withMemorySession(options.dbPath, (session) => recallMemoryExpanded({
|
|
28
|
+
session,
|
|
29
|
+
embed,
|
|
30
|
+
query: options.query,
|
|
31
|
+
limit: options.limit,
|
|
32
|
+
scope: options.scope,
|
|
33
|
+
...(options.sessionId ? { sessionId: options.sessionId } : {}),
|
|
34
|
+
...(options.expand ? { expansionModel: options.model } : {}),
|
|
35
|
+
}), { waitBudgetMs: options.waitBudgetMs });
|
|
36
|
+
if (options.json) {
|
|
37
|
+
// A single `now` so every row's pack score is computed against the same
|
|
38
|
+
// clock, then attach the fused relevance score the pipeline already
|
|
39
|
+
// returned per id. Emitted as a bare array of canonical memory objects,
|
|
40
|
+
// ordered best-first, matching the `duet memory` query output.
|
|
41
|
+
const now = Date.now();
|
|
42
|
+
const rows = result.observations.map((observation) => toMemoryJson(observation, {
|
|
43
|
+
packScore: scoreObservation(observation, now),
|
|
44
|
+
...(result.relevanceById.has(observation.id)
|
|
45
|
+
? { relevanceScore: result.relevanceById.get(observation.id) }
|
|
46
|
+
: {}),
|
|
47
|
+
}));
|
|
48
|
+
io.stdout.write(`${JSON.stringify(rows, null, 2)}\n`);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const degraded = result.vectorSearchAttempted && !result.vectorSearchSucceeded;
|
|
52
|
+
if (degraded) {
|
|
53
|
+
io.stdout.write("Semantic search unavailable (keyword-only fallback). Run `duet login` to enable hybrid retrieval.\n");
|
|
54
|
+
}
|
|
55
|
+
io.stdout.write(`${formatRecallTable(result.observations)}\n`);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Parse `duet memory recall` flags and positional query. Pure (no I/O) so it
|
|
59
|
+
* can be unit-tested. Returns `undefined` when `--help` was handled.
|
|
60
|
+
*/
|
|
61
|
+
export function parseMemoryRecallArgs(args) {
|
|
62
|
+
let dbPath = DEFAULT_MEMORY_DB_PATH;
|
|
63
|
+
let scope = "all";
|
|
64
|
+
let sessionId;
|
|
65
|
+
let limit = 8;
|
|
66
|
+
let expand = false;
|
|
67
|
+
let model = DEFAULT_CLI_MEMORY_MODEL;
|
|
68
|
+
let json = false;
|
|
69
|
+
let waitBudgetMs;
|
|
70
|
+
const queryParts = [];
|
|
71
|
+
let flagQuery;
|
|
72
|
+
for (let i = 0; i < args.length; i++) {
|
|
73
|
+
const arg = args[i];
|
|
74
|
+
switch (arg) {
|
|
75
|
+
case "--db":
|
|
76
|
+
if (!args[i + 1] || args[i + 1]?.startsWith("-"))
|
|
77
|
+
usageError(`Missing value for ${arg}`);
|
|
78
|
+
dbPath = resolveUserPath(args[++i]);
|
|
79
|
+
break;
|
|
80
|
+
case "--scope": {
|
|
81
|
+
const raw = args[++i];
|
|
82
|
+
if (!raw || !SCOPES.includes(raw)) {
|
|
83
|
+
usageError(`Invalid --scope value: ${raw} (expected one of ${SCOPES.join(", ")})`);
|
|
84
|
+
}
|
|
85
|
+
scope = raw;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
case "--session":
|
|
89
|
+
if (!args[i + 1] || args[i + 1]?.startsWith("-"))
|
|
90
|
+
usageError(`Missing value for ${arg}`);
|
|
91
|
+
sessionId = args[++i];
|
|
92
|
+
break;
|
|
93
|
+
case "--query":
|
|
94
|
+
if (!args[i + 1] || args[i + 1]?.startsWith("-"))
|
|
95
|
+
usageError(`Missing value for ${arg}`);
|
|
96
|
+
flagQuery = args[++i];
|
|
97
|
+
break;
|
|
98
|
+
case "--limit": {
|
|
99
|
+
const raw = args[++i];
|
|
100
|
+
const value = Number(raw);
|
|
101
|
+
if (!raw || !Number.isInteger(value) || value < 1) {
|
|
102
|
+
usageError(`Invalid --limit value: ${raw} (expected a positive integer)`);
|
|
103
|
+
}
|
|
104
|
+
limit = value;
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
case "--expand":
|
|
108
|
+
expand = true;
|
|
109
|
+
break;
|
|
110
|
+
case "--model":
|
|
111
|
+
if (!args[i + 1] || args[i + 1]?.startsWith("-"))
|
|
112
|
+
usageError(`Missing value for ${arg}`);
|
|
113
|
+
model = args[++i];
|
|
114
|
+
break;
|
|
115
|
+
case "--json":
|
|
116
|
+
json = true;
|
|
117
|
+
break;
|
|
118
|
+
case "--wait": {
|
|
119
|
+
const raw = args[++i];
|
|
120
|
+
const seconds = Number(raw);
|
|
121
|
+
if (!raw || !Number.isFinite(seconds) || seconds < 0) {
|
|
122
|
+
usageError(`Invalid --wait value: ${raw} (expected non-negative number of seconds)`);
|
|
123
|
+
}
|
|
124
|
+
waitBudgetMs = Math.round(seconds * 1000);
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
case "--help":
|
|
128
|
+
case "-h":
|
|
129
|
+
printMemoryRecallHelp();
|
|
130
|
+
return undefined;
|
|
131
|
+
default:
|
|
132
|
+
if (arg.startsWith("-"))
|
|
133
|
+
usageError(`Unknown recall option: ${arg}`);
|
|
134
|
+
queryParts.push(arg);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// `--query` and positional args are both accepted; positional is the
|
|
138
|
+
// human-friendly form. When both are present they combine, with the
|
|
139
|
+
// explicit flag first.
|
|
140
|
+
const query = [flagQuery, queryParts.join(" ")]
|
|
141
|
+
.filter((part) => Boolean(part && part.trim()))
|
|
142
|
+
.join(" ")
|
|
143
|
+
.trim();
|
|
144
|
+
if (query.length === 0) {
|
|
145
|
+
usageError("No query provided. Pass the text to recall, e.g. `duet memory recall wire budget cap`.");
|
|
146
|
+
}
|
|
147
|
+
// session/global scope filter is a no-op without an id to compare against,
|
|
148
|
+
// so require one rather than silently returning an unfiltered (or empty)
|
|
149
|
+
// result set.
|
|
150
|
+
if ((scope === "session" || scope === "global") && !sessionId) {
|
|
151
|
+
usageError(`--scope ${scope} requires --session <id> to compare against.`);
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
dbPath,
|
|
155
|
+
query,
|
|
156
|
+
scope,
|
|
157
|
+
...(sessionId ? { sessionId } : {}),
|
|
158
|
+
limit,
|
|
159
|
+
expand,
|
|
160
|
+
model,
|
|
161
|
+
json,
|
|
162
|
+
...(waitBudgetMs !== undefined ? { waitBudgetMs } : {}),
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function truncate(value, max) {
|
|
166
|
+
const collapsed = value.replace(/\s+/g, " ");
|
|
167
|
+
return collapsed.length <= max ? collapsed : `${collapsed.slice(0, max - 1)}…`;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Render fused recall hits as an aligned table. Rows are printed in ranked
|
|
171
|
+
* order (best match first), so a RANK column carries the ordering rather than
|
|
172
|
+
* the global-pack `score` the filter-query path prints.
|
|
173
|
+
*/
|
|
174
|
+
export function formatRecallTable(observations) {
|
|
175
|
+
if (observations.length === 0) {
|
|
176
|
+
return "No memories matched. Try different words, `--expand`, or a wider `--scope`.";
|
|
177
|
+
}
|
|
178
|
+
const rows = observations.map((o, index) => ({
|
|
179
|
+
rank: String(index + 1),
|
|
180
|
+
created: new Date(o.createdAt).toISOString().slice(0, 10),
|
|
181
|
+
kind: o.kind,
|
|
182
|
+
priority: o.priority,
|
|
183
|
+
source: o.source.kind,
|
|
184
|
+
content: truncate(o.content, 70),
|
|
185
|
+
id: o.id,
|
|
186
|
+
}));
|
|
187
|
+
const headers = {
|
|
188
|
+
rank: "#",
|
|
189
|
+
created: "CREATED",
|
|
190
|
+
kind: "KIND",
|
|
191
|
+
priority: "PRIORITY",
|
|
192
|
+
source: "SOURCE",
|
|
193
|
+
content: "CONTENT",
|
|
194
|
+
id: "MEMORY ID",
|
|
195
|
+
};
|
|
196
|
+
const width = (key, cap) => Math.min(cap, Math.max(headers[key].length, ...rows.map((row) => row[key].length)));
|
|
197
|
+
const w = {
|
|
198
|
+
rank: width("rank", 3),
|
|
199
|
+
created: width("created", 10),
|
|
200
|
+
kind: width("kind", 11),
|
|
201
|
+
priority: width("priority", 8),
|
|
202
|
+
source: width("source", 6),
|
|
203
|
+
content: width("content", 70),
|
|
204
|
+
id: width("id", 20),
|
|
205
|
+
};
|
|
206
|
+
const line = (cells) => [
|
|
207
|
+
cells.rank.padStart(w.rank),
|
|
208
|
+
cells.created.padEnd(w.created),
|
|
209
|
+
cells.kind.padEnd(w.kind),
|
|
210
|
+
cells.priority.padEnd(w.priority),
|
|
211
|
+
cells.source.padEnd(w.source),
|
|
212
|
+
truncate(cells.content, w.content).padEnd(w.content),
|
|
213
|
+
cells.id,
|
|
214
|
+
].join(" ");
|
|
215
|
+
return [line(headers), ...rows.map(line)].join("\n");
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=memory-recall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-recall.js","sourceRoot":"","sources":["../../../src/cli/memory-recall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAgB,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAoB,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,k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AAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvD,CAAC"}
|
package/dist/src/cli/memory.d.ts
CHANGED
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
* memory` opens the interactive TUI for browsing/editing/deleting, while
|
|
6
6
|
* passing `--json` or any filter flag (`--type`/`--kind`/`--priority`/
|
|
7
7
|
* `--source`/`--from`/`--to`) turns the same invocation into a non-TUI,
|
|
8
|
-
* scriptable query. `duet memory
|
|
8
|
+
* scriptable query. `duet memory recall` runs hybrid semantic search over the
|
|
9
|
+
* same pipeline as the runner's `recall_memory` tool, and `duet memory
|
|
10
|
+
* reflect` remains a separate subcommand.
|
|
9
11
|
*
|
|
10
12
|
* Defaults to the same `~/.duet/memory.db` the runner writes to so changes
|
|
11
13
|
* propagate to the next session immediately.
|