@dreamlake/dreamlake-cli 0.107.2 → 0.109.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.
@@ -0,0 +1,56 @@
1
+ import type { Transport } from "./client.js";
2
+ export interface AppConnection {
3
+ id: string;
4
+ label: string;
5
+ provider: string;
6
+ accountLabel: string;
7
+ lifecycle: string;
8
+ enabled: boolean;
9
+ writeEnabled: boolean;
10
+ grantRevision: number;
11
+ settingsRevision: number;
12
+ }
13
+ export interface AppAction {
14
+ actionId: string;
15
+ connectionId: string;
16
+ label: string;
17
+ accountLabel: string;
18
+ tool: string;
19
+ arguments: Record<string, unknown>;
20
+ payloadHash: string;
21
+ expiresAt: string;
22
+ state: string;
23
+ error: string | null;
24
+ result: unknown;
25
+ }
26
+ export interface AppCatalog {
27
+ providers: Array<{
28
+ kind: string;
29
+ label: string;
30
+ ready: boolean;
31
+ supportsWrite: boolean;
32
+ }>;
33
+ connections: AppConnection[];
34
+ actions: Array<{
35
+ id: string;
36
+ state: string;
37
+ tool: string;
38
+ }>;
39
+ truncated: boolean;
40
+ }
41
+ /** Explicit human authorization remains the caller's responsibility. Never expose confirm as a model tool. */
42
+ export declare function appsApi(t: Transport, namespace: string): {
43
+ list: () => Promise<AppCatalog>;
44
+ grant: (id: string, input: {
45
+ enabled: boolean;
46
+ writeEnabled: boolean;
47
+ expectedRevision: number;
48
+ }) => Promise<unknown>;
49
+ tools: (id: string) => Promise<unknown>;
50
+ check: (id: string) => Promise<unknown>;
51
+ read: (id: string, tool: string, args: Record<string, unknown>) => Promise<unknown>;
52
+ prepare: (id: string, tool: string, args: Record<string, unknown>) => Promise<unknown>;
53
+ receipt: (id: string) => Promise<AppAction>;
54
+ confirm: (id: string, payloadHash: string, confirmation: "send-exact-action") => Promise<AppAction>;
55
+ cancel: (id: string) => Promise<AppAction>;
56
+ };
@@ -0,0 +1,23 @@
1
+ /** Explicit human authorization remains the caller's responsibility. Never expose confirm as a model tool. */
2
+ export function appsApi(t, namespace) {
3
+ const base = `/agent/apps/${encodeURIComponent(namespace)}`;
4
+ const connection = (id) => `${base}/connections/${encodeURIComponent(id)}`;
5
+ const action = (id) => `${base}/actions/${encodeURIComponent(id)}`;
6
+ return {
7
+ list: () => t.request("GET", base),
8
+ grant: (id, input) => t.request("PUT", `${connection(id)}/grant`, { json: input }),
9
+ tools: (id) => t.request("GET", `${connection(id)}/tools`),
10
+ check: (id) => t.request("GET", `${connection(id)}/check`),
11
+ read: (id, tool, args) => t.request("POST", `${connection(id)}/read`, {
12
+ json: { tool, arguments: args },
13
+ }),
14
+ prepare: (id, tool, args) => t.request("POST", `${connection(id)}/prepare`, {
15
+ json: { tool, arguments: args },
16
+ }),
17
+ receipt: (id) => t.request("GET", action(id)),
18
+ confirm: (id, payloadHash, confirmation) => t.request("POST", `${action(id)}/confirm`, {
19
+ json: { payloadHash, confirmation },
20
+ }),
21
+ cancel: (id) => t.request("POST", `${action(id)}/cancel`, { json: {} }),
22
+ };
23
+ }
@@ -1,3 +1,4 @@
1
+ export * from './apps.js';
1
2
  export * from './lakeshore-connections.js';
2
3
  export * from "./open-resources.js";
3
4
  export * from "./library-manifest.js";
@@ -32,6 +33,21 @@ export * from "./skills.js";
32
33
  /** TypeScript operations use an explicit transport; importing does not execute CLI startup. */
