@vellumai/assistant 0.10.8-dev.202607111430.dcd3b7b → 0.10.8-dev.202607111622.3c66378
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/package.json +1 -1
- package/src/cli/commands/avatar.help.ts +1 -8
- package/src/cli/commands/avatar.ts +0 -8
- package/src/cli/commands/backup.help.ts +1 -8
- package/src/cli/commands/backup.ts +1 -3
- package/src/cli/commands/bash.help.ts +1 -8
- package/src/cli/commands/bash.ts +0 -4
- package/src/cli/commands/browser.help.ts +4 -7
- package/src/cli/commands/browser.ts +0 -4
- package/src/cli/commands/cache.help.ts +123 -0
- package/src/cli/commands/cache.ts +72 -166
- package/src/cli/commands/changelog.help.ts +59 -0
- package/src/cli/commands/changelog.ts +29 -61
- package/src/cli/commands/channel-verification-sessions.help.ts +178 -0
- package/src/cli/commands/channel-verification-sessions.ts +71 -226
- package/src/cli/commands/channels/index.help.ts +67 -0
- package/src/cli/commands/channels/index.ts +55 -105
- package/src/cli/commands/clients.help.ts +72 -0
- package/src/cli/commands/clients.ts +100 -153
- package/src/cli/commands/completions.help.ts +33 -0
- package/src/cli/commands/completions.ts +43 -66
- package/src/cli/commands/config.help.ts +126 -0
- package/src/cli/commands/config.ts +59 -174
- package/src/cli/commands/contacts.help.ts +327 -0
- package/src/cli/commands/contacts.ts +315 -587
- package/src/cli/index.help.ts +16 -0
- package/src/cli/lib/cli-command-help.ts +37 -3
- package/src/persistence/migrations/328-drop-memory-v3-learned-edge-tables.ts +16 -0
- package/src/persistence/schema/conversation-starters.ts +31 -0
- package/src/persistence/schema/index.ts +1 -0
- package/src/persistence/schema/memory-core.ts +0 -25
- package/src/persistence/steps.ts +2 -0
- package/src/plugins/defaults/memory/memory-db.ts +27 -0
- package/src/plugins/defaults/memory/v2/cli-command-content.ts +6 -1
- package/src/plugins/defaults/memory/v2/injection-events.ts +1 -18
- package/src/tools/registry.ts +2 -21
- package/src/tools/tool-manifest.ts +13 -0
package/package.json
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Declarative help for the `assistant avatar` command.
|
|
3
|
-
*
|
|
4
|
-
* Plain data (no action handlers, imports only the help contract type) so the
|
|
5
|
-
* memory capability indexer can read it without pulling in the daemon/IPC action
|
|
6
|
-
* graph. The handlers live in `avatar.ts`, which applies this via
|
|
7
|
-
* `applyCommandHelp` and attaches them.
|
|
8
|
-
*/
|
|
1
|
+
/** Declarative help for the `assistant avatar` command. */
|
|
9
2
|
|
|
10
3
|
import type { CliCommandHelp } from "../lib/cli-command-help.js";
|
|
11
4
|
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `assistant avatar` CLI namespace.
|
|
3
|
-
*
|
|
4
|
-
* The command's help structure lives in `avatar.help.ts` (import-safe for
|
|
5
|
-
* the memory capability indexer); this module applies it and attaches the
|
|
6
|
-
* action handlers.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
1
|
import { existsSync } from "node:fs";
|
|
10
2
|
import { homedir } from "node:os";
|
|
11
3
|
import { isAbsolute, join } from "node:path";
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Declarative help for the `assistant backup` command.
|
|
3
|
-
*
|
|
4
|
-
* Plain data (no action handlers, imports only the help contract type) so the
|
|
5
|
-
* memory capability indexer can read it without pulling in the daemon/IPC action
|
|
6
|
-
* graph. The handlers live in `backup.ts`, which applies this via
|
|
7
|
-
* `applyCommandHelp` and attaches them.
|
|
8
|
-
*/
|
|
1
|
+
/** Declarative help for the `assistant backup` command. */
|
|
9
2
|
|
|
10
3
|
import type { CliCommandHelp } from "../lib/cli-command-help.js";
|
|
11
4
|
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
* `assistant backup` — manage automated backup configuration and list snapshots.
|
|
3
3
|
*
|
|
4
4
|
* Thin IPC wrapper: each subcommand forwards its request to the daemon via
|
|
5
|
-
* cliIpcCall.
|
|
6
|
-
* (import-safe for the memory capability indexer); this module applies it and
|
|
7
|
-
* attaches the action handlers.
|
|
5
|
+
* cliIpcCall.
|
|
8
6
|
*/
|
|
9
7
|
|
|
10
8
|
import type { Command } from "commander";
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Declarative help for the `assistant bash` command.
|
|
3
|
-
*
|
|
4
|
-
* Plain data (no action handlers, imports only the help contract type) so the
|
|
5
|
-
* memory capability indexer can read it without pulling in the daemon/IPC action
|
|
6
|
-
* graph. The handler lives in `bash.ts`, which applies this via
|
|
7
|
-
* `applyCommandHelp` and attaches it.
|
|
8
|
-
*/
|
|
1
|
+
/** Declarative help for the `assistant bash` command. */
|
|
9
2
|
|
|
10
3
|
import type { CliCommandHelp } from "../lib/cli-command-help.js";
|
|
11
4
|
|
package/src/cli/commands/bash.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `assistant bash` — run a shell command in the assistant's process
|
|
3
3
|
* environment (debug tool, requires VELLUM_DEBUG=1 on the daemon).
|
|
4
|
-
*
|
|
5
|
-
* The command's help structure lives in `bash.help.ts` (import-safe for
|
|
6
|
-
* the memory capability indexer); this module applies it and attaches the
|
|
7
|
-
* action handler.
|
|
8
4
|
*/
|
|
9
5
|
|
|
10
6
|
import type { Command } from "commander";
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Declarative help for the `assistant browser` command.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* names, flags, and help text, so the derived help can never drift from the
|
|
9
|
-
* operations the daemon actually supports. The handlers live in `browser.ts`,
|
|
10
|
-
* which applies this via `applyCommandHelp` and attaches them.
|
|
4
|
+
* The per-operation subcommands are derived from {@link BROWSER_OPERATION_META}
|
|
5
|
+
* — the browser operations contract is the single source of truth for their
|
|
6
|
+
* names, flags, and help text, so the derived help cannot drift from the
|
|
7
|
+
* operations the daemon actually supports.
|
|
11
8
|
*/
|
|
12
9
|
|
|
13
10
|
// operation-meta is an execution-free data leaf (no Playwright imports),
|
|
@@ -5,10 +5,6 @@
|
|
|
5
5
|
* browser operations contract ({@link BROWSER_OPERATION_META}).
|
|
6
6
|
* Each subcommand maps CLI kebab-case flags into snake_case input
|
|
7
7
|
* keys and calls `browser_execute` over the CLI IPC socket.
|
|
8
|
-
*
|
|
9
|
-
* The command's help structure lives in `browser.help.ts` (import-safe for
|
|
10
|
-
* the memory capability indexer, derived from the same operations contract);
|
|
11
|
-
* this module applies it and attaches the action handlers.
|
|
12
8
|
*/
|
|
13
9
|
|
|
14
10
|
import { writeFileSync } from "node:fs";
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/** Declarative help for the `assistant cache` command. */
|
|
2
|
+
|
|
3
|
+
import type { CliCommandHelp } from "../lib/cli-command-help.js";
|
|
4
|
+
|
|
5
|
+
export const cacheHelp: CliCommandHelp = {
|
|
6
|
+
name: "cache",
|
|
7
|
+
description: "Interact with the assistant's in-memory key/value cache",
|
|
8
|
+
helpText: `
|
|
9
|
+
The cache is a TTL-aware, LRU-evicting in-memory store managed by the
|
|
10
|
+
running assistant. Data is scoped to the assistant process lifetime and
|
|
11
|
+
is not persisted across restarts.
|
|
12
|
+
|
|
13
|
+
Keys are opaque strings. If no key is provided on set, the assistant
|
|
14
|
+
generates one and returns it. Values can be any JSON-serializable data.
|
|
15
|
+
|
|
16
|
+
Examples:
|
|
17
|
+
$ assistant cache set --value '{"result": [1,2,3]}' --ttl 5m
|
|
18
|
+
$ assistant cache set --file /tmp/data.json --key my-key --ttl 1h
|
|
19
|
+
$ echo '{"result": [1,2,3]}' | assistant cache set --ttl 5m
|
|
20
|
+
$ assistant cache get my-key
|
|
21
|
+
$ assistant cache delete my-key`,
|
|
22
|
+
subcommands: [
|
|
23
|
+
{
|
|
24
|
+
name: "set",
|
|
25
|
+
description: "Store a JSON value in the cache",
|
|
26
|
+
options: [
|
|
27
|
+
{
|
|
28
|
+
flags: "--key <key>",
|
|
29
|
+
description:
|
|
30
|
+
"Cache key for idempotent upsert. Omit to auto-generate.",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
flags: "--ttl <duration>",
|
|
34
|
+
description:
|
|
35
|
+
"Time-to-live (minimum 1s). Units: ms, s, m, h (e.g. 1000ms, 30s, 5m, 2h). Defaults to 30m if omitted.",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
flags: "--value <json>",
|
|
39
|
+
description:
|
|
40
|
+
"JSON payload to store. Alternative to piping via stdin.",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
flags: "--file <path>",
|
|
44
|
+
description:
|
|
45
|
+
"Path to a file containing the JSON payload. Alternative to piping via stdin.",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
flags: "--json",
|
|
49
|
+
description: "Output result as machine-readable JSON.",
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
helpText: `
|
|
53
|
+
Stores a JSON payload in the cache and prints the assigned key. The payload
|
|
54
|
+
can be provided via --value, --file, or piped through stdin. If --key is
|
|
55
|
+
provided, the entry is upserted (created or replaced). If omitted, a new
|
|
56
|
+
unique key is generated.
|
|
57
|
+
|
|
58
|
+
Payloads exceeding 1 MB emit a warning to stderr but are still stored.
|
|
59
|
+
|
|
60
|
+
Input sources (mutually exclusive, checked in this order):
|
|
61
|
+
--value <json> Inline JSON string.
|
|
62
|
+
--file <path> Path to a JSON file.
|
|
63
|
+
(stdin) Piped input (fallback when neither flag is given).
|
|
64
|
+
|
|
65
|
+
Options:
|
|
66
|
+
--key <key> Cache key string. Omit to auto-generate a random hex key.
|
|
67
|
+
--ttl <duration> Expiry duration (minimum 1s). Units: ms, s, m, h.
|
|
68
|
+
Examples: 1000ms, 30s, 5m, 2h. Defaults to 30m if omitted.
|
|
69
|
+
--json Output as JSON: { "ok": true, "key": "..." }
|
|
70
|
+
|
|
71
|
+
Examples:
|
|
72
|
+
$ assistant cache set --value '{"scores":[98,85,72]}' --ttl 5m
|
|
73
|
+
$ assistant cache set --file /tmp/payload.json --key scores --ttl 10m
|
|
74
|
+
$ echo '{"scores":[98,85,72]}' | assistant cache set
|
|
75
|
+
$ echo '"simple string"' | assistant cache set --ttl 1h --json`,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "get",
|
|
79
|
+
args: "<key>",
|
|
80
|
+
description: "Retrieve a cached value by key",
|
|
81
|
+
options: [
|
|
82
|
+
{
|
|
83
|
+
flags: "--json",
|
|
84
|
+
description: "Output result as machine-readable JSON.",
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
helpText: `
|
|
88
|
+
Arguments:
|
|
89
|
+
key The cache key to look up. Run 'assistant cache set' to store a
|
|
90
|
+
value and receive its key.
|
|
91
|
+
|
|
92
|
+
Fetches the value associated with the given key. If the key does not
|
|
93
|
+
exist or has expired, reports not-found. In --json mode, a miss returns
|
|
94
|
+
{ "ok": true, "data": null }.
|
|
95
|
+
|
|
96
|
+
Examples:
|
|
97
|
+
$ assistant cache get my-key
|
|
98
|
+
$ assistant cache get my-key --json`,
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: "delete",
|
|
102
|
+
args: "<key>",
|
|
103
|
+
description: "Remove a cached entry by key",
|
|
104
|
+
options: [
|
|
105
|
+
{
|
|
106
|
+
flags: "--json",
|
|
107
|
+
description: "Output result as machine-readable JSON.",
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
helpText: `
|
|
111
|
+
Arguments:
|
|
112
|
+
key The cache key to remove. Run 'assistant cache get <key>' to
|
|
113
|
+
verify a key exists before deleting.
|
|
114
|
+
|
|
115
|
+
Removes the entry from the cache. Idempotent — exits 0 whether the key
|
|
116
|
+
existed or not, but reports whether an entry was actually removed.
|
|
117
|
+
|
|
118
|
+
Examples:
|
|
119
|
+
$ assistant cache delete my-key
|
|
120
|
+
$ assistant cache delete my-key --json`,
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
};
|
|
@@ -10,8 +10,10 @@ import type { Command } from "commander";
|
|
|
10
10
|
import { cliIpcCall } from "../../ipc/cli-client.js";
|
|
11
11
|
import { readStdinSync } from "../../util/read-stdin.js";
|
|
12
12
|
import { existsSync, readFileSync } from "../lib/cache-fs.js";
|
|
13
|
+
import { applyCommandHelp, subcommand } from "../lib/cli-command-help.js";
|
|
13
14
|
import { registerCommand } from "../lib/register-command.js";
|
|
14
15
|
import { log } from "../logger.js";
|
|
16
|
+
import { cacheHelp } from "./cache.help.js";
|
|
15
17
|
|
|
16
18
|
// ── Constants ─────────────────────────────────────────────────────────
|
|
17
19
|
|
|
@@ -170,169 +172,88 @@ function resolvePayload(opts: { value?: string; file?: string }): unknown {
|
|
|
170
172
|
|
|
171
173
|
export function registerCacheCommand(program: Command): void {
|
|
172
174
|
registerCommand(program, {
|
|
173
|
-
name:
|
|
175
|
+
name: cacheHelp.name,
|
|
174
176
|
transport: "ipc",
|
|
175
|
-
description:
|
|
177
|
+
description: cacheHelp.description,
|
|
176
178
|
build: (cache) => {
|
|
177
|
-
cache
|
|
178
|
-
"after",
|
|
179
|
-
`
|
|
180
|
-
The cache is a TTL-aware, LRU-evicting in-memory store managed by the
|
|
181
|
-
running assistant. Data is scoped to the assistant process lifetime and
|
|
182
|
-
is not persisted across restarts.
|
|
183
|
-
|
|
184
|
-
Keys are opaque strings. If no key is provided on set, the assistant
|
|
185
|
-
generates one and returns it. Values can be any JSON-serializable data.
|
|
186
|
-
|
|
187
|
-
Examples:
|
|
188
|
-
$ assistant cache set --value '{"result": [1,2,3]}' --ttl 5m
|
|
189
|
-
$ assistant cache set --file /tmp/data.json --key my-key --ttl 1h
|
|
190
|
-
$ echo '{"result": [1,2,3]}' | assistant cache set --ttl 5m
|
|
191
|
-
$ assistant cache get my-key
|
|
192
|
-
$ assistant cache delete my-key`,
|
|
193
|
-
);
|
|
179
|
+
applyCommandHelp(cache, cacheHelp);
|
|
194
180
|
|
|
195
181
|
// ── set ───────────────────────────────────────────────────────────
|
|
196
182
|
|
|
197
|
-
cache
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
.option("--json", "Output result as machine-readable JSON.")
|
|
217
|
-
.addHelpText(
|
|
218
|
-
"after",
|
|
219
|
-
`
|
|
220
|
-
Stores a JSON payload in the cache and prints the assigned key. The payload
|
|
221
|
-
can be provided via --value, --file, or piped through stdin. If --key is
|
|
222
|
-
provided, the entry is upserted (created or replaced). If omitted, a new
|
|
223
|
-
unique key is generated.
|
|
224
|
-
|
|
225
|
-
Payloads exceeding 1 MB emit a warning to stderr but are still stored.
|
|
226
|
-
|
|
227
|
-
Input sources (mutually exclusive, checked in this order):
|
|
228
|
-
--value <json> Inline JSON string.
|
|
229
|
-
--file <path> Path to a JSON file.
|
|
230
|
-
(stdin) Piped input (fallback when neither flag is given).
|
|
231
|
-
|
|
232
|
-
Options:
|
|
233
|
-
--key <key> Cache key string. Omit to auto-generate a random hex key.
|
|
234
|
-
--ttl <duration> Expiry duration (minimum 1s). Units: ms, s, m, h.
|
|
235
|
-
Examples: 1000ms, 30s, 5m, 2h. Defaults to 30m if omitted.
|
|
236
|
-
--json Output as JSON: { "ok": true, "key": "..." }
|
|
237
|
-
|
|
238
|
-
Examples:
|
|
239
|
-
$ assistant cache set --value '{"scores":[98,85,72]}' --ttl 5m
|
|
240
|
-
$ assistant cache set --file /tmp/payload.json --key scores --ttl 10m
|
|
241
|
-
$ echo '{"scores":[98,85,72]}' | assistant cache set
|
|
242
|
-
$ echo '"simple string"' | assistant cache set --ttl 1h --json`,
|
|
243
|
-
)
|
|
244
|
-
.action(
|
|
245
|
-
async (opts: {
|
|
246
|
-
key?: string;
|
|
247
|
-
ttl?: string;
|
|
248
|
-
value?: string;
|
|
249
|
-
file?: string;
|
|
250
|
-
json?: boolean;
|
|
251
|
-
}) => {
|
|
252
|
-
let data: unknown;
|
|
253
|
-
try {
|
|
254
|
-
data = resolvePayload(opts);
|
|
255
|
-
} catch (err) {
|
|
256
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
257
|
-
if (opts.json) {
|
|
258
|
-
process.stdout.write(
|
|
259
|
-
JSON.stringify({ ok: false, error: msg }) + "\n",
|
|
260
|
-
);
|
|
261
|
-
} else {
|
|
262
|
-
log.error(msg);
|
|
263
|
-
}
|
|
264
|
-
process.exitCode = 1;
|
|
265
|
-
return;
|
|
183
|
+
subcommand(cache, "set").action(
|
|
184
|
+
async (opts: {
|
|
185
|
+
key?: string;
|
|
186
|
+
ttl?: string;
|
|
187
|
+
value?: string;
|
|
188
|
+
file?: string;
|
|
189
|
+
json?: boolean;
|
|
190
|
+
}) => {
|
|
191
|
+
let data: unknown;
|
|
192
|
+
try {
|
|
193
|
+
data = resolvePayload(opts);
|
|
194
|
+
} catch (err) {
|
|
195
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
196
|
+
if (opts.json) {
|
|
197
|
+
process.stdout.write(
|
|
198
|
+
JSON.stringify({ ok: false, error: msg }) + "\n",
|
|
199
|
+
);
|
|
200
|
+
} else {
|
|
201
|
+
log.error(msg);
|
|
266
202
|
}
|
|
203
|
+
process.exitCode = 1;
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
267
206
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
}
|
|
280
|
-
process.exitCode = 1;
|
|
281
|
-
return;
|
|
207
|
+
let ttl_ms: number | undefined;
|
|
208
|
+
try {
|
|
209
|
+
ttl_ms = parseTtl(opts.ttl);
|
|
210
|
+
} catch (err) {
|
|
211
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
212
|
+
if (opts.json) {
|
|
213
|
+
process.stdout.write(
|
|
214
|
+
JSON.stringify({ ok: false, error: msg }) + "\n",
|
|
215
|
+
);
|
|
216
|
+
} else {
|
|
217
|
+
log.error(msg);
|
|
282
218
|
}
|
|
219
|
+
process.exitCode = 1;
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
283
222
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
const result = await cliIpcCall<{ key: string }>("cache_set", {
|
|
289
|
-
body: params,
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
if (!result.ok) {
|
|
293
|
-
if (opts.json) {
|
|
294
|
-
process.stdout.write(
|
|
295
|
-
JSON.stringify({ ok: false, error: result.error }) + "\n",
|
|
296
|
-
);
|
|
297
|
-
} else {
|
|
298
|
-
log.error(`Error: ${result.error}`);
|
|
299
|
-
}
|
|
300
|
-
process.exitCode = 1;
|
|
301
|
-
return;
|
|
302
|
-
}
|
|
223
|
+
const params: Record<string, unknown> = { data };
|
|
224
|
+
if (ttl_ms !== undefined) params.ttl_ms = ttl_ms;
|
|
225
|
+
if (opts.key) params.key = opts.key;
|
|
303
226
|
|
|
227
|
+
const result = await cliIpcCall<{ key: string }>("cache_set", {
|
|
228
|
+
body: params,
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
if (!result.ok) {
|
|
304
232
|
if (opts.json) {
|
|
305
233
|
process.stdout.write(
|
|
306
|
-
JSON.stringify({ ok:
|
|
234
|
+
JSON.stringify({ ok: false, error: result.error }) + "\n",
|
|
307
235
|
);
|
|
308
236
|
} else {
|
|
309
|
-
log.
|
|
237
|
+
log.error(`Error: ${result.error}`);
|
|
310
238
|
}
|
|
311
|
-
|
|
312
|
-
|
|
239
|
+
process.exitCode = 1;
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (opts.json) {
|
|
244
|
+
process.stdout.write(
|
|
245
|
+
JSON.stringify({ ok: true, key: result.result!.key }) + "\n",
|
|
246
|
+
);
|
|
247
|
+
} else {
|
|
248
|
+
log.info(`Cached with key: ${result.result!.key}`);
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
);
|
|
313
252
|
|
|
314
253
|
// ── get ───────────────────────────────────────────────────────────
|
|
315
254
|
|
|
316
|
-
cache
|
|
317
|
-
|
|
318
|
-
.description("Retrieve a cached value by key")
|
|
319
|
-
.option("--json", "Output result as machine-readable JSON.")
|
|
320
|
-
.addHelpText(
|
|
321
|
-
"after",
|
|
322
|
-
`
|
|
323
|
-
Arguments:
|
|
324
|
-
key The cache key to look up. Run 'assistant cache set' to store a
|
|
325
|
-
value and receive its key.
|
|
326
|
-
|
|
327
|
-
Fetches the value associated with the given key. If the key does not
|
|
328
|
-
exist or has expired, reports not-found. In --json mode, a miss returns
|
|
329
|
-
{ "ok": true, "data": null }.
|
|
330
|
-
|
|
331
|
-
Examples:
|
|
332
|
-
$ assistant cache get my-key
|
|
333
|
-
$ assistant cache get my-key --json`,
|
|
334
|
-
)
|
|
335
|
-
.action(async (key: string, opts: { json?: boolean }) => {
|
|
255
|
+
subcommand(cache, "get").action(
|
|
256
|
+
async (key: string, opts: { json?: boolean }) => {
|
|
336
257
|
const result = await cliIpcCall<{ data: unknown } | null>(
|
|
337
258
|
"cache_get",
|
|
338
259
|
{
|
|
@@ -366,29 +287,13 @@ Examples:
|
|
|
366
287
|
log.info(JSON.stringify(result.result.data, null, 2));
|
|
367
288
|
}
|
|
368
289
|
}
|
|
369
|
-
}
|
|
290
|
+
},
|
|
291
|
+
);
|
|
370
292
|
|
|
371
293
|
// ── delete ────────────────────────────────────────────────────────
|
|
372
294
|
|
|
373
|
-
cache
|
|
374
|
-
|
|
375
|
-
.description("Remove a cached entry by key")
|
|
376
|
-
.option("--json", "Output result as machine-readable JSON.")
|
|
377
|
-
.addHelpText(
|
|
378
|
-
"after",
|
|
379
|
-
`
|
|
380
|
-
Arguments:
|
|
381
|
-
key The cache key to remove. Run 'assistant cache get <key>' to
|
|
382
|
-
verify a key exists before deleting.
|
|
383
|
-
|
|
384
|
-
Removes the entry from the cache. Idempotent — exits 0 whether the key
|
|
385
|
-
existed or not, but reports whether an entry was actually removed.
|
|
386
|
-
|
|
387
|
-
Examples:
|
|
388
|
-
$ assistant cache delete my-key
|
|
389
|
-
$ assistant cache delete my-key --json`,
|
|
390
|
-
)
|
|
391
|
-
.action(async (key: string, opts: { json?: boolean }) => {
|
|
295
|
+
subcommand(cache, "delete").action(
|
|
296
|
+
async (key: string, opts: { json?: boolean }) => {
|
|
392
297
|
const result = await cliIpcCall<{ deleted: boolean }>(
|
|
393
298
|
"cache_delete",
|
|
394
299
|
{
|
|
@@ -419,7 +324,8 @@ Examples:
|
|
|
419
324
|
log.info(`No cache entry "${key}" (nothing to delete).`);
|
|
420
325
|
}
|
|
421
326
|
}
|
|
422
|
-
}
|
|
327
|
+
},
|
|
328
|
+
);
|
|
423
329
|
},
|
|
424
330
|
});
|
|
425
331
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** Declarative help for the `assistant changelog` command. */
|
|
2
|
+
|
|
3
|
+
import type { CliCommandHelp } from "../lib/cli-command-help.js";
|
|
4
|
+
|
|
5
|
+
// Shared config surfaced in the help text; `changelog.ts` imports these for
|
|
6
|
+
// the fetch/cache behavior so the prose can never drift from the code.
|
|
7
|
+
export const REPO = "vellum-ai/vellum-assistant";
|
|
8
|
+
export const LIST_TTL_MS = 60 * 60 * 1000;
|
|
9
|
+
export const DEFAULT_LIST_LIMIT = 30;
|
|
10
|
+
/**
|
|
11
|
+
* Maximum number of stable releases we persist in the rolling `recent` slot.
|
|
12
|
+
* Most callers only ever read the latest one or two; capping the cache keeps
|
|
13
|
+
* the file small and the network round-trip predictable.
|
|
14
|
+
*/
|
|
15
|
+
export const CACHE_STABLE_LIMIT = 5;
|
|
16
|
+
|
|
17
|
+
export const changelogHelp: CliCommandHelp = {
|
|
18
|
+
name: "changelog",
|
|
19
|
+
description:
|
|
20
|
+
"Show release notes of the Vellum Assistant to see what new capabilities you have!",
|
|
21
|
+
options: [
|
|
22
|
+
{
|
|
23
|
+
flags: "--since <version>",
|
|
24
|
+
description:
|
|
25
|
+
"Show notes for every stable release newer than this version (e.g. 0.7.0)",
|
|
26
|
+
},
|
|
27
|
+
{ flags: "--no-cache", description: "Bypass the local cache" },
|
|
28
|
+
{ flags: "--json", description: "Output structured JSON" },
|
|
29
|
+
{
|
|
30
|
+
flags: "--limit <n>",
|
|
31
|
+
description: "Max releases to consider when listing or filtering (1-100)",
|
|
32
|
+
defaultValue: String(DEFAULT_LIST_LIMIT),
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
helpText: `
|
|
36
|
+
Release notes are fetched on demand from the public GitHub Releases of
|
|
37
|
+
${REPO}. The most recent ${CACHE_STABLE_LIMIT} stable releases are cached
|
|
38
|
+
locally for ${LIST_TTL_MS / 60_000} minutes; pass --no-cache to bypass.
|
|
39
|
+
Specific tags are cached indefinitely once seen because release tags are
|
|
40
|
+
immutable.
|
|
41
|
+
|
|
42
|
+
Examples:
|
|
43
|
+
$ assistant changelog Show the latest release
|
|
44
|
+
$ assistant changelog --since 0.7.0 Show every release since 0.7.0
|
|
45
|
+
$ assistant changelog show 0.8.0 Show a specific release
|
|
46
|
+
$ assistant changelog list List recent release tags
|
|
47
|
+
$ assistant changelog --json JSON output for tooling`,
|
|
48
|
+
subcommands: [
|
|
49
|
+
{
|
|
50
|
+
name: "show",
|
|
51
|
+
args: "<version>",
|
|
52
|
+
description: "Show release notes for a specific version tag",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "list",
|
|
56
|
+
description: "List recent release tags",
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
};
|