@dreamlake/dreamlake-cli 0.107.1 → 0.108.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/apps.d.ts +56 -0
- package/dist/api/apps.js +23 -0
- 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 +157 -14
- package/dist/api/index.js +3 -0
- package/dist/api/memo-facade.js +2 -2
- package/dist/api/memo-reading.js +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 +64 -7
- package/dist/api/workspace.js +4 -10
- package/dist/cli/apps/index.d.ts +14 -0
- package/dist/cli/apps/index.js +205 -0
- package/dist/cli/connection/oauth.d.ts +2 -0
- package/dist/cli/connection/oauth.js +4 -2
- 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 +12 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/list/index.js +5 -7
- 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/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,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
|
+
};
|
package/dist/api/apps.js
ADDED
|
@@ -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
|
+
}
|
|
@@ -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
|
@@ -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;
|
|
@@ -716,6 +732,39 @@ export declare function createApi(transport: Transport): {
|
|
|
716
732
|
totalPages: number;
|
|
717
733
|
}>;
|
|
718
734
|
resources: (project: string, kind: "bindrs" | "datasets" | "episodes") => {
|
|
735
|
+
list: (query?: import("./common.js").Query) => Promise<{
|
|
736
|
+
bindrs: import("./bindrs.js").Bindr[];
|
|
737
|
+
}>;
|
|
738
|
+
create: (input: import("./bindrs.js").BindrInput) => Promise<{
|
|
739
|
+
bindr: import("./bindrs.js").Bindr;
|
|
740
|
+
}>;
|
|
741
|
+
get: (nameOrId: string, query?: import("./common.js").Query) => Promise<import("./bindrs.js").BindrDetail>;
|
|
742
|
+
summary: (nameOrId: string) => Promise<{
|
|
743
|
+
bindr: import("./bindrs.js").Bindr;
|
|
744
|
+
}>;
|
|
745
|
+
update: (nameOrId: string, input: Partial<Omit<import("./bindrs.js").BindrInput, "member" | "members">>) => Promise<{
|
|
746
|
+
bindr: import("./bindrs.js").Bindr;
|
|
747
|
+
}>;
|
|
748
|
+
delete: (nameOrId: string) => Promise<{
|
|
749
|
+
deleted: boolean;
|
|
750
|
+
}>;
|
|
751
|
+
addMember: (nameOrId: string, nodeId: string) => Promise<{
|
|
752
|
+
added: boolean;
|
|
753
|
+
memberCount: number;
|
|
754
|
+
}>;
|
|
755
|
+
removeMember: (nameOrId: string, nodeId: string) => Promise<{
|
|
756
|
+
removed: boolean;
|
|
757
|
+
memberCount: number;
|
|
758
|
+
}>;
|
|
759
|
+
addMembers: (nameOrId: string, nodeIds: string[]) => Promise<{
|
|
760
|
+
completedNodeIds: string[];
|
|
761
|
+
memberCount: number | undefined;
|
|
762
|
+
}>;
|
|
763
|
+
removeMembers: (nameOrId: string, nodeIds: string[]) => Promise<{
|
|
764
|
+
completedNodeIds: string[];
|
|
765
|
+
memberCount: number | undefined;
|
|
766
|
+
}>;
|
|
767
|
+
} | {
|
|
719
768
|
list: (query?: import("./common.js").Query) => Promise<{
|
|
720
769
|
[key: string]: unknown;
|
|
721
770
|
}>;
|
|
@@ -725,15 +774,38 @@ export declare function createApi(transport: Transport): {
|
|
|
725
774
|
delete: (id: string) => Promise<unknown>;
|
|
726
775
|
};
|
|
727
776
|
bindrs: (project: string) => {
|
|
728
|
-
addMembers: (name: string, add: string[]) => Promise<unknown>;
|
|
729
|
-
removeMembers: (name: string, remove: string[]) => Promise<unknown>;
|
|
730
777
|
list: (query?: import("./common.js").Query) => Promise<{
|
|
731
|
-
|
|
778
|
+
bindrs: import("./bindrs.js").Bindr[];
|
|
779
|
+
}>;
|
|
780
|
+
create: (input: import("./bindrs.js").BindrInput) => Promise<{
|
|
781
|
+
bindr: import("./bindrs.js").Bindr;
|
|
782
|
+
}>;
|
|
783
|
+
get: (nameOrId: string, query?: import("./common.js").Query) => Promise<import("./bindrs.js").BindrDetail>;
|
|
784
|
+
summary: (nameOrId: string) => Promise<{
|
|
785
|
+
bindr: import("./bindrs.js").Bindr;
|
|
786
|
+
}>;
|
|
787
|
+
update: (nameOrId: string, input: Partial<Omit<import("./bindrs.js").BindrInput, "member" | "members">>) => Promise<{
|
|
788
|
+
bindr: import("./bindrs.js").Bindr;
|
|
789
|
+
}>;
|
|
790
|
+
delete: (nameOrId: string) => Promise<{
|
|
791
|
+
deleted: boolean;
|
|
792
|
+
}>;
|
|
793
|
+
addMember: (nameOrId: string, nodeId: string) => Promise<{
|
|
794
|
+
added: boolean;
|
|
795
|
+
memberCount: number;
|
|
796
|
+
}>;
|
|
797
|
+
removeMember: (nameOrId: string, nodeId: string) => Promise<{
|
|
798
|
+
removed: boolean;
|
|
799
|
+
memberCount: number;
|
|
800
|
+
}>;
|
|
801
|
+
addMembers: (nameOrId: string, nodeIds: string[]) => Promise<{
|
|
802
|
+
completedNodeIds: string[];
|
|
803
|
+
memberCount: number | undefined;
|
|
804
|
+
}>;
|
|
805
|
+
removeMembers: (nameOrId: string, nodeIds: string[]) => Promise<{
|
|
806
|
+
completedNodeIds: string[];
|
|
807
|
+
memberCount: number | undefined;
|
|
732
808
|
}>;
|
|
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
809
|
};
|
|
738
810
|
datasets: (project: string) => {
|
|
739
811
|
addBindrs: (name: string, add: string[]) => Promise<unknown>;
|
|
@@ -1245,6 +1317,21 @@ export declare function createClient(options: ClientOptions): {
|
|
|
1245
1317
|
jobs: (namespace: string) => JobsApi;
|
|
1246
1318
|
infra: InfraApi;
|
|
1247
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
|
+
};
|
|
1248
1335
|
openResources: {
|
|
1249
1336
|
find(resources: readonly import("./open-resources.js").OpenResource[], input: {
|
|
1250
1337
|
query: string;
|
|
@@ -1929,6 +2016,39 @@ export declare function createClient(options: ClientOptions): {
|
|
|
1929
2016
|
totalPages: number;
|
|
1930
2017
|
}>;
|
|
1931
2018
|
resources: (project: string, kind: "bindrs" | "datasets" | "episodes") => {
|
|
2019
|
+
list: (query?: import("./common.js").Query) => Promise<{
|
|
2020
|
+
bindrs: import("./bindrs.js").Bindr[];
|
|
2021
|
+
}>;
|
|
2022
|
+
create: (input: import("./bindrs.js").BindrInput) => Promise<{
|
|
2023
|
+
bindr: import("./bindrs.js").Bindr;
|
|
2024
|
+
}>;
|
|
2025
|
+
get: (nameOrId: string, query?: import("./common.js").Query) => Promise<import("./bindrs.js").BindrDetail>;
|
|
2026
|
+
summary: (nameOrId: string) => Promise<{
|
|
2027
|
+
bindr: import("./bindrs.js").Bindr;
|
|
2028
|
+
}>;
|
|
2029
|
+
update: (nameOrId: string, input: Partial<Omit<import("./bindrs.js").BindrInput, "member" | "members">>) => Promise<{
|
|
2030
|
+
bindr: import("./bindrs.js").Bindr;
|
|
2031
|
+
}>;
|
|
2032
|
+
delete: (nameOrId: string) => Promise<{
|
|
2033
|
+
deleted: boolean;
|
|
2034
|
+
}>;
|
|
2035
|
+
addMember: (nameOrId: string, nodeId: string) => Promise<{
|
|
2036
|
+
added: boolean;
|
|
2037
|
+
memberCount: number;
|
|
2038
|
+
}>;
|
|
2039
|
+
removeMember: (nameOrId: string, nodeId: string) => Promise<{
|
|
2040
|
+
removed: boolean;
|
|
2041
|
+
memberCount: number;
|
|
2042
|
+
}>;
|
|
2043
|
+
addMembers: (nameOrId: string, nodeIds: string[]) => Promise<{
|
|
2044
|
+
completedNodeIds: string[];
|
|
2045
|
+
memberCount: number | undefined;
|
|
2046
|
+
}>;
|
|
2047
|
+
removeMembers: (nameOrId: string, nodeIds: string[]) => Promise<{
|
|
2048
|
+
completedNodeIds: string[];
|
|
2049
|
+
memberCount: number | undefined;
|
|
2050
|
+
}>;
|
|
2051
|
+
} | {
|
|
1932
2052
|
list: (query?: import("./common.js").Query) => Promise<{
|
|
1933
2053
|
[key: string]: unknown;
|
|
1934
2054
|
}>;
|
|
@@ -1938,15 +2058,38 @@ export declare function createClient(options: ClientOptions): {
|
|
|
1938
2058
|
delete: (id: string) => Promise<unknown>;
|
|
1939
2059
|
};
|
|
1940
2060
|
bindrs: (project: string) => {
|
|
1941
|
-
addMembers: (name: string, add: string[]) => Promise<unknown>;
|
|
1942
|
-
removeMembers: (name: string, remove: string[]) => Promise<unknown>;
|
|
1943
2061
|
list: (query?: import("./common.js").Query) => Promise<{
|
|
1944
|
-
|
|
2062
|
+
bindrs: import("./bindrs.js").Bindr[];
|
|
2063
|
+
}>;
|
|
2064
|
+
create: (input: import("./bindrs.js").BindrInput) => Promise<{
|
|
2065
|
+
bindr: import("./bindrs.js").Bindr;
|
|
2066
|
+
}>;
|
|
2067
|
+
get: (nameOrId: string, query?: import("./common.js").Query) => Promise<import("./bindrs.js").BindrDetail>;
|
|
2068
|
+
summary: (nameOrId: string) => Promise<{
|
|
2069
|
+
bindr: import("./bindrs.js").Bindr;
|
|
2070
|
+
}>;
|
|
2071
|
+
update: (nameOrId: string, input: Partial<Omit<import("./bindrs.js").BindrInput, "member" | "members">>) => Promise<{
|
|
2072
|
+
bindr: import("./bindrs.js").Bindr;
|
|
2073
|
+
}>;
|
|
2074
|
+
delete: (nameOrId: string) => Promise<{
|
|
2075
|
+
deleted: boolean;
|
|
2076
|
+
}>;
|
|
2077
|
+
addMember: (nameOrId: string, nodeId: string) => Promise<{
|
|
2078
|
+
added: boolean;
|
|
2079
|
+
memberCount: number;
|
|
2080
|
+
}>;
|
|
2081
|
+
removeMember: (nameOrId: string, nodeId: string) => Promise<{
|
|
2082
|
+
removed: boolean;
|
|
2083
|
+
memberCount: number;
|
|
2084
|
+
}>;
|
|
2085
|
+
addMembers: (nameOrId: string, nodeIds: string[]) => Promise<{
|
|
2086
|
+
completedNodeIds: string[];
|
|
2087
|
+
memberCount: number | undefined;
|
|
2088
|
+
}>;
|
|
2089
|
+
removeMembers: (nameOrId: string, nodeIds: string[]) => Promise<{
|
|
2090
|
+
completedNodeIds: string[];
|
|
2091
|
+
memberCount: number | undefined;
|
|
1945
2092
|
}>;
|
|
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
2093
|
};
|
|
1951
2094
|
datasets: (project: string) => {
|
|
1952
2095
|
addBindrs: (name: string, add: string[]) => Promise<unknown>;
|
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"),
|
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.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),
|