@dreamlake/dreamlake-cli 0.112.1 → 0.114.0
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/api/memo-facade.d.ts +7 -0
- package/dist/api/memo-facade.js +2 -0
- package/dist/api/memos.d.ts +3 -0
- package/dist/api/memos.js +15 -0
- package/dist/api/sessions.d.ts +11 -0
- package/dist/cli/help-examples.generated.js +3 -0
- package/dist/cli/memos/cover-command.d.ts +9 -0
- package/dist/cli/memos/cover-command.js +81 -0
- package/dist/cli/memos/index.js +4 -0
- package/dist/cli/memos/revise.d.ts +22 -0
- package/dist/cli/memos/revise.js +154 -0
- package/dist/cli/sessions/api.d.ts +4 -0
- package/dist/cli/sessions/control.js +2 -2
- package/dist/cli/sessions/index.js +21 -9
- package/dist/cli/sessions/live.js +2 -2
- package/dist/cli/version.d.ts +1 -1
- package/dist/cli/version.js +1 -1
- package/package.json +9 -9
|
@@ -175,6 +175,13 @@ export interface MemoHandle {
|
|
|
175
175
|
readonly namespace: string | undefined;
|
|
176
176
|
/** The id or slug the handle was opened with. */
|
|
177
177
|
readonly note: string;
|
|
178
|
+
metadata(): Promise<MemoRow & {
|
|
179
|
+
namespaceSlug: string;
|
|
180
|
+
permissions: Record<string, boolean>;
|
|
181
|
+
}>;
|
|
182
|
+
setCover(input: {
|
|
183
|
+
fileId: string | null;
|
|
184
|
+
}): Promise<MemoRow>;
|
|
178
185
|
read(options: MemoReadOptions & {
|
|
179
186
|
lines: [number, number];
|
|
180
187
|
}): Promise<MemoFocusedRead>;
|
package/dist/api/memo-facade.js
CHANGED
|
@@ -186,6 +186,8 @@ export function memoHandle(t, ref, context = {}) {
|
|
|
186
186
|
ref, note: parsed.note,
|
|
187
187
|
get namespace() { return namespace; },
|
|
188
188
|
read: read,
|
|
189
|
+
metadata: () => guarded(async (api) => api.get(await id(api))),
|
|
190
|
+
setCover: ({ fileId }) => guarded(async (api) => api.setCover(await id(api), fileId), "write"),
|
|
189
191
|
async append(input) {
|
|
190
192
|
const mode = modeOf(input.mode, "merge");
|
|
191
193
|
if (typeof input.text !== "string")
|
package/dist/api/memos.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export interface MemoSearchPage {
|
|
|
37
37
|
staleNotes: number;
|
|
38
38
|
}
|
|
39
39
|
export interface MemoRow {
|
|
40
|
+
coverFileId?: string | null;
|
|
40
41
|
id: string;
|
|
41
42
|
name: string;
|
|
42
43
|
slug: string;
|
|
@@ -143,6 +144,8 @@ export declare function memosApi(t: Transport, namespace: string): {
|
|
|
143
144
|
namespaceSlug: string;
|
|
144
145
|
permissions: Record<string, boolean>;
|
|
145
146
|
}>;
|
|
147
|
+
/** Metadata only: an image attachment ID sets the cover; null clears it. */
|
|
148
|
+
setCover: (noteId: string, coverFileId: string | null) => Promise<MemoRow>;
|
|
146
149
|
/** Archive independently of delete/tags. A saved edit restores the note and its folder path. */
|
|
147
150
|
archive: (noteId: string) => Promise<MemoRow>;
|
|
148
151
|
unarchive: (noteId: string) => Promise<MemoRow>;
|
package/dist/api/memos.js
CHANGED
|
@@ -116,6 +116,21 @@ export function memosApi(t, namespace) {
|
|
|
116
116
|
};
|
|
117
117
|
},
|
|
118
118
|
get: (noteId) => t.request("GET", `/notes/${id(noteId)}`),
|
|
119
|
+
/** Metadata only: an image attachment ID sets the cover; null clears it. */
|
|
120
|
+
setCover: async (noteId, coverFileId) => {
|
|
121
|
+
id(noteId);
|
|
122
|
+
if (coverFileId !== null && (typeof coverFileId !== "string" || !isObjectId(coverFileId)))
|
|
123
|
+
throw new TypeError("coverFileId must be a 24-hex attachment ID or null");
|
|
124
|
+
const current = await api.get(noteId);
|
|
125
|
+
if (current.id !== noteId || current.namespaceSlug !== namespace)
|
|
126
|
+
throw new ApiError(404, "memo_owner_changed", {});
|
|
127
|
+
if (current.permissions?.rename !== true)
|
|
128
|
+
throw new ApiError(403, "forbidden", {});
|
|
129
|
+
const row = await t.request("PATCH", `${base}/${noteId}`, { json: { coverFileId }, redirect: "error" });
|
|
130
|
+
if (row?.id !== noteId || row.namespaceSlug !== namespace || row.coverFileId !== coverFileId)
|
|
131
|
+
throw new Error("Cover update unconfirmed; read memo metadata before retrying");
|
|
132
|
+
return row;
|
|
133
|
+
},
|
|
119
134
|
/** Archive independently of delete/tags. A saved edit restores the note and its folder path. */
|
|
120
135
|
archive: (noteId) => t.request("PATCH", `${base}/${id(noteId)}`, { json: { archived: true } }),
|
|
121
136
|
unarchive: (noteId) => t.request("PATCH", `${base}/${id(noteId)}`, { json: { archived: false } }),
|
package/dist/api/sessions.d.ts
CHANGED
|
@@ -181,6 +181,16 @@ export interface Session {
|
|
|
181
181
|
vendorSessionId?: string;
|
|
182
182
|
runState: RunState;
|
|
183
183
|
runStateObservedAt: string | null;
|
|
184
|
+
/** Last observed state and outstanding attention remain available when runState becomes stale. */
|
|
185
|
+
lastRunState?: RunState | null;
|
|
186
|
+
attention?: "needs_input" | "error" | null;
|
|
187
|
+
metadataObservedAt?: string | null;
|
|
188
|
+
targetId?: string | null;
|
|
189
|
+
enrollmentId?: string | null;
|
|
190
|
+
hostId?: string | null;
|
|
191
|
+
machineId?: string | null;
|
|
192
|
+
username?: string | null;
|
|
193
|
+
tmuxSession?: string | null;
|
|
184
194
|
lastActivityAt: string | null;
|
|
185
195
|
createdAt: string;
|
|
186
196
|
repositoryRoot: string | null;
|
|
@@ -228,6 +238,7 @@ export type ListSessionsQuery = {
|
|
|
228
238
|
pageSize?: number;
|
|
229
239
|
cursor?: string;
|
|
230
240
|
q?: string;
|
|
241
|
+
searchIn?: "title" | "all";
|
|
231
242
|
provider?: Provider | "dreamlake-agent";
|
|
232
243
|
sort?: "created" | "recent";
|
|
233
244
|
archived?: "exclude" | "include" | "only";
|
|
@@ -117,11 +117,13 @@ export const helpExamples = {
|
|
|
117
117
|
"memos files status": "# OPERATION_ID is the ID from the original response.\ndl memos files status \"$OPERATION_ID\" --note \"$MEMO_ID\" --json",
|
|
118
118
|
"memos files reconcile": "dl memos files reconcile \"$OPERATION_ID\" --note \"$MEMO_ID\" --json",
|
|
119
119
|
"memos files cancel": "dl memos files cancel \"$OPERATION_ID\" --note \"$MEMO_ID\" --json",
|
|
120
|
+
"memos cover": "# Upload or replace the header image; inspect the current attachment ID.\ndl memos cover \"$MEMO_ID\" --namespace team --file ./cover.png\ndl memos cover \"$MEMO_ID\" --namespace team --json\n# Select an existing image attachment, or clear the header while retaining it.\ndl memos cover \"$MEMO_ID\" --namespace team --file-id \"$FILE_ID\"\ndl memos cover \"$MEMO_ID\" --namespace team --remove",
|
|
120
121
|
"memos visit": "# Reuse the task's DREAMLAKE_AGENT_ID and DREAMLAKE_AGENT_NAME.\nMEMO_ID=release-plan\ndl memos visit \"$MEMO_ID\"",
|
|
121
122
|
"memos presence": "# Read the participant roster without joining. Text is the default.\nMEMO_ID=release-plan\ndl memos presence \"$MEMO_ID\"\n# Include a source-bound human selection snapshot.\ndl memos presence \"$MEMO_ID\" --selections",
|
|
122
123
|
"memos select": "export DREAMLAKE_AGENT_ID=\"review-session-42\"\nexport DREAMLAKE_AGENT_NAME=\"Codex\"\nMEMO_ID=\"your-note-id\"\ndl memos select --text \"The next step is tested in simulation.\" --note \"$MEMO_ID\"\n# Select the last occurrence of a repeated passage.\ndl memos select --text \"simulation\" --note \"$MEMO_ID\" -o -1",
|
|
123
124
|
"memos contributors": "dl memos contributors release-plan --namespace geyang --json\n# If hasMore is true, continue with the returned nextCursor:\ndl memos contributors release-plan --namespace geyang --cursor LINK_CURSOR --json",
|
|
124
125
|
"memos rm": "# Read it first and confirm it is the note you mean.\ndl memos read MEMO_ID\n# Asks for confirmation, showing the title and owning namespace.\ndl memos rm MEMO_ID\n# Scripts and agents: skip the prompt and take a JSON receipt.\ndl memos rm MEMO_ID --yes --json\n# Afterwards a read reports not found.\ndl memos read MEMO_ID",
|
|
126
|
+
"memos revise": "dl memos read MEMO_ID --json > baseline.json\n# Review baseline.json and prepare proposed.md from its exact content.\ndl memos revise MEMO_ID --baseline baseline.json --file proposed.md \\\n --intent \"Clarify the proposed evaluation criteria.\" --label evaluation-criteria \\\n --receipt revision-receipt.json",
|
|
125
127
|
"memos patch": "set -euo pipefail\ndl memos create \"Patch tutorial\" --text 'Hello world.' > created.txt\nMEMO_ID=$(sed -n 's/^ id //p' created.txt)\ndl memos read \"$MEMO_ID\" --view source --json > baseline.json\n# A plain text read is the mapped reading view and --view source is bytes only;\n# --json is the structured snapshot with note, hash and revision.\nBASE=$(jq -er .revision baseline.json)\ndl memos patch \"$MEMO_ID\" --file - --base-revision \"$BASE\" --json > receipt.json <<'PATCH'\n@@ chars 0:12 @@\n~ Hello [-world-]{+team+}.\nPATCH\nACK=$(jq -er .revision receipt.json)\ndl memos read \"$MEMO_ID\" --if-match \"$ACK\"\n# Expect Hello team. Inspect the result; do not repeat a successful patch.",
|
|
126
128
|
"memos append": "dl memos append \"$MEMO_ID\" --file addition.md --base-revision \"$BASE\" --json\n# ACK is the revision in the successful append receipt.\ndl memos read \"$MEMO_ID\" --at \"$ACK\"",
|
|
127
129
|
"memos insert": "dl memos insert --note \"$MEMO_ID\" --ind 0 --text 'Review: ' \\\n --base-revision \"$BASE\" --json\n# ACK is the revision returned by the insertion receipt.\ndl memos read \"$MEMO_ID\" --at \"$ACK\"",
|
|
@@ -219,6 +221,7 @@ export const helpExamples = {
|
|
|
219
221
|
"sessions stop": "dl sessions stop SESSION_ID --namespace geyang --yes --json",
|
|
220
222
|
"sessions sync": "dl sessions sync --namespace geyang --target TARGET_ID --json\ndl sessions sync --namespace geyang --all --json",
|
|
221
223
|
"sessions upload-conversation": "dl sessions upload-conversation SESSION_ID --namespace geyang \\\n --file /absolute/path/to/conversation.jsonl --json",
|
|
224
|
+
"sessions search": "dl sess search \"tmux\"\ndl session search \"release\" --machine MACHINE_ID --sort recent\ndl sess search \"release\" --search-in title\ndl sessions search \"RTC\" --owner geyang --page-size 25 --json",
|
|
222
225
|
"sessions serve": "dl sessions serve\n# Handle one command and exit (useful in scripts and tests):\ndl sessions serve --once --json\n# Let a person raise sessions on this runner up to full access (control restart --raise):\ndl sessions serve --max-human-permission full-access",
|
|
223
226
|
"sessions runners": "dl sessions runners",
|
|
224
227
|
"sessions control start": "dl sessions control start --provider claude --repo /abs/repo --isolation worktree --branch feat/x --permission workspace-write --prompt \"Run the tests and report\" --name \"Test runner\"\n# Reuse the checkout as is, headless:\ndl sessions control start --provider codex --repo /abs/repo --isolation repo --permission read-only --mode headless --prompt \"Summarize open TODOs\"",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import { type ConnOpts } from './index.js';
|
|
3
|
+
export declare function runMemosCover(ref: string, opts: ConnOpts & {
|
|
4
|
+
file?: string;
|
|
5
|
+
fileId?: string;
|
|
6
|
+
remove?: boolean;
|
|
7
|
+
json?: boolean;
|
|
8
|
+
}): Promise<number>;
|
|
9
|
+
export declare function registerCoverCommand(memos: Command): void;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { createReadStream, statSync } from 'node:fs';
|
|
2
|
+
import { extname } from 'node:path';
|
|
3
|
+
import { randomUUID } from 'node:crypto';
|
|
4
|
+
import { memoHandle } from '../../api/memo-facade.js';
|
|
5
|
+
import { resolveCtx } from '../compat/ctx.js';
|
|
6
|
+
import { requireToken } from '../compat/http.js';
|
|
7
|
+
import { withConnFlags } from '../compat/flags.js';
|
|
8
|
+
import { emitJson, fail } from '../helpers.js';
|
|
9
|
+
import { requestJson } from '../client.js';
|
|
10
|
+
import { memoTransport } from './api-transport.js';
|
|
11
|
+
import { ctx, resolveNote } from './index.js';
|
|
12
|
+
const mime = { '.png': 'image/png', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.gif': 'image/gif', '.webp': 'image/webp', '.avif': 'image/avif', '.svg': 'image/svg+xml' };
|
|
13
|
+
export async function runMemosCover(ref, opts) {
|
|
14
|
+
if ([opts.file !== undefined, opts.fileId !== undefined, opts.remove === true].filter(Boolean).length > 1) {
|
|
15
|
+
fail('Choose only --file, --file-id or --remove');
|
|
16
|
+
return 1;
|
|
17
|
+
}
|
|
18
|
+
const c = resolveCtx(opts), token = requireToken(c);
|
|
19
|
+
if (!token)
|
|
20
|
+
return 1;
|
|
21
|
+
let uploadedId;
|
|
22
|
+
try {
|
|
23
|
+
let target = ref, namespace = opts.namespace?.trim().replace(/^@/, '') || undefined;
|
|
24
|
+
if (!/^[a-f0-9]{24}$/i.test(ref) && !ref.includes('/')) {
|
|
25
|
+
const scope = await ctx(opts);
|
|
26
|
+
if (!scope)
|
|
27
|
+
return 1;
|
|
28
|
+
const id = await resolveNote(scope, ref);
|
|
29
|
+
if (!id)
|
|
30
|
+
return 1;
|
|
31
|
+
target = id;
|
|
32
|
+
namespace = scope.ns;
|
|
33
|
+
}
|
|
34
|
+
const memo = memoHandle(memoTransport({ remote: c.remote, token }), target, { namespace });
|
|
35
|
+
const current = await memo.metadata();
|
|
36
|
+
if (memo.namespace !== current.namespaceSlug)
|
|
37
|
+
throw new Error('Memo owner changed; reopen it before updating the cover');
|
|
38
|
+
let fileId = opts.remove ? null : opts.fileId;
|
|
39
|
+
if (opts.file !== undefined) {
|
|
40
|
+
if (current.permissions?.rename !== true)
|
|
41
|
+
throw new Error('Not allowed to manage this memo');
|
|
42
|
+
const ext = extname(opts.file).toLowerCase(), contentType = mime[ext];
|
|
43
|
+
if (!contentType)
|
|
44
|
+
throw new Error('Choose a PNG, JPEG, GIF, WebP, AVIF or SVG image');
|
|
45
|
+
const stat = statSync(opts.file);
|
|
46
|
+
if (!stat.isFile())
|
|
47
|
+
throw new Error('--file must name a regular image file');
|
|
48
|
+
const bun = globalThis.Bun;
|
|
49
|
+
const bytes = bun ? bun.file(opts.file).stream() : createReadStream(opts.file);
|
|
50
|
+
const query = new URLSearchParams({ path: `covers/${randomUUID()}${ext}`, contentType });
|
|
51
|
+
const uploaded = await requestJson(c.remote, `/namespaces/${encodeURIComponent(current.namespaceSlug)}/notes/${current.id}/files/content?${query}`, {
|
|
52
|
+
method: 'PUT', token, body: bytes, redirect: 'error', headers: { 'Content-Type': contentType, ...(bun ? {} : { 'Content-Length': String(stat.size) }) },
|
|
53
|
+
});
|
|
54
|
+
if (!/^[a-f0-9]{24}$/i.test(uploaded?.id))
|
|
55
|
+
throw new Error('Upload unconfirmed; inspect memo files before retrying');
|
|
56
|
+
fileId = uploadedId = uploaded.id;
|
|
57
|
+
}
|
|
58
|
+
const row = fileId === undefined ? current : await memo.setCover({ fileId });
|
|
59
|
+
const result = { id: row.id, namespace: current.namespaceSlug, coverFileId: row.coverFileId ?? null };
|
|
60
|
+
if (opts.json)
|
|
61
|
+
emitJson(result);
|
|
62
|
+
else
|
|
63
|
+
process.stdout.write(`${result.coverFileId ?? 'No cover'}\n`);
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
fail(`${error instanceof Error ? error.message : String(error)}${uploadedId ? ` (uploaded attachment ${uploadedId} retained; inspect metadata before retrying)` : ''}`);
|
|
68
|
+
return 1;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export function registerCoverCommand(memos) {
|
|
72
|
+
withConnFlags(memos.command('cover').alias('title-image').allowExcessArguments(false))
|
|
73
|
+
.description('inspect, upload, replace or remove a memo cover image without changing its body')
|
|
74
|
+
.argument('<memo>', 'memo ID, qualified reference, slug or exact title')
|
|
75
|
+
.option('--namespace <slug>', 'lookup namespace; with an ID, asserts the owner')
|
|
76
|
+
.option('--file <path>', 'upload a new image attachment and set it as the cover')
|
|
77
|
+
.option('--file-id <id>', 'use an existing image attachment from this memo')
|
|
78
|
+
.option('--remove', 'remove the cover; keep its attachment')
|
|
79
|
+
.option('--json', 'emit cover metadata')
|
|
80
|
+
.action(async (memo, opts) => { process.exitCode = await runMemosCover(memo, opts); });
|
|
81
|
+
}
|
package/dist/cli/memos/index.js
CHANGED
|
@@ -4,9 +4,11 @@ import { collectionList } from "../collection-list.js";
|
|
|
4
4
|
import { registerVersionCommands, runSavedVersionRead } from "./version-commands.js";
|
|
5
5
|
import { registerMoveCommand } from "./move-command.js";
|
|
6
6
|
import { registerTransferCommand } from "./transfer-command.js";
|
|
7
|
+
import { registerCoverCommand } from "./cover-command.js";
|
|
7
8
|
import { registerPermalinkCommand } from "./permalink-command.js";
|
|
8
9
|
import { registerArchiveCommands } from "./archive-command.js";
|
|
9
10
|
import { registerRmCommand } from "./rm-command.js";
|
|
11
|
+
import { registerReviseCommand } from "./revise.js";
|
|
10
12
|
import { registerSuggestDiffCommand } from "./suggest-diff.js";
|
|
11
13
|
import { registerShareCommands } from "../share.js";
|
|
12
14
|
import { runMemosTextSelect } from "./select-command.js";
|
|
@@ -203,7 +205,9 @@ export function registerMemosCommand(program) {
|
|
|
203
205
|
registerRmCommand(notes);
|
|
204
206
|
registerArchiveCommands(notes);
|
|
205
207
|
registerPermalinkCommand(notes);
|
|
208
|
+
registerCoverCommand(notes);
|
|
206
209
|
registerSuggestDiffCommand(notes);
|
|
210
|
+
registerReviseCommand(notes);
|
|
207
211
|
// Same connection flags as the other ported groups, so --debug/--remote
|
|
208
212
|
// behave identically across the CLI.
|
|
209
213
|
const strict = (cmd) => withConnFlags(cmd.allowExcessArguments(false));
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import { type ConnOpts } from './index.js';
|
|
3
|
+
import type { MemoSource } from '../../api/memo-edits.js';
|
|
4
|
+
export interface ReviseOptions extends ConnOpts {
|
|
5
|
+
baseline: string;
|
|
6
|
+
file: string;
|
|
7
|
+
label: string;
|
|
8
|
+
intent: string;
|
|
9
|
+
receipt: string;
|
|
10
|
+
direct?: boolean;
|
|
11
|
+
allowReferenceChanges?: boolean;
|
|
12
|
+
dryRun?: boolean;
|
|
13
|
+
json?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function resourceAtoms(text: string): string[];
|
|
16
|
+
export declare function revisionBody(source: MemoSource, draft: string, options: {
|
|
17
|
+
direct?: boolean;
|
|
18
|
+
allowReferenceChanges?: boolean;
|
|
19
|
+
}): string;
|
|
20
|
+
/** Durable stages are evidence, never an automatic replay instruction. */
|
|
21
|
+
export declare function runMemosRevise(ref: string, opts: ReviseOptions): Promise<number>;
|
|
22
|
+
export declare function registerReviseCommand(memos: Command): void;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
+
import { readFileSync, writeFileSync, openSync, fsyncSync, closeSync, renameSync } from 'node:fs';
|
|
3
|
+
import { withConnFlags } from '../compat/flags.js';
|
|
4
|
+
import { requestJson } from '../client.js';
|
|
5
|
+
import { emitJson, fail } from '../helpers.js';
|
|
6
|
+
import { ctx, resolveNote, seg } from './index.js';
|
|
7
|
+
import { tokens, readDocumentSnapshot, submitDocumentPatch } from './document.js';
|
|
8
|
+
import { writePlan } from '../../api/memo-write.js';
|
|
9
|
+
import { memoPresenceApi, memoPresenceIntent } from '../../api/memo-presence.js';
|
|
10
|
+
import { memoTransport } from './api-transport.js';
|
|
11
|
+
import { suggestDiff } from './suggest-diff.js';
|
|
12
|
+
const hash = (text) => 'sha256:' + createHash('sha256').update(text, 'utf8').digest('hex');
|
|
13
|
+
// Keep resource atoms byte-for-byte, including attributes/fragments and legacy forms.
|
|
14
|
+
// Conservative even inside code: intentional changes use the explicit override.
|
|
15
|
+
export function resourceAtoms(text) {
|
|
16
|
+
return text.match(/:(?:note|artifact|dashboard|experiment|project|folder|bindr|asset-reference)\[(?:\\.|[^\]\\])*\](?:\{(?:\\.|[^}\\])*\})?|:(?:note|artifact)\{(?:\\.|[^}\\])*\}|#(?:note|artifact):[^\s)<>]+/g) ?? [];
|
|
17
|
+
}
|
|
18
|
+
export function revisionBody(source, draft, options) {
|
|
19
|
+
tokens(source, source.note);
|
|
20
|
+
if (hash(source.content) !== source.hash)
|
|
21
|
+
throw new Error('baseline content does not match its hash');
|
|
22
|
+
if (!options.allowReferenceChanges) {
|
|
23
|
+
const available = resourceAtoms(draft);
|
|
24
|
+
for (const atom of resourceAtoms(source.content)) {
|
|
25
|
+
const index = available.indexOf(atom);
|
|
26
|
+
if (index < 0)
|
|
27
|
+
throw new Error('draft removes or rewrites a native resource reference; preserve its exact source or use --allow-reference-changes for an intentional change');
|
|
28
|
+
available.splice(index, 1);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return options.direct ? draft : suggestDiff(source.content, draft, { inPlace: true }).markdown;
|
|
32
|
+
}
|
|
33
|
+
/** Durable stages are evidence, never an automatic replay instruction. */
|
|
34
|
+
export async function runMemosRevise(ref, opts) {
|
|
35
|
+
let journal;
|
|
36
|
+
const persist = (stage, fields = {}) => {
|
|
37
|
+
Object.assign(journal, fields, { stage });
|
|
38
|
+
const temporary = opts.receipt + '.' + randomUUID() + '.tmp';
|
|
39
|
+
const fd = openSync(temporary, 'wx', 0o600);
|
|
40
|
+
try {
|
|
41
|
+
writeFileSync(fd, JSON.stringify(journal, null, 2) + '\n');
|
|
42
|
+
fsyncSync(fd);
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
closeSync(fd);
|
|
46
|
+
}
|
|
47
|
+
renameSync(temporary, opts.receipt);
|
|
48
|
+
};
|
|
49
|
+
try {
|
|
50
|
+
if (!process.env.DREAMLAKE_AGENT_ID)
|
|
51
|
+
throw new Error('set DREAMLAKE_AGENT_ID to a stable task identity');
|
|
52
|
+
if (!memoPresenceIntent(opts.intent))
|
|
53
|
+
throw new Error('--intent is required');
|
|
54
|
+
if (!opts.label?.trim() || [...opts.label].length > 70)
|
|
55
|
+
throw new Error('--label requires 1–70 characters (before/after suffixes are added)');
|
|
56
|
+
const source = JSON.parse(readFileSync(opts.baseline, 'utf8'));
|
|
57
|
+
const body = revisionBody(source, new TextDecoder('utf-8', { fatal: true }).decode(readFileSync(opts.file)), opts);
|
|
58
|
+
const payload = { ...writePlan(source, body, 'exact'), commandId: 'revise:' + randomUUID() };
|
|
59
|
+
if (!payload.patch) {
|
|
60
|
+
emitJson({ noChange: true, note: source.note });
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
63
|
+
const c = await ctx(opts);
|
|
64
|
+
if (!c)
|
|
65
|
+
return 1;
|
|
66
|
+
const id = await resolveNote(c, ref);
|
|
67
|
+
if (!id)
|
|
68
|
+
return 1;
|
|
69
|
+
if (id !== source.note)
|
|
70
|
+
throw new Error('baseline belongs to a different memo');
|
|
71
|
+
if (opts.dryRun) {
|
|
72
|
+
emitJson({ dryRun: true, body, payload });
|
|
73
|
+
return 0;
|
|
74
|
+
}
|
|
75
|
+
// Exclusive creation makes rerunning an accepted/ambiguous invocation fail closed.
|
|
76
|
+
// No remote side effects occur until this record exists.
|
|
77
|
+
const initial = { note: id, namespace: c.ns, remote: c.remote, baseline: source, intendedHash: hash(body), payload, stage: 'prepared' };
|
|
78
|
+
const fd = openSync(opts.receipt, 'wx', 0o600);
|
|
79
|
+
try {
|
|
80
|
+
writeFileSync(fd, JSON.stringify(initial, null, 2) + '\n');
|
|
81
|
+
fsyncSync(fd);
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
closeSync(fd);
|
|
85
|
+
}
|
|
86
|
+
journal = initial;
|
|
87
|
+
await memoPresenceApi(memoTransport(c), `/namespaces/${seg(c.ns)}/notes`).visit(id, { intent: opts.intent });
|
|
88
|
+
const live = await readDocumentSnapshot(c, id);
|
|
89
|
+
if (live.revision !== source.revision || live.hash !== source.hash)
|
|
90
|
+
throw new Error('memo changed since the reviewed baseline; reconcile before revising');
|
|
91
|
+
const path = `/namespaces/${seg(c.ns)}/notes/${seg(id)}/versions`;
|
|
92
|
+
const checkpoint = async (snapshot, suffix, parentId) => {
|
|
93
|
+
const version = await requestJson(c.remote, path, {
|
|
94
|
+
token: c.token, method: 'POST', redirect: 'error', json: {
|
|
95
|
+
revision: snapshot.revision, hash: snapshot.hash.slice(7), tag: opts.label + '-' + suffix,
|
|
96
|
+
summary: opts.intent, ...(parentId ? { parentId } : {}),
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
persist(suffix + '-saved', { [suffix]: version });
|
|
100
|
+
if (!/^v_[0-9]{13}_[a-f0-9-]{36}$/.test(version.id) || version.hash !== snapshot.hash.slice(7) || version.revision !== snapshot.revision)
|
|
101
|
+
throw new Error('version receipt does not identify the reviewed revision; this server must preserve the requested opaque revision in version provenance');
|
|
102
|
+
const saved = await requestJson(c.remote, path + '/' + seg(version.id), { token: c.token });
|
|
103
|
+
if (saved.id !== version.id || saved.revision !== snapshot.revision || saved.text !== snapshot.content || hash(saved.text) !== snapshot.hash || saved.hash !== version.hash)
|
|
104
|
+
throw new Error('immutable version readback differs from reviewed source');
|
|
105
|
+
return version.id;
|
|
106
|
+
};
|
|
107
|
+
persist('before-saving');
|
|
108
|
+
const before = await checkpoint(source, 'before');
|
|
109
|
+
persist('write-submitting');
|
|
110
|
+
const receipt = await submitDocumentPatch(c, id, payload);
|
|
111
|
+
persist('write-acknowledged', { write: receipt });
|
|
112
|
+
const result = await readDocumentSnapshot(c, id, receipt.revision);
|
|
113
|
+
if (result.content !== body || result.hash !== hash(body))
|
|
114
|
+
throw new Error('acknowledged source differs from the intended revision');
|
|
115
|
+
// Do not checkpoint a concurrent later draft under this operation's label.
|
|
116
|
+
const current = await readDocumentSnapshot(c, id);
|
|
117
|
+
if (current.revision !== result.revision)
|
|
118
|
+
throw new Error('another edit followed the acknowledged write; preserve the receipt and recover its retained revision separately');
|
|
119
|
+
persist('after-saving');
|
|
120
|
+
await checkpoint(result, 'after', before);
|
|
121
|
+
persist('complete');
|
|
122
|
+
emitJson(journal);
|
|
123
|
+
return 0;
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
127
|
+
if (journal) {
|
|
128
|
+
try {
|
|
129
|
+
persist(String(journal.stage), { error: message });
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
fail('Could not update the receipt; preserve the existing file and inspect remote state before another operation.');
|
|
133
|
+
}
|
|
134
|
+
emitJson(journal);
|
|
135
|
+
fail(`Revision stopped; inspect ${opts.receipt}. Never rerun the content write to recover metadata. For write-submitting inspect memos command-status with the recorded commandId; for version stages inspect memos hist and read immutable IDs before saving anything else.`);
|
|
136
|
+
}
|
|
137
|
+
else
|
|
138
|
+
fail(message);
|
|
139
|
+
return 1;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
export function registerReviseCommand(memos) {
|
|
143
|
+
withConnFlags(memos.command('revise').description('revise reviewed source with pending redlines, intent and verified before/after versions')
|
|
144
|
+
.argument('<memo>')
|
|
145
|
+
.requiredOption('--baseline <path>', 'reviewed complete memos read --json snapshot')
|
|
146
|
+
.requiredOption('--file <path>', 'proposed complete Markdown source')
|
|
147
|
+
.requiredOption('--label <text>', 'meaningful checkpoint label; adds -before and -after')
|
|
148
|
+
.requiredOption('--intent <text>', 'concrete purpose published to presence and version summaries')
|
|
149
|
+
.requiredOption('--receipt <path>', 'new durable local receipt file; existing files are never replayed')
|
|
150
|
+
.option('--direct', 'apply wording directly when the current instruction authorizes it')
|
|
151
|
+
.option('--allow-reference-changes', 'allow intentional resource directive changes')
|
|
152
|
+
.option('--namespace <slug>', 'memo owner namespace').option('--dry-run', 'preview without presence, versions or writes').option('--json', 'emit JSON'))
|
|
153
|
+
.action(async (ref, opts) => { process.exitCode = await runMemosRevise(ref, opts); });
|
|
154
|
+
}
|
|
@@ -18,6 +18,10 @@ export interface TerminalSession extends SessionInput {
|
|
|
18
18
|
modelProvider?: string;
|
|
19
19
|
runState?: 'unknown' | 'running' | 'working' | 'waiting' | 'idle' | 'error' | 'stopped';
|
|
20
20
|
runStateObservedAt?: string | null;
|
|
21
|
+
lastRunState?: TerminalSession['runState'] | null;
|
|
22
|
+
attention?: 'needs_input' | 'error' | null;
|
|
23
|
+
metadataObservedAt?: string | null;
|
|
24
|
+
lastActivityAt?: string | null;
|
|
21
25
|
launch: {
|
|
22
26
|
kind: 'codex' | 'claude';
|
|
23
27
|
claudeConfigDir?: string;
|
|
@@ -126,7 +126,7 @@ export function registerSessionControl(group) {
|
|
|
126
126
|
throw new Error('Stopping ends the agent process. Pass --yes to confirm'); return submit(opts, 'stop', { sessionId: needId(id) }); }));
|
|
127
127
|
waitOption(common(control.command('send <id> <text>').description('send a message to a session (typed into tmux, or one headless resumed turn)'))).option('--permission <level>', 'permission ceiling for a headless turn (default: the level recorded at start)')
|
|
128
128
|
.action((id, text, opts) => guard(opts, () => submit(opts, 'send', { sessionId: needId(id), text, ...level(opts.permission) })));
|
|
129
|
-
common(control.command('broadcast <text>').description('send the same message to several sessions')).requiredOption('--session <id...>', 'session ids')
|
|
129
|
+
common(control.command('broadcast <text>').description('send the same message to several sessions')).requiredOption('--sess, --session <id...>', 'session ids')
|
|
130
130
|
.action((text, opts) => guard(opts, async () => {
|
|
131
131
|
const ns = await resolveHostNamespace(opts.namespace);
|
|
132
132
|
const ids = opts.session.map(needId);
|
|
@@ -138,7 +138,7 @@ export function registerSessionControl(group) {
|
|
|
138
138
|
common(control.command('wait <command-id>').description('wait for a command receipt')).option('--wait <seconds>', 'seconds', '60')
|
|
139
139
|
.action((id, opts) => guard(opts, async () => { const ns = await resolveHostNamespace(opts.namespace); emit({ namespace: ns, command: await client().sessions(ns).commands.wait(needId(id), Number(opts.wait)) }, !!opts.json); }));
|
|
140
140
|
common(control.command('cancel <command-id>').description('cancel pending work or request interruption of running work')).action((id, opts) => guard(opts, async () => { const ns = await resolveHostNamespace(opts.namespace); emit({ namespace: ns, command: await client().sessions(ns).commands.cancel(needId(id)) }, !!opts.json); }));
|
|
141
|
-
common(control.command('list').description('list recent commands and their receipts')).option('--session <id>').option('--status <status>').option('--limit <n>', 'max 100', '25')
|
|
141
|
+
common(control.command('list').description('list recent commands and their receipts')).option('--sess, --session <id>').option('--status <status>').option('--limit <n>', 'max 100', '25')
|
|
142
142
|
.action(opts => guard(opts, async () => { const ns = await resolveHostNamespace(opts.namespace); emit({ namespace: ns, ...(await client().sessions(ns).commands.list({ ...(opts.session ? { sessionId: needId(opts.session) } : {}), ...(opts.status ? { status: opts.status } : {}), limit: Number(opts.limit) })) }, !!opts.json); }));
|
|
143
143
|
common(group.command('children <id>').description('list managed child sessions; control each child by its stable session ID')).option('--cursor <cursor>').action((id, opts) => guard(opts, async () => { const ns = await resolveHostNamespace(opts.namespace); emit(await client().sessions(ns).list({ parentSessionId: needId(id), cursor: opts.cursor, archived: 'include' }), !!opts.json); }));
|
|
144
144
|
common(group.command('permission <id> <level>').description('move the recorded permission level of a session without a runner round-trip; the running process keeps its level until the next resume or restart'))
|
|
@@ -10,7 +10,7 @@ import { registerSessionControl } from './control.js';
|
|
|
10
10
|
import { registerSessionLive } from './live.js';
|
|
11
11
|
// Tolerates the fields a registered (host-less) descriptor leaves empty.
|
|
12
12
|
const cell = (value) => String(value ?? '').replace(/[\x00-\x1f\x7f-\x9f]/g, ' ');
|
|
13
|
-
const summary = (s) => `${cell(s.id)} ${cell(s.name)}\n ${cell(s.username)}@${cell(s.machineId)} ${cell(s.cwd)}\n ${s.provider === 'claude' ? 'Claude' : 'Codex'} ${cell(s.codexSessionId)}${s.runState ? ` · ${cell(s.runState)}` : ''}`;
|
|
13
|
+
const summary = (s) => `${cell(s.id)} ${cell(s.name)}\n ${cell(s.username)}@${cell(s.machineId)} ${cell(s.cwd)}\n ${s.provider === 'claude' ? 'Claude' : 'Codex'} ${cell(s.codexSessionId)}${s.runState ? ` · ${cell(s.runState)}` : ''}${s.lastRunState && s.lastRunState !== s.runState ? ` (last observed ${cell(s.lastRunState)})` : ''}${s.runStateObservedAt ? ` at ${cell(s.runStateObservedAt)}` : ''}${s.attention ? `\n Attention: ${cell(s.attention)}` : ''}`;
|
|
14
14
|
const runtimeSummary = (s, r) => `${summary(s)}\n Runtime: ${r.kind === 'direct' ? 'Direct' : `tmux ${cell(s.tmuxSession)}`}\n State: ${r.status}${r.reason ? ` (${r.reason})` : ''} · managed: ${r.managed ? 'yes' : 'no'} · viewers: ${r.clients ?? 'unknown'}\n Observed: ${r.observedAt}${r.pane ? ` · pane ${r.pane.id} · PID ${r.pane.pid}` : ''}`;
|
|
15
15
|
/** What the session is doing now, from its hooks or runner (`liveState`), next to the Nymph/runner `runState`. */
|
|
16
16
|
const liveSummary = (s) => {
|
|
@@ -23,7 +23,7 @@ const openingMessage = (id, kind) => kind === 'direct'
|
|
|
23
23
|
? `Opening session ${id} directly. Ctrl-] disconnects; disconnecting may end the process. Use sessions open to resume explicitly.`
|
|
24
24
|
: `Opening session ${id}. Ctrl-] detaches; reopen the same ID to reattach.`;
|
|
25
25
|
export function registerSessionsCommand(program) {
|
|
26
|
-
const group = program.command('sessions').description('save and reopen agent terminal sessions on an explicitly selected enrolled host');
|
|
26
|
+
const group = program.command('sessions').aliases(['session', 'sess']).description('save and reopen agent terminal sessions on an explicitly selected enrolled host');
|
|
27
27
|
registerSessionAffiliations(group);
|
|
28
28
|
registerSessionConversation(group);
|
|
29
29
|
registerSessionControl(group);
|
|
@@ -45,7 +45,7 @@ export function registerSessionsCommand(program) {
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
group.command('register').description('register native session metadata without an enrolled host or terminal launch; idempotent for the same provider and native UUID')
|
|
48
|
-
.requiredOption('--provider <provider>', 'codex or claude').requiredOption('--session <uuid>', 'native conversation UUID')
|
|
48
|
+
.requiredOption('--provider <provider>', 'codex or claude').requiredOption('--sess, --session <uuid>', 'native conversation UUID')
|
|
49
49
|
.requiredOption('--cwd <path>', 'original absolute working directory').option('--name <name>')
|
|
50
50
|
.option('--visibility <visibility>', 'public (default for new sessions) or private')
|
|
51
51
|
.option('--write-env <path>', 'write DREAMLAKE_TERMINAL_SESSION_ID and DREAMLAKE_SESSION_NAMESPACE (mode 600) so a shell that sources it links its memo and artifact writes to this session')
|
|
@@ -101,17 +101,20 @@ export function registerSessionsCommand(program) {
|
|
|
101
101
|
throw new Error('Terminal API returned an invalid target');
|
|
102
102
|
console.log(opts.json ? JSON.stringify({ namespace: ns, targets }, null, 2) : targets.map(t => `${cell(t.id)} ${cell(t.name)} ${cell(t.username)}@${cell(t.machineId)}\n enrollment: ${cell(t.enrollmentId ?? 'unavailable (cannot save session)')}`).join('\n') || 'No available terminal targets.');
|
|
103
103
|
}));
|
|
104
|
-
|
|
104
|
+
const listing = (command) => common(command)
|
|
105
|
+
.option('--search-in <scope>', 'title or all; default all includes metadata and uploaded conversation text')
|
|
105
106
|
.option('--page-size <count>', 'bounded registry page size, 1–100')
|
|
106
107
|
.option('--cursor <cursor>', 'continue a registry page using its nextCursor')
|
|
107
|
-
.option('--query <text>', 'search session metadata and uploaded conversation text')
|
|
108
108
|
.option('--scope <scope>', 'mine (default) or available; never expands after no matches')
|
|
109
109
|
.option('--owner <namespace>', 'explicitly search readable sessions of this person')
|
|
110
110
|
.option('--team <slug-or-id>', 'explicitly search sessions shared with this organization')
|
|
111
111
|
.option('--machine <id...>', 'filter exact machine IDs')
|
|
112
112
|
.option('--sort <order>', 'created or recent observed activity')
|
|
113
113
|
.option('--archived <mode>', 'exclude (default), include, or only archived sessions')
|
|
114
|
-
.option('--json')
|
|
114
|
+
.option('--json');
|
|
115
|
+
const listSessions = (opts) => run(opts, async () => {
|
|
116
|
+
if (opts.searchIn !== undefined && !['title', 'all'].includes(opts.searchIn))
|
|
117
|
+
throw new Error('--search-in must be title or all');
|
|
115
118
|
if (opts.pageSize !== undefined && (!/^\d+$/.test(opts.pageSize) || Number(opts.pageSize) < 1 || Number(opts.pageSize) > 100))
|
|
116
119
|
throw new Error('--page-size must be 1–100');
|
|
117
120
|
if (opts.sort !== undefined && !['created', 'recent'].includes(opts.sort))
|
|
@@ -133,7 +136,7 @@ export function registerSessionsCommand(program) {
|
|
|
133
136
|
throw new Error('use an exact owner namespace or organization slug/id');
|
|
134
137
|
const expanded = opts.scope === 'available' || !!opts.owner || !!opts.team;
|
|
135
138
|
const query = new URLSearchParams();
|
|
136
|
-
for (const [name, value] of [['pageSize', opts.pageSize], ['cursor', opts.cursor], ['q', opts.query], ['sort', opts.sort], ['archived', opts.archived], ['owner', opts.owner?.replace(/^@/, '')], ['team', opts.team]])
|
|
139
|
+
for (const [name, value] of [['pageSize', opts.pageSize], ['cursor', opts.cursor], ['q', opts.query], ['searchIn', opts.searchIn], ['sort', opts.sort], ['archived', opts.archived], ['owner', opts.owner?.replace(/^@/, '')], ['team', opts.team]])
|
|
137
140
|
if (value !== undefined)
|
|
138
141
|
query.set(name, value);
|
|
139
142
|
for (const machine of opts.machine ?? [])
|
|
@@ -144,7 +147,16 @@ export function registerSessionsCommand(program) {
|
|
|
144
147
|
const sessions = result.sessions.map(readSession);
|
|
145
148
|
const nextCursor = typeof result.nextCursor === 'string' && /^[A-Za-z0-9_-]{1,1024}$/.test(result.nextCursor) ? result.nextCursor : null;
|
|
146
149
|
console.log(opts.json ? JSON.stringify({ namespace: ns, scope: expanded ? 'available' : 'mine', owner: opts.owner ?? null, team: opts.team ?? null, sessions, hasMore: result.hasMore === true, nextCursor }, null, 2) : (sessions.map(summary).join('\n') || 'No saved terminal sessions.') + (result.hasMore === true ? `\nAdditional saved sessions exist.${nextCursor ? ` Continue with --cursor ${nextCursor} and the same filters/sort.` : ' Server did not return a continuation cursor.'}` : ''));
|
|
147
|
-
})
|
|
150
|
+
});
|
|
151
|
+
listing(collectionList(group, 'list').description('list saved descriptors; this does not probe or start remote processes'))
|
|
152
|
+
.option('--query <text>', 'search session metadata and uploaded conversation text').action(listSessions);
|
|
153
|
+
listing(group.command('search <query>').description('search saved session metadata and uploaded conversation text; never starts or attaches'))
|
|
154
|
+
.allowExcessArguments(false)
|
|
155
|
+
.action((query, opts, command) => {
|
|
156
|
+
if (!query.trim())
|
|
157
|
+
command.error('Search query must not be empty', { exitCode: 1 });
|
|
158
|
+
return listSessions({ ...opts, query });
|
|
159
|
+
});
|
|
148
160
|
common(group.command('show <id>').description('show one saved terminal descriptor')).option('--json').action((id, opts) => run(opts, async () => {
|
|
149
161
|
const ns = await resolveHostNamespace(opts.namespace), session = readSession((await requestJson(connection(), sessionPath(ns, id) + '/metadata')).session);
|
|
150
162
|
console.log(opts.json ? JSON.stringify({ session }, null, 2) : summary(session));
|
|
@@ -180,7 +192,7 @@ export function registerSessionsCommand(program) {
|
|
|
180
192
|
await attachSession(conn, endpoint, ns, session, kind);
|
|
181
193
|
}
|
|
182
194
|
};
|
|
183
|
-
gateway(target(common(group.command('create').description('save or find a matching session without starting it')))).option('--visibility <visibility>', 'public (new session default) or private').option('--session <uuid>', 'existing session UUID for the selected provider').option('--codex-session <uuid>', 'existing Codex session UUID (legacy alias)').option('--json').action(opts => run(opts, () => { if (opts.session && opts.codexSession && opts.session !== opts.codexSession)
|
|
195
|
+
gateway(target(common(group.command('create').description('save or find a matching session without starting it')))).option('--visibility <visibility>', 'public (new session default) or private').option('--sess, --session <uuid>', 'existing session UUID for the selected provider').option('--codex-session <uuid>', 'existing Codex session UUID (legacy alias)').option('--json').action(opts => run(opts, () => { if (opts.session && opts.codexSession && opts.session !== opts.codexSession)
|
|
184
196
|
throw new Error('Provide one session UUID'); return save(opts.session ?? opts.codexSession, opts, false); }));
|
|
185
197
|
gateway(target(common(group.command('resume <session-id>').description('save/find the exact agent session and attach; --json saves only')))).option('--json', 'save descriptor only; never start or attach to a process').action((id, opts) => run(opts, () => save(id, opts, !opts.json)));
|
|
186
198
|
gateway(common(group.command('open <id>').description('open an interactive terminal for a saved session; Ctrl-] detaches'))).action((id, opts) => run(opts, async () => {
|
|
@@ -180,7 +180,7 @@ export function registerSessionLive(group) {
|
|
|
180
180
|
process.exitCode = 1;
|
|
181
181
|
}
|
|
182
182
|
};
|
|
183
|
-
const common = (c) => c.option('--session <id>', 'saved 24-hex session id (default: the env file sessions register --write-env left for the native session this process belongs to (CLAUDE_CODE_SESSION_ID), else the sourced DREAMLAKE_TERMINAL_SESSION_ID pair)')
|
|
183
|
+
const common = (c) => c.option('--sess, --session <id>', 'saved 24-hex session id (default: the env file sessions register --write-env left for the native session this process belongs to (CLAUDE_CODE_SESSION_ID), else the sourced DREAMLAKE_TERMINAL_SESSION_ID pair)')
|
|
184
184
|
.option('--namespace <namespace>', 'personal namespace (default: from the env file or the signed-in personal namespace)')
|
|
185
185
|
.option('--hook-stdin', 'read a Claude Code hook JSON from stdin: tool_name / prompt / agent_id / agent_type fill the fields not given explicitly; its session_id must match the native identity in the environment')
|
|
186
186
|
.option('--at <iso>', 'when it happened (default: now)').option('--source <source>', 'hook (default) or runner; runner needs --runner').option('--runner <id>', 'report as this runner (the session must be bound to it)').option('--json', 'emit the receipt as JSON');
|
|
@@ -215,7 +215,7 @@ export function registerSessionLive(group) {
|
|
|
215
215
|
console.log(opts.json ? JSON.stringify({ namespace: ns, ...tree }, null, 2) : renderTree(tree));
|
|
216
216
|
}));
|
|
217
217
|
group.command('watch').description('follow live state, subagent events, receipts and permission changes as they happen (SSE); one session or all of yours; exits 0 when the server ends the stream after 15 minutes')
|
|
218
|
-
.option('--session <id>', 'one saved session (default: every session of the namespace)').option('--namespace <namespace>', 'personal namespace (default: signed-in personal namespace)').option('--json', 'NDJSON: one typed frame per line')
|
|
218
|
+
.option('--sess, --session <id>', 'one saved session (default: every session of the namespace)').option('--namespace <namespace>', 'personal namespace (default: signed-in personal namespace)').option('--json', 'NDJSON: one typed frame per line')
|
|
219
219
|
.action(opts => guard(opts, async () => {
|
|
220
220
|
if (opts.session !== undefined && !isObjectId(opts.session))
|
|
221
221
|
throw new Error('--session takes the 24-hex saved session id');
|
package/dist/cli/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.114.0";
|
package/dist/cli/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dreamlake/dreamlake-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.114.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dreamlake-ai/dreamlake-cli.git"
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"node": ">=18"
|
|
38
38
|
},
|
|
39
39
|
"optionalDependencies": {
|
|
40
|
-
"@dreamlake/dreamlake-cli-darwin-arm64": "0.
|
|
41
|
-
"@dreamlake/dreamlake-cli-darwin-x64": "0.
|
|
42
|
-
"@dreamlake/dreamlake-cli-linux-x64": "0.
|
|
43
|
-
"@dreamlake/dreamlake-cli-linux-arm64": "0.
|
|
44
|
-
"@dreamlake/dreamlake-cli-linux-x64-musl": "0.
|
|
45
|
-
"@dreamlake/dreamlake-cli-linux-arm64-musl": "0.
|
|
46
|
-
"@dreamlake/dreamlake-cli-win32-x64": "0.
|
|
47
|
-
"@dreamlake/dreamlake-cli-win32-arm64": "0.
|
|
40
|
+
"@dreamlake/dreamlake-cli-darwin-arm64": "0.114.0",
|
|
41
|
+
"@dreamlake/dreamlake-cli-darwin-x64": "0.114.0",
|
|
42
|
+
"@dreamlake/dreamlake-cli-linux-x64": "0.114.0",
|
|
43
|
+
"@dreamlake/dreamlake-cli-linux-arm64": "0.114.0",
|
|
44
|
+
"@dreamlake/dreamlake-cli-linux-x64-musl": "0.114.0",
|
|
45
|
+
"@dreamlake/dreamlake-cli-linux-arm64-musl": "0.114.0",
|
|
46
|
+
"@dreamlake/dreamlake-cli-win32-x64": "0.114.0",
|
|
47
|
+
"@dreamlake/dreamlake-cli-win32-arm64": "0.114.0"
|
|
48
48
|
}
|
|
49
49
|
}
|