@duetso/agent 0.1.197 → 0.1.199
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/package.json +3 -2
- 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 +77 -8
- package/dist/src/cli/help.js.map +1 -1
- package/dist/src/cli/memory-db.d.ts +26 -5
- package/dist/src/cli/memory-db.d.ts.map +1 -1
- package/dist/src/cli/memory-db.js +62 -5
- package/dist/src/cli/memory-db.js.map +1 -1
- package/dist/src/cli/memory-query.d.ts +35 -0
- package/dist/src/cli/memory-query.d.ts.map +1 -0
- package/dist/src/cli/memory-query.js +179 -0
- package/dist/src/cli/memory-query.js.map +1 -0
- package/dist/src/cli/memory.d.ts +7 -2
- package/dist/src/cli/memory.d.ts.map +1 -1
- package/dist/src/cli/memory.js +16 -42
- package/dist/src/cli/memory.js.map +1 -1
- package/dist/src/cli/model-gateway.d.ts +27 -0
- package/dist/src/cli/model-gateway.d.ts.map +1 -0
- package/dist/src/cli/model-gateway.js +51 -0
- package/dist/src/cli/model-gateway.js.map +1 -0
- package/dist/src/cli/model.d.ts +46 -0
- package/dist/src/cli/model.d.ts.map +1 -0
- package/dist/src/cli/model.js +344 -0
- package/dist/src/cli/model.js.map +1 -0
- package/dist/src/cli/train.d.ts.map +1 -1
- package/dist/src/cli/train.js +22 -35
- 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 +6 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/turn-runner/prompts.d.ts +12 -0
- package/dist/src/turn-runner/prompts.d.ts.map +1 -1
- package/dist/src/turn-runner/prompts.js +19 -1
- package/dist/src/turn-runner/prompts.js.map +1 -1
- package/dist/src/turn-runner/tools.d.ts +2 -1
- package/dist/src/turn-runner/tools.d.ts.map +1 -1
- package/dist/src/turn-runner/tools.js +7 -1
- package/dist/src/turn-runner/tools.js.map +1 -1
- package/dist/src/turn-runner/turn-runner.d.ts +3 -0
- package/dist/src/turn-runner/turn-runner.d.ts.map +1 -1
- package/dist/src/turn-runner/turn-runner.js +57 -17
- package/dist/src/turn-runner/turn-runner.js.map +1 -1
- package/dist/src/types/state-machine.d.ts +26 -0
- package/dist/src/types/state-machine.d.ts.map +1 -1
- package/package.json +3 -2
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duetso/agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.199",
|
|
4
4
|
"description": "An opinionated full-stack agent turn runner with native memories, interrupts, and multi-agent orchestration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
64
64
|
"@opentui/core": "^0.2.5",
|
|
65
65
|
"@vscode/ripgrep": "^1.18.0",
|
|
66
|
+
"ai": "^7",
|
|
66
67
|
"ajv": "^8.20.0",
|
|
67
68
|
"dedent": "^1.7.2",
|
|
68
69
|
"dotenv": "^17.4.2",
|
|
@@ -83,7 +84,7 @@
|
|
|
83
84
|
"typescript": "^5.7.0"
|
|
84
85
|
},
|
|
85
86
|
"engines": {
|
|
86
|
-
"node": ">=
|
|
87
|
+
"node": ">=22"
|
|
87
88
|
},
|
|
88
89
|
"packageManager": "bun@1.3.11"
|
|
89
90
|
}
|
package/dist/src/cli/help.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare function printSkillsHelp(): void;
|
|
|
12
12
|
export declare function printMemoryHelp(): void;
|
|
13
13
|
export declare function printMemoryAddHelp(): void;
|
|
14
14
|
export declare function printMemoryReflectHelp(): void;
|
|
15
|
+
export declare function printModelHelp(): void;
|
|
15
16
|
export declare function printTrainHelp(): void;
|
|
16
17
|
export declare function printSendFeedbackHelp(): void;
|
|
17
18
|
export declare function printUpgradeHelp(packageName: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../../src/cli/help.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,IAAI,CAAC;AAEjD,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../../src/cli/help.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,IAAI,CAAC;AAEjD,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAyFtD;AAED,wBAAgB,cAAc,IAAI,IAAI,CA0BrC;AAED,wBAAgB,YAAY,IAAI,IAAI,CAsBnC;AAED,wBAAgB,eAAe,IAAI,IAAI,CAqBtC;AAED,wBAAgB,eAAe,IAAI,IAAI,CAuDtC;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CAyBzC;AAED,wBAAgB,sBAAsB,IAAI,IAAI,CAuC7C;AAED,wBAAgB,cAAc,IAAI,IAAI,CAsCrC;AAED,wBAAgB,cAAc,IAAI,IAAI,CA+DrC;AAED,wBAAgB,qBAAqB,IAAI,IAAI,CAiB5C;AAED,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAe1D"}
|
package/dist/src/cli/help.js
CHANGED
|
@@ -15,7 +15,8 @@ USAGE
|
|
|
15
15
|
duet login [--no-browser] [--skip-skill-sync]
|
|
16
16
|
duet env [--env-file <path>] [--import [path]|--keys]
|
|
17
17
|
duet skills [--workdir <path>]
|
|
18
|
-
duet memory [--db <path>]
|
|
18
|
+
duet memory [--db <path>] [--json] [filters]
|
|
19
|
+
duet model -m <model> [--type text|image|video] [prompt]
|
|
19
20
|
duet send-feedback [--file <path>] [text...]
|
|
20
21
|
duet upgrade [--manager npm|bun|pnpm|yarn]
|
|
21
22
|
echo "prompt" | duet
|
|
@@ -24,7 +25,8 @@ COMMANDS
|
|
|
24
25
|
login Sign in via browser; saves DUET_API_KEY and syncs default skills (recommended)
|
|
25
26
|
env Manually create or update the shared duet env file with provider API keys
|
|
26
27
|
skills List installed skills + collisions as JSON
|
|
27
|
-
memory
|
|
28
|
+
memory Browse memories in a TUI, or query them with --json/filters (alias: memories)
|
|
29
|
+
model Call a gateway model directly (text/image/video) via the AI SDK
|
|
28
30
|
send-feedback Send free-form markdown feedback to the Duet team
|
|
29
31
|
upgrade Upgrade the global ${packageName} installation
|
|
30
32
|
|
|
@@ -87,6 +89,8 @@ EXAMPLES
|
|
|
87
89
|
duet login
|
|
88
90
|
duet env
|
|
89
91
|
duet memory
|
|
92
|
+
duet model -m openai/gpt-5.5 "write a haiku about gateways"
|
|
93
|
+
duet model -m black-forest-labs/flux-1.1-pro -o art.png "a fox in snow"
|
|
90
94
|
duet train ./docs/my-project
|
|
91
95
|
duet send-feedback "the TUI flickers when..."
|
|
92
96
|
duet upgrade
|
|
@@ -166,28 +170,54 @@ OUTPUT
|
|
|
166
170
|
}
|
|
167
171
|
export function printMemoryHelp() {
|
|
168
172
|
console.log(`
|
|
169
|
-
duet memory — Browse, edit, and delete observational memories
|
|
173
|
+
duet memory — Browse, query, edit, and delete observational memories
|
|
170
174
|
|
|
171
175
|
USAGE
|
|
172
176
|
duet memory [--db <path>] [--wait <seconds>]
|
|
177
|
+
duet memory [--json] [--type <kind>] [--priority <level>] [--source <origin>]
|
|
178
|
+
[--from <date>] [--to <date>]
|
|
173
179
|
duet memory reflect [options]
|
|
174
180
|
|
|
175
181
|
ALIASES
|
|
176
182
|
duet memories
|
|
177
183
|
|
|
184
|
+
DESCRIPTION
|
|
185
|
+
Bare \`duet memory\` opens an interactive TUI to browse, edit, and delete
|
|
186
|
+
durable observations. Passing --json or any filter flag instead runs a
|
|
187
|
+
non-TUI, scriptable query: it prints a flat, chronological list (newest
|
|
188
|
+
createdAt first) of the matching observations, each carrying a computed
|
|
189
|
+
\`score\` field matching the runner's global-pack ranking. With --json the
|
|
190
|
+
output is a machine-readable array; otherwise an aligned table is printed.
|
|
191
|
+
|
|
192
|
+
Examples:
|
|
193
|
+
duet memory
|
|
194
|
+
duet memory --json --type reflection --from 2026-06-26
|
|
195
|
+
duet memory --json --from "$(date -u -d '24 hours ago' +%Y-%m-%dT%H:%M:%S)"
|
|
196
|
+
|
|
178
197
|
SUBCOMMANDS
|
|
179
198
|
add Write a single user-added note memory
|
|
180
199
|
(run \`duet memory add --help\` for add-specific options)
|
|
181
200
|
reflect Condense old global observations into reflection rows
|
|
182
201
|
(run \`duet memory reflect --help\` for reflect-specific options)
|
|
183
202
|
|
|
203
|
+
QUERY OPTIONS
|
|
204
|
+
--json Emit a JSON array instead of a table (also enables query mode)
|
|
205
|
+
--type <kind> Filter by kind: observation | reflection | manual
|
|
206
|
+
--kind <kind> Alias for --type
|
|
207
|
+
--priority <level> Filter by priority: high | medium | low
|
|
208
|
+
--source <origin> Filter by source: user | agent | system
|
|
209
|
+
--from <date> Inclusive lower bound on createdAt. Accepts
|
|
210
|
+
YYYY-MM-DD (start of day UTC) or YYYY-MM-DDTHH:MM:SS (UTC)
|
|
211
|
+
--to <date> Inclusive upper bound on createdAt. Accepts
|
|
212
|
+
YYYY-MM-DD (end of day UTC) or YYYY-MM-DDTHH:MM:SS (UTC)
|
|
213
|
+
|
|
184
214
|
OPTIONS
|
|
185
215
|
--db <path> Memory database path (default: ~/.duet/memory.db)
|
|
186
216
|
--wait <seconds> Seconds to wait for the cross-process open-lock when a peer
|
|
187
217
|
duet process is holding it (default: 30; 0 fails immediately)
|
|
188
218
|
-h, --help Show this help
|
|
189
219
|
|
|
190
|
-
KEYS
|
|
220
|
+
KEYS (TUI)
|
|
191
221
|
↑ / ↓ Move selection
|
|
192
222
|
e Edit selected memory in $EDITOR
|
|
193
223
|
d Delete selected memory
|
|
@@ -260,16 +290,55 @@ OPTIONS
|
|
|
260
290
|
-h, --help Show this help
|
|
261
291
|
`);
|
|
262
292
|
}
|
|
293
|
+
export function printModelHelp() {
|
|
294
|
+
console.log(`
|
|
295
|
+
duet model — Call a gateway model directly via the AI SDK
|
|
296
|
+
|
|
297
|
+
USAGE
|
|
298
|
+
duet model -m <model> [options] [prompt]
|
|
299
|
+
echo "prompt" | duet model -m <model>
|
|
300
|
+
|
|
301
|
+
DESCRIPTION
|
|
302
|
+
Talks to a model directly through the Vercel AI SDK pointed at the Duet
|
|
303
|
+
gateway, bypassing the agent harness. The request type is inferred from
|
|
304
|
+
the gateway model catalog (language→text, image→image, video→video) and
|
|
305
|
+
can be overridden with --type. Text streams to stdout; image and video
|
|
306
|
+
generations write files and print each path. Auth uses DUET_API_KEY.
|
|
307
|
+
|
|
308
|
+
OPTIONS
|
|
309
|
+
-m, --model <name> Gateway model id, e.g. openai/gpt-5.5 (required)
|
|
310
|
+
--type text|image|video Override the catalog-inferred request type
|
|
311
|
+
--image <path> Input image: vision context (text), edit source
|
|
312
|
+
(image), or still to animate (video)
|
|
313
|
+
-o, --out <path> Write output here; image/video auto-name when omitted
|
|
314
|
+
--system <text> System prompt for text/image-language models
|
|
315
|
+
--size <WxH> Image size, e.g. 1024x1024
|
|
316
|
+
--aspect <W:H> Aspect ratio, e.g. 16:9
|
|
317
|
+
--n <count> Number of outputs to generate
|
|
318
|
+
--seed <int> Generation seed
|
|
319
|
+
--duration <seconds> Video length
|
|
320
|
+
--resolution <WxH> Video resolution, e.g. 1280x720
|
|
321
|
+
--fps <int> Video frames per second
|
|
322
|
+
--env-file <path> Shared env file to load after cwd .env
|
|
323
|
+
-h, --help Show this help
|
|
324
|
+
|
|
325
|
+
EXAMPLES
|
|
326
|
+
duet model -m openai/gpt-5.5 "write a haiku about gateways"
|
|
327
|
+
duet model -m bfl/flux-pro-1.1 -o art.png "a fox in snow"
|
|
328
|
+
duet model -m google/gemini-2.5-flash-image --type image --image src.png "add a hat"
|
|
329
|
+
duet model -m bytedance/seedance-2.0 --type video -o clip.mp4 "slow pan over dunes"
|
|
330
|
+
`);
|
|
331
|
+
}
|
|
263
332
|
export function printTrainHelp() {
|
|
264
333
|
console.log(`
|
|
265
334
|
duet train — Ingest a project corpus into one durable memory observation
|
|
266
335
|
|
|
267
336
|
USAGE
|
|
268
337
|
duet train <folder> [--slug <name>] [--model <name>] [--db <path>] [--wait <seconds>]
|
|
269
|
-
duet train list [--db <path>] [--json]
|
|
270
|
-
duet train show <slug> [--db <path>] [--json]
|
|
271
|
-
duet train update <slug> --content-file <path> [--db <path>] [--json]
|
|
272
|
-
duet train delete <slug> [--db <path>] [--json]
|
|
338
|
+
duet train list [--db <path>] [--json] [--wait <seconds>]
|
|
339
|
+
duet train show <slug> [--db <path>] [--json] [--wait <seconds>]
|
|
340
|
+
duet train update <slug> --content-file <path> [--db <path>] [--json] [--wait <seconds>]
|
|
341
|
+
duet train delete <slug> [--db <path>] [--json] [--wait <seconds>]
|
|
273
342
|
|
|
274
343
|
DESCRIPTION
|
|
275
344
|
Launches a duet agent with the corpus folder as its working directory.
|
package/dist/src/cli/help.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../../src/cli/help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAExE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC;AAEjD,MAAM,UAAU,YAAY,CAAC,WAAmB;IAC9C,OAAO,CAAC,GAAG,CAAC
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../../src/cli/help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAExE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC;AAEjD,MAAM,UAAU,YAAY,CAAC,WAAmB;IAC9C,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;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C;AAED,MAAM,UAAU,qBAAqB;IACnC,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;CAeb,CAAC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,WAAmB;IAClD,OAAO,CAAC,GAAG,CAAC;oCACsB,WAAW;;;;;;;;;;;;CAY9C,CAAC,CAAC;AACH,CAAC"}
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import type { TrainListEntry, TrainRecord } from "../train/types.js";
|
|
2
|
-
import type { Observation } from "../types/memory.js";
|
|
2
|
+
import type { Observation, ObservationSource } from "../types/memory.js";
|
|
3
3
|
/** Rows fetched per page by the ranked, lazily-paginated TUI list. */
|
|
4
4
|
export declare const MEMORY_PAGE_SIZE = 25;
|
|
5
|
+
export interface MemoryQueryFilters {
|
|
6
|
+
kind?: Observation["kind"];
|
|
7
|
+
priority?: Observation["priority"];
|
|
8
|
+
source?: ObservationSource["kind"];
|
|
9
|
+
fromMs?: number;
|
|
10
|
+
toMs?: number;
|
|
11
|
+
}
|
|
5
12
|
/**
|
|
6
13
|
* Absolute global-pack score for one observation under the CLI defaults.
|
|
7
|
-
* Reuses the shared {@link observationScore} formula
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
14
|
+
* Reuses the shared {@link observationScore} formula but layers the manual
|
|
15
|
+
* multiplier on top — `observationScore` only applies `reflectionBias`, so
|
|
16
|
+
* calling it directly would under-report curated/manual rows by the manual
|
|
17
|
+
* multiplier. The runner's `loadGlobalPack` applies `manualBias` to
|
|
18
|
+
* `kind === "manual"` as a separate factor, and the value surfaced here must
|
|
19
|
+
* match that ranking so the TUI ordering and the per-row score number agree
|
|
20
|
+
* with the runtime ranking across every kind, including manual rows.
|
|
11
21
|
*/
|
|
12
22
|
export declare function scoreObservation(observation: Observation, now?: number): number;
|
|
13
23
|
/**
|
|
@@ -51,6 +61,8 @@ export declare class MemoryDb {
|
|
|
51
61
|
offset: number;
|
|
52
62
|
now?: number;
|
|
53
63
|
}): Promise<Observation[]>;
|
|
64
|
+
/** Query observations newest-first with the optional `duet memory` query filters. */
|
|
65
|
+
queryObservations(filters?: MemoryQueryFilters): Promise<Observation[]>;
|
|
54
66
|
/**
|
|
55
67
|
* Every `duet train` row (those tagged `train`), newest-first, joined to its
|
|
56
68
|
* archive manifest for headline/model/provenance. Backs `duet train list`.
|
|
@@ -76,4 +88,13 @@ export declare class MemoryDb {
|
|
|
76
88
|
delete(id: string): Promise<void>;
|
|
77
89
|
close(): Promise<void>;
|
|
78
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Open the memory database for a one-shot CLI subcommand, run `fn`, and always
|
|
93
|
+
* close it. Cross-process lock contention surfaces as the same friendly,
|
|
94
|
+
* actionable message every memory/train subcommand uses rather than a raw
|
|
95
|
+
* error. Shared by `duet train` management commands and `duet memory` queries.
|
|
96
|
+
*/
|
|
97
|
+
export declare function withMemoryDb<T>(dbPath: string, fn: (db: MemoryDb) => Promise<T>, { waitBudgetMs }?: {
|
|
98
|
+
waitBudgetMs?: number;
|
|
99
|
+
}): Promise<T>;
|
|
79
100
|
//# sourceMappingURL=memory-db.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-db.d.ts","sourceRoot":"","sources":["../../../src/cli/memory-db.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"memory-db.d.ts","sourceRoot":"","sources":["../../../src/cli/memory-db.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAIzE,sEAAsE;AACtE,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,QAAQ,CAAC,EAAE,WAAW,CAAC,UAAU,CAA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CAAC,IAAI,CAAC;IAKjC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAClC,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,CAAC,EAAE,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,EAChC,EAAE,YAAY,EAAE,GAAE;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAO,GAC/C,OAAO,CAAC,CAAC,CAAC,CAqBZ"}
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { observationScore, PRIORITY_WEIGHT } from "../memory/loader.js";
|
|
2
2
|
import { runMigrations } from "../memory/migrations.js";
|
|
3
3
|
import { DEFAULT_MANUAL_BIAS, DEFAULT_NOTE_BIAS, DEFAULT_RECENCY_HALF_LIFE_MS, DEFAULT_REFLECTION_BIAS, } from "../memory/observational.js";
|
|
4
|
-
import { DEFAULT_OPEN_LOCK_WAIT_BUDGET_MS, openPGliteWaitingForLock } from "../memory/pglite.js";
|
|
4
|
+
import { DEFAULT_OPEN_LOCK_WAIT_BUDGET_MS, MemoryLockTimeoutError, openPGliteWaitingForLock, } from "../memory/pglite.js";
|
|
5
5
|
import { readArchiveManifest, removeArchive } from "../train/archive.js";
|
|
6
6
|
import { isTrainTagged, slugFromTags } from "../train/tags.js";
|
|
7
|
+
import { fail } from "./shared.js";
|
|
8
|
+
import { installShutdownHandlers } from "./shutdown.js";
|
|
7
9
|
/** Rows fetched per page by the ranked, lazily-paginated TUI list. */
|
|
8
10
|
export const MEMORY_PAGE_SIZE = 25;
|
|
9
11
|
/**
|
|
10
12
|
* Absolute global-pack score for one observation under the CLI defaults.
|
|
11
|
-
* Reuses the shared {@link observationScore} formula
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Reuses the shared {@link observationScore} formula but layers the manual
|
|
14
|
+
* multiplier on top — `observationScore` only applies `reflectionBias`, so
|
|
15
|
+
* calling it directly would under-report curated/manual rows by the manual
|
|
16
|
+
* multiplier. The runner's `loadGlobalPack` applies `manualBias` to
|
|
17
|
+
* `kind === "manual"` as a separate factor, and the value surfaced here must
|
|
18
|
+
* match that ranking so the TUI ordering and the per-row score number agree
|
|
19
|
+
* with the runtime ranking across every kind, including manual rows.
|
|
15
20
|
*/
|
|
16
21
|
export function scoreObservation(observation, now = Date.now()) {
|
|
17
22
|
return observationScore(observation, now, {
|
|
@@ -101,6 +106,32 @@ export class MemoryDb {
|
|
|
101
106
|
]);
|
|
102
107
|
return result.rows.map(rowToObservation);
|
|
103
108
|
}
|
|
109
|
+
/** Query observations newest-first with the optional `duet memory` query filters. */
|
|
110
|
+
async queryObservations(filters = {}) {
|
|
111
|
+
const conditions = [];
|
|
112
|
+
const params = [];
|
|
113
|
+
const bind = (clause, value) => {
|
|
114
|
+
params.push(value);
|
|
115
|
+
conditions.push(clause.replace("$?", `$${params.length}`));
|
|
116
|
+
};
|
|
117
|
+
if (filters.kind !== undefined)
|
|
118
|
+
bind("kind = $?", filters.kind);
|
|
119
|
+
if (filters.priority !== undefined)
|
|
120
|
+
bind("priority = $?", filters.priority);
|
|
121
|
+
if (filters.source !== undefined)
|
|
122
|
+
bind("(source_json::json->>'kind') = $?", filters.source);
|
|
123
|
+
if (filters.fromMs !== undefined)
|
|
124
|
+
bind("created_at >= $?", filters.fromMs);
|
|
125
|
+
if (filters.toMs !== undefined)
|
|
126
|
+
bind("created_at <= $?", filters.toMs);
|
|
127
|
+
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
128
|
+
const result = await this.db.query(`SELECT id, created_at, last_used_at, session_id, kind, observed_date, referenced_date, relative_date,
|
|
129
|
+
time_of_day, priority, source_json, content, tags_json
|
|
130
|
+
FROM observations
|
|
131
|
+
${where}
|
|
132
|
+
ORDER BY created_at DESC, id ASC`, params);
|
|
133
|
+
return result.rows.map(rowToObservation);
|
|
134
|
+
}
|
|
104
135
|
/**
|
|
105
136
|
* Every `duet train` row (those tagged `train`), newest-first, joined to its
|
|
106
137
|
* archive manifest for headline/model/provenance. Backs `duet train list`.
|
|
@@ -164,6 +195,32 @@ export class MemoryDb {
|
|
|
164
195
|
await this.db.close();
|
|
165
196
|
}
|
|
166
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* Open the memory database for a one-shot CLI subcommand, run `fn`, and always
|
|
200
|
+
* close it. Cross-process lock contention surfaces as the same friendly,
|
|
201
|
+
* actionable message every memory/train subcommand uses rather than a raw
|
|
202
|
+
* error. Shared by `duet train` management commands and `duet memory` queries.
|
|
203
|
+
*/
|
|
204
|
+
export async function withMemoryDb(dbPath, fn, { waitBudgetMs } = {}) {
|
|
205
|
+
let db;
|
|
206
|
+
try {
|
|
207
|
+
db = await MemoryDb.open(dbPath, { waitBudgetMs });
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
if (error instanceof MemoryLockTimeoutError) {
|
|
211
|
+
fail(`Memory database at ${error.dataDir} is still locked by duet pid ${error.holderPid} after ${error.budgetMs / 1000}s. Stop that process (or pass --wait <seconds> to wait longer) and retry.`);
|
|
212
|
+
}
|
|
213
|
+
throw error;
|
|
214
|
+
}
|
|
215
|
+
const removeShutdownHandlers = installShutdownHandlers(() => db.close());
|
|
216
|
+
try {
|
|
217
|
+
return await fn(db);
|
|
218
|
+
}
|
|
219
|
+
finally {
|
|
220
|
+
removeShutdownHandlers();
|
|
221
|
+
await db.close();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
167
224
|
function rowToObservation(row) {
|
|
168
225
|
return {
|
|
169
226
|
id: row.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-db.js","sourceRoot":"","sources":["../../../src/cli/memory-db.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EACL,mBAAm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GAAG,CAAC,SAAS,CAAa;KAC5C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Observation } from "../types/memory.js";
|
|
2
|
+
import { type MemoryQueryFilters } from "./memory-db.js";
|
|
3
|
+
interface MemoryQueryIO {
|
|
4
|
+
stdout: NodeJS.WritableStream;
|
|
5
|
+
}
|
|
6
|
+
type ScoredObservation = Observation & {
|
|
7
|
+
score: number;
|
|
8
|
+
};
|
|
9
|
+
export interface MemoryQueryOptions {
|
|
10
|
+
dbPath: string;
|
|
11
|
+
json: boolean;
|
|
12
|
+
filters: MemoryQueryFilters;
|
|
13
|
+
waitBudgetMs?: number;
|
|
14
|
+
/**
|
|
15
|
+
* True when the invocation requested a non-TUI query — i.e. it passed
|
|
16
|
+
* `--json` or any filter flag. Bare `duet memory` (only `--db`/`--wait`)
|
|
17
|
+
* leaves this false and opens the interactive TUI instead.
|
|
18
|
+
*/
|
|
19
|
+
queryMode: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Parse the shared `duet memory` argument set. The same flags drive both the
|
|
23
|
+
* interactive TUI (bare invocation) and the scriptable query (any filter or
|
|
24
|
+
* `--json`); `queryMode` records which path the caller asked for. Returns
|
|
25
|
+
* `undefined` when `--help` was handled.
|
|
26
|
+
*/
|
|
27
|
+
export declare function parseMemoryArgs(args: string[]): MemoryQueryOptions | undefined;
|
|
28
|
+
export declare function formatMemoryTable(observations: ScoredObservation[]): string;
|
|
29
|
+
/**
|
|
30
|
+
* Run the non-TUI query path of `duet memory`: fetch the filtered rows,
|
|
31
|
+
* compute each row's global-pack score, and print JSON or an aligned table.
|
|
32
|
+
*/
|
|
33
|
+
export declare function runMemoryQuery(options: MemoryQueryOptions, io?: MemoryQueryIO): Promise<void>;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=memory-query.d.ts.map
|
|
@@ -0,0 +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;AAGzF,UAAU,aAAa;IACrB,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC;CAC/B;AAED,KAAK,iBAAiB,GAAG,WAAW,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAOzD,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;AAwCD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,kBAAkB,GAAG,SAAS,CAoE9E;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,CAgBf"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { DEFAULT_MEMORY_DB_PATH } from "../session/session-manager.js";
|
|
2
|
+
import { printMemoryHelp } from "./help.js";
|
|
3
|
+
import { scoreObservation, withMemoryDb } from "./memory-db.js";
|
|
4
|
+
import { fail, resolveUserPath } from "./shared.js";
|
|
5
|
+
const KINDS = ["observation", "reflection", "manual"];
|
|
6
|
+
const PRIORITIES = ["high", "medium", "low"];
|
|
7
|
+
const SOURCES = ["user", "agent", "system"];
|
|
8
|
+
/** Parse UTC date filters; date-only bounds cover the whole day. */
|
|
9
|
+
function parseDateBound(raw, flag, edge) {
|
|
10
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(raw)) {
|
|
11
|
+
const iso = `${raw}T${edge === "start" ? "00:00:00.000" : "23:59:59.999"}Z`;
|
|
12
|
+
const ms = Date.parse(iso);
|
|
13
|
+
if (Number.isNaN(ms))
|
|
14
|
+
fail(`Invalid ${flag} date: ${raw}`);
|
|
15
|
+
// Reject impossible calendar dates (e.g. 2026-02-31) that JS silently
|
|
16
|
+
// normalizes into a different day rather than returning NaN — otherwise a
|
|
17
|
+
// typo slides the createdAt window and the wrong rows get exported.
|
|
18
|
+
if (new Date(ms).toISOString().slice(0, 10) !== raw) {
|
|
19
|
+
fail(`Invalid ${flag} date: ${raw} is not a real calendar date`);
|
|
20
|
+
}
|
|
21
|
+
return ms;
|
|
22
|
+
}
|
|
23
|
+
if (/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/.test(raw)) {
|
|
24
|
+
const ms = Date.parse(`${raw}Z`);
|
|
25
|
+
if (Number.isNaN(ms))
|
|
26
|
+
fail(`Invalid ${flag} datetime: ${raw}`);
|
|
27
|
+
// Same round-trip guard for the datetime form (e.g. 2026-02-31T00:00:00).
|
|
28
|
+
if (new Date(ms).toISOString().slice(0, 19) !== raw) {
|
|
29
|
+
fail(`Invalid ${flag} datetime: ${raw} is not a real calendar datetime`);
|
|
30
|
+
}
|
|
31
|
+
return ms;
|
|
32
|
+
}
|
|
33
|
+
fail(`Invalid ${flag} value: ${raw} (expected YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS)`);
|
|
34
|
+
}
|
|
35
|
+
function parseEnum(raw, allowed, flag) {
|
|
36
|
+
if (!raw || raw.startsWith("-"))
|
|
37
|
+
fail(`Missing value for ${flag}`);
|
|
38
|
+
if (!allowed.includes(raw)) {
|
|
39
|
+
fail(`Invalid ${flag} value: ${raw} (expected one of ${allowed.join(", ")})`);
|
|
40
|
+
}
|
|
41
|
+
return raw;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Parse the shared `duet memory` argument set. The same flags drive both the
|
|
45
|
+
* interactive TUI (bare invocation) and the scriptable query (any filter or
|
|
46
|
+
* `--json`); `queryMode` records which path the caller asked for. Returns
|
|
47
|
+
* `undefined` when `--help` was handled.
|
|
48
|
+
*/
|
|
49
|
+
export function parseMemoryArgs(args) {
|
|
50
|
+
let dbPath = DEFAULT_MEMORY_DB_PATH;
|
|
51
|
+
let json = false;
|
|
52
|
+
let waitBudgetMs;
|
|
53
|
+
let hasFilter = false;
|
|
54
|
+
const filters = {};
|
|
55
|
+
for (let i = 0; i < args.length; i++) {
|
|
56
|
+
const arg = args[i];
|
|
57
|
+
switch (arg) {
|
|
58
|
+
case "--db":
|
|
59
|
+
if (!args[i + 1] || args[i + 1]?.startsWith("-"))
|
|
60
|
+
fail(`Missing value for ${arg}`);
|
|
61
|
+
dbPath = resolveUserPath(args[++i]);
|
|
62
|
+
break;
|
|
63
|
+
// `--type` and `--kind` are aliases for the same `Observation.kind` axis.
|
|
64
|
+
case "--type":
|
|
65
|
+
case "--kind":
|
|
66
|
+
filters.kind = parseEnum(args[++i], KINDS, arg);
|
|
67
|
+
hasFilter = true;
|
|
68
|
+
break;
|
|
69
|
+
case "--priority":
|
|
70
|
+
filters.priority = parseEnum(args[++i], PRIORITIES, arg);
|
|
71
|
+
hasFilter = true;
|
|
72
|
+
break;
|
|
73
|
+
case "--source":
|
|
74
|
+
filters.source = parseEnum(args[++i], SOURCES, arg);
|
|
75
|
+
hasFilter = true;
|
|
76
|
+
break;
|
|
77
|
+
case "--from": {
|
|
78
|
+
const raw = args[++i];
|
|
79
|
+
if (!raw || raw.startsWith("-"))
|
|
80
|
+
fail(`Missing value for ${arg}`);
|
|
81
|
+
filters.fromMs = parseDateBound(raw, arg, "start");
|
|
82
|
+
hasFilter = true;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
case "--to": {
|
|
86
|
+
const raw = args[++i];
|
|
87
|
+
if (!raw || raw.startsWith("-"))
|
|
88
|
+
fail(`Missing value for ${arg}`);
|
|
89
|
+
filters.toMs = parseDateBound(raw, arg, "end");
|
|
90
|
+
hasFilter = true;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
case "--json":
|
|
94
|
+
json = true;
|
|
95
|
+
break;
|
|
96
|
+
case "--wait": {
|
|
97
|
+
const raw = args[++i];
|
|
98
|
+
const seconds = Number(raw);
|
|
99
|
+
if (!Number.isFinite(seconds) || seconds < 0) {
|
|
100
|
+
fail(`Invalid --wait value: ${raw} (expected non-negative number of seconds)`);
|
|
101
|
+
}
|
|
102
|
+
waitBudgetMs = seconds * 1000;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
case "--help":
|
|
106
|
+
case "-h":
|
|
107
|
+
printMemoryHelp();
|
|
108
|
+
return undefined;
|
|
109
|
+
default:
|
|
110
|
+
fail(`Unknown memory option: ${arg}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (filters.fromMs !== undefined && filters.toMs !== undefined && filters.fromMs > filters.toMs) {
|
|
114
|
+
fail("--from must not be after --to");
|
|
115
|
+
}
|
|
116
|
+
return { dbPath, json, filters, waitBudgetMs, queryMode: json || hasFilter };
|
|
117
|
+
}
|
|
118
|
+
function truncate(value, max) {
|
|
119
|
+
const collapsed = value.replace(/\s+/g, " ");
|
|
120
|
+
return collapsed.length <= max ? collapsed : `${collapsed.slice(0, max - 1)}…`;
|
|
121
|
+
}
|
|
122
|
+
export function formatMemoryTable(observations) {
|
|
123
|
+
if (observations.length === 0) {
|
|
124
|
+
return "No memories matched. Adjust the filters or run `duet memory --help`.";
|
|
125
|
+
}
|
|
126
|
+
const rows = observations.map((o) => ({
|
|
127
|
+
created: new Date(o.createdAt).toISOString().slice(0, 10),
|
|
128
|
+
kind: o.kind,
|
|
129
|
+
priority: o.priority,
|
|
130
|
+
source: o.source.kind,
|
|
131
|
+
score: o.score.toFixed(2),
|
|
132
|
+
content: truncate(o.content, 60),
|
|
133
|
+
id: o.id,
|
|
134
|
+
}));
|
|
135
|
+
const headers = {
|
|
136
|
+
created: "CREATED",
|
|
137
|
+
kind: "KIND",
|
|
138
|
+
priority: "PRIORITY",
|
|
139
|
+
source: "SOURCE",
|
|
140
|
+
score: "SCORE",
|
|
141
|
+
content: "CONTENT",
|
|
142
|
+
id: "MEMORY ID",
|
|
143
|
+
};
|
|
144
|
+
const width = (key, cap) => Math.min(cap, Math.max(headers[key].length, ...rows.map((row) => row[key].length)));
|
|
145
|
+
const w = {
|
|
146
|
+
created: width("created", 10),
|
|
147
|
+
kind: width("kind", 11),
|
|
148
|
+
priority: width("priority", 8),
|
|
149
|
+
source: width("source", 6),
|
|
150
|
+
score: width("score", 8),
|
|
151
|
+
content: width("content", 60),
|
|
152
|
+
id: width("id", 20),
|
|
153
|
+
};
|
|
154
|
+
const line = (cells) => [
|
|
155
|
+
cells.created.padEnd(w.created),
|
|
156
|
+
cells.kind.padEnd(w.kind),
|
|
157
|
+
cells.priority.padEnd(w.priority),
|
|
158
|
+
cells.source.padEnd(w.source),
|
|
159
|
+
cells.score.padStart(w.score),
|
|
160
|
+
truncate(cells.content, w.content).padEnd(w.content),
|
|
161
|
+
cells.id,
|
|
162
|
+
].join(" ");
|
|
163
|
+
return [line(headers), ...rows.map(line)].join("\n");
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Run the non-TUI query path of `duet memory`: fetch the filtered rows,
|
|
167
|
+
* compute each row's global-pack score, and print JSON or an aligned table.
|
|
168
|
+
*/
|
|
169
|
+
export async function runMemoryQuery(options, io = { stdout: process.stdout }) {
|
|
170
|
+
const observations = await withMemoryDb(options.dbPath, (db) => db.queryObservations(options.filters), { waitBudgetMs: options.waitBudgetMs });
|
|
171
|
+
// Score with a single `now` so every row's value is comparable.
|
|
172
|
+
const now = Date.now();
|
|
173
|
+
const scored = observations.map((o) => ({
|
|
174
|
+
...o,
|
|
175
|
+
score: scoreObservation(o, now),
|
|
176
|
+
}));
|
|
177
|
+
io.stdout.write(options.json ? `${JSON.stringify(scored, null, 2)}\n` : `${formatMemoryTable(scored)}\n`);
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=memory-query.js.map
|
|
@@ -0,0 +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,IAAI,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAQpD,MAAM,KAAK,GAAG,CAAC,aAAa,EAAE,YAAY,EAAE,QAAQ,CAA+C,CAAC;AACpG,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAmD,CAAC;AAE/F,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAA0C,CAAC;AAerF,oEAAoE;AACpE,SAAS,cAAc,CAAC,GAAW,EAAE,IAAY,EAAE,IAAqB;IACtE,IAAI,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACpC,MAAM,GAAG,GAAG,GAAG,GAAG,IAAI,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,GAAG,CAAC;QAC5E,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3B,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YAAE,IAAI,CAAC,WAAW,IAAI,UAAU,GAAG,EAAE,CAAC,CAAC;QAC3D,sEAAsE;QACtE,0EAA0E;QAC1E,oEAAoE;QACpE,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,GAAG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@@ -1,6 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Run `duet memory` (alias: `duet memories`)
|
|
3
|
-
*
|
|
2
|
+
* Run `duet memory` (alias: `duet memories`).
|
|
3
|
+
*
|
|
4
|
+
* One entry point for fetching and viewing durable memories: bare `duet
|
|
5
|
+
* memory` opens the interactive TUI for browsing/editing/deleting, while
|
|
6
|
+
* passing `--json` or any filter flag (`--type`/`--kind`/`--priority`/
|
|
7
|
+
* `--source`/`--from`/`--to`) turns the same invocation into a non-TUI,
|
|
8
|
+
* scriptable query. `duet memory reflect` remains a separate subcommand.
|
|
4
9
|
*
|
|
5
10
|
* Defaults to the same `~/.duet/memory.db` the runner writes to so changes
|
|
6
11
|
* propagate to the next session immediately.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../src/cli/memory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../src/cli/memory.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAwCpE"}
|