@netnodeag/kraftwerk 0.101.0 → 0.103.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/README.md +60 -2
- package/dist/cli/join.js +4 -2
- package/dist/config.d.ts +2 -2
- package/dist/config.js +3 -3
- package/dist/core/boards.d.ts +3 -0
- package/dist/core/boards.js +16 -2
- package/dist/core/cloud.d.ts +7 -0
- package/dist/core/git.d.ts +36 -2
- package/dist/core/git.js +226 -6
- package/dist/core/notifications.d.ts +3 -2
- package/dist/core/settings.d.ts +1 -1
- package/dist/core/settings.js +2 -2
- package/dist/server/api/git.d.ts +0 -6
- package/dist/server/api/git.js +4 -25
- package/dist/server/cloud-events.d.ts +8 -0
- package/dist/server/cloud-events.js +199 -0
- package/dist/server/cloud.d.ts +15 -0
- package/dist/server/cloud.js +77 -2
- package/dist/server/join.d.ts +6 -2
- package/dist/server/join.js +15 -4
- package/dist/server/relay.js +5 -0
- package/dist/server/sandbox.d.ts +9 -0
- package/dist/server/sandbox.js +48 -0
- package/dist/server/server.js +5 -3
- package/dist/server/sync-setup.d.ts +3 -2
- package/dist/server/sync-setup.js +6 -3
- package/dist/server/users.d.ts +11 -0
- package/dist/server/users.js +68 -18
- package/dist/server/workspace-cloud.d.ts +3 -1
- package/dist/server/workspace-cloud.js +18 -8
- package/package.json +1 -1
- package/web/dist/assets/{dist-BgG4OIU9.js → dist-B09k-Kwi.js} +1 -1
- package/web/dist/assets/{dist-Db9KgP0W.js → dist-BG9MPqC7.js} +1 -1
- package/web/dist/assets/{dist-Bi5Y6JmO.js → dist-BbST9sxK.js} +1 -1
- package/web/dist/assets/{dist-CiGlBloC.js → dist-BrXAphjl.js} +1 -1
- package/web/dist/assets/{dist-Bd_SvBeU.js → dist-C0Ulmjwh.js} +1 -1
- package/web/dist/assets/{dist-DTxqCKQj.js → dist-C8wsDqpL.js} +1 -1
- package/web/dist/assets/{dist-Cfj7O2BI.js → dist-CJk4RtqY.js} +1 -1
- package/web/dist/assets/{dist-DXGv3DRS.js → dist-CfSpo_bP.js} +1 -1
- package/web/dist/assets/dist-DMU8iY9H.js +1 -0
- package/web/dist/assets/{dist-Cq4ezkbk.js → dist-Dv55aORJ.js} +1 -1
- package/web/dist/assets/{dist-Co1Cz1EB.js → dist-QQHKzUGH.js} +1 -1
- package/web/dist/assets/{editor-CH-WK0Ag.js → editor-Co8xGDnf.js} +3 -3
- package/web/dist/assets/index-CepQsH8H.js +488 -0
- package/web/dist/assets/index-DJGLnVQY.css +2 -0
- package/web/dist/index.html +2 -2
- package/web/dist/assets/dist-DeUP_9vJ.js +0 -1
- package/web/dist/assets/index-ClVr51ut.css +0 -2
- package/web/dist/assets/index-CnwVoHX3.js +0 -488
package/dist/server/api/git.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
2
|
import { type GitStatus } from "../../core/git.js";
|
|
3
|
-
/**
|
|
4
|
-
* Who hosts the workspace's remote: kraftwerk sync is the workspace's own
|
|
5
|
-
* repo in kraftwerk cloud, `<cloud>/git/<id>.git` (the cloud's host when this
|
|
6
|
-
* machine knows it); anything else is an own git provider.
|
|
7
|
-
*/
|
|
8
|
-
export declare function hostingOf(remoteUrl: string | undefined): Promise<NonNullable<GitStatus["hosting"]>>;
|
|
9
3
|
/** The workspace's own git, and the repositories cloned under its repos root. */
|
|
10
4
|
export declare const gitRoutes: (import("./router.js").Route<"git.commit", import("./router.js").Reply<{
|
|
11
5
|
ok: boolean;
|
package/dist/server/api/git.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as z from "zod";
|
|
|
2
2
|
import { resolveWorkspace } from "../../config.js";
|
|
3
3
|
import { workspaceRoot } from "../../core/context.js";
|
|
4
4
|
import { gitCommit, gitDiff, gitFetch, gitPull, gitPush, gitStatus } from "../../core/git.js";
|
|
5
|
-
import {
|
|
5
|
+
import { hostingFor } from "../cloud.js";
|
|
6
6
|
import { setupSync } from "../sync-setup.js";
|
|
7
7
|
import { addRepo, listRepos, openRepos, removeRepo, repoCommitDiff, repoDetail, repoDiff, updateRepo } from "../../core/repos.js";
|
|
8
8
|
import { fail, reply, route, statusByMessage } from "./router.js";
|
|
@@ -12,30 +12,9 @@ const conflictUnlessOk = (result) => reply(result.ok ? 200 : 409, result);
|
|
|
12
12
|
const Commit = z.object({ paths: z.array(z.string()).default([]), message: z.string().default("") });
|
|
13
13
|
/** A clone to add; url, name, branch and depth are checked by addRepo. */
|
|
14
14
|
const AddRepo = z.object({ url: z.string().default(""), name: z.string().optional(), branch: z.string().optional(), depth: z.number().optional() });
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* machine knows it); anything else is an own git provider.
|
|
19
|
-
*/
|
|
20
|
-
export async function hostingOf(remoteUrl) {
|
|
21
|
-
if (!remoteUrl)
|
|
22
|
-
return "none";
|
|
23
|
-
const id = (await resolveWorkspace(workspaceRoot()).catch(() => null))?.config.id;
|
|
24
|
-
let u;
|
|
25
|
-
try {
|
|
26
|
-
u = new URL(remoteUrl);
|
|
27
|
-
}
|
|
28
|
-
catch {
|
|
29
|
-
return "custom"; // scp-like ssh (git@host:path) — never kraftwerk sync
|
|
30
|
-
}
|
|
31
|
-
const cloud = cloudStatus().url;
|
|
32
|
-
const sameHost = !cloud || (() => { try {
|
|
33
|
-
return new URL(cloud).host === u.host;
|
|
34
|
-
}
|
|
35
|
-
catch {
|
|
36
|
-
return false;
|
|
37
|
-
} })();
|
|
38
|
-
return id && sameHost && u.pathname.replace(/\/+$/, "") === `/git/${encodeURIComponent(id)}.git` ? "kraftwerk" : "custom";
|
|
15
|
+
/** Who hosts the workspace's remote (server/cloud.ts). */
|
|
16
|
+
async function hostingOf(remoteUrl) {
|
|
17
|
+
return hostingFor((await resolveWorkspace(workspaceRoot()).catch(() => null))?.config.id, remoteUrl);
|
|
39
18
|
}
|
|
40
19
|
/** The workspace's own git, and the repositories cloned under its repos root. */
|
|
41
20
|
export const gitRoutes = [
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Fetch and act on what waits; a call while one runs makes it run once more after. */
|
|
2
|
+
export declare function fetchCloudEvents(): Promise<void>;
|
|
3
|
+
/** Hold the stream while connected and claimed; drop it otherwise. */
|
|
4
|
+
export declare function keepEventStream(): void;
|
|
5
|
+
/** Whether the stream is up (tests, status). */
|
|
6
|
+
export declare const eventStreamOpen: () => boolean;
|
|
7
|
+
/** Hook in (cloud.ts startMachineCloud): the task context, the heartbeat's count, the link's changes. Not at import — the modules load each other. */
|
|
8
|
+
export declare function installCloudEvents(): void;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { getAgent } from "../core/agents.js";
|
|
2
|
+
import { emitTaskEvent, setCloudTaskContext } from "../core/boards.js";
|
|
3
|
+
import { cloudPost } from "../core/cloud.js";
|
|
4
|
+
import { log } from "../core/log.js";
|
|
5
|
+
import { pushNotification } from "../core/notifications.js";
|
|
6
|
+
import { getCloudBoard, getCloudTask } from "./cloud-boards.js";
|
|
7
|
+
import { cloudStatus, inServedWorkspace, machineLink, onCloudChanged, onEventsWaiting } from "./cloud.js";
|
|
8
|
+
let running = null;
|
|
9
|
+
let again = false;
|
|
10
|
+
/** Fetch and act on what waits; a call while one runs makes it run once more after. */
|
|
11
|
+
export function fetchCloudEvents() {
|
|
12
|
+
if (running) {
|
|
13
|
+
again = true;
|
|
14
|
+
return running;
|
|
15
|
+
}
|
|
16
|
+
running = (async () => {
|
|
17
|
+
try {
|
|
18
|
+
do {
|
|
19
|
+
again = false;
|
|
20
|
+
await round();
|
|
21
|
+
} while (again);
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
running = null;
|
|
25
|
+
}
|
|
26
|
+
})();
|
|
27
|
+
return running;
|
|
28
|
+
}
|
|
29
|
+
async function round() {
|
|
30
|
+
const link = machineLink();
|
|
31
|
+
if (!link)
|
|
32
|
+
return;
|
|
33
|
+
const auth = { id: link.creds.id, secret: link.creds.secret };
|
|
34
|
+
let events;
|
|
35
|
+
try {
|
|
36
|
+
events = (await cloudPost(link.url, "/api/machines/events", auth, { version: link.version })).events ?? [];
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
log("warn", "cloud", `could not fetch events: ${err.message}`);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (!events.length)
|
|
43
|
+
return;
|
|
44
|
+
const ack = [];
|
|
45
|
+
const claim = [];
|
|
46
|
+
for (const ev of events) {
|
|
47
|
+
if (ev.kind === "task_assigned") {
|
|
48
|
+
await inServedWorkspace(ev.workspaceId, () => notifyAssigned(ev)).catch(() => null);
|
|
49
|
+
ack.push(ev.id);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
const here = await inServedWorkspace(ev.workspaceId, async () => !!(ev.agent && (await getAgent(ev.agent).catch(() => null)))).catch(() => null);
|
|
53
|
+
if (here?.value)
|
|
54
|
+
claim.push({ ev, agentHere: true });
|
|
55
|
+
else
|
|
56
|
+
ack.push(ev.id);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
let claimed = [];
|
|
60
|
+
try {
|
|
61
|
+
claimed = (await cloudPost(link.url, "/api/machines/events/ack", { ...auth, ack, claim: claim.map((c) => c.ev.id) }, { version: link.version })).claimed ?? [];
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
log("warn", "cloud", `could not acknowledge events: ${err.message}`);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
for (const { ev } of claim) {
|
|
68
|
+
if (!claimed.includes(ev.id))
|
|
69
|
+
continue; // another machine with the agent took it
|
|
70
|
+
await inServedWorkspace(ev.workspaceId, () => wakeFor(ev)).catch((err) => log("warn", "cloud", `could not wake ${ev.agent} for @${ev.board}/${ev.number}: ${err.message}`));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const who = (actor) => actor.replace(/^human:/, "");
|
|
74
|
+
async function notifyAssigned(ev) {
|
|
75
|
+
await pushNotification({
|
|
76
|
+
kind: "task_assigned",
|
|
77
|
+
title: `📋 ${who(ev.by)} gave you “${ev.title}”`,
|
|
78
|
+
body: `${ev.boardTitle} · ${ev.status}${ev.message ? ` — ${ev.message}` : ""}`,
|
|
79
|
+
href: `/boards/@${ev.board}/${ev.number}`,
|
|
80
|
+
key: `task-assigned:@${ev.board}/${ev.number}`,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/** The agent's wake, as for a local board: a TaskEvent board-wake.ts consumes. */
|
|
84
|
+
async function wakeFor(ev) {
|
|
85
|
+
await emitTaskEvent({
|
|
86
|
+
at: new Date(ev.at).toISOString(),
|
|
87
|
+
ref: `@${ev.board}/${ev.number}`,
|
|
88
|
+
board: `@${ev.board}`,
|
|
89
|
+
task: String(ev.number),
|
|
90
|
+
title: ev.title,
|
|
91
|
+
agent: ev.agent,
|
|
92
|
+
status: ev.status,
|
|
93
|
+
reason: ev.reason,
|
|
94
|
+
actor: ev.by,
|
|
95
|
+
...(ev.message ? { message: ev.message } : {}),
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/** The context block of a cloud task for the agent woken for it (core/boards.ts taskContext). */
|
|
99
|
+
async function cloudContext(reference) {
|
|
100
|
+
const [board, n] = reference.split("/");
|
|
101
|
+
const flags = `--board ${board}`;
|
|
102
|
+
try {
|
|
103
|
+
const [t, b] = await Promise.all([getCloudTask({ kind: "local" }, board, n), getCloudBoard({ kind: "local" }, board).catch(() => null)]);
|
|
104
|
+
const cols = b ? b.columns.map((c) => c.slug).join(", ") : "";
|
|
105
|
+
return (`## Your task: ${t.number} ${t.title}\n` +
|
|
106
|
+
`Cloud board ${board}${b ? ` (columns: ${cols})` : ""} — kept in kraftwerk cloud, shared with everyone on the workspace; status ${t.status}${t.assignee ? `, assigned to ${t.assignee}` : ""}${t.due ? `, due ${t.due}` : ""}.\n` +
|
|
107
|
+
`\n### Notes\n${t.notes.trim() || "(none — ask in the log what done looks like)"}\n` +
|
|
108
|
+
`\n### Log (newest first)\n${t.log.trim() || "(empty)"}\n\n` +
|
|
109
|
+
`Work it through the CLI (${flags}, the number ${t.number} names the task): \`npx kraftwerk tasks move ${t.number} doing ${flags}\` when you start, ` +
|
|
110
|
+
`\`tasks log ${t.number} "<what you did>" ${flags}\` as you go (files into $KRAFTWERK_TEMP or the workspace), ` +
|
|
111
|
+
`\`tasks assign ${t.number} <agent or human:handle> -m "<note>" ${flags}\` to hand it over, \`tasks move ${t.number} review -m "<summary>" ${flags}\` when done. Never move it to a finished column.`);
|
|
112
|
+
}
|
|
113
|
+
catch (err) {
|
|
114
|
+
return `You were opened for task ${reference} on a cloud board, but it could not be read (${err.message}). Try \`npx kraftwerk tasks show ${n} ${flags}\`.`;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/* ---------- the event stream ---------- */
|
|
118
|
+
const PING_MS = 30_000;
|
|
119
|
+
const stream = {
|
|
120
|
+
ws: null,
|
|
121
|
+
/** The link it was opened for: url + machine id; another one closes it. */
|
|
122
|
+
key: "",
|
|
123
|
+
retry: null,
|
|
124
|
+
ping: null,
|
|
125
|
+
backoff: 1_000,
|
|
126
|
+
};
|
|
127
|
+
function closeStream() {
|
|
128
|
+
if (stream.retry)
|
|
129
|
+
clearTimeout(stream.retry);
|
|
130
|
+
if (stream.ping)
|
|
131
|
+
clearInterval(stream.ping);
|
|
132
|
+
stream.retry = null;
|
|
133
|
+
stream.ping = null;
|
|
134
|
+
const ws = stream.ws;
|
|
135
|
+
stream.ws = null;
|
|
136
|
+
stream.key = "";
|
|
137
|
+
try {
|
|
138
|
+
ws?.close();
|
|
139
|
+
}
|
|
140
|
+
catch { }
|
|
141
|
+
}
|
|
142
|
+
/** Hold the stream while connected and claimed; drop it otherwise. */
|
|
143
|
+
export function keepEventStream() {
|
|
144
|
+
const link = machineLink();
|
|
145
|
+
const st = cloudStatus();
|
|
146
|
+
const want = link && st.state === "connected" && st.account ? `${link.url} ${link.creds.id}` : "";
|
|
147
|
+
if (want === stream.key && (stream.ws || stream.retry))
|
|
148
|
+
return;
|
|
149
|
+
closeStream();
|
|
150
|
+
if (!want || !link || typeof WebSocket === "undefined")
|
|
151
|
+
return;
|
|
152
|
+
stream.key = want;
|
|
153
|
+
const ws = new WebSocket(`${link.url.replace(/^http/, "ws")}/api/machines/stream`);
|
|
154
|
+
stream.ws = ws;
|
|
155
|
+
ws.addEventListener("open", () => ws.send(JSON.stringify({ t: "auth", id: link.creds.id, secret: link.creds.secret })));
|
|
156
|
+
ws.addEventListener("message", (ev) => {
|
|
157
|
+
let msg;
|
|
158
|
+
try {
|
|
159
|
+
msg = JSON.parse(String(ev.data));
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (msg.t === "ok") {
|
|
165
|
+
stream.backoff = 1_000;
|
|
166
|
+
stream.ping = setInterval(() => ws.readyState === WebSocket.OPEN && ws.send(JSON.stringify({ t: "ping" })), PING_MS);
|
|
167
|
+
stream.ping.unref?.();
|
|
168
|
+
// What came in while there was no stream.
|
|
169
|
+
void fetchCloudEvents().catch(() => { });
|
|
170
|
+
}
|
|
171
|
+
else if (msg.t === "poke")
|
|
172
|
+
void fetchCloudEvents().catch(() => { });
|
|
173
|
+
});
|
|
174
|
+
ws.addEventListener("close", () => {
|
|
175
|
+
if (stream.ws !== ws)
|
|
176
|
+
return;
|
|
177
|
+
if (stream.ping)
|
|
178
|
+
clearInterval(stream.ping);
|
|
179
|
+
stream.ping = null;
|
|
180
|
+
stream.ws = null;
|
|
181
|
+
// Gone (the cloud restarted, the network changed): again soon, slower each time; a refused auth waits for the next change.
|
|
182
|
+
stream.retry = setTimeout(() => {
|
|
183
|
+
stream.retry = null;
|
|
184
|
+
stream.key = "";
|
|
185
|
+
keepEventStream();
|
|
186
|
+
}, stream.backoff);
|
|
187
|
+
stream.retry.unref?.();
|
|
188
|
+
stream.backoff = Math.min(stream.backoff * 2, 60_000);
|
|
189
|
+
});
|
|
190
|
+
ws.addEventListener("error", () => { });
|
|
191
|
+
}
|
|
192
|
+
/** Whether the stream is up (tests, status). */
|
|
193
|
+
export const eventStreamOpen = () => stream.ws?.readyState === 1;
|
|
194
|
+
/** Hook in (cloud.ts startMachineCloud): the task context, the heartbeat's count, the link's changes. Not at import — the modules load each other. */
|
|
195
|
+
export function installCloudEvents() {
|
|
196
|
+
setCloudTaskContext(cloudContext);
|
|
197
|
+
onEventsWaiting(fetchCloudEvents);
|
|
198
|
+
onCloudChanged(keepEventStream);
|
|
199
|
+
}
|
package/dist/server/cloud.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Credentials, type CloudUrlSource, type InviteResponse } from "../core/cloud.js";
|
|
2
|
+
import { type GitStatus } from "../core/git.js";
|
|
2
3
|
/**
|
|
3
4
|
* The machine client: the daemon registers THIS MACHINE with the kraftwerk
|
|
4
5
|
* cloud once and heartbeats while it runs; the workspaces it serves ride
|
|
@@ -68,6 +69,12 @@ export type WorkspaceSource = () => Array<{
|
|
|
68
69
|
};
|
|
69
70
|
}>;
|
|
70
71
|
export declare const cloudStatus: () => CloudStatus;
|
|
72
|
+
/**
|
|
73
|
+
* Who hosts a workspace's remote: kraftwerk sync is the workspace's own repo
|
|
74
|
+
* in kraftwerk cloud, `<cloud>/git/<id>.git` (the cloud's host when this
|
|
75
|
+
* machine knows it); anything else is an own git provider.
|
|
76
|
+
*/
|
|
77
|
+
export declare function hostingFor(id: string | undefined, remoteUrl: string | undefined): NonNullable<GitStatus["hosting"]>;
|
|
71
78
|
/**
|
|
72
79
|
* Start the machine client (the daemon, once its workspaces are open).
|
|
73
80
|
* Resolves after the first registration attempt; the heartbeat runs on its
|
|
@@ -104,10 +111,18 @@ export declare function machineLink(): {
|
|
|
104
111
|
creds: Credentials;
|
|
105
112
|
version: string;
|
|
106
113
|
} | null;
|
|
114
|
+
export declare function onCloudChanged(fn: () => void): void;
|
|
115
|
+
export declare function onEventsWaiting(fn: () => Promise<void>): void;
|
|
116
|
+
/** Whether workspace `id` was deleted in kraftwerk cloud (its copies here stay, in local mode). */
|
|
117
|
+
export declare const deletedInCloud: (id: string | undefined) => boolean;
|
|
107
118
|
/** HTTP Basic with the machine's id and secret — what kraftwerk sync's git server takes from a machine. */
|
|
108
119
|
export declare const syncAuthHeader: (creds: Credentials) => string;
|
|
109
120
|
/** kraftwerk sync's repository for workspace `id` on this machine's cloud, or null without one. */
|
|
110
121
|
export declare function syncUrl(id: string): string | null;
|
|
122
|
+
/** Run `fn` inside the served workspace whose `id` is `id` (its own context: notifications, chats); null when none here serves it. */
|
|
123
|
+
export declare function inServedWorkspace<T>(id: string, fn: () => Promise<T>): Promise<{
|
|
124
|
+
value: T;
|
|
125
|
+
} | null>;
|
|
111
126
|
/** The served workspace whose kraftwerk.yml `id` is `id` (vetoed ones not), or null. */
|
|
112
127
|
export declare function servedWorkspace(id: string): Promise<{
|
|
113
128
|
slug: string;
|
package/dist/server/cloud.js
CHANGED
|
@@ -6,12 +6,15 @@ import { claimUrlFor, machineCloud, machineGoodbye, machineHeartbeat, machineReg
|
|
|
6
6
|
import { identityString, readIdentity } from "../core/identity.js";
|
|
7
7
|
import { routineReport } from "../core/routines.js";
|
|
8
8
|
import { machineCredentials } from "./relay.js";
|
|
9
|
-
import { setRemoteAuth } from "../core/git.js";
|
|
9
|
+
import { gitRemoteUrl, setRemoteAuth, setSyncAuthor } from "../core/git.js";
|
|
10
|
+
import { installCloudEvents } from "./cloud-events.js";
|
|
10
11
|
const DEFAULT_INTERVAL = 60;
|
|
11
12
|
const STANDALONE = { url: "", state: "off", reason: "only the daemon registers this machine with the cloud (`kraftwerk daemon start`)" };
|
|
12
13
|
const m = {
|
|
13
14
|
status: { ...STANDALONE },
|
|
14
15
|
creds: null,
|
|
16
|
+
/** Workspaces (ws_ ids) this machine reports that were deleted in the cloud. */
|
|
17
|
+
deleted: new Set(),
|
|
15
18
|
registered: false,
|
|
16
19
|
timer: null,
|
|
17
20
|
started: false,
|
|
@@ -32,6 +35,40 @@ function serial(fn) {
|
|
|
32
35
|
return run;
|
|
33
36
|
}
|
|
34
37
|
export const cloudStatus = () => m.status;
|
|
38
|
+
/**
|
|
39
|
+
* Who hosts a workspace's remote: kraftwerk sync is the workspace's own repo
|
|
40
|
+
* in kraftwerk cloud, `<cloud>/git/<id>.git` (the cloud's host when this
|
|
41
|
+
* machine knows it); anything else is an own git provider.
|
|
42
|
+
*/
|
|
43
|
+
export function hostingFor(id, remoteUrl) {
|
|
44
|
+
if (!remoteUrl)
|
|
45
|
+
return "none";
|
|
46
|
+
let u;
|
|
47
|
+
try {
|
|
48
|
+
u = new URL(remoteUrl);
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return "custom"; // scp-like ssh (git@host:path) — never kraftwerk sync
|
|
52
|
+
}
|
|
53
|
+
const cloud = m.status.url;
|
|
54
|
+
const sameHost = !cloud || (() => { try {
|
|
55
|
+
return new URL(cloud).host === u.host;
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return false;
|
|
59
|
+
} })();
|
|
60
|
+
return id && sameHost && u.pathname.replace(/\/+$/, "") === `/git/${encodeURIComponent(id)}.git` ? "kraftwerk" : "custom";
|
|
61
|
+
}
|
|
62
|
+
/** A served workspace's git hosting, told to the cloud so it shows kraftwerk sync only where it is used; undefined when it cannot tell. */
|
|
63
|
+
async function hostingOfServed(id, ws) {
|
|
64
|
+
if (!ws)
|
|
65
|
+
return undefined;
|
|
66
|
+
const run = ws.run.bind(ws);
|
|
67
|
+
return Promise.resolve()
|
|
68
|
+
.then(() => run(() => gitRemoteUrl()))
|
|
69
|
+
.then((url) => hostingFor(id, url))
|
|
70
|
+
.catch(() => undefined); // a workspace closing meanwhile: nothing said
|
|
71
|
+
}
|
|
35
72
|
/** The open workspaces as the cloud lists them: vetoed ones left out, roots only once claimed. */
|
|
36
73
|
async function entries(withRoots) {
|
|
37
74
|
const list = [];
|
|
@@ -43,7 +80,8 @@ async function entries(withRoots) {
|
|
|
43
80
|
continue;
|
|
44
81
|
if (c?.url)
|
|
45
82
|
ymlUrls.push(c.url.replace(/\/+$/, ""));
|
|
46
|
-
|
|
83
|
+
const git = await hostingOfServed(ws?.config.id, o.ws);
|
|
84
|
+
list.push({ ...(ws?.config.id ? { id: ws.config.id } : {}), name: o.name, slug: o.slug, ...(withRoots ? { root: o.root } : {}), ...(git ? { git } : {}) });
|
|
47
85
|
}
|
|
48
86
|
return { list, ymlUrls };
|
|
49
87
|
}
|
|
@@ -127,6 +165,8 @@ async function register() {
|
|
|
127
165
|
// An unclaimed register carries no roots: the list counts as reported only when that is all the cloud should know.
|
|
128
166
|
m.reported = r.account ? "" : JSON.stringify(list);
|
|
129
167
|
await noteAccount(r);
|
|
168
|
+
m.deleted = new Set(r.deletedWorkspaces ?? []);
|
|
169
|
+
queueMicrotask(() => cloudChanged());
|
|
130
170
|
m.status = {
|
|
131
171
|
...base, state: "connected", account: r.account ?? null, accountId: r.accountId ?? null, accountHandle: r.accountHandle ?? null, interval: r.interval || DEFAULT_INTERVAL, lastSeen: new Date().toISOString(),
|
|
132
172
|
claimCode: r.claimCode ?? null, claimUrl: claimUrlFor(cloud.url, r.claimCode), workspaces: list.length,
|
|
@@ -160,6 +200,11 @@ async function heartbeat() {
|
|
|
160
200
|
m.reported = now;
|
|
161
201
|
m.routines = ran;
|
|
162
202
|
await noteAccount(r);
|
|
203
|
+
m.deleted = new Set(r.deletedWorkspaces ?? []);
|
|
204
|
+
queueMicrotask(() => cloudChanged());
|
|
205
|
+
// Events a poke did not bring (the relay was down): fetch them now (cloud-events.ts).
|
|
206
|
+
if (r.events)
|
|
207
|
+
void Promise.resolve().then(() => eventsWaiting()).catch(() => { });
|
|
163
208
|
m.status = {
|
|
164
209
|
...m.status, state: "connected", error: undefined, interval: r.interval || m.status.interval || DEFAULT_INTERVAL, lastSeen: new Date().toISOString(),
|
|
165
210
|
...(r.account !== undefined ? { account: r.account, accountId: r.accountId ?? null, accountHandle: r.accountHandle ?? null } : {}),
|
|
@@ -219,11 +264,15 @@ export async function startMachineCloud(opts) {
|
|
|
219
264
|
await fs.rm(retiredCloudDir(), { recursive: true, force: true }).catch(() => { });
|
|
220
265
|
// The machine's id exists from the daemon's first start on, with the relay still off.
|
|
221
266
|
m.creds = await machineCredentials().catch(() => null);
|
|
267
|
+
// Cloud-board events: notifications and agent wakes (cloud-events.ts).
|
|
268
|
+
installCloudEvents();
|
|
222
269
|
// kraftwerk sync: git reaches the workspaces' cloud repos with this machine's key (core/git.ts).
|
|
223
270
|
setRemoteAuth(() => {
|
|
224
271
|
const link = machineLink();
|
|
225
272
|
return link ? { [`${link.url}/git/`]: syncAuthHeader(link.creds) } : {};
|
|
226
273
|
});
|
|
274
|
+
// What kraftwerk sync commits by itself is by the account this machine is linked to.
|
|
275
|
+
setSyncAuthor(() => (m.status.state === "connected" && m.status.account ? { name: m.status.accountHandle || m.status.account, email: m.status.account } : null));
|
|
227
276
|
await serial(register);
|
|
228
277
|
schedule();
|
|
229
278
|
return m.status;
|
|
@@ -250,6 +299,7 @@ export async function applyMachineCloud() {
|
|
|
250
299
|
clearTimeout(m.timer);
|
|
251
300
|
m.timer = null;
|
|
252
301
|
m.status = { url: cloud.url, state: "off", source: cloud.source, ...(cloud.reason ? { reason: cloud.reason } : {}) };
|
|
302
|
+
cloudChanged();
|
|
253
303
|
return m.status;
|
|
254
304
|
}
|
|
255
305
|
if (!m.registered)
|
|
@@ -282,6 +332,7 @@ export async function unlinkMachineCloud() {
|
|
|
282
332
|
m.routines = "";
|
|
283
333
|
await writeAccountFile(null);
|
|
284
334
|
m.status = { ...m.status, account: null, accountId: null, accountHandle: null, claimCode: r.claimCode ?? null, claimUrl: claimUrlFor(m.status.url, r.claimCode) };
|
|
335
|
+
cloudChanged();
|
|
285
336
|
return m.status;
|
|
286
337
|
});
|
|
287
338
|
}
|
|
@@ -302,6 +353,7 @@ export async function stopMachineCloud(owner) {
|
|
|
302
353
|
m.registered = false;
|
|
303
354
|
m.reported = "";
|
|
304
355
|
m.status = { ...STANDALONE };
|
|
356
|
+
cloudChanged();
|
|
305
357
|
if (registered && creds && url)
|
|
306
358
|
await machineGoodbye(url, creds, m.version).catch(() => { });
|
|
307
359
|
}
|
|
@@ -315,6 +367,18 @@ export function machineLink() {
|
|
|
315
367
|
return null;
|
|
316
368
|
return { url: m.status.url, creds: m.creds, version: m.version };
|
|
317
369
|
}
|
|
370
|
+
/** What runs when the machine's link changes — connected, claimed, stopped (cloud-events.ts keeps its stream to match). */
|
|
371
|
+
let cloudChanged = () => { };
|
|
372
|
+
export function onCloudChanged(fn) {
|
|
373
|
+
cloudChanged = fn;
|
|
374
|
+
}
|
|
375
|
+
/** What runs when the cloud says events wait for this machine (cloud-events.ts sets it). */
|
|
376
|
+
let eventsWaiting = async () => { };
|
|
377
|
+
export function onEventsWaiting(fn) {
|
|
378
|
+
eventsWaiting = fn;
|
|
379
|
+
}
|
|
380
|
+
/** Whether workspace `id` was deleted in kraftwerk cloud (its copies here stay, in local mode). */
|
|
381
|
+
export const deletedInCloud = (id) => !!id && m.deleted.has(id);
|
|
318
382
|
/** HTTP Basic with the machine's id and secret — what kraftwerk sync's git server takes from a machine. */
|
|
319
383
|
export const syncAuthHeader = (creds) => `Authorization: Basic ${Buffer.from(`${creds.id}:${creds.secret}`).toString("base64")}`;
|
|
320
384
|
/** kraftwerk sync's repository for workspace `id` on this machine's cloud, or null without one. */
|
|
@@ -322,6 +386,17 @@ export function syncUrl(id) {
|
|
|
322
386
|
const url = cloudStatus().url;
|
|
323
387
|
return url ? `${url}/git/${encodeURIComponent(id)}.git` : null;
|
|
324
388
|
}
|
|
389
|
+
/** Run `fn` inside the served workspace whose `id` is `id` (its own context: notifications, chats); null when none here serves it. */
|
|
390
|
+
export async function inServedWorkspace(id, fn) {
|
|
391
|
+
for (const o of m.source()) {
|
|
392
|
+
const ws = await resolveWorkspace(o.root).catch(() => null);
|
|
393
|
+
if (ws?.config.id !== id || !cloudIncluded(ws.config) || !o.ws)
|
|
394
|
+
continue;
|
|
395
|
+
const run = o.ws.run.bind(o.ws);
|
|
396
|
+
return { value: await run(fn) };
|
|
397
|
+
}
|
|
398
|
+
return null;
|
|
399
|
+
}
|
|
325
400
|
/** The served workspace whose kraftwerk.yml `id` is `id` (vetoed ones not), or null. */
|
|
326
401
|
export async function servedWorkspace(id) {
|
|
327
402
|
for (const o of m.source()) {
|
package/dist/server/join.d.ts
CHANGED
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
* the cloud claims it for the code's account and names the workspace
|
|
10
10
|
* 3. the workspace cloned from kraftwerk sync into the folder — the machine's
|
|
11
11
|
* key goes along through core/git.ts setRemoteAuth, nothing is stored;
|
|
12
|
-
* a cloud repository with no history yet
|
|
13
|
-
*
|
|
12
|
+
* a cloud repository with no history yet is refused with what to do (its
|
|
13
|
+
* owner sets up kraftwerk sync first), nothing is made locally
|
|
14
|
+
* 4. the folder opened in the daemon, and a one-time sign-in link for the
|
|
15
|
+
* browser the CLI opens (no second round through the cloud)
|
|
14
16
|
*
|
|
15
17
|
* Again on a folder that already holds the workspace: no clone, just open.
|
|
16
18
|
*/
|
|
@@ -21,6 +23,8 @@ export interface JoinResult {
|
|
|
21
23
|
slug: string;
|
|
22
24
|
url: string;
|
|
23
25
|
};
|
|
26
|
+
/** Opens the workspace signed in as the account (one use, five minutes); absent when the cloud did not confirm. */
|
|
27
|
+
signin?: string;
|
|
24
28
|
root: string;
|
|
25
29
|
role: string;
|
|
26
30
|
account: string;
|
package/dist/server/join.js
CHANGED
|
@@ -7,6 +7,8 @@ import { git, NET_TIMEOUT, remoteAuthEnv } from "../core/git.js";
|
|
|
7
7
|
import { ApiError } from "./api/router.js";
|
|
8
8
|
import { applyMachineCloud, cloudStatus, machineLink, syncMachineCloud } from "./cloud.js";
|
|
9
9
|
import { currentHub } from "./hub-context.js";
|
|
10
|
+
import { sandboxOrigin } from "./sandbox.js";
|
|
11
|
+
import { issueHandoff } from "./users.js";
|
|
10
12
|
/** `<origin>/join/<code>` or a bare code (this machine's cloud). */
|
|
11
13
|
export function parseJoinLink(raw) {
|
|
12
14
|
const text = raw.trim();
|
|
@@ -79,21 +81,30 @@ export async function joinWorkspace(link, dirIn, cwd) {
|
|
|
79
81
|
throw new ApiError(409, `${root} exists and is not empty — pass another folder: kraftwerk join <link> <folder>`);
|
|
80
82
|
}
|
|
81
83
|
else {
|
|
84
|
+
// A workspace whose repository has no history yet (begun locally, kraftwerk sync not set up there yet):
|
|
85
|
+
// nothing to clone — a kraftwerk.yml made here would collide with the owner's first push.
|
|
86
|
+
const heads = await git(["ls-remote", "--heads", "--", joined.sync.url], cwd, NET_TIMEOUT, remoteAuthEnv());
|
|
87
|
+
if (!heads.ok)
|
|
88
|
+
throw new ApiError(502, `kraftwerk sync did not answer: ${heads.stderr || "unknown error"}`);
|
|
89
|
+
if (!heads.stdout.trim()) {
|
|
90
|
+
throw new ApiError(409, `${joined.workspaceName} has no files in kraftwerk sync yet — whoever runs it has to set up kraftwerk sync first (kraftwerk → Git → "set up kraftwerk sync"); then run this again. This machine is linked to ${joined.account} already.`);
|
|
91
|
+
}
|
|
82
92
|
await fs.mkdir(path.dirname(root), { recursive: true });
|
|
83
93
|
const r = await git(["clone", "-q", "--", joined.sync.url, root], path.dirname(root), NET_TIMEOUT * 5, remoteAuthEnv());
|
|
84
94
|
if (!r.ok)
|
|
85
95
|
throw new ApiError(502, `cloning from kraftwerk sync failed: ${r.stderr || "unknown error"}`);
|
|
86
96
|
cloned = true;
|
|
87
|
-
// A workspace whose repository has no history yet (made locally, never pushed): its kraftwerk.yml starts here.
|
|
88
|
-
if (!existsSync(path.join(root, "kraftwerk.yml"))) {
|
|
89
|
-
await fs.writeFile(path.join(root, "kraftwerk.yml"), [`id: ${joined.workspaceId}`, `name: ${JSON.stringify(joined.workspaceName)}`, `users:`, ` mode: cloud`, `git:`, ` autosync: push`, ``].join("\n"));
|
|
90
|
-
}
|
|
91
97
|
}
|
|
92
98
|
const o = await currentHub().open(root);
|
|
93
99
|
// The cloud learns the workspace is here now (its host list, sign-in).
|
|
94
100
|
await syncMachineCloud().catch(() => { });
|
|
101
|
+
// Signed in at once: the link proved the account (server/users.ts issueHandoff). Not in a sandbox the
|
|
102
|
+
// cloud runs (server/sandbox.ts): nobody opens a browser there, and the link would only sit in its log.
|
|
103
|
+
const accountId = cloudStatus().accountId;
|
|
104
|
+
const token = accountId && !sandboxOrigin() ? await issueHandoff(joined.workspaceId, accountId) : null;
|
|
95
105
|
return {
|
|
96
106
|
workspace: { id: joined.workspaceId, name: joined.workspaceName, slug: o.slug, url: o.url },
|
|
107
|
+
...(token ? { signin: `${o.url}/auth/handoff?t=${token}` } : {}),
|
|
97
108
|
root,
|
|
98
109
|
role: joined.role,
|
|
99
110
|
account: joined.account,
|
package/dist/server/relay.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fetchCloudEvents } from "./cloud-events.js";
|
|
1
2
|
import { createHash, randomBytes } from "node:crypto";
|
|
2
3
|
import { promises as fs } from "node:fs";
|
|
3
4
|
import http from "node:http";
|
|
@@ -322,6 +323,10 @@ export async function startRelay(opts) {
|
|
|
322
323
|
}
|
|
323
324
|
else if (msg.t === "close" && msg.c)
|
|
324
325
|
dropConn(msg.c);
|
|
326
|
+
else if (msg.t === "poke") {
|
|
327
|
+
// The cloud has events for this machine (a task handed to its person, one for an agent): fetch them now.
|
|
328
|
+
void fetchCloudEvents().catch(() => { });
|
|
329
|
+
}
|
|
325
330
|
else if (msg.t === "push_invalid" && typeof msg.token === "string") {
|
|
326
331
|
// Apple no longer knows the token (the app was deleted, or pushes turned off): stop sending to it.
|
|
327
332
|
void dropPushToken(msg.token).catch(() => { });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type http from "node:http";
|
|
2
|
+
/** The public origin, when this daemon is a sandbox; read each time (tests set it). */
|
|
3
|
+
export declare function sandboxOrigin(): URL | null;
|
|
4
|
+
/** Where the browser signs in: the cloud as people reach it. */
|
|
5
|
+
export declare const browserCloudUrl: (machineCloudUrl: string) => string;
|
|
6
|
+
/** The request came in on the public origin (through the cloud). */
|
|
7
|
+
export declare function viaPublicOrigin(req: http.IncomingMessage): boolean;
|
|
8
|
+
/** A sandbox, and this request is from outside it: a person, who signs in. */
|
|
9
|
+
export declare function fromOutside(req: http.IncomingMessage): boolean;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A daemon that kraftwerk cloud runs for a workspace — "launch" on the
|
|
3
|
+
* platform: the cloud starts a sandbox (a container or microVM) on its own
|
|
4
|
+
* hardware with this daemon in it, which joins the workspace like any other
|
|
5
|
+
* machine (`kraftwerk join`). People reach its UI through the cloud, which
|
|
6
|
+
* forwards a public origin of the sandbox's own (e.g.
|
|
7
|
+
* https://<id>.run.kraftwerk-cloud…) here with the Host as the browser sent it.
|
|
8
|
+
*
|
|
9
|
+
* KRAFTWERK_PUBLIC_ORIGIN that origin; set, the daemon is a sandbox
|
|
10
|
+
* KRAFTWERK_PUBLIC_CLOUD_URL the cloud as the browser reaches it, when the
|
|
11
|
+
* sandbox reaches it at another address (locally:
|
|
12
|
+
* host.docker.internal) — the sign-in goes there
|
|
13
|
+
*
|
|
14
|
+
* In a sandbox, everyone arriving from outside is a person who signs in with
|
|
15
|
+
* their cloud account — whatever the workspace's `users:` says, and whether
|
|
16
|
+
* or not the request looks like a browser (users.ts fromBrowser lets the
|
|
17
|
+
* machine's own scripts through; here the network is not the machine's).
|
|
18
|
+
* Only what runs inside the sandbox itself (its agents' CLI, on loopback)
|
|
19
|
+
* is the machine. A request without a workspace in its Host reaches the
|
|
20
|
+
* sandbox's one workspace.
|
|
21
|
+
*/
|
|
22
|
+
const LOOPBACK_PEER = /^(127\.|::1$|::ffff:127\.)/;
|
|
23
|
+
/** The public origin, when this daemon is a sandbox; read each time (tests set it). */
|
|
24
|
+
export function sandboxOrigin() {
|
|
25
|
+
const raw = process.env.KRAFTWERK_PUBLIC_ORIGIN?.trim();
|
|
26
|
+
if (!raw)
|
|
27
|
+
return null;
|
|
28
|
+
try {
|
|
29
|
+
const u = new URL(raw);
|
|
30
|
+
return u.protocol === "http:" || u.protocol === "https:" ? u : null;
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** Where the browser signs in: the cloud as people reach it. */
|
|
37
|
+
export const browserCloudUrl = (machineCloudUrl) => sandboxOrigin() && process.env.KRAFTWERK_PUBLIC_CLOUD_URL?.trim() ? process.env.KRAFTWERK_PUBLIC_CLOUD_URL.trim().replace(/\/+$/, "") : machineCloudUrl;
|
|
38
|
+
/** The request came in on the public origin (through the cloud). */
|
|
39
|
+
export function viaPublicOrigin(req) {
|
|
40
|
+
const o = sandboxOrigin();
|
|
41
|
+
return !!o && String(req.headers.host ?? "").toLowerCase() === o.host.toLowerCase();
|
|
42
|
+
}
|
|
43
|
+
/** A sandbox, and this request is from outside it: a person, who signs in. */
|
|
44
|
+
export function fromOutside(req) {
|
|
45
|
+
if (!sandboxOrigin())
|
|
46
|
+
return false;
|
|
47
|
+
return viaPublicOrigin(req) || !LOOPBACK_PEER.test(req.socket.remoteAddress ?? "");
|
|
48
|
+
}
|
package/dist/server/server.js
CHANGED
|
@@ -23,6 +23,7 @@ import { MIME } from "./api/mime.js";
|
|
|
23
23
|
import { getPkgVersion, RESTART_EXIT_CODE } from "./version.js";
|
|
24
24
|
import { trustOf } from "./trust.js";
|
|
25
25
|
import { fromBrowser, handleAuth, signedIn } from "./users.js";
|
|
26
|
+
import { fromOutside, sandboxOrigin } from "./sandbox.js";
|
|
26
27
|
import { configAt, usersMode } from "../config.js";
|
|
27
28
|
import { targetOf } from "./target.js";
|
|
28
29
|
import { isDir, resolveWorkspace, workspaceSlug } from "../config.js";
|
|
@@ -248,7 +249,8 @@ async function cloudUsers(open, prefix) {
|
|
|
248
249
|
if (!open)
|
|
249
250
|
return undefined;
|
|
250
251
|
const config = await configAt(open.root);
|
|
251
|
-
|
|
252
|
+
// A sandbox's UI is reached from the internet (server/sandbox.ts): people sign in there, whatever `users:` says.
|
|
253
|
+
if (usersMode(config) !== "cloud" && !sandboxOrigin())
|
|
252
254
|
return undefined;
|
|
253
255
|
return { workspaceId: config.id, name: open.name, prefix };
|
|
254
256
|
}
|
|
@@ -260,7 +262,7 @@ async function cloudUsers(open, prefix) {
|
|
|
260
262
|
* and remote members have their own credentials.
|
|
261
263
|
*/
|
|
262
264
|
async function withUser(req, trust, cu) {
|
|
263
|
-
if (!cu || trust.kind !== "local" || !fromBrowser(req))
|
|
265
|
+
if (!cu || trust.kind !== "local" || !(fromBrowser(req) || fromOutside(req)))
|
|
264
266
|
return { trust };
|
|
265
267
|
const user = cu.workspaceId ? await signedIn(req, cu.workspaceId) : null;
|
|
266
268
|
return user ? { trust: { kind: "local", user } } : { trust, signin: true };
|
|
@@ -278,7 +280,7 @@ export async function startHub(opts) {
|
|
|
278
280
|
const version = await getPkgVersion();
|
|
279
281
|
installExitHandlers();
|
|
280
282
|
/** Which open workspace a request is for: its slug, else the port it came in on, else the default. */
|
|
281
|
-
const pick = (target, portDefault) => target.slug !== undefined ? bySlug.get(target.slug) : portDefault;
|
|
283
|
+
const pick = (target, portDefault) => target.slug !== undefined ? bySlug.get(target.slug) : (portDefault ?? (sandboxOrigin() && bySlug.size === 1 ? [...bySlug.values()][0] : undefined));
|
|
282
284
|
const handler = (portDefault) => async (req, res) => {
|
|
283
285
|
try {
|
|
284
286
|
if (!hostAllowed(req))
|
|
@@ -10,8 +10,9 @@ import { type GitStatus } from "../core/git.js";
|
|
|
10
10
|
* 2. a git repository at the workspace's root (`git init -b main` when
|
|
11
11
|
* there is none; a workspace inside a bigger repository is expert mode
|
|
12
12
|
* and left alone)
|
|
13
|
-
* 3. `git:` on in kraftwerk.yml, `autosync:
|
|
14
|
-
* is committed goes up by itself
|
|
13
|
+
* 3. `git:` on in kraftwerk.yml, `autosync: sync` every 60 s when it was
|
|
14
|
+
* off: what changes is committed and goes up by itself, the others'
|
|
15
|
+
* changes come in (core/git.ts syncNow)
|
|
15
16
|
* 4. the remote: added when there is none; one that already points at the
|
|
16
17
|
* workspace's cloud repo is fine; one of another provider (expert mode)
|
|
17
18
|
* is never replaced
|