@dreamlake/dreamlake-cli 0.107.0 → 0.107.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/bindrs.d.ts +76 -0
- package/dist/api/bindrs.js +83 -0
- package/dist/api/client.d.ts +3 -0
- package/dist/api/client.js +4 -1
- package/dist/api/common.js +2 -2
- package/dist/api/execution.js +4 -4
- package/dist/api/host-moves.js +2 -2
- package/dist/api/index.d.ts +126 -14
- package/dist/api/memo-facade.d.ts +1 -1
- package/dist/api/memo-facade.js +2 -2
- package/dist/api/memo-reading.js +2 -2
- package/dist/api/memos.d.ts +2 -2
- package/dist/api/memos.js +3 -3
- package/dist/api/native-experiments.js +2 -2
- package/dist/api/platform.js +6 -6
- package/dist/api/sessions.js +5 -5
- package/dist/api/workspace.d.ts +66 -8
- package/dist/api/workspace.js +4 -10
- package/dist/cli/create/index.d.ts +1 -0
- package/dist/cli/create/index.js +23 -9
- package/dist/cli/delete/index.js +13 -4
- package/dist/cli/help-examples.generated.js +3 -1
- package/dist/cli/list/index.js +5 -7
- package/dist/cli/memos/index.d.ts +1 -0
- package/dist/cli/memos/index.js +11 -2
- package/dist/cli/resources.d.ts +2 -0
- package/dist/cli/resources.js +17 -3
- package/dist/cli/self-update/index.js +6 -4
- package/dist/cli/self-update/install.d.ts +5 -1
- package/dist/cli/self-update/install.js +28 -86
- package/dist/cli/self-update/shell-path.d.ts +4 -0
- package/dist/cli/self-update/shell-path.js +135 -0
- package/dist/cli/share.js +3 -3
- package/dist/cli/update/index.js +29 -65
- package/dist/cli/version.d.ts +1 -1
- package/dist/cli/version.js +1 -1
- package/package.json +9 -9
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type Transport } from "./client.js";
|
|
2
|
+
import { type Query, type Resource } from "./common.js";
|
|
3
|
+
export interface Bindr extends Resource {
|
|
4
|
+
name: string;
|
|
5
|
+
parent: string | null;
|
|
6
|
+
projectNodeId: string;
|
|
7
|
+
description: string | null;
|
|
8
|
+
tags: string[];
|
|
9
|
+
memberCount?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface BindrInput {
|
|
12
|
+
name: string;
|
|
13
|
+
description?: string | null;
|
|
14
|
+
tags?: string[];
|
|
15
|
+
parent?: string | null;
|
|
16
|
+
member?: {
|
|
17
|
+
nodeId: string;
|
|
18
|
+
};
|
|
19
|
+
/** Legacy bulk input; composed into singular requests, not atomic. */
|
|
20
|
+
members?: string[];
|
|
21
|
+
}
|
|
22
|
+
export interface BindrDetail {
|
|
23
|
+
bindr: Bindr;
|
|
24
|
+
members: Array<{
|
|
25
|
+
nodeId: string;
|
|
26
|
+
name: string;
|
|
27
|
+
kind: string;
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
}>;
|
|
30
|
+
page: number;
|
|
31
|
+
pageSize: number;
|
|
32
|
+
total: number;
|
|
33
|
+
totalPages: number;
|
|
34
|
+
}
|
|
35
|
+
/** Earlier requests succeeded; the failed request may have reached the server. */
|
|
36
|
+
export declare class BindrMembersError extends Error {
|
|
37
|
+
readonly bindrId: string;
|
|
38
|
+
readonly completedNodeIds: string[];
|
|
39
|
+
readonly failedNodeId: string;
|
|
40
|
+
constructor(bindrId: string, completedNodeIds: string[], failedNodeId: string, cause: unknown);
|
|
41
|
+
}
|
|
42
|
+
/** Collection operations are project-scoped; item operations accept IDs or exact names. */
|
|
43
|
+
export declare function bindrsApi(t: Transport, namespace: string, project: string): {
|
|
44
|
+
list: (query?: Query) => Promise<{
|
|
45
|
+
bindrs: Bindr[];
|
|
46
|
+
}>;
|
|
47
|
+
create: (input: BindrInput) => Promise<{
|
|
48
|
+
bindr: Bindr;
|
|
49
|
+
}>;
|
|
50
|
+
get: (nameOrId: string, query?: Query) => Promise<BindrDetail>;
|
|
51
|
+
summary: (nameOrId: string) => Promise<{
|
|
52
|
+
bindr: Bindr;
|
|
53
|
+
}>;
|
|
54
|
+
update: (nameOrId: string, input: Partial<Omit<BindrInput, "member" | "members">>) => Promise<{
|
|
55
|
+
bindr: Bindr;
|
|
56
|
+
}>;
|
|
57
|
+
delete: (nameOrId: string) => Promise<{
|
|
58
|
+
deleted: boolean;
|
|
59
|
+
}>;
|
|
60
|
+
addMember: (nameOrId: string, nodeId: string) => Promise<{
|
|
61
|
+
added: boolean;
|
|
62
|
+
memberCount: number;
|
|
63
|
+
}>;
|
|
64
|
+
removeMember: (nameOrId: string, nodeId: string) => Promise<{
|
|
65
|
+
removed: boolean;
|
|
66
|
+
memberCount: number;
|
|
67
|
+
}>;
|
|
68
|
+
addMembers: (nameOrId: string, nodeIds: string[]) => Promise<{
|
|
69
|
+
completedNodeIds: string[];
|
|
70
|
+
memberCount: number | undefined;
|
|
71
|
+
}>;
|
|
72
|
+
removeMembers: (nameOrId: string, nodeIds: string[]) => Promise<{
|
|
73
|
+
completedNodeIds: string[];
|
|
74
|
+
memberCount: number | undefined;
|
|
75
|
+
}>;
|
|
76
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { seg } from "./client.js";
|
|
2
|
+
import { call, namespacePath } from "./common.js";
|
|
3
|
+
/** Earlier requests succeeded; the failed request may have reached the server. */
|
|
4
|
+
export class BindrMembersError extends Error {
|
|
5
|
+
bindrId;
|
|
6
|
+
completedNodeIds;
|
|
7
|
+
failedNodeId;
|
|
8
|
+
constructor(bindrId, completedNodeIds, failedNodeId, cause) {
|
|
9
|
+
super(`Bindr ${bindrId}: ${completedNodeIds.length} member request(s) confirmed; request for ${failedNodeId} failed (outcome may be unknown): ${cause instanceof Error ? cause.message : String(cause)}`, { cause });
|
|
10
|
+
this.bindrId = bindrId;
|
|
11
|
+
this.completedNodeIds = completedNodeIds;
|
|
12
|
+
this.failedNodeId = failedNodeId;
|
|
13
|
+
this.name = "BindrMembersError";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/** Collection operations are project-scoped; item operations accept IDs or exact names. */
|
|
17
|
+
export function bindrsApi(t, namespace, project) {
|
|
18
|
+
const base = `${namespacePath(namespace)}/projects/${seg(project)}/bindrs`;
|
|
19
|
+
const path = (id) => `/bindrs/${seg(id)}`;
|
|
20
|
+
const list = (query = {}) => call(t, "GET", base, undefined, query);
|
|
21
|
+
async function resolveId(nameOrId) {
|
|
22
|
+
const { bindrs } = await list();
|
|
23
|
+
const byId = bindrs.find(row => row.id === nameOrId);
|
|
24
|
+
if (byId)
|
|
25
|
+
return byId.id;
|
|
26
|
+
const matches = bindrs.filter(row => row.name === nameOrId);
|
|
27
|
+
if (!matches.length)
|
|
28
|
+
throw new Error(`bindr '${nameOrId}' not found in ${project}`);
|
|
29
|
+
if (matches.length > 1)
|
|
30
|
+
throw new Error(`bindr '${nameOrId}' is ambiguous; use its ID (${matches.map(row => row.id).join(", ")})`);
|
|
31
|
+
return matches[0].id;
|
|
32
|
+
}
|
|
33
|
+
async function members(method, id, nodeIds) {
|
|
34
|
+
const completedNodeIds = [];
|
|
35
|
+
let memberCount;
|
|
36
|
+
for (const nodeId of nodeIds) {
|
|
37
|
+
try {
|
|
38
|
+
const result = await call(t, method, path(id) + "/members", { nodeId });
|
|
39
|
+
memberCount = result.memberCount;
|
|
40
|
+
completedNodeIds.push(nodeId);
|
|
41
|
+
}
|
|
42
|
+
catch (cause) {
|
|
43
|
+
throw new BindrMembersError(id, completedNodeIds, nodeId, cause);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return { completedNodeIds, memberCount };
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
list,
|
|
50
|
+
create: async (input) => {
|
|
51
|
+
const { members: legacyMembers = [], ...body } = input;
|
|
52
|
+
if (!Array.isArray(legacyMembers) || legacyMembers.some(id => typeof id !== "string" || !id.trim()))
|
|
53
|
+
throw new Error("Bindr members must be node IDs");
|
|
54
|
+
const nodeIds = [...new Set([...(body.member ? [body.member.nodeId] : []), ...legacyMembers])];
|
|
55
|
+
const [first, ...rest] = nodeIds;
|
|
56
|
+
const result = await call(t, "POST", base, {
|
|
57
|
+
...body, ...(first ? { member: { nodeId: first } } : {}),
|
|
58
|
+
});
|
|
59
|
+
if (!result?.bindr || typeof result.bindr.id !== "string" || !result.bindr.id.trim())
|
|
60
|
+
throw new Error("Bindr creation returned success without a usable ID; creation outcome is unknown. Inspect the project before retrying; no further membership requests were sent.");
|
|
61
|
+
if (rest.length) {
|
|
62
|
+
try {
|
|
63
|
+
const progress = await members("POST", result.bindr.id, rest);
|
|
64
|
+
result.bindr.memberCount = progress.memberCount;
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
if (error instanceof BindrMembersError)
|
|
68
|
+
throw new BindrMembersError(result.bindr.id, [first, ...error.completedNodeIds], error.failedNodeId, error.cause);
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return result;
|
|
73
|
+
},
|
|
74
|
+
get: async (nameOrId, query = {}) => call(t, "GET", path(await resolveId(nameOrId)), undefined, query),
|
|
75
|
+
summary: async (nameOrId) => call(t, "GET", path(await resolveId(nameOrId)) + "/summary"),
|
|
76
|
+
update: async (nameOrId, input) => call(t, "PATCH", path(await resolveId(nameOrId)), input),
|
|
77
|
+
delete: async (nameOrId) => call(t, "DELETE", path(await resolveId(nameOrId))),
|
|
78
|
+
addMember: async (nameOrId, nodeId) => call(t, "POST", path(await resolveId(nameOrId)) + "/members", { nodeId }),
|
|
79
|
+
removeMember: async (nameOrId, nodeId) => call(t, "DELETE", path(await resolveId(nameOrId)) + "/members", { nodeId }),
|
|
80
|
+
addMembers: async (nameOrId, nodeIds) => members("POST", await resolveId(nameOrId), nodeIds),
|
|
81
|
+
removeMembers: async (nameOrId, nodeIds) => members("DELETE", await resolveId(nameOrId), nodeIds),
|
|
82
|
+
};
|
|
83
|
+
}
|
package/dist/api/client.d.ts
CHANGED
|
@@ -50,5 +50,8 @@ export interface Transport {
|
|
|
50
50
|
raw?(method: Method, path: string, options?: RequestOptions): Promise<Response>;
|
|
51
51
|
}
|
|
52
52
|
export declare function createTransport(options: ClientOptions): Transport;
|
|
53
|
+
/** Encode a literal resource identifier without changing its identity. */
|
|
53
54
|
export declare const seg: (value: string) => string;
|
|
55
|
+
/** Only namespace shorthand treats a leading @ as syntax. */
|
|
56
|
+
export declare const namespaceSeg: (value: string) => string;
|
|
54
57
|
export declare const isObjectId: (value: unknown) => value is string;
|
package/dist/api/client.js
CHANGED
|
@@ -84,7 +84,10 @@ export function createTransport(options) {
|
|
|
84
84
|
},
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
/** Encode a literal resource identifier without changing its identity. */
|
|
88
|
+
export const seg = (value) => encodeURIComponent(value);
|
|
89
|
+
/** Only namespace shorthand treats a leading @ as syntax. */
|
|
90
|
+
export const namespaceSeg = (value) => seg(value.replace(/^@/, ""));
|
|
88
91
|
export const isObjectId = (value) => typeof value === "string" && /^[a-f0-9]{24}$/.test(value);
|
|
89
92
|
/** Construct domain APIs over an authenticated transport, e.g. Fastify injection. */
|
|
90
93
|
function apiFailure(error) {
|
package/dist/api/common.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { seg, } from "./client.js";
|
|
2
|
-
export const namespacePath = (namespace) => `/namespaces/${
|
|
1
|
+
import { namespaceSeg, seg, } from "./client.js";
|
|
2
|
+
export const namespacePath = (namespace) => `/namespaces/${namespaceSeg(namespace)}`;
|
|
3
3
|
export function resourceApi(t, base) {
|
|
4
4
|
return {
|
|
5
5
|
list: (query = {}) => t.request("GET", base, { query }),
|
package/dist/api/execution.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApiError, seg } from "./client.js";
|
|
1
|
+
import { ApiError, namespaceSeg, seg } from "./client.js";
|
|
2
2
|
import { namespacePath, call, } from "./common.js";
|
|
3
3
|
export function runsApi(t, namespace) {
|
|
4
4
|
const base = namespacePath(namespace) + "/runs";
|
|
@@ -50,12 +50,12 @@ export function queuesApi(t, namespace) {
|
|
|
50
50
|
token: (prefix, token) => call(t, "PATCH", p(prefix), { token }),
|
|
51
51
|
proxy: (prefix, lakeshoreNamespace, kind, query = {}) => call(t, "GET", p(prefix) +
|
|
52
52
|
"/proxy/v1/namespaces/" +
|
|
53
|
-
|
|
53
|
+
namespaceSeg(lakeshoreNamespace) +
|
|
54
54
|
"/" +
|
|
55
55
|
kind, undefined, query),
|
|
56
|
-
worker: (prefix, lakeshoreNamespace, workerId) => call(t, "GET", p(prefix) + "/proxy/v1/namespaces/" +
|
|
56
|
+
worker: (prefix, lakeshoreNamespace, workerId) => call(t, "GET", p(prefix) + "/proxy/v1/namespaces/" + namespaceSeg(lakeshoreNamespace) + "/workers/" + seg(workerId)),
|
|
57
57
|
// Future business claims only; heartbeat, control and remote exec continue.
|
|
58
|
-
setWorkerClaimJobs: (prefix, lakeshoreNamespace, workerId, enabled) => call(t, "POST", p(prefix) + "/proxy/v1/namespaces/" +
|
|
58
|
+
setWorkerClaimJobs: (prefix, lakeshoreNamespace, workerId, enabled) => call(t, "POST", p(prefix) + "/proxy/v1/namespaces/" + namespaceSeg(lakeshoreNamespace) + "/workers/" + seg(workerId) + "/claim-jobs", { enabled }),
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
export async function submitRun(t, namespace, input) {
|
package/dist/api/host-moves.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { namespaceSeg } from './client.js';
|
|
2
2
|
const nonempty = (v) => typeof v === 'string' && v.length > 0 && v.length <= 256 && !/[\x00-\x1f\x7f]/.test(v);
|
|
3
3
|
const invalid = () => { throw new Error('Host move response could not be verified. Keep the same request and reconcile before retrying.'); };
|
|
4
4
|
const base = (namespace, hostId) => {
|
|
5
5
|
if (!nonempty(namespace) || !/^[a-f0-9]{24}$/.test(hostId))
|
|
6
6
|
invalid();
|
|
7
|
-
return `/namespaces/${
|
|
7
|
+
return `/namespaces/${namespaceSeg(namespace)}/hosts/${hostId}/move`;
|
|
8
8
|
};
|
|
9
9
|
export function validateHostMoveSessions(value) {
|
|
10
10
|
if (value === undefined)
|
package/dist/api/index.d.ts
CHANGED
|
@@ -716,6 +716,39 @@ export declare function createApi(transport: Transport): {
|
|
|
716
716
|
totalPages: number;
|
|
717
717
|
}>;
|
|
718
718
|
resources: (project: string, kind: "bindrs" | "datasets" | "episodes") => {
|
|
719
|
+
list: (query?: import("./common.js").Query) => Promise<{
|
|
720
|
+
bindrs: import("./bindrs.js").Bindr[];
|
|
721
|
+
}>;
|
|
722
|
+
create: (input: import("./bindrs.js").BindrInput) => Promise<{
|
|
723
|
+
bindr: import("./bindrs.js").Bindr;
|
|
724
|
+
}>;
|
|
725
|
+
get: (nameOrId: string, query?: import("./common.js").Query) => Promise<import("./bindrs.js").BindrDetail>;
|
|
726
|
+
summary: (nameOrId: string) => Promise<{
|
|
727
|
+
bindr: import("./bindrs.js").Bindr;
|
|
728
|
+
}>;
|
|
729
|
+
update: (nameOrId: string, input: Partial<Omit<import("./bindrs.js").BindrInput, "member" | "members">>) => Promise<{
|
|
730
|
+
bindr: import("./bindrs.js").Bindr;
|
|
731
|
+
}>;
|
|
732
|
+
delete: (nameOrId: string) => Promise<{
|
|
733
|
+
deleted: boolean;
|
|
734
|
+
}>;
|
|
735
|
+
addMember: (nameOrId: string, nodeId: string) => Promise<{
|
|
736
|
+
added: boolean;
|
|
737
|
+
memberCount: number;
|
|
738
|
+
}>;
|
|
739
|
+
removeMember: (nameOrId: string, nodeId: string) => Promise<{
|
|
740
|
+
removed: boolean;
|
|
741
|
+
memberCount: number;
|
|
742
|
+
}>;
|
|
743
|
+
addMembers: (nameOrId: string, nodeIds: string[]) => Promise<{
|
|
744
|
+
completedNodeIds: string[];
|
|
745
|
+
memberCount: number | undefined;
|
|
746
|
+
}>;
|
|
747
|
+
removeMembers: (nameOrId: string, nodeIds: string[]) => Promise<{
|
|
748
|
+
completedNodeIds: string[];
|
|
749
|
+
memberCount: number | undefined;
|
|
750
|
+
}>;
|
|
751
|
+
} | {
|
|
719
752
|
list: (query?: import("./common.js").Query) => Promise<{
|
|
720
753
|
[key: string]: unknown;
|
|
721
754
|
}>;
|
|
@@ -725,15 +758,38 @@ export declare function createApi(transport: Transport): {
|
|
|
725
758
|
delete: (id: string) => Promise<unknown>;
|
|
726
759
|
};
|
|
727
760
|
bindrs: (project: string) => {
|
|
728
|
-
addMembers: (name: string, add: string[]) => Promise<unknown>;
|
|
729
|
-
removeMembers: (name: string, remove: string[]) => Promise<unknown>;
|
|
730
761
|
list: (query?: import("./common.js").Query) => Promise<{
|
|
731
|
-
|
|
762
|
+
bindrs: import("./bindrs.js").Bindr[];
|
|
763
|
+
}>;
|
|
764
|
+
create: (input: import("./bindrs.js").BindrInput) => Promise<{
|
|
765
|
+
bindr: import("./bindrs.js").Bindr;
|
|
766
|
+
}>;
|
|
767
|
+
get: (nameOrId: string, query?: import("./common.js").Query) => Promise<import("./bindrs.js").BindrDetail>;
|
|
768
|
+
summary: (nameOrId: string) => Promise<{
|
|
769
|
+
bindr: import("./bindrs.js").Bindr;
|
|
770
|
+
}>;
|
|
771
|
+
update: (nameOrId: string, input: Partial<Omit<import("./bindrs.js").BindrInput, "member" | "members">>) => Promise<{
|
|
772
|
+
bindr: import("./bindrs.js").Bindr;
|
|
773
|
+
}>;
|
|
774
|
+
delete: (nameOrId: string) => Promise<{
|
|
775
|
+
deleted: boolean;
|
|
776
|
+
}>;
|
|
777
|
+
addMember: (nameOrId: string, nodeId: string) => Promise<{
|
|
778
|
+
added: boolean;
|
|
779
|
+
memberCount: number;
|
|
780
|
+
}>;
|
|
781
|
+
removeMember: (nameOrId: string, nodeId: string) => Promise<{
|
|
782
|
+
removed: boolean;
|
|
783
|
+
memberCount: number;
|
|
784
|
+
}>;
|
|
785
|
+
addMembers: (nameOrId: string, nodeIds: string[]) => Promise<{
|
|
786
|
+
completedNodeIds: string[];
|
|
787
|
+
memberCount: number | undefined;
|
|
788
|
+
}>;
|
|
789
|
+
removeMembers: (nameOrId: string, nodeIds: string[]) => Promise<{
|
|
790
|
+
completedNodeIds: string[];
|
|
791
|
+
memberCount: number | undefined;
|
|
732
792
|
}>;
|
|
733
|
-
get: (id: string) => Promise<import("./common.js").Resource>;
|
|
734
|
-
create: (input: import("./common.js").JsonObject) => Promise<import("./common.js").Resource>;
|
|
735
|
-
update: (id: string, input: Partial<import("./common.js").JsonObject>) => Promise<import("./common.js").Resource>;
|
|
736
|
-
delete: (id: string) => Promise<unknown>;
|
|
737
793
|
};
|
|
738
794
|
datasets: (project: string) => {
|
|
739
795
|
addBindrs: (name: string, add: string[]) => Promise<unknown>;
|
|
@@ -1929,6 +1985,39 @@ export declare function createClient(options: ClientOptions): {
|
|
|
1929
1985
|
totalPages: number;
|
|
1930
1986
|
}>;
|
|
1931
1987
|
resources: (project: string, kind: "bindrs" | "datasets" | "episodes") => {
|
|
1988
|
+
list: (query?: import("./common.js").Query) => Promise<{
|
|
1989
|
+
bindrs: import("./bindrs.js").Bindr[];
|
|
1990
|
+
}>;
|
|
1991
|
+
create: (input: import("./bindrs.js").BindrInput) => Promise<{
|
|
1992
|
+
bindr: import("./bindrs.js").Bindr;
|
|
1993
|
+
}>;
|
|
1994
|
+
get: (nameOrId: string, query?: import("./common.js").Query) => Promise<import("./bindrs.js").BindrDetail>;
|
|
1995
|
+
summary: (nameOrId: string) => Promise<{
|
|
1996
|
+
bindr: import("./bindrs.js").Bindr;
|
|
1997
|
+
}>;
|
|
1998
|
+
update: (nameOrId: string, input: Partial<Omit<import("./bindrs.js").BindrInput, "member" | "members">>) => Promise<{
|
|
1999
|
+
bindr: import("./bindrs.js").Bindr;
|
|
2000
|
+
}>;
|
|
2001
|
+
delete: (nameOrId: string) => Promise<{
|
|
2002
|
+
deleted: boolean;
|
|
2003
|
+
}>;
|
|
2004
|
+
addMember: (nameOrId: string, nodeId: string) => Promise<{
|
|
2005
|
+
added: boolean;
|
|
2006
|
+
memberCount: number;
|
|
2007
|
+
}>;
|
|
2008
|
+
removeMember: (nameOrId: string, nodeId: string) => Promise<{
|
|
2009
|
+
removed: boolean;
|
|
2010
|
+
memberCount: number;
|
|
2011
|
+
}>;
|
|
2012
|
+
addMembers: (nameOrId: string, nodeIds: string[]) => Promise<{
|
|
2013
|
+
completedNodeIds: string[];
|
|
2014
|
+
memberCount: number | undefined;
|
|
2015
|
+
}>;
|
|
2016
|
+
removeMembers: (nameOrId: string, nodeIds: string[]) => Promise<{
|
|
2017
|
+
completedNodeIds: string[];
|
|
2018
|
+
memberCount: number | undefined;
|
|
2019
|
+
}>;
|
|
2020
|
+
} | {
|
|
1932
2021
|
list: (query?: import("./common.js").Query) => Promise<{
|
|
1933
2022
|
[key: string]: unknown;
|
|
1934
2023
|
}>;
|
|
@@ -1938,15 +2027,38 @@ export declare function createClient(options: ClientOptions): {
|
|
|
1938
2027
|
delete: (id: string) => Promise<unknown>;
|
|
1939
2028
|
};
|
|
1940
2029
|
bindrs: (project: string) => {
|
|
1941
|
-
addMembers: (name: string, add: string[]) => Promise<unknown>;
|
|
1942
|
-
removeMembers: (name: string, remove: string[]) => Promise<unknown>;
|
|
1943
2030
|
list: (query?: import("./common.js").Query) => Promise<{
|
|
1944
|
-
|
|
2031
|
+
bindrs: import("./bindrs.js").Bindr[];
|
|
2032
|
+
}>;
|
|
2033
|
+
create: (input: import("./bindrs.js").BindrInput) => Promise<{
|
|
2034
|
+
bindr: import("./bindrs.js").Bindr;
|
|
2035
|
+
}>;
|
|
2036
|
+
get: (nameOrId: string, query?: import("./common.js").Query) => Promise<import("./bindrs.js").BindrDetail>;
|
|
2037
|
+
summary: (nameOrId: string) => Promise<{
|
|
2038
|
+
bindr: import("./bindrs.js").Bindr;
|
|
2039
|
+
}>;
|
|
2040
|
+
update: (nameOrId: string, input: Partial<Omit<import("./bindrs.js").BindrInput, "member" | "members">>) => Promise<{
|
|
2041
|
+
bindr: import("./bindrs.js").Bindr;
|
|
2042
|
+
}>;
|
|
2043
|
+
delete: (nameOrId: string) => Promise<{
|
|
2044
|
+
deleted: boolean;
|
|
2045
|
+
}>;
|
|
2046
|
+
addMember: (nameOrId: string, nodeId: string) => Promise<{
|
|
2047
|
+
added: boolean;
|
|
2048
|
+
memberCount: number;
|
|
2049
|
+
}>;
|
|
2050
|
+
removeMember: (nameOrId: string, nodeId: string) => Promise<{
|
|
2051
|
+
removed: boolean;
|
|
2052
|
+
memberCount: number;
|
|
2053
|
+
}>;
|
|
2054
|
+
addMembers: (nameOrId: string, nodeIds: string[]) => Promise<{
|
|
2055
|
+
completedNodeIds: string[];
|
|
2056
|
+
memberCount: number | undefined;
|
|
2057
|
+
}>;
|
|
2058
|
+
removeMembers: (nameOrId: string, nodeIds: string[]) => Promise<{
|
|
2059
|
+
completedNodeIds: string[];
|
|
2060
|
+
memberCount: number | undefined;
|
|
1945
2061
|
}>;
|
|
1946
|
-
get: (id: string) => Promise<import("./common.js").Resource>;
|
|
1947
|
-
create: (input: import("./common.js").JsonObject) => Promise<import("./common.js").Resource>;
|
|
1948
|
-
update: (id: string, input: Partial<import("./common.js").JsonObject>) => Promise<import("./common.js").Resource>;
|
|
1949
|
-
delete: (id: string) => Promise<unknown>;
|
|
1950
2062
|
};
|
|
1951
2063
|
datasets: (project: string) => {
|
|
1952
2064
|
addBindrs: (name: string, add: string[]) => Promise<unknown>;
|
|
@@ -248,7 +248,7 @@ export interface MemosFacade {
|
|
|
248
248
|
namespace: string;
|
|
249
249
|
name?: string;
|
|
250
250
|
text?: string;
|
|
251
|
-
visibility?: "private" | "public";
|
|
251
|
+
visibility?: "private" | "public" | "unlisted";
|
|
252
252
|
projects?: string[];
|
|
253
253
|
}): Promise<CreatedMemo>;
|
|
254
254
|
/** The namespace-scoped API for a dynamic namespace (a bare literal, `dl.notes("fortyfive")`, is the same object). */
|
package/dist/api/memo-facade.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* `at` is a snapshot or a bare revision; a content hash is never accepted in
|
|
14
14
|
* its place. Edits compile to the same PATCH as the CLI through note-write.ts. */
|
|
15
15
|
import { createHash } from "node:crypto";
|
|
16
|
-
import {
|
|
16
|
+
import { namespaceSeg } from "./client.js";
|
|
17
17
|
import { RequestNotSent } from "./http.js";
|
|
18
18
|
import { documentInsertion, memoEdits } from "./memo-edits.js";
|
|
19
19
|
import * as editing from "./memo-editing.js";
|
|
@@ -362,7 +362,7 @@ export function memosFacade(t) {
|
|
|
362
362
|
// Initial source is a second, unconditional write (as the CLI does); atomic creation is a server target.
|
|
363
363
|
if (text !== undefined) {
|
|
364
364
|
try {
|
|
365
|
-
await t.request("PUT", `/namespaces/${
|
|
365
|
+
await t.request("PUT", `/namespaces/${namespaceSeg(namespace)}/notes/${created.note.id}/body`, { json: { text }, redirect: "error" });
|
|
366
366
|
}
|
|
367
367
|
catch (error) {
|
|
368
368
|
const status = failureInfo(error).status;
|
package/dist/api/memo-reading.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { isObjectId,
|
|
1
|
+
import { isObjectId, namespaceSeg } from './client.js';
|
|
2
2
|
/** Same addressed, revision-pinned reading contract as the built-in agent. */
|
|
3
3
|
export async function readMemoView(t, namespace, note, options = {}) {
|
|
4
4
|
if (!isObjectId(note))
|
|
5
5
|
throw new Error('expected a 24-hex memo id');
|
|
6
6
|
if ((options.start ?? 0) > 0 && !options.at)
|
|
7
7
|
throw new Error('reading continuation requires the original revision');
|
|
8
|
-
const page = await t.request('GET', `/namespaces/${
|
|
8
|
+
const page = await t.request('GET', `/namespaces/${namespaceSeg(namespace)}/notes/${note}/body`, { query: { contract: 'v2', view: 'reading', ...options } });
|
|
9
9
|
if (page.note !== note || typeof page.revision !== 'string' || !page.revision || /[\r\n]/.test(page.revision) || options.at && page.revision !== options.at ||
|
|
10
10
|
!/^sha256:[a-f0-9]{64}$/.test(page.hash) || typeof page.text !== 'string' || !['markdown', 'html'].includes(page.sourceType) || typeof page.scope !== 'string' ||
|
|
11
11
|
![page.start, page.end, page.total].every(n => Number.isSafeInteger(n) && n >= 0) || page.start !== (options.start ?? 0) || page.end < page.start || page.end > page.total ||
|
package/dist/api/memos.d.ts
CHANGED
|
@@ -154,7 +154,7 @@ export declare function memosApi(t: Transport, namespace: string): {
|
|
|
154
154
|
get: () => Promise<Record<string, unknown>>;
|
|
155
155
|
create: (role?: "read" | "write") => Promise<unknown>;
|
|
156
156
|
revoke: (revokeAccepted?: boolean) => Promise<unknown>;
|
|
157
|
-
visibility: (visibility: "
|
|
157
|
+
visibility: (visibility: import("./workspace.js").MemoVisibility) => Promise<unknown>;
|
|
158
158
|
access: () => Promise<unknown>;
|
|
159
159
|
remove: (userId: string) => Promise<unknown>;
|
|
160
160
|
};
|
|
@@ -258,7 +258,7 @@ export declare function memosApi(t: Transport, namespace: string): {
|
|
|
258
258
|
name: string;
|
|
259
259
|
summary?: string;
|
|
260
260
|
projects?: string[];
|
|
261
|
-
visibility?: "private" | "public";
|
|
261
|
+
visibility?: "private" | "public" | "unlisted";
|
|
262
262
|
}) => Promise<{
|
|
263
263
|
note: MemoRow;
|
|
264
264
|
rtc: {
|
package/dist/api/memos.js
CHANGED
|
@@ -12,10 +12,10 @@ import { sharingApi } from "./workspace.js";
|
|
|
12
12
|
import { createHash } from "node:crypto";
|
|
13
13
|
import { memoEdits, } from "./memo-edits.js";
|
|
14
14
|
export { memoEdits, noteEdits, } from "./memo-edits.js";
|
|
15
|
-
import { ApiError, isObjectId, seg } from "./client.js";
|
|
15
|
+
import { ApiError, isObjectId, namespaceSeg, seg } from "./client.js";
|
|
16
16
|
import { submitMemoPatch, readMemoCommand, validateCommandId, refuseNewReadingViewLines } from "./memo-write.js";
|
|
17
17
|
export function memosApi(t, namespace) {
|
|
18
|
-
const base = `/namespaces/${
|
|
18
|
+
const base = `/namespaces/${namespaceSeg(namespace)}/notes`;
|
|
19
19
|
const id = (value) => {
|
|
20
20
|
if (!isObjectId(value))
|
|
21
21
|
throw new Error("expected a 24-hex memo id");
|
|
@@ -121,7 +121,7 @@ export function memosApi(t, namespace) {
|
|
|
121
121
|
unarchive: (noteId) => t.request("PATCH", `${base}/${id(noteId)}`, { json: { archived: false } }),
|
|
122
122
|
delete: (noteId) => t.request("DELETE", `${base}/${id(noteId)}`),
|
|
123
123
|
shared: (query = {}) => t.request("GET", "/me/notes/shared", { query }),
|
|
124
|
-
projects: (noteId, view) => t.request("GET", `/namespaces/${
|
|
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
126
|
share: (noteId) => sharingApi(t, namespace, "notes", id(noteId)),
|
|
127
127
|
files: (noteId) => memoFilesApi(t, `${base}/${id(noteId)}`),
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
import { seg } from "./client.js";
|
|
2
|
+
import { namespaceSeg, seg } from "./client.js";
|
|
3
3
|
import { call } from "./common.js";
|
|
4
4
|
function trackQuery(q) {
|
|
5
5
|
return { start_timestamp: q.startTimestamp, end_timestamp: q.endTimestamp, columns: q.columns?.join(","), format: q.format };
|
|
6
6
|
}
|
|
7
7
|
export function nativeExperimentPaths(namespace, project) {
|
|
8
|
-
const base = `/native-experiments/ns/${
|
|
8
|
+
const base = `/native-experiments/ns/${namespaceSeg(namespace)}/projects/${seg(project)}`;
|
|
9
9
|
const run = (id) => `${base}/runs/${seg(id)}`;
|
|
10
10
|
return {
|
|
11
11
|
base,
|
package/dist/api/platform.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { seg } from "./client.js";
|
|
1
|
+
import { namespaceSeg, seg } from "./client.js";
|
|
2
2
|
import { call, resourceApi, namespacePath, } from "./common.js";
|
|
3
3
|
export function platformApi(t, namespace) {
|
|
4
4
|
const ns = namespacePath(namespace);
|
|
@@ -7,10 +7,10 @@ export function platformApi(t, namespace) {
|
|
|
7
7
|
storage: resourceApi(t, ns + "/lakeshore-storages"),
|
|
8
8
|
queueDefinitions: resourceApi(t, ns + "/lakeshore-queue-defs"),
|
|
9
9
|
experiments: {
|
|
10
|
-
workspaces: () => call(t, "GET", "/integrations/dash/ns/" +
|
|
11
|
-
binding: () => call(t, "GET", "/integrations/dash/ns/" +
|
|
12
|
-
connect: (input) => call(t, "PUT", "/integrations/dash/ns/" +
|
|
13
|
-
disconnect: (expectedRevision) => call(t, "DELETE", "/integrations/dash/ns/" +
|
|
10
|
+
workspaces: () => call(t, "GET", "/integrations/dash/ns/" + namespaceSeg(namespace) + "/workspaces"),
|
|
11
|
+
binding: () => call(t, "GET", "/integrations/dash/ns/" + namespaceSeg(namespace) + "/binding"),
|
|
12
|
+
connect: (input) => call(t, "PUT", "/integrations/dash/ns/" + namespaceSeg(namespace) + "/binding", input),
|
|
13
|
+
disconnect: (expectedRevision) => call(t, "DELETE", "/integrations/dash/ns/" + namespaceSeg(namespace) + "/binding", undefined, { expectedRevision }),
|
|
14
14
|
},
|
|
15
15
|
slurm: {
|
|
16
16
|
clusters: () => call(t, "GET", ns + "/slurm-clusters"),
|
|
@@ -48,7 +48,7 @@ export function machineApi(t) {
|
|
|
48
48
|
}
|
|
49
49
|
/** A caller-supplied machine-authenticated transport must sign each request; no ambient local key is read. */
|
|
50
50
|
export function lakeshoreApi(t, namespace) {
|
|
51
|
-
const base = "/v1/namespaces/" +
|
|
51
|
+
const base = "/v1/namespaces/" + namespaceSeg(namespace);
|
|
52
52
|
return {
|
|
53
53
|
workers: (query = {}) => call(t, "GET", base + "/workers", undefined, query),
|
|
54
54
|
queues: (query = {}) => call(t, "GET", base + "/queues", undefined, query),
|
package/dist/api/sessions.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Agent sessions and the session control plane. Mirrors
|
|
2
2
|
* dreamlake-server `routes/terminal-sessions.ts` and `session-control/`. */
|
|
3
|
-
import { isObjectId, seg } from "./client.js";
|
|
3
|
+
import { isObjectId, namespaceSeg, seg } from "./client.js";
|
|
4
4
|
import { serverEvents } from "./streams.js";
|
|
5
5
|
/** Ordered: each level includes the ones before it. */
|
|
6
6
|
export const PERMISSION_LEVELS = ["read-only", "workspace-write", "full-access"];
|
|
@@ -32,7 +32,7 @@ export const TERMINAL = new Set([
|
|
|
32
32
|
/** Seconds the server will hold a wait; longer waits are client loops. */
|
|
33
33
|
export const MAX_WAIT_SECONDS = 25;
|
|
34
34
|
export function sessionsApi(t, namespace) {
|
|
35
|
-
const ns =
|
|
35
|
+
const ns = namespaceSeg(namespace), base = `/namespaces/${ns}/terminal-sessions`, commands = `/namespaces/${ns}/session-commands`, runners = `/namespaces/${ns}/session-runners`;
|
|
36
36
|
const id = (value) => {
|
|
37
37
|
if (!isObjectId(value))
|
|
38
38
|
throw new Error("expected a 24-hex id");
|
|
@@ -41,8 +41,8 @@ export function sessionsApi(t, namespace) {
|
|
|
41
41
|
const long = (seconds) => ({ timeoutMs: (seconds + 10) * 1000 });
|
|
42
42
|
return {
|
|
43
43
|
namespace,
|
|
44
|
-
link: (sessionId, resource) => t.request("PUT", `/namespaces/${
|
|
45
|
-
unlink: (sessionId, resource) => t.request("DELETE", `/namespaces/${
|
|
44
|
+
link: (sessionId, resource) => t.request("PUT", `/namespaces/${namespaceSeg(resource.namespace)}/resources/${resource.type}/${seg(resource.id)}/sessions/${id(sessionId)}`, { json: { sessionNamespaceSlug: namespace } }),
|
|
45
|
+
unlink: (sessionId, resource) => t.request("DELETE", `/namespaces/${namespaceSeg(resource.namespace)}/resources/${resource.type}/${seg(resource.id)}/sessions/${id(sessionId)}`, { json: { sessionNamespaceSlug: namespace } }),
|
|
46
46
|
list: (query = {}) => t.request("GET", base, { query }),
|
|
47
47
|
/** Every session the caller may read across namespaces: public, team-shared and their own. */
|
|
48
48
|
available: (query = {}) => t.request("GET", "/terminal-sessions/available", { query }),
|
|
@@ -140,7 +140,7 @@ export function sessionsApi(t, namespace) {
|
|
|
140
140
|
}
|
|
141
141
|
/** Gateway operations are separate from runner command execution; callers supply the configured gateway transport. */
|
|
142
142
|
export function terminalApi(t, namespace) {
|
|
143
|
-
const ns =
|
|
143
|
+
const ns = namespaceSeg(namespace), base = `/namespaces/${ns}/terminal`, sessions = `/namespaces/${ns}/terminal-sessions`;
|
|
144
144
|
return {
|
|
145
145
|
targets: () => t.request("GET", base + "/targets"),
|
|
146
146
|
discovery: (input) => t.request("POST", base + "/discovery", { json: input }),
|