@dreamlake/dreamlake-cli 0.102.1 → 0.102.2
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/note-presence.d.ts +18 -0
- package/dist/api/note-presence.js +1 -0
- package/dist/api/notes.d.ts +4 -0
- package/dist/cli/agent-identity.js +11 -5
- package/dist/cli/compat/http.js +2 -1
- package/dist/cli/help-examples.generated.js +1 -0
- package/dist/cli/notes/index.d.ts +5 -0
- package/dist/cli/notes/index.js +33 -0
- package/dist/cli/session-affiliation.js +6 -0
- package/dist/cli/version.d.ts +1 -1
- package/dist/cli/version.js +1 -1
- package/package.json +9 -9
|
@@ -9,6 +9,20 @@ export interface NotePresenceRoster {
|
|
|
9
9
|
participants: Participant[];
|
|
10
10
|
observedAt: number;
|
|
11
11
|
}
|
|
12
|
+
export interface NoteContributorsPage {
|
|
13
|
+
sessions: {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
namespaceSlug: string;
|
|
17
|
+
contribution: {
|
|
18
|
+
kind: 'created' | 'edited';
|
|
19
|
+
firstAt: string;
|
|
20
|
+
lastAt: string;
|
|
21
|
+
} | null;
|
|
22
|
+
}[];
|
|
23
|
+
hasMore: boolean;
|
|
24
|
+
nextCursor: string | null;
|
|
25
|
+
}
|
|
12
26
|
export interface NotePresenceReceipt {
|
|
13
27
|
state?: {
|
|
14
28
|
user?: Participant['user'];
|
|
@@ -63,6 +77,10 @@ export declare function notePresenceIntent(value: string | undefined): {
|
|
|
63
77
|
summary: string;
|
|
64
78
|
} | undefined;
|
|
65
79
|
export declare function notePresenceApi(t: Transport, base: string): {
|
|
80
|
+
contributors: (id: string, options?: {
|
|
81
|
+
cursor?: string;
|
|
82
|
+
pageSize?: number;
|
|
83
|
+
}) => Promise<NoteContributorsPage>;
|
|
66
84
|
/** No join or heartbeat. The optional input retains the former POST API for compatibility. */
|
|
67
85
|
presence: {
|
|
68
86
|
(id: string): Promise<NotePresenceRoster>;
|
|
@@ -17,6 +17,7 @@ export function notePresenceApi(t, base) {
|
|
|
17
17
|
? t.request('GET', path(id) + '/presence', { query: { format: 'json' } })
|
|
18
18
|
: updatePresence(id, input);
|
|
19
19
|
return {
|
|
20
|
+
contributors: (id, options = {}) => t.request('GET', path(id) + '/contributors', { query: options }),
|
|
20
21
|
/** No join or heartbeat. The optional input retains the former POST API for compatibility. */
|
|
21
22
|
presence: presence,
|
|
22
23
|
presenceText: async (id) => {
|
package/dist/api/notes.d.ts
CHANGED
|
@@ -306,6 +306,10 @@ export declare function notesApi(t: Transport, namespace: string): {
|
|
|
306
306
|
after?: string;
|
|
307
307
|
}, ifMatch?: string) => Promise<WriteReceipt>;
|
|
308
308
|
removeSection: (noteId: string, anchor: string, ifMatch?: string) => Promise<WriteReceipt>;
|
|
309
|
+
contributors: (id: string, options?: {
|
|
310
|
+
cursor?: string;
|
|
311
|
+
pageSize?: number;
|
|
312
|
+
}) => Promise<import("./note-presence.js").NoteContributorsPage>;
|
|
309
313
|
presence: {
|
|
310
314
|
(id: string): Promise<import("./note-presence.js").NotePresenceRoster>;
|
|
311
315
|
(id: string, input: Record<string, unknown>): Promise<import("./note-presence.js").NotePresenceReceipt>;
|
|
@@ -9,13 +9,19 @@ export function noteAgentHeaders(path, env = process.env) {
|
|
|
9
9
|
}
|
|
10
10
|
/** Send conversation context only to supported DreamLake resource routes. */
|
|
11
11
|
export function resourceSessionHeaders(path, env = process.env) {
|
|
12
|
-
if (!/^\/(?:namespaces\/[^/]+\/(?:notes|repos)
|
|
12
|
+
if (!/^\/(?:namespaces\/[^/]+\/(?:notes|repos)(?:[/?]|$)|infrastructure\/stacks\/[^/?]+(?:[/?]|$)|resources\/)/.test(path))
|
|
13
13
|
return {};
|
|
14
|
-
const
|
|
15
|
-
const
|
|
14
|
+
const preference = env.DREAMLAKE_SESSION_AFFILIATION === '0' ? { 'X-DreamLake-Session-Affiliation': '0' } : {};
|
|
15
|
+
const saved = env.DREAMLAKE_TERMINAL_SESSION_ID;
|
|
16
|
+
if (saved)
|
|
17
|
+
return /^[a-f0-9]{24}$/.test(saved) ? { ...preference, 'X-DreamLake-Terminal-Session-Id': saved } : preference;
|
|
18
|
+
const claude = env.CLAUDE_SESSION_ID || env.CLAUDE_CODE_SESSION_ID;
|
|
19
|
+
const native = env.CODEX_THREAD_ID && claude ? undefined : env.CODEX_THREAD_ID || claude;
|
|
20
|
+
const id = env.DREAMLAKE_SESSION_ID || native;
|
|
21
|
+
const provider = env.DREAMLAKE_SESSION_PROVIDER || (!env.DREAMLAKE_SESSION_ID && native ? env.CODEX_THREAD_ID ? 'codex' : 'claude' : undefined);
|
|
16
22
|
if (!id || id.length > 128 || /[^\x20-\x7e]/.test(id) || !provider || !['codex', 'claude', 'agent'].includes(provider))
|
|
17
|
-
return
|
|
23
|
+
return preference;
|
|
18
24
|
const name = env.DREAMLAKE_SESSION_NAME;
|
|
19
|
-
return { 'X-DreamLake-Session-Id': id, 'X-DreamLake-Session-Provider': provider,
|
|
25
|
+
return { ...preference, 'X-DreamLake-Session-Id': id, 'X-DreamLake-Session-Provider': provider,
|
|
20
26
|
...(name && name.length <= 256 && !/[^\x20-\x7e]/.test(name) ? { 'X-DreamLake-Session-Name': name } : {}) };
|
|
21
27
|
}
|
package/dist/cli/compat/http.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
// doesn't need the status.
|
|
7
7
|
import { fail } from "../helpers.js";
|
|
8
8
|
import { affiliateSuccessfulWrite } from '../session-affiliation.js';
|
|
9
|
+
import { noteAgentHeaders, resourceSessionHeaders } from '../agent-identity.js';
|
|
9
10
|
import { resolveNamespace } from "./ctx.js";
|
|
10
11
|
function headers(token, hasBody) {
|
|
11
12
|
const h = {};
|
|
@@ -29,7 +30,7 @@ function isStaleConnection(e) {
|
|
|
29
30
|
export async function jsonRequest(method, url, token, body) {
|
|
30
31
|
const doFetch = () => fetch(url, {
|
|
31
32
|
method,
|
|
32
|
-
headers: headers(token, body !== undefined),
|
|
33
|
+
headers: { ...headers(token, body !== undefined), ...noteAgentHeaders(new URL(url).pathname), ...resourceSessionHeaders(new URL(url).pathname) },
|
|
33
34
|
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
34
35
|
});
|
|
35
36
|
let res;
|
|
@@ -92,6 +92,7 @@ export const helpExamples = {
|
|
|
92
92
|
"notes visit": "# Reuse the task's DREAMLAKE_AGENT_ID and DREAMLAKE_AGENT_NAME.\nNOTE_ID=release-plan\ndreamlake notes visit \"$NOTE_ID\"",
|
|
93
93
|
"notes presence": "# Read the participant roster without joining. Text is the default.\nNOTE_ID=release-plan\ndreamlake notes presence \"$NOTE_ID\"",
|
|
94
94
|
"notes select": "export DREAMLAKE_AGENT_ID=\"review-session-42\"\nexport DREAMLAKE_AGENT_NAME=\"Codex\"\nNOTE_ID=\"your-note-id\"\ndreamlake notes select --text \"The next step is tested in simulation.\" --note \"$NOTE_ID\"\n# Select the last occurrence of a repeated passage.\ndreamlake notes select --text \"simulation\" --note \"$NOTE_ID\" -o -1",
|
|
95
|
+
"notes contributors": "dreamlake notes contributors release-plan --namespace geyang --json\n# If hasMore is true, continue with the returned nextCursor:\ndreamlake notes contributors release-plan --namespace geyang --cursor LINK_CURSOR --json",
|
|
95
96
|
"notes rm": "# Read it first and confirm it is the note you mean.\ndreamlake notes read NOTE_ID\n# Asks for confirmation, showing the title and owning namespace.\ndreamlake notes rm NOTE_ID\n# Scripts and agents: skip the prompt and take a JSON receipt.\ndreamlake notes rm NOTE_ID --yes --json\n# Afterwards a read reports not found.\ndreamlake notes read NOTE_ID",
|
|
96
97
|
"notes patch": "set -euo pipefail\ndreamlake notes create \"Patch tutorial\" --text 'Hello world.' > created.txt\nNOTE_ID=$(sed -n 's/^ id //p' created.txt)\ndreamlake notes read \"$NOTE_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)\ndreamlake notes patch \"$NOTE_ID\" --file - --base-revision \"$BASE\" --json > receipt.json <<'PATCH'\n@@ chars 0:12 @@\n~ Hello [-world-]{+team+}.\nPATCH\nACK=$(jq -er .revision receipt.json)\ndreamlake notes read \"$NOTE_ID\" --if-match \"$ACK\"\n# Expect Hello team. Inspect the result; do not repeat a successful patch.",
|
|
97
98
|
"notes append": "dreamlake notes append \"$NOTE_ID\" --file addition.md --base-revision \"$BASE\" --json\n# ACK is the revision in the successful append receipt.\ndreamlake notes read \"$NOTE_ID\" --at \"$ACK\"",
|
|
@@ -116,6 +116,11 @@ export declare function runNotesDiff(ref: string | undefined, opts: DocumentRead
|
|
|
116
116
|
}): Promise<number>;
|
|
117
117
|
export declare function runNotesPatch(ref: string, opts: DocumentPatchOptions): Promise<number>;
|
|
118
118
|
/** Reading the roster never registers presence or maintains a session. */
|
|
119
|
+
export declare function runNotesContributors(ref: string, opts: ConnOpts & {
|
|
120
|
+
json?: boolean;
|
|
121
|
+
cursor?: string;
|
|
122
|
+
}): Promise<number>;
|
|
123
|
+
/** Reading the roster never registers presence or maintains a session. */
|
|
119
124
|
export declare function runNotesPresence(ref: string, opts: ConnOpts & {
|
|
120
125
|
json?: boolean;
|
|
121
126
|
}): Promise<number>;
|
package/dist/cli/notes/index.js
CHANGED
|
@@ -218,6 +218,13 @@ export function registerNotesCommand(program) {
|
|
|
218
218
|
.option("--namespace <slug>", "note owner namespace")
|
|
219
219
|
.option("--json", "emit JSON for programmatic consumers")
|
|
220
220
|
.action(async (note, opts) => { process.exitCode = await runNotesPresence(note, opts); });
|
|
221
|
+
strict(notes.command("contributors"))
|
|
222
|
+
.argument("<note>", "note id, slug or title")
|
|
223
|
+
.description("list durable contributing sessions and explicitly linked sessions")
|
|
224
|
+
.option("--namespace <slug>", "note owner namespace")
|
|
225
|
+
.option("--cursor <id>", "continue from the returned nextCursor")
|
|
226
|
+
.option("--json", "emit JSON including evidence and pagination")
|
|
227
|
+
.action(async (note, opts) => { process.exitCode = await runNotesContributors(note, opts); });
|
|
221
228
|
strict(notes.command("projects"))
|
|
222
229
|
.argument("<note-id>", "stable Note ID")
|
|
223
230
|
.description("inspect current project filing and server-computed filing permissions (JSON)")
|
|
@@ -1307,6 +1314,32 @@ export async function runNotesPatch(ref, opts) {
|
|
|
1307
1314
|
return opts.legacy ? runLegacyNotesPatch(ref, opts) : runDocumentPatch(ref, opts);
|
|
1308
1315
|
}
|
|
1309
1316
|
/** Reading the roster never registers presence or maintains a session. */
|
|
1317
|
+
export async function runNotesContributors(ref, opts) {
|
|
1318
|
+
const c = await ctx(opts);
|
|
1319
|
+
if (!c)
|
|
1320
|
+
return 1;
|
|
1321
|
+
try {
|
|
1322
|
+
const id = await resolveNote(c, ref);
|
|
1323
|
+
if (!id)
|
|
1324
|
+
return 1;
|
|
1325
|
+
const result = await notePresenceApi(noteTransport(c), `/namespaces/${seg(c.ns)}/notes`).contributors(id, { cursor: opts.cursor });
|
|
1326
|
+
if (opts.json)
|
|
1327
|
+
emitJson(result);
|
|
1328
|
+
else {
|
|
1329
|
+
for (const session of result.sessions)
|
|
1330
|
+
process.stdout.write(`${session.name}\t${session.contribution?.kind ?? 'linked'}\t${session.namespaceSlug}/${session.id}\n`);
|
|
1331
|
+
if (!result.sessions.length)
|
|
1332
|
+
process.stdout.write('No accessible contributing sessions recorded.\n');
|
|
1333
|
+
if (result.nextCursor)
|
|
1334
|
+
process.stdout.write(`Continue with --cursor ${result.nextCursor}\n`);
|
|
1335
|
+
}
|
|
1336
|
+
return 0;
|
|
1337
|
+
}
|
|
1338
|
+
catch (error) {
|
|
1339
|
+
return report(error);
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
/** Reading the roster never registers presence or maintains a session. */
|
|
1310
1343
|
export async function runNotesPresence(ref, opts) {
|
|
1311
1344
|
const c = await ctx(opts);
|
|
1312
1345
|
if (!c)
|
|
@@ -67,6 +67,12 @@ export function createAutoAffiliator(deps = {}) {
|
|
|
67
67
|
const address = new URL(url), resource = writtenResource(method, address.pathname, response, payload);
|
|
68
68
|
if (!resource)
|
|
69
69
|
return;
|
|
70
|
+
// The Note server records confirmed changes using presence/session headers.
|
|
71
|
+
// A second client-side link cannot prove a write (notably no-op/replayed receipts).
|
|
72
|
+
// Explicit conversation upload remains opt-in and never replays content.
|
|
73
|
+
if (resource.type === 'note' && (!env.DREAMLAKE_CONVERSATION_FILE ||
|
|
74
|
+
response?.outcome === 'no-write'))
|
|
75
|
+
return;
|
|
70
76
|
if (env.DREAMLAKE_SESSION_VISIBILITY && !['public', 'private'].includes(env.DREAMLAKE_SESSION_VISIBILITY))
|
|
71
77
|
throw new Error('DREAMLAKE_SESSION_VISIBILITY must be public or private; metadata was not published');
|
|
72
78
|
const key = JSON.stringify([address.origin, token, resource, context]);
|
package/dist/cli/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.102.
|
|
1
|
+
export declare const VERSION = "0.102.2";
|
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.102.
|
|
3
|
+
"version": "0.102.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dreamlake-ai/dreamlake-cli.git"
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"node": ">=18"
|
|
37
37
|
},
|
|
38
38
|
"optionalDependencies": {
|
|
39
|
-
"@dreamlake/dreamlake-cli-darwin-arm64": "0.102.
|
|
40
|
-
"@dreamlake/dreamlake-cli-darwin-x64": "0.102.
|
|
41
|
-
"@dreamlake/dreamlake-cli-linux-x64": "0.102.
|
|
42
|
-
"@dreamlake/dreamlake-cli-linux-arm64": "0.102.
|
|
43
|
-
"@dreamlake/dreamlake-cli-linux-x64-musl": "0.102.
|
|
44
|
-
"@dreamlake/dreamlake-cli-linux-arm64-musl": "0.102.
|
|
45
|
-
"@dreamlake/dreamlake-cli-win32-x64": "0.102.
|
|
46
|
-
"@dreamlake/dreamlake-cli-win32-arm64": "0.102.
|
|
39
|
+
"@dreamlake/dreamlake-cli-darwin-arm64": "0.102.2",
|
|
40
|
+
"@dreamlake/dreamlake-cli-darwin-x64": "0.102.2",
|
|
41
|
+
"@dreamlake/dreamlake-cli-linux-x64": "0.102.2",
|
|
42
|
+
"@dreamlake/dreamlake-cli-linux-arm64": "0.102.2",
|
|
43
|
+
"@dreamlake/dreamlake-cli-linux-x64-musl": "0.102.2",
|
|
44
|
+
"@dreamlake/dreamlake-cli-linux-arm64-musl": "0.102.2",
|
|
45
|
+
"@dreamlake/dreamlake-cli-win32-x64": "0.102.2",
|
|
46
|
+
"@dreamlake/dreamlake-cli-win32-arm64": "0.102.2"
|
|
47
47
|
}
|
|
48
48
|
}
|