33
34
  export declare function createApi(transport: Transport): {
34
35
  transport: Transport;
36
+ apps: (namespace: string) => {
37
+ list: () => Promise<import("./apps.js").AppCatalog>;
38
+ grant: (id: string, input: {
39
+ enabled: boolean;
40
+ writeEnabled: boolean;
41
+ expectedRevision: number;
42
+ }) => Promise<unknown>;
43
+ tools: (id: string) => Promise<unknown>;
44
+ check: (id: string) => Promise<unknown>;
45
+ read: (id: string, tool: string, args: Record<string, unknown>) => Promise<unknown>;
46
+ prepare: (id: string, tool: string, args: Record<string, unknown>) => Promise<unknown>;
47
+ receipt: (id: string) => Promise<import("./apps.js").AppAction>;
48
+ confirm: (id: string, payloadHash: string, confirmation: "send-exact-action") => Promise<import("./apps.js").AppAction>;
49
+ cancel: (id: string) => Promise<import("./apps.js").AppAction>;
50
+ };
35
51
  openResources: {
36
52
  find(resources: readonly import("./open-resources.js").OpenResource[], input: {
37
53
  query: string;
@@ -1301,6 +1317,21 @@ export declare function createClient(options: ClientOptions): {
1301
1317
  jobs: (namespace: string) => JobsApi;
1302
1318
  infra: InfraApi;
1303
1319
  transport: Transport;
1320
+ apps: (namespace: string) => {
1321
+ list: () => Promise<import("./apps.js").AppCatalog>;
1322
+ grant: (id: string, input: {
1323
+ enabled: boolean;
1324
+ writeEnabled: boolean;
1325
+ expectedRevision: number;
1326
+ }) => Promise<unknown>;
1327
+ tools: (id: string) => Promise<unknown>;
1328
+ check: (id: string) => Promise<unknown>;
1329
+ read: (id: string, tool: string, args: Record<string, unknown>) => Promise<unknown>;
1330
+ prepare: (id: string, tool: string, args: Record<string, unknown>) => Promise<unknown>;
1331
+ receipt: (id: string) => Promise<import("./apps.js").AppAction>;
1332
+ confirm: (id: string, payloadHash: string, confirmation: "send-exact-action") => Promise<import("./apps.js").AppAction>;
1333
+ cancel: (id: string) => Promise<import("./apps.js").AppAction>;
1334
+ };
1304
1335
  openResources: {
1305
1336
  find(resources: readonly import("./open-resources.js").OpenResource[], input: {
1306
1337
  query: string;
package/dist/api/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { appsApi } from './apps.js';
2
+ export * from './apps.js';
1
3
  import { lakeshoreConnectionsApi } from './lakeshore-connections.js';
2
4
  export * from './lakeshore-connections.js';
3
5
  import { openResourcesApi } from "./open-resources.js";
@@ -63,6 +65,7 @@ export function createApi(transport) {
63
65
  const memos = memosFacade(transport);
64
66
  return {
65
67
  transport,
68
+ apps: (namespace) => appsApi(transport, namespace),
66
69
  openResources: openResourcesApi(transport),
67
70
  browser,
68
71
  profile: () => transport.request("GET", "/auth/me"),
@@ -3,7 +3,7 @@ import { type MemoSource } from "./memo-edits.js";
3
3
  import * as editing from "./memo-editing.js";
4
4
  import { type MemoFocusedRead } from "./memo-reading.js";
5
5
  import { type MemoCommandStatus, type MemoWriteMode, type MemoWriteReceipt } from "./memo-write.js";
6
- import { type MemoRow, type MemosApi, type MemoVersion } from "./memos.js";
6
+ import { type MemoRow, type MemoPermalink, type MemosApi, type MemoVersion } from "./memos.js";
7
7
  /** `{note, content, hash, revision}`: four distinct values. A hash describes text; a revision is the write baseline. */
8
8
  export type MemoSnapshot = MemoSource;
9
9
  /** A qualified reference: the first `/` separates the lookup namespace from a 24-hex id or a slug. */
@@ -191,6 +191,10 @@ export interface MemoHandle {
191
191
  since: string;
192
192
  format?: "diff" | "inline-dff";
193
193
  }): Promise<MemoDiff>;
194
+ /** Get or allocate a public URL, or edit its slug; previous slugs remain reserved aliases. */
195
+ permalink(input?: {
196
+ slug?: string;
197
+ }): Promise<MemoPermalink>;
194
198
  presence(): Promise<unknown>;
195
199
  /** Announce the caller once. `address`/`cursor` locations are a documented target (UnsupportedTarget today). */
196
200
  visit(input?: MemoVisitInput): Promise<unknown>;
@@ -309,6 +309,7 @@ export function memoHandle(t, ref, context = {}) {
309
309
  return result;
310
310
  });
311
311
  },
312
+ async permalink(input = {}) { return guarded(async (api) => api.permalink(await id(api), input), "write"); },
312
313
  async presence() { return guarded(async (api) => api.presence(await id(api))); },
313
314
  async visit(input = {}) {
314
315
  if (input.address !== undefined || input.cursor !== undefined)
@@ -6,6 +6,14 @@ import { type MemoSource, type MemoEdit } from "./memo-edits.js";
6
6
  export { memoEdits, type MemoSource, type MemoEdit, type MemoPatch, noteEdits, type NoteSource, type NoteEdit, type NotePatch, } from "./memo-edits.js";
7
7
  import { type Transport } from "./client.js";
8
8
  import { type MemoPatchRequest, type MemoWriteReceipt, type MemoCommandStatus } from "./memo-write.js";
9
+ /** Current public URL and retained previous slugs. */
10
+ export interface MemoPermalink {
11
+ noteId: string;
12
+ namespaceSlug: string;
13
+ slug: string;
14
+ href: string;
15
+ aliases: string[];
16
+ }
9
17
  export interface MemoSearchHit {
10
18
  noteId: string;
11
19
  noteSlug: string;
@@ -150,6 +158,10 @@ export declare function memosApi(t: Transport, namespace: string): {
150
158
  projects: string[];
151
159
  dryRun?: boolean;
152
160
  }) => Promise<unknown>;
161
+ /** Get or allocate a public/unlisted URL; an explicit slug edits it and retains aliases. */
162
+ permalink: (noteId: string, input?: {
163
+ slug?: string;
164
+ }) => Promise<MemoPermalink>;
153
165
  share: (noteId: string) => {
154
166
  get: () => Promise<Record<string, unknown>>;
155
167
  create: (role?: "read" | "write") => Promise<unknown>;
package/dist/api/memos.js CHANGED
@@ -123,6 +123,8 @@ export function memosApi(t, namespace) {
123
123
  shared: (query = {}) => t.request("GET", "/me/notes/shared", { query }),
124
124
  projects: (noteId, view) => t.request("GET", `/namespaces/${namespaceSeg(namespace)}/resources/note/${id(noteId)}/projects`, { query: { view } }),
125
125
  move: (noteId, input) => t.request("POST", `${base}/${id(noteId)}/move`, { json: input }),
126
+ /** Get or allocate a public/unlisted URL; an explicit slug edits it and retains aliases. */
127
+ permalink: (noteId, input = {}) => t.request("POST", `${base}/${id(noteId)}/permalink`, { json: input, redirect: "error" }),
126
128
  share: (noteId) => sharingApi(t, namespace, "notes", id(noteId)),
127
129
  files: (noteId) => memoFilesApi(t, `${base}/${id(noteId)}`),
128
130
  media: async (form) => {
@@ -0,0 +1,14 @@
1
+ import type { Command } from "commander";
2
+ import { type AppAction } from "../../api/apps.js";
3
+ interface Options {
4
+ namespace?: string;
5
+ json?: boolean;
6
+ inputFile?: string;
7
+ send?: boolean;
8
+ }
9
+ export declare function validAction(value: unknown): asserts value is AppAction;
10
+ export declare function appInput(path?: string): Promise<Record<string, unknown>>;
11
+ export declare const display: (value: unknown) => string;
12
+ export declare function runApps(operation: string, id: string | undefined, tool: string | undefined, opts: Options): Promise<number>;
13
+ export declare function registerAppsCommand(program: Command): void;
14
+ export {};
@@ -0,0 +1,205 @@
1
+ import { readFile, stat } from "node:fs/promises";
2
+ import { confirm } from "@inquirer/prompts";
3
+ import { appsApi } from "../../api/apps.js";
4
+ import { requestJson } from "../client.js";
5
+ import { ctx, strictArgs } from "../connection/index.js";
6
+ import { emitJson, fail } from "../helpers.js";
7
+ export function validAction(value) {
8
+ const a = value;
9
+ if (!a ||
10
+ typeof a.actionId !== "string" ||
11
+ !/^[a-f0-9]{24}$/.test(a.actionId) ||
12
+ typeof a.payloadHash !== "string" ||
13
+ !/^[a-f0-9]{64}$/.test(a.payloadHash) ||
14
+ !a.arguments ||
15
+ typeof a.arguments !== "object" ||
16
+ Array.isArray(a.arguments) ||
17
+ typeof a.label !== "string" ||
18
+ typeof a.accountLabel !== "string" ||
19
+ typeof a.tool !== "string" ||
20
+ ![
21
+ "prepared",
22
+ "sending",
23
+ "completed",
24
+ "failed",
25
+ "cancelled",
26
+ "uncertain",
27
+ ].includes(a.state) ||
28
+ !Number.isFinite(Date.parse(a.expiresAt)))
29
+ throw new Error("Invalid app action response; nothing was confirmed.");
30
+ }
31
+ export async function appInput(path) {
32
+ if (!path)
33
+ throw new Error("--input-file is required");
34
+ const info = await stat(path);
35
+ if (!info.isFile() || info.size > 16_384)
36
+ throw new Error("Input must be a JSON file of at most 16 KiB.");
37
+ const raw = await readFile(path, "utf8");
38
+ if (Buffer.byteLength(raw) > 16_384)
39
+ throw new Error("Input exceeds 16 KiB.");
40
+ const args = JSON.parse(raw);
41
+ if (!args || typeof args !== "object" || Array.isArray(args))
42
+ throw new Error("Input must be a JSON object.");
43
+ return args;
44
+ }
45
+ // JSON escaping also makes terminal control characters and bidirectional overrides visible.
46
+ export const display = (value) => JSON.stringify(value, null, 2).replace(/[\u007f-\u009f\u202a-\u202e\u2066-\u2069]/g, (c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, "0")}`);
47
+ export async function runApps(operation, id, tool, opts) {
48
+ // Neither a pipe nor --json is a way to bypass human review.
49
+ if (operation === "confirm" &&
50
+ (!process.stdin.isTTY || !process.stdout.isTTY || opts.json)) {
51
+ fail("Confirmation requires an interactive terminal. Review the action in Assistant connections → Apps for your agent (/go My connections), or run this command interactively.");
52
+ return 1;
53
+ }
54
+ try {
55
+ const args = ["read", "prepare"].includes(operation)
56
+ ? await appInput(opts.inputFile)
57
+ : undefined;
58
+ const c = await ctx(opts.namespace);
59
+ if (!c)
60
+ return 1;
61
+ const api = appsApi({
62
+ request: (method, path, options) => requestJson(c.remote, path, {
63
+ method: method === "HEAD" ? "GET" : method,
64
+ json: options?.json,
65
+ signal: options?.signal,
66
+ token: c.token,
67
+ }),
68
+ }, c.ns);
69
+ let result;
70
+ switch (operation) {
71
+ case "list":
72
+ result = await api.list();
73
+ break;
74
+ case "tools":
75
+ result = await api.tools(id);
76
+ break;
77
+ case "check":
78
+ result = await api.check(id);
79
+ break;
80
+ case "read":
81
+ result = await api.read(id, tool, args);
82
+ break;
83
+ case "prepare":
84
+ result = await api.prepare(id, tool, args);
85
+ break;
86
+ case "receipt":
87
+ result = await api.receipt(id);
88
+ validAction(result);
89
+ break;
90
+ case "cancel":
91
+ result = await api.cancel(id);
92
+ validAction(result);
93
+ break;
94
+ case "grant":
95
+ case "revoke": {
96
+ const catalog = await api.list();
97
+ const row = catalog.connections.find((x) => x.id === id);
98
+ if (!row ||
99
+ !Number.isSafeInteger(row.grantRevision) ||
100
+ row.grantRevision < 0)
101
+ throw new Error("Connection not found or invalid grant revision.");
102
+ result = await api.grant(id, {
103
+ enabled: operation === "grant",
104
+ writeEnabled: operation === "grant" && !!opts.send,
105
+ expectedRevision: row.grantRevision,
106
+ });
107
+ break;
108
+ }
109
+ case "confirm": {
110
+ const action = await api.receipt(id);
111
+ validAction(action);
112
+ if (action.actionId !== id)
113
+ throw new Error("Action identity changed; nothing was confirmed.");
114
+ if (action.state !== "prepared") {
115
+ result = action;
116
+ break;
117
+ }
118
+ if (Date.parse(action.expiresAt) <= Date.now())
119
+ throw new Error("This proposal expired. Prepare a new action.");
120
+ process.stdout.write(display({
121
+ account: action.accountLabel,
122
+ connection: action.label,
123
+ tool: action.tool,
124
+ arguments: action.arguments,
125
+ }) + "\n");
126
+ if (!(await confirm({
127
+ message: "Send this exact Slack message?",
128
+ default: false,
129
+ })))
130
+ return 0;
131
+ result = await api.confirm(id, action.payloadHash, "send-exact-action");
132
+ validAction(result);
133
+ break;
134
+ }
135
+ default:
136
+ throw new Error("Unknown app operation");
137
+ }
138
+ if (opts.json)
139
+ emitJson(result);
140
+ else
141
+ process.stdout.write(display(result) + "\n");
142
+ if (operation === "confirm" &&
143
+ result.state !== "completed") {
144
+ fail("Sending is not confirmed. Check the receipt and Slack before preparing another action.");
145
+ return 1;
146
+ }
147
+ return 0;
148
+ }
149
+ catch (e) {
150
+ // Do not print request bodies or raw provider errors.
151
+ fail(e instanceof Error ? e.message : "App request failed");
152
+ if (operation === "confirm")
153
+ fail("Do not retry the send blindly. Read the action receipt and check Slack.");
154
+ return 1;
155
+ }
156
+ }
157
+ export function registerAppsCommand(program) {
158
+ const apps = program
159
+ .command("apps")
160
+ .description("connect personal apps to the built-in agent; review external actions");
161
+ for (const operation of [
162
+ "list",
163
+ "grant",
164
+ "revoke",
165
+ "tools",
166
+ "check",
167
+ "read",
168
+ "prepare",
169
+ "receipt",
170
+ "confirm",
171
+ "cancel",
172
+ ]) {
173
+ let cmd = strictArgs(apps.command(operation)).description({
174
+ list: "list app connections and recent actions",
175
+ grant: "allow built-in agent reads (optionally reviewed sends)",
176
+ revoke: "remove built-in agent access",
177
+ tools: "discover allowed tools",
178
+ check: "verify sign-in and tool discovery without reading content",
179
+ read: "call an allowed read tool",
180
+ prepare: "prepare a Slack message for review without sending",
181
+ receipt: "review an action and its saved outcome",
182
+ confirm: "interactively review and send one exact action",
183
+ cancel: "cancel a prepared action",
184
+ }[operation]);
185
+ if (operation !== "list")
186
+ cmd = cmd.argument("<id>", ["receipt", "confirm", "cancel"].includes(operation)
187
+ ? "action id"
188
+ : "connection id");
189
+ if (["read", "prepare"].includes(operation))
190
+ cmd = cmd
191
+ .argument("<tool>", "discovered tool name")
192
+ .requiredOption("--input-file <path>", "JSON argument object (16 KiB maximum)");
193
+ if (operation === "grant")
194
+ cmd.option("--send", "also allow preparing reviewed sends; requires Slack send consent");
195
+ cmd
196
+ .option("--namespace <slug>", "personal namespace (default: active login)")
197
+ .option("--json", "emit JSON (unavailable for confirm)");
198
+ cmd.action(async (...args) => {
199
+ const opts = args[args.length - 2];
200
+ process.exitCode = await runApps(operation, operation === "list" ? undefined : args[0], ["read", "prepare"].includes(operation)
201
+ ? args[1]
202
+ : undefined, opts);
203
+ });
204
+ }
205
+ }
@@ -11,6 +11,7 @@ export declare function runOAuthCreate(opts: {
11
11
  wait?: boolean;
12
12
  json?: boolean;
13
13
  timeoutMs?: number;
14
+ access?: string;
14
15
  }): Promise<number>;
15
16
  export declare function runOAuthReconnect(id: string, opts: {
16
17
  connector: string;
@@ -19,5 +20,6 @@ export declare function runOAuthReconnect(id: string, opts: {
19
20
  wait?: boolean;
20
21
  json?: boolean;
21
22
  timeoutMs?: number;
23
+ access?: string;
22
24
  }): Promise<number>;
23
25
  export declare function registerConnectionOAuthCommands(connection: Command): void;
@@ -72,7 +72,7 @@ async function begin(c, body) {
72
72
  const res = await requestJson(c.remote, operationsPath(c), {
73
73
  method: "POST",
74
74
  token: c.token,
75
- json: { ...body, returnTo: RETURN_TO },
75
+ json: { ...body, returnTo: ["slack-mcp", "plaud-mcp"].includes(String(body.connectorKind)) ? `/${seg(c.ns)}/settings?apps=1` : RETURN_TO },
76
76
  });
77
77
  return parseBegin(res, "begin");
78
78
  }
@@ -235,7 +235,7 @@ export async function runOAuthCreate(opts) {
235
235
  const c = await ctx(opts.namespace);
236
236
  if (!c)
237
237
  return 1;
238
- return flow(c, { intent: "create", connectorKind: opts.connector, label: opts.label }, opts);
238
+ return flow(c, { intent: "create", connectorKind: opts.connector, label: opts.label, ...(opts.access ? { oauthProfile: opts.access } : {}) }, opts);
239
239
  }
240
240
  export async function runOAuthReconnect(id, opts) {
241
241
  const c = await ctx(opts.namespace);
@@ -258,6 +258,7 @@ export async function runOAuthReconnect(id, opts) {
258
258
  return 1;
259
259
  return flow(c, {
260
260
  intent: "reconnect",
261
+ ...(opts.access ? { oauthProfile: opts.access } : {}),
261
262
  connectorKind: opts.connector,
262
263
  connectionId: id,
263
264
  expectedSettingsRevision: one.settingsRevision,
@@ -269,6 +270,7 @@ export function registerConnectionOAuthCommands(connection) {
269
270
  .command("oauth")
270
271
  .description("authorize a connection through a provider's browser flow");
271
272
  const shared = (cmd) => cmd
273
+ .option("--access <profile>", "provider access profile (app providers: read or read-write)")
272
274
  .option("--no-browser", "print the URL instead of opening a browser")
273
275
  .option("--no-wait", "print the operation id and exit without watching")
274
276
  .option("--namespace <slug>", "namespace slug (default: active login)")
@@ -5,6 +5,16 @@ export const helpExamples = {
5
5
  "agents show": "dreamlake agents show my_repo.tri --namespace my-workspace",
6
6
  "agents edit": "dreamlake agents edit my_repo.tri --namespace my-workspace\n# Browser form: follow the localhost URL printed by the command.\ndreamlake agents edit my_repo.tri --namespace my-workspace --web",
7
7
  "telemetry": "dreamlake telemetry disable --quiet\ndreamlake telemetry status\ndreamlake telemetry enable --quiet",
8
+ "apps": "dreamlake apps list --json\ndreamlake connection oauth create --connector slack-mcp --label \"Work Slack\" --access read\ndreamlake connection oauth create --connector plaud-mcp --label \"My Plaud\" --access read",
9
+ "apps grant": "dreamlake apps grant <connection-id>",
10
+ "apps check": "dreamlake apps check <connection-id> --json",
11
+ "apps tools": "dreamlake apps tools <connection-id> --json",
12
+ "apps read": "dreamlake apps read <connection-id> <read-tool> --input-file query.json --json",
13
+ "apps prepare": "dreamlake apps prepare <connection-id> slack_send_message --input-file message.json --json",
14
+ "apps receipt": "dreamlake apps receipt <action-id> --json",
15
+ "apps confirm": "dreamlake apps confirm <action-id>",
16
+ "apps cancel": "dreamlake apps cancel <action-id> --json",
17
+ "apps revoke": "dreamlake apps revoke <connection-id>",
8
18
  "artifact push": "dreamlake artifact push ./dashboard.html --id q1-dashboard\n# Edit the file, then repeat the same command to upload only new chunks.\n\n# Static build with on-demand assets (CLI 0.101.0+; requires site hosting):\ndreamlake artifact push ./dist/client --site --id simulation\n\n# Compatibility with older self-hosted viewers:\ndreamlake artifact push ./dashboard.html --id q1-dashboard --full\n\n# Multiple self-contained HTML pages (requires an updated viewer):\ndreamlake artifact push ./report --entry index.html --id quarterly-report",
9
19
  "artifact meta set": "# At push time:\ndreamlake artifact push ./report.html --id q1-dashboard \\\n --description \"Revenue, churn and pipeline for the quarter\" \\\n --cover ./cover.png\n\n# Or after the fact, for an artifact that already exists:\ndreamlake artifact meta set q1-dashboard --description \"Revenue, churn and pipeline\"\ndreamlake artifact meta set q1-dashboard --cover ./cover.png\ndreamlake artifact meta show q1-dashboard\n\n# Back to the automatic description / the generated cover:\ndreamlake artifact meta set q1-dashboard --clear-description --clear-cover",
10
20
  "artifact share": "# Find the dashboard you already uploaded; no new version is needed.\ndreamlake artifact list\nARTIFACT=\"q1-dashboard\" # Replace with the id from list.\ndreamlake artifact share get \"$ARTIFACT\"\n\n# Give signed-in recipients read access, then verify the returned link.\ndreamlake artifact share create \"$ARTIFACT\"\ndreamlake artifact share get \"$ARTIFACT\"\n\n# When link access is no longer needed, revoke it and verify.\ndreamlake artifact share revoke \"$ARTIFACT\"\ndreamlake artifact share get \"$ARTIFACT\"",
@@ -130,6 +140,7 @@ export const helpExamples = {
130
140
  "memos share revoke": "MEMO=\"release-plan\" # Your existing memo id or slug.\ndreamlake memos share revoke \"$MEMO\" --revoke-accepted",
131
141
  "memos share access": "MEMO=\"release-plan\" # Your existing memo id or slug.\n# List acceptance records and stored roles as a readable table.\ndreamlake memos share access \"$MEMO\"",
132
142
  "memos share remove": "MEMO=\"release-plan\" # Your existing memo id or slug.\nUSER_ID=\"user-id-from-access-list\"\ndreamlake memos share remove \"$MEMO\" \"$USER_ID\"",
143
+ "memos permalink": "dreamlake memos permalink <memo-id> --namespace <namespace> --json\ndreamlake memos permalink <memo-id> --namespace <namespace> --slug my-article --json",
133
144
  "memos suggest-diff": "# Review a change as a new private note.\ndreamlake memos suggest-diff before.md after.md --user \"Docs review\" \\\n | dreamlake memos create \"Redline: release plan\" --file -\n# Propose edits inside the note itself; refuses changes it cannot express.\ndreamlake memos suggest-diff current.md edited.md --in-place --user \"$DREAMLAKE_AGENT_NAME\" > proposal.md\n# Count insertions, deletions, replacements and changed code blocks.\ndreamlake memos suggest-diff before.md after.md --json | jq .stats",
134
145
  "memos transfer": "dreamlake memos transfer MEMO_ID --namespace alice --to acme \\\n --dry-run --out note-transfer.json\n# Submit the exact reviewed file; the authorized destination member accepts separately.\ndreamlake memos transfer MEMO_ID --namespace alice --to acme \\\n --confirm --request-file note-transfer.json\n# If you also have destination acceptance authority:\ndreamlake memos transfer MEMO_ID --namespace alice --to acme \\\n --confirm --request-file note-transfer.json --accept-if-authorized --wait",
135
146
  "memos tag": "# Save the current content on the existing Memo.\ndreamlake memos tag MEMO_ID end-of-day --namespace my-org --summary \"Reviewed today's actions\"\n# Require the hash retained from a reviewed full read (not its opaque revision).\ndreamlake memos tag MEMO_ID reviewed --hash sha256:CONTENT_HASH --json\n# Connect this checkpoint to an earlier version in the same Memo.\ndreamlake memos tag MEMO_ID next-checkpoint --parent VERSION_ID\n# Read and validate without creating a version.\ndreamlake memos tag MEMO_ID preview --dry-run --json",
package/dist/cli/index.js CHANGED
@@ -33,6 +33,7 @@ import { registerTeamCommand } from "./team/index.js";
33
33
  import { registerPipelineCommand } from "./pipeline/index.js";
34
34
  import { registerWorkflowCommand } from "./workflow/index.js";
35
35
  import { registerPageCommand } from "./page/index.js";
36
+ import { registerAppsCommand } from "./apps/index.js";
36
37
  import { registerConnectionCommand } from "./connection/index.js";
37
38
  import { registerSourceCommand } from "./source/index.js";
38
39
  import { registerTasksCommand } from "./tasks/index.js";
@@ -205,6 +206,7 @@ async function main(argv) {
205
206
  registerProjectCommand(program);
206
207
  registerTasksCommand(program);
207
208
  registerConnectionCommand(program);
209
+ registerAppsCommand(program);
208
210
  // ─── declaration collections ─────────────────────────────────────
209
211
  //
210
212
  // `declare` writes the five head collections; `runnable` and
@@ -4,6 +4,7 @@ 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 { registerPermalinkCommand } from "./permalink-command.js";
7
8
  import { registerArchiveCommands } from "./archive-command.js";
8
9
  import { registerRmCommand } from "./rm-command.js";
9
10
  import { registerSuggestDiffCommand } from "./suggest-diff.js";
@@ -201,6 +202,7 @@ export function registerMemosCommand(program) {
201
202
  registerTransferCommand(notes);
202
203
  registerRmCommand(notes);
203
204
  registerArchiveCommands(notes);
205
+ registerPermalinkCommand(notes);
204
206
  registerSuggestDiffCommand(notes);
205
207
  // Same connection flags as the other ported groups, so --debug/--remote
206
208
  // behave identically across the CLI.
@@ -0,0 +1,7 @@
1
+ import type { Command } from 'commander';
2
+ import { type ConnOpts } from './index.js';
3
+ export declare function runMemosPermalink(ref: string, opts: ConnOpts & {
4
+ slug?: string;
5
+ json?: boolean;
6
+ }): Promise<number>;
7
+ export declare function registerPermalinkCommand(memos: Command): void;
@@ -0,0 +1,50 @@
1
+ import { memoHandle } from '../../api/memo-facade.js';
2
+ import { resolveCtx } from '../compat/ctx.js';
3
+ import { requireToken } from '../compat/http.js';
4
+ import { withConnFlags } from '../compat/flags.js';
5
+ import { emitJson, fail } from '../helpers.js';
6
+ import { memoTransport } from './api-transport.js';
7
+ import { ctx, resolveNote } from './index.js';
8
+ export async function runMemosPermalink(ref, opts) {
9
+ const c = resolveCtx(opts), token = requireToken(c);
10
+ if (!token)
11
+ return 1;
12
+ try {
13
+ let target = ref;
14
+ let namespace = opts.namespace?.trim().replace(/^@/, '') || undefined;
15
+ if (!/^[a-f0-9]{24}$/i.test(ref) && !ref.includes('/')) {
16
+ const scope = await ctx(opts);
17
+ if (!scope)
18
+ return 1;
19
+ const id = await resolveNote(scope, ref);
20
+ if (!id)
21
+ return 1;
22
+ target = id;
23
+ namespace = scope.ns;
24
+ }
25
+ const result = await memoHandle(memoTransport({ remote: c.remote, token }), target, { namespace })
26
+ .permalink(opts.slug === undefined ? {} : { slug: opts.slug });
27
+ if (opts.json)
28
+ emitJson(result);
29
+ else {
30
+ process.stdout.write(`${result.href}\n`);
31
+ for (const slug of result.aliases)
32
+ process.stdout.write(`Previous: ${slug}\n`);
33
+ }
34
+ return 0;
35
+ }
36
+ catch (error) {
37
+ // Reserved slugs are permanent conflicts, not RTC contention. Do not retry.
38
+ fail(error instanceof Error ? error.message : String(error));
39
+ return 1;
40
+ }
41
+ }
42
+ export function registerPermalinkCommand(memos) {
43
+ withConnFlags(memos.command('permalink').allowExcessArguments(false))
44
+ .description('get or allocate a public article URL, edit its slug, and list previous slugs')
45
+ .argument('<memo>', 'memo id, qualified reference, internal slug or exact title')
46
+ .option('--namespace <slug>', 'lookup namespace; with an id, asserts the owner')
47
+ .option('--slug <slug>', 'set the public URL slug; retain previous URLs')
48
+ .option('--json', 'emit current URL, namespace and alias history')
49
+ .action(async (memo, opts) => { process.exitCode = await runMemosPermalink(memo, opts); });
50
+ }
@@ -1 +1 @@
1
- export declare const VERSION = "0.107.2";
1
+ export declare const VERSION = "0.109.0";
@@ -6,4 +6,4 @@
6
6
  // value means a binary that re-installs the same version forever.
7
7
  //
8
8
  // Editing this by hand does nothing for a release; bump package.json.
9
- export const VERSION = "0.107.2";
9
+ export const VERSION = "0.109.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreamlake/dreamlake-cli",
3
- "version": "0.107.2",
3
+ "version": "0.109.0",
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.107.2",
40
- "@dreamlake/dreamlake-cli-darwin-x64": "0.107.2",
41
- "@dreamlake/dreamlake-cli-linux-x64": "0.107.2",
42
- "@dreamlake/dreamlake-cli-linux-arm64": "0.107.2",
43
- "@dreamlake/dreamlake-cli-linux-x64-musl": "0.107.2",
44
- "@dreamlake/dreamlake-cli-linux-arm64-musl": "0.107.2",
45
- "@dreamlake/dreamlake-cli-win32-x64": "0.107.2",
46
- "@dreamlake/dreamlake-cli-win32-arm64": "0.107.2"
39
+ "@dreamlake/dreamlake-cli-darwin-arm64": "0.109.0",
40
+ "@dreamlake/dreamlake-cli-darwin-x64": "0.109.0",
41
+ "@dreamlake/dreamlake-cli-linux-x64": "0.109.0",
42
+ "@dreamlake/dreamlake-cli-linux-arm64": "0.109.0",
43
+ "@dreamlake/dreamlake-cli-linux-x64-musl": "0.109.0",
44
+ "@dreamlake/dreamlake-cli-linux-arm64-musl": "0.109.0",
45
+ "@dreamlake/dreamlake-cli-win32-x64": "0.109.0",
46
+ "@dreamlake/dreamlake-cli-win32-arm64": "0.109.0"
47
47
  }
48
48
  }